Quantcast
Viewing latest article 21
Browse Latest Browse All 35

PHP doesn't execute Login Form MySQL

Recently, I was making a login and signup page, where a mail gets sent if you sign up to confirm your account. I used MySQL for the account list, and have a 'confirm' column with 0 (unconfirmed) or 1 (confirmed).

Now, I created the following script to login, but it doesn't seem to be working. After executing this script, I see the "Processing...", then I see the "Such Sadness" part. I have checked in PHPMyAdmin that the account exists, and that it is actually confirmed. MySQL_Base is the file with the connection to the database, and that file is included in other files where the script works.

What is exactly the problem here?

ini_set('display_errors',1);ini_set('display_startup_errors',1);error_reporting(-1);$email = $_POST['email'];$password = $_POST['password'];include("mysql_base.php");echo "Processing...<br>";$sql = "SELECT * FROM pages_accounts WHERE confirm='1' AND email='".$email."' AND pass='".$password."' LIMIT 1";if($result = mysqli_query($conn, $sql) &&  $result->num_rows > 0){  echo "FOUND UR ACCOUNT. MUCH HAPPINESS. SUCH GLAD. WOW REDIRECTING...";} else {  echo "SUCH SADNESS. NO ACCOUNT WITH SUCH NAME. WEIRD RETURN. WOW. WHY NOT <a href='loginSignup.php'>SIGNUP</a>?";}

Viewing latest article 21
Browse Latest Browse All 35

Trending Articles