Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <link rel="stylesheet" type="text/css" href="site.css">
- </head>
- <body>
- <div class="frame">
- <div class="headerf"></div>
- <div class="contentf">
- <h3>Incorrect user credentials.</h3>
- <?php
- include("info.inc.php");
- $comm=@mysql_connect(localhost,$username,$password);
- $rs=@mysql_select_db($database) or die( "Unable to select database");
- // username and password sent from form
- $myusername=$_POST['myusername'];
- $mypassword=$_POST['mypassword'];
- // To protect MySQL injection
- $myusername = stripslashes($myusername);
- $mypassword = stripslashes($mypassword);
- $myusername = mysql_real_escape_string($myusername);
- $mypassword = mysql_real_escape_string($mypassword);
- $sql="SELECT * FROM users WHERE username='$myusername' and password='$mypassword'";
- $result=mysql_query($sql);
- // Mysql_num_row is counting table row
- $count=mysql_num_rows($result);
- // If result matched $myusername and $mypassword, table row must be 1 row
- if($count==1){
- // Register $myusername, $mypassword and redirect to file "index.php"
- $_SESSION["username"] = $myusername;
- $_SESSION["password"] = $mypassword;
- header("location:../index.php");
- }
- else {
- echo "Please return to the log-in page.";
- }
- ?>
- <form name="form" method="post" action="../login.php"><br>
- <td><input type="submit" name="Submit" value="Back"></td>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement