AIidE/php/utilities/functions.php
2021-09-09 23:55:45 +02:00

39 lines
1021 B
PHP

<?php
$dbh = new PDO('mysql:host=dwarves.iut-bleau.fr;dbname=dupard', "dupard", "Dd77sfr2002");
function register($mail, $promo, $pass)
{
$request = "INSERT INTO AIIDE_INSCRIPTIONS VALUES(?, ?, ?);";
$pdo = $dbh->prepare($request);
$pdo->execute(array($mail, $promo, $pass));
}
function validate_register($mail, $login)
{
$request = "SELECT * FROM AIIDE_INSCRIPTIONS WHERE MAIL=?";
$pdo = $dbh->prepare($request);
$pdo->execute(array($mail));
$user = $pdo->fetch();
if($user)
{
include_once "roles.php";
$request_insert = "INSERT INTO AIIDE_USERS VALUES(?, ?, ?, ?, ?)";
$request_delete = "DELETE FROM AIIDE_INSCRIPTIONS WHERE MAIL=?";
$insert = $dbh->prepare($request_insert);
$insert->execute(array($user->MAIL, $user->LOGIN, $user->PROMO, $roles["std"], $user->PASSWD));
$delete = $dbh->prepare($request_delete);
$delete->execute(array($user->mail));
}
}
// A compléter
function reject_register($mail)
{
}
?>