473,395 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

PHP Login Problems (with MySQL backend database)

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_register( "email" );
session_register( "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_register( "email" );
session_register( "passwd" );
# setcookie( "email", $email, time()+3600*24*365 );
if( isset( $cat ) ) header( "Location: ./list.php?cat=$cat" );
if( $cat == "" ) header( "Location: ./account.php" );
}
}
Jul 17 '05 #1
2 3580

"Nathan Given" <ng****@hotmail.com> wrote in message
news:f7**************************@posting.google.c om...
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_register( "email" );
session_register( "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_register( "email" );
session_register( "passwd" );
# setcookie( "email", $email, time()+3600*24*365 );
if( isset( $cat ) ) header( "Location: ./list.php?cat=$cat" );
if( $cat == "" ) header( "Location: ./account.php" );
}
}


is your *** if( $action == "login" ) ** loop being called ?
where is $cat set ?

Jul 17 '05 #2
When the email and the password is held against your database, you should do
a SELECT email,password FROM user WHERE email='$email' otherwise mySQL
doesn't return the value for your password field???

..Nico

<xyzzy> schreef in bericht news:hr********************@comcast.com...

"Nathan Given" <ng****@hotmail.com> wrote in message
news:f7**************************@posting.google.c om...
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_register( "email" );
session_register( "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_register( "email" );
session_register( "passwd" );
# setcookie( "email", $email, time()+3600*24*365 );
if( isset( $cat ) ) header( "Location: ./list.php?cat=$cat" );
if( $cat == "" ) header( "Location: ./account.php" );
}
}


is your *** if( $action == "login" ) ** loop being called ?
where is $cat set ?

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: frizzle | last post by:
Hi Group, I have a site with a MySQL backend. It has a member-system. Members login with a small login-form that appears on every page (via include()) If members are logged in, the form...
0
by: David Emme | last post by:
Win XP Pro Access 97 MySQL 4.0.x I'm attempting to convert a number of apps to MySQL backends. Having converted the tables from the MDB backend, I'm running into a number of differences in...
3
by: Michael S | last post by:
only my server get the report whitout the dialogue database login. I think it is where the database is localhost and the crystal report know not the connection string. how I can crystal reports...
8
by: Brett | last post by:
I've been developing in CFMX with an SQL Server 2000 backend. For cost reasons, I want to switch to a different database. I'm also moving away from CFMX to ASP.NET. There are quite a few...
3
by: bala | last post by:
Hi Gurus The scenario A MS Access frontend application with Oracle Backend (Linked Tables). The Database UserID and password is not stored and each user has a unique UserID and password. There...
0
by: www.gerardvignes.com | last post by:
I'm adding secure login to a PHP 3 web application on Linux/Apache. I can't afford my own SSL certificate, so I'm using the shared SSL provided by my web hosting company. I tried this back in...
31
by: louishong | last post by:
3rd time posting this as the first two simply disappeared! Here's the issue: We currently run an Access application in the West Coast for tracking resource centric data. For those located in the...
9
by: Ben | last post by:
Hello, I'll bet this has been asked a million times but I can't seem to find a thread that gives the clear example I need. This PC has MySQL and IIS configured and running. The MySQL database is...
2
by: JRough | last post by:
I cannot log into our web site. I have a test web site and a real site. On Friday I could log in and today Monday I cannot log in. I have 2 databases In PHPMyAdmin, the real database and and a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.