PHPBuilder - Simple Login Script

RSS Twitter

Simple Login Script

by: Matt Slavin
December 3, 2001

Version: 1

Type: Sample Code (HOWTO)

Category: HTTP

License: GNU General Public License

Description: This will work on all https and http securely without knocken overhead down. And its just plain simple

# Login Code Written by Matt Slavin
# Email Me At for questions or comments.

if((!$Username) | (!$Password)) {
print ("Please Enter In THe Correct Name");


# This part is sort if ya want to. I would suggest it.
# Make your login page have the main value of Password
#Comment Out if you Want too
$Password = md5($Password);

$sql = "select * from My_Table where Password=$Password and Username=$Username";
$result = mysql_query($sql);
$num = mysql_numrows($result);

# If Login Is Okay Do What You Want TO DO to Them
if ($num == "1") {
print ("Logged in okay");
#Or you can send them somwhere nice like hawaii
header("Location: http://www.hawii");
# or even fetch feild about them or save sessions

# And we must a have a default error message if login fails
if ($num == "0"){
print ("Sorry Bub You Need Some Manners In Password");


Comment and Contribute

Your comment has been submitted and is pending approval.

Matt Slavin



(Maximum characters: 1200). You have characters left.