#native_company# #native_desc#
#native_cta#

Simple Login Script

By Matt Slavin
on 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 [email protected] for questions or comments.

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

mysql_connect("localhost","User_Name_here","Password_Here");
mysql_select_db("My_Database_Here");

# 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");
exit;
# or even fetch feild about them or save sessions
session_start();
session_register(Username);
}

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


?>