qinyezhu 2008-2-10 22:16
现在买的空间关掉了全局变量?怎么办?
我的登录程序是登不了数据库了,不知哪位高手帮我看看我的程序要怎么改,下面是我的登录程序不知要怎么改,请高手指点,谢谢!!!
include("database.php");
$result = mysql_query("select * from $mantable where username='$loginname'") or die(mysql_error());
$number = mysql_num_rows($result);
if ($number ==0 ) {
$information="Sorry! You aren't our adminstrator.you can't make the fuction!";
print "<table width=\"500\" border=\"0\" align=\"center\" >
<tr>
<td><font face=\"Arial\" size=\"2\">$information<br><a href=\"javascript:history.back()\">Please login again!</a></font></td>
</tr>
</table>";
}
if ($number ==1 ){
$row=mysql_fetch_Array($result);
$password=$row[password];
$username=$row[username];
$email=$row[email];
if (strcmp($word,$password)){
$information="Your password is error,Please check the password once more!";
print "<table width=\"500\" border=\"0\" align=\"center\" >
<tr>
<td><font face=\"Arial\" size=\"2\">$information <br><a href=\"javascript:history.back()\">Please login again!</a></font></td>
</tr>
</table>";
}
else {
$information="You have been proved that you are manager,you can login and manage it at once.";
qinyezhu 2008-2-12 15:44
这是database.php
<?
$hostname1 = 'localhost';
$username1 = 'A011';
$pas1 = 'Q123456';
$dbName = 'A011';
$userstable='users';
$protable='product';
$zhucata='zhucatalog';
$fucata='fucatalog';
$newstable='news';
$mantable='manager';
$policy='policy';
$careertable='career';
$producttable='product';
MYSQL_CONNECT($hostname1, $username1, $pas1) OR DIE("Unable to connect to database");
@mysql_select_db( "$dbName") or die( "Unable to select database");
$db=mysql_connect($hostname1, $username1, $pas1);
?>
极品黑公子 2008-2-12 23:15
如何克服php的register_global被关掉[转]
unset($_ENV,$HTTP_ENV_VARS,$_REQUEST,$HTTP_POST_VARS,$HTTP_GET_VARS,$HTTP_POST_FILES,$HTTP_COOKIE_VARS);
if(!get_magic_quotes_gpc()){
Add_S($_POST);
Add_S($_GET);
Add_S($_SESSION); // wrapper of addslashes ()
}
if(!ini_get('register_globals')){
@extract($_FILES,EXTR_SKIP);
}
foreach($_POST as $_key=>$_value){
$$_key=$_POST[$_key];
}
foreach($_GET as $_key=>$_value){
$$_key=$_GET[$_key];
}
利用php独特的变量机制,把全局变量安全地转换成本地变量。phpBIZ中也是用parse_income函数实现类似的功能。记住一点,本地比全局安全。
目前4.3版本的处理方法:
foreach($_POST as $_key=>$_value){
!ereg("^\_",$_key) && !isset($$_key) && $$_key=$_POST[$_key];
}
foreach($_GET as $_key=>$_value){
!ereg("^\_",$_key) && !isset($$_key) && $$_key=$_GET[$_key];
}
再补充:又看到一个函数,更简单了:
import_request_variables('pg');
一句就解决。
zh63573351 2008-2-14 20:23
我还是看不杂懂! 呵呵!