add function user exist
This commit is contained in:
parent
091181c859
commit
50705e1234
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
//SELECT * FROM `projetphp` WHERE `login` = 'aaazzze'
|
||||||
|
function userExist($login){
|
||||||
|
$req = $bdd->prepare('SELECT * FROM `projetphp` WHERE `login` = :login');
|
||||||
|
$req->execute(array('login' => htmlspecialchars($_POST["userToDel"])));
|
||||||
|
if($req->rowCount() != 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
Loading…
Reference in New Issue