32 lines
625 B
PHP
32 lines
625 B
PHP
|
<?php
|
||
|
session_start();
|
||
|
|
||
|
require_once 'connexionbdd.php';
|
||
|
|
||
|
if(!isset($_POST['pseudo'], $_POST['password']))
|
||
|
{
|
||
|
$reponse = "n";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
$pseudo = $_POST['pseudo'];
|
||
|
$password = md5($_POST['password']);
|
||
|
|
||
|
$bdd = connexionBD();
|
||
|
$requete = $bdd->query("SELECT pseudo FROM login WHERE pseudo = '$pseudo' AND mdp = '$password'");
|
||
|
$count = $requete->rowCount();
|
||
|
|
||
|
if($count == 1)
|
||
|
{
|
||
|
session_start();
|
||
|
$_SESSION['pseudo'] = $_POST['pseudo'];
|
||
|
$reponse = "v";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
$reponse = "i";
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
echo json_encode($reponse);
|