|
一个很简单得php传值,只有登陆用户才能打开业面的脚本,可是不知道为什么desktop.php就是不可以成功。老是跳转到errorpage。operator_login.php已经测试过了echo到正确的登陆时后的用户名密码等。但是到了desktop.php就找不到session了,在desktop.php加了session_start();之后也不行,加了之后desktop.php可以直接打开不会返回错误。
operator_login.php 内容如下:
<?php session_start(); ?>
<?php require_once('mysql_conn.php'); ?>
<?php
#echo $_POST[operator_id],$_POST[password];
mysql_select_db($database_mysql_conn, $mysql_conn);
$query_check_operator = "SELECT * FROM operator_id WHERE operator_id='$_POST[operator_id]' and password='$_POST[password]'";
$check_operator = mysql_query($query_check_operator, $mysql_conn) or die(mysql_error());
$row_check_operator = mysql_fetch_assoc($check_operator);
$totalRows_check_operator = mysql_num_rows($check_operator);
#echo $row_check_operator[operator_id],'<BR>';
#echo $row_check_operator[password],'<BR>';
#echo $totalRows_check_operator;
if ($totalRows_check_operator==0){
#echo "error_login!";
echo "<meta http-equiv=refresh content=0;URL=error_code.php?code=10>";
}
else {
$_SESSION[operator_id]=$row_check_operator[operator_id];
$_SESSION[password]=$row_check_operator[password];
#echo "good!";
echo "<meta http-equiv=refresh content=0;URL=desktop.php>";
}
?>
<?php
mysql_free_result($check_operator);
?>
desktop.php如下
<?php if ($_SESSION[operator_id]==""){echo "<meta http-equiv=refresh content=0;URL=error_code.php?code=30>";}?>
<?php require_once('mysql_conn.php'); ?>
<?php
mysql_select_db($database_mysql_conn, $mysql_conn);
$query_insert_login_record = "SELECT * FROM telnetlog ";
$insert_login_record = mysql_query($query_insert_login_record, $mysql_conn) or die(mysql_error());
$row_insert_login_record = mysql_fetch_assoc($insert_login_record);
$totalrows_insert_login_record = mysql_num_rows($insert_login_record);
?>
下面的html我就略过了 |
|