本文整理匯總了PHP中secure_site_url函數的典型用法代碼示例。如果您正苦於以下問題:PHP secure_site_url函數的具體用法?PHP secure_site_url怎麽用?PHP secure_site_url使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了secure_site_url函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
public function index()
{
if ($this->require_role('admin,super-agent,agent')) {
$settings = array();
foreach ($this->settings_model->getDataList() as $setting) {
$settings[$setting->key] = $setting->value;
}
if ($this->is_role('agent')) {
//if it's an agent we redirect him to start creating a sheet
redirect(secure_site_url('polls/select'));
} elseif ($this->is_role('super-agent')) {
//if it's an super-agent we redirect him to the Poll module
redirect(secure_site_url('polls'));
}
$this->config->load('pms_config');
$polls = $this->polls_model->getActivePolls(false);
foreach ($polls as $poll) {
$poll->sheets_count = $this->polls_model->countSheets($poll);
$color = $poll->sheets_count == $poll->max_surveys_number ? 'red' : 'green';
$poll->show_count = "<span style='color:{$color}'> (<span id='sheet_number_" . $poll->id . "'>" . $poll->sheets_count . '</span>/' . $poll->max_surveys_number . ')</span>';
}
$data = array('title' => "Fiche du répondant", 'content' => 'dashboard/index', 'js_to_load' => array('tracking.js', 'map_utilities.js'), 'map_key' => $this->config->item('pms_google_map_key'), 'map_refresh' => $settings['map_update_interval'], 'idle_time' => $settings['map_idle_interval'], 'polls' => $polls, 'sheets' => $this->sheets_model->getSheetsWithPollAndUser(10), 'geolocations' => $this->geolocations_model->getErrors(10), 'data_url' => base_url("sheets/get_sheets/"));
$this->load->view('global/layout', $data);
}
}
示例2: secure_redirect
function secure_redirect($uri = '', $method = 'location', $http_response_code = 302)
{
switch ($method) {
case 'refresh':
header("Refresh:0;url=" . secure_site_url($uri));
break;
default:
header("Location: " . secure_site_url($uri), TRUE, $http_response_code);
break;
}
exit;
}
開發者ID:khaledaSabina,項目名稱:php-codeigniter-tips-tricks,代碼行數:12,代碼來源:codeigniter_function_about_url.php
示例3: index
/**
* List all the polls
*/
public function index()
{
if ($this->require_role('admin,super-agent')) {
if ($this->is_role('agent')) {
//if it's an agent so we redirect him
redirect(secure_site_url('polls/select'));
}
$polls = array();
$polls_list = $this->main_model->getPollsWithSheetsNumber();
foreach ($polls_list as $poll) {
$poll->sheets_count = $poll->sheets_number . '/' . $poll->max_surveys_number;
$polls[] = $poll;
}
$data = array('content' => 'polls/index', 'title' => "Liste des sondages", 'js_to_load' => array('polls.js'), 'polls' => $polls);
$this->load->view('global/layout', $data);
}
}
示例4: password
/**
* Reset password
* @return [type] [description]
*/
public function password()
{
if (!$this->auth_role) {
// Load resources
$this->load->model('examples_model');
/// If IP or posted email is on hold, display message
if ($on_hold = $this->authentication->current_hold_status(TRUE)) {
$view_data['disabled'] = 1;
} else {
// If the form post looks good
if ($this->tokens->match && $this->input->post('user_email')) {
if ($user_data = $this->examples_model->get_recovery_data($this->input->post('user_email'))) {
// Check if user is banned
if ($user_data->user_banned == '1') {
// Log an error if banned
$this->authentication->log_error($this->input->post('user_email', TRUE));
// Show special message for banned user
$view_data['user_banned'] = 1;
} else {
/**
* Use the string generator to create a random string
* that will be hashed and stored as the password recovery key.
*/
$this->load->library('generate_string');
$recovery_code = $this->generate_string->set_options(array('exclude' => array('char')))->random_string(64)->show();
$hashed_recovery_code = $this->_hash_recovery_code($user_data->user_salt, $recovery_code);
// Update user record with recovery code and time
$this->examples_model->update_user_raw_data($user_data->user_id, array('passwd_recovery_code' => $hashed_recovery_code, 'passwd_recovery_date' => date('Y-m-d H:i:s')));
$view_data['special_link'] = secure_anchor('user/verification/' . $user_data->user_id . '/' . $recovery_code, secure_site_url('user/verification/' . $user_data->user_id . '/' . $recovery_code), 'target ="_blank"');
$view_data['confirmation'] = 1;
}
} else {
// Log the error
$this->authentication->log_error($this->input->post('user_email', TRUE));
$view_data['no_match'] = 1;
}
}
}
$data['title'] = "Forgot Password";
$data['content'] = $this->load->view('forgot', isset($view_data) ? $view_data : NULL, TRUE);
$this->load->view('html_anon', $data);
} else {
//Render access denied page
show_error('You are not authorized to view this page', '403');
}
}
示例5: secure_anchor_popup
function secure_anchor_popup($uri = '', $title = '', $attributes = FALSE)
{
$title = (string) $title;
$secure_site_url = !preg_match('!^\\w+://! i', $uri) ? secure_site_url($uri) : $uri;
if ($title == '') {
$title = $site_url;
}
if ($attributes === FALSE) {
return "<a href='javascript:void(0);' onclick=\"window.open('" . $secure_site_url . "', '_blank');\">" . $title . "</a>";
}
if (!is_array($attributes)) {
$attributes = array();
}
foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0') as $key => $val) {
$atts[$key] = !isset($attributes[$key]) ? $val : $attributes[$key];
unset($attributes[$key]);
}
if ($attributes != '') {
$attributes = _parse_attributes($attributes);
}
return "<a href='javascript:void(0);' onclick=\"window.open('" . $secure_site_url . "', '_blank', '" . _parse_attributes($atts, TRUE) . "');\"{$attributes}>" . $title . "</a>";
}
示例6: delete_user
/**
* Delete a user
*
* @param int the user_id of the user to delete.
* @param int the pagination page number to redirect back to.
*/
public function delete_user($user_to_delete = FALSE, $page = FALSE)
{
// Make sure admin or manager is logged in
if ($this->require_role('admin,manager')) {
// Load resources
$this->load->model('user_model');
// Must not be a user trying to delete themeselves
if (is_numeric($user_to_delete) && $user_to_delete != $this->auth_user_id) {
// If an ajax request
if ($this->input->is_ajax_request()) {
// Must pass token match and delete_user must return TRUE
if ($this->tokens->match && $this->user_model->delete_user($user_to_delete, $this->auth_level)) {
// Send success message back
$response = array('test' => 'success', 'token' => $this->tokens->token(), 'ci_csrf_token' => $this->security->get_csrf_hash());
} else {
// CSRF token mismatch or delete_user was FALSE
$response = array('test' => 'error', 'message' => 'No Token Match - Please Reload Page');
}
echo json_encode($response);
} else {
$test = $this->user_model->delete_user($user_to_delete, $this->auth_level);
$page = $page ? '/' . $page : '';
header("Location: " . secure_site_url('administration/manage_users' . $page));
exit;
}
}
}
}
示例7: secure_site_url
<?php
if (config_item('allow_remember_me')) {
?>
<br />
<label for="remember_me" class="form_label">Remember Me</label>
<input type="checkbox" id="remember_me" name="remember_me" value="yes" />
<?php
}
?>
<p>
<a href="<?php
echo secure_site_url('recover');
?>
">
Can't access your account?
</a>
</p>
<input type="submit" name="submit" value="Login" id="submit_button" />
</div>
</form>
<?php
} else {
// EXCESSIVE LOGIN ATTEMPTS ERROR MESSAGE
示例8: secure_site_url
?>
" />
<input type="hidden" id="allowed_types" value="<?php
echo $uploader_settings['allowed_types'];
?>
" />
<input type="hidden" id="update_image_order_url" value="<?php
echo secure_site_url('custom_uploader/update_image_order');
?>
" />
<input type="hidden" id="delete_image_url" value="<?php
echo secure_site_url('custom_uploader/delete_image');
?>
" />
<input type="hidden" id="upload_image_url" value="<?php
echo secure_site_url('uploads_manager/bridge_filesystem/custom_uploader');
?>
" />
</form>
</p>
<div id="status-bar"></div>
</div>
<div id="image-list">
<?php
// If there are images
if (!empty($images->images_data)) {
// Unserialize the images
$images = unserialize($images->images_data);
// If the unserialized data is not empty
if (!empty($images)) {
// Start the image list
示例9: _maintain_state
/**
* Setup session, HTTP user cookie, and remember me cookie
* during a successful login attempt. Redirect is specified here.
*
* @param obj the user record
* @return void
*/
private function _maintain_state($auth_data)
{
// Redirect to specified page, or home page if none provided
$redirect = $this->CI->input->get('redirect') ? urldecode($this->CI->input->get('redirect')) : '';
$url = USE_SSL === 1 ? secure_site_url($redirect) : site_url($redirect);
header("Location: " . $url, TRUE, 302);
// Store login time in database and cookie
$login_time = time();
/**
* Since the session cookie needs to be able to use
* the secure flag, we want to hold some of the user's
* data in another cookie.
*/
$http_user_cookie = array('name' => config_item('http_user_cookie_name'), 'domain' => config_item('cookie_domain'), 'path' => config_item('cookie_path'), 'prefix' => config_item('cookie_prefix'), 'secure' => FALSE);
// Initialize the HTTP user cookie data
$http_user_cookie_data['_user_name'] = $auth_data->user_name;
// Get the array of selected profile columns
$selected_profile_columns = config_item('selected_profile_columns');
// If selected profile columns are to be added to the HTTP user cookie
if (!empty($selected_profile_columns)) {
// Loop through the auth data
foreach ((array) $auth_data as $k => $v) {
// If a selected profile column
if (in_array($k, $selected_profile_columns)) {
$http_user_cookie_data['_' . $k] = $v;
}
}
}
// Serialize the HTTP user cookie data
$http_user_cookie['value'] = $this->CI->session->serialize_data($http_user_cookie_data);
// Check if remember me requested, and set cookie if yes
if (config_item('allow_remember_me') && $this->CI->input->post('remember_me')) {
$remember_me_cookie = array('name' => config_item('remember_me_cookie_name'), 'value' => config_item('remember_me_expiration') + time(), 'expire' => config_item('remember_me_expiration'), 'domain' => config_item('cookie_domain'), 'path' => config_item('cookie_path'), 'prefix' => config_item('cookie_prefix'), 'secure' => FALSE);
$this->CI->input->set_cookie($remember_me_cookie);
// Make sure the CI session cookie doesn't expire on close
$this->CI->session->sess_expire_on_close = FALSE;
$this->CI->session->sess_expiration = config_item('remember_me_expiration');
// Set the expiration of the http user cookie
$http_user_cookie['expire'] = config_item('remember_me_expiration') + time();
} else {
// Unless remember me is requested, the http user cookie expires when the browser closes.
$http_user_cookie['expire'] = 0;
}
$this->CI->input->set_cookie($http_user_cookie);
// Set CI session cookie
$this->CI->session->set_userdata('auth_identifier', $this->create_auth_identifier($auth_data->user_id, $auth_data->user_modified, $login_time));
// For security, force regenerate the session ID
$session_id = $this->CI->session->sess_update(TRUE);
// Update user record in database
$this->CI->auth_model->login_update($auth_data->user_id, $login_time, $session_id);
}
示例10: logout
/**
* Log out
*/
public function logout()
{
$this->authentication->logout();
redirect(secure_site_url(LOGIN_PAGE . '?logout=1'));
}
示例11: secure_anchor
/**
* Secure Anchor Link
*
* Creates a secure anchor based on the local URL, and if USE_SSL is 'on'.
*
* @param string the URL
* @param string the link title
* @param mixed any attributes
*/
function secure_anchor($uri = '', $title = '', $attributes = '')
{
$title = (string) $title;
$site_url = is_array($uri) ? secure_site_url($uri) : preg_match('#^(\\w+:)?//#i', $uri) ? $uri : secure_site_url($uri);
if ($title === '') {
$title = $site_url;
}
if ($attributes !== '') {
$attributes = _stringify_attributes($attributes);
}
return '<a href="' . $site_url . '"' . $attributes . '>' . $title . '</a>';
}
示例12: config_item
<div><label for="login_string">Email address</label><br>
<input type="text" id="login_string" name="login_string" size="60" /></div>
<div><label for="login_pass">Password</label><br>
<input type="password" id="login_pass" name="login_pass" maxlength="<?php
echo config_item('max_chars_for_password');
?>
" /></div>
<?php
if (config_item('allow_remember_me')) {
?>
<div></div><label for="remember_me" class="form_label">Remember Me</label><br>
<input type="checkbox" id="remember_me" name="remember_me" value="yes" /></div>
<?php
}
?>
<div><input type="submit" id="submit_button" name="submit" value="Login" /></div>
</form>
<p><a href="<?php
echo secure_site_url('auth/recover');
?>
">Can't access your account?</a><br>
<a href="<?php
echo site_url('welcome');
?>
">Home</a></p>
</div>
</div>
</section>
<?php
}
示例13: secure_site_url
if (config_item('allow_remember_me')) {
?>
<div class="form-row">
<label for="remember_me" class="form_label">Remember Me</label>
<input type="checkbox" id="remember_me" name="remember_me" value="yes" />
</div>
<?php
}
?>
<div class="form-row">
<p>
<a href="<?php
echo secure_site_url('user/recover');
?>
">
Can't access your account?
</a>
</p>
</div>
<div class="form-row">
<div id="submit_box">
<input type="submit" name="submit" value="Login" id="submit_button" />
</div>
</div>
</div>
</form>
<?php
示例14: secure_anchor
/**
* Secure Anchor Link
*
* Creates a secure anchor based on the local URL, and if USE_SSL is 'on'.
*
* @param string the URL
* @param string the link title
* @param mixed any attributes
*/
function secure_anchor($uri = '', $title = '', $attributes = '')
{
$title = (string) $title;
if (!is_array($uri)) {
$site_url = !preg_match('!^\\w+://! i', $uri) ? secure_site_url($uri) : $uri;
} else {
$site_url = secure_site_url($uri);
}
if ($title == '') {
$title = $site_url;
}
if ($attributes != '') {
$attributes = _parse_attributes($attributes);
}
return '<a href="' . $site_url . '"' . $attributes . '>' . $title . '</a>';
}
示例15: config_item
?>
" />
<input type="hidden" id="allowed_types" value="<?php
echo $upload_config['allowed_types'];
?>
" />
<input type="hidden" id="ci_csrf_token_name" value="<?php
echo config_item('csrf_token_name');
?>
" />
<input type="hidden" id="upload_url" value="<?php
echo secure_site_url('uploads_manager/bridge_' . $upload_destination . '/profile_image');
?>
" />
<input type="hidden" id="delete_url" value="<?php
echo secure_site_url('user/delete_profile_image');
?>
" />
</div>
</fieldset>
<div class="form-row">
<div id="submit_box">
<?php
// SUBMIT BUTTON ***********************
$input_data = array('name' => 'submit', 'id' => 'submit_button', 'value' => 'Update');
echo form_submit($input_data);
?>
</div>
</div>