会话在Localhost中正常运行,但在CPANEL中不正常 [英] Session works properly in Localhost but not in CPANEL

查看:64
本文介绍了会话在Localhost中正常运行,但在CPANEL中不正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个登录系统,该系统已在登录该帐户时使用了会话.在

Hello i have a Login system which i have used session while loging to the account. in

localhost一切正常,但是在MY CPANEL中,其显示以下内容

localhost each and everything is working properly, but in MY CPANEL its showing the following

问题:

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标签(例如:-

remove extra sapces from start opening and end php tags like:-

<?php session_start();

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

also try to check session is already started or not before start new session. or header is already sent header_sent() also avoid header modification warning messages by buffering your source ob_start()

这篇关于会话在Localhost中正常运行,但在CPANEL中不正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆