Advertisement
Guest User

Untitled

a guest
Apr 21st, 2016
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <?php
  2. $host="localhost"; // Host name
  3. $username="root"; // Mysql username
  4. $password=""; // Mysql password
  5. $db_name="preschool"; // Database name
  6. $tbl_name="admin"; // Table name
  7. mysql_connect($host,$username,$password) or die ('Could Not Connect.');
  8. mysql_select_db("$db_name") or die ("No Database found.");
  9. $username=$_POST['username'];
  10. $password=$_POST['password'];
  11. $username = stripslashes($username);
  12. $password = stripslashes($password);
  13. $username = mysql_real_escape_string($username);
  14. $password = mysql_real_escape_string($password);
  15. $sql="SELECT * FROM admin WHERE username='$username' and password='$password'";
  16. $result=mysql_query($sql);
  17. $count=mysql_num_rows($result);
  18. if($count==1){
  19. session_start();
  20. if(!@session_is_registered('username')){
  21. header("location:loginProcess.php");}
  22. $_SESSION['session_name'] = 'username';
  23. $_SESSION['session_name'] = 'password';
  24. header("location:admin.php");}
  25. else {
  26. header("location:loginError.php");} ?>
  27.  
  28. <?php
  29. include("connect.php");
  30. $sql='SELECT * FROM online';
  31. $result=mysql_query($sql) or die("Cannot execute sql.");
  32. .
  33. .
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement