daily pastebin goal
60%
SHARE
TWEET

Untitled

a guest Oct 3rd, 2017 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. session_start();
  3. $connect = mysql_connect("db4free.net", "waveboz", "");
  4. mysql_select_db("waveboz", $connect);
  5.  
  6.  
  7. if(!($_SESSION['session_id']))
  8. {
  9.  
  10. if(isset($_POST['pseudo']))
  11. {
  12.     $pseudo = mysql_real_escape_string($_POST['pseudo']);
  13.     $mdp = mysql_real_escape_string($_POST['mdp']);
  14.    
  15.     $sql = mysql_query("SELECT * FROM users WHERE username='".$pseudo."' AND password='".$mdp."'");
  16.    
  17.     if(mysql_num_rows($sql) > 0)
  18.     {
  19.         $data = mysql_fetch_assoc($sql);
  20.         $_SESSION['session_id'] = md5(sha1(md5($mdp)));
  21.         mysql_query("INSERT INTO sessions(session_id, session_user_id) VALUES ('".$_SESSION['session_id']."', '".$data['user_id']."')");
  22.         echo'T\'es désormait connecté ! Rends-toi sur le chat sur : /chat/';
  23.     }
  24.     else
  25.     {
  26.         echo'Mauvais identifiants';
  27.     }
  28. }
  29.  
  30. ?>
  31. <form method="post" action="connexion.php">
  32. Pseudo : <input type="text" name="pseudo"/><br>
  33. Mot-de-passe : <input type="password" name="mdp"/><br>
  34. <input type="submit" name="Connexion !"/>
  35. </form>
  36. <?php
  37. }
  38. else
  39. {
  40.     echo "T'es déjà connecté ?";
  41. }
  42. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top