Guest User

Untitled

a guest
Jan 24th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1.  
  2. <?php
  3. include 'contectar.php';
  4.  
  5. $user = strtolower(htmlspecialchars($_POST['user']));
  6. $pass = htmlspecialchars($_POST['pass']);
  7.  
  8. if (isset($_POST['submit'])){
  9. $encode = base64_encode($pass);
  10. $query = "SELECT * FROM users WHERE user = '$user' AND password = '$encode'";
  11. $result = mysqli_query($conn, $query);
  12. if ($result->num_rows == 0){
  13. session_start();
  14. $_SESSION['user'] = $user;
  15. $_SESSION['pass'] = $pass;
  16. header('Location: http://elsillondeemporda.com/admin/dashboard.php');
  17. }
  18. }else{
  19. echo "holis2";
  20. if ($_GET['d']=='1'){
  21. $_SESSION['user'] = '';
  22. $_SESSION['pass'] = '';
  23. session_destroy();
  24. header('Location: index.html');
  25. }
  26. if (empty($_SESSION['user']) && empty($_SESSION['pass'])){
  27. session_destroy();
  28. header('Location: index.html');
  29. }
  30. }
  31.  
  32. ?>
Add Comment
Please, Sign In to add comment