Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include("connection.php");
- //Establishing connection with our database
- $error = "";
- //Variable for storing our errors.
- if(isset($_POST["submit"]))
- {
- $username=$_POST['u_email'];
- $password=$_POST['u_password'];
- if(empty($username) || empty($password) { $error = "Both fields are required."; }
- else
- {
- $password = md5($password);
- // To protect from SQL Injection
- $sql = $db->prepare("SELECT u_id FROM user WHERE u_email = ? AND u_password = ?");
- $sql->bind_param("ss", $username, $password);
- $sql->execute();
- // Get the result from query that was executed
- $sql->store_result();
- if($sql->num_rows > 0)
- {
- // Found one or more rows with that matches both email and password/
- echo "I'm inside if";
- //$_SESSION["u_email"] = $username;
- //header("Location:homeexample.php");
- }
- else
- {
- // Found none
- echo "No row found";
- //header("Location:index.php");
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement