You are here: I'm crazy, why php doesn't transfer variable submitted by web form? « PHP Programming Language « IT news, forums, messages
I'm crazy, why php doesn't transfer variable submitted by web form?

Posted by tigerwang1974 on 04/06/06 13:21

I had previously installed php-4.3.9 and apache-2.0.49 on my solaris9
server and written a php script for user login, it ran well until
today...:-(
today for some reasons I upgraded php to php-5.1.2, complied as
apache's DSO module, and I found the script couldn't work when being
accessed by IE. I didn't know why...It seemed php script hadn't
transfered variables submmitted by web form to itself...now the
following is my script:


<?php
if ($queryflag == 1) {
$ybn="admin";
$ybp="111";
$ybusername=$_POST["username"];
$ybuserpwd=$_POST["password"];
if ($ybusername==$ybn AND $ybuserpwd==$ybp){
session_start();
$_SESSION["admin"]=true;
header("location: testtest.php");
} else {
echo <<<EOM
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>login</title>
<style type="text/css">
<!--
..style5 {font-size: 24px}
..style6 {
font-family: "Times New Roman", Times, serif;
color: #FF0000;
}
..style7 {
font-size: 14px;
color: #FF0000;
}
-->
</style>
</head>

<body>
<table width="200" border="0" align="center">
<tr>
<td height="68" colspan="2">
<form name="form1" method="post" action="login.php">
<table width="474" height="89" border="0"
background="image/log.gif">
<tr>
<td width="77" height="29">&nbsp;</td>
<input type=hidden name=queryflag value=0>
<td width="114" valign="bottom"><input name="username"
type="text" id="username" size="15"></td>
<td width="42">&nbsp;</td>
<td width="125" valign="bottom"><input name="password"
type="password" id="password" size="15"></td>
<td width="82" valign="bottom"><input name="imageField"
type="image" src="image/bt-login.gif" width="46" height="19" border="0"
onclick="this.form.queryflag.value=1"></td>
</tr>
<tr>
<td colspan="5"></td>
</tr>
<tr>
<td height="26" colspan="5"><span class="style7">username or
password error!</span></td>
</tr>
</table>
</form> </td>
</tr>
</table>
</body>
</html>
EOM;
}
} else if (!isset($queryflag)){
echo <<<EOM
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>login</title>
<style type="text/css">
<!--
..style5 {font-size: 24px}
..style6 {
font-family: "Times New Roman", Times, serif;
color: #FF0000;
}
..style7 {
font-size: 16px;
color: #FF0000;
}
-->
</style>
</head>

<body>
<table width="200" border="0" align="center">
<tr>
<td height="68" colspan="2">
<form name="form1" method="post" action="login.php">
<table width="474" height="89" border="0"
background="image/log.gif">
<tr>
<td width="77" height="29">&nbsp;</td>
<td width="114" valign="bottom"><input name="username"
type="text" id="username" size="15"></td>
<td width="42">&nbsp;</td>
<input type=hidden name=queryflag value=0>
<td width="125" valign="bottom"><input name="password"
type="password" id="password" size="15"></td>
<td width="82" valign="bottom"><input name="imageField"
type="image" src="image/bt-login.gif" width="46" height="19" border="0"
onclick="this.form.queryflag.value=1"></td>
</tr>
<tr>
<td colspan="5"></td>
</tr>
<tr>
<td height="26" colspan="5">&nbsp;</td>
</tr>
</table>
</form> </td>
</tr>
</table>
</body>
</html>
EOM;
}
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация