13.05.2011, 20:46
Okay, so: I have a database, a gm and a mysql table.
The MySQL table is for showing bans on a website, everything in GM is okay because when I am banning someone using the command /ban, it appears on the phpmyadmin page, but I have errors at the php page...
Here's the connection.php file
Yeah, it's RafStar's webpage edited by me, so credits go to him for this...
And I also know that I have also changed the mysql_pconnect details because I thought this was the problem.
And the index.php file:
And of course the errors I get when I access the page:
The webhost is provided by HostGator, the database is provided by ToolZ and the samp host is provided by a Romanian firm called Zonek
What have I done wrong here?
P.S.: Sorry for the grammar mistakes, if there are any.
The MySQL table is for showing bans on a website, everything in GM is okay because when I am banning someone using the command /ban, it appears on the phpmyadmin page, but I have errors at the php page...
Here's the connection.php file
Код:
<?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_VehicleSystem = "NotShowing"; $database_VehicleSystem = "rogzoner_samp"; $username_VehicleSystem = "rogzoner_samp"; $password_VehicleSystem = "NotShowing"; $VehicleSystem = mysql_pconnect("NotShowing","rogzoner_samp","NotShowing"); mysql_select_db("rogzoner_samp"); //or trigger_error(mysql_error(),E_USER_ERROR); ?>
And I also know that I have also changed the mysql_pconnect details because I thought this was the problem.
And the index.php file:
Код:
<?php require_once('connection/connection.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $currentPage = $_SERVER["PHP_SELF"]; $currentPage = $_SERVER["PHP_SELF"]; $maxRows_vs = 30; $pageNum_vs = 0; if (isset($_GET['pageNum_vs'])) { $pageNum_vs = $_GET['pageNum_vs']; } $startRow_vs = $pageNum_vs * $maxRows_vs; mysql_select_db($database_VehicleSystem, $VehicleSystem); $query_vs = "SELECT id, name, adminname, ip, reason, FROM bans ORDER BY id ASC"; $query_limit_vs = sprintf("%s LIMIT %d, %d", $query_vs, $startRow_vs, $maxRows_vs); $vs = mysql_query($query_limit_vs, $VehicleSystem) or die(mysql_error()); $row_vs = mysql_fetch_assoc($vs); if (isset($_GET['totalRows_vs'])) { $totalRows_vs = $_GET['totalRows_vs']; } else { $all_vs = mysql_query($query_vs); $totalRows_vs = mysql_num_rows($all_vs); } $totalPages_vs = ceil($totalRows_vs/$maxRows_vs)-1; $queryString_vs = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_vs") == false && stristr($param, "totalRows_vs") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_vs = "&" . htmlentities(implode("&", $newParams)); } } $queryString_vs = sprintf("&totalRows_vs=%d%s", $totalRows_vs, $queryString_vs); $queryString_vs = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_vs") == false && stristr($param, "totalRows_vs") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_vs = "&" . htmlentities(implode("&", $newParams)); } } $queryString_vs = sprintf("&totalRows_vs=%d%s", $totalRows_vs, $queryString_vs); ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Vehicle System Page !</title> <style type="text/css"> <!-- body,td,th { font-family: Lucida Console, Monaco, monospace; font-size: 12px; font-style: italic; color: #F63; font-weight: bold; text-align: center; } body { background-color: #000; background-image: url(pic.jpg); background-repeat: repeat; color: #333; font-weight: normal; } .Values { font-weight: normal; } .pageselect { font-family: "Lucida Console", Monaco, monospace; font-size: 12px; color: #F60; text-decoration: underline; font-weight: bold; font-style: normal; } --> </style></head> <body> <div align="center"> <p> </p> <table width="350" border="0" align="center"> <tr class="tabela"> <th height="21" align="center" bgcolor="#333333" style="font-size: 16px; font-weight: bold;" scope="col">ID</th> <th align="center" valign="middle" bgcolor="#333333" style="font-weight: bold; font-size: 16px; font-style: normal;" scope="col">Player</th> <th bgcolor="#333333" style="font-weight: bold; font-size: 16px; font-style: normal;" scope="col">Admin</th> <th bgcolor="#333333" style="font-weight: bold; font-size: 16px; font-style: normal;" scope="col">IP</th> <th bgcolor="#333333" style="font-weight: bold; font-size: 16px; font-style: normal;" scope="col">Motiv</th> </tr> <?php do { ?> <tr class="tabela"> <td bgcolor="#333333" class="tabela"><?php echo $row_vs['id']; ?></td> <td bgcolor="#666666" class="Values" style="color: #FFF; font-style: normal; font-size: 14px;"><strong><code><?php echo $row_vs['name']; ?></code></strong></td> <td bgcolor="#666666" class="Values" style="color: #FFF; font-style: normal; font-size: 14px;"><strong><code><?php echo $row_vs['adminname']; ?></code></strong></td> <td bgcolor="#666666" class="Values" style="color: #FFF; font-style: normal; font-size: 14px;"><strong><code><?php echo $row_vs['ip']; ?></code></strong></td> <td bgcolor="#666666" class="Values" style="color: #FFF; font-style: normal; font-size: 14px;"><strong><code><?php echo $row_vs['reason']; ?></code></strong></td> </tr> <?php } while ($row_vs = mysql_fetch_assoc($vs)); ?> </table> <p> <table border="0"> <tr class="pageselect"> <td class="pageselect"><?php if ($pageNum_vs > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_vs=%d%s", $currentPage, 0, $queryString_vs); ?>" class="pageselect">First</a> <?php } // Show if not first page ?></td> <td class="pageselect"><?php if ($pageNum_vs > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_vs=%d%s", $currentPage, max(0, $pageNum_vs - 1), $queryString_vs); ?>" class="pageselect"><span class="pageselect">Previous</span></a> <?php } // Show if not first page ?></td> <td><?php if ($pageNum_vs < $totalPages_vs) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_vs=%d%s", $currentPage, min($totalPages_vs, $pageNum_vs + 1), $queryString_vs); ?>" class="pageselect">Next</a> <?php } // Show if not last page ?></td> <td><?php if ($pageNum_vs < $totalPages_vs) { // Show if not last page ?> <span class="Values"><span class="pageselect"><a href="<?php printf("%s?pageNum_vs=%d%s", $currentPage, $totalPages_vs, $queryString_vs); ?>" class="pageselect">Last</a></span></span> <?php } // Show if not last page ?></td> </tr> </table> <p> <span style="color: #666; font-weight: bold;">scripted by RafStar</span><p> </p> </div> </body> </html> <?php mysql_free_result($vs); ?>
Код:
Warning: mysql_pconnect() [function.mysql-pconnect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 110 in /home/x/public_html/banlist/connection/connection.php on line 9 Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'x'@'localhost' (using password: NO) in /home/x/public_html/banlist/connection/connection.php on line 9 Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/x/public_html/banlist/connection/connection.php on line 9 Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/x/public_html/banlist/index.php on line 45 Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/x/public_html/banlist/index.php on line 48 Access denied for user 'x'@'localhost' (using password: NO)
What have I done wrong here?
P.S.: Sorry for the grammar mistakes, if there are any.