Problem in a user auth script. Advice please.
| From: | Matthew Darcy | Date: | Sat, 16 Feb 2002 11:05:15 +0000 |
| Subject: | Problem in a user auth script. Advice please. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-85017@lists.php.net to get a copy of this message | ||
Hi,
After the help given on my last script I got a bit more advanced. I am
trying to write a user auth script and start sessions. I wrote this script
and ran it and I am getting an error on line 4. Once again I cannot see any
problems. I would appriciate you experienced guys casting your eyes over it
and pulling up any errors you see in the functionality.
Thanks,
Matt.
script attatched in file user_auth.txt
<?php include("../dbconnect.php"); include("../functions/common_functions.php"): session_start(); if (!isset($login_username)) { ?> <HTML> <HEAD> <META NAME="GENERATOR" Content="vi"> <META NAME="Author" Content="Matthew Darcy"> <TITLE>BathJobs.com User Login</TITLE> </HEAD> <BODY BGCOLOR=#ffffff LINK=#000000 ALINK=#000000 VLINK=#000000> <FONT FACE=Arial Size=4 Color=black> <P> <FORM METHOD="post" ACTION="<?=$PHP_SELF?>"> <BR><CENTER> BathJobs.com Login <BR><BR> <TABLE BGCOLOR=#ffffff BORDER=0 > <TR BGCOLOR=#191970> <TD BGCOLOR=#191970 width=30 height=30 > <B><FONT color=#ff9900>UserName</FONT> </B> </TD> <TD BGCOLOR=#191970 width=30 height=30 ><INPUT NAME="login_username" SIZE=8 ></TD> </TR> <TR> <TD BGCOLOR=#191970 width=30 height=30 > <B><FONT color=#ff9900>Password </FONT> </B> </TD> <TD BGCOLOR=#191970 width=30 height=30 ><INPUT NAME="login_password" SIZE=8 ></TD> </TR> </TABLE> <BR> <INPUT TYPE="hidden" NAME="user_login_submit_button" VALUE="submit_login" > <INPUT TYPE="submit" NAME="submit_login_details" VALUE="Login"> <BR> </FORM> <P> </P></CENTER></FORM></FONT> </BODY> </HTML> <?php exit; } session_register("login_username"); session_register("login_password"); $sql_authorisation = "SELECT * FROM account_details WHERE account_name='$login_username' AND account_password=PASSWORD('$login_password'); $sql_authorisation_result = mysql_query($sql_authorisation); if (!$result) { error("A Database Error Occurred while trying to authorise login details" "\\nIf this problem persists, please contact support@bathjobs.com"); } if (mysql_num_rows($sql_authorisation_result) == 0) { session_unregister("login_username"); session_unregister("login_password"); ?> <HTML> <HEAD> <TITLE> Access Denied </TITLE> </HEAD> <BODY BGCOLOR=white> <H1> Access Denied </H1> <P> Your user ID and Password could not be verified. This could be an incorrect username or password, or you are not a registered user on this site. Try logging in again checking your details, or enter the signup process to join bathjobs.com</P> </BODY> </HTML> <?php exit; } ?>
<?php include("../dbconnect.php"); include("../functions/common_functions.php"): session_start(); if (!isset($login_username)) { ?> <HTML> <HEAD> <META NAME="GENERATOR" Content="vi"> <META NAME="Author" Content="Matthew Darcy"> <TITLE>BathJobs.com User Login</TITLE> </HEAD> <BODY BGCOLOR=#ffffff LINK=#000000 ALINK=#000000 VLINK=#000000> <FONT FACE=Arial Size=4 Color=black> <P> <FORM METHOD="post" ACTION="<?=$PHP_SELF?>"> <BR><CENTER> BathJobs.com Login <BR><BR> <TABLE BGCOLOR=#ffffff BORDER=0 > <TR BGCOLOR=#191970> <TD BGCOLOR=#191970 width=30 height=30 > <B><FONT color=#ff9900>UserName</FONT> </B> </TD> <TD BGCOLOR=#191970 width=30 height=30 ><INPUT NAME="login_username" SIZE=8 ></TD> </TR> <TR> <TD BGCOLOR=#191970 width=30 height=30 > <B><FONT color=#ff9900>Password </FONT> </B> </TD> <TD BGCOLOR=#191970 width=30 height=30 ><INPUT NAME="login_password" SIZE=8 ></TD> </TR> </TABLE> <BR> <INPUT TYPE="hidden" NAME="user_login_submit_button" VALUE="submit_login" > <INPUT TYPE="submit" NAME="submit_login_details" VALUE="Login"> <BR> </FORM> <P> </P></CENTER></FORM></FONT> </BODY> </HTML> <?php exit; } session_register("login_username"); session_register("login_password"); $sql_authorisation = "SELECT * FROM account_details WHERE account_name='$login_username' AND account_password=PASSWORD('$login_password'); $sql_authorisation_result = mysql_query($sql_authorisation); if (!$result) { error("A Database Error Occurred while trying to authorise login details" "\\nIf this problem persists, please contact support@bathjobs.com"); } if (mysql_num_rows($sql_authorisation_result) == 0) { session_unregister("login_username"); session_unregister("login_password"); ?> <HTML> <HEAD> <TITLE> Access Denied </TITLE> </HEAD> <BODY BGCOLOR=white> <H1> Access Denied </H1> <P> Your user ID and Password could not be verified. This could be an incorrect username or password, or you are not a registered user on this site. Try logging in again checking your details, or enter the signup process to join bathjobs.com</P> </BODY> </HTML> <?php exit; } ?>