You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
618 B

<?php
//SELECT * FROM `projetphp` WHERE `login` = 'aaazzze'
function userExist($login){
try {
$config = include('config.php');
$bdd = new PDO('mysql:host='.$config['host'].';dbname='.$config['dbName'].';charset=utf8', $config['username'], $config['pw']);
} catch (Exception $e) {
die('Erreur : '.$e->getMessage());
}
$req = $bdd->prepare('SELECT * FROM `projetphp` WHERE `login` = :login');
$req->execute(array('login' => htmlspecialchars($login)));
if($req->rowCount() != 0)
{
$req->closeCursor();
return true;
}
else {
$req->closeCursor();
return false;
}
}
?>