本文整理汇总了PHP中authentication函数的典型用法代码示例。如果您正苦于以下问题:PHP authentication函数的具体用法?PHP authentication怎么用?PHP authentication使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了authentication函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clientRequest
function clientRequest($config)
{
global $routes;
$GLOBALS['debug'] = false;
// print_r($_SERVER);
$routes['content'] = translateRoutes($config);
// print_r($routes['content']);
// Set application request parameters...
// If access over http:
if (empty($_SERVER['argv'])) {
// Set default PHP Server request property if empty:
if (!isset($_SERVER["REQUEST_URI"])) {
$_SERVER["REQUEST_URI"] = '/' . $config['root_dir'] . 'home';
}
$GLOBALS['controller'] = 'application';
$GLOBALS['debug'] = false;
// if access from command line:
} elseif (!empty($_SERVER['argv'])) {
$_SERVER["HTTP_USER_AGENT"] = '';
$config['domain_url'] = trim(preg_replace('@domain=@', '', $_SERVER['argv'][1]), '/') . '/';
$GLOBALS['controller'] = preg_replace('@controller=@', '', $_SERVER['argv'][2]);
$request = trim(preg_replace('@request=@', '', $_SERVER['argv'][3]), '/');
if (isset($_SERVER['argv'][4])) {
$format = trim(preg_replace('@format=@', '', $_SERVER['argv'][4]), '/');
} else {
$format = '';
}
$_SERVER["REQUEST_URI"] = trim('commandline::/' . $config['root_dir'] . $request, '/') . '/' . $format;
$GLOBALS['view_path'] = '';
$GLOBALS['debug'] = true;
}
$GLOBALS['request_uri'] = $_SERVER["REQUEST_URI"];
// Set application uri request parameters:
$request_parameters = clientRequestValidation($config, $routes['content']);
// If authentiacation is enabled, load AUTHENTICATION:
if ($config['authentication']['enable'] == true and $GLOBALS['debug'] == false) {
authentication($config, $request_parameters);
}
// print_r($GLOBALS);
return $request_parameters;
}
示例2: CheckContactViewPerm
function CheckContactViewPerm($user_name, $password)
{
if (authentication($user_name, $password)) {
global $current_user, $log;
require_once 'modules/Users/Users.php';
$seed_user = new Users();
$user_id = $seed_user->retrieve_user_id($user_name);
$current_user = $seed_user;
$current_user->retrieve_entity_info($user_id, "Users");
if (isPermitted("Contacts", "index") == "yes") {
return "allowed";
} else {
return "contact";
}
}
}
示例3: session_start
session_start();
header("Cache-control: private");
// extract ( $_SESSION , EXTR_REFS ) ;
// Define a few page vars
$settingInfo = get_Conference_Settings();
$trackStr = $settingInfo->TrackName;
//Name for Track
$topicStr = $settingInfo->TopicName;
//Name for Topic
$levelStr = $settingInfo->LevelName;
//Name for Level
$err_message = " Unable to process your request due to the following problems: <br>\n";
$header = "View Abstract";
$accepted_privilegeID_arr = array(2 => "");
$accepted_phaseID_arr = array(2 => "", 3 => "");
authentication($header, $accepted_privilegeID_arr, $accepted_phaseID_arr, $homepage, $php_root_path, $GLOBALS["DB_PREFIX"], &$err_message);
//Get the paper information
if (($paperInfo = get_paper_info($_GET["paperid"], &$err_message)) === false) {
do_html_header("View Abstract Failed", &$err_message);
$err_message .= " Cannot retrieve information from database. <br>\n";
$err_message .= "<br><br> Try <a href='view_abstract.php?paperid=" . $_GET["paperid"] . "'>again</a>?";
do_html_footer(&$err_message);
exit;
}
//Get the lastest file of the paper
if (($FileIDData = get_latestFile($_GET["paperid"], &$err_message)) === false) {
do_html_header("View Abstract Failed", &$err_message);
$err_message .= " Could not execute \"get_latestFile\" in \"view_abstract.php\". <br>\n";
$err_message .= "<br><br> Try <a href='view_abstract.php?paperid=" . $_GET["paperid"] . "'>again</a>?";
do_html_footer(&$err_message);
exit;
示例4: authentication
<div><p>Authentication API</p>
<form method="post"/>
<table>
<tr><td>Login Id</td><td><input type="text" name="login_id" value=""/></td></tr>
<tr><td>Api Key</td><td><input type="text" name="api_key" value=""/></td></tr>
<input type="hidden" name="action_type" value="do_authentication"/>
<tr><td></td><td><input type="submit"/></td></tr>
</table>
</div>
</form>
<?php
}
if ($_POST['action_type'] == 'do_authentication') {
$login_id = $_POST['login_id'];
$api_key = $_POST['api_key'];
$token = authentication($login_id, $api_key);
$_SESSION['token'] = $token;
echo "Your token is:" . $token;
?>
<div><p>Add Benificary/Bank Detail</p>
<form method="post"/>
<table>
<tr><td>Nick Name</td><td><input type="text" name="nickname" value=""/></td></tr>
<tr><td>Benificary nmae</td><td><input type="text" name="beneficiary_name" value=""/></td></tr>
<tr><td>Bank Name</td><td><input type="text" name="bank_name" value=""/></td></tr>
<tr><td>Bank Address</td><td><input type="text" name="bank_address" value=""/></td></tr>
<tr><td>Account No.</td><td><input type="text" name="acct_number" value=""/></td></tr>
<tr><td>Bic Swift</td><td><input type="text" name="bic_swift" value=""/></td></tr>
<input type="hidden" name="action_type" value="add_benificary"/>
示例5: Exception
try {
// Validating request data
if (!isset($_REQUEST['a'])) {
throw new Exception('The required parameter "a" is empty.');
}
########### VALIDATE BROWSER NAVIGATION #####
//validate_BrowserNavigation('full_assoc');
############## AUTHENTICATION ###############
//conv_validateRole($_REQUEST['u']); // Validate Role
if (isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '') {
@session_destroy();
session_start();
session_regenerate_id();
}
// Authentication
$_SESSION['USER_LOGGED'] = authentication($_REQUEST['u'], $_REQUEST['p']);
$_SESSION['USR_USERNAME'] = $_REQUEST['u'];
switch ($_REQUEST['a']) {
case 'webEntry':
// Redirect to web entry
if (!isset($_REQUEST['task'])) {
throw new Exception('The required parameter "task" is empty.');
}
G::header('Location: ../' . urldecode($_REQUEST['task']));
die;
break;
case 'mesdemandes':
// Redirect to inbox
//G::header('Location: ../convergenceList/inboxDinamic.php?table=95654345151237be9ca3ab2040266744&filter=demande');
if (!isset($_REQUEST['task'])) {
G::header('Location: ../convergenceList/inboxDinamic.php?idInbox=DEMANDES');
示例6: ModifyProfile
function ModifyProfile($post_errors = array())
{
global $txt, $scripturl, $user_info, $context, $sourcedir, $user_profile, $cur_profile;
global $modSettings, $memberContext, $profile_vars, $smcFunc, $post_errors, $options, $user_settings;
// Don't reload this as we may have processed error strings.
if (empty($post_errors)) {
loadLanguage('Profile');
}
loadTemplate('Profile');
require_once $sourcedir . '/Subs-Menu.php';
// Did we get the user by name...
if (isset($_REQUEST['user'])) {
$memberResult = loadMemberData($_REQUEST['user'], true, 'profile');
} elseif (!empty($_REQUEST['u'])) {
$memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile');
} else {
$memberResult = loadMemberData($user_info['id'], false, 'profile');
}
// Check if loadMemberData() has returned a valid result.
if (!is_array($memberResult)) {
fatal_lang_error('not_a_user', false);
}
// If all went well, we have a valid member ID!
list($memID) = $memberResult;
$context['id_member'] = $memID;
$cur_profile = $user_profile[$memID];
// Let's have some information about this member ready, too.
loadMemberContext($memID);
$context['member'] = $memberContext[$memID];
// Is this the profile of the user himself or herself?
$context['user']['is_owner'] = $memID == $user_info['id'];
/* Define all the sections within the profile area!
We start by defining the permission required - then SMF takes this and turns it into the relevant context ;)
Possible fields:
For Section:
string $title: Section title.
array $areas: Array of areas within this section.
For Areas:
string $label: Text string that will be used to show the area in the menu.
string $file: Optional text string that may contain a file name that's needed for inclusion in order to display the area properly.
string $custom_url: Optional href for area.
string $function: Function to execute for this section.
bool $enabled: Should area be shown?
string $sc: Session check validation to do on save - note without this save will get unset - if set.
bool $hidden: Does this not actually appear on the menu?
bool $password: Whether to require the user's password in order to save the data in the area.
array $subsections: Array of subsections, in order of appearance.
array $permission: Array of permissions to determine who can access this area. Should contain arrays $own and $any.
*/
$profile_areas = array('info' => array('title' => $txt['profileInfo'], 'areas' => array('summary' => array('label' => $txt['summary'], 'file' => 'Profile-View.php', 'function' => 'summary', 'permission' => array('own' => 'profile_view_own', 'any' => 'profile_view_any')), 'statistics' => array('label' => $txt['statPanel'], 'file' => 'Profile-View.php', 'function' => 'statPanel', 'permission' => array('own' => 'profile_view_own', 'any' => 'profile_view_any')), 'showposts' => array('label' => $txt['showPosts'], 'file' => 'Profile-View.php', 'function' => 'showPosts', 'subsections' => array('messages' => array($txt['showMessages'], array('profile_view_own', 'profile_view_any')), 'topics' => array($txt['showTopics'], array('profile_view_own', 'profile_view_any')), 'attach' => array($txt['showAttachments'], array('profile_view_own', 'profile_view_any'))), 'permission' => array('own' => 'profile_view_own', 'any' => 'profile_view_any')), 'permissions' => array('label' => $txt['showPermissions'], 'file' => 'Profile-View.php', 'function' => 'showPermissions', 'permission' => array('own' => 'manage_permissions', 'any' => 'manage_permissions')), 'tracking' => array('label' => $txt['trackUser'], 'file' => 'Profile-View.php', 'function' => 'tracking', 'subsections' => array('activity' => array($txt['trackActivity'], 'moderate_forum'), 'ip' => array($txt['trackIP'], 'moderate_forum'), 'edits' => array($txt['trackEdits'], 'moderate_forum')), 'permission' => array('own' => 'moderate_forum', 'any' => 'moderate_forum')), 'viewwarning' => array('label' => $txt['profile_view_warnings'], 'enabled' => in_array('w', $context['admin_features']) && $modSettings['warning_settings'][0] == 1 && $cur_profile['warning'] && $context['user']['is_owner'] && !empty($modSettings['warning_show']), 'file' => 'Profile-View.php', 'function' => 'viewWarning', 'permission' => array('own' => 'profile_view_own', 'any' => 'issue_warning')))), 'edit_profile' => array('title' => $txt['profileEdit'], 'areas' => array('account' => array('label' => $txt['account'], 'file' => 'Profile-Modify.php', 'function' => 'account', 'enabled' => $context['user']['is_admin'] || $cur_profile['id_group'] != 1 && !in_array(1, explode(',', $cur_profile['additional_groups'])), 'sc' => 'post', 'password' => true, 'permission' => array('own' => array('profile_identity_any', 'profile_identity_own', 'manage_membergroups'), 'any' => array('profile_identity_any', 'manage_membergroups'))), 'forumprofile' => array('label' => $txt['forumprofile'], 'file' => 'Profile-Modify.php', 'function' => 'forumProfile', 'sc' => 'post', 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own', 'profile_title_own', 'profile_title_any'), 'any' => array('profile_extra_any', 'profile_title_any'))), 'theme' => array('label' => $txt['theme'], 'file' => 'Profile-Modify.php', 'function' => 'theme', 'sc' => 'post', 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own'), 'any' => array('profile_extra_any'))), 'authentication' => array('label' => $txt['authentication'], 'file' => 'Profile-Modify.php', 'function' => 'authentication', 'enabled' => !empty($modSettings['enableOpenID']) || !empty($cur_profile['openid_uri']), 'sc' => 'post', 'hidden' => empty($modSettings['enableOpenID']) && empty($cur_profile['openid_uri']), 'password' => true, 'permission' => array('own' => array('profile_identity_any', 'profile_identity_own'), 'any' => array('profile_identity_any'))), 'notification' => array('label' => $txt['notification'], 'file' => 'Profile-Modify.php', 'function' => 'notification', 'sc' => 'post', 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own'), 'any' => array('profile_extra_any'))), 'pmprefs' => array('label' => $txt['pmprefs'], 'file' => 'Profile-Modify.php', 'function' => 'pmprefs', 'enabled' => allowedTo(array('profile_extra_own', 'profile_extra_any')), 'sc' => 'post', 'permission' => array('own' => array('pm_read'), 'any' => array('profile_extra_any'))), 'ignoreboards' => array('label' => $txt['ignoreboards'], 'file' => 'Profile-Modify.php', 'function' => 'ignoreboards', 'enabled' => !empty($modSettings['allow_ignore_boards']), 'sc' => 'post', 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own'), 'any' => array('profile_extra_any'))), 'lists' => array('label' => $txt['editBuddyIgnoreLists'], 'file' => 'Profile-Modify.php', 'function' => 'editBuddyIgnoreLists', 'enabled' => !empty($modSettings['enable_buddylist']) && $context['user']['is_owner'], 'sc' => 'post', 'subsections' => array('buddies' => array($txt['editBuddies']), 'ignore' => array($txt['editIgnoreList'])), 'permission' => array('own' => array('profile_extra_any', 'profile_extra_own'), 'any' => array())), 'groupmembership' => array('label' => $txt['groupmembership'], 'file' => 'Profile-Modify.php', 'function' => 'groupMembership', 'enabled' => !empty($modSettings['show_group_membership']) && $context['user']['is_owner'], 'sc' => 'request', 'permission' => array('own' => array('profile_view_own'), 'any' => array('manage_membergroups'))))), 'profile_action' => array('title' => $txt['profileAction'], 'areas' => array('sendpm' => array('label' => $txt['profileSendIm'], 'custom_url' => $scripturl . '?action=pm;sa=send', 'permission' => array('own' => array(), 'any' => array('pm_send'))), 'issuewarning' => array('label' => $txt['profile_issue_warning'], 'enabled' => in_array('w', $context['admin_features']) && $modSettings['warning_settings'][0] == 1 && (!$context['user']['is_owner'] || $context['user']['is_admin']), 'file' => 'Profile-Actions.php', 'function' => 'issueWarning', 'permission' => array('own' => array('issue_warning'), 'any' => array('issue_warning'))), 'banuser' => array('label' => $txt['profileBanUser'], 'custom_url' => $scripturl . '?action=admin;area=ban;sa=add', 'enabled' => $cur_profile['id_group'] != 1 && !in_array(1, explode(',', $cur_profile['additional_groups'])), 'permission' => array('own' => array(), 'any' => array('manage_bans'))), 'subscriptions' => array('label' => $txt['subscriptions'], 'file' => 'Profile-Actions.php', 'function' => 'subscriptions', 'enabled' => !empty($modSettings['paid_enabled']), 'permission' => array('own' => array('profile_view_own'), 'any' => array('moderate_forum'))), 'deleteaccount' => array('label' => $txt['deleteAccount'], 'file' => 'Profile-Actions.php', 'function' => 'deleteAccount', 'sc' => 'post', 'password' => true, 'permission' => array('own' => array('profile_remove_any', 'profile_remove_own'), 'any' => array('profile_remove_any'))), 'activateaccount' => array('file' => 'Profile-Actions.php', 'function' => 'activateAccount', 'sc' => 'get', 'permission' => array('own' => array(), 'any' => array('moderate_forum'))))));
// Let them modify profile areas easily.
call_integration_hook('integrate_profile_areas', array(&$profile_areas));
// Do some cleaning ready for the menu function.
$context['password_areas'] = array();
$current_area = isset($_REQUEST['area']) ? $_REQUEST['area'] : '';
foreach ($profile_areas as $section_id => $section) {
// Do a bit of spring cleaning so to speak.
foreach ($section['areas'] as $area_id => $area) {
// If it said no permissions that meant it wasn't valid!
if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any'])) {
$profile_areas[$section_id]['areas'][$area_id]['enabled'] = false;
} else {
$profile_areas[$section_id]['areas'][$area_id]['permission'] = $area['permission'][$context['user']['is_owner'] ? 'own' : 'any'];
}
// Password required - only if not on OpenID.
if (!empty($area['password'])) {
$context['password_areas'][] = $area_id;
}
}
}
// Is there an updated message to show?
if (isset($_GET['updated'])) {
$context['profile_updated'] = $txt['profile_updated_own'];
}
// Set a few options for the menu.
$menuOptions = array('disable_url_session_check' => true, 'current_area' => $current_area, 'extra_url_parameters' => array('u' => $context['id_member']));
// Actually create the menu!
$profile_include_data = createMenu($profile_areas, $menuOptions);
// No menu means no access.
if (!$profile_include_data && (!$user_info['is_guest'] || validateSession())) {
fatal_lang_error('no_access', false);
}
// Make a note of the Unique ID for this menu.
$context['profile_menu_id'] = $context['max_menu_id'];
$context['profile_menu_name'] = 'menu_data_' . $context['profile_menu_id'];
// Set the selected item - now it's been validated.
$current_area = $profile_include_data['current_area'];
$context['menu_item_selected'] = $current_area;
// Before we go any further, let's work on the area we've said is valid. Note this is done here just in case we every compromise the menu function in error!
$context['completed_save'] = false;
$security_checks = array();
$found_area = false;
foreach ($profile_areas as $section_id => $section) {
// Do a bit of spring cleaning so to speak.
foreach ($section['areas'] as $area_id => $area) {
// Is this our area?
if ($current_area == $area_id) {
// This can't happen - but is a security check.
if (isset($section['enabled']) && $section['enabled'] == false || isset($area['enabled']) && $area['enabled'] == false) {
//.........这里部分代码省略.........
示例7: mysqli_query
$mobilePhone = $_REQUEST['$mobilePhone'];
$sortF = $_REQUEST['$sortF'];
$sortS = $_REQUEST['$sortS'];
$privileges = $_REQUEST['$privileges'];
$description = $_REQUEST['$description'];
$serviceindex = $_REQUEST['$serviceindex'];
$province = $_REQUEST['$province'];
$city = $_REQUEST['$city'];
$addresDetail = $_REQUEST['$addresDetail'];
$fixTelephone = $_REQUEST['$fixTelephone'];
// 字符必须添加'',数字不必添加
$sqlUpdate = "UPDATE\n `business`\n SET\n `name` = '{$businessName}',\n `sortF` = {$sortF},\n `sortS` = {$sortS},\n `privileges` = '{$privileges}',\n `picUrl` = '{$shopfrontPic}',\n `description` = '{$description}',\n `businessSTime` = {$startTime},\n `businessETime` = {$endTime},\n `licensePicUrl` = '{$licencePic}',\n `mobilePhone` = '{$mobilePhone}',\n `serviceindex` = {$serviceindex},\n `longitude` = {$lon},\n `latitude` = {$lat},\n `province` = {$province},\n `city` = {$city},\n `addresDetail` = '{$addresDetail}',\n `fixTelephone` = '{$fixTelephone}'\n WHERE\n `business`.`id` = {$businessId}";
$connect = db::getInstance()->connect();
$result = mysqli_query($connect, $sqlUpdate);
if ($result) {
echo '更新基本数据成功';
} else {
echo response::show(201, '更新基本数据失败');
}
}
$businessId = $_REQUEST['$businessId'];
// id+time+.jpg
$ImageName = $_REQUEST['$businessId'] . time() . '.jpg';
// 1.身份验证
authentication($_REQUEST['mgrPhone'], $_REQUEST['mgrPwd'], $businessId);
// 2.保存门面照
$shopfrontPic = storeUploadImage::storeShopFrontImage($ImageName, $_REQUEST['$shopfrontPic']);
// 3.保存营业执照
$licencePic = storeUploadImage::storeLicenceImage($ImageName, $_REQUEST['$licencePic']);
// 4.更新基本数据
updateBusinessInfor($businessId, $shopfrontPic, $licencePic);
示例8: session_start
<?php
$php_root_path = "..";
require_once "{$php_root_path}/includes/include_all_fns.inc";
session_start();
$header = "View Papers";
$accepted_privilegeID_arr = array(1 => "");
$accepted_phaseID_arr = array(1 => "", 2 => "", 3 => "", 4 => "");
authentication($header, $accepted_privilegeID_arr, $accepted_phaseID_arr, $homepage, $php_root_path, $dbprefix, &$err_message);
$sort =& $_GET["sort"];
$err_message = " Unable to process your request due to the following problems: <br>\n";
//Call function to evaluate showing
$showing = evaluate_showing($_GET["showing"]);
$_SESSION["phase"]->set_view_paper(&$err_message);
// 4.0.6
//Call the function to display the range of records
$from = evaluate_records_range($showing, $totalPapers);
//Call the function to evaluate prev
$prev = evaluate_prev($_GET["sort"], $showing);
$next = evaluate_next($_GET["sort"], $showing, $totalPapers);
echo "User Name:<strong> " . stripslashes($_SESSION["valid_user"]) . "</strong><p>";
?>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td>From: <?php
echo "<strong>{$from}</strong>";
?>
</td>
<td align="right">Total Papers : <strong><?php