I run a book exchange web site based in PHP with a mysql database.
Many users have having trouble logging in.
Here is a description of the problem.
A user types in his/her username and password and hits login. The
browser thinks for a bit then the login screen comes up again and
nothing has happened (except now the username and password fields are
blank).
Here is a snippet of the code...
session_registe r( "email" );
session_registe r( "passwd" );
#setcookie( "email", $email, time()+3600*24* 365 );
I commented out the setcookie function because many users use the same
computer and they were able to use the same computer with the
setcookie function in there.
Please help!
Thanks in advance!
--
Nathan
Here is all of the code...
if( $action == "login" )
{
$email = trim( $email );
$passwd = trim( $passwd );
if( $email == "" ) error( "Please enter your e-mail" );
if( $passwd == "" ) error( "Please enter your password" );
dbConnect();
$result = mysql_query( "SELECT email FROM user WHERE
email='$email'" ) or error( mysql_error() );
if( mysql_num_rows( $result ) != 1 ) error( "Sorry, e-mail doesn't
exist" );
$result = mysql_query( "SELECT email FROM user WHERE email='$email'
AND passwd='$passwd '" ) or error( mysql_error() );
if( mysql_num_rows( $result ) != 1 ) error( "Sorry, invalid
password" );
else
{
session_registe r( "email" );
session_registe r( "passwd" );
# setcookie( "email", $email, time()+3600*24* 365 );
if( isset( $cat ) ) header( "Location: ./list.php?cat=$c at" );
if( $cat == "" ) header( "Location: ./account.php" );
}
}
Many users have having trouble logging in.
Here is a description of the problem.
A user types in his/her username and password and hits login. The
browser thinks for a bit then the login screen comes up again and
nothing has happened (except now the username and password fields are
blank).
Here is a snippet of the code...
session_registe r( "email" );
session_registe r( "passwd" );
#setcookie( "email", $email, time()+3600*24* 365 );
I commented out the setcookie function because many users use the same
computer and they were able to use the same computer with the
setcookie function in there.
Please help!
Thanks in advance!
--
Nathan
Here is all of the code...
if( $action == "login" )
{
$email = trim( $email );
$passwd = trim( $passwd );
if( $email == "" ) error( "Please enter your e-mail" );
if( $passwd == "" ) error( "Please enter your password" );
dbConnect();
$result = mysql_query( "SELECT email FROM user WHERE
email='$email'" ) or error( mysql_error() );
if( mysql_num_rows( $result ) != 1 ) error( "Sorry, e-mail doesn't
exist" );
$result = mysql_query( "SELECT email FROM user WHERE email='$email'
AND passwd='$passwd '" ) or error( mysql_error() );
if( mysql_num_rows( $result ) != 1 ) error( "Sorry, invalid
password" );
else
{
session_registe r( "email" );
session_registe r( "passwd" );
# setcookie( "email", $email, time()+3600*24* 365 );
if( isset( $cat ) ) header( "Location: ./list.php?cat=$c at" );
if( $cat == "" ) header( "Location: ./account.php" );
}
}
Comment