View file biling_panel/cron.php

File size: 2.29Kb
<?
# Проверка на срок активации услуги
# Спасибо за использавание WBilling v1 trial!
# Автор: Пиминов Никита
# Vk: http://vk.com/piminovremont

# ╲╭━━━━╮╲╲╭━━━━━━━━━━━━━╮ 
# ╲┃╭╮╭╮┃╲╲┃ •web-byte.ru• 
# ┗┫┏━━┓┣┛╲╰┳━━━━━━━━━━━━╯ 
# ╲┃╰━━╯┃━━━╯Современный хостинг 
# ╲╰┳━━┳╯╲╲ Дешевый WeB-Хостинг! 
# ╲╲┛╲╲┗╲╲╲ Продажа игровых серверов 
# ╲╲╲╲╲╲╲╲╲ Отзывчивая администрация 
# ╲╲╲╲╲╲╲╲╲ Низкие цены 
# ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
require_once 'wbilling/core.php';
$wbillpayday = mysql_query("SELECT * FROM `orders` WHERE `works_to` < '".time()."' AND `status` = '1'");

while ($payday = mysql_fetch_array($wbillpayday))
{
$id_user = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$payday['id_user']."'"));

if ($id_user['bits'] >= $payday['bits']){
mysql_query("UPDATE `users` SET `bits` = '".($id_user['bits']-$payday['bits'])."' WHERE `id` = '$id_user[id]' LIMIT 1");
mysql_query("UPDATE `orders` SET `power` = '1', `works_to` = '".(time()+60 * 60 * 24 * 30)."' WHERE `id` = '". $payday['id'] ."'");
	
}
	else {
if ($payday['type'] == 1) {
$stophostsvr1 = file_get_contents("https://".$svr1.":1500/ispmgr?authinfo=".$svr1login.":".$svr1pwd."&out=xml&func=user.suspend&elid=".$payday['usr']."&sok=yes");

if(preg_match('<ok/>',$stophostsvr1)){ 

}else{
echo 'Нет подключения к SVR1';}
mysql_query("UPDATE `orders` SET `power` = '2', `works_to` = '".(time()+60 * 60 * 24 * 30)."' WHERE `id` = '". $payday['id'] ."'");

}
if ($payday['type'] == 2) {
}else{
	$stophostsvr2 = file_get_contents("https://".$svr2."/manager/ispmgr?authinfo=".$svr2login.":".$svr2pwd."&out=xml&func=user.enable&elid=".$payday['usr']."&sok=yes");
if(preg_match('<ok/>',$stophostsvr2)){ 

mysql_query("UPDATE `orders` SET `power` = '1', `works_to` = '".(time()+60 * 60 * 24 * 30)."' WHERE `id` = '". $payday['id'] ."'");


}else{
echo 'Нет подключения к SVR2';}
}

		
	}
}	
?>