Session Support enabled
Registered save handlers files user
Registered serializer handlers php php_binary wddx Directive Local Value Master Value
session.auto_start On On
session.bug_compat_42 On On
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_lifetime 0 0
session.cookie_path , ,
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 100 100
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 4 4
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path C:\Documents and Settings\erpuser\Local Settings\Temp C:\Documents and Settings\erpuser\Local Settings\Temp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies On On
session.use_trans_sid 1 1
Registered save handlers files user
Registered serializer handlers php php_binary wddx Directive Local Value Master Value
session.auto_start On On
session.bug_compat_42 On On
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_lifetime 0 0
session.cookie_path , ,
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 100 100
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 4 4
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path C:\Documents and Settings\erpuser\Local Settings\Temp C:\Documents and Settings\erpuser\Local Settings\Temp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies On On
session.use_trans_sid 1 1
<?
session_start();
$_SESSION['field']='$textfield';
$_SESSION['field2']='$textfield2';
echo "<script>location.href='3.php';</script>"; //跳转
?>3.php
<?
echo $_SESSION['field'];
echo $_SESSION['field2'];
echo $field;
?>
<?
session_start();
$_SESSION['field']='$textfield';
$_SESSION['field2']='$textfield2';这里不能用单引号
$_SESSION['field']="$textfield";
$_SESSION['field2']="$textfield2";
或者:
$_SESSION['field']=$textfield;
$_SESSION['field2']=$textfield2;
echo "<script>location.href='3.php';</script>"; //跳转
?>3.php
<?
echo $_SESSION['field'];
echo $_SESSION['field2'];
echo $field;
?>
C:\Documents and Settings\erpuser\Local Settings\Temp 这个目录存在码?
这是系统文件的临时目录。而且可以写入
而且use1|s:3:"cys";pass1|s:3:"cys";这是session里面的东西
加上:
SESSION_START();
$_REGISTER['field2']='$textfield2';这里的变量名外边的单引号将不能解析变量!
第二个页面:$field=$_post["field"];
$field2=$_post["field2"];
session_start();
session_register('field');
session_register('field2');第三页:$field=$_session('field');
$field2=$_session('field2'); 注意大小写,有的版本得php区分大小写
我有三个页面:
1.html
<body>
<form id="form1" name="form1" method="post" action="2.PHP">
<table width="200" border="1" align="center">
<tr>
<td>用户名</td>
<td><input type="text" name="textfield" /></td>
</tr>
<tr>
<td>密码</td>
<td><input type="password" name="textfield2" /></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="提交" /></td>
<td><input type="reset" name="Submit2" value="重置" /></td>2.php
<?
SESSION_START();
$_REGISTER['field']='$textfield';
$_REGISTER['field2']='$textfield2';
echo "<script>location.href='3.php';</script>"; //跳转
?>3.php
<?
echo $_REGISTER['field'];
echo $_REGISTER['field2'];
echo $field;
?>然后什么东西也没有
1.htm
<html>
<body>
<form id="form1" name="form1" method="post" action="file1.php">
<table width="200" border="1" align="center">
<tr>
<td>用户名</td>
<td><input type="text" name="textfield" /></td>
</tr>
<tr>
<td>密码</td>
<td><input type="password" name="textfield2" /></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="提交" /></td>
<td><input type="reset" name="Submit2" value="重置" /></td>
</tr>
</table>
</form>
</body>
</html>
file1.php
<?
session_start();
$_SESSION['field']=$textfield;
$_SESSION['field2']=$textfield2;
echo "<script>location.href='file2.php';</script>"; //跳转
?>file2.php
<?
session_start();
echo $_SESSION['field'];
echo $_SESSION['field2'];
?>
的你们说的我都照做了还是不行呀
<body>
<form id="form1" name="form1" method="post" action="2.php">
<table width="200" border="1" align="center">
<tr>
<td>用户名</td>
<td><input type="text" name="textfield" /></td>
</tr>
<tr>
<td>密码</td>
<td><input type="password" name="textfield2" /></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="提交" /></td>
<td><input type="reset" name="Submit2" value="重置" /></td>2.php
<?
session_start();
$_SESSION['field']=$_POST["textfield"];
$_SESSION['field2']=$_POST["textfield2"];
echo "<script>location.href='3.php';</script>"; //跳转
?>3.php
<?
session_start();
echo $_SESSION['field'];
echo $_SESSION['field2'];
?>
?>
这样写试一下
这一句改成header跳转
header("location:3.php");
<?
/*********验证用户名和密码是否为空****************/
if($use==null){
echo("<script>alert('请输入用户名')</script>");
echo "<script>location.href='login.html';</script>"; //跳转
exit;
}
if($pass==null){
echo("<script>alert('请输入密码')</script>");
echo "<script>location.href='login.html';</script>"; //跳转
exit;
}
SESSION_START();//开始SESSION_START
/*************验证用户和和码是否正确并取出其个人信息并进行session**********/
$con = mssql_connect("$dateuser", "sa", "");
mssql_select_db("loveC", $con);
$usesql = "select * from [name] where LoginName='$use' and LoginPWD='$pass'";
$useresult = @mssql_query($usesql);
$usenum = @mssql_num_rows($useresult);
if($usenum!=1){
echo("<script>alert('输入密码或用户名错误')</script>");
echo "<script>location.href='login.html';</script>"; //跳转
exit;}
$usemyrow = mssql_fetch_array($useresult);
$_SESSION['bumen']=$usemyrow[DeptID];//部门如新厂
$_SESSION['chejian']=$usemyrow[chejian];//车间如炒制or罐装
/******选择进入系统的条件*********/
//echo("<script>alert('登陆成功,欢迎进入老干妈公司生产管理系统')</script>");
$CurDate=date("Y-m-d");
$d=explode("-",$CurDate);
$CurMonth=str_replace($d[1].">".$d[1]."月",$d[1]." selected>".$d[1]."月",$cMonth);
$CurDay=str_replace($d[2].">".$d[2]."日",$d[2]." selected>".$d[2]."日",$cDay);
$startCurDay=str_replace("01".">"."01"."日","01"." selected>"."01"."日",$cDay);
$m=date(m);
echo"<form id='form1' name='form1' method='post' action='index.php'>";
echo" <table border=1 cellpadding=3 cellspacing=0 bgcolor=#F3F2F1 bordercolorlight=#C0C0C0 bordercolordark=#FEFEFE width=400 align=center>";
echo"<TR height=30>";
echo" <TD background=image/7block_title4b.gif colSpan=8>";
echo" <DIV align=center><STRONG>请选择考勤条件</STRONG></DIV></TD></TR>";
echo"";
echo"<tr>";
echo" <td align='center' align=left colspan=4 width=50%>选择统计年月</td>";
echo" <td align='center' colspan=4 width=50%><input type=text name=year size=5 maxlength=4 value=$d[0]>年<select name=startmonth>
<option value=$m>$m</option>
<option value='01'>01</option>
<option value='02'>02</option>
<option value='03'>03</option>
<option value='04'>04</option>
<option value='05'>05</option>
<option value='06'>06</option>
<option value='07'>07</option>
<option value='08'>08</option>
<option value='09'>09</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12'>12</option>
</select>月</select></td>";
echo" </tr>";
$dwsql="select * from [bumen] where fenchang='$usemyrow[DeptID]' and chejian='$usemyrow[chejian]'";
$dwresult = @mssql_query($dwsql);
$dwnum = @mssql_num_rows($dwresult);
$b=0;//列数
echo"<tr>";
for ($i = 0; $i < $dwnum; $i++){
$dwmyrow = mssql_fetch_array($dwresult);
if($b>3){
echo"<tr>";}
echo" <td align='center' width='26'><input type='checkbox' name='checkbox[]' value=$dwmyrow[banzhu] /></td>";
echo" <td align='center' width='74'>$dwmyrow[banzhu]</td>";
$b++;
if($b>3){
echo"</tr>";
$b=0;}
}
mssql_colse;
echo"<tr>";
echo" <td align='center' colspan=4 width=50%><input type='submit' name='Submit' value='提交' /></td>";
echo" <td align='center' colspan=4 width=50%><input type='reset' name='Submit2' value='重置' /></td>";
echo"</tr>";
echo"</table>";echo"</form>";?>
{
$_SESSION['adminname']=$username;
//在这里输出 $_SESSION['adminname']是有值的。
echo "<script>location.href='index.php';</script>";
}
登录之后访问其他的页面:
<?
session_start();
if($_SESSION['adminname']=="")//这里老是为空呀!!!!!!!!!!!!!
{
echo "<script>location.href='login.php';</script>";
}else{
?>
还有一个问题!就是我每打开一个页面他就会在session目录下生成一个session文件
{
$_SESSION['adminname']=$username;
//在这里输出 $_SESSION['adminname']是有值的。
echo "<script>location.href='index.php';</script>";
}
---------------------------------------------------
echo "<script>location.href='index.php';</script>";
这一句改成header跳转
header("location:index.php");
不行吗?我测试通过。
难道我的php配置有问题吗!那又该怎么弄呢!!!!!!!!!?
可不可以给给详细的php.ini-sessionn 的配置呢!
马上就结
回想一下代码中是否有session_regenerate_id()方法,或者类型功能的地方。
因为没有存session的路径所以空白
回答完毕谢谢
echo "good luck";
或者
echo $_SESSION['field2']."Hello World!";
存在的话有可写的权限没?
这都得看看.这个是最主要的.