Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.46 KB | None | 0 0
  1. <form id='login' action='login.php' method='post' accept-charset='UTF-8'>
  2. <fieldset >
  3. <legend>Login</legend>
  4. <input type='hidden' name='submitted' id='submitted' value='1'/>
  5.  
  6. <label for='email' >E-mail :</label>
  7. <input type='text' name='email' id='email'  maxlength="50" />
  8.  
  9. <label for='password' >Password:</label>
  10. <input type='password' name='password' id='password' maxlength="50" />
  11.  
  12. <input type='submit' name='Submit' value='Submit' />
  13.  
  14. </fieldset>
  15. </form>
  16.  
  17. <?php
  18. include '/home/pieter/Documents/Project 2.2/kyoto-website/login-page/connect.php';
  19. function Login()
  20. echo "hoi3";
  21. {
  22.   echo "hoi2";
  23.   if(empty($_POST)['email']))
  24.   {
  25.     echo "hoi1";
  26.     return("Fill in an e-mail address!");
  27.   }
  28.   if(empty($_POST['password']))
  29.   {
  30.     return("Fill in an Password");
  31.   }
  32.   $email = trim($_POST)['email']);
  33.   $password = trim($_POST)['password']);
  34.    echo "hoi";
  35.    connect($email,$password);
  36.    echo "hoi";
  37. }
  38. ?>
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51. <?php
  52. function connect($email,$password)
  53. {
  54.   $connection = mysql_connect("localhost", "root", "");
  55.   $db = mysql_select_db("company",$connection);
  56.   $query = mysql_query("select * from login where password='$password' AND username='$email'", $connection);)
  57.   $rows = mysql_num_rows($query);
  58.   if ($rows == 1) {
  59.     session_start();
  60.     $_SESSION['login_user']=$username;
  61.     header("location: index.html");
  62.   }
  63.   else {
  64.     return("Username or Password is invalid");
  65.   }
  66.   mysql_close($connection);
  67. }
  68. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement