会话在Localhost中正常工作,但在CPANEL中不正常


Session works properly in Localhost but not in CPANEL

你好,我有一个登录系统,在登录到帐户时使用了会话。在中

localhost每一个都正常工作,但在我的CPANEL中,它显示了以下

问题:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/scalepro/public_html/Admin Panel/Remote Employee/main.php:1) in /home/scalepro/public_html/Admin Panel/Remote Employee/main.php on line 3

Warning: Cannot modify header information - headers already sent by (output started at /home/scalepro/public_html/Admin Panel/Remote Employee/main.php:1) in /home/scalepro/public_html/Admin Panel/Remote Employee/main.php on line 20

<?php
session_start();
require_once('../../Admin Panel/db.php');
if(isset($_POST['email']) && !empty($_POST['email']) && isset($_POST['password']) && !empty($_POST['password']))
{
 $email = $_POST['email'];
 $password = $_POST['password'];
 $query="SELECT RemoteEmployeeFullName, RemoteEmployeeEmail, RemoteEmployeePassword FROM remoteemployees WHERE RemoteEmployeeEmail='".$email."' AND RemoteEmployeePassword='".$password."'";
 $queryrun=$connection->query($query);
 if($queryrun->num_rows > 0)
 {
     $_SESSION['email']=$RemoteEmployeeFullName;     
     header('Location:REPLists.php');
 }
 else
 {
     echo 'Email: <b>'.$email. '</b> or Password <b>'. $password.'</b> Is Not Typed Correctly Try Again Please!.';
     header( "refresh:5;url=../../spd/myaccount.php" );
 }
}
else
{
    header( "refresh:1;url=../../spd/myaccount.php" );
}
?>

从开始打开和结束php标签中删除额外的sapces,如:-

<?php session_start();

在启动新会话之前,还要尝试检查会话是否已启动。或标头已发送header_sent()还可以通过缓冲源来避免头修改警告消息ob_start()

检查第一个

相关文章: