编辑:我的客户在这里给了我错误的细节是正确的代码这是产生问题的区域的一部分。完整的代码太大,但可以在这里找到 http://pastebin.com/9506yzGh 这让我很困惑,在我的虚拟机(测试场)上,这段代码有效!!证明 http://socialneko.koding.com/现在但是在 godaddy 托管它没有。http://socialneko.com/
解析错误:语法错误,第 297 行 /home/content/21/11408921/html/index.php 中的意外 $end
<?php
$ads = array(
"<a href='http://3ds-explore.com'><img src='http://puu.sh/391aC.png'></a>",
"<a href='http://socialpixel.heliohost.org'><img src='/image/socialpixel.png'></a>",
"<a href='http://strike.koding.com'>DSiStrike</a>",
"<a href='http://3dsar7.koding.com'><img src='/image/remixed.png'></a>",
"<a href='http://l09.heliohost.org'><img src='/image/l09.png'></a>"
);
print_r($ads[array_rand($ads)]);
?></center>
<span style="position:absolute;top:60px;left:180px;font-size:10px;color:gray;letter-spacing:-1px;-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;">
<?php echo $database->getNumMembers(); ?> members and growing!
</span>
<br><center><a href="http://mobile.twitter.com/sosharuneko"><img src="/image/follow.png"></a></center><br>
<?php include("footer.php"); ?>
</body>
</html>
页脚.php:
<hr>
<div class="footer" style="font-size:10px;color:grey"> <center>
Total members: <?php echo $database->getNumMembers(); ?><br>
Newcomer: <?php
$getnewcomer = mysqli_query(db(), "SELECT username FROM users ORDER BY id DESC");
$newcomer = mysqli_fetch_row($getnewcomer);
if($session->logged_in){
echo "<a href='/user/".strtolower($newcomer[0])."'>$newcomer[0]</a>";
} else {
echo $newcomer[0];
}
?>
<p> <div class="copyright"> This website is ©2012-2013 SocialNeko.<br> All rights reserved.<p> About :: <a href="/guide/terms.php">Terms</a></center> </div><p>
</div>
db() 函数
$db = new mysqli(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
if($db->connect_errno > 0){
die("<p><b>It looks like we can't connect to the database.</b><br>A team of highly trained monkeys has been dispatched to deal with this situation.<p>If you see them, show them this information:<br>[" . $db->connect_error . "]<br>Refreshing in 8 seconds. <meta http-equiv='REFRESH' content='8;url='>");
//die('Unable to connect to database ');
}
function db()
{
global $db;
global $host;
global $db_username;
global $db_pass;
global $db_name;
if (!$db) {
$db = new mysqli(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
}
return $db;
}