Skip to content

Instantly share code, notes, and snippets.

@ofus
Last active December 19, 2015 22:38
Show Gist options
  • Save ofus/6028366 to your computer and use it in GitHub Desktop.
Save ofus/6028366 to your computer and use it in GitHub Desktop.
<?php
$dbh = new PDO("mysql:host=localhost;dbname=muratore", "root", "");
$sql = "SELECT count(*) FROM medrithms WHERE username=:username AND contrasena=:contrasena";
$stmt = $dbh->prepare($sql);
$stmt->execute(Array(':username' => $_POST['username'], ':contrasena' => $_POST['contrasena']));
$authenticated = $stmt->fetch(PDO::FETCH_COLUMN);
if ($authenticated) {
echo "BIENVENIDO";
echo $username;
} else {
echo "USUARIO Y/O CONTRASEÑA INCORRECTO";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment