Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. <?php
  2. $dbhost = "localhost";
  3. $dbuser = "root";
  4. $dbpass = "";
  5. $dberror1 = "Could not connect to the database!!";
  6. $errordb = "Couldn't select database!";
  7. $conn = mysql_connect($dbhost,$dbuser,$dbpass) or die ($dberror1);
  8. $db = mysql_select_db('club') or die ($errordb);
  9. ?>
  10.  
  11. <?php
  12. require ('db.php');
  13. error_reporting(0);
  14.  
  15.  
  16. if( $_SERVER['REQUEST_METHOD']=='POST' ){
  17. $admin_id = isset( $_POST['admin_id'] ) && !empty( $_POST['admin_id'] ) ? filter_input( INPUT_POST, 'admin_id', FILTER_SANITIZE_STRING ) : false;
  18. $password = isset( $_POST['a_pass'] ) && !empty( $_POST['a_pass'] ) ? filter_input( INPUT_POST, 'a_pass', FILTER_SANITIZE_STRING ) : false;
  19.  
  20. if( $admin_id && $password ){
  21.  
  22. require ('db.php');
  23.  
  24. $admin_id=strip_tags( mysql_real_escape_string( $admin_id, $con ) );
  25. $password=strip_tags( mysql_real_escape_string( $password, $con ) );
  26.  
  27. $sql="SELECT `admin_id`, `a_pass` FROM `admin` where `admin_id` = '$admin_id' and `a_pass` = '$password';";
  28.  
  29. $result = mysql_query($sql,$con);
  30.  
  31. if( mysql_num_rows( $result ) == 1 )
  32. $_SESSION["admin_id"] = $admin_id;
  33. $_SESSION["a_pass"] = $password;
  34. echo 'Success!!';
  35. echo "<form action='home.php' style='margin-left:100px'>";
  36. echo '<input action="home.php" type="submit" name="submit">';
  37. echo '</form>';
  38. } else {
  39.  
  40. echo "Sorry, Username or Password enetered does not match!<br> Try to check again!
  41. <br><br>
  42. <form action='ad_login.php' style='margin-left:100px;'>
  43. <input type='submit' value='Back'>
  44. </form>";
  45. }
  46. mysql_close( $con );
  47.  
  48.  
  49. }
  50. }
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement