Php > Authentication
An Authenticator with Cookies and Redirect
An Authenticator with Cookies and Redirect email@address.\n"; exit; } $lim = mysql_num_rows( $dbq ); if ($lim != 1) { $headers=1; //HTML headers in place echo "
Login Page
"; echo "
Invalid User ID or Password. Please Try again
"; } if ($lim == 1) { //make unique session id and store it in Database $timer = md5(time()); $sid = $UserID . "+" . $timer; SetCookie("Cookiename",$sid,time()+2592000); //Set Cookie for 30 days $query = "update members set sid=\"$timer\" where UserID=\"$UserID\""; if( !($dbq = mysql_query( $query, $dblink))) { echo "Unable to update database. Please contact
email@address
.\n"; exit; } $headers=1; header("Location: $redirect"); exit; } } if (isset($Cookiename)) { $headers=1; //make sure HTML headers are in place before the form $sidarray = explode("+", "$Cookiename"); $query = "select * from members where UserID = \"$sidarray[0]\" and sid = \"$sidarray[1] \""; if ( !($dbq = mysql_query($query, $dblink))) { echo "Unable to find database. Please Contact
email@address
.\n"; exit; } if (mysql_num_rows( $dbq ) == 1) { echo "
Login Page
"; echo "You are already logged in as $sidarray[0].
"; echo "You may logon as another user or simply begin using our services with your current session.
"; echo "Click
Here
to return to our homepage."; } } if ($headers == 0) { echo "
Login Page
"; } echo "
"; echo "
User Name
"; echo "
"; echo "
"; echo "
Password
"; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; ?>
Create an Account
email@address.\n"; exit; } if (mysql_num_rows( $dbq ) != 1) { header("Location: http://www.yourdomain.com/login.php3?redirect=thispage.php"); exit; } ?>
Php Codes
Algorithms
Arrays
Authentication
Calendar
Code Snippets
Programs
Content Manage
Contest Related
Cookies
Credit Cards
DBase Related
Databases
Date Time
Directories
E-Mail
Errors
File
File System
Forms
Handling
Graphics
HTML and PHP
Informix
Ingres
InterBase
LDAP
Look and Feel
Miscellaneous
MySQL
Other
PHP Classes
Searching
Navigation
Statistics
Strings
User Manage