Hvorfor virker min kode ikke.
Hvorfor virker min kode ikke? Når jeg prøver at logge ind får jeg error lige meget hvad. Har tjekket at mit pass bliver krypteret ens. Her er min kode:<?
session_start();
$mysqli = new mysqli("xxx", "xxx", "xxx", "xxx");
if (mysqli_connect_errno()) {
printf("Connect failed: %sn", mysqli_connect_error());
exit();
}
$loginmail = strip_tags(htmlspecialchars($_POST['loginmail']));
$loginpass = strip_tags(htmlspecialchars($_POST['loginpass']));
$salt = md5($loginpass.'£%h¤,P2/<${]');
$insertpass = md5('$salt$loginpass$salt');
$sql = 'SELECT `id`, `mail`, `navn`, `pass`, `alder`, `admin` FROM user WHERE mail = ? AND pass = ?';
$stmt = $mysqli->prepare($sql);
$stmt->bind_param("ss", $loginmail, $insertpass);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($id, $mail, $navn, $pass, $alder, $admin);
$stmt->fetch();
$stmt->free_result();
if(!$id || !$mail || !$navn || !$pass || !$alder || !$admin){
echo 'error';
}else{
$secid = $id + 860983239;
$rand = md5('$secid$secid$secid');
$salt = md5($rand.'Sl!Qm?P');
$ip = md5('$salt$_SERVER["REMOTE_ADDR"]$salt');
$admintjek = 1;
$_SESSION['navn'] = $navn;
$_SESSION['mail'] = $mail;
$_SESSION['id'] = $id;
$_SESSION['ip'] = $ip;
$_SESSION['login'] = md5(323695175);
$salt2 = md5($pass.'Sl!Qm?P');
$tjekadmin = md5('$salt2$admintjek$salt2');
if($admin = $tjekadmin){
$_SESSION['admin'] = md5('589649036');
}else{
$_SESSION['admin'] = md5('733325894');
}
header('Location: http://www.mit.deplex.dk/logged_in.php');
}
?>