I did get my password cookie to work whit my loginscript so i found a script at planetsourcecode and i tried it but it didn't work... i get a parse error on line 16 that the
else{
header("Location: $SCRIPT_NAME");
}
i can't figure it out... And i need a good cookie script for my webpage and fast... if someone know of a working one or can figure out why it acts like i does please help me... I posted the whole script inhere for you to see..
<?
if($username && $password) {
mysql_connect() or die ("Whoops");
$password = md5($password);
$sql = "select * from users where username='$username'";
$r = mysql_db_query("reg_users",$sql);
if(!mysql_num_rows($r)) {
header("Location: $SCRIPT_NAME");
}
$user = mysql_fetch_array($r);
if($user["password"] == $password) {
$password = serialize($password);
setcookie("utkastare_cookie","$username $password");
$msg = "<meta http-equiv=\"Refresh\" content=\"0;url=langtrue/utkastarsite/index.php">";
}else{
header("Location: $SCRIPT_NAME");
}
}
if($msg) echo $msg;
?>
<head><title>Login form</title></head>
<body bgcolor="#ffffff">
<form action="<?echo $SCRIPT_NAME;?>" target="_blank" method="post">
<table border="0">
<tr>
<td><strong>Username</strong></td>
<td><input type="text" name="username" size="10" maxsize="50"></td>
</tr>
<tr>
<td><strong>Password</strong></td>
<td><input type="password" name="password" size="10" maxsize="50"></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Auth me">
</td>
</tr>
</table>
</form>
</body>
//T-man
ps. I know nothing about cookie setting, thats why i downloaded the script ds.