setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM admins WHERE email=:email");
$stmt->bindParam(':email', $_POST['email']);
$stmt->execute();
$row = $stmt->fetch();
if (password_verify($_POST['password'], $row['password'])){
$_SESSION['admin'] = true;
} else {
$_SESSION['admin'] = false;
}
} catch (PDOException $e) {
echo "
Error!: " . $e->getMessage() . "
";
}
$stmt=null;
$conn=null;
}
?>
Yota Callplan
';
echo "\n";
echo "";
echo "Ime | ";
echo "Prezime | ";
echo "Godine | ";
echo "Actions | ";
echo "
\n";
foreach($conn->query("SELECT * FROM activities WHERE approved = false") as $row) {
echo "";
echo "" . $row['name'] . " | ";
echo "" . $row['surname'] . " | ";
echo "" . $row['age'] . " | ";
echo ' | ';
echo "
\n";
}
echo "
\n\n";
} catch (PDOException $e) {
echo "Error!: " . $e->getMessage() . "
";
}
} else {
# Bad pass check...
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_SESSION['admin']) && $_SESSION['admin'] == false) echo "Bad credentials!";
# Login form
echo '';
}
?>