Advertisement
Guest User

Untitled

a guest
Jun 14th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.33 KB | None | 0 0
  1. <?php
  2. include'./function.php';
  3. startsession();
  4. //Procédure stocké PHP
  5. if (isset($_POST["valid"]))
  6. {
  7.    try
  8.    {
  9.     $connstrg = ("mysql:host=localhost;dbname=anti_cheat");
  10.     $user = ("root");
  11.     $password = ("oopkopok");
  12.     $PDO = new PDO($connstrg,$user,$password);
  13.    
  14.     echo'1';
  15.         $valide = true;
  16.     }
  17.     catch (Exception $ex)
  18.     {
  19.         $msg = "Une erreur ces produit à la ligne " . $ex->getLine() . " Dans le fichier " . $ex->getFile() . " Le message d'erreur est " . $ex->getMessage();
  20.         echo $msg;
  21.         $valide = false;
  22.     }
  23.    
  24.     //si aucune erreur de connexion
  25.     if($valide)
  26.     {
  27.        echo'2';
  28.         $query = ("CALL select_login(:P_admin);");
  29.         $prep =$PDO->prepare($query);
  30.         $prep->bindParam(':P_admin', $_POST["admin"]);
  31.         //echo json_encode($prep->errorInfo());
  32.         $prep->execute();
  33.         echo'3';
  34.         if($resultat=$prep->fetch())
  35.         {
  36.             echo'4';
  37.             $_SESSION["user"]=$resultat["Admin"];
  38.             header("location:intra.php");
  39.         }
  40.         else
  41.         {
  42.              if($resultat["Admin"] != $_POST["admin"])
  43.             {
  44.                  
  45.                 echo"<div class='alert alert-danger'><strong>Informations éronné </div>";  
  46.             }
  47.         }
  48.     }
  49. }
  50.        
  51.         ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement