Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(isset($_POST['Submit'])){
- include 'connection/conn.php';
- $database="issuelog";
- $selectdb = mysql_selectdb($database);
- if ($selectdb){
- echo "Selected";
- $UserName = $_POST['username'];
- $Password = $_POST['password'];
- $table = "userreg";
- $sql = "SELECT UserName FROM $table WHERE UserName='{$UserName}' AND Password='{$Password}' LIMIT 1";
- $results=mysql_query($sql, $conn);
- if( $results && mysql_num_rows($results) === 1){
- $_SESSION['username'] = $UserName;
- $_SESSION['password'] = $Password;
- if( !headers_sent()){
- header("Location: login_success.php");
- exit;
- }else{
- echo '<meta http-equiv="refresh" content="0; url=login_success.php"/>');
- echo '<script>document.location.href="login_success.php";</script>';
- exit;
- }
- } else if( !$results ){
- echo 'Internal Server Error';
- } else {
- echo "Wrong Username or Password.";
- }
- }
- }
- ?>
- login_success.php
- <?php
- session_start();
- if(!isset($_SESSION['username'])){
- header("Location: login.php");
- }
- ?>
- <html>
- <body>
- Login Successful
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement