本文整理汇总了PHP中authenticated函数的典型用法代码示例。如果您正苦于以下问题:PHP authenticated函数的具体用法?PHP authenticated怎么用?PHP authenticated使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了authenticated函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lock
/**
* Locks a specific script for unauthenticated requests.
*/
function lock()
{
if (!authenticated()) {
header('Location: ' . R . 'auth/?referer=' . $_SERVER['REQUEST_URI']);
exit;
}
}
示例2: autherized
function autherized($userid, $pageauth)
{
if (!isset($pageauth)) {
return 1;
}
if (authenticated()) {
return 1;
}
return 0;
}
示例3: isset
?>
</div>
<!-- end Authentication status -->
<br clear="all" />
<?php
// if $_GET['status'] is populated then we have a response
// about a syndicated upload from YouTube's servers
if (isset($_GET['status'])) {
isset($_GET['code']) ? $code = $_GET['code'] : ($code = null);
isset($_GET['id']) ? $id = $_GET['id'] : ($id = null);
print '<div id="generalStatus">' . uploadStatus($_GET['status'], $code, $id) . '<div id="detailedUploadStatus"></div></div>';
}
?>
<!-- General status -->
<?php
if (authenticated()) {
printAuthenticatedActions();
}
?>
<!-- end General status -->
<br clear="all" />
<div id="searchResults">
<div id="searchResultsListColumn">
<div id="searchResultsVideoList"></div>
<div id="searchResultsNavigation">
<form id="navigationForm" action="javascript:void();">
<input type="button" id="previousPageButton" onclick="ytVideoApp.listVideos(ytVideoApp.previousQueryType, ytVideoApp.previousSearchTerm, ytVideoApp.previousPage);" value="Back" style="display: none;" />
<input type="button" id="nextPageButton" onclick="ytVideoApp.listVideos(ytVideoApp.previousQueryType, ytVideoApp.previousSearchTerm, ytVideoApp.nextPage);" value="Next" style="display: none;" />
</form>
</div>
</div>
示例4: function
});
$app->get('/friends', function () use($app) {
authenticated();
$query = 'SELECT * FROM relations WHERE one = ? OR another = ? ORDER BY created_at DESC';
$friends = array();
$stmt = db_execute($query, array(current_user()['id'], current_user()['id']));
while ($rel = $stmt->fetch()) {
$key = $rel['one'] == current_user()['id'] ? 'another' : 'one';
if (isset($friends[$rel[$key]])) {
$friends[$rel[$key]] = $rel['created_at'];
}
}
$app->render('friends.php', array('friends' => $friends));
});
$app->post('/friends/:account_name', function ($account_name) use($app) {
authenticated();
if (!is_friend_account($account_name)) {
$user = user_from_account($account_name);
if (!$user) {
abort_content_not_found();
}
db_execute('INSERT INTO relations (one, another) VALUES (?,?), (?,?)', array(current_user()['id'], $user['id'], $user['id'], current_user()['id']));
$app->redirect('/friends');
}
});
$app->get('/initialize', function () use($app) {
db_execute("DELETE FROM relations WHERE id > 500000");
db_execute("DELETE FROM footprints WHERE id > 500000");
db_execute("DELETE FROM entries WHERE id > 500000");
db_execute("DELETE FROM comments WHERE id > 1500000");
});
示例5: catch
}
// load objects from configuration
if (!$err) {
try {
$moviemasher_client =& MovieMasher::fromConfig('MovieMasher.xml', 'Client');
$moviemasher_file =& MovieMasher::fromConfig('MovieMasher.xml', 'File');
} catch (Exception $ex) {
$err = xml_safe($ex->getMessage());
}
}
// load utilities
if (!$err && !@(include_once 'MovieMasher/lib/authutils.php')) {
$err = 'Problem loading utility script';
}
// see if the user is autheticated (will NOT exit)
if (!$err && !authenticated()) {
$err = 'Unauthenticated access';
}
// check to make sure required parameters have been sent
if (!$err) {
$job = empty($_REQUEST['job']) ? '' : $_REQUEST['job'];
$id = empty($_REQUEST['id']) ? '' : $_REQUEST['id'];
if (!($job && $id)) {
$err = 'Parameters job, id required';
}
}
// make sure required configuration options have been set
if (!$err) {
$uploads_locally = $moviemasher_file->uploadsLocally();
$renders_locally = $moviemasher_client->rendersLocally();
$path_media = $moviemasher_client->getOption('PathMedia');
示例6: catch
}
// load objects from configuration
if (!$err) {
try {
$moviemasher_client =& MovieMasher::fromConfig('MovieMasher.xml', 'Client');
$moviemasher_file =& MovieMasher::fromConfig('MovieMasher.xml', 'File');
} catch (Exception $ex) {
$err = xml_safe($ex->getMessage());
}
}
// load utilities
if (!$err && !@(include_once 'MovieMasher/lib/authutils.php')) {
$err = 'Problem loading utility script';
}
// see if the user is autheticated (will NOT exit)
if (!$err && !authenticated($moviemasher_client)) {
$err = 'Unauthenticated access';
}
// check to make sure required parameters have been sent
if (!$err) {
$id = empty($_REQUEST['id']) ? '' : $_REQUEST['id'];
if (!$id) {
$err = 'Parameter id required';
}
}
if (!$err) {
// set $err for log entry
$progress = @file_get_contents('php://input');
if (!$progress) {
$err = 'No request body provided';
}
示例7:
<?php
if (!authenticated()) {
echo "echo Authentication failed!\n";
echo "sleep 3\n";
echo "chain --replace --autofree {$url}boot.php\n";
exit;
}
示例8: array
$response = User::getUsersByName($search, $user_id);
} else {
$result = (object) array('status' => -1, 'status_explanation' => 'Insufficient data provided.');
}
header('Content-Type: application/json');
echo json_encode($response, JSON_PRETTY_PRINT);
}, $f3->get('route_ttl'));
/**
* Route: Get user information by ID
*
* @example /user/@id
*/
$f3->route('POST /user/@id', function ($f3, $params) use($db) {
$id = $f3->get('PARAMS.id');
// If user sending request is authenticated
if ($sender_id = authenticated()) {
$user = new User(null, $id);
if ($user_info = $user->getInfo(false)) {
$response = (object) array('status' => 1, 'status_explanation' => 'Success.', 'handle' => $user_info->handle, 'first_name' => $user_info->first_name, 'last_name' => $user_info->last_name, 'image' => $user_info->image);
} else {
$response = (object) array('status' => -2, 'status_explanation' => 'Couldn\'t fetch user information from database.');
}
} else {
$response = (object) array('status' => -1, 'status_explanation' => 'Insufficient data provided.');
}
header('Content-Type: application/json');
echo json_encode($response, JSON_PRETTY_PRINT);
}, $f3->get('route_ttl'));
/**
* Route: Retrieve all achievements
* @todo the achievement system needs to be finished. Right now it just returns a list of available achievements. Nothing more.