add function user exist

This commit is contained in:
adri 2019-01-02 11:48:16 +01:00
parent 091181c859
commit 50705e1234
1 changed files with 20 additions and 0 deletions

20
function.php Normal file
View File

@ -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;
}
}
?>