Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $db_server = "localhost:3306";
- $db_username = "root";
- $db_password = "root";
- $db_name = "spatius";
- $conn = new mysqli($db_server,$db_username,$db_password,$db_name);
- if (!$conn)
- {
- die("Connection failed " . mysqli_connect_error());
- }
- $enteredName = $_POST["email"];
- $enteredPass = $_POST["password"];
- $query = "SELECT password FROM admin WHERE username = '".$enteredName."'";
- $result = mysqli_query($conn,$query);
- if (mysqli_num_rows($result) > 0)
- {
- while($pass = mysqli_fetch_assoc($result))
- {
- if ($pass == $enteredPass)
- {
- echo("Correct password");
- header("location:cp.php");
- }
- else
- {
- echo("Password Incorrect, redirecting");
- header("location:index.php");
- }
- }
- }
- else
- {
- echo("Account not found, redirecting");
- header("location:index.php");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement