Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include("db.php");
- mysql_select_db("youscoop") or die("Could not select database");
- if(isset($_POST['submit'])){
- $username = mysql_real_escape_string($_POST['username']);
- $password = mysql_real_escape_string($_POST['password']);
- $query= mysql_query("SELECT id,user FROM user_info WHERE user='$username' AND pass = '$password' LIMIT 1");
- $found = mysql_num_rows($query);
- if($found == 1){
- $row = mysql_fetch_assoc($query);
- //start sessioning the id and username
- $_SESSION['id'] = $row['id'];
- $_SESSION['user'] = $row['user'];
- header('Location: index.php');
- }else{
- echo "Login failed";
- }
- }
- ?>
- <form method="POST" action="">
- <table>
- <tr>
- <td>Username</td>
- <td> <input type="text" name="username" id="username"><br/></td>
- </tr>
- <tr><td>Password</td>
- <td> <input type="password" name="password" id="password"><br/></td>
- </tr>
- <tr>
- <td></td>
- <td>
- <input type="submit" id="submit" name="submit" value="login">
- </td>
- </tr>
- </table>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement