Hi all,
I have just put together a simple log in script from various tutorials on the web and at the moment it is only checking the username entered by the user against what is in my database.
I cant find any infromation about any kind of AND function or any other check the password as well as the username so thats what i need help with
here is what i have already:
<?php
// Connects to your Database
mysql_connect("", "", "") or die(mysql_error());
mysql_select_db("") or die(mysql_error());;
$uname = $_POST['uname'];
$pword = $_POST['pword'];
//gets username and password from uname and pword fields on previous page
$result = mysql_query("SELECT * FROM logins WHERE uname='$uname'");
if($row = mysql_fetch_array($result))
{
setcookie("loggedin", "$uname", time()+3600);
echo "logged in as: ";
echo $row['uname'];
echo "<br />and cookie written.";
echo "<br />";
echo 'click <a href="cookie.php">here</a> to view cookie information.<br/><a href="login.php">Back to login page.</a>';
}
else
{
echo "wrong login information";
}
?>
Thanks guyyys :D
Max