本文整理匯總了PHP中type::packagetype方法的典型用法代碼示例。如果您正苦於以下問題:PHP type::packagetype方法的具體用法?PHP type::packagetype怎麽用?PHP type::packagetype使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類type
的用法示例。
在下文中一共展示了type::packagetype方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
unset($where);
$where[] = array("reply", "=", "0", "AND");
$where[] = array("userid", "=", $_SESSION['cuser']);
$all_tickets_query = $dbh->select("tickets", $where, 0, 0, 1);
$client_home_array['TICKETS'] = $dbh->num_rows($all_tickets_query);
unset($where);
$where[] = array("reply", "=", "0", "AND");
$where[] = array("status", "=", "1", "AND");
$where[] = array("userid", "=", $_SESSION['cuser']);
$open_tickets_query = $dbh->select("tickets", $where, 0, 0, 1);
$client_home_array['OPENTICKETS'] = $dbh->num_rows($open_tickets_query);
unset($where);
$where[] = array("reply", "=", "0", "AND");
$where[] = array("status", "=", "3", "AND");
$where[] = array("userid", "=", $_SESSION['cuser']);
$closed_tickets_query = $dbh->select("tickets", $where, 0, 0, 1);
$client_home_array['CLOSEDTICKETS'] = $dbh->num_rows($closed_tickets_query);
unset($where);
$where[] = array("uid", "=", $_SESSION['cuser'], "AND");
$where[] = array("message", "LIKE", "Login%");
$log_data = $dbh->select("logs", $where, array("id", "DESC"), "1");
if ($log_data['logtime']) {
$client_home_array['LASTDATE'] = main::convertdate("n/d/Y", $log_data['logtime']);
$client_home_array['LASTTIME'] = main::convertdate("g:i a", $log_data['logtime']);
$client_home_array['LASTLOGIN'] = $client_home_array['LASTDATE'] . " at " . $client_home_array['LASTTIME'];
} else {
$client_home_array['LASTLOGIN'] = "None";
}
$client_data = $dbh->client($_SESSION['cuser']);
$client_home_array['DATE'] = main::convertdate("n/d/Y", $client_data['signup']);
$client_home_array['EMAIL'] = $client_data['email'];
$client_home_array['ALERTS'] = $dbh->config('alerts');
$client_home_array['UNAME'] = $client_data['user'];
$packages_data = $dbh->select("packages", array("id", "=", $client_data['pid']));
$client_home_array['PACKAGE'] = $packages_data['name'];
unset($where);
$where[] = array("uid", "=", $client_data['id'], "AND");
$where[] = array("is_paid", "=", "0");
$invoices_query = $dbh->select("invoices", $where, 0, 0, 1);
$client_home_array['INVOICES'] = $dbh->num_rows($invoices_query);
unset($where);
$where[] = array("uid", "=", $client_data['id'], "AND");
$where[] = array("message", "LIKE", "Suspended (%");
$suspended_data = $dbh->select("logs", $where, array("id", "DESC"), "1");
switch ($client_data['status']) {
default:
$client_home_array['STATUS'] = "Other";
break;
case "1":
$client_home_array['STATUS'] = "Active";
break;
case "2":
$client_home_array['STATUS'] = "Suspended";
$suspended_message = str_replace(")", "", $suspended_data['message']);
$suspended_message = str_replace("Suspended (", "", $suspended_message);
$client_home_array['STATUS_REASON'] = "<br><br><b>Suspended for:</b> " . $suspended_message;
break;
case "4":
$client_home_array['STATUS'] = "Awaiting Payment";
break;
case "5":
$client_home_array['STATUS'] = "Awaiting Email Confirmation";
break;
case "9":
$client_home_array['STATUS'] = "Cancelled";
break;
}
if (!$client_home_array['STATUS_REASON']) {
$client_home_array['STATUS_REASON'] = "";
}
$typename = type::packagetype($client_data['pid']);
$type_instance = $instance->packtypes[$typename];
if (method_exists($type_instance, "clientBox")) {
$box = $type_instance->clientBox();
$client_home_array['BOX'] = main::sub($box[0], $box[1]);
} else {
$clienthome_array['BOX'] = "";
}
if ($dbh->config('alerts')) {
$client_home_array['ALERTS'] = "<font size = '3'><b>Announcements:</b></font><br><font size = '2'>" . $dbh->config('alerts') . "</font><br><hr size = '1' noshade'><br>";
} else {
$client_home_array['ALERTS'] = "";
}
echo style::replaceVar("tpl/client/client-home.tpl", $client_home_array);
}
示例2: ViewClient
private function ViewClient($client)
{
global $dbh, $postvar, $getvar, $instance;
$client_details_array['DATE'] = main::convertdate("n/d/Y", $client['signup']);
$client_details_array['EMAIL'] = $client['email'];
$client_details_array['UPGRADEINFO'] = "";
$existing_upgrade = $dbh->select("upgrade", array("uid", "=", $client['id']));
$all_packs_query = $dbh->select("packages", array("is_disabled", "=", "0"), array("type", "ASC"), 0, 1);
while ($all_packs_data = $dbh->fetch_array($all_packs_query)) {
$additional = type::additional($all_packs_data['id']);
$monthly = $additional['monthly'];
$signup = $additional['signup'];
unset($info);
if ($all_packs_data['type'] == "p2h") {
$info = "[Signup Posts: " . $signup . ", Monthly Posts: " . $monthly . "] ";
} elseif ($all_packs_data['type'] == "paid") {
$info = "[" . main::money($monthly) . "] ";
}
$packages[] = array("[" . $all_packs_data['type'] . "] " . $info . $all_packs_data['name'], $all_packs_data['id']);
if ($existing_upgrade && $existing_upgrade['newpack'] == $all_packs_data['id']) {
if ($all_packs_data['admin']) {
$admin = " after you approve them";
}
if ($existing_upgrade['flags'] && $existing_upgrade['flags'] < 5) {
$next_cycle = " next billing cycle";
}
$client_details_array['UPGRADEINFO'] = "NOTE: This user is slated for an upgrade to \"" . $all_packs_data['name'] . "\"" . $next_cycle . $admin . ".<br><br>";
}
}
$client_details_array['PACKAGE'] = main::dropdown("newpackage", $packages, $client['pid']);
$client_details_array['USER'] = $client['user'];
$client_details_array['DOMAIN'] = $client['domain'];
$client_details_array['CLIENTIP'] = $client['ip'];
$client_details_array['FIRSTNAME'] = $client['firstname'];
$client_details_array['LASTNAME'] = $client['lastname'];
$client_details_array['ADDRESS'] = $client['address'];
$client_details_array['CITY'] = $client['city'];
$client_details_array['STATE'] = $client['state'];
$client_details_array['ZIP'] = $client['zip'];
$client_details_array['COUNTRY'] = strtolower($client['country']);
$client_details_array['FULLCOUNTRY'] = main::country_code_to_country($client['country']);
$client_details_array['PHONE'] = $client['phone'];
unset($where);
$where[] = array("uid", "=", $client['id'], "AND");
$where[] = array("is_paid", "=", "0");
$invoices_query = $dbh->select("invoices", $where, 0, 0, 1);
$client_details_array['INVOICES'] = $dbh->num_rows($invoices_query);
switch ($client['status']) {
default:
$client_details_array['STATUS'] = "Other";
break;
case "1":
$client_details_array['STATUS'] = "Active";
break;
case "2":
$client_details_array['STATUS'] = "Suspended";
break;
case "3":
$client_details_array['STATUS'] = "Awaiting Validation";
break;
case "4":
$client_details_array['STATUS'] = "Awaiting Payment";
break;
case "5":
$client_details_array['STATUS'] = "Awaiting Email Confirmation";
break;
case "9":
$client_details_array['STATUS'] = "Cancelled";
break;
}
$class = type::packagetype($client['pid']);
$packtype = $instance->packtypes[$class];
if (method_exists($packtype, "acpBox")) {
$box = $packtype->acpBox();
$clientview_array['BOX'] = main::sub($box[0], $box[1]);
} else {
$clientview_array['BOX'] = "";
}
$clientview_array['CONTENT'] = style::replaceVar("tpl/admin/clients/client-details.tpl", $client_details_array);
return $clientview_array;
}
示例3: couponcheck
public function couponcheck()
{
global $dbh, $postvar, $getvar, $instance;
if (empty($getvar['coupon'])) {
echo 1;
return;
} else {
$package_type = type::packagetype($getvar['package']);
if ($package_type == "free") {
echo 0;
return;
}
$coupon_text = coupons::validate_coupon($getvar['coupon'], $getvar['location'], $getvar['username'], $getvar['package']);
if ($coupon_text) {
echo $coupon_text;
return;
} else {
echo 0;
return;
}
}
}
示例4: array
$order_form_array['ADDRESS'] = $postvar['address'];
$order_form_array['CITY'] = $postvar['city'];
$order_form_array['STATE'] = $postvar['state'];
$order_form_array['ZIP'] = $postvar['zip'];
$order_form_array['PHONE'] = $postvar['phone'];
$order_form_array['COUPON'] = $postvar['coupon'] == "" ? $getvar['coupon'] : $postvar['coupon'];
$order_form_array['PACKID'] = $getvar['package'];
$domain_array['DOMAIN'] = $postvar['cdom'];
if (empty($domain_array['DOMAIN'])) {
$domain_array['DOMAIN'] = $postvar['csub'];
}
$order_form_array['TOS'] = $dbh->config("tos");
$order_form_array['TZADJUST'] = main::tzlist($tz_default);
$order_form_array['COUNTRIES'] = main::countries(1, $postvar['country']);
//1 = Make it a drop down instead of pulling an array. The second part makes it set it's default.
$ptype = type::packagetype($getvar['package']);
$order_form_array['TYPESPECIFIC'] = type::orderForm($ptype);
if ($getvar['domsub'] == "dom") {
$order_form_array['DOMORSUB'] = style::replaceVar("tpl/order/domain.tpl", $domain_array);
} else {
$pack = $getvar['package'];
$server_type = type::packageserver($pack);
$serverfile = server::createServer($server_type);
$can_create_subs = $serverfile->subdomains;
if ($can_create_subs == false) {
$maincontent = main::table("Subdomain Error", "Sorry, but the server for this package doesn't allow subdomains to be used without a unique domain present on the account. If you'd like to\n use a domain, please go back and select the domain option.");
} else {
$subdomains_query = $dbh->select("subdomains", array("server", "=", $server_type), array("subdomain", "ASC"), 0, 1);
while ($subdomains_data = $dbh->fetch_array($subdomains_query)) {
$subdomains[] = array($subdomains_data['domain'], $subdomains_data['domain']);
}
示例5: cron
public function cron()
{
global $dbh, $postvar, $getvar, $instance;
if ($dbh->config("p2hcheck") == "") {
// Probably a new install. Cron has never run before.
$dbh->updateConfig("p2hcheck", "0:0:0");
}
$checkdate = explode(":", $dbh->config("p2hcheck"));
if ($checkdate === array($dbh->config("p2hcheck"))) {
$dbh->updateConfig("p2hcheck", $dbh->config("p2hcheck") . ":0:0");
$checkdate = explode(":", $dbh->config("p2hcheck"));
} elseif (array_key_exists(1, $checkdate)) {
if ($checkdate[1] == "") {
$dbh->updateConfig("p2hcheck", $checkdate[0] . ":0:0");
$checkdate = explode(":", $dbh->config("p2hcheck"));
}
}
// If today is the last day of the month (and hasn't been run yet)
if (date("d") == date("t") && ((int) $checkdate[0] < (int) date("m") || (int) $checkdate[0] == (int) date("m") && $checkdate[2] == "0")) {
$users_query = $dbh->select("users");
while ($users_data = $dbh->fetch_array($users_query)) {
//Skip this user if its marked as a free user.
if ($users_data['freeuser']) {
continue;
}
$ptype = type::packagetype($users_data['pid']);
if ($ptype == "p2h") {
$fuser = type::userAdditional($users_data['id']);
$forum = type::additional($users_data['pid'], 'forum');
$this->con = $this->forumCon($forum);
$posts = coupons::totalposts($users_data['id']);
$mposts = $this->getMonthly($users_data['pid'], $users_data['id']);
if ($posts < $mposts) {
// If the user haven't posted enough...
$user = $dbh->client($users_data['id']);
$grace_period = $dbh->config("p2hgraceperiod");
//The grace period in days
$grace_period = $grace_period * 24 * 60 * 60;
if (strtotime(date("Y-m-d") . " 00:00:00") > $users_data['signup'] + $grace_period) {
//This gives the user a grace period.
// Suspend the user.
server::suspend($users_data['id'], "Only posted {$posts} post out of the required {$mposts} monthly posts");
// Output to the cron.
echo "<strong>" . $user['user'] . " (" . $fuser['fuser'] . "):</strong> Suspended for not posting the required amount. ({$posts} out of {$mposts})<br />";
}
}
}
}
// We're done for this month. Prepare for the next.
if (date("m") == 12) {
$checkmonth = "0";
} else {
$checkmonth = date("m");
}
} elseif ((int) date("d") == $dbh->config("p2hwarndate") && (int) $checkdate[1] != 1) {
$users_query = $dbh->select("users");
while ($users_data = $dbh->fetch_array($users_query)) {
//Skip this user if its marked as a free user.
if ($users_data['freeuser']) {
continue;
}
$ptype = type::packagetype($users_data['pid']);
if ($ptype == "p2h") {
$fuser = type::userAdditional($users_data['id']);
$forum = type::additional($users_data['pid'], 'forum');
$this->con = $this->forumCon($forum);
$posts = coupons::totalposts($users_data['id']);
$posts_text = main::s($posts, " Post");
$mposts = $this->getMonthly($users_data['pid'], $users_data['id']);
$mposts_text = main::s($mposts, " post");
$config_url_data = $dbh->select("p2h", array("forumname", "=", $forum));
$furl = $config_url_data['value'];
// If the user hasn't posted enough yet
$grace_period = $dbh->config("p2hgraceperiod");
//The grace period in days
$grace_period = $grace_period * 24 * 60 * 60;
$userinfo = $dbh->client($users_data['id']);
$signup_date = $userinfo['signup'];
if (date("m") != date("m", $signup_date + $grace_period)) {
//If they won't be suspended on this months check, then we don't need to warn them.
$no_email = 1;
}
if ($posts < $mposts && !$no_email) {
$emaildata = email::emailTemplate("p2h-low-post-warning");
$p2hwarning_array['USERPOSTS'] = $posts;
$p2hwarning_array['MONTHLY'] = $mposts;
$p2hwarning_array['URL'] = $furl;
// Warn the user that they still have some more posting to do!
email::send($users_data['email'], $emaildata['subject'], $emaildata['content'], $p2hwarning_array);
// Output to the cron.
echo "<strong>" . $users_data['user'] . " (" . $fuser['fuser'] . "):</strong> Warned for not yet posting the required monthly amount. ({$posts_text} posted out of {$mposts_text}/month)<br />";
}
}
}
// This prevents the post warnings from being sent again today/this month.
$dbh->updateConfig("p2hcheck", $checkdate[0] . ":1:0");
}
}
示例6: coupon
public function coupon($coupon, $user, $package)
{
if (empty($coupon)) {
return true;
}
if (type::packagetype($package) == "free") {
return false;
}
$coupon_text = coupons::validate_coupon($coupon, "orders", $user, $package);
if ($coupon_text) {
return $coupon_text;
}
return false;
}
示例7: validate_coupon
public function validate_coupon($coupcode, $areaused, $uname, $package)
{
global $dbh, $postvar, $getvar, $instance;
$userid = main::userid($uname);
$coupon_info = self::coupon_data($coupcode);
if (empty($coupon_info)) {
return false;
}
if ($coupon_info['expiredate'] != "99/99/9999") {
$today = time();
$coupon_expiry = explode("/", $coupon_info['expiredate']);
$expiry_time = mktime(date("H"), date("i"), date("s"), ltrim($coupon_expiry[0]), ltrim($coupon_expiry[1]), $coupon_expiry[2]);
if ($today >= $expiry_time) {
return false;
}
}
if ($coupon_info['area'] != "both" && $coupon_info['area'] != $areaused) {
return false;
}
if ($coupon_info['user'] != "all" && $coupon_info['user'] != $uname) {
return false;
}
if ($coupon_info['packages'] != "all") {
$available_packs = explode(",", $coupon_info['packages']);
if (!in_array($package, $available_packs)) {
return false;
}
}
if ($coupon_info['limited']) {
$coupons_used_query = $dbh->select("coupons_used", array("coupcode", "=", $coupcode), 0, 0, 1);
$coupons_used_rows = $dbh->num_rows($coupons_used_query);
if ($coupons_used_rows >= $coupon_info['limited']) {
return false;
}
}
$coupon_used = self::user_coupon_data($userid, 0, $coupcode);
if (!empty($coupon_used) && $coupon_used['disabled'] != '2') {
return false;
}
//All checks passed.
//
//Brok
// en
// Eng
// lish
// lol
$package_type = type::packagetype($package);
$package_info = type::additional($package);
$package_monthly = $package_info['monthly'];
$package_p2hinit = $package_info['signup'];
$paidtype = $coupon_info['paidtype'];
$p2hinittype = $coupon_info['p2hinittype'];
$p2hmonthlytype = $coupon_info['p2hmonthlytype'];
$coupon_info['paiddisc'] = self::percent_to_value("paid", $paidtype, $coupon_info['paiddisc'], $package_monthly);
$coupon_info['p2hinitdisc'] = self::percent_to_value("p2h", $p2hinittype, $coupon_info['p2hinitdisc'], $package_p2hinit);
$coupon_info['p2hmonthlydisc'] = self::percent_to_value("p2h", $p2hmonthlytype, $coupon_info['p2hmonthlydisc'], $package_monthly);
if ($package_type == "paid") {
if ($coupon_info['paiddisc'] >= $package_monthly) {
$coupon_text = "Free ";
} else {
$they_pay = $package_monthly - $coupon_info['paiddisc'];
$currency = main::money($they_pay);
$coupon_text = "Only pay " . $currency . " ";
$pay_per_month = "/month";
}
} else {
$init_required = $package_p2hinit - $coupon_info['p2hinitdisc'];
$monthly_required = $package_monthly - $coupon_info['p2hmonthlydisc'];
if ($init_required > 1) {
$s = "s";
}
if ($monthly_required > 1) {
$s2 = "s";
}
if ($coupon_info['p2hinitdisc'] >= $package_p2hinit) {
$coupon_p2hdisc = "0 Posts";
} else {
$coupon_p2hdisc = $init_required . " Post" . $s . " required";
}
if ($coupon_info['p2hmonthlydisc'] >= $package_monthly) {
$coupon_p2hmonth = "0 Posts";
} else {
$coupon_p2hmonth = $monthly_required . " Post" . $s2 . " required";
}
if ($coupon_info['p2hinitdisc'] > 0 && $coupon_info['p2hmonthlydisc'] > 0) {
$coupon_text = $coupon_p2hdisc . " to sign up and " . $coupon_p2hmonth . " for the month";
} else {
if ($coupon_info['p2hinitdisc'] > 0) {
$coupon_text = $coupon_p2hdisc . " to sign up";
$no_goodfor = "1";
//YOU! lol Good for nothing? lol
} else {
$coupon_text = $coupon_p2hmonth . " for the month";
}
}
}
if ($coupon_info['goodfor'] == "life") {
$coupon_text .= $pay_per_month . " for the lifetime of the account.";
}
if ($coupon_info['goodfor'] == "current") {
//.........這裏部分代碼省略.........
示例8: client
function client()
{
global $dbh, $postvar, $getvar, $instance;
ob_start();
// Stop the output buffer
if (!$getvar['page']) {
$getvar['page'] = "home";
}
$page = $dbh->select("clientnav", array("link", "=", $getvar['page']), array("id", "ASC"));
$header = $page['visual'];
$link = "pages/" . $getvar['page'] . ".php";
if (!file_exists($link)) {
$html = "That page doesn't exist.";
} else {
if (preg_match("/[\\.*]/", $getvar['page']) == 0) {
include $link;
$content = new page();
// Main Side Bar HTML
$nav = "Sidebar";
if (!$dbh->config("delacc")) {
$clientnav_query = $dbh->select("clientnav", array("link", "!=", "delete"), array("id", "ASC"), 0, 1);
} else {
$clientnav_query = $dbh->select("clientnav", 0, array("id", "ASC"), 0, 1);
}
while ($clientnav_data = $dbh->fetch_array($clientnav_query)) {
$sidebar_link_array['IMGURL'] = $clientnav_data['icon'];
$sidebar_link_array['LINK'] = "?page=" . $clientnav_data['link'];
$sidebar_link_array['VISUAL'] = $clientnav_data['visual'];
$sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebar_link_array);
}
// Types Navbar
$client = $dbh->client($_SESSION['cuser']);
$packtype = $instance->packtypes[type::packagetype($client['pid'])];
if ($packtype->clientNav) {
foreach ($packtype->clientNav as $key2 => $value) {
$sidebar_link_array['IMGURL'] = $value[2];
$sidebar_link_array['LINK'] = "?page=type&type=" . type::packagetype($client['pid']) . "&sub=" . $value[1];
$sidebar_link_array['VISUAL'] = $value[0];
$sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebar_link_array);
if ($getvar['page'] == "type" && $getvar['type'] == type::packagetype($client['pid']) && $getvar['sub'] == $value[1]) {
define("SUB", $value[3]);
$header = $value[3];
$getvar['myheader'] = $value[3];
}
}
}
$sidebar_link_array['IMGURL'] = "delete.png";
$sidebar_link_array['LINK'] = "?page=logout";
$sidebar_link_array['VISUAL'] = "Logout";
$sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebar_link_array);
$sidebar = style::replaceVar("tpl/sidebar.tpl", $sidebar_array);
//Page Sidebar
if ($content->navtitle) {
$subnav = $content->navtitle;
foreach ($content->navlist as $key => $value) {
$sidebar_link_array['IMGURL'] = $value[1];
$sidebar_link_array['LINK'] = "?page=" . $getvar['page'] . "&sub=" . $value[2];
$sidebar_link_array['VISUAL'] = $value[0];
$sub_sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebar_link_array);
}
$subsidebar = style::replaceVar("tpl/sidebar.tpl", $sub_sidebar_array);
}
if ($getvar['sub'] == "delete" && isset($getvar['do']) && !$_POST && !$getvar['confirm']) {
foreach ($postvar as $key => $value) {
$warning_array['HIDDEN'] .= '<input name="' . $key . '" type="hidden" value="' . $value . '" />';
}
$warning_array['HIDDEN'] .= " ";
$html = style::replaceVar("tpl/warning.tpl", $warning_array);
} elseif ($getvar['sub'] == "delete" && isset($getvar['do']) && $_POST && !$getvar['confirm']) {
if ($postvar['yes']) {
foreach ($getvar as $key => $value) {
if ($i) {
$i = "&";
} else {
$i = "?";
}
$url .= $i . $key . "=" . $value;
}
$url .= "&confirm=1";
main::redirect($url);
} elseif ($postvar['no']) {
main::done();
}
} else {
if (isset($getvar['sub'])) {
ob_start();
$content->content();
$html = ob_get_contents();
// Retrieve the HTML
ob_clean();
// Flush the HTML
} elseif ($content->navlist) {
if ($content->description()) {
$html = $content->description() . "<br><br>";
}
$html .= "Select a sub-page from the sidebar.";
} else {
ob_start();
$content->content();
$html = ob_get_contents();
//.........這裏部分代碼省略.........
示例9: signup
//.........這裏部分代碼省略.........
} else {
if ($packages_data['type'] == "paid") {
$status = "4";
} else {
$status = "1";
}
}
$users_insert = array("user" => $username, "email" => $user_email, "password" => $password_hash, "salt" => $salt, "signup" => $time, "ip" => $ip, "firstname" => $firstname, "lastname" => $lastname, "address" => $address, "city" => $city, "state" => $state, "zip" => $zip, "country" => $country, "phone" => $phone, "status" => $status, "tzadjust" => $tzones, "domain" => $use_dom, "pid" => $package, "additional" => $additional);
$dbh->insert("users", $users_insert);
$users_data = $dbh->select("users", array("user", "=", $username), 0, "1");
$users_bak_insert = array("uid" => $users_data['id'], "user" => $username, "email" => $user_email, "password" => $password_hash, "salt" => $salt, "signup" => $time, "ip" => $ip, "firstname" => $firstname, "lastname" => $lastname, "address" => $address, "city" => $city, "state" => $state, "zip" => $zip, "country" => $country, "phone" => $phone, "status" => $status, "tzadjust" => $tzones, "domain" => $use_dom, "pid" => $package, "additional" => $additional);
$dbh->insert("users_bak", $users_bak_insert);
main::thtlog("Client Registered", 'Registered.', $users_data['id']);
if (!$users_data['id']) {
$return = "Your account could not be created. Please contact your system administrator.";
} else {
if (!empty($coupon_info)) {
main::thtlog("Coupon Used", "Coupon used (" . $coupon_info['coupcode'] . ")", $users_data['id']);
$package_info = type::additional($package);
$packmonthly = $package_info['monthly'];
if ($packages_data['type'] == "paid") {
$coupon_info['p2hmonthlydisc'] = "0";
$coupon_info['paiddisc'] = coupons::percent_to_value("paid", $coupon_info['paidtype'], $coupon_info['paiddisc'], $packmonthly);
} else {
$coupon_info['paiddisc'] = "0";
$coupon_info['p2hmonthlydisc'] = coupons::percent_to_value("p2h", $coupon_info['p2hmonthlytype'], $coupon_info['p2hmonthlydisc'], $packmonthly);
}
$insert_array = array("user" => $users_data['id'], "coupcode" => $coupon_info['coupcode'], "timeapplied" => time(), "packages" => $package, "goodfor" => $coupon_info['goodfor'], "monthsgoodfor" => $coupon_info['monthsgoodfor'], "paiddisc" => $coupon_info['paiddisc'], "p2hmonthlydisc" => $coupon_info['p2hmonthlydisc']);
$dbh->insert("coupons_used", $insert_array);
}
$servers_data = $dbh->select("servers", array("id", "=", $package_server), 0, "1");
$server_host = $servers_data['host'];
$server_ip = $servers_data['ip'];
$server_nameservers = $servers_data['nameservers'];
$server_port = $servers_data['port'];
$server_resellerport = $servers_data['resellerport'];
$url = $dbh->config("url");
$new_acc_email_array['CPPORT'] = $server_port;
$new_acc_email_array['RESELLERPORT'] = $server_resellerport;
$new_acc_email_array['SERVERIP'] = $server_ip;
$new_acc_email_array['NAMESERVERS'] = nl2br($server_nameservers);
$new_acc_email_array['USER'] = $username;
$new_acc_email_array['PASS'] = $password;
$new_acc_email_array['EMAIL'] = $user_email;
$new_acc_email_array['FNAME'] = $firstname;
$new_acc_email_array['LNAME'] = $lastname;
$new_acc_email_array['DOMAIN'] = $use_dom;
$new_acc_email_array['CONFIRM'] = $url . "client/confirm.php?u=" . $username . "&c=" . $time;
$new_acc_email_array['PACKAGE'] = $packages_data['name'];
if ($packages_data['admin'] == 0) {
if ($packages_data['reseller'] == "1") {
$new_acc_email = email::emailTemplate("new-reseller-account");
} else {
$new_acc_email = email::emailTemplate("new-account");
}
$return = "<strong>Your account has been created!</strong><br />You may now <a href = '../client'>login</a> to see your client area or proceed to your <a href = 'http://" . $server_host . ":" . $server_port . "'>control panel</a>. An email has been dispatched to the address on file.";
if (type::packagetype($package) == "paid") {
//Set the user up for when they finish their payment.
$_SESSION['clogged'] = 1;
$_SESSION['cuser'] = $users_data['id'];
}
$donecorrectly = true;
} else {
if ($serverfile->suspend($username, type::packageserver($package), 1) == false) {
$return = "We could not suspend your account! Please contact the admin to suspend it until they validate it. lol";
} else {
$dbh->update("users", array("status" => "3"), array("id", "=", $users_data['id']));
if ($packages_data['reseller'] == "1") {
$new_acc_email = email::emailTemplate("new-reseller-account-adminval");
} else {
$new_acc_email = email::emailTemplate("new-account-adminval");
}
$admin_val_email = email::emailTemplate("admin-validation-requested");
$valarray['LINK'] = $dbh->config("url") . ADMINDIR . "/?page=users&sub=search&do=" . $users_data['id'];
email::staff($admin_val_email['subject'], $admin_val_email['content'], $valarray);
$return = "<strong>Your account is awaiting admin validation!</strong><br />An email has been dispatched to the address on file. You will recieve another email when the admin has looked over your account.";
$donecorrectly = true;
}
}
email::send($new_acc_email_array['EMAIL'], $new_acc_email['subject'], $new_acc_email['content'], $new_acc_email_array);
}
if ($donecorrectly && type::packagetype($package) == "paid") {
$amountinfo = type::additional($package);
$amount = $amountinfo['monthly'];
$due = time() + 2592000;
$notes = "Your hosting package invoice for this billing cycle. Package: " . $packages_data['name'];
if (!empty($coupon_info)) {
$amount = max(0, $amount - $coupon_info['paiddisc']);
}
invoice::create($users_data['id'], $amount, $due, $notes);
$serverfile->suspend($username, type::packageserver($package), 0, 1);
$dbh->update("users", array("status" => $status), array("id", "=", $users_data['id']));
if ($packages_data['admin'] != "1") {
$return = '<div class="errors"><b>You are being redirected to payment! It will load in a couple of seconds.</b></div>';
return true;
}
}
return $return;
}
}