global $DBHost, $DBPort, $RingDBUserName, $RingDBPassword, $RingDBName;
$ringDb = mysql_connect($DBHost, $RingDBUserName, $RingDBPassword, NULL, $DBPort) or die("can't connect to ring db @'".$DBHost."' with user '".$RingDBUserName."'");
mysql_select_db($RingDBName, $ringDb) or die("can't select ring db: '$RingDBName' Host=$DBHost User=$RingDBUserName (not enough privilege?)");
$ringDb = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword, NULL, $DBPort) or die("can't connect to ring db @'".$DBHost."' with user '".$RingDBUserName."'");
mysqli_select_db($ringDb, $RingDBName) or die("can't select ring db: '$RingDBName' Host=$DBHost User=$RingDBUserName (not enough privilege?)");
return $ringDb;
}
@ -414,20 +420,23 @@ function connect_to_ring_db()
// -------------------------------------
function check_character_belongs_to_guild($charName, $guildName)
{
connect_to_ring_db();
$res = mysql_query(
$ringDb = connect_to_ring_db();
$res = mysqli_query($ringDb,
"SELECT guilds.guild_name FROM guilds
JOIN characters ON characters.guild_id=guilds.guild_id
WHERE char_name='$charName'")
or die("Can't query guild for $charName in DB");
if (false === ($row = mysql_fetch_row($res)))
$row = mysqli_fetch_row($res);
if (!isset($row))
die("Guild not found for char $charName in DB");
if ($row[0] != $guildName)
die("ACCESS DENIED: $charName is not a member of $guildName");
}
$remote_addr = $HTTP_SERVER_VARS['REMOTE_ADDR'];
if ($remote_addr == "213.208.119.226" || $remote_addr == "38.117.236.132")
$remote_addr = $_SERVER['REMOTE_ADDR'];
// if ($remote_addr == "213.208.119.226" || $remote_addr == "38.117.236.132")