Jag har ett problem, jag fattar inte det e koplingen till databasen som inte fungerar om ni kollar in den här sidan. http://www.6suryoye.f2s.com/php/phpbook
O här är filen som det är knas i, snälla hjälp mig:
mysql_connect("3306", "a6suryoye", "jeancan");
echo "<table align=\"center\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\" border=\"0\">\n";
echo "<tr><td><div class=\"maincatnav\">\n";
echo " <br>\n";
echo "</div></td>\n";
if (empty($perpage)) $perpage = 5;
if (empty($pperpage)) $pperpage = 9; //!!! ONLY 5,7,9,11,13 !!!!
if (empty($sort)) $sort = "desc";
if (empty($offset)) $offset = 0;
if (empty($poffset)) $poffset = 0;
$amount = mysql_db_query($database, "SELECT count(*) FROM guestbook");
$amount_array = mysql_fetch_array($amount);
$pages = ceil($amount_array["0"] / $perpage);
$actpage = ($offset+$perpage)/$perpage;
$maxpoffset = $pages-$pperpage;
$middlepage=($pperpage-1)/2;
if ($maxpoffset<0) {$maxpoffset=0;}
echo "<td><div class=\"mainpages\">\n";
if ($admin) {$adminlink="&admin=$admin";}
if ($pages) { // print only when pages > 0
echo "$ad_pages\\n";
if ($offset) {
$noffset=$offset-$perpage;
$npoffset = $noffset/$pperpage-$middlepage;
if ($npoffset\<0) {$npoffset=0;}
if ($npoffset\>$maxpoffset) {$npoffset = $maxpoffset;}
echo "\[\<a href=\\"guestbook.php?offset=$noffset&poffset=$npoffset$adminlink\\"\>\<\</a\>\] ";
}
for($i = $poffset; $i\< $poffset+$pperpage && $i \< $pages; $i++) {
$noffset = $i \* $perpage;
$npoffset = $noffset/$pperpage-$middlepage;
if ($npoffset\<0) {$npoffset = 0;}
if ($npoffset\>$maxpoffset) {$npoffset = $maxpoffset;}
$actual = $i + 1;
if ($actual==$actpage) {
echo "(\<a href=\\"guestbook.php?offset=$noffset&poffset=$npoffset$adminlink\\"\>$actual\</a\> ) ";
} else {
echo "\[\<a href=\\"guestbook.php?offset=$noffset&poffset=$npoffset$adminlink\\"\>$actual\</a\>\] ";
}
}
if ($offset+$perpage\<$amount_array\["0"\]) {
$noffset=$offset+$perpage;
$npoffset = $noffset/$pperpage-$middlepage;
if ($npoffset\<0) {$npoffset=0;}
if ($npoffset\>$maxpoffset) {$npoffset = $maxpoffset;}
echo "\[\<a href=\\"guestbook.php?offset=$noffset&poffset=$npoffset$adminlink\\"\>\>\</a\>\] ";
}
}
echo "</div></td></tr>\n";
echo "</table>\n";
# Start the Page
#################################################################################################
echo "<table align=\"center\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\" border=\"0\">\n";
echo " <tr>\n";
echo " <td class=\"gb_header\">$gb_name</td>\n";
echo " <td class=\"gb_header\">$gb_comments</td>\n";
echo " </tr>\n";
# Get Entrys for current page
#################################################################################################
$result = mysql_db_query($database, "SELECT * FROM guestbook ORDER by id $sort LIMIT $offset, $perpage");
while ($db = mysql_fetch_array($result)) {
$when = strftime("%m/%d/%Y %I:%M %p", $db\["timestamp"\]);
if ($db != "none") {
$email = "\<a href=\\"mailto:".$db."\\"\>\<img src=\\"$image_dir/icons/email.gif\\" alt=\\"Send E-Mail\\" border=\\"0\\" align=\\"right\\"\>\</a\>";
} else {
$email = "";
}
if ($db\[icq\] != 0) {
$icq = "\<a href=\\"http://wwp.icq.com/scripts/contact.dll?msgto=$db\[icq\]\\"\>\<img src=\\"http://wwp.icq.com/scripts/online.dll?icq=" . $db\[icq\] . "&img=5\\" alt=\\"Send ICQ Message\\" border=\\"0\\" align=\\"right\\" height=\\"17\\"\>\</a\>";
} else {
$icq = "";
}
if ($db\[http\] != "none") {
$http = "\<a href=\\"http://$db\[http\]\\" target=\\"\_blank\\"\>\<img src=\\"$image_dir/icons/home.gif\\" alt=\\"View Web Page\\" border=\\"0\\" align=\\"right\\"\>\</a\>";
} else {
$http = "";
}
if ($db\[ip\] != "none") {
if ($admin==$adminpass) {
$ip = "\<img src=\\"$image_dir/icons/ip.gif\\" alt=\\"".$db\[ip\]."\\" align=\\"left\\"\>";
} else {
$ip = "\<img src=\\"$image_dir/icons/ip.gif\\" alt=\\"IP logged\\" align=\\"left\\"\>";
}
} else {
$ip = "";
}
if ($db\[location\]!= "none") {
$location = "$gb_location\<br\>$db\[location\]\<br\>";
} else {
$location = "\<br\>\<br\>";
}
if ($db\[browser\] != "") {
$browser = "\<img src=\\"$image_dir/icons/browser.gif\\" alt=\\"$db\[browser\]\\" align=\\"left\\"\>";
} else {
$browser = "";
}
echo " \<tr\>\\n";
echo " \<td class=\\"gb_table1\\"\>\\n";
echo " \<div class=\\"mainname\\"\>$db\[name\]\</div\>\<br\>\\n";
echo " \<div class=\\"smallleft\\"\>$location\<br\>\</div\>\\n";
echo " \<br\>$icq $http $email $ip $browser\\n";
echo " \</td\>\\n";
echo " \<td class=\\"gb_table2\\"\>\<div class=\\"smallleft\\"\>\\n";
if ($admin==$adminpass) {
echo "\<a href=\\"guestbook_submit.php?delid=$db\[id\]&admin=$admin\\"\>\<img src=\\"$image_dir/icons/trash.gif\\" alt=\\"MODERATOR Delete Entry\\" border=\\"0\\" align=\\"right\\"\>\</a\>";
echo "\<a href=\\"guestbook_submit.php?delcommentid=$db\[id\]&admin=$admin\\"\>\<img src=\\"$image_dir/icons/trashcomment.gif\\" alt=\\"MODERATOR Delete Comment\\" border=\\"0\\" align=\\"right\\"\>\</a\>";
echo "\<a href=\\"guestbook_submit.php?commentid=$db\[id\]&admin=$admin\\"\>\<img src=\\"$image_dir/icons/comment.gif\\" alt=\\"MODERATOR Edit Comment\\" border=\\"0\\" align=\\"right\\"\>\</a\>";
echo "\<div class=\\"spaceleft\\"\> \</div\>\\n";
}
echo " $gb_posted $when\</div\>\<hr\>\<div class=\\"mainleft\\"\>".censor_msg($db\[message\],($admin==$adminpass))."\</div\>\\n";
if($commentid == $db\[id\] && $entry!="changed" && $admin==$adminpass) {
echo "  \\n";
echo " \<form action=\\"guestbook_submit.php\\" method=\\"post\\"\>\\n";
echo " \<input type=\\"hidden\\" name=\\"admin\\" value=\\"$admin\\"\>\<input type=\\"hidden\\" name=\\"commentid\\" value=\\"$commentid\\"\>\\n";
echo " \<div class=\\"comment\\"\>\<textarea name=\\"comment\\" cols=\\"".($text_field_size-5)."\\" rows=\\"5\\"\>".decode_msg($db\[comment\])."\</textarea\>\\n\<BR\>";
echo " \<input type=\\"submit\\"\> \<a href=\\"smiliehelp.php\\"
onClick='enterWindow=window.open(\\"smiliehelp.php\\",\\"Smilie\\",
\\"width=250,height=450,top=100,left=100,scrollbars=yes\\"); return false'
onmouseover=\\"window.status='$smiliehelp'; return true;\\"
onmouseout=\\"window.status=''; return true;\\"\>SmilieHelp\</a\>\</div\>\\n";
echo " \</form\>\\n";
} elseif(!empty($db\[comment\])) {
echo "  \<div class=\\"comment\\"\>".$gb_modcomment.$db\[comment\]."\</div\>\\n";
}
echo " \</td\>\\n \</tr\>\\n";
}
# End of Page reached
#################################################################################################
echo "</table>\n";
#echo "<br>\n";
#echo "</div>";
# Disconnect DB
#################################################################################################
mysql_close();
?>