本文整理汇总了PHP中redirectTo函数的典型用法代码示例。如果您正苦于以下问题:PHP redirectTo函数的具体用法?PHP redirectTo怎么用?PHP redirectTo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redirectTo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exec_query
/**
* Returns reseller data
*
* @return array Reference to array of data
*/
function &admin_getData()
{
static $data = null;
if (null === $data) {
$stmt = exec_query('SELECT ip_id, ip_number FROM server_ips ORDER BY ip_number');
if ($stmt->rowCount()) {
$data['server_ips'] = $stmt->fetchAll();
} else {
set_page_message(tr('Unable to get the IP address list. Please fix this problem.'), 'error');
redirectTo('manage_users.php');
}
$phpini = iMSCP_PHPini::getInstance();
foreach (array('admin_name' => '', 'password' => '', 'password_confirmation' => '', 'fname' => '', 'lname' => '', 'gender' => 'U', 'firm' => '', 'zip' => '', 'city' => '', 'state' => '', 'country' => '', 'email' => '', 'phone' => '', 'fax' => '', 'street1' => '', 'street2' => '', 'max_dmn_cnt' => '0', 'max_sub_cnt' => '0', 'max_als_cnt' => '0', 'max_mail_cnt' => '0', 'max_ftp_cnt' => '0', 'max_sql_db_cnt' => '0', 'max_sql_user_cnt' => '0', 'max_traff_amnt' => '0', 'max_disk_amnt' => '0', 'software_allowed' => 'no', 'softwaredepot_allowed' => 'no', 'websoftwaredepot_allowed' => 'no', 'support_system' => 'yes', 'customer_id' => '', 'php_ini_system' => $phpini->getResellerPermission('phpiniSystem'), 'php_ini_al_allow_url_fopen' => $phpini->getResellerPermission('phpiniAllowUrlFopen'), 'php_ini_al_display_errors' => $phpini->getResellerPermission('phpiniDisplayErrors'), 'php_ini_al_disable_functions' => $phpini->getResellerPermission('phpiniDisableFunctions'), 'php_ini_al_mail_function' => $phpini->getResellerPermission('phpiniMailFunction'), 'post_max_size' => $phpini->getResellerPermission('phpiniPostMaxSize'), 'upload_max_filesize' => $phpini->getResellerPermission('phpiniUploadMaxFileSize'), 'max_execution_time' => $phpini->getResellerPermission('phpiniMaxExecutionTime'), 'max_input_time' => $phpini->getResellerPermission('phpiniMaxInputTime'), 'memory_limit' => $phpini->getResellerPermission('phpiniMemoryLimit')) as $key => $value) {
if (isset($_POST[$key])) {
$data[$key] = clean_input($_POST[$key]);
} else {
$data[$key] = $value;
}
}
if (isset($_POST['reseller_ips']) && is_array($_POST['reseller_ips'])) {
foreach ($_POST['reseller_ips'] as $key => $value) {
$_POST['reseller_ips'][$key] = clean_input($value);
}
$data['reseller_ips'] = $_POST['reseller_ips'];
} else {
// We are safe here
$data['reseller_ips'] = array();
}
}
return $data;
}
示例2: client_addHtaccessGroup
/**
* Adds Htaccess group.
*
* @param int $domainId Domain unique identifier
* @return
*/
function client_addHtaccessGroup($domainId)
{
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!'), 'error');
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($query, array($groupname, $domainId));
if ($rs->rowCount() == 0) {
$change_status = 'toadd';
$query = "\n\t\t\t\t\tINSERT INTO `htaccess_groups` (\n\t\t\t\t\t `dmn_id`, `ugroup`, `status`\n\t\t\t\t\t) VALUES (\n\t\t\t\t\t ?, ?, ?\n\t\t\t\t\t)\n\t\t\t\t";
exec_query($query, array($domainId, $groupname, $change_status));
send_request();
set_page_message(tr('Htaccess group successfully scheduled for addition.'), 'success');
$admin_login = $_SESSION['user_logged'];
write_log("{$admin_login}: added htaccess group: {$groupname}", E_USER_NOTICE);
redirectTo('protected_user_manage.php');
} else {
set_page_message(tr('This htaccess group already exists.'), 'error');
return;
}
} else {
set_page_message(tr('Invalid htaccess group name.'), 'error');
return;
}
} else {
return;
}
}
示例3: session_check
function session_check($redirect = false, $showErrorMsg = false)
{
$valid = false;
if (defined("SITENAME")) {
if (isset($_SESSION['SESS_USER_ID']) && isset($_SESSION['SESS_PRIVILEGE_ID']) && isset($_SESSION['SESS_ACCESS_ID']) && isset($_SESSION['SESS_TOKEN']) && isset($_SESSION['SESS_SITEID']) && isset($_SESSION['SESS_LOGIN_SITE']) && isset($_SESSION['SESS_ACCESS_SITES']) && isset($_SESSION['SESS_SITEID']) && $_SESSION['SESS_SITEID'] == SiteID) {
if ($_SESSION['SESS_TOKEN'] == session_id() || $_SESSION['MAUTH_KEY'] == generateMAuthKey()) {
if (is_numeric($_SESSION['SESS_PRIVILEGE_ID']) && $_SESSION['SESS_PRIVILEGE_ID'] > 0) {
if ($_SESSION['SESS_LOGIN_SITE'] == $_REQUEST['site']) {
$valid = true;
} elseif (is_array($_SESSION['SESS_ACCESS_SITES']) && in_array(SITENAME, $_SESSION['SESS_ACCESS_SITES'])) {
$valid = true;
}
}
}
}
}
if ($valid) {
return true;
} else {
if ($redirect) {
$relink = SiteLocation . "login";
redirectTo($relink, "SESSION Expired. Going To Login Page");
session_destroy();
exit;
} else {
if ($showErrorMsg) {
trigger_logikserror("Accessing Forbidden Page", E_USER_ERROR, 401);
}
return false;
}
}
}
示例4: client_updateHtaccessUser
/**
* Updates htaccess user.
*
* @param int $dmn_id Domain unique identifier
* @param int $uuser_id Htaccess user unique identifier
* @return
*/
function client_updateHtaccessUser(&$dmn_id, &$uuser_id)
{
if (isset($_POST['uaction']) && $_POST['uaction'] == 'modify_user') {
// we have to add the user
if (isset($_POST['pass']) && isset($_POST['pass_rep'])) {
if (!checkPasswordSyntax($_POST['pass'])) {
return;
}
if ($_POST['pass'] !== $_POST['pass_rep']) {
set_page_message(tr("Passwords do not match."), 'error');
return;
}
$nadmin_password = cryptPasswordWithSalt($_POST['pass'], generateRandomSalt(true));
$change_status = 'tochange';
$query = "\n\t\t\t\tUPDATE\n\t\t\t\t\t`htaccess_users`\n\t\t\t\tSET\n\t\t\t\t\t`upass` = ?, `status` = ?\n\t\t\t\tWHERE\n\t\t\t\t\t`dmn_id` = ?\n\t\t\t\tAND\n\t\t\t\t\t`id` = ?\n\t\t\t";
exec_query($query, array($nadmin_password, $change_status, $dmn_id, $uuser_id));
send_request();
$query = "\n\t\t\t\tSELECT\n\t\t\t\t\t`uname`\n\t\t\t\tFROM\n\t\t\t\t\t`htaccess_users`\n\t\t\t\tWHERE\n\t\t\t\t\t`dmn_id` = ?\n\t\t\t\tAND\n\t\t\t\t\t`id` = ?\n\t\t\t";
$rs = exec_query($query, array($dmn_id, $uuser_id));
$uname = $rs->fields['uname'];
$admin_login = $_SESSION['user_logged'];
write_log("{$admin_login}: updated htaccess user ID: {$uname}", E_USER_NOTICE);
redirectTo('protected_user_manage.php');
}
} else {
return;
}
}
示例5: client_ActivateAutoresponder
/**
* Activate autoresponder of the given mail account with the given autoreponder message
*
* @param int $mailAccountId Mail account id
* @param string $autoresponderMessage Auto-responder message
* @return void
*/
function client_ActivateAutoresponder($mailAccountId, $autoresponderMessage)
{
$autoresponderMessage = clean_input($autoresponderMessage);
if ($autoresponderMessage == '') {
set_page_message(tr('Auto-responder message cannot be empty.'), 'error');
redirectTo("mail_autoresponder_enable.php?mail_account_id={$mailAccountId}");
} else {
$db = iMSCP_Database::getInstance();
try {
$db->beginTransaction();
$query = "SELECT `mail_addr` FROM `mail_users` WHERE `mail_id` = ?";
$stmt = exec_query($query, $mailAccountId);
$query = '
UPDATE
`mail_users`
SET
`status` = ?, `mail_auto_respond` = ?, `mail_auto_respond_text` = ?
WHERE
`mail_id` = ?
';
exec_query($query, array('tochange', 1, $autoresponderMessage, $mailAccountId));
// Purge autoreplies log entries
delete_autoreplies_log_entries();
$db->commit();
// Ask iMSCP daemon to trigger engine dispatcher
send_request();
write_log(sprintf("%s: activated auto-responder for the '%s' mail account", $_SESSION['user_logged'], $stmt->fields['mail_addr']), E_USER_NOTICE);
set_page_message(tr('Auto-responder successfully scheduled for activation.'), 'success');
} catch (iMSCP_Exception_Database $e) {
$db->rollBack();
throw $e;
}
}
}
示例6: UpdateSession
function UpdateSession()
{
global $CONF, $db;
if (request_var('ajax', 0) == 1) {
return true;
}
$_SESSION['last'] = $this->GetSessionFromDB();
if (empty($_SESSION['last']) || !$this->CompareIPs($_SESSION['last']['user_ip'])) {
$this->DestroySession();
redirectTo('index.php?code=2');
}
$SelectPlanet = request_var('cp', 0);
if (!empty($SelectPlanet)) {
$IsPlanetMine = $db->uniquequery("SELECT `id` FROM " . PLANETS . " WHERE `id` = '" . $SelectPlanet . "' AND `id_owner` = '" . $_SESSION['id'] . "';");
}
$_SESSION['path'] = $this->GetPath();
$_SESSION['planet'] = !empty($IsPlanetMine['id']) ? $IsPlanetMine['id'] : $_SESSION['planet'];
$SQL = "UPDATE " . USERS . " as u, " . SESSION . " as s SET ";
$SQL .= "u.`onlinetime` = '" . TIMESTAMP . "', ";
$SQL .= "u.`user_lastip` = '" . $_SERVER['REMOTE_ADDR'] . "', ";
$SQL .= "s.`user_ip` = '" . $_SERVER['REMOTE_ADDR'] . "', ";
$SQL .= "s.`user_side` = '" . $db->sql_escape($_SESSION['path']) . "', ";
$SQL .= "s.`user_ua` = '" . $db->sql_escape($_SERVER['HTTP_USER_AGENT']) . "', ";
$SQL .= "s.`user_method` = '" . $_SERVER["REQUEST_METHOD"] . "', ";
$SQL .= "s.`user_lastactivity` = '" . TIMESTAMP . "' ";
$SQL .= "WHERE ";
$SQL .= "u.`id` = '" . $_SESSION['id'] . "' AND s.`sess_id` = '" . session_id() . "';";
$db->query($SQL);
return true;
}
示例7: validateUser
public function validateUser($username, $password)
{
global $db;
if ($this->validateUsername($username) && $this->validatePassword($password)) {
// success
if ($db->hasRows($result = $db->userNameExists($this->username))) {
$result = $db->fetchArray($result);
//print_r($result);
if (password_verify($this->password, $result['user_password'])) {
$_SESSION['user_id'] = $result['user_id'];
$_SESSION['username'] = $result['user_name'];
$_SESSION['permission'] = $result['permission'];
// the following checks to see if the response is an Ajax response.
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
// ajax message
echo false;
} else {
redirectTo('../public/workshop.php');
}
} else {
echo $this->errors[] = "Incorrect password";
}
} else {
$this->password = "";
echo $this->errors[] = "No such username exists";
}
}
}
示例8: client_pydioAuth
/**
* Pydio authentication
*
* @param int $userId ftp username
* @return bool FALSE on failure
*/
function client_pydioAuth($userId)
{
if (file_exists(GUI_ROOT_DIR . '/data/tmp/failedAJXP.log')) {
@unlink(GUI_ROOT_DIR . '/data/tmp/failedAJXP.log');
}
$credentials = _client_pydioGetLoginCredentials($userId);
if (!$credentials) {
set_page_message(tr('Unknown FTP user.'), 'error');
return false;
}
$contextOptions = array();
// Prepares Pydio absolute Uri to use
if (isSecureRequest()) {
$contextOptions = array('ssl' => array('verify_peer' => false, 'allow_self_signed' => true));
}
$pydioBaseUrl = getBaseUrl() . '/ftp/';
$port = getUriPort();
// Pydio authentication
$context = stream_context_create(array_merge($contextOptions, array('http' => array('method' => 'GET', 'protocol_version' => '1.1', 'header' => array('Host: ' . $_SERVER['SERVER_NAME'] . ($port ? ':' . $port : ''), 'User-Agent: i-MSCP', 'Connection: close')))));
# Getting secure token
$secureToken = file_get_contents("{$pydioBaseUrl}/index.php?action=get_secure_token", false, $context);
$postData = http_build_query(array('get_action' => 'login', 'userid' => $credentials[0], 'login_seed' => '-1', "remember_me" => 'false', 'password' => stripcslashes($credentials[1]), '_method' => 'put'));
$contextOptions = array_merge($contextOptions, array('http' => array('method' => 'POST', 'protocol_version' => '1.1', 'header' => array('Host: ' . $_SERVER['SERVER_NAME'] . ($port ? ':' . $port : ''), 'Content-Type: application/x-www-form-urlencoded', 'X-Requested-With: XMLHttpRequest', 'Content-Length: ' . strlen($postData), 'User-Agent: i-MSCP', 'Connection: close'), 'content' => $postData)));
stream_context_set_default($contextOptions);
# TODO Parse the full response and display error message on authentication failure
$headers = get_headers("{$pydioBaseUrl}?secure_token={$secureToken}", true);
_client_pydioCreateCookies($headers['Set-Cookie']);
redirectTo($pydioBaseUrl);
exit;
}
示例9: logout
public function logout()
{
$_SESSION["logged"] = false;
$_SESSION["id"] = null;
session_destroy();
$this->logged = false;
redirectTo("home");
}
示例10: __construct
public function __construct($title = '')
{
parent::__construct($title);
if (!isset($_SESSION['buy'])) {
redirectTo('/');
}
unset($_SESSION['buy']);
}
示例11: log_in
function log_in()
{
if ($this->logged_in) {
redirectTo("index.php");
} else {
redirectTo("login.php");
}
}
示例12: create
protected function create()
{
$params = arrayKeysSnakeToCamel($_POST['user']);
$user = new User();
$user->fromArray($params);
$user->save();
$this->addFlash("success", "registered");
redirectTo("/");
}
示例13: client_generatePage
/**
* Generates page.
*
* @param iMSCP_pTemplate $tpl Template engine instance
* @param int $dmn_id Domain unique identifier
* @return void
*/
function client_generatePage($tpl, &$dmn_id)
{
if (isset($_GET['uname']) && $_GET['uname'] !== '' && is_numeric($_GET['uname'])) {
$uuser_id = $_GET['uname'];
$tpl->assign('UNAME', tohtml(client_getHtaccessUsername($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(client_getHtaccessUsername($uuser_id, $dmn_id)));
$tpl->assign('UID', $uuser_id);
} else {
redirectTo('protected_user_manage.php');
exit;
// Useless but avoid stupid IDE warning about possibled undefined variable
}
}
// get groups
$query = "SELECT * FROM `htaccess_groups` WHERE `dmn_id` = ?";
$stmt = exec_query($query, $dmn_id);
if ($stmt->rowCount() == 0) {
set_page_message(tr('You have no groups.'), 'error');
redirectTo('protected_user_manage.php');
} else {
$added_in = 0;
$not_added_in = 0;
while (!$stmt->EOF) {
$group_id = $stmt->fields['id'];
$group_name = $stmt->fields['ugroup'];
$members = $stmt->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->assign(array('GRP_IN' => tohtml($group_name), 'GRP_IN_ID' => $group_id));
$tpl->parse('ALREADY_IN', '.already_in');
$grp_in = $group_id;
$added_in++;
}
}
if ($grp_in !== $group_id) {
$tpl->assign(array('GRP_NAME' => tohtml($group_name), 'GRP_ID' => $group_id));
$tpl->parse('GRP_AVLB', '.grp_avlb');
$not_added_in++;
}
$stmt->moveNext();
}
// generate add/remove buttons
if ($added_in < 1) {
$tpl->assign('IN_GROUP', '');
}
if ($not_added_in < 1) {
$tpl->assign('NOT_IN_GROUP', '');
}
}
}
示例14: ShowFleetShortcuts
function ShowFleetShortcuts()
{
global $USER, $LNG, $db;
$a = request_var('a', '');
$mode = request_var('mode', '');
$template = new template();
$template->page_header();
$template->page_footer();
if ($mode == "add") {
if ($_POST) {
$name = request_var('n', $LNG['fl_anonymous']);
$gala = request_var('g', 0);
$sys = request_var('s', 0);
$plan = request_var('p', 0);
$type = request_var('t', 0);
$USER['fleet_shortcut'] .= $name . ',' . $gala . ',' . $sys . ',' . $plan . ',' . $type . "\r\n";
$db->query("UPDATE " . USERS . " SET `fleet_shortcut` = '" . $USER['fleet_shortcut'] . "' WHERE `id` = '" . $USER['id'] . "';");
redirectTo("game." . PHP_EXT . "?page=shortcuts");
}
$template->assign_vars(array('fl_shortcut_add_title' => $LNG['fl_shortcut_add_title'], 'fl_clean' => $LNG['fl_clean'], 'fl_register_shorcut' => $LNG['fl_register_shorcut'], 'fl_back' => $LNG['fl_back'], 'typeselector' => array(1 => $LNG['fl_planet'], 2 => $LNG['fl_debris'], 3 => $LNG['fl_moon'])));
$template->show("fleet_shortcuts_add.tpl");
} elseif (is_numeric($a)) {
$scarray = explode("\r\n", $USER['fleet_shortcut']);
$r = explode(",", $scarray[$a]);
if ($_POST) {
if ($_POST['delete']) {
unset($scarray[$a]);
} else {
$r[0] = request_var('n', '');
$r[1] = request_var('g', 0);
$r[2] = request_var('s', 0);
$r[3] = request_var('p', 0);
$r[4] = request_var('t', 0);
$scarray[$a] = implode(",", $r);
}
$USER['fleet_shortcut'] = implode("\r\n", $scarray);
$db->query("UPDATE " . USERS . " SET fleet_shortcut='" . $USER['fleet_shortcut'] . "' WHERE id=" . $USER['id'] . ";");
exit(redirectTo("game." . PHP_EXT . "?page=shortcuts"));
}
if (empty($USER['fleet_shortcut'])) {
redirectTo("game." . PHP_EXT . "?page=shortcuts");
}
$template->assign_vars(array('fl_back' => $LNG['fl_back'], 'fl_shortcut_edition' => $LNG['fl_shortcut_edition'], 'fl_reset_shortcut' => $LNG['fl_reset_shortcut'], 'fl_register_shorcut' => $LNG['fl_register_shorcut'], 'fl_dlte_shortcut' => $LNG['fl_dlte_shortcut'], 'typeselector' => array(1 => $LNG['fl_planet'], 2 => $LNG['fl_debris'], 3 => $LNG['fl_moon']), 'name' => $r[0], 'galaxy' => $r[1], 'system' => $r[2], 'planet' => $r[3], 'type' => $r[4], 'id' => $a));
$template->show("fleet_shortcuts_edit.tpl");
} else {
$scarray = explode("\r\n", $USER['fleet_shortcut']);
foreach ($scarray as $b) {
if (empty($b)) {
continue;
}
$c = explode(',', $b);
$ShortCuts[] = array('name' => $c[0], 'galaxy' => $c[1], 'system' => $c[2], 'planet' => $c[3], 'type' => $c[4]);
}
$template->assign_vars(array('ShortCuts' => $ShortCuts, 'fl_back' => $LNG['fl_back'], 'fl_planet_shortcut' => $LNG['fl_planet_shortcut'], 'fl_moon_shortcut' => $LNG['fl_moon_shortcut'], 'fl_debris_shortcut' => $LNG['fl_debris_shortcut'], 'fl_no_shortcuts' => $LNG['fl_no_shortcuts'], 'fl_shortcuts' => $LNG['fl_shortcuts'], 'fl_shortcut_add' => $LNG['fl_shortcut_add']));
$template->show("fleet_shortcuts.tpl");
}
}
示例15: sessionInit
function sessionInit()
{
session_start();
if (!isset($_SESSION['loggedin'])) {
// User is not logged in and did not get here via the login page.
redirectTo("login.php");
die;
}
}