Цитата (Egorka @ 21.04.2014 - 13:41) |
if (isset($_COOKIE['cookie'])) { foreach ($_COOKIE['cookie'] as $name => $value) { $name = htmlspecialchars($name); $value = htmlspecialchars($value); } } |
setcookie("cookie[admin]", md5("adminpsw"),time()+3600,"/admin/");
$value == md5('adminpsw')
header('Location:http://localhost/admin/index.php');А вот весь код:
if (isset($_COOKIE['cookie'])) {
foreach ($_COOKIE['cookie'] as $name => $value) {
$name = htmlspecialchars($name);
$value = htmlspecialchars($value);
}
}
If (($name == '21232f297a57a5a743894a0e4a801fc3') and ($value == '21232f297a57a5a743894a0e4a801fc3'))
{
header('Location:http://localhost/admin/pages.php');
exit;
}
else
{
echo '<form method="post">
Логин: <input type="text" name="login" />
Пароль: <input type="password" name="pass" />
<input type="submit" name="submit" value="Войти" />
</form>';
$_POST['login'] = $login;
$_POST['pass'] = $pass;
$_POST['sumbit'] = $sumbit;
If (isset($sumbit)){
If ((md5($pass) == '21232f297a57a5a743894a0e4a801fc3') and (md5($login) == '21232f297a57a5a743894a0e4a801fc3')){
setcookie("cookie[21232f297a57a5a743894a0e4a801fc3]", "21232f297a57a5a743894a0e4a801fc3",time()+3600,"/admin/");
header('Location:http://localhost/admin/pages.php');
exit;
}
else
{
header('Location:http://localhost/admin/index.php');
}
}
else
{
header('Location:http://localhost/admin/index.php');
exit;
}
}