handle.hp

Kan ikke logge ind med mine ændringer til stmt .
mail@pastecode.io avatar
unknown
php
3 years ago
1.2 kB
29
Indexable
Never
if(isset($_POST['logon'])){
	$nickName = filter_input(INPUT_POST, 'nickname', FILTER_SANITIZE_STRING);
	$password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);  
    $profileID = 0;
    $status = "";
    $stmt = $campist->prepare("SELECT profileID, nickname, password FROM login WHERE nickname=? AND password=? LIMIT 1");
    $stmt->bind_param('ss', $nickname, $password);
    $stmt->execute();
    $stmt->bind_result($profileID, $nickname, $password, $status);
    $stmt->store_result();

	$result = $stmt->get_result(); / ??
	$row = $result->fetch_assoc(); // ??
	
	
    if(password_verify($password, $row['password']) AND $stmt->num_rows == 1) {
			

            if($stmt->fetch()) //fetching the contents of the row
            {
               if ($status == 2) {
                   echo "Din konto er ikke aktiveret";
                   exit();
               } else {
				   $_SESSION['loggetindsom'] = $nickname;
                   $_SESSION['user_id'] = $profileID;
                   echo 'Logger ind!';
                   exit();
               }
           }

    }
    else {
        echo "Kunne ikke logge ind!";
    }
    $stmt->close();
}
else 
{   

}


$campist->close();