所以我已经搬到了一个新的主机(从一个免费主机)到 Crazy Domains,一切似乎都很好,但一些代码似乎正在播放。
做了一些研究,它似乎是 fetch 数组。现在,我迷失了解决方案。
在转移到 Crazydomain 托管之前,整个网站都在运行。
这是一条错误消息:
“警告:mysql_fetch_array() 期望参数 1 是资源,布尔值在第 11 行的 /home/lgbtrada/public_html/login.php 中给出”
代码:
<?
session_start();
include("config.php");
include("clean.php");
$login = clean($_GET[login]);
if(isset($_SESSION[usr_name]) && isset($_SESSION[usr_level]) && $login!=logout)
echo('<meta http-equiv="refresh" content="0;url=main.php" />');
else {
$ip = $_SERVER['REMOTE_ADDR'];
$sqlcontent = mysql_query("select * from usr_config");
$content = mysql_fetch_array($sqlcontent);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="css.css" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Usersystem • <? echo("$content[site]");?></title>
</head>
<body>
<div align="center">
<p> </p>
<table width="50%" border="1">
<tr>
<td><div align="center"><? echo("$content[site]");?> UserSystem </div></td>
</tr>
<tr>
<td>
<? if($login!=login){ ?>
<div align="center"><form method="post" action="admin.php?login=login">
Your Username:<br />
<input type="text" name="username" />
<br />
<br />
Password:<br />
<input type="password" name="password" />
<br />
<br />
<input type="hidden" name="ip" value="<? echo("$ip");?>" />
<input type="submit" value="Login" />
<? if($content[pwd]==1){ ?><br /><a href="lostpw.php">Forgot Password?</a> <? } ?><br />
<a href="register.php">Register</a></form></div>
<? }
elseif($login==login)
{
$username = clean($_POST[username]);
$password = md5($_POST[password]);
$date = date("Y-m-d");
$time = date("H:i:s");
$sql = mysql_query("select * from usr_users where username = '$username' AND password = '$password'");
$check = mysql_num_rows($sql);
if($check!=1)
{
echo("Invalid Username or Password!");
echo('<meta http-equiv="refresh" content="1;url=admin.php" />');
$success = "Failed";
if($content[loginlog]==1)
$sqllog = mysql_query("insert into usr_logs(user, ip, time, date, success) values('$username', '$ip', '$time', '$date', '$success')");
}
else
{
$user = mysql_fetch_array($sql);
$_SESSION[usr_name] = $user[username];
$_SESSION[usr_level] = $user[level];
$_SESSION[usr_ip] = $ip;
$success = "Success";
echo("Logged in as $username, Now redirecting..");
echo('<meta http-equiv="refresh" content="1;url=main.php" />');
if($content[loginlog]==1)
$sqllog = mysql_query("insert into usr_logs(user, ip, time, date, success) values('$username', '$ip', '$time', '$date', '$success')");
}
}
if($login==logout)
{
session_unset();
session_destroy();
echo("You are now logged out!");
}
?></td>
</tr>
<tr>
<td><? if($content[loginlog]==1){ ?>Logged: Your IP: <? echo("<b>$ip</b>");?><? } else echo("Your IP was NOT logged");?></td>
</tr>
</table>
<? } ?>
</div>
</body>
</html>
使用我们的新闻系统,它会返回这个;"'; echo stripslashes( $myrow['title'] ); echo ''; echo ' '; echo stripslashes( $myrow['text1'] ); echo '
'; 回声“”;回声''; echo ''.$myrow["reporter"].' | '.$myrow["dtime"].' | 评论 | '.$myrow["views"].' 视图'; }//循环结束?>”
新闻显示代码:
<?php
// load the configuration file.
include("config.php");
//load all news from the database and then OREDER them by newsid
//you will notice that newlly added news will appeare first.
//also you can OREDER by (dtime) instaed of (news id)
$result = mysql_query("SELECT * FROM news ORDER BY newsid DESC LIMIT 7",$connect);
//lets make a loop and get all news from the database
while($myrow = mysql_fetch_assoc($result))
{//begin of loop
//now print the results:
echo '<h2>';
echo stripslashes( $myrow['title'] );
echo '</h2>';
echo '<p>';
echo stripslashes( $myrow['text1'] );
echo '</p>';
echo "<br />";
echo '<a href="https://twitter.com/share" class="twitter-share-button" ata-url="http://www.mylasuni.com/read_more.php?id='.$myrow["newsid"].'" data-text="'.$myrow["title"].'" data-via="mylasuni" data-related="mylasuni">Tweet</a>';
echo '<hr>
<span style="float:right;"><strong><a href="profile.php?user='.$myrow["reporter"].'">'.$myrow["reporter"].'</a></strong> | '.$myrow["dtime"].' | <a href="read_more.php?id='.$myrow["newsid"].'">Comment</a> | '.$myrow["views"].' view(s)</span><br><hr>';
}//end of loop
?>
看了布尔参数和一些 tuts,任何其他可以帮助我的文章你知道吗?请帮我解决这个问题!这个网站是有充分理由的。