Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $dbhost = "localhost";
- $dbuser = "root";
- $dbpass = "";
- $dberror1 = "Could not connect to the database!!";
- $errordb = "Couldn't select database!";
- $conn = mysql_connect($dbhost,$dbuser,$dbpass) or die ($dberror1);
- $db = mysql_select_db('club') or die ($errordb);
- ?>
- <?php
- require ('db.php');
- error_reporting(0);
- if( $_SERVER['REQUEST_METHOD']=='POST' ){
- $admin_id = isset( $_POST['admin_id'] ) && !empty( $_POST['admin_id'] ) ? filter_input( INPUT_POST, 'admin_id', FILTER_SANITIZE_STRING ) : false;
- $password = isset( $_POST['a_pass'] ) && !empty( $_POST['a_pass'] ) ? filter_input( INPUT_POST, 'a_pass', FILTER_SANITIZE_STRING ) : false;
- if( $admin_id && $password ){
- require ('db.php');
- $admin_id=strip_tags( mysql_real_escape_string( $admin_id, $con ) );
- $password=strip_tags( mysql_real_escape_string( $password, $con ) );
- $sql="SELECT `admin_id`, `a_pass` FROM `admin` where `admin_id` = '$admin_id' and `a_pass` = '$password';";
- $result = mysql_query($sql,$con);
- if( mysql_num_rows( $result ) == 1 )
- $_SESSION["admin_id"] = $admin_id;
- $_SESSION["a_pass"] = $password;
- echo 'Success!!';
- echo "<form action='home.php' style='margin-left:100px'>";
- echo '<input action="home.php" type="submit" name="submit">';
- echo '</form>';
- } else {
- echo "Sorry, Username or Password enetered does not match!<br> Try to check again!
- <br><br>
- <form action='ad_login.php' style='margin-left:100px;'>
- <input type='submit' value='Back'>
- </form>";
- }
- mysql_close( $con );
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement