I have created a HTML login form which checks for email and password authentication and then redirects to the user account.
My PHP code is as below:
<?php
require('connect.php');//for connection to the database.
$email = $_POST['email'];
$password = $_POST['password'];
$query = "SELECT * FROM `account` WHERE pemail='$email' and password='$password'";
$result1 = mysql_query($query) or die(mysql_error());
$usercount = mysql_num_rows($result1);
if ($usercount == 1){
include 'myaccount.php';
}
else{
echo "Invalid Details.";
echo "<a href='login.php'>Back to Login</a>";
}
Here, I have tried include
to redirect to the user account...and it works fine.
Though my instructor says me that it is wrong to use include
and you should implement it in another ways.
Why it is wrong to use include
to redirect to the user account? I searched for it but I didn't found the answer.
plz do not discourage...thanks in advance.