Jump to content

MySQL blocking PHP from connecting


benphelps

Recommended Posts

I get an error saying the host has been block due to connection errors.

 

I have checked the MySQL query's and they are all error free, I'm not sure why this is happening.

 

Here is the SQL part on my code.

 

 

$createuser = "INSERT INTO `account` (`username`,`sha_pass_hash`,`email`,`last_ip`,`locked`,`tbc`)
VALUES ('".$username."',SHA1(CONCAT(UPPER('".$username."'),':',UPPER('".$pass."'))),'".$email."','".$ip."','2','1')";
mysql_query($createuser);

 

mysql_connect("255.255.255.255", "*****", "*****") or die(mysql_error());
mysql_select_db('realmd');

//////////////////////////////

$online = mysql_num_rows(mysql_query("SELECT online FROM account WHERE online='1';"));
$accounts = mysql_num_rows(mysql_query("SELECT * FROM account;"));

//////////////////////////////

mysql_select_db('characters');
$char1 = mysql_num_rows(mysql_query("SELECT guid FROM characters;"));
$row1 = mysql_fetch_array(mysql_query("SELECT SUM(totaltime) AS total FROM characters;"));
$played1 = $row1['total'];

mysql_select_db('characters2');
$char2 = mysql_num_rows(mysql_query("SELECT guid FROM characters;"));
$row2 = mysql_fetch_array(mysql_query("SELECT SUM(totaltime) AS total FROM characters;"));
$played2 = $row2['total'];

$characters = $char1+$char2;
$played = $played1+$played2;

 

$query = "SELECT * FROM characters WHERE online = '1' ORDER by name";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
// blah blah blah.. handle results
}

 

That's all the PHP that uses MySQL, and about once a day I have to run mysqladmin flush-hosts to allow it to continue.

 

Is there anything I'm missing?

 

/* edit, I connect to a remote server to handle the MySQL requests, its not on the same server as the scripts. */

Link to comment
https://forums.phpfreaks.com/topic/121629-mysql-blocking-php-from-connecting/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.