error with login

This is a discussion on "error with login" within the PHP Forum section. This forum, and the thread "error with login are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Mar 19th, 2007, 19:41
simonb's Avatar
Blog Moderator

Join Date: Dec 2006
Location: Norwich
Posts: 675
Blog Entries: 4
Thanks: 4
Thanked 2 Times in 2 Posts
Send a message via Skype™ to simonb
error with login

what is going on on this page
Code: Select all
<?php virtual('/Connections/working.php'); ?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['username'])) {
  $loginUsername=$_POST['username'];
  $password=$_POST['password'];
  $MM_fldUserAuthorization = "UsertypeID";
  $MM_redirectLoginSuccess = "/admin/index.php";
  $MM_redirectLoginFailed = "/admin/loginfailed.php";
  $MM_redirecttoReferrer = true;
  mysql_select_db($database_working, $working);
      
  $LoginRS__query=sprintf("SELECT Username, Userpassword, UsertypeID FROM User WHERE Username='%s' AND Userpassword='%s'",
  get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); 
   
  $LoginRS = mysql_query($LoginRS__query, $working) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
    
    $loginStrGroup  = mysql_result($LoginRS,0,'UsertypeID');
    
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;          

    if (isset($_SESSION['PrevUrl']) && true) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];    
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
Reply With Quote

  #2 (permalink)  
Old Mar 20th, 2007, 11:41
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: error with login

what errors are you getting?
Reply With Quote
  #3 (permalink)  
Old Mar 20th, 2007, 15:19
simonb's Avatar
Blog Moderator

Join Date: Dec 2006
Location: Norwich
Posts: 675
Blog Entries: 4
Thanks: 4
Thanked 2 Times in 2 Posts
Send a message via Skype™ to simonb
Re: error with login

um
Quote:
Fatal error: Call to undefined function: virtual() in /home/betanew/public_html/henry/admin/login.php on line 1
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
Reply With Quote
  #4 (permalink)  
Old Mar 20th, 2007, 17:26
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: error with login

this is what's going on:

Fatal error: Call to undefined function: virtual() in /home/betanew/public_html/henry/admin/login.php on line 1

Your code is calling a function which either doesn't exist or it can't find.

A simple google search for "php virtual" gives this page:
http://uk2.php.net/function.virtual

And by the looks of it, virtual() is an apache function so you'll probably get an error if you're trying to run this code on IIS.
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #5 (permalink)  
Old Mar 20th, 2007, 17:36
simonb's Avatar
Blog Moderator

Join Date: Dec 2006
Location: Norwich
Posts: 675
Blog Entries: 4
Thanks: 4
Thanked 2 Times in 2 Posts
Send a message via Skype™ to simonb
Re: error with login

i put a include() tag and now look

Quote:
Warning: main(/Connections/working.php) [function.main]: failed to open stream: No such file or directory in /home/betanew/public_html/henry/admin/login.php on line 1

Warning: main(/Connections/working.php) [function.main]: failed to open stream: No such file or directory in /home/betanew/public_html/henry/admin/login.php on line 1

Warning: main() [function.include]: Failed opening '/Connections/working.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/betanew/public_html/henry/admin/login.php on line 1

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/betanew/public_html/henry/admin/login.php:1) in /home/betanew/public_html/henry/admin/login.php on line 5

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/betanew/public_html/henry/admin/login.php:1) in /home/betanew/public_html/henry/admin/login.php on line 5
SELECT Username,Userpassword,UserTypeID FROM Users WHERE Username='#FORM.username#' AND Userpassword='#FORM.password#' AND Admin = AND Allowed =
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
Reply With Quote
  #6 (permalink)  
Old Mar 20th, 2007, 18:13
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: error with login

session_start(); has to be the very first thing it loads and since you are including a page that has headers ... it doesn't like it.

the first 3 is a problem loading your include file ... check the path. You can't do include(/include/ ... ) it has to be something like include(../include/...)
Reply With Quote
  #7 (permalink)  
Old Mar 20th, 2007, 18:19
simonb's Avatar
Blog Moderator

Join Date: Dec 2006
Location: Norwich
Posts: 675
Blog Entries: 4
Thanks: 4
Thanked 2 Times in 2 Posts
Send a message via Skype™ to simonb
Re: error with login

ok i have got rid of the includes

but look now
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
Reply With Quote
  #8 (permalink)  
Old Mar 20th, 2007, 18:36
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: error with login

look where?
do you have a link for this?
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #9 (permalink)  
Old Mar 20th, 2007, 18:38
simonb's Avatar
Blog Moderator

Join Date: Dec 2006
Location: Norwich
Posts: 675
Blog Entries: 4
Thanks: 4
Thanked 2 Times in 2 Posts
Send a message via Skype™ to simonb
Re: error with login

oh sorry
http://henry.noloafing.co.uk/admin/login.php

the the same
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
Reply With Quote
  #10 (permalink)  
Old Mar 20th, 2007, 18:52
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: error with login

Here's your answer, exactly what Karinne said:
Quote:
Originally Posted by karinne View Post
session_start(); has to be the very first thing it loads and since you are including a page that has headers ... it doesn't like it.

the first 3 is a problem loading your include file ... check the path. You can't do include(/include/ ... ) it has to be something like include(../include/...)
Sorry, I had skipped it before...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #11 (permalink)  
Old Mar 20th, 2007, 18:55
simonb's Avatar
Blog Moderator

Join Date: Dec 2006
Location: Norwich
Posts: 675
Blog Entries: 4
Thanks: 4
Thanked 2 Times in 2 Posts
Send a message via Skype™ to simonb
Re: error with login

i tryed that and got a big error
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
Reply With Quote
  #12 (permalink)  
Old Mar 20th, 2007, 19:06
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: error with login

"a big error"
Shame IPv5 doesn't support thought transfer protocols...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #13 (permalink)  
Old Mar 20th, 2007, 19:19
simonb's Avatar
Blog Moderator

Join Date: Dec 2006
Location: Norwich
Posts: 675
Blog Entries: 4
Thanks: 4
Thanked 2 Times in 2 Posts
Send a message via Skype™ to simonb
Re: error with login

Quote:
Originally Posted by spinal007 View Post
Shame IPv5 doesn't support thought transfer protocols...
what
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
Reply With Quote
  #14 (permalink)  
Old Mar 20th, 2007, 23:25
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: error with login

That was a joke mate.
We can't help if you say you 'got a big error'
What was the error?
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #15 (permalink)  
Old Mar 21st, 2007, 06:38
simonb's Avatar
Blog Moderator

Join Date: Dec 2006
Location: Norwich
Posts: 675
Blog Entries: 4
Thanks: 4
Thanked 2 Times in 2 Posts
Send a message via Skype™ to simonb
Re: error with login

Quote:
Warning: main(/Connections/working.php) [function.main]: failed to open stream: No such file or directory in /home/betanew/public_html/henry/admin/login.php on line 1

Warning: main(/Connections/working.php) [function.main]: failed to open stream: No such file or directory in /home/betanew/public_html/henry/admin/login.php on line 1

Warning: main() [function.include]: Failed opening '/Connections/working.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/betanew/public_html/henry/admin/login.php on line 1

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/betanew/public_html/henry/admin/login.php:1) in /home/betanew/public_html/henry/admin/login.php on line 5

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/betanew/public_html/henry/admin/login.php:1) in /home/betanew/public_html/henry/admin/login.php on line 5
SELECT Username,Userpassword,UserTypeID FROM Users WHERE Username='#FORM.username#' AND Userpassword='#FORM.password#' AND Admin = AND Allowed =

that one happened when i move the session_start();
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
Reply With Quote
  #16 (permalink)  
Old Mar 21st, 2007, 10:45
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: error with login

PROBLEM 1:
You're trying to include a file that can't be found.

I'm assuming your folder structure is...
{ROOT}/Connections/
{ROOT}/admin/
{ROOT}/etc/

So,
<?php virtual('/Connections/working.php'); ?>
LOOKS FOR: {ROOT}/Connections/working.php
But this only works on Apache.

<?php include('/Connections/working.php'); ?>
LOOKS FOR: {ROOT}/admin//Connections/working.php
Which is probably what you have at the moment.

<?php include('../Connections/working.php'); ?>
LOOKS FOR: {ROOT}/Connections/working.php
BINGO!

PROBLEM 2:
Look for session_start(); in ALL your code and make sure there's only ONE.

PROBLEM 3:
You're never gonna get the hang of this if you don't try. Just mess about with the code and it will work. This is a simple enough problem that any PHPer wannabe should be able to solve, specially after the pointers we've already given. There is a lot of people in this forum willing to help but we can't spoon-feed you all the way along...
I mean this nicely, with lots of love and sugar on top! LOL
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #17 (permalink)  
Old Mar 21st, 2007, 11:49
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: error with login

Quote:
Originally Posted by spinal007 View Post
PROBLEM 1:
You're trying to include a file that can't be found.

I'm assuming your folder structure is...
{ROOT}/Connections/
{ROOT}/admin/
{ROOT}/etc/

So,
<?php virtual('/Connections/working.php'); ?>
LOOKS FOR: {ROOT}/Connections/working.php
But this only works on Apache.

<?php include('/Connections/working.php'); ?>
LOOKS FOR: {ROOT}/admin//Connections/working.php
Which is probably what you have at the moment.

<?php include('../Connections/working.php'); ?>
LOOKS FOR: {ROOT}/Connections/working.php
BINGO!
Didn't I say that already?!
Reply With Quote
  #18 (permalink)  
Old Mar 21st, 2007, 18:51
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: error with login

I know... and when I read your post I thought it would be the end of this thread but here we are....

which is why I made a point of mentioning PROBLEM 3 (see previous post)
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #19 (permalink)  
Old Mar 21st, 2007, 19:26
simonb's Avatar
Blog Moderator

Join Date: Dec 2006
Location: Norwich
Posts: 675
Blog Entries: 4
Thanks: 4
Thanked 2 Times in 2 Posts
Send a message via Skype™ to simonb
Re: error with login

i got it to work
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
Reply With Quote
  #20 (permalink)  
Old Mar 21st, 2007, 19:55
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: error with login

Well done...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
Reply

Tags
error with login

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads