Php session_start()在firefox中工作正常,但在chrome中不工作
Php session_start()在firefox中工作正常,但在chrome中不工作,php,html,google-chrome,firefox,Php,Html,Google Chrome,Firefox,session\u start()在firefox中工作正常,但在chrome中不工作。我还在一个文件的顶部写了session\u start(),但它在google chrome中仍然不起作用。 我在代码中添加了一个复选框,如果设置了会话,则会向用户显示一个页面。在chrome中,它总是转到else语句。在firefox中,它可以完美地工作 <?php session_start(); include("connection.php"); i
session\u start()
在firefox中工作正常,但在chrome中不工作。我还在一个文件的顶部写了session\u start()
,但它在google chrome中仍然不起作用。
我在代码中添加了一个复选框,如果设置了会话,则会向用户显示一个页面。在chrome中,它总是转到else语句。在firefox中,它可以完美地工作
<?php
session_start();
include("connection.php");
if (isset($_SESSION['adminid'])) {
?>
<!DOCTYPE html>
<html>
<head>
<title>SezaPharma AdminPanel</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
</head>
<body>
<div class="dashboard">
<div class="tab">
<button class="tablinks" onclick="openCity(event, 'London')" id="defaultOpen">All Products</button>
<button class="tablinks" onclick="openCity(event, 'Paris')">Add New Product</button>
<button class="tablinks" onclick="openCity(event, 'Tokyo')">Setting</button>
<a href="logout.php" ><button class="tablinks" onclick="openCity(event, 'Tokyo')" >Logout</button></a>
</div>
<div id="London" class="tabcontent" style="overflow:auto">
<div class="site_wrapper" >
<div class="clearfix margin_top10"></div>
<div class="works01" >
<div class="container" >
<div id="grid-container" class="cbp-l-grid-fullWidth" style="overflow:visible;">
<?php
$select_post=mysqli_query($conn,"select * from products ORDER BY PID desc") or die(mysqli_error());
while($post=mysqli_fetch_array($select_post))
{
?>
<div class="cbp-item <?php echo $post['PTYPE'];?>">
<div class="cbp-caption">
<div class="cbp-caption-defaultWrap">
<img style="width:100%; height:200px;" src="UploadedImage/<?php echo $post['PIMAGELOC'];?>" alt="">
</div>
<div class="cbp-caption-activeWrap">
<div class="cbp-l-caption-alignCenter">
<div class="cbp-l-caption-body">
<h3><?php echo $post['PNAME'];?></h3>
<br />
<a href="delete_product.php?PID=<?php echo $post['PID']; ?>" class="cbp-l-caption-buttonLeft" data-title="Looking Publishing <br>reasonable always">Delete</a>
</div>
</div>
</div>
</div>
</div><!-- end item -->
<?php
}
?>
</div>
</div>
</div><!-- end works section -->
<!-- ######### JS FILES ######### -->
<!-- get jQuery used for the theme -->
<script type="text/javascript" src="js/universal/jquery.js"></script>
<script src="js/style-switcher/styleselector.js"></script>
<script src="js/animations/js/animations.min.js" type="text/javascript"></script>
<script src="js/mainmenu/bootstrap.min.js"></script>
<script src="js/mainmenu/customeUI.js"></script>
<script src="js/scrolltotop/totop.js" type="text/javascript"></script>
<script type="text/javascript" src="js/mainmenu/sticky.js"></script>
<script type="text/javascript" src="js/mainmenu/modernizr.custom.75180.js"></script>
<script type="text/javascript" src="js/cubeportfolio/jquery.cubeportfolio.min.js"></script>
<script type="text/javascript" src="js/cubeportfolio/main31.js"></script>
</body>
</html>
<?php } else{ echo " You mus Loggedin to acces this page"; } ?>
SezaPharma管理小组
所有产品
添加新产品
背景
问题不可能出在浏览器上,因为如果web服务器出现故障,浏览器也会受到同样的影响。检查您是否在Google Chrome中禁用了Cookie
如果您在自己的机器上运行代码,请确保本地服务器处于联机模式;有时候Mozilla Firefox在这种情况下是灵活的
代码中有错误:您的
和
不符合PHP条件
编辑
<?php
session_start();
include("connection.php");
if (isset($_SESSION['adminid'])) {
?>
<!DOCTYPE html>
<html>
<head>
<title>SezaPharma AdminPanel</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
</head>
<body>
<div class="dashboard">
<div class="tab">
<button class="tablinks" onclick="openCity(event, 'London')" id="defaultOpen">All Products</button>
<button class="tablinks" onclick="openCity(event, 'Paris')">Add New Product</button>
<button class="tablinks" onclick="openCity(event, 'Tokyo')">Setting</button>
<a href="logout.php" ><button class="tablinks" onclick="openCity(event, 'Tokyo')" >Logout</button></a>
</div>
<div id="London" class="tabcontent" style="overflow:auto">
<div class="site_wrapper" >
<div class="clearfix margin_top10"></div>
<div class="works01" >
<div class="container" >
<div id="grid-container" class="cbp-l-grid-fullWidth" style="overflow:visible;">
<?php
$select_post=mysqli_query($conn,"select * from products ORDER BY PID desc") or die(mysqli_error());
while($post=mysqli_fetch_array($select_post))
{
?>
<div class="cbp-item <?php echo $post['PTYPE'];?>">
<div class="cbp-caption">
<div class="cbp-caption-defaultWrap">
<img style="width:100%; height:200px;" src="UploadedImage/<?php echo $post['PIMAGELOC'];?>" alt="">
</div>
<div class="cbp-caption-activeWrap">
<div class="cbp-l-caption-alignCenter">
<div class="cbp-l-caption-body">
<h3><?php echo $post['PNAME'];?></h3>
<br />
<a href="delete_product.php?PID=<?php echo $post['PID']; ?>" class="cbp-l-caption-buttonLeft" data-title="Looking Publishing <br>reasonable always">Delete</a>
</div>
</div>
</div>
</div>
</div><!-- end item -->
<?php
}
?>
</div>
</div>
</div><!-- end works section -->
<!-- ######### JS FILES ######### -->
<!-- get jQuery used for the theme -->
<script type="text/javascript" src="js/universal/jquery.js"></script>
<script src="js/style-switcher/styleselector.js"></script>
<script src="js/animations/js/animations.min.js" type="text/javascript">
</script>
<script src="js/mainmenu/bootstrap.min.js"></script>
<script src="js/mainmenu/customeUI.js"></script>
<script src="js/scrolltotop/totop.js" type="text/javascript"></script>
<script type="text/javascript" src="js/mainmenu/sticky.js"></script>
<script type="text/javascript" src="js/mainmenu/modernizr.custom.75180.js"></script>
<script type="text/javascript" src="js/cubeportfolio/jquery.cubeportfolio.min.js"></script>
<script type="text/javascript" src="js/cubeportfolio/main31.js"></script>
</body>
</html>
<?php } else{ echo " You mus Loggedin to acces this page"; } ?>
SezaPharma管理小组
所有产品
添加新产品
背景
重置浏览器…我的chrome浏览器中已启用Cookie。我已检查它。是否测试了代码?这个错误可能会在浏览器中导致这个错误。我现在无法测试如果你想复制它你复制了吗?在这里,它可以在所有浏览器(包括谷歌浏览器)中完美运行。你的web服务器是什么?它在线吗?您是否以@Huy Tr重新启动了Chromeịnh说什么?在这种情况下,也重新启动机器