本文整理汇总了PHP中location函数的典型用法代码示例。如果您正苦于以下问题:PHP location函数的具体用法?PHP location怎么用?PHP location使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了location函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Login
function Login()
{
if ($_COOKIE["ID_USUARIO"] == "") {
msg_box("ERRO! Faça Login.");
parent . location("index.php");
}
}
示例2: restrict_access
function restrict_access($levels)
{
if (!user_access($levels)) {
// Access forbidden
$user_level = $_SESSION['permissions'];
if ($user_level == 'X') {
alert('You need to log in to do that.', -1);
require_once PATH::root() . '/Account/Signin.php';
die;
} else {
if ($user_level == 'E') {
location('Account/Verify_Email');
} else {
if ($user_level == 'P') {
location('Account/Approve');
} else {
if ($user_level == '+') {
location('Admin/Super_Admin');
} else {
if ($user_level == 'B') {
location('Account/Banned');
} else {
// Go home - e.g. if you're logged in and it's restrict_access('X') on Signin, you shouldn't be signing in again. It'll just bring you back home.
location('Home');
}
}
}
}
}
}
}
示例3: OtherLogin
public function OtherLogin()
{
$ary_get = $this->_get();
$ary_data = array();
$ary_data['state'] = $_SESSION['state'] = md5(uniqid(rand(), TRUE));
if ($ary_get['t'] == 'qq') {
$ary_data['scope'] = $_SESSION['scope'] = "get_user_info,add_share,get_info,list_album,add_album,upload_pic,add_topic,add_one_blog,add_weibo";
} else {
if ($ary_get['t'] == 'tqq') {
$ary_data['scope'] = 'all';
} else {
if ($ary_get['scope']) {
$ary_data['scope'] = 'email,direct_messages_write,direct_messages_read,friendships_groups_read,friendships_groups_write,statuses_to_me_read';
}
}
}
$ary_data['response_type'] = "code";
$url = str_replace('__APP__/', '/', 'http://' . $_SERVER['HTTP_HOST'] . U('Home/Oauth/OtherCallbackLogin', array('t' => $ary_get['t'])));
$ary_data['redirect_uri'] = $url;
$type = ucwords($ary_get['t']);
$config = M("Oauth")->where(array('code' => $type, 'status' => '1'))->find();
$ary_config = json_decode($config['config'], true);
${$ary_get}['t'] = new $type($ary_config['app_key'], $ary_config['app_secret']);
$loginUrl = ${$ary_get}['t']->getOauthUrl($ary_data);
location($loginUrl);
exit;
}
示例4: admin
public function admin()
{
if ($this->is_back()) {
if ($this->parent->get_type() == 'Base_Admin') {
$this->parent->reset();
} else {
location(array());
}
return;
}
$form = $this->init_module(Libs_QuickForm::module_name(), 'Changing template');
$themes = Base_Theme::list_themes();
$form->addElement('header', 'install_module_header', __('Themes Administration'));
$form->addElement('select', 'theme', __('Choose template'), $themes);
$form->addElement('static', null, '', '<br /><br />');
$form->addElement('header', 'upload_theme_header', __('Upload template'));
$form->setDefaults(array('theme' => Variable::get('default_theme')));
if ($form->validate()) {
$form->process(array(&$this, 'submit_admin'));
} else {
$form->display();
if (class_exists('ZipArchive')) {
$this->pack_module(Utils_FileUpload::module_name(), array(array($this, 'upload_template'), __('Upload template')));
// Base_ActionBarCommon::add('edit',__('Manage templates'),$this->create_callback_href(array($this,'download_template')));
}
}
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
}
示例5: process
public function process()
{
$http_host = $_SERVER['HTTP_HOST'];
if ($http_host == 'localhost:8080') {
$http_host = 'localhost';
}
$host_name = 'http://' . $http_host;
$actual_url = str_replace($host_name, '', APPLICATION_ROOT);
$actual_url = str_replace($actual_url, '', $_SERVER['REQUEST_URI']);
$size = $this->getP3();
if (!$size) {
location('/error/base/' . urlencode('The url was invalid'));
}
$size_ex = explode('x', $size);
$height = isset($size_ex[0]) ? $size_ex[0] : '100';
$width = isset($size_ex[1]) ? $size_ex[1] : '100';
$image_path = str_replace('/images/process/' . $size, '', $actual_url);
$full_image_path = 'http://' . $http_host . $image_path;
$headers = get_headers($full_image_path);
foreach ($headers as $header) {
if (strpos($header, 'Content-Type') !== false) {
header($header);
}
}
$new_url = 'http://' . $http_host . href('/framework/external/timthumb/timthumb.php');
$new_url .= '?src=' . $image_path;
$new_url .= '&h=' . $height;
$new_url .= '&w=' . $width;
echo file_get_contents($new_url);
}
示例6: redirectWhenNotSignedIn
public static function redirectWhenNotSignedIn()
{
$session = CL_Session::get_instance();
$id = $session->get('signedId');
if ($id === FALSE) {
location('/user/login');
exit;
}
}
示例7: admin
/**
* For internal use only.
*/
public function admin() {
if($this->is_back()) {
if($this->parent->get_type()=='Base_Admin')
$this->parent->reset();
else
location(array());
return;
}
Base_ActionBarCommon::add('back',__('Back'),$this->create_back_href());
$this->browse();
}
示例8: login
public function login()
{
//如果已经登录则,进入主页
if ($this->admin_id) {
location(U(MODULE_NAME . '/Index/index'));
exit;
}
//如果没有登录
if (!IS_POST) {
$this->display();
exit;
}
//获取表单数据
$passwd = $_POST['passwd'];
$name = $_POST['username'];
//验证数据
/* if (!$this->checkCaptcha($_POST['codeinput'])) {
$this->error('验证码错误!');
} */
/* 验证是否存在该用户 */
$admin = D('sys_admin');
$data_get = $admin->where("name='%s'", $name)->find();
if (!$data_get) {
$this->error('该用户不存在');
exit;
}
//如果该用户被锁定则不能登入
if ($data_get['lock']) {
$this->error('该用户已被锁定!!!请换其他帐号登录');
exit;
}
//验证密码是否正确
if (!strcmp(md5($passwd), $data_get['password'])) {
$admin->where("id='%d'", $data_get['id'])->setField('login_ip', $_SERVER['REMOTE_ADDR']);
//存入session
session('admin_info', array('admin_id' => $data_get['id'], 'secret_key' => md5($data_get['id'] . C('secret_key')), 'admin_authority' => M('sys_role')->where('id="%d"', $data_get['role_id'])->getField('authority'), 'admin_name' => $data_get['name']));
//存入cookie
cookie('admin_info', array('admin_name' => $data_get['name']));
//获取登录用户管理模块
$lAuthLogic = D('Auth', 'Logic');
$return = $lAuthLogic->init_auth($data_get);
if ($return['status'] != 1) {
$this->error($return['info']);
exit;
} else {
redirect(U('Index/index'));
}
} else {
$this->error('密码验证失败');
exit;
}
}
示例9: submit_login
public static function submit_login($x)
{
$username = $x[0];
$pass = $x[1];
$ret = Base_User_LoginCommon::check_login($username, $pass);
if (!$ret) {
$limit_exceeded = self::log_failed_login($username);
if ($limit_exceeded) {
location(array());
}
}
return $ret;
}
示例10: admin
public function admin()
{
if ($this->is_back()) {
if ($this->parent->get_type() == 'Base_Admin') {
$this->parent->reset();
} else {
location(array());
}
return;
}
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
$this->pack_module(Utils_CommonData::module_name(), 'Countries', 'admin_array');
}
示例11: admin
public function admin()
{
if ($this->is_back()) {
if ($this->parent->get_type() == 'Base_Admin') {
$this->parent->reset();
} else {
location(array());
}
return;
}
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
$this->rb = $this->init_module(Utils_RecordBrowser::module_name(), 'data_tax_rates', 'data_tax_rates_module');
$this->display_module($this->rb);
}
示例12: forward
public static function forward()
{
if (self::is_forward()) {
$_SESSION['client']['__history_id__']++;
}
self::$action = true;
$data = DB::GetOne('SELECT data FROM history WHERE session_name=%s AND page_id=%d AND client_id=%d', array(self::session_id(), $_SESSION['client']['__history_id__'] - 1, CID));
// $data = DB::BlobDecode($data);
if (GZIP_HISTORY && function_exists('gzuncompress')) {
$data = gzuncompress($data);
}
$_SESSION['client']['__module_vars__'] = unserialize($data);
location(array());
}
示例13: admin
public function admin() {
if ($this->is_back()) {
$this->parent->reset();
}
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
$google_login = Variable::get('utils_attachments_google_user', false);
$google_pass = Variable::get('utils_attachments_google_pass', false);
$form = $this->init_module('Libs_QuickForm');
$theme = $this->init_module('Base_Theme');
$form->addElement('header', 'header', __('Google Username and Password'));
$form->addElement('text', 'google_user', __('Username'));
$form->addElement('password', 'google_pass', __('Password'));
$form->setDefaults(array('google_user'=>$google_login));
$form->setDefaults(array('google_pass'=>$google_pass));
if ($form->validate()) {
$vals = $form->exportValues();
$ok = true;
if ($vals['google_user']) {
$g_auth = Utils_AttachmentCommon::get_google_auth($vals['google_user'], $vals['google_pass']);
if (!$g_auth) $ok = false;
}
if ($ok) {
Variable::set('utils_attachments_google_user', $vals['google_user']);
Variable::set('utils_attachments_google_pass', $vals['google_pass']);
Base_StatusBarCommon::message(__('Settings saved'));
} else {
Base_StatusBarCommon::message(__('Unable to authenticate'), 'error');
}
location(array());
return;
}
$form->assign_theme('form', $theme);
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
Base_ThemeCommon::load_css('Utils_RecordBrowser','View_entry');
$theme->display('admin');
}
示例14: admin
public function admin()
{
if ($this->is_back()) {
if ($this->parent->get_type() == 'Base_Admin') {
$this->parent->reset();
} else {
location(array());
}
return;
}
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
$this->rb = $this->init_module('Utils/RecordBrowser', 'quick_search', 'quick_searach');
$this->display_module($this->rb);
return true;
}
示例15: parseurl
private static function parseurl()
{
if (isset($_REQUEST['act']) && isset($_REQUEST['mod'])) {
$act = ucfirst(trim($_REQUEST['act']) . 'Action');
$method = trim($_REQUEST['mod']);
} else {
$act = 'IndexAction';
$method = 'index';
}
if (isset($_REQUEST['app']) && !defined('APP_NAME')) {
define('APP_NAME', trim($_REQUEST['app']));
}
if (CREATE_DEMO) {
//if need create demo
$demo = new Demo();
$demo->run();
}
if (!class_exists($act)) {
if (APP_DEBUG) {
die('controller class: ' . $act . ' not find. ');
} else {
location();
}
}
$controller = new $act();
if (!method_exists($controller, $method)) {
if (APP_DEBUG) {
die('controller class: ' . $act . ', method: ' . $method . ' not find. ');
} else {
location();
}
}
self::$controller_obj = $controller;
$controller->method = $method;
$controller->open_token = OPEN_TOKEN;
$controller->act = str_ireplace('Action', '', $act);
self::$act = $controller->act;
self::$mod = $method;
$controller->{$method}();
}