Добро пожаловать, Гость!
Чат - Страница 1
Ошибки и недочеты | Чат
Damal :
я добавить одну игру бота в include room.php это не работает, какая ошибка?
<?
//GET TIME
$fd = fopen("time1.dat", "r");
if(!$fd) return;
$buff_time = intval(fgets($fd));
fclose($fd);
//GET ACTION
$fd = fopen("action1.dat", "r");
if(!$fd) $buff_action = "unknown";
else $buff_action = fgets($fd);
fclose($fd);
if($buff_time < time() && $buff_action != 0)
{
if($buff_action != 0) $action = 3;
}
else
{
if($buff_action == 0 && ($buff_time - time() < 0)) $action = 0;
if($buff_action == 1 && ($buff_time - time() < 135)) $action = 1;
if($buff_action == 2 && ($buff_time - time() < 75)) $action = 2;
if($buff_action == 3 && ($buff_time - time() < 15)) $action = 3;
}
//FIRST START
if($buff_time == 0) $action = 0;
switch($action)
{
//NEW QUESTION
case '0':
$q = @mysql_query("SELECT `id`, `nick` FROM `user` WHERE `place` = 1 AND `time` >= ".time()." ORDER BY RAND() DESC LIMIT 1 ;");
while($user = mysql_fetch_array($q))
{
$uid = $user['id'];
$nick = $user['nick'];
$system = "Dummy_Rummy";
$msg = "<b>For Now Rummy Is <i>$nick</i>.Others
Are Just Dummy.100 Chat Post Added In The Account Of <i>$nick</i>.Thank You.</b>";
mysql_query("INSERT INTO `chat_post` (`id_user`, `time`, `msg`, `room`, `privat`) values('$user[id]', '$time', '".my_esc($msg)."', '$room[id]', '$priv')");
mysql_query("UPDATE `user` SET `balls` = `balls` + '100' WHERE `id`='$user[id]' ");
$qa = @mysql_query("SELECT `id` FROM `user` WHERE `place` = 1;");
while($user = mysql_fetch_array($qa)){
$uida = $user['id'];
mysql_query("UPDATE `user` SET `place` = 0 WHERE `id`='".$uida."';");
}
$fd = fopen("action1.dat", "w");
flock($fd, LOCK_EX);
$puts = fputs($fd, "1");
flock($fd, LOCK_UN);
fclose($fd);
$fd = fopen("inc/time1.dat", "w");
flock($fd, LOCK_EX);
$puts = fputs($fd, (time() + 180 + $intervals[0])); //TIME FOR ANSWER - 15
flock($fd, LOCK_UN);
fclose($fd);
}
break;
//NO ANSWER
case '3':
$fd = fopen("time1.dat", "w");
flock($fd, LOCK_EX);
$puts = fputs($fd, (time() + $intervals[0])); //NEXT QUESTION
flock($fd, LOCK_UN);
fclose($fd);
$fd = fopen("action1.dat", "w");
flock($fd, LOCK_EX);
$puts = fputs($fd, "0");
flock($fd, LOCK_UN);
fclose($fd);
break;
}
?>
Чат
3 Июня 2016я добавить одну игру бота в include room.php это не работает, какая ошибка?
<?
//GET TIME
$fd = fopen("time1.dat", "r");
if(!$fd) return;
$buff_time = intval(fgets($fd));
fclose($fd);
//GET ACTION
$fd = fopen("action1.dat", "r");
if(!$fd) $buff_action = "unknown";
else $buff_action = fgets($fd);
fclose($fd);
if($buff_time < time() && $buff_action != 0)
{
if($buff_action != 0) $action = 3;
}
else
{
if($buff_action == 0 && ($buff_time - time() < 0)) $action = 0;
if($buff_action == 1 && ($buff_time - time() < 135)) $action = 1;
if($buff_action == 2 && ($buff_time - time() < 75)) $action = 2;
if($buff_action == 3 && ($buff_time - time() < 15)) $action = 3;
}
//FIRST START
if($buff_time == 0) $action = 0;
switch($action)
{
//NEW QUESTION
case '0':
$q = @mysql_query("SELECT `id`, `nick` FROM `user` WHERE `place` = 1 AND `time` >= ".time()." ORDER BY RAND() DESC LIMIT 1 ;");
while($user = mysql_fetch_array($q))
{
$uid = $user['id'];
$nick = $user['nick'];
$system = "Dummy_Rummy";
$msg = "<b>For Now Rummy Is <i>$nick</i>.Others
Are Just Dummy.100 Chat Post Added In The Account Of <i>$nick</i>.Thank You.</b>";
mysql_query("INSERT INTO `chat_post` (`id_user`, `time`, `msg`, `room`, `privat`) values('$user[id]', '$time', '".my_esc($msg)."', '$room[id]', '$priv')");
mysql_query("UPDATE `user` SET `balls` = `balls` + '100' WHERE `id`='$user[id]' ");
$qa = @mysql_query("SELECT `id` FROM `user` WHERE `place` = 1;");
while($user = mysql_fetch_array($qa)){
$uida = $user['id'];
mysql_query("UPDATE `user` SET `place` = 0 WHERE `id`='".$uida."';");
}
$fd = fopen("action1.dat", "w");
flock($fd, LOCK_EX);
$puts = fputs($fd, "1");
flock($fd, LOCK_UN);
fclose($fd);
$fd = fopen("inc/time1.dat", "w");
flock($fd, LOCK_EX);
$puts = fputs($fd, (time() + 180 + $intervals[0])); //TIME FOR ANSWER - 15
flock($fd, LOCK_UN);
fclose($fd);
}
break;
//NO ANSWER
case '3':
$fd = fopen("time1.dat", "w");
flock($fd, LOCK_EX);
$puts = fputs($fd, (time() + $intervals[0])); //NEXT QUESTION
flock($fd, LOCK_UN);
fclose($fd);
$fd = fopen("action1.dat", "w");
flock($fd, LOCK_EX);
$puts = fputs($fd, "0");
flock($fd, LOCK_UN);
fclose($fd);
break;
}
?>
Комментарии:
Нет сообщений в теме