Sorri, here is the code... 🙂
if (($POST["username"] == $name[0]) && ($POST["password"] == $pass[0])) {
$date = getdate();
$str_ulogin = "$date[mday] $date[mon]";
$str_ulogin = implode("", unpack("H", $str_ulogin));
$r1 = mt_rand(0,9) . mt_rand(0,9);
$r2 = mt_rand(0,9) . mt_rand(0,9);
$r3 = mt_rand(0,9) . mt_rand(0,9);
preg_match("/(.{2})(.{2})(.{2})(.?)$/", $str_ulogin, $reg);
$str_ulogin = $reg[1] . $r1 . $reg[2] . $r2 . $reg[3] . $r3 . $reg[4];
setcookie("alogin",$str_ulogin,"");
header("Location: http://localhost/admin/admin.php");
exit;
}