本文整理汇总了PHP中uid函数的典型用法代码示例。如果您正苦于以下问题:PHP uid函数的具体用法?PHP uid怎么用?PHP uid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateChargeStatus
public function updateChargeStatus($cid, $status)
{
$data = array('status' => $status, 'optuid' => uid(), 'donedate' => time());
$this->db->where('cid', $cid);
$this->db->update($this->table, $data);
return $this->db->affected_rows();
}
示例2: robot
public function robot()
{
if (!he_is('agency')) {
abort(403);
}
$data = DB::table('i_robot')->select('i_robot.*', 'i_robot_lease_log.*', 'i_hospital.name as hospital_name', 'i_employee.name as employee_name')->leftJoin('i_robot_lease_log', 'i_robot.id', '=', 'i_robot_lease_log.robot_id')->leftJoin('i_hospital', 'i_hospital.id', '=', 'i_robot_lease_log.hospital_id')->leftJoin('i_employee', 'i_employee.id', '=', 'i_robot.employee_id')->where('i_robot_lease_log.recent', 1)->where('i_robot_lease_log.agency_id', uid())->orderBy('i_robot.id', 'i_robot_lease_log.lease_ended_at desc')->get();
return ss($data);
}
示例3: api_mycss
function api_mycss()
{
$sql = "SELECT `css` FROM `css` WHERE `uid` = '" . intval(uid()) . "' LIMIT 1";
$data = get_var($sql);
if (db_errno() != 0) {
apiController::send_error(LR_API_DB_ERROR, 'DATABASE ERROR ' . db_error());
}
return apiController::send_result($data);
}
示例4: requestRecommendation
function requestRecommendation($user_id, $author, $email, $message)
{
if (!checkLock("peer")) {
return 6;
}
$config = $GLOBALS['config'];
$user_id = escape($user_id);
$author = escape($author);
$email = escape($email);
if (!validEmail($email)) {
return 1;
}
if (strlen($author) <= 3) {
return 2;
}
//make sure there aren't too many recommendations already
$result = mysql_query("SELECT COUNT(*) FROM recommendations WHERE user_id = '{$user_id}'");
$row = mysql_fetch_row($result);
if ($row[0] >= $config['max_recommend']) {
return 4;
//too many recommendations
}
//ensure this email hasn't been asked with this user already
$result = mysql_query("SELECT COUNT(*) FROM recommendations WHERE user_id = '{$user_id}' AND email = '{$email}'");
$row = mysql_fetch_row($result);
if ($row[0] > 0) {
return 5;
//email address already asked
}
lockAction("peer");
//first create an instance
$instance_id = customCreate(customGetCategory('recommend', true), $user_id);
//insert into recommendations table
$auth = escape(uid(64));
mysql_query("INSERT INTO recommendations (user_id, instance_id, author, email, auth, status, filename) VALUES ('{$user_id}', '{$instance_id}', '{$author}', '{$email}', '{$auth}', '0', '')");
$recommend_id = mysql_insert_id();
$userinfo = getUserInformation($user_id);
//array (username, email address, name)
//send email now
$content = page_db("request_recommendation");
$content = str_replace('$USERNAME$', $userinfo[0], $content);
$content = str_replace('$USEREMAIL$', $userinfo[1], $content);
$content = str_replace('$NAME$', $userinfo[2], $content);
$content = str_replace('$AUTHOR$', $author, $content);
$content = str_replace('$EMAIL$', $email, $content);
$content = str_replace('$MESSAGE$', page_convert($message), $content);
$content = str_replace('$AUTH$', $auth, $content);
$content = str_replace('$SUBMIT_ADDRESS$', $config['site_address'] . "/recommend.php?id={$recommend_id}&user_id={$user_id}&auth={$auth}", $content);
$result = one_mail("Recommendation request", $content, $email);
if ($result) {
return 0;
} else {
return 3;
}
}
示例5: usb_url
function usb_url($type)
{
if (!he_is('employee')) {
return;
}
$base = 'http://www.remebot.cn/isapi/remeisapi.dll/?';
$user = DB::table('i_employee')->select(DB::raw('right(password, 4) as pass'))->where('id', uid())->first();
$time = time();
$params = ['a' => $type, 'b' => $time, 'c' => uid() * 3 * substr($time, -4), 'd' => $user->pass];
return $base . http_build_query($params);
}
示例6: read
public function read()
{
$id = rq('id');
$data = $this->find($id);
$res = 0;
if ($data->recipientid == uid()) {
$data->read = 1;
$res = $data->save();
}
return ss($res);
}
示例7: accessRules
public function accessRules()
{
Yii::app()->user->loginUrl = param('adminUrl') . 'user/login';
$assumed = false;
if (isset(Yii::app()->session['assumed']) && Yii::app()->session['assumed'] != '') {
$assumed = true;
}
if (uid() != 'admin' && uid() != '' && !$assumed) {
$this->redirect(array('/video/admin'));
}
return array(array('allow', 'actions' => array('login', 'logout'), 'users' => array('*')), array('allow', 'users' => array('admin')), array('deny', 'users' => array('*')));
}
示例8: client
function client()
{
if (v('type') == 'android') {
$type = 'android';
} else {
$type = 'ios';
}
$data['type'] = $type;
$token = $_SESSION['token'];
$api = parse_url(c('api_server'), PHP_URL_HOST);
$data['url'] = $token . '|' . $api . '|' . $_SESSION['uname'] . '|' . uid() . '|' . $_SESSION['level'];
render($data, 'ajax', 'raw');
}
示例9: rl
public function rl()
{
$user = uid();
$time = time();
$row = $this->select(DB::raw('right(password, 4) as pass, name'))->where('id', $user)->first();
$params = ['a' => 'department', 'b' => $time, 'd' => $row->pass, 'c' => substr($time, -4) * 3 * $user];
$baseUrl = env('ISAPI_URL');
$url = $baseUrl . http_build_query($params);
$res = Requests::get($url);
$data = json_decode($res->body);
$data->name = $row->name;
return response()->json($data);
}
示例10: progress_area
function progress_area($data)
{
$all = count(get_data("SELECT * FROM todo_user WHERE `uid` = 0 OR `uid` = '" . intval(uid()) . "'"));
$finished = count(get_data("SELECT * FROM todo_user WHERE (`uid` = 0 OR `uid` = '" . intval(uid()) . "') AND `status`='3' "));
$data['all'] = $all;
$data['finished'] = $finished;
$data['margin-left'] = 25;
$private_all = count(get_data("SELECT * FROM todo_user WHERE (`uid` = 0 OR `uid` = '" . intval(uid()) . "') AND `is_public` ='0'"));
$private_finished = count(get_data("SELECT * FROM todo_user WHERE (`uid` = 0 OR `uid` = '" . intval(uid()) . "') AND `is_public` = '0' AND `status`='3' "));
$data['private_all'] = $private_all;
$data['private_finished'] = $private_finished;
$data['private_margin-left'] = 200;
echo render_html($data, dirname(__FILE__) . DS . 'view' . DS . 'progress.tpl.html');
}
示例11: verifyPGPKey
function verifyPGPKey($content, $email)
{
global $config;
//allow blank "keys" if this is set
//this means that encryption for $email will be disabled by the cron if it
// was enabled originally
if ($config['pgpverify_allowblank'] && trim($content) == '') {
return true;
}
require_once "Crypt/GPG.php";
//try to create a random subdirectory of $config['pgpverify_tmpdir']
do {
$path = $config['pgpverify_tmpdir'] . '/' . uid(16);
} while (file_exists($path));
$result = @mkdir($path);
if ($result === false) {
if ($config['debug']) {
die("Failed to create directory [" . $path . "] for PGP verification.");
} else {
return false;
}
}
$gpg = new Crypt_GPG(array('homedir' => $path));
//import the key to our GPG temp directory
try {
$gpg->importKey($content);
} catch (Crypt_GPG_NoDataException $e) {
//user supplied an invalid key!
recursiveDelete($path);
return false;
}
//verify the email address matches
$keys = $gpg->getKeys();
if (count($keys) != 1) {
if ($config['debug']) {
die("Error in PGP verification: key count is " . count($keys) . "!");
} else {
recursiveDelete($path);
return false;
}
}
$userIds = $keys[0]->getUserIds();
if (count($userIds) != 1 || strtolower($userIds[0]->getEmail()) != strtolower($email)) {
recursiveDelete($path);
return false;
}
recursiveDelete($path);
return true;
}
示例12: header
function header($view)
{
//view同级下是否存在对应的header
$header = $view . '_header';
$viewPath = APPPATH . 'views/';
$data['controller'] = $this->CI->router->fetch_class();
if (uli()) {
//获取用户信息
lm('user_model');
$data['userprofile'] = $this->CI->user_model->getUserProfileByIdArray(uid());
}
if (file_exists($viewPath . $header . '.php')) {
lv($header, $data);
} else {
lv('header', $data);
}
}
示例13: actionDelete
public function actionDelete($id)
{
if ($_POST['action'] == 1) {
if ($id == 1) {
echo json_encode(array('id' => array(0), 'class' => 'alert-error', 'message' => __('supper user can not delete')));
exit;
}
if ($id === uid()) {
echo json_encode(array('id' => array(0), 'class' => 'alert-error', 'message' => __('you can not remove yourself')));
exit;
}
$model = \app\modules\auth\models\User::find($id);
$model->delete();
echo json_encode(array('id' => array($id), 'class' => 'alert-success', 'message' => __('delete user success')));
exit;
}
}
示例14: requestPGP
function requestPGP($email, $key)
{
require_once includePath() . "/lock.php";
global $config, $lang;
if (!checkLock('requestpgp')) {
return $lang['submit_error_trylater'];
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
return $lang['submit_error_bademail'];
}
if (strlen($email) > 256 || strlen($key) > 1024 * 32) {
return $lang['submit_error_toolong'];
}
if (!isAscii($key)) {
return $lang['submit_error_nonascii'];
}
//housekeeping
databaseQuery("DELETE FROM gpgmw_keys WHERE time < DATE_SUB(NOW(), INTERVAL 48 HOUR) AND confirm != '' AND status = 0");
//if we already have an unaccepted key for this user, only replace if one day has elapsed since the last request
// this may prevent spam
$result = databaseQuery("SELECT HOUR(TIMEDIFF(time, NOW())), id FROM gpgmw_keys WHERE email = ? AND status = 0", array($email));
if ($row = $result->fetch()) {
if ($row[0] < 24) {
return $lang['submit_error_alreadyqueue'];
} else {
databaseQuery('DELETE FROM gpgmw_keys WHERE id = ?', array($row[1]));
}
}
//if PGP key verification is enabled, do it
if ($config['pgpverify_enable']) {
require_once includePath() . "/gpg.php";
if (!verifyPGPKey($key, $email)) {
return $lang['submit_error_badkey'];
}
}
//well, it looks good, let's submit it
lockAction('requestpgp');
$confirm = uid(32);
$confirm_link = "{$config['site_url']}/confirm.php?email=" . urlencode($email) . "&confirm={$confirm}";
$result = gpgmw_mail($config['email_subject_requestpgp'], sprintf($lang['mail_confirm'], $confirm_link), $email);
if (!$result) {
return $lang['submit_error_emailfail'];
}
databaseQuery("INSERT INTO gpgmw_keys (email, publickey, confirm) VALUES (?, ?, ?)", array($email, $key, $confirm));
return true;
}
示例15: uploaded
function uploaded()
{
if (!is_admin()) {
return info_page(__('ADMIN_ONLY_LOGIN'));
}
if ($_FILES['pfile']['error'] != 0) {
return info_page(__('PLUGIN_UPLOAD_FILE_ERROR_RETRY'));
}
$tmp_name = $_FILES['pfile']['tmp_name'];
$tname = uid() . '-' . time();
$plug_path = c('plugin_path') . DS . $tname;
if (@mkdir($plug_path)) {
include_once AROOT . 'lib' . DS . 'dUnzip2.inc.php';
$zip = new dUnzip2($tmp_name);
$zip->debug = false;
$zip->unzipAll($plug_path);
@chmod($plug_path, 0755);
$info_file = $plug_path . DS . 'app.php';
if (file_exists($info_file)) {
if ($info = get_plugin_info(file_get_contents($info_file))) {
if (isset($info['folder_name'])) {
$folder_name = $info['folder_name'];
}
if (strlen($folder_name) < 1) {
$folder_name = reset(explode('.', basename($_FILES['pfile']['name'])));
}
if (strlen($folder_name) > 0) {
if (file_exists(c('plugin_path') . DS . $folder_name)) {
@rename(c('plugin_path') . DS . $folder_name . DS . 'app.php', c('plugin_path') . DS . $folder_name . DS . 'app.bak.php');
@rename(c('plugin_path') . DS . $folder_name, c('plugin_path') . DS . $folder_name . '_' . uid() . '_' . time());
}
rename($plug_path, c('plugin_path') . DS . $folder_name);
header("Location: ?c=pluglist");
return true;
} else {
return info_page(__('PLUGIN_GET_NAME_ERROR_RETRY', $tname));
}
}
} else {
// clear dir
}
return info_page(__('PLUGIN_PACKAGE_FORMAT_ERROR'));
} else {
return info_page(__('PLUGIN_CREATE_FOLDER_ERROR'));
}
}