Advertisement
Guest User

Untitled

a guest
Aug 14th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. Warning: Cannot modify header information - headers already sent by (output started at /home4/jachun39/public_html/ap/login.php:6) in /home4/jachun39/public_html/ap/login.php on line 22
  2.  
  3. <?php
  4. include('SqlConnect.php');
  5. ?>
  6. <link rel="Stylesheet" type="text/css" href="style.css" />
  7. <link href='http://fonts.googleapis.com/css?family=Karla:400,700,700italic,400italic' rel='stylesheet' type='text/css'>
  8. <?php
  9. if (isset($_POST['Login'])){
  10. if (!@mysql_connect($host, $username, $password)) die("Can't connect to database");
  11. if (!mysql_select_db($db_name)) die("Can't select database");
  12. $username=$_POST['username'];
  13. $password=$_POST['password'];
  14. $username = stripslashes($username);
  15. $password = stripslashes($password);
  16. $username = mysql_real_escape_string($username);
  17. $password = mysql_real_escape_string($password);
  18. $sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$password'";
  19. $result=mysql_query($sql);
  20. $count=mysql_num_rows($result);
  21. if($count >= 1){
  22. $_SESSION['username']= "username";
  23. $_SESSION['password']= "password";
  24. header("location: index.php");
  25. echo "<center><font color='green'><b>Logged in Successfully</center></font></b>";
  26. } else {
  27. echo "<center><font color='red'><b>Wrong Username or Password</center></font></b>";
  28. }
  29. }
  30.  
  31. <?php
  32. if(!isset($_SESSION['username'])){
  33. header("location: login.php");
  34. }
  35. ?>
  36.  
  37. ob_start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement