This would be the script for the login form
<html>
<title>Login</title>
<body>
<form action="userlogin.php">
Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br>
<input type="submit" value="login">
</form>
save that as login.html then make a file called userlogin.php
and put this in it...
<?php
//Check for required forms in the fields
if (empty($_POST["username"])) || (empty($_POST["password"])))
{
header("Location: login.html");
exit;
}
//Connects to database
$mysqli = mysqli_connect("Your Mysql server", "Databases Username", "Databases Password", "Database Name");
//Create and issue the query
$sql = "SELECT * FROM auth_users WHERE username = '".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')";
$result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
//get the number of rows in the result set; should be 1 if a match
if (mysqli_num_rows($result) == 1) {
//Set Authorization Cookie
setcookie("auth", "1", 0, "/", "Your Websites Name", 0);
?>
<body>You Are Authorized!!!</body>
<?
} else {
?>
<body>You are unauthorized </body>
<?
}
?>
But you have to have a database for this one :biggrin: sorry if I made a stupid typo, I hope I didn't
