本文整理汇总了PHP中server::terminate方法的典型用法代码示例。如果您正苦于以下问题:PHP server::terminate方法的具体用法?PHP server::terminate怎么用?PHP server::terminate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类server
的用法示例。
在下文中一共展示了server::terminate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
if (!$dbh->config("delacc")) {
die('This feature has been disabled.');
} else {
if ($_POST) {
$user = $_SESSION['cuser'];
$pass = $postvar['password'];
$client = $dbh->client($user);
unset($where);
$where[] = array("is_paid", "=", "0", "AND");
$where[] = array("uid", "=", $user);
$balance_query = $dbh->select("invoices", $where, 0, "1", 1);
if ($dbh->num_rows($balance_query) != 0) {
main::errors("You can't close your account with an outstanding balance. Please contact an administrator for assistance or pay any unpaid invoices.");
}
if (crypto::passhash($pass, $client['salt']) == $client['password']) {
if (server::terminate($client['id'], "", 1)) {
main::errors("Your account has been cancelled successfully.");
session_destroy();
} else {
main::errors("Your account wasn't cancelled. Please try again or contact your system administrator.");
}
} else {
main::errors("The password entered is incorrect.");
}
}
echo style::replaceVar("tpl/client/delete-account.tpl");
}
}
示例2: TerminateClient
private function TerminateClient($client)
{
global $dbh, $postvar, $getvar, $instance;
if (!$postvar['submitreason']) {
$client_uname = main::uname($client['id']);
$reason_array['WARNTEXT'] = 'CAUTION: If you proceed, the account "' . $client_uname . '" will be completely and irrevocably removed from the server and THT.<br><br>Why are you terminating this account? Leave blank if you just feel like terminating them.';
$reason_array['ACTION'] = 'terminating';
$reason_array['ACTIONBUTT'] = 'Terminate Client';
$clientview_array['BOX'] = "";
$clientview_array['CONTENT'] = style::replaceVar("tpl/admin/clients/reason.tpl", $reason_array);
return $clientview_array;
} else {
$command = server::terminate($client['id'], $postvar['reason']);
if ($command == true) {
//Terminated
main::done();
} else {
main::errors($command);
}
}
}
示例3: cron
public function cron()
{
global $dbh, $postvar, $getvar, $instance;
$packages_query = $dbh->select("packages", array("type" => "paid"), 0, 0, 1);
$packages_num_rows = $dbh->num_rows($packages_query);
//Do we have paid packages?
if ($packages_num_rows) {
while ($packages_data = $dbh->fetch_array($packages_query)) {
$i++;
//Do we have multiple packages and aren't on the last one?
if ($packages_data < $i) {
//Did we already pull one package? If so, we don't set the flag for the parenthesis.
if ($pulled_one) {
$where[] = array("pid", "=", $packages_data['id'], "OR");
//We are on the first listing of the paid packages, so we set the flag for the opening parenthesis and mark it that we pulled one already.
} else {
$where[] = array("pid", "=", $packages_data['id'], "OR", 1);
$pulled_one = 1;
}
} else {
//Are we on the last listing of paid listings? If so, we close the parenthesis by setting that flag.
if ($pulled_one) {
$where[] = array("pid", "=", $packages_data['id'], "", 1);
//We only had one listing, so we don't use parenthesis and we don't use "OR."
} else {
$where[] = array("pid", "=", $packages_data['id']);
}
}
//So we can later grab the package's information without needing to repull this data.
$packages_info[$packages_data['id']] = $packages_data;
}
$time = time();
//Look at every last invoice.
$invoices_query = $dbh->select("invoices");
while ($invoices_data = $dbh->fetch_array($invoices_query)) {
$uid = $invoices_data['uid'];
$client = $dbh->client($uid);
//Skip this invoice if it belongs to a user marked as a free user.
if ($client['freeuser']) {
continue;
}
//If the invoice is older than 30 days and we haven't issued a new invoice yet... (This makes sure the user is still on the package
//before issuing a new invoice for it.)
if ($time > $invoices_data['created'] + 2592000 && !in_array($uid, $invoiced_to) && $invoices_data['pid'] == $client['pid']) {
$pack_additional = type::additional($client['pid']);
$amount = coupons::get_discount("paid", $pack_additional['monthly'], $client['user']);
invoice::create($uid, $amount, $time, "Your hosting package invoice for this billing cycle. Package: " . $packages_info[$client['pid']]['name']);
$invoiced_to[] = $uid;
//Track what clients have been sent a new invoice.
}
$lastmonth = $time - 2592000;
$suspenddays = $dbh->config('suspensiondays');
$terminationdays = $suspenddays + $dbh->config('terminationdays');
$suspendseconds = $suspenddays * 24 * 60 * 60;
$terminateseconds = $dbh->config('terminationdays') * 24 * 60 * 60;
//If we have an unpaid bill that's greater than $0 and it's past it's due date...
if ($invoices_data['due'] < $time and $invoices_data['is_paid'] == 0 && $invoices_data['amount'] > 0) {
//If we have a bill that's overdue by $terminationdays + $suspenddays, then we terminate the account...
if ($time - $suspendseconds - $terminateseconds > $invoices_data['due']) {
server::terminate($uid, "Your account was overdue for more than " . $terminationdays . " days.");
$checked_term = 1;
//If we have a bill that's overdue by $suspenddays and the client is active, then we suspend them...
//Just an FYI, if I start(ed) charging for this script, check The Pirate Bay for this script as I always upload my payware stuff there since I know not everyone can afford to pay me.
} elseif ($time - $suspendseconds > $invoices_data['due'] && $client['status'] == '1') {
server::suspend($uid, "Your account is overdue. Please log in and pay your invoice to bring your account out of suspension.");
}
}
}
//If the user does not have an invoice yet and never had one, this will create one for them. The portion above
//handles creating NEW invoices. (It checks for outdated ones and such.)
$users_query = $dbh->select("users", $where, 0, 0, 1);
while ($users_data = $dbh->fetch_array($users_query)) {
//Skip this user if its marked as a free user.
if ($users_data['freeuser']) {
continue;
}
$invoice_data = $dbh->select("invoices", array("pid", "=", $users_data['pid']));
if (!$invoice_data['id']) {
$monthly = type::additional($users_data['pid']);
$amount = $monthly['monthly'];
$amount = coupons::get_discount("paid", $amount, $users_data['id']);
invoice::create($users_data['id'], $amount, $time + 30 * 24 * 60 * 60, "Your hosting package invoice for this billing cycle. Package: " . $packages_info[$users_data['pid']]['name']);
// Create Invoice +30 Days
}
}
}
}