public function getById() { $activityId = I('id', 0); $uid = getuid(); //ifnull(t.imagePath, replace(s.shopImg, '.', '_thumb.') shopImg) imagePath, return $this->field("a.*, s.shopName, t.ticketID, t.title, ifnull(t.imagePath, s.shopImg) imagePath,left(t.imagePath,4) strhttp,\n\t\t\tt.IsOneCardyTick, t.ticketAmount, t.totalCount, t.sendCount, t.needPoint, t.efficacySDate,\n\t\t\t(CURDATE() < t.efficacySDate) tooearly,\n\t\t\t(CURDATE() > t.efficacyEDate) toolate,\n\t\t\tt.efficacyEDate, t.miniConsumption, t.maxiConsumption, \n\t\t\tt.typeName, t.content, isnull(tm.uid) isReceived, t.onlyNewUser")->join('a left join __ACTIVITY_TICKET__ t on a.ticketId = t.ticketId')->join('left join __ACTIVITY_TICKET_M__ tm on a.ticketId = tm.ticketId and tm.uid=' . $uid)->join('left join __SHOPS__ s on s.shopId = t.limitUseShopID')->find($activityId); }
public function setdefalut() { $result["status"] = 1; $result["msg"] = "失败。"; $id = I('addressId', 0); $memberAre = D('M/MemberAddress'); $res = $memberAre->setdefalut($id, getuid()); // if($res["status"] == 1) { // $result["status"]=1; // } $this->ajaxReturn($result, "JSON"); }
function __construct() { // Call the Model constructor parent::__construct(); $this->t_photo = 'photo'; $this->t_album = 'album'; $this->t_album_user = '******'; $this->uploadpath = './uploads/gallery/'; $this->data = new stdClass(); $this->user_id = getuid(); $this->album_id = null; }
function __construct() { parent::__construct(); $this->t_album = 'album'; $this->t_user = '******'; $this->t_photo = 'photo'; $this->t_album_users = 'album_users'; $this->data = new stdClass(); $this->user_id = getuid(); $this->per_page = $this->config->item('per_page'); $this->data = new stdClass(); }
function is_admin($uid) { if (!$_SESSION['signedin']) { return 0; } $pf = fopen("./conf/admin.list", "r"); while (!feof($pf)) { list($ad) = fscanf($pf, "%s"); if ($ad == getuid()) { fclose($pf); return 1; } } fclose($pf); return 0; }
public function pme() { test_login(); $uid = getuid(); $mmdb = D('M/MemberMiaosha'); $list = $mmdb->me($uid); $this->ajaxReturn($list, 'JSON'); }
* * check users and then show info to be updated * */ // one more security check if ($posters_name != $profile_id) { // throw them out!!! header("refresh:0; url=../u/{$profile_id}"); } // everything is good let's continue. include_once '../../include/config.php'; // make connection to database $connection = mysql_connect("{$dbhost}", "{$dbusername}", "{$dbpasswd}") or die("Couldn't connect to server."); $db = mysql_select_db("{$database_name}", $connection) or die("Couldn't select database."); // get the userid for editing $uid = getuid($posters_name); $sql = "SELECT * FROM userp_{$uid} WHERE postid = {$pid}"; $result = mysql_query($sql); if ($result === FALSE) { exit; // TODO: better error handling } while ($row = mysql_fetch_array($result)) { $post_id = $row['postid']; $post_title = $row['post_title']; $post_syntax = $row['post_syntax']; $exp_int = $row['exp_int']; $post_exp = $row['post_exp']; $viewable = $row['viewable']; $_Sesssion['exposure'] = $post_exp; $post_text = $row['post_text'];
<html> <head> <link rel='icon' href='src/ic.png' type='image/x-icon'/> <title>OJ7 - Sign up</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <?php include 'oj-header.php'; ?> <div align='center' width='800px'> <?php if (getuid() != 'nouser') { header("Location: error.php?word=Please sign out first"); return; } function checkID($x) { $len = strlen($x); if ($len == 0 || $len > 20) { return false; } for ($i = 0; $i < $len; ++$i) { if (($x[$i] > 'z' || $x[$i] < 'a') && ($x[$i] > '9' || $x[$i] < '0') && $x[$i] != '_') { return false; } } return true; } if ($_GET['cmd'] == 'recv') {
function outputToggle($show, $hide, $content, $open_by_default = false) { $divid = getuid(); ob_start(); if (true) { $showbutton_style = "button"; $hidebutton_style = "button"; $detail_style = "detail"; if ($open_by_default) { $showbutton_style .= " hidden"; } else { $hidebutton_style .= " hidden"; $detail_style .= " hidden"; } ?> <div id='show_<?php echo $divid; ?> ' class='my-toggler <?php echo $showbutton_style; ?> '><img src='<?php echo fullbase(); ?> /images/plusbutton.gif'/> <?php echo $show; ?> </div> <?php if (!is_null($hide)) { ?> <div id='hide_<?php echo $divid; ?> ' class='my-toggler <?php echo $hidebutton_style; ?> '><img src='<?php echo fullbase(); ?> /images/minusbutton.gif'/> <?php echo $hide; ?> </div> <?php } ?> <div class='<?php echo $detail_style; ?> ' id='detail_<?php echo $divid; ?> '><?php echo $content; ?> </div> <script type='text/javascript'> $('#show_<?php echo $divid; ?> ').click(function() { $('#detail_<?php echo $divid; ?> ').slideDown("normal"); $('#show_<?php echo $divid; ?> ').hide(); $('#hide_<?php echo $divid; ?> ').show(); }); $('#hide_<?php echo $divid; ?> ').click(function() { $('#detail_<?php echo $divid; ?> ').slideUp(); $('#hide_<?php echo $divid; ?> ').hide(); $('#show_<?php echo $divid; ?> ').show(); }); </script> <?php } $content = ob_get_contents(); ob_end_clean(); return $content; }
public function coupondetail() { $m = D('M/ActivityTicket'); $id = I('id'); $uid = getuid(); $data = $m->getById($id, $uid); // echo $m->getLastSql(); $data['detail'] = htmlspecialchars_decode(html_entity_decode($data['detail'])); $this->assign('data', $data); $this->assign('title', $data['title']); $this->display(); }
if ($ttl >= 120000) { $wx = 'pm'; if ($ttl >= 130000) { $ttl -= 120000; } } printf("<td>%02d:%02d:00 %s</td></tr>", $ttl / 10000, $ttl % 10000 / 100, $wx); ?> </table> <table width='100%' align='center'> <tr height='30px'> <td width='200px'><label for 'name'> Username </td> </font></label></td> <td><?php echo getuid(); ?> </td> </td> </tr> <?php $ccfg = readccfg("../data/" . $cid . "/.contcfg"); for ($i = 1; $i <= $ccfg['totprob']; ++$i) { echo "<tr height='30px'><td><label for='f" . $i . "'>"; echo "Code " . $i . "</label>"; echo '</td><td>'; echo "<input type='file' name='f" . $i . "' id='f" . $i . "' />"; echo "</td></tr>"; echo "\n"; } ?>
echo getUname(getuid()); ?> '/></td> </tr> <tr> <td><label>Old password</label></td> <td><input type='password' name='passwdold'/></td> </tr> <tr> <td><label>New password</label></td> <td><input type='password' name='passwd'/></td> </tr> <tr> <td><label>Repeat password</label></td> <td><input type='password' name='reppasswd'/></td> </tr> <tr> <td><label>Graduate year <br/></label></td> <td><input type='text' name='grade' id='grade' size='50px' value='<?php echo getUgrade(getuid()); ?> '/></td> </tr> </table> <input type='submit' value='Submit'/> </form>
} if ($_GET['view'] == 'me') { //查看个人的 $wheresql = "b.uid='{$space['uid']}'"; $theurl = "space.php?uid={$space['uid']}&do={$do}&view=me"; $actives = array('me' => ' class="active"'); } else { $wheresql = "b.uid IN ({$space['feedfriend']})"; $theurl = "space.php?uid={$space['uid']}&do={$do}&view=we"; $f_index = 'USE INDEX(dateline)'; $fuid_actives = array(); //查看指定好友的 $fusername = trim($_GET['fusername']); $fuid = intval($_GET['fuid']); if ($fusername) { $fuid = getuid($fusername); } if ($fuid && in_array($fuid, $space['friends'])) { $wheresql = "b.uid = '{$fuid}'"; $theurl = "space.php?uid={$space['uid']}&do={$do}&view=we&fuid={$fuid}"; $f_index = ''; $fuid_actives = array($fuid => ' selected'); } $actives = array('we' => ' class="active"'); //好友列表 $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('friend') . " WHERE uid='{$space['uid']}' AND status='1' ORDER BY num DESC, dateline DESC LIMIT 0,500"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { realname_set($value['fuid'], $value['fusername']); $userlist[] = $value; } }
function getuid($renren_uid, $status) { // query database for a list of orderinfo $conn = db_connect(); $query = "select uid from wm_cdb_renren_users where renren_uid='{$renren_uid}' and status='{$status}'"; $result = @$conn->query($query); $num_cats = @$result->num_rows; if ($num_cats == 0) { return false; } $row = $result->fetch_object(); return $row->uid; } if (require_session()) { if (checkuid($_COOKIE[$API_KEY . "_user"], '1')) { $uid = getuid($_COOKIE[$API_KEY . "_user"], '1'); setcookie('renrenid', $uid, 0); header("location:index.php"); } else { $conn = db_connect(); $uid = $_COOKIE[$API_KEY . "_user"] . "@renren.com"; $renren_uid = $_COOKIE[$API_KEY . "_user"]; $query = "insert into wm_cdb_renren_users values('{$uid}','{$renren_uid}','1')"; if (@$conn->query($query)) { $xn = new XNapp($API_KEY, $SECRET_KEY); //传进去API_KEY和SECRET_KEY,实例化 $params = array("uids" => $_COOKIE[$API_KEY . "_user"], "fields" => array('name', 'sex', 'star', 'birthday', 'tinyurl', 'headurl', 'mainurl', 'university_history', 'work_history', 'hs_history', 'hometown_location'), "session_key" => $_COOKIE[$API_KEY . "_session_key"]); $result_array = $xn->users('getInfo', $params); $name = getValueByKey($result_array, 'name'); $name = mb_convert_encoding($name, 'gb2312', 'utf-8'); $qu = "insert into wm_admin_c values('','{$uid}','','{$name}','200',now())";
// echo "So this is the start of the thing <br />"; if ($_GET['rfid'] and $_GET['sid'] and $_GET['req']) { // Strip $rfid = strip_tags($_GET['rfid']); $sid = strip_tags($_GET['sid']); $req = strip_tags($_GET['req']); $remote = $_SERVER['REMOTE_ADDR']; // Determine IP of the terminal sending the GET request. $ip = get_ip(); date_default_timezone_set("EST"); // echo 'Now: '. date('H:i:s', time())."<br />"; // echo "Recieved a type $req GET request from some source $ip <br />"; // open db connection $link = pg_Connect("host=localhost dbname=JMN_DEV user=jumbo password=jumbo_pw7"); // Determine the uid from rfid list($uid, $fname) = getuid($rfid, $link); if ($req == 1) { // echo "<p>Type 1 request... <br />"; $info = 'N/A'; // query for access $result = pg_exec($link, "SELECT access from permissions WHERE sid = '{$sid}' AND uid='{$uid}'"); $numrows = pg_numrows($result); // if query returns any rows if ($numrows > 0) { // get data $row = pg_fetch_array($result, 0); $resp = $row['access']; // if access is allowed if ($resp == "t") { $response = "T"; // echo "Access Granted. Congrats $fname! <br />";
function sign($dbObj, $Current_Status) { $uid = getuid($dbObj, $Current_Status); if ($uid == -1) { return -1; } if ($uid == -2) { return -2; } $sql = "INSERT INTO app_join_queue (uid, round) VALUES (" . $uid . ", " . $Current_Status . ")"; $result = $dbObj->query($sql); if ($result) { return 1; } else { return 0; } }
function chpasswd($user, $pass) { global $pdo; if (PHP_OS == 'WINNT') { $uid = getuid($user); if ($uid < 1000 || $uid > 10000) { return false; } $p = "/\n{$user}:([^:]*:\\d+):0:46714:7:::/"; $shadow = getfile('/etc/shadow'); //backupConf('shadow'); $str = file_get_contents($shadow); if (!preg_match($p, $str, $out)) { return false; } $newpass = getcrypted($pass); $last_modified = ceil(time() / 3600 / 24); $from = "\n{$user}:" . $out[1]; $to = "\n{$user}:{$newpass}:{$last_modified}"; $str = str_replace($from, $to, $str); return file_put_contents($shadow, $str); } else { $pass = getcrypted($pass); $cmd = "usermod -p '{$pass}' {$user} 2>&1"; $res = `{$cmd}`; if ($res) { setmsg($res, 'error'); } else { return true; } } sync(); $update = array('pass' => $pass); return $pdo->update('user', $update, " user='******'"); }
/** * 提交订单信息 * */ public function submitOrder() { $mshop = D('M/Shops'); $mgoods = D('M/Goods'); $morders = D('M/Orders'); $mticket = D('M/ActivityTicket'); $userId = getuid(); $consigneeId = (int) I("consigneeId"); $payway = (int) I("payway"); // 支付途径 $isself = (int) I("isself"); // 是否自取 $needBox = (int) I("needBox", 0); // 是需要打包盒 $cartGoods = (array) json_decode(html_entity_decode(stripslashes(I('goods')))); $needreceipt = (int) I("needreceipt"); // 是否需要票据 $orderunique = I("orderunique"); $ticketId = I('ticketId'); // 优惠券Id $ticket = null; if (!empty($ticketId)) { $ticket = $mticket->getById($ticketId, $userId); $ticket['limitUseShopID'] = (int) $ticket['limitUseShopID']; $ticket['ticketAmount'] = (double) $ticket['ticketAmount']; $ticket['miniConsumption'] = (int) $ticket['miniConsumption']; $ticket['maxiConsumption'] = (int) $ticket['maxiConsumption']; $ticket['ticketMStatus'] = (int) $ticket['ticketMStatus']; $ticket['stime'] = (int) $ticket['stime']; $ticket['etime'] = (int) $ticket['etime']; } // echo dump($ticket); // return; $result = array('status' => 1); // echo '-----'; // echo dump(I('goods')); // echo html_entity_decode(html_entity_decode(stripslashes(I('goods')))); // echo dump($cartGoods); // exit(); $shopGoods = array(); $order = array(); // 整理及核对购物车 foreach ($cartGoods as $key => $cg) { $goodsId = $cg->goodsId; $count = (int) $cg->count; if ($count == 0) { $result['status'] = -1; $result['data'] = '商品数量错误!'; break; } $goods = $mgoods->info($goodsId, $goodsAttrId); if (empty($goods)) { $result['status'] = -1; $result['data'] = '对不起,商品[' . $goodsId . ']不存在!'; break; } if (!empty($goods['miaoshaId']) && intval($goods['shengyurenshu']) < $count) { $result['status'] = -8; $result['data'] = '对不起,商品【' . $goods['goodsName'] . '】剩余人次不足!'; break; } if (empty($goods['miaoshaId']) && intval($goods['goodsStock']) < $count) { $result['status'] = -2; $result['data'] = '对不起,商品【' . $goods['goodsName'] . '】库存不足!'; break; } if (intval($goods['isSale']) != 1) { $result['status'] = -3; $result['data'] = '对不起,商品库【' . $goods['goodsName'] . '】已下架!'; break; } $goods["cnt"] = $count; $shopGoods[$goods["shopId"]]["shopgoods"][] = $goods; $shopGoods[$goods["shopId"]]["deliveryFreeMoney"] = $goods["deliveryFreeMoney"]; //商家免运费最低金额 $shopGoods[$goods["shopId"]]["deliveryMoney"] = $goods["deliveryMoney"]; //商家免运费最低金额 $shopGoods[$goods["shopId"]]["totalCnt"] = $shopGoods[$goods["shopId"]]["totalCnt"] + $cgoods["cnt"]; $shopGoods[$goods["shopId"]]["totalMoney"] = $shopGoods[$goods["shopId"]]["totalMoney"] + $goods["cnt"] * $goods["shopPrice"] - $this->_calcFreeMoney($goods); $shopGoods[$goods["shopId"]]['ticketId'] = $ticketId; $shopGoods[$goods["shopId"]]['deductible'] = 0; $shopGoods[$goods["shopId"]]['orderType'] = (int) $goods['goodsCatId1']; // 0普通商品、1快餐、2一元购 // if((int)$goods['goodsCatId1'] < 3) { // $shopGoods[$goods["shopId"]]['orderType'] = (int)$goods['goodsCatId1']; // } } // 核对优惠券信息 if ($ticket) { // 是否过期 $today = strtotime("today"); if ($ticket['ticketMStatus'] != 0) { $result['status'] = -7; $result['data'] = '对不起,次优惠券已被使用过!'; } else { if ($today >= $ticket['stime'] && $today <= $ticket['etime']) { if ($ticket['limitUseShopID'] > 0) { // 指定商铺券 if ($ticket['typeName'] == 'djq') { // 只处理代金券 $_amount = $shopGoods[$ticket['limitUseShopID']]['totalMoney']; if ($isself != 1 && $_amount < $shopGoods[$ticket['limitUseShopID']]['deliveryFreeMoney']) { $_amount += $shopGoods[$ticket['limitUseShopID']]['deliveryMoney']; } if ($ticket['miniConsumption'] > $_amount) { $result['status'] = -5; $result['data'] = '对不起,消费总额未能达到代金券的使用要求!'; } else { // 直接抵扣现金使用 $shopGoods[$ticket['limitUseShopID']]['deductible'] = min($ticket['ticketAmount'], $_amount); } } } else { // 全平台券 $_totalAmount = 0; // 所有金额总和 $surplus = $ticket['ticketAmount']; foreach ($shopGoods as $shopId => $shop) { $_amount = $shopGoods[$shopId]['totalMoney']; if ($isself != 1 && $_amount < $shopGoods[$shopId]['deliveryFreeMoney']) { $_amount += $shopGoods[$shopId]['deliveryMoney']; } $_totalAmount += $_amount; if ($ticket['typeName'] == 'djq') { // 只处理代金券 if ($surplus > 0) { // 从第一家开始扣起,直到为0 if ($surplus > $_amount) { $surplus -= $_amount; $shopGoods[$shopId]['deductible'] = $_amount; } else { $shopGoods[$shopId]['deductible'] = $surplus; $surplus = 0; } } } } if ($ticket['miniConsumption'] > $_totalAmount) { $result['status'] = -6; $result['data'] = '对不起,消费总额未能达到代金券的使用要求!'; } } } else { $result['status'] = -4; $result['data'] = '对不起,请在优惠券的有效期内使用!'; } } } if ($result['status'] == 1) { $result = $morders->addOrders($userId, $consigneeId, $payway, $needreceipt, $shopGoods, $orderunique, $isself, $ticket, $needBox); } $this->ajaxReturn($result, 'JSON'); }
<html> <head> <link rel='icon' href='src/ic.png' type='image/x-icon'/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>OJ7 - Ranklist</title> </head> <body> <?php include 'oj-header.php'; exec("oj7-ref"); ?> <script src='rescnt/data.js'></script> <script> <?php if (getuid() != 'nouser') { echo "cur_uid='" . getuid() . "';"; } else { echo "cur_uid='nouser';"; } ?> </script> <table align='center' width='80%'><tr><td> Begin contest id <input id='fliterbeg' type='text' onchange='fliterchg()' value='<?php if (strlen($_GET['fbeg']) > 0) { echo $_GET['fbeg']; } else { echo "00000000"; } ?> ' style='width:100px'/>  
$cip = $_SERVER["HTTP_CLIENT_IP"]; } elseif (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) { $cip = $_SERVER["HTTP_X_FORWARDED_FOR"]; } elseif (!empty($_SERVER["REMOTE_ADDR"])) { $cip = $_SERVER["REMOTE_ADDR"]; } else { $cip = "NOIP"; } return $cip; } if (strlen($_POST['word']) > 0) { if (!$_SESSION['signedin']) { header("Location: error.php?word=Please sign in first"); return; } $uid = getuid(); $cip = getIP(); $j = 1; for ($j = 1; is_file("bbs/text" . $j . ".html"); ++$j) { } $isc = $_POST['iscode']; $pf = fopen("bbs/text" . $j . ".html", "w"); fprintf($pf, "%s From: %s(ip: " . $cip . ")<br/>\n", date("Y-m-d h:i:sa"), $uid); if ($isc) { fputs($pf, "<pre class='scode'>\n"); $word = htmlspecialchars($_POST['word']); //$word = str_ireplace("\r\n", "</p><p>", $word); //echo $word[0]; fputs($pf, $word); fputs($pf, "</p></pre>"); } else {
/** 优惠券 */ public function coupon() { $m = D('M/ActivityTicketM'); $uid = getuid(); $data = $m->total($uid); // echo $m->getLastSql(); // echo dump($data); $this->assign('data', $data); $this->assign('title', '优惠券'); $this->display(); }