Php & Session after login to page
Get the solution ↓↓↓I have created login page which after user name and pass word is accessing my other pages. But problem is when I am creating session for other pages which I do n't want to be accused without login. I am directed from login page to login again
<?php
session_start();
if(isset($_POST['submit'])){
$user=$_POST['user'];
$password=$_POST['password'];
$query="SELECT * FROM login WHERE user='$user' && password='$password'";
$data=mysqli_query($db_conn,$query);
$total=mysqli_num_rows($data);
if($total==1) {
echo("Login Sucessfull");
$_SESSION['log']=1;
header("refresh:3;url=customer_data_ie.php");
}
elseif($total==is_null()){
echo("Invalid User");
header("refresh:2;url=login_page_crm.php");
}
else{
echo "Invalid User";
}
}
?>
<?php
session_start();
if(isset($_SESSION['user'])){
header("location:login_page_crm.php");
}else{
header("location:customer_data_ie.php");
}
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: integrity constraint violation: 1452 cannot add or update a child row: a foreign key constraint fails
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.