查看: 1069|回复: 13
|
PHP的code问题
[复制链接]
|
|
ASP的response indirect, 在PHP是什么? |
|
|
|
|
|
|
|
发表于 21-2-2006 04:22 PM
|
显示全部楼层
Reponse.indrect?! Response.redirect吧!PHP里可以用header('Location: redirect.php'); |
|
|
|
|
|
|
|
发表于 21-2-2006 05:37 PM
|
显示全部楼层
这两者似乎不太一样哟。。。
Response.redirect时。。。
1.URL不会变。
2.可以access之前的page的variable
header('Location: redirect.php');
1.好像好像html里的 <meta http-equiv="Refresh" content="0;URL=redirect.php">
其它的我不清楚咯。
如有错误,请多多指点。 |
|
|
|
|
|
|
|
发表于 22-2-2006 09:49 AM
|
显示全部楼层
原帖由 ccsuser 于 21-2-2006 05:37 PM 发表
这两者似乎不太一样哟。。。
Response.redirect时。。。
1.URL不会变。
2.可以access之前的page的variable
header('Location: redirect.php');
1.好像好像html里的 <meta http-equiv="Refresh&q ...
好像不是你所说嘞!我测试过了俩者是一样的。不过,Response.Redirect和Server.Transfer倒是不太一样。 |
|
|
|
|
|
|
|
发表于 22-2-2006 05:23 PM
|
显示全部楼层
原帖由 ccsuser 于 21-2-2006 05:37 PM 发表
这两者似乎不太一样哟。。。
Response.redirect时。。。
1.URL不会变。
2.可以access之前的page的variable
header('Location: redirect.php');
1.好像好像html里的 <meta http-equiv="Refresh&q ...
据我所知,<meta http-equiv="refresh.... 和 header('Location: redirect.php'); 是不一样的。
如果你disable浏览器的redirect功能,那 <meta http-equiv="refresh.... 就无法发挥作用,不过 header('Location: redirect.php'); 还是照常操作 |
|
|
|
|
|
|
|
发表于 23-2-2006 03:32 PM
|
显示全部楼层
PHP code
Got any way for download the php code.
very urgent o!!!
[ 本帖最后由 baguaman 于 23-2-2006 03:36 PM 编辑 ] |
|
|
|
|
|
|
|
发表于 25-2-2006 03:28 AM
|
显示全部楼层
原帖由 wowwildcat 于 22-2-2006 09:49 AM 发表
好像不是你所说嘞!我测试过了俩者是一样的。不过,Response.Redirect和Server.Transfer倒是不太一样。
看来是我把这两个(Response.Redirect && Server.Transfer)搞错了。谢谢!
hui_yang: 对,你说得对。  |
|
|
|
|
|
|
|
发表于 3-3-2006 02:41 AM
|
显示全部楼层
为什么我会这样?
Warning: Cannot modify header information - headers already sent by (output started at c:\inetpub\wwwroot\fyp11\login.php:32) in c:\inetpub\wwwroot\fyp11\login.php on line 36
我的code是
<?php
session_start();
if(isset($HTTP_POST_VARS['cusid']) && isset($HTTP_POST_VARS['password']))
{ $cusid=$HTTP_POST_VARS['cusid'];
$password=$HTTP_POST_VARS['password'];
$db = mysql_connect('localhost','root','');
if (!$db)
{
echo 'Can nt connect to database server';
}
if ( !mysql_select_db( "fyp", $db ) )
die( "Could not open database" );
$query="select * from customer where CustomerID='$cusid'and Pword='$password'";
$result=mysql_query($query);
if(mysql_num_rows($result) >0 )
{
$HTTP_SESSION_VARS['valid_user']=$cusid;}
}
?>
<html>
<head>
<title>login</title>
</head>
<body>
<?php
if(isset($HTTP_SESSION_VARS['valid_user']))
{
header('Location: http://www.yahoo.com');
}
else
{
if(isset($cusid))
{
echo'cant log u in';
}
else
{ echo'you are not logged in';
}
?>
<form method="post">
<p>customer id:
<input type="text" name="cusid" />
</p>
<p>
Password:
<input type="password" name="password" />
</p>
<p>
<input type="submit" value="login" />
</p>
</form>
<?php
}
?>
</body>
</html>
[ 本帖最后由 L3MoN_TeA 于 3-3-2006 02:47 AM 编辑 ] |
|
|
|
|
|
|
|
发表于 3-3-2006 07:00 AM
|
显示全部楼层
原帖由 L3MoN_TeA 于 3-3-2006 02:41 AM 发表
为什么我会这样?
?>
<html>
<head>
<title>login</title>
</head>
<body>
<?php
if(isset($HTTP_SESSION_VARS['valid_user']))
{
header('Location: http://www.yahoo.com');
}
else
{
if(isset($cusid))
{
echo'cant log u in';
}
else
{ echo'you are not logged in';
}
?>
这边有问题. Header (Locatio 必须使用在所有的OutPut之前. 你的则是在<BODY>之后当然出问题啦! |
|
|
|
|
|
|
|
发表于 6-3-2006 02:39 AM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 24-3-2006 03:13 PM
|
显示全部楼层
我用array排列的方法,把档案从database里读出。
然后,将之写进file收著,这些排列好的参数。
这样的做法,能够决绝,每次都从database里读出档案,而造成速度变慢的问题。
可是,另一方面,我不能确定,每一次写进file的排列参数,是否正切。
请问,有何方法,能够做到,检查这方面的问题呢? |
|
|
|
|
|
|
|
发表于 28-3-2006 06:46 PM
|
显示全部楼层
如何检查sendmail
如何检查,如果 sendmail return false
为什么,我尝试放入错误的email address,sendmail 却return ture 呢? |
|
|
|
|
|
|
|
发表于 29-3-2006 11:21 PM
|
显示全部楼层
sendmail是无法检测电子邮件地址的正确与否的,只要能把mail send出去,function就会return true了。
检查电邮地址正确的方法是把密码(有密码的link)放在电邮里寄出去,如果收信人知道该密码(点击有密码的link)就表示他有收到信,表示他的电子邮件地址是正确的。 |
|
|
|
|
|
|
|
发表于 30-3-2006 09:40 AM
|
显示全部楼层
原帖由 hui_yang 于 29-3-2006 11:21 PM 发表
sendmail是无法检测电子邮件地址的正确与否的,只要能把mail send出去,function就会return true了。
检查电邮地址正确的方法是把密码(有密码的link)放在电邮里寄出去,如果收信人知道该密码(点击有密码的l ...
哦,明白了
谢谢 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|