本文整理汇总了PHP中user_goto函数的典型用法代码示例。如果您正苦于以下问题:PHP user_goto函数的具体用法?PHP user_goto怎么用?PHP user_goto使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_goto函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: padd_group
function padd_group($tpl, $sql, $dmn_id)
{
$cfg = EasySCP_Registry::get('Config');
if (isset($_POST['uaction']) && $_POST['uaction'] == 'add_group') {
// we have to add the group
if (isset($_POST['groupname'])) {
if (!validates_username($_POST['groupname'])) {
set_page_message(tr('Invalid group name!'), 'warning');
return;
}
$groupname = $_POST['groupname'];
$query = "\n\t\t\t\tSELECT\n\t\t\t\t\t`id`\n\t\t\t\tFROM\n\t\t\t\t\t`htaccess_groups`\n\t\t\t\tWHERE\n\t\t\t\t\t`ugroup` = ?\n\t\t\t\tAND\n\t\t\t\t\t`dmn_id` = ?\n\t\t\t";
$rs = exec_query($sql, $query, array($groupname, $dmn_id));
if ($rs->recordCount() == 0) {
$change_status = $cfg->ITEM_ADD_STATUS;
$query = "\n\t\t\t\t\tINSERT INTO `htaccess_groups`\n\t\t\t\t\t\t(`dmn_id`, `ugroup`, `status`)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t(?, ?, ?)\n\t\t\t\t";
exec_query($sql, $query, array($dmn_id, $groupname, $change_status));
send_request();
$admin_login = $_SESSION['user_logged'];
write_log("{$admin_login}: add group (protected areas): {$groupname}");
user_goto('protected_user_manage.php');
} else {
set_page_message(tr('Group already exists!'), 'error');
return;
}
} else {
set_page_message(tr('Invalid group name!'), 'error');
return;
}
} else {
return;
}
}
示例2: gen_user_table
/**
* @param EasySCP_TemplateEngine $tpl
*/
function gen_user_table($tpl)
{
$cfg = EasySCP_Registry::get('Config');
$sql = EasySCP_Registry::get('Db');
$query = "\n\t\tSELECT\n\t\t\t`admin_id`, `admin_name`\n\t\tFROM\n\t\t\t`admin`\n\t\tWHERE\n\t\t\t`admin_type` = 'reseller'\n\t\tORDER BY\n\t\t\t`admin_name`\n\t";
$rs = exec_query($sql, $query);
if ($rs->recordCount() == 0) {
set_page_message(tr('Reseller or user list is empty!'), 'info');
user_goto('manage_users.php');
}
$reseller_id = $rs->fields['admin_id'];
$all_resellers = array();
while (!$rs->EOF) {
if (isset($_POST['uaction']) && $_POST['uaction'] === 'change_src' && (isset($_POST['src_reseller']) && $_POST['src_reseller'] == $rs->fields['admin_id'])) {
$selected = $cfg->HTML_SELECTED;
$reseller_id = $_POST['src_reseller'];
} else {
if (isset($_POST['uaction']) && $_POST['uaction'] === 'move_user' && (isset($_POST['dst_reseller']) && $_POST['dst_reseller'] == $rs->fields['admin_id'])) {
$selected = $cfg->HTML_SELECTED;
$reseller_id = $_POST['dst_reseller'];
} else {
$selected = '';
}
}
$all_resellers[] = $rs->fields['admin_id'];
$tpl->append(array('SRC_RSL_OPTION' => tohtml($rs->fields['admin_name']), 'SRC_RSL_VALUE' => $rs->fields['admin_id'], 'SRC_RSL_SELECTED' => $selected));
$tpl->append(array('DST_RSL_OPTION' => tohtml($rs->fields['admin_name']), 'DST_RSL_VALUE' => $rs->fields['admin_id'], 'DST_RSL_SELECTED' => ''));
$rs->moveNext();
}
if (isset($_POST['src_reseller']) && $_POST['src_reseller'] == 0) {
$selected = $cfg->HTML_SELECTED;
$reseller_id = 0;
} else {
$selected = '';
}
$tpl->append(array('SRC_RSL_OPTION' => tr("N/A"), 'SRC_RSL_VALUE' => 0, 'SRC_RSL_SELECTED' => $selected));
if ($reseller_id === 0) {
$query = "\n\t\t\tSELECT\n\t\t\t\t`admin_id`, `admin_name`\n\t\t\tFROM\n\t\t\t\t`admin`\n\t\t\tWHERE\n\t\t\t\t`admin_type` = 'user'\n\t\t\tAND\n\t\t\t\t`created_by` NOT IN (?)\n\t\t\tORDER BY\n\t\t\t\t`admin_name`\n\t\t";
$not_in = implode(',', $all_resellers);
$rs = exec_query($sql, $query, $not_in);
} else {
$query = "\n\t\t\tSELECT\n\t\t\t\t`admin_id`, `admin_name`\n\t\t\tFROM\n\t\t\t\t`admin`\n\t\t\tWHERE\n\t\t\t\t`admin_type` = 'user'\n\t\t\tAND\n\t\t\t\t`created_by` = ?\n\t\t\tORDER BY\n\t\t\t\t`admin_name`\n\t\t";
$rs = exec_query($sql, $query, $reseller_id);
}
if ($rs->recordCount() == 0) {
set_page_message(tr('User list is empty!'), 'info');
$tpl->assign('RESELLER_LIST', '');
} else {
$i = 0;
while (!$rs->EOF) {
$admin_id = $rs->fields['admin_id'];
$admin_id_var_name = 'admin_id_' . $admin_id;
$show_admin_name = decode_idna($rs->fields['admin_name']);
$tpl->append(array('NUMBER' => $i + 1, 'USER_NAME' => tohtml($show_admin_name), 'CKB_NAME' => $admin_id_var_name));
$rs->moveNext();
$i++;
}
}
}
示例3: gen_user_assign
/**
* @param EasySCP_TemplateEngine $tpl
* @param EasySCP_Database $sql
* @param int $dmn_id
*/
function gen_user_assign($tpl, $sql, &$dmn_id)
{
if (isset($_GET['uname']) && $_GET['uname'] !== '' && is_numeric($_GET['uname'])) {
$uuser_id = $_GET['uname'];
$tpl->assign('UNAME', tohtml(get_htuser_name($sql, $uuser_id, $dmn_id)));
$tpl->assign('UID', $uuser_id);
} else {
if (isset($_POST['nadmin_name']) && !empty($_POST['nadmin_name']) && is_numeric($_POST['nadmin_name'])) {
$uuser_id = $_POST['nadmin_name'];
$tpl->assign('UNAME', tohtml(get_htuser_name($sql, $uuser_id, $dmn_id)));
$tpl->assign('UID', $uuser_id);
} else {
user_goto('protected_user_manage.php');
}
}
// get groups
$query = "\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t`htaccess_groups`\n\t\tWHERE\n\t\t\t`dmn_id` = ?\n\t";
$rs = exec_query($sql, $query, $dmn_id);
if ($rs->recordCount() == 0) {
set_page_message(tr('You have no groups!'), 'info');
user_goto('protected_user_manage.php');
} else {
$added_in = 0;
$not_added_in = 0;
while (!$rs->EOF) {
$group_id = $rs->fields['id'];
$group_name = $rs->fields['ugroup'];
$members = $rs->fields['members'];
$members = explode(",", $members);
$grp_in = 0;
// let's generete all groups wher the user is assigned
for ($i = 0, $cnt_members = count($members); $i < $cnt_members; $i++) {
if ($uuser_id == $members[$i]) {
$tpl->append(array('GRP_IN' => tohtml($group_name), 'GRP_IN_ID' => $group_id));
$grp_in = $group_id;
$added_in++;
}
}
if ($grp_in !== $group_id) {
$tpl->append(array('GRP_NAME' => tohtml($group_name), 'GRP_ID' => $group_id));
$not_added_in++;
}
$rs->moveNext();
}
// generate add/remove buttons
if ($added_in != 0) {
$tpl->assign('IN_GROUP', true);
}
if ($not_added_in != 0) {
$tpl->assign('NOT_IN_GROUP', true);
}
}
}
示例4: load_user_data
/**
* Load data from sql
*/
function load_user_data($user_id, $domain_id)
{
global $sub, $als, $mail, $ftp, $sql_db, $sql_user, $traff, $disk;
$sql = EasySCP_Registry::get('Db');
$query = "\n\t\tSELECT\n\t\t\t`domain_id`\n\t\tFROM\n\t\t\t`domain`\n\t\tWHERE\n\t\t\t`domain_id` = ?\n\t\tAND\n\t\t\t`domain_created_id` = ?\n\t";
$rs = exec_query($sql, $query, array($domain_id, $user_id));
if ($rs->recordCount() == 0) {
set_page_message(tr('User does not exist or you do not have permission to access this interface!'), 'error');
user_goto('users.php?psi=last');
}
list(, $sub, , $als, , $mail, , $ftp, , $sql_db, , $sql_user, $traff, $disk) = generate_user_props($domain_id);
load_additional_data($user_id, $domain_id);
}
示例5: change_sql_user_pass
function change_sql_user_pass(&$sql, $db_user_id, $db_user_name)
{
global $cfg;
if (!isset($_POST['uaction'])) {
return;
}
if ($_POST['pass'] === '' && $_POST['pass_rep'] === '') {
set_page_message(tr('Please type user password!'));
return;
}
if ($_POST['pass'] !== $_POST['pass_rep']) {
set_page_message(tr('Entered passwords does not match!'));
return;
}
if (strlen($_POST['pass']) > $cfg['MAX_SQL_PASS_LENGTH']) {
set_page_message(tr('Too long user password!'));
return;
}
$user_pass = $_POST['pass'];
//
// update user pass in the vhcs sql_user table;
//
$query = <<<SQL_QUERY
update
sql_user
set
sqlu_pass = ?
where
sqlu_id = ?
SQL_QUERY;
$rs = exec_query($sql, $query, array($user_pass, $db_user_id));
//
// update user pass in the mysql system tables;
//
$query = <<<SQL_QUERY
SET PASSWORD FOR '{$db_user_name}'@'%' = PASSWORD('{$user_pass}')
SQL_QUERY;
$rs = execute_query($sql, $query);
$query = <<<SQL_QUERY
\tSET PASSWORD FOR '{$db_user_name}'@localhost = PASSWORD('{$user_pass}')
SQL_QUERY;
$rs = execute_query($sql, $query);
write_log($_SESSION['user_logged'] . " : update SQL user password" . $db_user_name);
set_page_message(tr('SQL user password was successfully changed!'));
user_goto('manage_sql.php');
}
示例6: add_user
/**
* @param EasySCP_TemplateEngine $tpl
*/
function add_user($tpl)
{
$cfg = EasySCP_Registry::get('Config');
$sql = EasySCP_Registry::get('Db');
if (isset($_POST['uaction']) && $_POST['uaction'] === 'add_user') {
if (check_user_data()) {
$upass = crypt_user_pass($_POST['pass']);
$user_id = $_SESSION['user_id'];
$username = clean_input($_POST['username']);
$fname = clean_input($_POST['fname']);
$lname = clean_input($_POST['lname']);
$gender = clean_input($_POST['gender']);
$firm = clean_input($_POST['firm']);
$zip = clean_input($_POST['zip']);
$city = clean_input($_POST['city']);
$state = clean_input($_POST['state']);
$country = clean_input($_POST['country']);
$email = clean_input($_POST['email']);
$phone = clean_input($_POST['phone']);
$fax = clean_input($_POST['fax']);
$street1 = clean_input($_POST['street1']);
$street2 = clean_input($_POST['street2']);
if (get_gender_by_code($gender, true) === null) {
$gender = '';
}
$query = "\n\t\t\t\tINSERT INTO `admin`\n\t\t\t\t\t(\n\t\t\t\t\t\t`admin_name`,\n\t\t\t\t\t\t`admin_pass`,\n\t\t\t\t\t\t`admin_type`,\n\t\t\t\t\t\t`domain_created`,\n\t\t\t\t\t\t`created_by`,\n\t\t\t\t\t\t`fname`,\n\t\t\t\t\t\t`lname`,\n\t\t\t\t\t\t`firm`,\n\t\t\t\t\t\t`zip`,\n\t\t\t\t\t\t`city`,\n\t\t\t\t\t\t`state`,\n\t\t\t\t\t\t`country`,\n\t\t\t\t\t\t`email`,\n\t\t\t\t\t\t`phone`,\n\t\t\t\t\t\t`fax`,\n\t\t\t\t\t\t`street1`,\n\t\t\t\t\t\t`street2`,\n\t\t\t\t\t\t`gender`\n\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t'admin',\n\t\t\t\t\t\tunix_timestamp(),\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?\n\t\t\t\t\t)\n\t\t\t";
exec_query($sql, $query, array($username, $upass, $user_id, $fname, $lname, $firm, $zip, $city, $state, $country, $email, $phone, $fax, $street1, $street2, $gender));
$new_admin_id = $sql->insertId();
$user_logged = $_SESSION['user_logged'];
write_log("{$user_logged}: add admin: {$username}");
$user_def_lang = $_SESSION['user_def_lang'];
$user_theme_color = $_SESSION['user_theme'];
$query = "\n\t\t\t\tINSERT INTO `user_gui_props` (\n\t\t\t\t\t`user_id`,\n\t\t\t\t\t`lang`,\n\t\t\t\t\t`layout`\n\t\t\t\t) VALUES (?,?,?)\n\t\t\t";
exec_query($sql, $query, array($new_admin_id, $user_def_lang, $user_theme_color));
send_add_user_auto_msg($user_id, clean_input($_POST['username']), clean_input($_POST['pass']), clean_input($_POST['email']), clean_input($_POST['fname']), clean_input($_POST['lname']), tr('Administrator'), $gender);
$_SESSION['user_added'] = 1;
user_goto('manage_users.php');
} else {
// check user data
$tpl->assign(array('EMAIL' => clean_input($_POST['email'], true), 'USERNAME' => clean_input($_POST['username'], true), 'FIRST_NAME' => clean_input($_POST['fname'], true), 'LAST_NAME' => clean_input($_POST['lname'], true), 'FIRM' => clean_input($_POST['firm'], true), 'ZIP' => clean_input($_POST['zip'], true), 'CITY' => clean_input($_POST['city'], true), 'STATE' => clean_input($_POST['state'], true), 'COUNTRY' => clean_input($_POST['country'], true), 'STREET_1' => clean_input($_POST['street1'], true), 'STREET_2' => clean_input($_POST['street2'], true), 'PHONE' => clean_input($_POST['phone'], true), 'FAX' => clean_input($_POST['fax'], true), 'VL_MALE' => $_POST['gender'] == 'M' ? $cfg->HTML_SELECTED : '', 'VL_FEMALE' => $_POST['gender'] == 'F' ? $cfg->HTML_SELECTED : '', 'VL_UNKNOWN' => $_POST['gender'] == 'U' || empty($_POST['gender']) ? $cfg->HTML_SELECTED : ''));
}
} else {
$tpl->assign(array('EMAIL' => '', 'USERNAME' => '', 'FIRST_NAME' => '', 'LAST_NAME' => '', 'FIRM' => '', 'ZIP' => '', 'CITY' => '', 'STATE' => '', 'COUNTRY' => '', 'STREET_1' => '', 'STREET_2' => '', 'PHONE' => '', 'FAX' => '', 'VL_MALE' => '', 'VL_FEMALE' => '', 'VL_UNKNOWN' => $cfg->HTML_SELECTED));
}
// end else
}
示例7: get_domain_trafic
function get_domain_trafic($from, $to, $domain_id)
{
$sql = EasySCP_Registry::get('Db');
$reseller_id = $_SESSION['user_id'];
$query = "\n\t\tSELECT\n\t\t\t`domain_id`\n\t\tFROM\n\t\t\t`domain`\n\t\tWHERE\n\t\t\t`domain_id` = ? AND `domain_created_id` = ?\n\t";
$rs = exec_query($sql, $query, array($domain_id, $reseller_id));
if ($rs->recordCount() == 0) {
set_page_message(tr('User does not exist or you do not have permission to access this interface!'), 'error');
user_goto('user_statistics.php');
}
$query = "\n\t\tSELECT\n\t\t\tIFNULL(SUM(`dtraff_web_in`), 0) AS web_dr_in,\n\t\t\tIFNULL(SUM(`dtraff_web_out`), 0) AS web_dr_out,\n\t\t\tIFNULL(SUM(`dtraff_ftp_in`), 0) AS ftp_dr_in,\n\t\t\tIFNULL(SUM(`dtraff_ftp_out`), 0) AS ftp_dr_out,\n\t\t\tIFNULL(SUM(`dtraff_mail`), 0) AS mail_dr,\n\t\t\tIFNULL(SUM(`dtraff_pop`), 0) AS pop_dr\n\t\tFROM\n\t\t\t`domain_traffic`\n\t\tWHERE\n\t\t\t`domain_id` = ?\n\t\tAND\n\t\t\t`dtraff_time` >= ?\n\t\tAND\n\t\t\t`dtraff_time` <= ?\n\t";
$rs = exec_query($sql, $query, array($domain_id, $from, $to));
if ($rs->recordCount() == 0) {
return array(0, 0, 0, 0, 0, 0);
} else {
return array($rs->fields['web_dr_in'], $rs->fields['web_dr_out'], $rs->fields['ftp_dr_in'], $rs->fields['ftp_dr_out'], $rs->fields['pop_dr'], $rs->fields['mail_dr']);
}
}
示例8: padd_user
function padd_user($tpl, $sql, $dmn_id)
{
$cfg = EasySCP_Registry::get('Config');
if (isset($_POST['uaction']) && $_POST['uaction'] == 'add_user') {
// we have to add the user
if (isset($_POST['username']) && isset($_POST['pass']) && isset($_POST['pass_rep'])) {
if (!validates_username($_POST['username'])) {
set_page_message(tr('Wrong username!'), 'warning');
return;
}
if (!chk_password($_POST['pass'])) {
if ($cfg->PASSWD_STRONG) {
set_page_message(sprintf(tr('The password must be at least %s chars long and contain letters and numbers to be valid.'), $cfg->PASSWD_CHARS), 'warning');
} else {
set_page_message(sprintf(tr('Password data is shorter than %s signs or includes not permitted signs!'), $cfg->PASSWD_CHARS), 'warning');
}
return;
}
if ($_POST['pass'] !== $_POST['pass_rep']) {
set_page_message(tr('Passwords do not match!'), 'warning');
return;
}
$status = $cfg->ITEM_ADD_STATUS;
$uname = clean_input($_POST['username']);
$upass = crypt_user_pass_with_salt($_POST['pass']);
$query = "\n\t\t\t\tSELECT\n\t\t\t\t\t`id`\n\t\t\t\tFROM\n\t\t\t\t\t`htaccess_users`\n\t\t\t\tWHERE\n\t\t\t\t\t`uname` = ?\n\t\t\t\tAND\n\t\t\t\t\t`dmn_id` = ?\n\t\t\t";
$rs = exec_query($sql, $query, array($uname, $dmn_id));
if ($rs->recordCount() == 0) {
$query = "\n\t\t\t\t\tINSERT INTO `htaccess_users`\n\t\t\t\t\t\t(`dmn_id`, `uname`, `upass`, `status`)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t(?, ?, ?, ?)\n\t\t\t\t";
exec_query($sql, $query, array($dmn_id, $uname, $upass, $status));
send_request('110 DOMAIN htaccess ' . $dmn_id);
$admin_login = $_SESSION['user_logged'];
write_log("{$admin_login}: add user (protected areas): {$uname}");
user_goto('protected_user_manage.php');
} else {
set_page_message(tr('User already exist !'), 'error');
return;
}
}
} else {
return;
}
}
示例9: save_data_to_db
/**
* Add new host plan to DB
*/
function save_data_to_db()
{
global $tpl;
global $hp_name, $hp_php, $hp_phpe, $hp_cgi, $hp_ssl;
global $hp_sub, $hp_als, $hp_mail;
global $hp_ftp, $hp_sql_db, $hp_sql_user;
global $hp_traff, $hp_disk, $hp_countbackup;
global $hpid;
global $hp_backup, $hp_dns;
// global $tos;
$sql = EasySCP_Registry::get('Db');
$err_msg = '';
$description = clean_input($_POST['hp_description']);
$price = clean_input($_POST['hp_price']);
$setup_fee = clean_input($_POST['hp_setupfee']);
$value = clean_input($_POST['hp_value']);
$payment = clean_input($_POST['hp_payment']);
$status = clean_input($_POST['status']);
$tos = clean_input($_POST['hp_tos']);
//$hp_props = "$hp_php;$hp_cgi;$hp_sub;$hp_als;$hp_mail;$hp_ftp;$hp_sql_db;" .
// "$hp_sql_user;$hp_traff;$hp_disk;$hp_backup;$hp_dns;$hp_ssl";
$newProps = array('allow_php' => $hp_php, 'allow_phpe' => $hp_phpe, 'allow_cgi' => $hp_cgi, 'subdomain_cnt' => $hp_sub, 'alias_cnt' => $hp_als, 'mail_cnt' => $hp_mail, 'ftp_cnt' => $hp_ftp, 'db_cnt' => $hp_sql_db, 'sqluser_cnt' => $hp_sql_user, 'traffic' => $hp_traff, 'disk' => $hp_disk, 'disk_countbackup' => $hp_countbackup, 'allow_backup' => $hp_backup, 'allow_dns' => $hp_dns, 'allow_ssl' => $hp_ssl);
$hp_props = serialize($newProps);
$admin_id = $_SESSION['user_id'];
if (reseller_limits_check($sql, $err_msg, $admin_id, $hpid, $hp_props)) {
if (!empty($err_msg)) {
set_page_message($err_msg, 'error');
restore_form($tpl, $sql);
return false;
} else {
$query = "\n\t\t\t\tUPDATE\n\t\t\t\t\t`hosting_plans`\n\t\t\t\tSET\n\t\t\t\t\t`name` = ?,\n\t\t\t\t\t`description` = ?,\n\t\t\t\t\t`props` = ?,\n\t\t\t\t\t`price` = ?,\n\t\t\t\t\t`setup_fee` = ?,\n\t\t\t\t\t`value` = ?,\n\t\t\t\t\t`payment` = ?,\n\t\t\t\t\t`status` = ?,\n\t\t\t\t\t`tos` = ?\n\t\t\t\tWHERE\n\t\t\t\t\t`id` = ?\n\t\t\t\t;\n\t\t\t";
exec_query($sql, $query, array($hp_name, $description, $hp_props, $price, $setup_fee, $value, $payment, $status, $tos, $hpid));
$_SESSION['hp_updated'] = '_yes_';
user_goto('hosting_plan.php');
}
} else {
set_page_message(tr("Hosting plan values exceed reseller maximum values!"), 'warning');
restore_form($tpl, $sql);
return false;
}
}
示例10: not_allowed
function not_allowed()
{
$_SESSION['dnsedit'] = '_no_';
user_goto('dns_overview.php');
}
示例11: check_login
*
* @link http://www.easyscp.net
* @author EasySCP Team
*/
require '../../include/easyscp-lib.php';
check_login(__FILE__);
$cfg = EasySCP_Registry::get('Config');
$tpl = EasySCP_TemplateEngine::getInstance();
$template = 'admin/server_statistic_day.tpl';
global $month, $year, $day;
if (isset($_GET['month']) && isset($_GET['year']) && isset($_GET['day']) && is_numeric($_GET['month']) && is_numeric($_GET['year']) && is_numeric($_GET['day'])) {
$year = $_GET['year'];
$month = $_GET['month'];
$day = $_GET['day'];
} else {
user_goto('server_statistic.php');
}
// static page messages
$tpl->assign(array('TR_PAGE_TITLE' => tr('EasySCP - Admin/Server day stats'), 'TR_SERVER_STATISTICS' => tr('Server statistics'), 'TR_SERVER_DAY_STATISTICS' => tr('Server day statistics'), 'TR_MONTH' => tr('Month:'), 'TR_YEAR' => tr('Year:'), 'TR_DAY' => tr('Day:'), 'TR_HOUR' => tr('Hour'), 'TR_WEB_IN' => tr('Web in'), 'TR_WEB_OUT' => tr('Web out'), 'TR_SMTP_IN' => tr('SMTP in'), 'TR_SMTP_OUT' => tr('SMTP out'), 'TR_POP_IN' => tr('POP3/IMAP in'), 'TR_POP_OUT' => tr('POP3/IMAP out'), 'TR_OTHER_IN' => tr('Other in'), 'TR_OTHER_OUT' => tr('Other out'), 'TR_ALL_IN' => tr('All in'), 'TR_ALL_OUT' => tr('All out'), 'TR_ALL' => tr('All'), 'TR_BACK' => tr('Back'), 'MONTH' => $month, 'YEAR' => $year, 'DAY' => $day));
gen_admin_mainmenu($tpl, 'admin/main_menu_statistics.tpl');
gen_admin_menu($tpl, 'admin/menu_statistics.tpl');
gen_page_message($tpl);
generate_page($tpl);
if ($cfg->DUMP_GUI_DEBUG) {
dump_gui_debug($tpl);
}
$tpl->display($template);
unset_messages();
/**
* @param EasySCP_TemplateEngine $tpl
*/
示例12: gen_detaildom_page
/**
* @param EasySCP_TemplateEngine $tpl
* @param int $user_id
* @param int $domain_id
*/
function gen_detaildom_page($tpl, $user_id, $domain_id)
{
$sql = EasySCP_Registry::get('Db');
$cfg = EasySCP_Registry::get('Config');
// Get domain data
$query = "\n\t\tSELECT\n\t\t\t*,\n\t\t\tIFNULL(`domain_disk_usage`, 0) AS domain_disk_usage\n\t\tFROM\n\t\t\t`domain`\n\t\tWHERE\n\t\t\t`domain_id` = ?\n\t";
$res = exec_query($sql, $query, $domain_id);
$data = $res->fetchRow();
if ($res->recordCount() <= 0) {
user_goto('users.php?psi=last');
}
// Get admin data
$created_by = $_SESSION['user_id'];
$query = "SELECT `admin_name` FROM `admin` WHERE `admin_id` = ? AND `created_by` = ?";
$res1 = exec_query($sql, $query, array($data['domain_admin_id'], $created_by));
// NXW: Unused variable so...
// $data1 = $res1->fetchRow();
$res1->fetchRow();
if ($res1->recordCount() <= 0) {
user_goto('users.php?psi=last');
}
// Get IP info
$query = "SELECT * FROM `server_ips` WHERE `ip_id` = ?";
$ipres = exec_query($sql, $query, $data['domain_ip_id']);
$ipres->fetchRow();
// Get staus name
$dstatus = translate_dmn_status($data['status']);
// Traffic diagram
$fdofmnth = mktime(0, 0, 0, date("m"), 1, date("Y"));
$ldofmnth = mktime(1, 0, 0, date("m") + 1, 0, date("Y"));
$query = "SELECT\n\t\t\tIFNULL(SUM(`dtraff_web_in`), 0) AS dtraff_web_in,\n\t\t\tIFNULL(SUM(`dtraff_web_out`), 0) AS dtraff_web_out,\n\t\t\tIFNULL(SUM(`dtraff_ftp_in`), 0) AS dtraff_ftp_in,\n\t\t\tIFNULL(SUM(`dtraff_ftp_out`), 0) AS dtraff_ftp_out,\n\t\t\tIFNULL(SUM(`dtraff_mail`), 0) AS dtraff_mail,\n\t\t\tIFNULL(SUM(`dtraff_pop`),0) AS dtraff_pop\n\t\tFROM\n\t\t\t`domain_traffic`\n\t\tWHERE\n\t\t\t`domain_id` = ?\n\t\tAND\n\t\t\t`dtraff_time` > ?\n\t\tAND\n\t\t\t`dtraff_time` < ?\n\t";
$res7 = exec_query($sql, $query, array($data['domain_id'], $fdofmnth, $ldofmnth));
$dtraff = $res7->fetchRow();
$sumtraff = $dtraff['dtraff_web_in'] + $dtraff['dtraff_web_out'] + $dtraff['dtraff_ftp_in'] + $dtraff['dtraff_ftp_out'] + $dtraff['dtraff_mail'] + $dtraff['dtraff_pop'];
// NXW: Unused variables so ...
/*
$dtraffmb = sprintf("%.1f", ($sumtraff / 1024) / 1024);
$month = date("m");
$year = date("Y");
*/
$query = "SELECT * FROM `server_ips` WHERE `ip_id` = ?";
$res8 = exec_query($sql, $query, $data['domain_ip_id']);
$ipdat = $res8->fetchRow();
$domain_traffic_limit = $data['domain_traffic_limit'];
$domain_all_traffic = $sumtraff;
$traffic_percent = $domain_all_traffic != 0 ? sprintf("%.2f", 100 * $domain_all_traffic / ($domain_traffic_limit * 1024 * 1024)) : 0;
// Get disk status
$domdu = $data['domain_disk_usage'];
$domdl = $data['domain_disk_limit'];
$domduh = sizeit($domdu);
$disk_percent = sprintf("%.2f", 100 * $domdu / ($domdl * 1024 * 1024));
// Get current mail count
$query = "SELECT COUNT(`mail_id`) AS mcnt " . "FROM `mail_users` " . "WHERE `domain_id` = ? " . "AND `mail_type` NOT RLIKE '_catchall'";
$res6 = exec_query($sql, $query, $data['domain_id']);
$dat3 = $res6->fetchRow();
$mail_limit = translate_limit_value($data['domain_mailacc_limit']);
// FTP stat
$query = "SELECT `gid` FROM `ftp_group` WHERE `groupname` = ?";
$res4 = exec_query($sql, $query, $data['domain_name']);
$ftp_gnum = $res4->rowCount();
if ($ftp_gnum == 0) {
$used_ftp_acc = 0;
} else {
$dat1 = $res4->fetchRow();
$query = "SELECT COUNT(*) AS ftp_cnt FROM `ftp_users` WHERE `gid` = ?";
$res5 = exec_query($sql, $query, $dat1['gid']);
$dat2 = $res5->fetchRow();
$used_ftp_acc = $dat2['ftp_cnt'];
}
$ftp_limit = translate_limit_value($data['domain_ftpacc_limit']);
// Get sql database count
$query = "SELECT COUNT(*) AS dnum FROM `sql_database` WHERE `domain_id` = ?";
$res = exec_query($sql, $query, $data['domain_id']);
$dat5 = $res->fetchRow();
$sql_db = translate_limit_value($data['domain_sqld_limit']);
// Get sql users count
$query = "SELECT COUNT(u.`sqlu_id`) AS ucnt FROM sql_user u, sql_database d WHERE u.`sqld_id` = d.`sqld_id` AND d.`domain_id` = ?";
$res = exec_query($sql, $query, $data['domain_id']);
$dat6 = $res->fetchRow();
$sql_users = translate_limit_value($data['domain_sqlu_limit']);
// Get subdomain
$query = "SELECT COUNT(`subdomain_id`) AS sub_num FROM `subdomain` WHERE `domain_id` = ?";
$res1 = exec_query($sql, $query, $domain_id);
$sub_num_data = $res1->fetchRow();
$query = "SELECT COUNT(`subdomain_alias_id`) AS sub_num FROM `subdomain_alias` WHERE `alias_id` IN (SELECT `alias_id` FROM `domain_aliasses` WHERE `domain_id` = ?)";
$res1 = exec_query($sql, $query, $domain_id);
$alssub_num_data = $res1->fetchRow();
$sub_dom = translate_limit_value($data['domain_subd_limit']);
// Get domain aliases
$query = "SELECT COUNT(*) AS alias_num FROM `domain_aliasses` WHERE `domain_id` = ?";
$res1 = exec_query($sql, $query, $domain_id);
$alias_num_data = $res1->fetchRow();
// Check if Backup support is available for this user
switch ($data['allowbackup']) {
case "full":
//.........这里部分代码省略.........
示例13: check_login
check_login(__FILE__);
$reseller_id = $_SESSION['user_created_by'];
if (!hasTicketSystem($reseller_id)) {
user_goto('index.php');
}
$back_url = 'ticket_system.php';
$user_id = $_SESSION['user_id'];
if (isset($_GET['ticket_id']) && $_GET['ticket_id'] != '') {
$ticket_id = $_GET['ticket_id'];
$user_id = $_SESSION['user_id'];
$query = "\n\t\tSELECT\n\t\t\t`ticket_status`\n\t\tFROM\n\t\t\t`tickets`\n\t\tWHERE\n\t\t\t`ticket_id` = ?\n\t\tAND\n\t\t\t(`ticket_from` = ? OR `ticket_to` = ?)\n\t;";
$rs = exec_query($sql, $query, array($ticket_id, $user_id, $user_id));
if ($rs->recordCount() == 0) {
user_goto('ticket_system.php');
}
$back_url = getTicketStatus($ticket_id) == 0 ? 'ticket_closed.php' : 'ticket_system.php';
deleteTicket($ticket_id);
write_log(sprintf("%s: deletes support ticket %d", $_SESSION['user_logged'], $ticket_id));
set_page_message(tr('Support ticket deleted successfully!'), 'info');
} elseif (isset($_GET['delete']) && $_GET['delete'] == 'open') {
deleteTickets('open', $user_id);
write_log(sprintf("%s: deletes all open support tickets.", $_SESSION['user_logged']));
set_page_message(tr('All open support tickets deleted successfully!'), 'info');
} elseif (isset($_GET['delete']) && $_GET['delete'] == 'closed') {
deleteTickets('closed', $user_id);
write_log(sprintf("%s: deletes all closed support ticket.", $_SESSION['user_logged']));
set_page_message(tr('All closed support tickets deleted successfully!'), 'info');
$back_url = 'ticket_closed.php';
}
user_goto($back_url);
示例14: date
$template = 'reseller/user_statistics.tpl';
$rid = $_SESSION['user_id'];
$name = $_SESSION['user_logged'];
$month = date('m');
$year = date('Y');
if (isset($_POST['month']) && isset($_POST['year'])) {
$year = intval($_POST['year']);
$month = intval($_POST['month']);
} else {
if (isset($_GET['month']) && isset($_GET['year'])) {
$month = intval($_GET['month']);
$year = intval($_GET['year']);
}
}
if (!is_numeric($rid) || !is_numeric($month) || !is_numeric($year)) {
user_goto('./reseller_statistics.php');
}
// static page messages
gen_logged_from($tpl);
$tpl->assign(array('TR_PAGE_TITLE' => tr('EasySCP - Admin/Reseller User Statistics'), 'TR_RESELLER_USER_STATISTICS' => tr('Reseller users table'), 'TR_MONTH' => tr('Month'), 'TR_YEAR' => tr('Year'), 'TR_SHOW' => tr('Show'), 'TR_NO_DOMAINS' => tr('This reseller has no domains yet.'), 'TR_DOMAIN_NAME' => tr('Domain'), 'TR_TRAFF' => tr('Traffic<br />usage'), 'TR_DISK' => tr('Disk<br />usage'), 'TR_WEB' => tr('Web<br />traffic'), 'TR_FTP_TRAFF' => tr('FTP<br />traffic'), 'TR_SMTP' => tr('SMTP<br />traffic'), 'TR_POP3' => tr('POP3/IMAP<br />traffic'), 'TR_SUBDOMAIN' => tr('Subdomain'), 'TR_ALIAS' => tr('Alias'), 'TR_MAIL' => tr('Mail'), 'TR_FTP' => tr('FTP'), 'TR_SQL_DB' => tr('SQL<br />database'), 'TR_SQL_USER' => tr('SQL<br />user'), 'VALUE_NAME' => $name, 'VALUE_RID' => $rid));
gen_reseller_mainmenu($tpl, 'reseller/main_menu_statistics.tpl');
gen_reseller_menu($tpl, 'reseller/menu_statistics.tpl');
gen_select_lists($tpl, $month, $year);
generate_page($tpl, $rid, $name);
gen_page_message($tpl);
if ($cfg->DUMP_GUI_DEBUG) {
dump_gui_debug($tpl);
}
$tpl->display($template);
unset_messages();
/**
示例15: exec_query
$query = <<<SQL_QUERY
delete from
ftp_group
where
gid = ?
SQL_QUERY;
$rs = exec_query($sql, $query, array($ftp_gid));
} else {
$query = <<<SQL_QUERY
update
ftp_group
set
members = ?
where
gid = ?
SQL_QUERY;
$rs = exec_query($sql, $query, array($members, $ftp_gid));
}
$query = <<<SQL_QUERY
delete from
ftp_users
where
userid = ?
SQL_QUERY;
$rs = exec_query($sql, $query, array($ftp_id));
write_log($_SESSION['user_logged'] . " : delete FTP account -> " . $_GET['id']);
set_page_message(tr('FTP account deleted successfully!'));
user_goto('ftp_accounts.php');
} else {
user_goto('ftp_accounts.php');
}