|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Help With Login Scripts
I'm very new with PHP/mysql, i just design my login page. But seems like i can't login using my own email and password. Can any one tell me where i'm doing wrong. Can any one help with this.Thanks . The scripts i'm using is as follows:
<?php // // db.private // This file holds the $username and $password variables etc // Read how to protect your password in db.private/db.inc // $hostname = "localhost"; $databaseName = "xxxxxxx"; // Change these values to your own database name $username = "xxxxx"; // user id and password. $password = "xxxxxx"; ?> <?php // *** Start the session session_start(); // *** Validate request to log in to this site. $FF_LoginAction = $HTTP_SERVER_VARS['PHP_SELF']; if (isset($HTTP_SERVER_VARS['QUERY_STRING']) && $HTTP_SERVER_VARS['QUERY_STRING']!="") $FF_LoginAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING']; if (isset($HTTP_POST_VARS['email'])) { $FF_valUsername=$HTTP_POST_VARS['email']; $FF_valPassword=$HTTP_POST_VARS['password']; $FF_fldUserAuthorization=""; $FF_redirectLoginSuccess="bookings/yourbookings.php"; $FF_redirectLoginFailed="failedlogin.php"; $FF_rsUser_Source="SELECT Email, password "; if ($FF_fldUserAuthorization != "") $FF_rsUser_Source .= "," . $FF_fldUserAuthorization; $FF_rsUser_Source .= " FROM customer WHERE Email='" . $FF_valUsername . "' AND password='" . $FF_valPassword . "'"; $connection = mysql_connect($hostname,$username,$password); mysql_select_db($databaseName, $connection); $FF_rsUser=mysql_query($FF_rsUser_Source, $connection) or die(mysql_error()); $row_FF_rsUser = mysql_fetch_assoc($FF_rsUser); if(mysql_num_rows($FF_rsUser) > 0) { // username and password match - this is a valid user $MM_Username=$FF_valUsername; session_register("MM_Username"); if ($FF_fldUserAuthorization != "") { $MM_UserAuthorization=$row_FF_rsUser[$FF_fldUserAuthorization]; } else { $MM_UserAuthorization=""; } session_register("MM_UserAuthorization"); if (isset($accessdenied) && false) { $FF_redirectLoginSuccess = $accessdenied; } mysql_free_result($FF_rsUser); session_register("FF_login_failed"); $FF_login_failed = false; $resouser = $_POST['email']; $resouser = stripslashes($resouser); session_register('resouser'); $_SESSION['resouser'] = $resouser; header ("Location: $FF_redirectLoginSuccess"); exit; } mysql_free_result($FF_rsUser); session_register("FF_login_failed"); $FF_login_failed = true; header ("Location: $FF_redirectLoginFailed"); exit; } ?> |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Help With Login Scripts |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|