projetphp/function.php

21 lines
568 B
PHP
Raw Normal View History

2019-01-02 11:48:16 +01:00
<?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;
}
}
?>