后,我要让我的更改默认菜单登录通过后 和 我有一些代码对我的应用程序是这样PHP制作隐藏和显示菜单登录
的index.php
<?php session_start(); ?>
<html>
<head></head>
<body>
<ul>
<?php if($_SESSION['loggedIn'] == '1'): ?>
<li><a href="../templates/" title="Home" id="activated">Home</a></li>
<li><a href="catalog.html" title="Catalog" >Catalog</a></li>
<li><a href="signup-for-partners.html" title="Partners">Become Our Partner</a></li>
<li><a href="About-us.html" title="About Us">About Us</a></li>
<?php else: ?>
<li><a href="../templates/" title="" >Home</a></li>
<li><a href="account.html" title="" >My Account</a></li>
<li><a href="catalog.html" title="" >Catalog</a></li>
<li><a href="logout.php" title="" >logout</a></li>
<?php endif; ?>
</ul>
</body> </html>
这是我与验证码
<?php
session_start();
include 'conection.php';
if($_POST['captcha'] == $_SESSION['captcha']){
$username = $_POST['UserID'];
$password =$_POST['Password'];
$sql = "select * from login where username='".$username."' and password='".$password."'";
#echo $sql."<br />";
$query = mysql_query($sql) or die (mysql_error());
if($query){
$row = mysql_num_rows($query);
if($row > 0){
$_SESSION['loggedIn']='1';
$_SESSION['UserID']=$username;
header('Location: ../templates/');
}
else {
header('Location: error.php');
}
}
}
else{
header('Location: ../templates/');
}
?>
过程及其可能出现的错误这样
公告:未定义的索引:在的loggedIn C:\ XAMPP \ htdocs中\模板\的index.php上线78
只是process.php
定义为什么它不工作的loggedIn?
哪里的html表单为此? –
'$ _SESSION ['loggedIn'] ='0';'如果。 'mysql_'函数已被弃用。你必须照顾SQL注入..等..等 –
当然希望你打算采取这种生活。你现在拥有的是完全不安全的。 –