Guest User

Untitled

a guest
Nov 18th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if (!isset($_SESSION['username'])){
  4. header('location:../userregistration/login.php');
  5. $error="Require to Login to use this function";
  6. }
  7. }else {
  8. header('location:map.php');
  9. }
  10. ?>
  11.  
  12. <?php
  13.  
  14. session_start();
  15.  
  16.  
  17. $con = mysqli_connect('localhost','root','');
  18.  
  19. mysqli_select_db($con, 'userregistration');
  20.  
  21. $name = $_POST['user'];
  22. $pass = $_POST ['password'];
  23.  
  24. // /*$email = $_POST['mail'];
  25. // $phone = $_POST['phone'];
  26. // $address = $_POST['address'];*/
  27.  
  28. $s = " SELECT * FROM usertable WHERE name = '$name'&& password = '$pass'";
  29.  
  30. $result = mysqli_query($con, $s);
  31.  
  32. $num = mysqli_num_rows($result);
  33.  
  34. if ($num == 1){
  35. $_SESSION['username'] = $name;
  36. header('location:../Index.php');
  37. }else {
  38. header('location:login.php');
  39.  
  40. }
  41. ?>
Add Comment
Please, Sign In to add comment