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.


 Subscribe in a reader

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

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Mar 19th, 2007, 19:41
Highly Reputable Member
Join Date: Dec 2006
Location: Norwich
Posts: 721
Blog Entries: 4
Thanks: 6
Thanked 2 Times in 2 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Mar 20th, 2007, 15:19
Highly Reputable Member
Join Date: Dec 2006
Location: Norwich
Posts: 721
Blog Entries: 4
Thanks: 6
Thanked 2 Times in 2 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Mar 20th, 2007, 17:26
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Mar 20th, 2007, 17:36
Highly Reputable Member
Join Date: Dec 2006
Location: Norwich
Posts: 721
Blog Entries: 4
Thanks: 6
Thanked 2 Times in 2 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Mar 20th, 2007, 18:13
Elite Veteran
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/...)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Mar 20th, 2007, 18:19
Highly Reputable Member
Join Date: Dec 2006
Location: Norwich
Posts: 721
Blog Entries: 4
Thanks: 6
Thanked 2 Times in 2 Posts
Re: error with login

ok i have got rid of the includes

but look now
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Mar 20th, 2007, 18:36
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
Re: error with login

look where?
do you have a link for this?
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Mar 20th, 2007, 18:38
Highly Reputable Member
Join Date: Dec 2006
Location: Norwich
Posts: 721
Blog Entries: 4
Thanks: 6
Thanked 2 Times in 2 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Mar 20th, 2007, 18:52
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Mar 20th, 2007, 18:55
Highly Reputable Member
Join Date: Dec 2006
Location: Norwich
Posts: 721
Blog Entries: 4
Thanks: 6
Thanked 2 Times in 2 Posts
Re: error with login

i tryed that and got a big error
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Mar 20th, 2007, 19:06
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Mar 20th, 2007, 19:19
Highly Reputable Member
Join Date: Dec 2006
Location: Norwich
Posts: 721
Blog Entries: 4
Thanks: 6
Thanked 2 Times in 2 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old Mar 20th, 2007, 23:25
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old Mar 21st, 2007, 06:38
Highly Reputable Member
Join Date: Dec 2006
Location: Norwich
Posts: 721
Blog Entries: 4
Thanks: 6
Thanked 2 Times in 2 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16  
Old Mar 21st, 2007, 10:45
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #17  
Old Mar 21st, 2007, 11:49
Elite Veteran
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?!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #18  
Old Mar 21st, 2007, 18:51
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: G