本文整理汇总了PHP中getvar函数的典型用法代码示例。如果您正苦于以下问题:PHP getvar函数的具体用法?PHP getvar怎么用?PHP getvar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getvar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
if (!$GLOBALS['islogin']) {
redirect($GLOBALS['s']['urlsite'] . '/member/login');
}
$college = M("college");
$collegeList = $college->select();
$this->assign('collegeList', $collegeList);
$cid = getvar('college', 1);
$c = $college->where("id={$cid}")->find();
$c = $c["name"];
//dump($c);
$sex = $GLOBALS['i']['sex'] == 1 ? 2 : 1;
$a = '';
if ($cid != "") {
$a = " AND college='{$c}'";
$b = "class=currt";
}
$a .= $GLOBALS['i']['sex'] == 2 ? ' AND default_photonum>0' : '';
$orderby = getvar('orderby', array('login_time', 'register_time'));
$member = M('member');
$count = $member->where("group_type>0 AND sex={$sex}.{$a}")->count();
//echo $member->getLastSql();
import("@.ORG.Page");
$page = new Page($count, 10);
$memberlist = $member->field('uid, sex, username, default_pic, is_videoauth, photonum, login_time, class, college, height, hometown_prov, hometown_city, birth_y, constellation, blood, stature, grade, introduce, want_content')->where("group_type>0 AND sex={$sex}.{$a}")->order("{$orderby} DESC")->limit($page->firstRow . ',' . $page->listRows)->select();
//echo $member->getLastSql();
$this->assign('memberlist', $memberlist);
$this->assign('sex', $sex);
$this->assign('orderby', $orderby);
$this->assign('b', $b);
$this->assign('cid', $cid);
$this->assign('pages', $page->show(1));
$this->display();
}
示例2: share_score
public function share_score()
{
$uid = getvar('uid', 1);
if ($GLOBALS['islogin'] && ($GLOBALS['i']['uid'] == $uid || !$uid)) {
$m = $GLOBALS['i'];
} else {
$member = M('member');
$m = $member->field('uid, username, sex, default_pic, score_impress')->where("uid={$uid}")->find();
if (!$m) {
$this->error('找不到此人');
}
}
$img = $GLOBALS['s']['pathupload'] . $m['default_pic'] . '_qq.jpg';
if (!is_file($img) || filemtime($img) + 86400 < time()) {
$tpl = $GLOBALS['s']['pathupload'] . '/000face/share_score.jpg';
$water = $GLOBALS['s']['pathupload'] . $m['default_pic'] . '_240x240.jpg';
$girl = array('邻家女孩', '古典美', '大眼妹妹', '潮女', '皮肤好白', '性感', '奶茶妹妹', '似曾相识', '乖乖女', '时尚的女生', '惊艳', '眼睛好漂亮', '脖子很性感', '你很爱笑哦', '距离感', '风情女', '帅气的女生', '朋克女生', '好迷你好娇小', '野性', '小资文艺女', '温柔的美女', '小萝莉', '有气质', '氧气美女', '身材很魔鬼', '骨感的女生', '冰雪女王', '笑得好妩媚好温暖', '好淑女');
$boy = array('骑着白马的唐僧', '好美啊!', '贵族王子', '魅力型男', '灰太狼', '潮男', '莲花小王子', '背包客', '眼神犀利', '阳光宅男', '黑框眼镜男', '迷茫弟', '王子范儿', '西装笔挺', '运动健将', '纯爷们', '很有潜力', '三好学生', '火星男', '文艺青年', '极品好男人', '成熟', '霸气外露', '坏男人', '体魄强健', '老实本分', '心好男人', '绅士', '这货不简单', '猥琐');
$arr = $m['sex'] == 1 ? $boy : $girl;
$a1 = rand(0, 29);
$a2 = ($a1 + rand(1, 3)) % 30;
$a3 = ($a2 + rand(1, 3)) % 30;
$a4 = ($a3 + rand(1, 3)) % 30;
import('@.ORG.Image');
//font-size, margin-left, margin-top, font-color, text
$text = array(array(20, 50, 0, array(10, 10, 10), '您的照片在网站上获得 分'), array(28, 323, -35, array(240, 0, 35), $m['score_impress']), array(24, 195 + $a1 - strlen($arr[$a1]) * 5.5, -10, array(153, 0, 153), $arr[$a1]), array(24, 195 + $a2 - strlen($arr[$a2]) * 5.5, -10, array(102, 100, 204), $arr[$a2]), array(24, 195 + $a3 - strlen($arr[$a3]) * 5.5, -10, array(0, 0, 255), $arr[$a3]), array(24, 195 + $a4 - strlen($arr[$a4]) * 5.5, -10, array(0, 204, 51), $arr[$a4]));
Image::share_pic($tpl, $water, $img, 100, $text);
//Image::buildString('你们好啊', array(102, 104, 104), $img);
}
$this->assign('m', $m);
$this->display();
}
示例3: add
public function add()
{
if ($GLOBALS['islogin']) {
$uid = $GLOBALS['i']['uid'];
$visit_uid = getvar('uid', 1);
if ($uid != $visit_uid) {
$member = M('member');
$u = $member->field('sex')->where("uid={$visit_uid}")->find();
if ($u && $u['sex'] != $GLOBALS['i']['sex']) {
$visit = M('visit');
$data['uid'] = $uid;
$data['visit_uid'] = $visit_uid;
$rs = $visit->field('id')->where($data)->find();
//echo '<!--', $visit->getLastSql(), '-->';
if (!$rs) {
$data['add_time'] = time();
$id = $visit->add($data);
} else {
$visit->where($data)->setField('add_time', time());
}
$member_field = M('member_field');
$data1['new_visitor'] = array('exp', 'new_visitor+1');
$member_field->where("uid={$visit_uid}")->save($data1);
}
}
}
}
示例4: get_oauth_token
function get_oauth_token()
{
global $twitterObj;
$twitterObj = new EpiTwitter(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, getvar('oauth_token', ''));
// $twitterObj->setToken(getvar('oauth_token', ''));
$token = $twitterObj->getAccessToken();
//$twitterObj->setToken($token->oauth_token, $token->oauth_token_secret);
return $token;
}
示例5: download
/**
* @@desc Xuat ra chi thi cho phep download file
*/
function download($name)
{
$user = getvar('UserName');
$folder = "temp/{$user}/";
$name = $name . '_' . date('y-m-d_His') . '.pdf';
$file = $folder . $name;
$this->Output($file, 'F');
message("In thành công!<ul><li>Click chuột trái vào tên file để mở file trên cửa sổ mới.<li>Click chuột phải vào tên file và chọn <b>Save target as...</b> để lưu file.</ul><center><a href='get.php?f={$name}' target=_blank>{$name}</a></center>");
}
示例6: index_login
public function index_login()
{
$invite_uid = getvar('uid', 1);
if ($invite_uid) {
cookie('invite_uid', $invite_uid, 180);
}
$member = M('member');
$memberlist1 = $member->field('uid, sex, username, default_pic, college, want_content, photonum, score_impress')->where("default_pic!='' AND sex=1 AND default_photonum>0 AND group_type>0")->order('uid DESC')->limit('5, 2')->select();
$memberlist2 = $member->field('uid, sex, username, default_pic, college, want_content, photonum, score_impress')->where("default_pic!='' AND sex=2 AND default_photonum>0 AND group_type>0")->order('uid DESC')->limit('1, 8')->select();
$memberlist3 = $member->field('uid, sex, username, default_pic, college, want_content, photonum, score_impress')->where("default_pic!='' AND sex=1 AND default_photonum>0 AND group_type>0")->order('uid DESC')->limit('7, 17')->select();
$memberlist = array_merge($memberlist1, $memberlist2, $memberlist3);
$rand = rand(1, 9);
$mosaic = '';
for ($i = 1; $i < 33; $i++) {
$pixel = 120;
if ($i > 25) {
$pixel = 32;
} elseif ($i > 15) {
$pixel = 48;
} elseif ($i > 5) {
$pixel = 72;
} else {
$pixel = 120;
}
$pz = $pixel == 32 ? 48 : $pixel;
$mosaic .= "<div id=\"mp_c{$i}\" class=\"mp_c mp_cs{$pixel}\">";
if (($i + $rand) % 5 == 0) {
//if(1) {
$rand = ($i + $rand + 3) % 9 + 1;
$mosaic .= "<div class=\"mp_c_p mp_c_p{$rand} mp_c_tz\">";
} else {
$m = current($memberlist);
$mj = json_encode($m);
$mj = str_replace('"', "'", $mj);
next($memberlist);
$mosaic .= '<div class="mp_c_ph mp_c_tz">';
$mosaic .= "<a class=\"mp_c_ph_l\" target=\"_blank\" href=\"{$GLOBALS['s']['urldomain']}/{$m['uid']}\">\n<img id=\"img_0_{$i}\" class=\"mp_c_ph_img\" width=\"{$pixel}\" height=\"{$pixel}\" src=\"{$GLOBALS['s']['urlupload']}{$m['default_pic']}_{$pz}x{$pz}.jpg\" title=\"{$m['username']}的个人档案\" alt=\"{$m['username']}的个人档案\" onmouseover=\"show_user_tips({$i},{$mj})\" /></a>";
}
$mosaic .= '</div></div>';
}
$count = $member->count() + 1212;
$counter = '';
$n = $count;
$i = 1;
while ($n > 0) {
$num = $n % 10;
if ($i % 3 == 1 && $i > 1) {
$counter = '<span class="mp_cnt_d mp_cnt_space"><span class="mp_cnt_d_os"></span></span>' . $counter;
}
$counter = "<span class=\"mp_cnt_d mp_cnt_d_{$num}\"><span class=\"mp_cnt_d_o\">{$num}</span> <i class=\"mp_cnt_d_f\"></i></span>" . $counter;
$n = ($n - $num) / 10;
$i++;
}
$this->assign('mosaic', $mosaic);
$this->assign('counter', $counter);
$this->display('index_login');
}
示例7: process
/**
* Checks, wheter a page is actually in INSERT or UPDATE mode an creates the corresponding
* Saveset.
*/
function process()
{
global $page_action;
$this->posFilter = str_replace("<chcat>", "CHID = " . getvar("chsel"), $this->posFilter);
$pos = getDBCell($this->table, $this->column, $this->posFilter . " AND " . $this->column . "=" . $this->value);
if ($pos != "") {
freeRowPosition($this->table, $this->column, $this->value, $this->posFilter);
}
if ($page_action == "INSERT") {
addInsert($this->table, $this->column, $this->value, $this->datatype);
} else {
if ($page_action == "UPDATE") {
addUpdate($this->table, $this->column, $this->value, $this->row_identifier, $this->datatype);
}
}
}
示例8: sender
public function sender()
{
if (!$GLOBALS['islogin']) {
redirect($GLOBALS['s']['urlsite'] . '/member/login');
}
$question = M("question");
$map['uid'] = $GLOBALS['i']['uid'];
$order = getvar('order', 1);
if ($order == 0) {
$b = "new_answer desc,";
}
$list = $question->where($map)->order("{$b} add_time desc")->select();
//echo $question->getLastSql();
$this->assign('list', $list);
$this->assign('order', $order);
$this->display();
}
示例9: callback
public function callback()
{
$site = getvar('site', array('qq', 'sina', 'ren', 'tao'));
include_once APP_PATH . "/Lib/Extend/apilogin/{$site}.class.php";
$platform = new $site();
$openid = $platform->getOpenId();
if (!$openid) {
$this->error('系统繁忙,请稍候重试一下啊');
exit;
}
$member_field = M('member_field');
//已登录用户同步设置开始
if ($GLOBALS['islogin']) {
$sync['qquid'] = $openid;
$sync['qq_oauth'] = $platform->get_oauth();
$member_field->where("uid={$GLOBALS['i']['uid']}")->save($sync);
redirect(cookie('referer'));
exit;
}
//已登录用户同步设置结束
$u = $member_field->field('qh_member_field.uid')->join("qh_member ON qh_member.uid=qh_member_field.uid")->where("qquid='{$openid}'")->find();
//exit($member_field->getLastSql());
if ($u) {
cookie('uid', $u['uid'], 86400);
$member = M('member');
$edit['login_time'] = time();
$edit['login_times'] = array('exp', 'login_times+1');
$edit['login_ip'] = get_client_ip();
$member->where("uid={$u['uid']}")->save($edit);
$member_field->where("uid={$u['uid']}")->setField('qq_oauth', $platform->get_oauth());
redirect(cookie('referer'));
exit;
} else {
$openuser = $platform->getUserInfo();
cookie('open_uid', $openuser['uid'], 0);
cookie('open_name', $openuser['name'], 0);
cookie('open_sex', $openuser['sex'], 0);
cookie('open_pic', $openuser['pic'], 0);
cookie('open_province', $openuser['province'], 0);
cookie('open_city', $openuser['city'], 0);
cookie('open_oauth', $platform->get_oauth(), 0);
//exit($GLOBALS['s']['urlsite'] . '/member/reg_active');
$memberAction = A('Member');
$memberAction->reg_active();
}
}
示例10: index
function index()
{
$data['title'] = $this->title;
$data['controller'] = $this->controller;
$data['help'] = $this->help;
$data['admin'] = getvar("admin", 100000);
$data['col_lancar'] = getvar("col_lancar", 0);
$data['col_no_lancar'] = getvar("col_no_lancar", 14);
$data['col_macet'] = getvar("col_macet", 14);
$data['hari_telat'] = getvar("hari_telat", 14);
//kurang dari 14 masuk sa, lebih masuk adminls
$data['penalty'] = getvar("penalty", 2);
$data['denda_prc'] = getvar("denda_prc", 5);
$data['denda_hari'] = getvar("denda_hari", 8);
$data = array_merge($data, $this->gl_link());
$this->template->display_form_input($this->file_view, $data);
}
示例11: __construct
function __construct($thisurl, $template = 'base.tpl')
{
parent::__construct($template);
$this->object = array();
$this->assign('title', APP_NAME);
$this->assign('formaction', $thisurl);
$this->assign('doctype', "<!DOCTYPE html>");
// We obtain the mode
$this->mode = getvar('mode', 'show');
$this->order = getvar('order', '');
// We use a dummy object to generate the needed elements for the canvas.
$this->common = new Element();
$this->common->addMeta('content-type', 'text/html;charset=utf-8');
$this->common->addCSSRef(APP_URL . 'files/gen.css.php');
$this->common->addScriptRef(APP_URL . 'files/gen.js');
$this->common->setFormVar('mode', $this->mode);
$this->common->setFormVar('order', $this->order);
}
示例12: card_log
public function card_log()
{
if (!$GLOBALS['islogin']) {
redirect($GLOBALS['s']['urlsite'] . '/member/login');
}
$type = getvar('type', array('link', 'refund', 'buy'));
$card_log = M("card_log");
$uid = $GLOBALS['i']['uid'];
import("@.ORG.Page");
$count1 = $card_log->where("uid={$uid} AND type='{$type}'")->count();
$page1 = new Page($count1, 10);
$list = $card_log->where("uid={$uid} AND type='{$type}'")->order('add_time DESC')->limit($page1->firstRow . ',' . $page1->listRows)->select();
//echo $card_log->getLastSql();
$this->assign('pages1', $page1->show());
//dump($page1);
$this->assign('list', $list);
$this->assign('type', $type);
$this->display();
}
示例13: xiaoyuannannv
public function xiaoyuannannv()
{
$guest_name = cookie('username');
$guest_pic = cookie('guest_pic');
if (!$guest_pic) {
$guest_pic = '/000face/ask_' . rand(1, 9) . '.jpg';
cookie('guest_pic', $guest_pic);
}
$GLOBALS['i'] = array('uid' => 0, 'username' => $guest_name ? $guest_name : '游客', 'default_pic' => '/000face/s1.jpg');
$college = M("college");
$collegeList = $college->select();
$this->assign('collegeList', $collegeList);
$cid = getvar('college', 1);
$c = $college->where("id={$cid}")->find();
$c = $c["name"];
//dump($c);
$sex = getvar('sex', 1);
$addsql = '';
if ($sex) {
$addsql .= "AND sex={$sex}";
}
if ($cid != "") {
$addsql .= " AND college='{$c}'";
$b = "class=currt";
}
$orderby = getvar('orderby', array('login_time', 'register_time'));
$member = M('member');
$count = $member->where("default_photonum>0 AND group_type>0 {$addsql}")->count();
//echo $member->getLastSql();
import("@.ORG.Page");
$page = new Page($count, 10);
$memberlist = $member->field('uid, sex, username, default_pic, is_videoauth, photonum, login_time, class, college, height, hometown_prov, hometown_city, birth_y, constellation, blood, stature, grade, introduce, want_content')->where("default_photonum>0 AND group_type>0 {$addsql}")->order("{$orderby} DESC")->limit($page->firstRow . ',' . $page->listRows)->select();
//echo $member->getLastSql();
$this->assign('memberlist', $memberlist);
$this->assign('sex', $sex);
$this->assign('orderby', $orderby);
$this->assign('b', $b);
$this->assign('cid', $cid);
$this->assign('pages', $page->show(1));
$this->display();
}
示例14: array
</div>
</fieldset>
</form>
<?php
if (!empty($_GET)) {
$searchfilters = array("name" => "data.name || ' ' || data.lastname ILIKE " . $dbh->quote("%" . getvar("name") . "%"), "room" => "data.room = " . $dbh->quote(getvar("room")), "activity" => "data.activity = " . $dbh->quote(getvar("activity")), "date1" => "data.dob > " . $dbh->quote(getvar("date1")), "date2" => "data.dob < " . $dbh->quote(getvar("date2")), "date3" => "data.\"joinDate\" > " . $dbh->quote(getvar("date3")), "date4" => "data.\"joinDate\" < " . $dbh->quote(getvar("date4")), "date5" => "data.\"lastSeen\" > " . $dbh->quote(getvar("date5")), "date6" => "data.\"lastSeen\" < " . $dbh->quote(getvar("date6")));
$wherequery = array();
foreach ($searchfilters as $n => $q) {
$v = getvar($n);
if (!empty($v)) {
$wherequery[] = $q;
}
}
$query = "SELECT DISTINCT data.id, data.name, lastname, paging, room, activity\n FROM data";
if (count($wherequery) > 0) {
$query .= " WHERE " . (getvar("invert") == "on" ? " NOT " : "") . "(" . implode(" and ", $wherequery) . ")";
}
$query .= " ORDER BY lastname;";
$result = pg_query($connection, $query) or die(_("Error in query") . ": {$query}." . pg_last_error($connection));
if (pg_num_rows($result) == 0) {
echo '<div class="alert alert-error">
<a class="close" data-dismiss="alert" href="#">×</a>
<h4 class=\\"alert-heading\\">' . _('No results') . '</h4>
</div>';
} else {
echo '<table class="table">
<thead>
<tr>
<script language="JavaScript">
function toggle(source) {
checkboxes = document.getElementsByName(\'foo\');
示例15: session_start
<?php
session_start();
require_once "../session.php";
require_once '../inc/const.php';
$act = $_GET['act'];
$id = getvar('id');
$fid = getvar('fid');
$name = getvar('name');
$rank = getvar('rank');
if ($act == 'add') {
$record = array('fid' => $fid, 'name' => $name, 'rank' => $rank, 'dateline' => date("y-m-d H-i-s"));
$id = $db->insert($GLOBALS[databasePrefix] . 'industry', $record);
echo "<script>alert('添加成功!');window.location='customer_industry.php';</script>";
}
if ($act == 'mod') {
$record = array('fid' => $fid, 'name' => $name, 'rank' => $rank);
$db->update($GLOBALS[databasePrefix] . 'industry', $record, 'id=' . $id);
echo "<script>alert('修改成功!');window.location='customer_industry.php';</script>";
}
//删除
if ($act == 'del') {
$db->delete($GLOBALS[databasePrefix] . 'industry', 'id=' . $id);
echo "<script>alert('删除成功!');window.location='customer_industry.php';</script>";
}