如何解决PHP登录会话中的错误?

时间:2019-01-26 05:46:14

标签: php mysql session

我有一个登录页面。使用会话用户可以进入索引页面。但登录用户进入索引页面后,如果我单击chrome中的页面,则它总是返回到以前的登录表单。我不明白我的代码在哪里出了问题。如何解决这个错误吗?

 login.php page----

<?php
include 'includes\common.php';
// Redirects the user to products page if logged in.
if (isset($_SESSION['email'])) {
    header('location: ');
}
?>

index.php page----

<?php
$con = mysqli_connect("localhost", "root", "", "store") or die(mysqli_error($con));
if(!isset($_SESSION)) 
    { 
        session_start(); 
    }
	require 'includes\header.php';

if(isset($_POST['search']))
{
    $valueToSearch = $_POST['valueToSearch'];
    // search in all table columns
    // using concat mysql function
    $query = "SELECT * FROM `users` WHERE CONCAT(`id`, `Name`, `email`, `password`, `contact`, `city`, `address`) LIKE '%".$valueToSearch."%'";
    $search_result = filterTable($query);
    
}
 else {
    $query = "SELECT * FROM `users`";
    $search_result = filterTable($query);
}
// function to connect and execute the query
function filterTable($query)
{
    $connect = mysqli_connect("localhost", "root", "",'store');
    $filter_Result = mysqli_query($connect, $query);
    return $filter_Result;
}
	
	
?>

export FLASK_APP=manage

0 个答案:

没有答案