Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once('_head.php');
- if(isset($_POST['submit'])){
- /* Post entered data */
- $username = $_POST['username'];
- $password = md5($_POST['password']);
- /* Check if data is in the database*/
- $query=mysql_query("SELECT * FROM users where username='$username' AND password='$password'");
- $count=mysql_num_rows($query);
- /* If username and password match with those in database, user is take to the members area */
- if($count == 1) {
- $_SESSION['username'] = $_POST['username'];
- Header("location: members.php");
- }
- /* Otherwise , user is redirected to the login form */
- else
- {
- echo "Username or password is incorrect";
- echo "<br />";
- echo "<a href='login.php'>Try again</a>";
- }
- }
- else
- {
- ?>
- <html>
- <body>
- <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
- <table border="0">
- <tr>
- <td>Username: </td><td><input type="text" name="username" />
- </td>
- </tr>
- <tr>
- <td>Password: </td><td><input type="password" name="password" />
- </td>
- </tr>
- <tr>
- <td>
- </td>
- <td><input type="submit" value="Login" />
- </td>
- </tr>
- <tr>
- <td><a href="signup.php">Signup</a>
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement