本文整理汇总了PHP中need_login函数的典型用法代码示例。如果您正苦于以下问题:PHP need_login函数的具体用法?PHP need_login怎么用?PHP need_login使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了need_login函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: save_profile
function save_profile()
{
need_login('ajax');
$current_id = $this->user->get_field('id');
$arr['user_nicename'] = safe_convert($this->getPost('user_nicename'));
$new_pass = $this->getPost('new_pass');
$old_pass = $this->getPost('old_pass');
$new_pass_again = $this->getPost('new_pass_again');
$extra_arr = $this->getPost('extra');
if ($extra_arr['email'] && !check_email($extra_arr['email'])) {
form_ajax_failed('text', lang('error_email'));
}
if ($new_pass) {
if (!$this->user->check_pass($current_id, md5($old_pass))) {
form_ajax_failed('text', lang('old_pass_error'));
}
if ($new_pass != $new_pass_again) {
form_ajax_failed('text', lang('pass_twice_error'));
}
$arr['user_pass'] = md5($new_pass);
}
if ($this->user->update($current_id, $arr)) {
$this->user->save_extra($current_id, $extra_arr);
form_ajax_success('box', lang('modify_success') . ($new_pass ? lang('pass_edit_ok') : ''), null, 0.5, $_SERVER['HTTP_REFERER']);
} else {
form_ajax_failed('text', lang('modify_failed'));
}
}
开发者ID:vluo,项目名称:myPoto,代码行数:28,代码来源:users.ctl.php
示例2: copyselectedurl
function copyselectedurl($config = array())
{
need_login('ajax_page');
global $base_root;
$ids = $this->getPost('sel_id');
if (!$ids || count($ids) == 0) {
ajax_box(lang('copyimg:pls_sel_photo_want_to_copy'));
} else {
$site_url = $this->setting->get_conf('site.url');
$mdl_photo =& loader::model('photo');
$ids = array_keys($ids);
$html = '';
$urls = '';
$ubb = '';
foreach ($ids as $id) {
$pic = $mdl_photo->get_info($id);
$img_path = img_path($pic['path']);
$html_code = $config['tpl'];
$html_code = str_replace('{thumbpath}', img_path($pic['thumb']), $html_code);
$html_code = str_replace('{imgpath}', $img_path, $html_code);
$html_code = str_replace('{imgname}', $pic['name'], $html_code);
$html_code = str_replace('{detailurl}', $base_root . site_link('photos', 'view', array('id' => $pic['id'])), $html_code);
$html .= $html_code . $config['split'];
$urls .= $img_path . "\r\n";
$ubb .= '[IMG]' . $img_path . "[/IMG]\r\n";
}
$this->output->set('img_url', $urls);
$this->output->set('img_html', $html);
$this->output->set('img_ubb', $ubb);
loader::view('copyimg:copyurlall');
}
}
开发者ID:vluo,项目名称:myPoto,代码行数:32,代码来源:utils.cct.php
示例3: __construct
public function __construct()
{
parent::__construct();
$this->load->library('htmllib');
$this->load->model('game');
$this->load->model('level');
// Your own constructor code
if (need_login() == false) {
redirect(base_url() . "base/login");
}
}
开发者ID:aliarham11,项目名称:dde2e39a058dd14de5fba1f4b4b85154,代码行数:11,代码来源:games.php
示例4: create_session
public function create_session()
{
if (need_login()) {
redirect(base_url() . "base/logout");
}
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
if ($this->form_validation->run()) {
$this->load->model("user");
$user = $this->user->auth($this->input->post("username"), $this->input->post("password"));
if (count($user) > 0) {
$this->session->set_userdata("user_id", $user->id);
$this->session->set_userdata("user_name", $user->username);
redirect(base_url() . "intro");
} else {
$this->session->set_flashdata("alert", "Username dan password tidak cocok");
redirect(base_url() . "base/login");
}
} else {
$this->session->set_flashdata("alert", validation_errors());
redirect(base_url() . "base/login");
}
}
开发者ID:aliarham11,项目名称:dde2e39a058dd14de5fba1f4b4b85154,代码行数:24,代码来源:base.php
示例5: require_once
<?php
require_once (dirname ( dirname ( __FILE__ ) ) . '/app.php');
need_login ();
$condition = array (
'user_id' => $login_user_id,
'team_id > 0'
);
$selector = strval ( $_GET ['s'] );
$allow = array (
'index',
'unpay',
'pay',
'askrefund',
/* BEGIN add status by abei */
'unused',
'expiring',
'undp',
'refundsuccess',
'expired',
'had_dp'
/* END add status by abei */
);
if (false == in_array ( $selector, $allow )){
$selector = 'index';
}
if ($selector == 'index') {
$count = Table::Count ( 'order', $condition );
开发者ID:noikiy,项目名称:mdwp,代码行数:31,代码来源:index.php
示例6: require_once
<?php
/**
* My
* ----------------------------------------------------------------------------
* This is not free software
* ----------------------------------------------------------------------------
* @author abei <[email protected]>
* @version 1.0
* @link http://www.qiang8.cn
*/
require_once(dirname(dirname(__FILE__)) . '/app.php');
need_login(true);
$consume_times = Table::Count('order', array(
'user_id' => $login_user_id,
'state' => 'pay',
));
die(include template('m_my'));
开发者ID:noikiy,项目名称:mdwp,代码行数:19,代码来源:my.php
示例7: emptying
function emptying()
{
need_login('ajax_page');
$albums = $this->mdl_album->get_trash();
if ($albums) {
foreach ($albums as $v) {
$ret = $this->mdl_album->real_delete($v['id'], $v);
}
}
$photos = $this->mdl_photo->get_trash();
if ($photos) {
foreach ($photos as $v) {
$ret = $this->mdl_photo->real_delete($v['id'], $v);
}
}
ajax_box(lang('empty_trash_success'), null, 0.5, $_SERVER['HTTP_REFERER']);
}
开发者ID:vluo,项目名称:myPoto,代码行数:17,代码来源:trash.ctl.php
示例8: delete
function delete()
{
need_login('ajax_page');
$id = intval($this->getGet('id'));
if ($this->mdl_cate->delete($id)) {
$mdl_album =& Loader::model('album');
$mdl_album->set_default_cate($id);
ajax_box(lang('delete_cate_succ'), null, 0.5, $_SERVER['HTTP_REFERER']);
} else {
ajax_box(lang('delete_cate_fail'));
}
}
开发者ID:vluo,项目名称:myPoto,代码行数:12,代码来源:category.ctl.php
示例9: save_priv
function save_priv()
{
need_login('ajax');
$album['priv_type'] = $this->getPost('priv_type', '0');
$album['priv_pass'] = $this->getPost('priv_pass');
$album['priv_question'] = safe_convert($this->getPost('priv_question'));
$album['priv_answer'] = safe_convert($this->getPost('priv_answer'));
$id = intval($this->getGet('id'));
if ($album['priv_type'] == '1') {
if ($album['priv_pass'] == '') {
form_ajax_failed('text', lang('album_password_empty'));
}
}
if ($album['priv_type'] == '2') {
if ($album['priv_question'] == '') {
form_ajax_failed('text', lang('album_question_empty'));
}
if ($album['priv_answer'] == '') {
form_ajax_failed('text', lang('album_answer_empty'));
}
}
if ($this->mdl_album->update($id, $album)) {
$this->plugin->trigger('modified_album_priv', $id);
form_ajax_success('box', lang('modify_album_priv_success'), null, 0.5, $_SERVER['HTTP_REFERER']);
} else {
form_ajax_failed('text', lang('modify_album_priv_failed'));
}
}
开发者ID:vluo,项目名称:myPoto,代码行数:28,代码来源:albums.ctl.php
示例10: approve_batch
function approve_batch()
{
need_login('ajax_page');
$ids = $this->getPost('sel_id');
if (!$ids || count($ids) == 0) {
ajax_box(lang('pls_sel_comments_want_to_approve'));
} else {
if ($this->mdl_comment->approve_batch(array_keys($ids))) {
ajax_box(lang('batch_approve_comments_success'), null, 1, $_SERVER['HTTP_REFERER']);
} else {
ajax_box(lang('batch_approve_comments_failed'));
}
}
}
开发者ID:vluo,项目名称:myPoto,代码行数:14,代码来源:comments.ctl.php
示例11: remove_related_org_from_user
public function remove_related_org_from_user($user_id, $related_org_name)
{
need_login();
if (!user('is_admin')) {
$user_id = user('id');
}
$related_ngo_model = M('Related_ngos');
$related_ngo_model->where(array('user_name' => $related_org_name, 'user_id' => $user_id))->delete();
echo json_encode(array('status' => 'ok'));
}
开发者ID:baixinxing,项目名称:ngo20map6,代码行数:10,代码来源:UserAction.class.php
示例12: save_nav
function save_nav()
{
need_login('ajax_box');
$mdl_nav =& Loader::model('nav');
$names = $this->getPost('name');
$urls = $this->getPost('url');
$sorts = $this->getPost('sort');
$dels = $this->getPost('del');
$enables = $this->getPost('enable');
$flag = true;
//编辑及删除
if ($names) {
foreach ($names as $key => $name) {
$key = intval($key);
$name = trim($name);
$urls[$key] = isset($urls[$key]) ? trim($urls[$key]) : '';
if (isset($dels[$key])) {
//delete 记录
$mdl_nav->delete($key);
} else {
$data = array();
if ($name) {
$data['name'] = $name;
}
if ($urls[$key]) {
$data['url'] = $urls[$key];
}
if ($sorts[$key]) {
$data['sort'] = intval($sorts[$key]);
}
if (isset($enables[$key])) {
$data['enable'] = 1;
} else {
$data['enable'] = 0;
}
if (!$mdl_nav->update($key, $data)) {
$flag = false;
}
}
}
}
//新增
$newnames = $this->getPost('namenew');
$newurls = $this->getPost('urlnew');
$newsorts = $this->getPost('sortnew');
if ($newnames) {
foreach ($newnames as $key => $newname) {
$newname = trim($newname);
$newurls[$key] = trim($newurls[$key]);
if ($newname == '') {
continue;
}
if ($newurls[$key] == '') {
$flag = false;
continue;
}
$data = array('name' => $newname, 'url' => $newurls[$key], 'sort' => $newsorts[$key] ? intval($newsorts[$key]) : 100, 'enable' => 1);
if (!$mdl_nav->save($data)) {
$flag = false;
}
}
}
//清除菜单缓存
$mdl_nav->clear_nav_cache();
if ($flag) {
form_ajax_success('box', lang('nav_save_succ'), null, 0.5, $_SERVER['HTTP_REFERER']);
} else {
form_ajax_failed('box', lang('nav_save_fail'), null, 2, $_SERVER['HTTP_REFERER']);
}
}
开发者ID:vluo,项目名称:myPoto,代码行数:70,代码来源:setting.ctl.php
示例13: core
function core()
{
need_login('page');
@set_time_limit(0);
@ignore_user_abort(true);
$newversion = $this->getRequest('version');
$software = 'meiupic';
$version = MPIC_VERSION;
if ($newversion == $version) {
exit(lang('no_need_to_update'));
}
if (!$newversion) {
exit(lang('version_can_not_be_empty'));
}
//检查目录是否可以读写
$directory = @dir(ROOTDIR);
while ($entry = $directory->read()) {
if ($entry == '..' || $entry == '.') {
continue;
}
$filename = ROOTDIR . $entry;
if (is_dir($filename) && !dir_writeable($filename)) {
exit(lang('dir_not_writable', $filename));
} elseif (is_file($filename) && !is_writable($filename)) {
exit(lang('file_not_writable', $filename));
}
}
$directory->close();
$langset = LANGSET;
$time = time();
$hash = md5("{$newversion}{$software}{$version}{$langset}{$time}");
$q = base64_encode("newversion={$newversion}&software={$software}&version={$version}&langset={$langset}&time={$time}&hash={$hash}");
$url = CHECK_UPDATE_URL . '?act=update&q=' . $q;
$response = get_remote($url, 2);
if (!$response) {
exit(lang('connect_to_server_failed'));
}
$json =& loader::lib('json');
$result = $json->decode($response);
if ($result['return']) {
$tmpfile = ROOTDIR . 'cache/tmp/update.zip';
if (file_exists($tmpfile) && md5_file($tmpfile) == $result['md5']) {
echo lang('file_has_been_downloaded') . '<br />';
} else {
$content = get_remote($result['package']);
file_put_contents($tmpfile, $content);
$file_md5 = md5_file($tmpfile);
if ($file_md5 != $result['md5']) {
echo lang('download_package_failed') . '<br />';
exit;
}
echo lang('download_package_succ') . '<br />';
}
$zip =& loader::lib('zip');
$zip->load_file($tmpfile);
$zip->extract(PCLZIP_OPT_PATH, './', PCLZIP_OPT_REPLACE_NEWER);
echo lang('unzip_package_succ') . '<br />';
echo lang('delete_tmp_download_file') . '<br />';
@unlink($tmpfile);
echo lang('upgrade_after_jump') . '<br />';
redirect(site_link('default'), 1);
} else {
exit(lang('get_update_fail'));
}
}
开发者ID:vluo,项目名称:myPoto,代码行数:65,代码来源:update.ctl.php
示例14: save_desc
function save_desc()
{
need_login('ajax');
$id = intval($this->getGet('id'));
$desc = safe_convert($this->getPost('desc'));
if ($desc == '') {
form_ajax_failed('text', lang('empty_photo_desc'));
}
if ($this->mdl_photo->update($id, array('desc' => $desc))) {
$this->plugin->trigger('modified_photo_desc', $id);
form_ajax_success('text', $desc);
} else {
form_ajax_failed('text', lang('modify_photo_desc_failed'));
}
return;
}
开发者ID:vluo,项目名称:myPoto,代码行数:16,代码来源:photos.ctl.php
示例15: base_url
?>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<input type="hidden" id="base_url" value="<?php
echo base_url();
?>
">
<?php
if (need_login()) {
?>
<div class="row">
<div class="col s12 grey darken-4">
<a href="<?php
echo base_url();
?>
"><h5 class="white-text" style="float:left">Naval - Intuition<i class="material-icons left">play_circle_outline</i></h5></a>
<a href="<?php
echo base_url();
?>
base/logout" class="white-text" style="float:right"><h5>Logout<i class="material-icons left">not_interested</i></h5></a>
</div>
</div>
<?php
}
开发者ID:aliarham11,项目名称:dde2e39a058dd14de5fba1f4b4b85154,代码行数:31,代码来源:default_header.php
示例16: save
function save()
{
@set_time_limit(0);
@ignore_user_abort(true);
$type = $this->getGet('t');
$album_id = intval($this->getRequest('aid'));
if (!$album_id) {
showError(lang('pls_sel_album'));
}
if ($type == 'multi') {
need_login('ajax');
/*$files_count = intval($this->getPost('muilti_uploader_count'));
for($i=0;$i<$files_count;$i++){
$filename = $this->getPost("muilti_uploader_{$i}_tmpname");
$realname = $this->getPost("muilti_uploader_{$i}_name");
$purename = file_pure_name($filename);
$purerealname = file_pure_name($realname);
$photorow = $this->mdl_photo->get_photo_by_name_aid($album_id,$purename);
if($photorow){
$this->mdl_photo->update($photorow['id'],array('name'=>$purerealname));
}
}
*/
$this->mdl_album->update_photos_num($album_id);
$this->mdl_album->check_repare_cover($album_id);
$gourl = site_link('photos', 'index', array('aid' => $album_id));
form_ajax_success('box', lang('upload_photo_success'), null, 1, $gourl);
} else {
need_login('page');
$this->output->set('album_id', $album_id);
$album_info = $this->mdl_album->get_info($album_id);
$this->output->set('album_info', $album_info);
$page_title = lang('upload_photo') . ' - ' . $this->setting->get_conf('site.title');
$page_keywords = $this->setting->get_conf('site.keywords');
$page_description = $this->setting->get_conf('site.description');
$this->page_init($page_title, $page_keywords, $page_description);
$imglib =& loader::lib('image');
$supportType = $imglib->supportType();
$empty_num = 0;
$error = '';
$allowsize = allowsize($this->setting->get_conf('upload.allow_size'));
if (isset($_FILES['imgs'])) {
foreach ($_FILES['imgs']['name'] as $k => $upfile) {
if (!empty($upfile)) {
$filesize = $_FILES['imgs']['size'][$k];
$tmpfile = $_FILES['imgs']['tmp_name'][$k];
$filename = $upfile;
$fileext = file_ext($filename);
if ($_FILES['imgs']['error'][$k] == 1) {
$error .= lang('failed_larger_than_server', $filename) . '<br />';
continue;
}
if ($allowsize && $filesize > $allowsize) {
$error .= lang('failed_larger_than_usetting', $filename) . '<br />';
continue;
}
if ($filesize == 0) {
$error .= lang('failed_if_file', $filename) . '<br />';
continue;
}
if (!in_array($fileext, $supportType)) {
$error .= lang('failed_not_support', $filename) . '<br />';
continue;
}
if (!$this->mdl_photo->save_upload($album_id, $tmpfile, $filename, true, array('cate_id' => $album_info['cate_id']))) {
$error .= lang('file_upload_failed', $filename) . '<br />';
}
} else {
$empty_num++;
}
}
} else {
$error = lang('need_sel_upload_file');
}
if (isset($_FILES['imgs']) && $empty_num == count($_FILES['imgs']['name'])) {
$this->output->set('msginfo', '<div class="failed">' . lang('need_sel_upload_file') . '</div>');
} else {
$this->mdl_album->update_photos_num($album_id);
$this->mdl_album->check_repare_cover($album_id);
if ($error) {
$this->output->set('msginfo', '<div class="failed">' . $error . '</div>');
} else {
$this->output->set('msginfo', '<div class="success">' . lang('upload_photo_success') . '<a href="' . site_link('photos', 'index', array('aid' => $album_id)) . '">' . lang('view_album') . '</a></div>');
}
}
$crumb_nav = array();
$crumb_nav[] = array('name' => lang('upload_photo'));
$this->page_crumb($crumb_nav);
loader::view('upload/normal');
}
}
开发者ID:vluo,项目名称:myPoto,代码行数:91,代码来源:upload.ctl.php
注:本文中的need_login函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论