Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if (isset($_POST["username"]) && isset($_POST["password"])) {
- $username = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["username"]);
- $password = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["password"]);
- include "connect_to_mysql.php";
- $sql = mysql_query("SELECT id FROM users WHERE username='$username' AND password='$password' LIMIT 1");
- $existCount = mysql_num_rows($sql);
- if ($existCount == 1)
- while($row = mysql_fetch_array($sql)){
- $id = $row["id"];{
- }
- $_SESSION["id"] = $id;
- $_SESSION["username"] = $username;
- $_SESSION["password"] = $password;
- $_SESSION["name"] = $name;
- header("location:instructions.php");
- exit();
- } else {
- echo 'That information is incorrect, try again <a href="login.php">Click Here</a>';
- exit();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement