我有4个文件home.php,log_out.php,blank_one.php,connection.php 并没有包括login.php和index.php,因为它只读取 用户名和密码。会话破坏在登录和禁用回
我的问题是会话单击注销
后,然后单击箭头回
去blank_one.php直接我得到这些错误:'(
注意:未定义索引:当前用户
注意:未定义指数:CurrentUserType
- BLANK ONE
========================= ===============================================
并且由于注销(log_out.php)被点击的内容必须是没有用户发现,EMPTY和back应该被禁用。
有没有办法处理这个会话,以消除它后的错误?
`请帮忙。 :'(
blank_one.php
<?php
session_start();
$currUser = $_SESSION["CurrentUser"];
$currUserType = $_SESSION["CurrentUserType"];
echo('BLANK ONE');
?>
home.php
<?php
\t session_start();
\t $currUser = $_SESSION["CurrentUser"];
\t $currUserType = $_SESSION["CurrentUserType"];
\t if($currUserType == '1' or $currUserType == '2') \t
\t {
\t \t echo '
<html>
<body>
<a href="blank_one.php">blank</a>
<a href="log_out.php">logout</a>
</body>
</html>
';
\t \t \t
\t }
\t
\t else if($currUserType == '2'){
\t
\t }
\t
\t else if($currUserType == '3'){
\t \t echo '
\t \t
\t \t ';
\t \t
\t }else{
\t \t echo '<div> no user found </div>';
\t }
\t \t
?>
connection.php
\t \t <?php
\t \t $conn = mysql_connect('localhost', 'root', '', 'life');
\t \t \t if (!$conn)
\t \t \t {
\t \t \t \t die('Connect Error: ' . mysql_errno());
session_destroy();
session_start();
\t \t \t }
\t \t \t
else
\t \t \t {
\t \t \t \t //echo ("connected from connection.php");
session_start();
\t \t \t \t echo ("");
\t \t \t }
\t \t ?>
log_out.php
\t \t <?php
\t \t session_start();
\t \t include('connection.php');
\t \t $conn = mysql_connect('localhost', 'root', '', 'wildlife');
\t \t
\t \t if ($conn)
\t \t {
\t \t \t $update=mysql_query("INSERT INTO wrd_user(emp_log_out) VALUES (now())");
\t \t session_destroy();
\t \t mysql_close();
\t \t \t header('Location:index.php');
\t \t }
\t \t else
\t \t \t {
\t \t \t \t
\t \t \t \t echo ("");
\t \t \t }
\t \t \t
\t \t \t
\t \t ?>
HI
你的意思是这样??? for home.php –
如果单独使用它们,那么是的,如果将它们绑定在一起,那么您可以使用单个if语句来检查它们。请在评论中使用代码格式。您可以在新行和4个空格之后将代码写入您的评论。 – szenbalu