Page 1 of 1

custom login?

Posted: Fri Aug 30, 2002 11:59 pm
by NJ Termite
hello all, i fairly new to php, I'm making a custom log in page, im useing a html form to proses the user name and password. I have a few questions


How does php check to see if the user and password is correct? any sample code would be help full

Thanks,
Mark

Posted: Sat Aug 31, 2002 12:03 am
by Dale
If you have a host with PHP and MySQL on it then this is a EXCELLENT tutorial:

http://robouk.mchost.com/tuts/tutorial. ... rial=login

Posted: Sat Aug 31, 2002 1:09 am
by NJ Termite
thanks for the link, one question do i put this code together like this?

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Login Signup!</title>
</head>
<body>
<form action="register.php" method="Post">
What is your desired Username? <input type="text" name="name"><br>
What is your password? <input type="password" name="password"><br>
<input type="submit" name="submit">
</form>
</body>
</html>

<?php

include('config.php');

$uname = $_POST['name'];
$upass = $_POST['password'];

$sql = "INSERT INTO $table VALUES ('', '$uname', md5('$upass'))";

if(!$result = mysql_query($sql)) die(mysql_error());

echo "Registered Successfully. <a href=\"login.html\">Continue</a> to the members page.";

?>

Posted: Sat Aug 31, 2002 1:16 am
by Dale
i thyink so... im still a n00b at php :)