function DoList() { $keyword = trim($this->Get['keyword']); $where_list = array(); if ($keyword) { $where_list[] = "`name` like '%{$keyword}%'"; } $where = ""; $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' '; $per_page_num = (int) $this->Get['pn'] ? (int) $this->Get['pn'] : 50; $offset = (max((int) $this->Get['page'], 1) - 1) * $per_page_num; $sql = "SELECT count(1) total from " . TABLE_PREFIX . "tag {$where}"; $query = $this->DatabaseHandler->Query($sql); $row = $query->GetRow(); $total = $row['total']; $order_by_list = array('order_by_default' => 'default', 'default' => array('name' => '添加时间', 'order_by' => 'id'), 'thread_count' => array('name' => '使用次数', 'order_by' => 'total_count'), 'member_count' => array('name' => '标签名称', 'order_by' => 'name')); $order_condition = order($order_by_list, "admin.php?mod=tag&keyword=" . urlencode($keyword), array('display_un_href' => true)); $sql = "SELECT *\r\n\t\tFROM " . TABLE_PREFIX . "tag\r\n\t\t{$where}\r\n\t\t{$order_condition['order']}\r\n\t\tlimit {$offset},{$per_page_num}"; $query = $this->DatabaseHandler->Query($sql); $tag_list = array(); while ($row = $query->GetRow()) { $row['dateline'] = my_date_format($row['dateline']); $row['tag_html'] = $this->_tag_html($row['id'], $row['status']); $tag_list[] = $row; } $pages = page($total, $per_page_num, '', array(), "20 50 100 200 300"); $tag_item_list = jconf::get('tag', 'item_list'); $tag_num = jconf::get('tag_num'); foreach ($tag_item_list as $key => $val) { $val["selected_" . (int) $tag_num[$val['value']]] = " selected "; $tag_item_list[$key] = $val; } include template('admin/tag'); }
public function area() { $map = array('region_type' => 1); $list = M('region')->where($map)->select(); $list = order($list); $this->assign('list', $list); $this->display(); }
/** * Load entity * * @param array $entity * @param array $crit * @param array $opts * * @return array */ function flat_load(array $entity, array $crit = [], array $opts = []) : array { $stmt = db()->prepare(select($entity['attr']) . from($entity['tab']) . where($crit, $entity['attr'], $opts) . order($opts['order'] ?? [], $entity['attr']) . limit($opts['limit'] ?? 0, $opts['offset'] ?? 0)); $stmt->execute(); if (!empty($opts['one'])) { return $stmt->fetch() ?: []; } return $stmt->fetchAll(); }
public function index() { header("content-type:text/html;charset=utf-8"); import("@.ORG.Page"); $db = M('goods_category'); /*$count = $db->count(); $Page = new Page($count,10); $list = $db->order('id DESC')->limit($Page->firstRow.','.$Page->listRows)->select(); $show = $Page->show();*/ $_list = $db->order('list asc')->select(); $list = order($_list); $this->assign('show', $show); $this->assign('list', $list); $this->display(); }
die(JSON::encode($return_data)); } $user_id = $_SESSION['user_id']; $method = $_SERVER['REQUEST_METHOD']; $resource = isset($_REQUEST['api_data']) ? trim($_REQUEST['api_data']) : 'hot'; /* 根据不同的API_RESOURCE来做不同的处理 */ switch ($resource) { case 'hot': include_once 'includes/controller/goods/lib_controller_list.php'; api_return($resource, li_st()); break; case 'view': include_once 'includes/controller/goods/lib_controller_view.php'; api_return($resource, view()); break; case 'idcard': include_once 'includes/controller/goods/lib_controller_new.php'; api_return($resource, idcard()); break; case 'secret': include_once 'includes/controller/goods/lib_controller_secret.php'; api_return($resource, secret()); break; case 'order': include_once 'includes/controller/goods/lib_controller_order.php'; api_return($resource, order()); break; default: # code... break; }
include "shop/db.php"; include "shop/lib.php"; define('BASKET', "{$_COOKIE['basket']}"); if (isset($_GET[id])) { $id = $_GET[id]; delItem('orders', $id); header("Location: basket.php"); } if ($_SERVER['REQUEST_METHOD'] == "POST") { $itemname = clrStr($_POST[itemname]); $itemprice = clrInt($_POST[itemprice]); $quantity = clrInt($_POST[cost]); $img = clrStr($_POST[image]); if ($quantity > 0) { order(BASKET, $itemname, $itemprice, $img, $quantity); } else { header("Refresh:3; url=../index.php#price"); echo "<h2> Неверное количество Товаров!</h2>"; } } $q = qtItem(BASKET); if ($q > 0) { echo "<h2>У Вас в корзине {$q} товаров!</h2>"; addOrder(); } else { echo "<h2>Ваша корзина пуста!</h2>"; } ?> <DOCTYPE html> <html>
" /> <br/><br/><br/> <button type="submit" class="btn btn-primary">Додати</button> </div> </div> </form> <?php } ?> <?php if ($e == 'many') { multiple($e, $t, $t_id); } elseif ($e == 'one') { single($e, $t, $t_id); } elseif ($e == 'yn') { yn($e, 2, $t_id); } elseif ($e == 'text') { text($e, $t_id); } elseif ($e == 'order') { order($e, $t, $t_id); } ?> <div class="col-xs-9 col-sm-8 col-md-6 col-lg-4 col-xs-offset-3 col-sm-offset-2 col-md-offset-2 col-lg-offset-2"> <a href="<?php print URL; ?> ?c=manageTests&f=create_question_hand">назад</a> </div> </div></div></div> </div> </div>
" /> </label></td> </tr> <tr> <td class="height_row"><div align="right">Nick Skype </div></td> <td class="height_row"><input name="skype" type="text" class="input_text" id="skype" value="<?php echo $row['skype']; ?> " /></td> </tr> <tr> <td class="height_row"><div align="right">Số TT</div></td> <td class="height_row"> <select name="order" class="input_text" > <?php order(1, 21, $row['stt']); ?> </select> </td> </tr> <tr> <td> </td> <td><label> <input type="submit" name="UpdateUsers" value="Sửa thành viên" <?php echo @$_SESSION['modmana'] == '2' ? 'disabled' : ''; ?> /> <input type="reset" name="Submit2" value="Nhập Lại" <?php echo @$_SESSION['modmana'] == '2' ? 'disabled' : ''; ?> /> </label></td>
/** * Moves the record down one position */ function orderup() { order(1); }
<tr> <td class="height_row"><div align="right">Picture </div></td> <td class="height_row"><label> <input name="picture_hidden" type="hidden" value="<?php echo $row['picture']; ?> " /> <input name="picture" type="file" id="picture" /> </label></td> </tr> <tr> <td class="height_row"><div align="right">Số thứ tự </div></td> <td class="height_row"> <select name="order" class="input_text" > <?php order(1, 11, $row['stt']); ?> </select></td> </tr> <tr> <td class="height_row"><div align="right">Vị trí </div></td> <td class="height_row"> <select name="alignment" class="input_text" > <option value="1" <?php echo $row['alignment'] == '1' ? 'Selected' : ''; ?> >Bên trái</option> <option value="2" <?php echo $row['alignment'] == '2' ? 'Selected' : ''; ?> >Bên phải</option>
function write($_POST) { $Out = ""; #get & send vars foreach ($_POST as $key => $value) { ${$key} = $value; $Out .= "<input type='hidden' name=\${$key} value='{$value}'>"; } # validate input require_lib("validate"); $v = new validate(); $v->isOk($id, "num", 1, 100, "Invalid stock item id."); if (isset($me)) { $v->isOk($me, "string", 0, 100, "Invalid bar code."); } $v->isOk($sharecode, "string", 0, 100, "Invalid shared bar code."); # display errors, if any if ($v->isError()) { return order($_POST, $v->genErrors()); } $cols = grp(m("bar", $sharecode)); $wh = "stkid='{$id}'"; $qry = new dbUpdate("stock", "cubit", $cols, $wh); $qry->run(DB_UPDATE); if (isset($me) && strlen($me) > 0) { db_conn("cubit"); switch (substr($me, strlen($me) - 1, 1)) { case "0": $tab = "ss0"; break; case "1": $tab = "ss1"; break; case "2": $tab = "ss2"; break; case "3": $tab = "ss3"; break; case "4": $tab = "ss4"; break; case "5": $tab = "ss5"; break; case "6": $tab = "ss6"; break; case "7": $tab = "ss7"; break; case "8": $tab = "ss8"; break; case "9": $tab = "ss9"; break; default: return order($_POST, "The code you selected is invalid"); } if (barext_ex($tab, 'code', $me) or strlen($me) == 0) { return order($_POST, "The code you selected aready exits in the system."); } else { $getcheck = "SELECT * FROM " . $tab . " WHERE code = '{$me}' AND active = 'no'"; $runcheck = db_exec($getcheck) or errDie("Unable to get serial number check"); if (pg_numrows($runcheck) < 1) { $Sl = "INSERT INTO " . $tab . " (code,stock,div) VALUES ('{$me}','{$id}','" . USER_DIV . "')"; $Rs = db_exec($Sl) or errDie("Unable to update database.", SELF); } else { $arr = pg_fetch_array($runcheck); $Sl = "UPDATE " . $tab . " SET active = 'yes' WHERE code = '{$arr['code']}' AND stock = '{$arr['stock']}' AND div = '{$arr['div']}'"; $Rs = db_exec($Sl) or errDie("Unable to update database.", SELF); } } } return order($_POST); }
public function testApiTypeHints() { function order(Topping $topping) { if ($topping == Topping::BLACKBERRY()) { return 'Unfortunately, we are all out of ' . $topping->getValue() . ' topping!'; } return 'Here you go, an icecream with ' . $topping->getValue() . ' topping!'; } // Attempt to order an icecream with different toppings $icecream = order(Topping::STRAWBERRY()); $blackberry = order(Topping::BLACKBERRY()); try { order('test'); // Error, 'test' is no Topping instance } catch (Exception $e) { $error = $e->getMessage(); } $this->assertInternalType('string', $icecream); $this->assertInternalType('string', $blackberry); print sprintf('%s.', $icecream) . PHP_EOL; print sprintf('%s.', $blackberry) . PHP_EOL; print sprintf('%s.', $error) . PHP_EOL; }
echo $require; ?> Tên menu: </div></td> <td width="600"> <input type="text" name="title" id="inputRegister" value="<?php echo $row['title']; ?> " size="30"> </td> </tr> <tr> <td class="height_row"><div align="right">Số TT</div></td> <td colspan="3" class="height_row"> <select name="stt" > <?php order(1, 100, $row['stt']); ?> </select> </td> </tr> <tr> <td class="height_row"><div align="right">Nội dung</div></td> <td class="height_row"> <?php $oFCKeditor = new FCKeditor('full'); $oFCKeditor->BasePath = 'fckeditor/'; $oFCKeditor->Value = $row['full']; $oFCKeditor->Create(); ?>
function write($_POST) { $Out = ""; #get & send vars foreach ($_POST as $key => $value) { ${$key} = $value; $Out .= "<input type=hidden name=\${$key} value='{$value}'>"; } # validate input require_lib("validate"); $v = new validate(); $v->isOk($id, "num", 1, 100, "Invalid bar code."); $v->isOk($rid, "num", 1, 10, "Invalid stock code."); $v->isOk($tab, "string", 3, 3, "Invalid stock code."); # display errors, if any if ($v->isError()) { $errors = ""; $Errors = $v->getErrors(); foreach ($Errors as $e) { $errors .= "<li class=err>" . $e["msg"]; } $errors .= "<input type=hidden name=errors value='{$errors}'>"; return order($_POST, $errors); } db_conn("cubit"); $Sl = "DELETE FROM " . $tab . " WHERE code='{$id}'"; $Rs = db_exec($Sl) or errDie("Unable to update database.", SELF); header("Location: pos.php?id={$rid}"); exit; }
function Main() { $this->CheckAdminPrivs('sessions'); $where_list=array(); $where=""; $query_link="admin.php?mod=sessions"; $p=max((int)$this->Get['page'],1); $query_link.="&page=".$p; $pn=(int)$this->Get['pn']?(int)$this->Get['pn']:20; if($pn<1)$pn=20; $query_link.='&pn='.$pn; $username=trim($this->Get['username']); if ($username!="") { $where_list[]="username like '%$username%'"; $query_link.="&username="******"*" || empty($_ip))continue; $ips.=$and."ip{$i}='$_ip'"; $and=" and "; } $where_list[]=$ips; } if($this->Get['order_by'])$query_link.="&order_by=".$this->Get['order_by']; if($this->Get['order_type'])$query_link.="&order_type=".$this->Get['order_type']; if($where_list)$where=" where ".implode(" AND ",$where_list); $order_by_list = array ( 'order_by_default' => 'lastactivity', 'lastactivity' => array ( 'name' => '最后访问时间', 'order_by' => 'lastactivity', ), 'ip' => array ( 'name' => 'IP地址', 'order_by' =>"concat_ws('.',ip1,ip2,ip3,ip4)", ), 'uid' => array ( 'name' => '用户名', 'order_by' => 'uid', ), ); $order_array = order($order_by_list,$query_link,array('display_un_href'=>true)); $order = $order_array['order']; $order_html = $order_array['html']; $limit=""; $offset=($p-1)*$pn; $sql="SELECT count(1) total from ".TABLE_PREFIX."system_sessions".$where; $query = $this->DatabaseHandler->Query($sql); $row=$query->GetRow(); $total=$row['total']; $sql="SELECT * from ".TABLE_PREFIX."system_sessions".$where." ".$order." limit $offset,$pn"; $query = $this->DatabaseHandler->Query($sql); $session_list=array(); while ($row=$query->GetRow()) { $row['dateline']=my_date_format($row['lastactivity']); $row['ip']=sprintf("%s.%s.%s.%s",$row['ip1'],$row['ip2'],$row['ip3'],$row['ip4']); $session_list[]=$row; } $robot=array(); $robot_record=(int)ConfigHandler::get('robot','turnon'); if($robot_record==1) { $sql="SELECT * from ".TABLE_PREFIX."system_robot_ip"; $query=$this->DatabaseHandler->Query($sql,"SKIP_ERROR"); if($query) { while ($row=$query->GetRow()) { $robot[$row['ip']]=$row['name']; } } } $pages=page($total,$pn,$query_link,array(),"2 10 20 50 100 200 500"); include handler('template')->file('@admin/sessions'); }
" size="6" maxlength="6" /></td> </tr> <tr> <td><div align="right">Màu chữ khi rê chuột </div></td> <td># <input name="hovercolor" type="text" id="hovercolor" value="<?php echo $row['hovercolor']; ?> " size="6" maxlength="6" /></td> </tr> <tr> <td><div align="right">Số thứ tự </div></td> <td> <select name="order" class="input-text" > <?php order(1, 50, $row['stt']); ?> </select></td> </tr> <tr> <td> </td> <td> <input type="submit" name="Ads" value="Sửa category" <?php echo @$_SESSION['modmana'] == '2' ? 'disabled' : ''; ?> /> </td> </tr> </form> </table> </div>
function order($array, $pid = 0, $level = 0) { $arr = array(); foreach ($array as $v) { if ($v['fup'] == $pid) { //||$v['parent_id']==$pid $v['pre'] = str_repeat('—', $level); $arr[] = $v; $arr = array_merge($arr, order($array, $v['id'], $level + 1)); } } return $arr; }
$barcode = $_POST['barcode']; /* * Ambil hasil perhitungan untuk avg daily sales dan saran order */ $hasil = hitung($link, $poId, $barcode); /* * Update po detail dengan nilai hasil perhitungan */ mysqli_query($link, "update purchase_order_detail set avg_daily_sales={$hasil['avg_daily_sales']}, saran_order={$hasil['saran_order']}" . " where purchase_order_id={$poId} and barcode='{$barcode}'") or die('Gagal update po #' . $poId . ', error: ' . mysqli_error($link)); /* * Kembalikan hasil perhitungan + status sukses */ echo json_encode(array_merge(array('sukses' => true), $hasil)); break; case 'order': echo json_encode(order($link, $_POST['poId'], $_POST['barcode'], $_POST['qty'])); break; case 'hapus': echo json_encode(hapus($link, $_POST['poId'], $_POST['barcode'])); break; case 'simpan': echo json_encode(simpan($link, $_POST['poId'])); break; case 'csv': csv($link, $_GET['poId']); break; case 'hapuspo': hapusPo($link, $_GET['poid']); header('location:index.php'); break; }
} } elseif (isset($_GET["month"])) { if (isset($_GET["month"])) { $_POST["month"] = $_GET["month"]; } else { exit; } if (isset($_GET["year"])) { $_POST["year"] = $_GET["year"]; } else { exit; } $OUTPUT = order($_POST); } else { # Display default output $OUTPUT = order($_POST); } # get templete require "template.php"; function order($_POST, $errors = "") { $Out = ""; # get vars foreach ($_POST as $key => $value) { ${$key} = $value; } db_conn("cubit"); $date = date("Y-m-d"); pglib_transaction("begin"); if (!isset($month)) { $month = date("m");
function cancel() { extract($_REQUEST); pglib_transaction("BEGIN"); if (isset($rem) && is_array($rem)) { foreach ($rem as $invid) { db_conn("cubit"); $sql = "DELETE FROM pinvoices WHERE invid='{$invid}'"; $pinvRslt = db_exec($sql) or errDie("Unable to remove invoice from Cubit."); #get any allocated serial numbers and remove items ... AND re-allocate stock $get_sers = "SELECT ss,serno,stkid,qty FROM pinv_items WHERE invid = '{$invid}'"; $run_sers = db_exec($get_sers) or errDie("Unable to get invoice items serial numbers"); if (pg_numrows($run_sers) < 1) { #no items ? } else { while ($parr = pg_fetch_array($run_sers)) { if (strlen($parr['ss']) > 0) { $me = $parr['ss']; } else { $me = $parr['serno']; } #determine which table to connect to and update it switch (substr($me, strlen($me) - 1, 1)) { case "0": $tab = "ss0"; break; case "1": $tab = "ss1"; break; case "2": $tab = "ss2"; break; case "3": $tab = "ss3"; break; case "4": $tab = "ss4"; break; case "5": $tab = "ss5"; break; case "6": $tab = "ss6"; break; case "7": $tab = "ss7"; break; case "8": $tab = "ss8"; break; case "9": $tab = "ss9"; break; default: return order($_POST, "The code you selected is invalid"); } $upd = "UPDATE {$tab} SET active = 'yes' WHERE code = '{$parr['ss']}' OR code = '{$parr['serno']}'"; $run_upd = db_exec($upd) or errDie("Unable to update stock serial numbers"); #look 4 this stock item $get_stock = "SELECT * FROM stock WHERE stkid = '{$parr['stkid']}' LIMIT 1"; $run_stock = db_exec($get_stock) or errDie("Unable to get stock information."); if (pg_numrows($run_stock) < 1) { #cant find stock item ??? } else { $min_alloc = $parr['qty'] + 0; $starr = pg_fetch_array($run_stock); #all set ... re-allocate stock $update_sql = "UPDATE stock SET alloc = alloc - '{$min_alloc}' WHERE stkid = '{$starr['stkid']}'"; $update_run = db_exec($update_sql) or errDie("Unable to update allocated stock information."); } } } #now remove the items $rem_items = "DELETE FROM pinv_items WHERE invid = '{$invid}'"; $run_rem = db_exec($rem_items) or errDie("Unable to remove invoice items"); } } return printInv(); }
removeReal($cid, $option); break; case 'publish': publish($cid, 1, $option); break; case 'unpublish': publish($cid, 0, $option); break; case 'cancel': cancel($option); break; case 'orderup': order($cid[0], -1, $option); break; case 'orderdown': order($cid[0], 1, $option); break; case 'saveorder': saveOrder($cid); break; case 'show': default: show(); break; } /** * show galleries * @param database A database connector object */ function show() {
function account_info($_POST) { $Out = ""; #get & send vars foreach ($_POST as $key => $value) { ${$key} = remval($value); $Out .= "<input type=hidden name=\${$key} value='{$value}'>"; } # validate input require_lib("validate"); $v = new validate(); # display errors, if any if ($v->isError()) { $errors = ""; $Errors = $v->getErrors(); foreach ($Errors as $e) { $errors .= "<li class=err>" . $e["msg"]; } $errors .= "<input type=hidden name=errors value='{$errors}'>"; return order($_POST, $errors); } if (isset($cc)) { $com = "Yes"; } else { $com = "No"; } $op = USER_NAME; db_conn("cubit"); if (strlen($des) > 0) { $Sl = "INSERT INTO todos (datemade,timemade,op,des,com) VALUES ('{$datemade}','{$timemade}','{$op}','{$des}','{$com}')"; $Rs = db_exec($Sl) or errDie("Unable to update database.", SELF); } if (isset($done)) { #get & send vars foreach ($done as $key => $value) { $Sl = "UPDATE todos SET com='Yes' WHERE id='{$key}'"; $Rs = db_exec($Sl) or errDie("Unable to update database.", SELF); } } return order($_POST); }
$orderNumber = $dao->makeOrder($_GET['sID'], $_SESSION['uID']); echo 'Thanks for your booking ! . Your order number is ' . $orderNumber; } } function bookAsMember() { $userName = $_SESSION['LoginName']; $dao = new DAO(); $orderNumber = $dao->makeOrder($_GET['sID'], $dao->fetchUserIDByUserName($userName)); echo 'Thanks for your booking ! . Your order number is ' . $orderNumber; } ?> <div class="pageContent"> <div id="main"> <div class="container"> <h1>Online Cinema </h1> <h2>Enjoying the real rewards! </h2> </div> <div class="container"> <h3><a href="#">Ticket purchase </a></h3> <h2><?php order(); ?> </h2> <div class="clear"></div> </div> </div> <?php include_once 'footer.php';
function Main() { $where_list = array(); $where = ""; $query_link = "admin.php?mod=sessions"; $p = max((int) $this->Get['page'], 1); $query_link .= "&page=" . $p; $pn = $this->Get['pn'] ? (int) $this->Get['pn'] : 20; if ($pn < 1 || $pn > 500) { $pn = 20; } $query_link .= '&pn=' . $pn; $uid = 0; $nickname = get_param('nickname'); if ($nickname) { $info = jsg_member_info($nickname, '', '`uid`'); $uid = $info['uid']; } $uid = $uid ? $uid : (int) get_param('uid'); if ($uid > 0) { $where_list[] = "uid = '{$uid}'"; $query_link .= "&uid={$uid}"; } $is_member_radio = $this->jishigou_form->YesNoRadio('is_member', $this->Get['is_member']); if (isset($this->Get['is_member'])) { $is_member = (int) $this->Get['is_member']; $where_list[] = $is_member > 0 ? "uid>0" : "uid=0"; } $ip = trim($this->Get['ip']); if (!empty($ip)) { $ip_l = explode('.', $ip); $ips = ''; $i = 0; $and = ''; foreach ($ip_l as $_ip) { $i++; if ($_ip == "*" || empty($_ip)) { continue; } $ips .= $and . "ip{$i}='{$_ip}'"; $and = " and "; } $where_list[] = $ips; } if ($this->Get['order_by']) { $query_link .= "&order_by=" . $this->Get['order_by']; } if ($this->Get['order_type']) { $query_link .= "&order_type=" . $this->Get['order_type']; } $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' '; $order_by_list = array('order_by_default' => 'slastactivity', 'slastactivity' => array('name' => '最后访问时间', 'order_by' => 'slastactivity'), 'ip' => array('name' => 'IP地址', 'order_by' => "concat_ws('.',ip1,ip2,ip3,ip4)"), 'uid' => array('name' => '用户ID', 'order_by' => 'uid')); $order_array = order($order_by_list, $query_link, array('display_un_href' => true)); $order = $order_array['order']; $order_html = $order_array['html']; $limit = ""; $offset = ($p - 1) * $pn; $sql = "SELECT count(1) total from " . TABLE_PREFIX . "sessions" . $where; $query = $this->DatabaseHandler->Query($sql); $row = $query->GetRow(); $total = $row['total']; $sql = "SELECT * from " . TABLE_PREFIX . "sessions" . $where . " " . $order . " limit {$offset},{$pn}"; $query = $this->DatabaseHandler->Query($sql); $session_list = array(); $uids = array(); $ips = array(); while (false != ($row = $query->GetRow())) { $row['dateline'] = my_date_format($row['slastactivity']); $row['ip'] = sprintf("%s.%s.%s.%s", $row['ip1'], $row['ip2'], $row['ip3'], $row['ip4']); if ($row['uid'] > 0) { $uids[$row['uid']] = $row['uid']; } $ips[$row['ip']] = $row['ip']; $session_list[] = $row; } $robot = array(); if ($ips && $this->Config['robot_enable']) { $sql = "SELECT `ip`, `name` from " . TABLE_PREFIX . "robot_ip where `ip` in ('" . implode("','", $ips) . "')"; $query = $this->DatabaseHandler->Query($sql, "SKIP_ERROR"); if ($query) { while (false != ($row = $query->GetRow())) { $robot[$row['ip']] = $row['name']; } } } $users = array(); if ($uids) { $query = DB::query("select `uid`, `username`, `nickname` from " . DB::table('members') . " where `uid` in ('" . implode("','", $uids) . "')"); while (false != ($row = DB::fetch($query))) { $users[$row['uid']] = $row; } } $pages = page($total, $pn, $query_link, array(), "10 20 50 100 200"); $action = "admin.php?mod=session&code=delete"; include template('admin/sessions'); }
" /> <br/><br/><br/> <button type="submit" class="btn btn-primary">Додати</button> </div> </div> </form> <?php } ?> <?php $test_type = $data[0]['test_type']; if ($test_type == 'many') { multiple($test_type, $t_id, $question_id, $data); } elseif ($test_type == 'one') { single($test_type, $t_id, $question_id, $data); } elseif ($test_type == 'yn') { yn($test_type, 2, $t_id, $question_id, $data); } elseif ($test_type == 'text') { text($test_type, $t_id, $question_id, $data); } elseif ($test_type == 'order') { order($test_type, $t_id, $question_id, $data); } ?> <div class="col-xs-9 col-sm-8 col-md-6 col-lg-4 col-xs-offset-3 col-sm-offset-2 col-md-offset-2 col-lg-offset-2"> <a href="<?php print URL; ?> ?c=manageTests&f=create_question_hand">назад</a> </div> </div></div></div> </div> </div>
function write($_POST) { $Out = ""; #get & send vars foreach ($_POST as $key => $value) { ${$key} = $value; $Out .= "<input type=hidden name=\${$key} value='{$value}'>"; } $blength = strlen($barcodes); $start = 0; while ($start < $blength) { $value = substr($barcodes, $start, $clength); $start = $start + $clength; if (strlen($value) == $clength) { $bars[] = $value; } } # validate input require_lib("validate"); $v = new validate(); foreach ($bars as $each) { $v->isOk($each, "num", 1, $clength, "Invalid bar code."); } # display errors, if any if ($v->isError()) { $errors = ""; $Errors = $v->getErrors(); foreach ($Errors as $e) { $errors .= "<li class=err>" . $e["msg"] . "</li>"; } $errors .= "<input type=hidden name=errors value='{$errors}'>"; return read_bars($_POST, $errors); } #we can only add as many barcodes as there is stock, so find the max and reduce the array if it exceeds the max pglib_transaction("begin"); $Sl = "SELECT stkcod,stkdes,units,alloc FROM stock WHERE stkid='{$id}' AND div = '" . USER_DIV . "'"; $Rs = db_exec($Sl) or errDie("Unable to view stock"); if (pg_numrows($Rs) < 1) { return "Invalid Stock id."; } $St = pg_fetch_array($Rs); $Av = $St['units'] - $St['alloc']; $i = 0; $Sl = "SELECT code FROM ss0 WHERE stock='{$id}' AND div = '" . USER_DIV . "'"; $Rs = db_exec($Sl) or errDie("Unable to retrieve barcodes from db"); while ($Tp = pg_fetch_array($Rs)) { $i++; } $Sl = "SELECT code FROM ss1 WHERE stock='{$id}' AND div = '" . USER_DIV . "'"; $Rs = db_exec($Sl) or errDie("Unable to retrieve barcodes from db"); while ($Tp = pg_fetch_array($Rs)) { $i++; } $Sl = "SELECT code FROM ss2 WHERE stock='{$id}' AND div = '" . USER_DIV . "'"; $Rs = db_exec($Sl) or errDie("Unable to retrieve barcodes from db"); while ($Tp = pg_fetch_array($Rs)) { $i++; } $Sl = "SELECT code FROM ss3 WHERE stock='{$id}' AND div = '" . USER_DIV . "'"; $Rs = db_exec($Sl) or errDie("Unable to retrieve barcodes from db"); while ($Tp = pg_fetch_array($Rs)) { $i++; } $Sl = "SELECT code FROM ss4 WHERE stock='{$id}' AND div = '" . USER_DIV . "'"; $Rs = db_exec($Sl) or errDie("Unable to retrieve barcodes from db"); while ($Tp = pg_fetch_array($Rs)) { $i++; } $Sl = "SELECT code FROM ss5 WHERE stock='{$id}' AND div = '" . USER_DIV . "'"; $Rs = db_exec($Sl) or errDie("Unable to retrieve barcodes from db"); while ($Tp = pg_fetch_array($Rs)) { $i++; } $Sl = "SELECT code FROM ss6 WHERE stock='{$id}' AND div = '" . USER_DIV . "'"; $Rs = db_exec($Sl) or errDie("Unable to retrieve barcodes from db"); while ($Tp = pg_fetch_array($Rs)) { $i++; } $Sl = "SELECT code FROM ss7 WHERE stock='{$id}' AND div = '" . USER_DIV . "'"; $Rs = db_exec($Sl) or errDie("Unable to retrieve barcodes from db"); while ($Tp = pg_fetch_array($Rs)) { $i++; } $Sl = "SELECT code FROM ss8 WHERE stock='{$id}' AND div = '" . USER_DIV . "'"; $Rs = db_exec($Sl) or errDie("Unable to retrieve barcodes from db"); while ($Tp = pg_fetch_array($Rs)) { $i++; } $Sl = "SELECT code FROM ss9 WHERE stock='{$id}' AND div = '" . USER_DIV . "'"; $Rs = db_exec($Sl) or errDie("Unable to retrieve barcodes from db"); while ($Tp = pg_fetch_array($Rs)) { $i++; } pglib_transaction("commit"); $Wob = $Av - $i; if ($Wob > 0) { #doesnt exceed, do nothing foreach ($bars as $each) { $bars2[] = $each; } } else { $bars2 = array(); for ($count = 0; $count <= $Wob; $count++) { $bars2[] = $bars[$count]; } } db_conn("cubit"); foreach ($bars2 as $each) { switch (substr($each, strlen($each) - 1, 1)) { case "0": $tab = "ss0"; break; case "1": $tab = "ss1"; break; case "2": $tab = "ss2"; break; case "3": $tab = "ss3"; break; case "4": $tab = "ss4"; break; case "5": $tab = "ss5"; break; case "6": $tab = "ss6"; break; case "7": $tab = "ss7"; break; case "8": $tab = "ss8"; break; case "9": $tab = "ss9"; break; default: return order($_POST, "The code you selected is invalid"); } if (barext_ex($tab, 'code', $each) or strlen($each) == 0) { return read_bars($_POST, "<li class='err'>The code you selected already exits in the system.</li>"); } else { $getcheck = "SELECT * FROM " . $tab . " WHERE code = '{$me}' AND active = 'no'"; $runcheck = db_exec($getcheck) or errDie("Unable to get serial number check"); if (pg_numrows($runcheck) < 1) { $Sl = "INSERT INTO " . $tab . " (code,stock,div) VALUES ('{$each}','{$id}','" . USER_DIV . "')"; $Rs = db_exec($Sl) or errDie("Unable to update database.", SELF); } else { $arr = pg_fetch_array($runcheck); $Sl = "UPDATE " . $tab . " SET active = 'yes' WHERE code = '{$arr['code']}' AND stock = '{$arr['stock']}' AND div = '{$arr['div']}'"; $Rs = db_exec($Sl) or errDie("Unable to update database.", SELF); } } } #print and reload parent window return "All Possible RFID Barcodes Have Been Imported<br><br\n\t\t<input type='button' onClick='javascript:window.close();' value='Close'>\n\t\t<script>\n\t\t\topener.document.formName.submit()\n\t\t</script>"; }
for ($i = 1; $i < count($locales); $i++) { if ($locales[$i] != '') { $query .= " OR (`skill_name` = '" . $roster->locale->act['sill'] . "') "; } } $query .= "ORDER BY recipe_type, `reagents`,`recipe_name` "; $result = $roster->db->query($query) or die_quietly($roster->db->error(), 'Database Error', basename(__FILE__), __LINE__, $query); $count = 0; $temp = array(); while ($row = $roster->db->fetch($result)) { $temp[$count] = $row; $count++; } return $temp; } $header_title = $roster->locale->act['glyph_title_addon']; //check for available clientLocales $clientLocales = array(); $clquery = "SELECT DISTINCT p.clientLocale FROM `" . $roster->db->table('players') . "` p;"; $clresult = $roster->db->query($clquery) or die_quietly($roster->db->error(), 'Database Error', basename(__FILE__), __LINE__, $clquery); $i = 0; while ($clrow = $roster->db->fetch($clresult)) { $clientLocales[$i] = $clrow['clientLocale']; $i++; } if ($i == 0) { $clientLocales[$i] = $roster->locale->act['roster_lang']; } $tmpglyphes = glyphlookup($clientLocales); $glyphes = order($tmpglyphes); Glyphs_display();
require_once '../classes/Item.php'; require_once '../classes/Restaurant.php'; require_once '../classes/Order.php'; $session = new Session(); if (!$session->getLoggedin()) { setStatus($out, 'fail', 'Login required.'); } $user = User::find($session->getUsername()); $data = file_get_contents("php://input"); $data = json_decode($data, TRUE); $out = []; if (isset($data['post'])) { $type = $data['post']; switch ($type) { case 'order': $out = order($data); break; break; default: setStatus($out, 'fail', 'invalid type.'); break; } } else { //get request if (isset($_GET['query'])) { $type = $_GET['query']; switch ($type) { case 'menu': $out = menu(); break; default:
$res = SQL_Query_exec("SELECT COUNT(*) FROM messages WHERE `receiver` = " . $CURUSER["id"] . " AND `location` IN ('in','both') AND `unread` = 'yes'"); $unread = mysql_result($res, 0); $res = SQL_Query_exec("SELECT COUNT(*) FROM messages WHERE `sender` = " . $CURUSER["id"] . " AND `location` IN ('out','both')"); $outbox = mysql_result($res, 0); $res = SQL_Query_exec("SELECT COUNT(*) FROM messages WHERE `sender` = " . $CURUSER["id"] . " AND `location` = 'draft'"); $draft = mysql_result($res, 0); $res = SQL_Query_exec("SELECT COUNT(*) FROM messages WHERE `sender` = " . $CURUSER["id"] . " AND `location` = 'template'"); $template = mysql_result($res, 0); tr2('<a href="mailbox.php?inbox">' . T_("INBOX") . ' </a> ', " {$inbox} " . P_("message", $inbox) . " ({$unread} " . T_("unread") . ")"); tr2('<a href="mailbox.php?outbox">' . T_("OUTBOX") . ' </a> ', " {$outbox} " . P_("message", $outbox)); tr2('<a href="mailbox.php?draft">' . T_("DRAFT") . ' </a> ', " {$draft} " . P_("message", $draft)); tr2('<a href="mailbox.php?templates">' . T_("TEMPLATES") . ' </a> ', " {$template} " . P_("message", $template)); end_table(); echo "<br /><br />"; } elseif ($type == "Mail") { $order = order("added,sender,sendto,subject", "added", true); $res = SQL_Query_exec("SELECT COUNT(*) FROM messages WHERE {$where}"); $count = mysql_result($res, 0); list($pagertop, $pagerbottom, $limit) = pager2(20, $count); print $pagertop; begin_form(); begin_table(0, "list"); $table[' '] = th("<input type=\"checkbox\" onclick=\"toggleChecked(this.checked);this.form.remove.disabled=true;\" />", 1); $table['Sender'] = th_left("Sender", 'sender'); $table['Sent_to'] = th_left("Sent To", 'receiver'); $table['Subject'] = th_left("Subject", 'subject'); $table['Date'] = th_left("Date", 'added'); table($table, $tablefmt); $res = SQL_Query_exec("SELECT * FROM messages WHERE {$where} {$order} {$limit}"); while ($arr = mysql_fetch_assoc($res)) { unset($table);
function DoSearch() { $sql = "select * from `" . TABLE_PREFIX . "medal` "; $query = $this->DatabaseHandler->Query($sql); $medal = array(); while (false != ($rs = $query->GetRow())) { $medal[$rs['id']] = $rs['medal_name']; } $credit_search_list = array(); if ($this->Config['extcredits_enable']) { foreach ($this->Config['credits']['ext'] as $key => $val) { $credit_search_list["l[{$key}]"] = array('name' => "lower[{$key}]", 'describe' => "{$val[name]} 低于"); $credit_search_list["h[{$key}]"] = array('name' => "higher[{$key}]", 'describe' => "{$val[name]} 高于"); } } $where_list = array(); if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $this->Config['company_enable']) { $companyid = (int) get_param('companyid'); if ($companyid > 0) { $where_list['companyid'] = " m.companyid = '{$companyid}'"; $cp_user_ids = $this->CpLogic->get_cp_user_uids($companyid); } $jobid = (int) get_param('jobid'); if ($jobid > 0) { $where_list['jobid'] = " m.jobid = '{$jobid}'"; } if ($this->Config['department_enable']) { $departmentid = (int) get_param('departmentid'); if ($departmentid > 0) { $where_list['departmentid'] = " m.departmentid = '{$departmentid}'"; $cp_user_ids = $this->CpLogic->get_cp_user_uids($departmentid, 'department'); } } } $uid = (int) get_param('uid'); if ($uid) { $where_list['uid'] = " m.uid = '{$uid}'"; } $nickname = get_param('nickname'); if ($nickname != '') { $where_list['nickname'] = build_like_query('m.nickname', $nickname); } $username = get_param('username'); if ($username != '') { $where_list['username'] = build_like_query('m.username', $username); } $email = get_param('email'); if ($email != '') { $where_list['email'] = build_like_query('m.email', $email); } $regip = get_param('regip'); if ($regip != '') { $where_list['regip'] = " m.regip like '{$regip}%' "; } $lastip = get_param('lastip'); if ($lastip != '') { $where_list['lastip'] = " m.lastip like '{$lastip}%' "; } $invite_uid = max(0, (int) get_param('invite_uid')); $invite_nickname = get_param('invite_nickname'); if ('' != $invite_nickname) { $invite_uid = DB::result_first("select `uid` from `" . TABLE_PREFIX . "members` where `nickname`='{$invite_nickname}'"); } if ($invite_uid > 0) { $where_list['invite_uid'] = "`invite_uid`='{$invite_uid}'"; } $role_id = get_param('role_id'); $role_ids = get_param('role_ids'); if (is_array($role_id) and count($role_id)) { if ($role_id[0] != 'all') { $where_list['role_id'] = " `role_id` IN (" . jimplode($role_id) . ") "; $_GET['role_ids'] = implode(",", $role_id); } else { unset($where_list['role_id']); } } elseif (is_string($role_ids) and $role_ids) { $where_list['role_id'] = " m.role_id in({$role_ids})"; } $order_arr = array(); $lower = get_param('lower'); if (is_array($lower)) { foreach ($lower as $field => $val) { if ($val != '') { $where_list[$field . '_lower'] = " m.{$field}<=" . (int) $val; $list["l[{$field}]"] = $val; $order_arr[$field] = ' m.' . $field . ' desc '; } } } $higher = get_param('higher'); if (is_array($higher)) { foreach ($higher as $field => $val) { if ($val != '') { $where_list[$field . '_higher'] = " m.{$field}>=" . (int) $val; $list["h[{$field}]"] = $val; $order_arr[$field] = ' m.' . $field . ' desc '; } } } $earned = get_param('earned'); if ($earned) { $medal_arr[$earned] = " selected "; $medal_where = " LEFT JOIN " . TABLE_PREFIX . "user_medal um ON um.uid = m.uid and um.medalid = '{$earned}' "; $select_sql = " ,um.dateline "; $where_list['earned'] = " um.`dateline` IS NULL "; } $sql = "\r\n\t\t SELECT\r\n\t\t\t id,name,`type`\r\n\t\t FROM\r\n\t\t\t " . TABLE_PREFIX . 'role' . "\r\n\t\t WHERE\r\n\t\t\t id>1"; $query = $this->DatabaseHandler->Query($sql); while (false != ($row = $query->GetRow())) { $role_list[$row['id']] = $row; } $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' '; if ($where && $cp_user_ids) { $where .= ' OR uid IN(' . jimplode($cp_user_ids) . ') '; } $order_by_list = array('order_by_default' => 'uid', 'uid' => array('name' => '最新注册', 'order_by' => 'm.`uid`'), 'lastactivity' => array('name' => '最近活跃', 'order_by' => 'm.`lastactivity`'), 'credits' => array('name' => '最多积分', 'order_by' => 'm.`credits`')); $query_link = 'admin.php?' . ((is_array($_POST) and count($_POST)) ? http_build_query(array_merge($_GET, $_POST)) : $_SERVER['QUERY_STRING']); $order_arr = order($order_by_list, $query_link); $order_html = $order_arr['html']; $query_link = $order_arr['query_link']; $order = $order_arr['order']; $sql = "\r\n\t\t SELECT\r\n\t\t\t count(1) total\r\n\t\t FROM\r\n\t\t\t " . TABLE_PREFIX . 'members' . " m\r\n\t\t\t {$medal_where}\r\n\t\t\t {$where}"; $total = DB::result_first($sql); $page_num = 20; $pages = page($total, $page_num, $query_link, array('return' => 'array')); $limit = $pages['limit']; $sql = "\r\n\t\t SELECT\r\n\t\t\t m.* {$select_sql}\r\n\t\t FROM\r\n\r\n\t\t\t " . TABLE_PREFIX . 'members' . " m\r\n\t\t\t {$medal_where}\r\n\t\t\t {$where}\r\n\t\t\t {$order}\r\n\t\t\t {$limit}"; $query = $this->DatabaseHandler->Query($sql); $uids = array(); $invite_uids = array(); while (false != ($row = $query->GetRow())) { $uids[$row['uid']] = $row['uid']; if ($row['invite_uid'] > 0) { $invite_uids[$row['invite_uid']] = $row['invite_uid']; } if ($this->Config['credits']['ext']) { $credit_list = array(); $row['totle_credit'] = 0; foreach ($this->Config['credits']['ext'] as $key => $val) { $credit_list[] = array('credit' => $row[$key], 'name' => "{$val['name']}"); $row['totle_credit'] = $row['totle_credit'] + $row[$key]; } $row['credit'] = $credit_list; } $role = $role_list[$row['role_id']]; if ($role != false) { if ($role['is_system'] == 1) { $row['role_name'] = "<B>{$role['name']}</B>"; } else { $row['role_name'] = $role['name']; } } $member_list[$row['uid']] = $row; } $sql = "\r\n\t\t SELECT\r\n\t\t\t `uid`,`validate_remark`\r\n\t\t FROM\r\n\t\t\t " . TABLE_PREFIX . 'memberfields' . "\r\n\t\t WHERE\r\n\t\t\t `uid` in ('" . implode("','", $uids) . "') "; $query = $this->DatabaseHandler->Query($sql); $memberfields = array(); while (false != ($row = $query->GetRow())) { $member_list[$row['uid']]['validate_remark'] = $row['validate_remark']; $memberfields[$row['uid']] = $row; } if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $this->Config['company_enable']) { $companyselect = $this->CpLogic->get_cp_html($companyid); if ($this->Config['department_enable']) { $departmentselect = $this->CpLogic->get_cp_html($departmentid, 'department', $companyid); } $jobselect = jlogic('job')->get_job_select($jobid); } if ($invite_uids && is_array($invite_uids)) { $sql = "select `uid`, `nickname`, `username` from `" . TABLE_PREFIX . "members` where `uid` in (" . jimplode($invite_uids) . ") limit " . count($invite_uids); $query = $this->DatabaseHandler->Query($sql); $invite_members = array(); while (false != ($row = $query->GetRow())) { $invite_members[$row['uid']] = $row; } } $action = 'admin.php?mod=member&code=doact'; include template('admin/member_search_list'); }