首先,你好,
我从2011年开始使用此配置文件。 但是已经离开了一段时间。 现在我尝试再次启动我自己的服务器。 但.config文件让我很难继续我的网站和游戏。 好像我的sql代码比预期的要早,但我不知道如何修改它们给我正确的结果。 我希望有人可以帮助我获得一个有效的Config文件。
请参阅下面的代码和错误代码。 港口转发不应该是任何问题。
配置文件。
<?php
if(stristr($_SERVER['PHP_SELF'], "config.php")) die('FATAL ERROR');
$host = "*"; // host mysql
$user = "*"; // mysql username
$pass = "*"; // mysql password
$pass = "*"; // mysql password
$db = "*"; // mysql db
$loginport = 9999; // loginserver port
$gameport = 9998; // gameserver port
$medalvalue = 1; // value of each gold medal in shop points
$jobprice = 500; // shop price for job changing
//Set the amount of players that will appear in the top for each race (default of TOP 5)
$slayer_rank_limit = 10;
$vampire_rank_limit = 10;
$ousters_rank_limit = 10;
mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
function isAlNum($str) {
if(preg_match("[^0-9a-zA-Z]",$str)) return 0;
return 1;
}
function isNum($str) {
if(preg_match("[^0-9]",$str)) return 0;
return 1;
}
function ismail($str) {
/* if(preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$str)) return true;
else return false;
*/
if (!filter_var($str, FILTER_VALIDATE_EMAIL))
return false;
return true;
}
?>
错误
Deprecated function: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in include() (line 19 of \htdocs\config.php).
Warning: mysql_connect():Can not connect because the target machine actively refused the connection. in include() (line 19 of \htdocs\config.php).
如果有人可以帮我解决一个非常有用的配置文件。
我将配置文件更改为此。
<?php
$connect = mysqli_connect('*', '*', '*', '*');
$loginport = 9999; // loginserver port
$gameport = 9998; // gameserver port
$medalvalue = 1; // value of each gold medal in shop points
$jobprice = 500; // shop price for job changing
//Set the amount of players that will appear in the top for each race (default of TOP 5)
$slayer_rank_limit = 10;
$vampire_rank_limit = 10;
$ousters_rank_limit = 10;
mysqli_connect($host,$user,$pass) or die(mysqli_error());
mysqli_select_db($db) or die(mysqli_error());
function isAlNum($str) {
if(preg_match("[^0-9a-zA-Z]",$str)) return 0;
return 1;
}
function isNum($str) {
if(preg_match("[^0-9]",$str)) return 0;
return 1;
}
function ismail($str) {
/* if(preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$str)) return true;
else return false;
*/
if (!filter_var($str, FILTER_VALIDATE_EMAIL))
return false;
return true;
}
?>
下一个错误,
Warning: mysqli_connect(): (HY000/2002): Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd. in include() (line 19 of C:\xampp\htdocs\config.php).
Warning: mysqli_error() expects exactly 1 parameter, 0 given in include() (line 19 of C:\xampp\htdocs\config.php).