473,569 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_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" );
}
}
Jul 17 '05 #1
2 3587

"Nathan Given" <ng****@hotmail .com> wrote in message
news:f7******** *************** ***@posting.goo gle.com...
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" );
}
}


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******** ************@co mcast.com...

"Nathan Given" <ng****@hotmail .com> wrote in message
news:f7******** *************** ***@posting.goo gle.com...
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" );
}
}


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
2260
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 disappears and a few extra links appear instead of the form. - If members log in, i want to redirect them, if succesful, back to the page they logged...
0
1123
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 behavior between the app using the MDB backend and that using the MySQL backend. Several problems seem to boil down to the following: A "Single Form"
3
22915
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 say where the database is? Have anywhere a idee how a can fix this? thank you
8
1957
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 hosting services for about $10/mo that have ASP.NET and MySQL Server along with many other features. I'd like to hear any opinions on using MySQL or any...
3
2441
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 is no common database UserID and password. Each time the user logs in, the DSN UserID and Password screen is displayed. It has three input box...
0
1294
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 2001, and I remember running into a snag. I was able to get the login/pwd to the PHP script on the web server, via the shared SSL connection with no...
31
2148
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 West the program zips along fine but the folks in the East Coast are having a nightmarish performance issue. We've had our tech guys take a look...
9
3573
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 "myDB" with a table "myUsers" with fields "Username" and "Password". I also have the MySQL ODBC driver loaded with a DSN "dsnMySQL" setup. ...
2
2656
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 test database site which used to be mirrors. Someone else did upgrade work on the real site which I must troubleshoot because they are gone. ...
0
7701
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7677
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.