示例#1
0
$limit = "LIMIT {$start}, {$rp}";
$where = "";
if ($query) {
    $where = " WHERE {$qtype} LIKE '%{$query}%' ";
}
// for filter firstname by letter
if (isset($_POST['letter_pressed']) && $_POST['letter_pressed'] != '') {
    if ($_POST['letter_pressed'] != 'All') {
        if (trim($where) == '') {
            $where = " WHERE firstname LIKE '" . $_POST['letter_pressed'] . "%' ";
        }
        $where .= " AND firstname LIKE '" . $_POST['letter_pressed'] . "%' ";
    }
}
$sql = "SELECT * FROM phonebook {$where} {$sort} {$limit}";
$data = runSQL($sql);
$total = countRec("id", "phonebook {$where}");
header("Content-type: application/json");
$jsonData = array('page' => $page, 'total' => $total, 'rows' => array());
$index = 1;
foreach ($data as $row) {
    //If cell's elements have named keys, they must match column names
    //Only cell's with named keys and matching columns are order independent.
    $ext = !isset($row['extension']) || $row['extension'] == '' ? '' : '<a href="javascript:void(0)" onclick="make_call(\'' . $row['extension'] . '\')"' . ">\n    <img src='modules/agent_console/images/call.png' title='Gọi số " . $row['extension'] . "'/></a> " . $row['extension'];
    $mob = !isset($row['mobile']) || $row['mobile'] == '' ? '' : '<a href="javascript:void(0)" onclick="make_call(\'' . $row['mobile'] . '\')"' . ">\n    <img src='modules/agent_console/images/call.png' title='Gọi số " . $row['mobile'] . "'/></a> " . $row['mobile'];
    $com_mob = !isset($row['company_mobile']) || $row['company_mobile'] == '' ? '' : '<a href="javascript:void(0)" onclick="make_call(\'' . $row['company_mobile'] . '\')"' . ">\n    <img src='modules/agent_console/images/call.png' title='Gọi số " . $row['mobile'] . "'/></a> " . $row['company_mobile'];
    $entry = array('id' => $row['id'], 'cell' => array('stt' => $index, 'firstname' => $row['firstname'], 'lastname' => $row['lastname'], 'company_mobile' => $com_mob, 'mobile' => $mob, 'extension' => $ext, 'email' => '<a title="Gửi mail đến hộp mail này" href="mailto:' . $row['email'] . '?Subject=[CallCenter]" target="_top">' . $row['email'] . '</a>', 'note' => $row['note'], 'department' => $row['department']));
    $index++;
    $jsonData['rows'][] = $entry;
}
echo $json->encode($jsonData);
示例#2
0
}
if (!$sortorder) {
    $sortorder = 'desc';
}
$sort = "ORDER BY {$sortname} {$sortorder}";
if (!$page) {
    $page = 1;
}
if (!$rp) {
    $rp = 10;
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
$sql = "SELECT iso,name,printable_name,iso3,numcode FROM country {$sort} {$limit}";
$result = runSQL($sql);
$total = countRec('iso', 'country');
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: text/xml");
$xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$xml .= "<rows>";
$xml .= "<page>{$page}</page>";
$xml .= "<total>{$total}</total>";
while ($row = mysql_fetch_array($result)) {
    $xml .= "<row id='" . $row['iso'] . "'>";
    $xml .= "<cell><![CDATA[" . $row['iso'] . "]]></cell>";
    $xml .= "<cell><![CDATA[" . utf8_encode($row['name']) . "]]></cell>";
    //$xml .= "<cell><![CDATA[".print_r($_POST,true)."]]></cell>";
    $xml .= "<cell><![CDATA[" . utf8_encode($row['printable_name']) . "]]></cell>";
}
if (!$rp) {
    $rp = 10;
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
$query = $_POST['query'];
$qtype = $_POST['qtype'];
$where = "";
if ($query) {
    $where = " WHERE {$qtype} LIKE '%{$query}%' ";
}
global $database;
$sql = "SELECT top_id,top_title,sub_id FROM topics {$where} {$sort} {$limit}";
$result = $database->query($sql);
$total = countRec("top_id", "topics {$where}");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: text/x-json");
$json = "";
$json .= "{\n";
$json .= "page: {$page},\n";
$json .= "total: {$total},\n";
$json .= "rows: [";
$rc = false;
while ($row = mysql_fetch_array($result)) {
    if ($rc) {
        $json .= ",";
    }
示例#4
0
    if ($query) {
        $where = " WHERE {$qtype} LIKE '%{$query}%' ";
    }
}
if (isset($_POST['letter_pressed']) && $_POST['letter_pressed'] != '') {
    if ($_POST['letter_pressed'] != 'All') {
        if (trim($where) == '') {
            $where = " WHERE SUBSTRING_INDEX(customer_name,' ',-1) LIKE '" . $_POST['letter_pressed'] . "%' ";
        }
        $where .= " AND SUBSTRING_INDEX(customer_name,' ',-1) LIKE '" . $_POST['letter_pressed'] . "%' ";
    }
}
$sql = "SELECT a.id, a.customer_name, a.customer_phone, a.purchase_date, b.name as agent, a.status,\n        a.pay_amount, c.name as delivery_man, a.delivery_date, a.collection_date, a.isActive\n        FROM ticket_delivery a LEFT JOIN agent b ON a.agent_id = b.id\n        LEFT JOIN ticket_delivery_user c on a.user_id = c.id\n        {$where} {$sort} {$limit}";
$data = runSQL($sql);
//var_dump($sql);
$total = countRec("a.id", $where);
$jsonData = array('page' => $page, 'total' => $total, 'rows' => array());
foreach ($data as $row) {
    //If cell's elements have named keys, they must match column names
    //Only cell's with named keys and matching columns are order independent.
    $ticket_id = $row['id'];
    $codes = runSQL("SELECT ticket_code FROM ticket_delivery_code WHERE ticket_id='{$ticket_id}'");
    $code_list = '';
    foreach ($codes as $code) {
        $code_list .= $code['ticket_code'] . '<br/>';
    }
    $phone = '<a href="javascript:void(0)" onclick="make_call(\'' . $row['customer_phone'] . '\')"' . ">\n        <img border=0 src='modules/agent_console/images/call.png' \n\t\ttitle='Gọi số " . $row['customer_phone'] . "'/></a> " . $row['customer_phone'];
    // status "Da Huy"
    if ($row['isActive'] == '0') {
        $row['status'] = 'Đã hủy';
    }
if ($page == 1) {
    $start = $page;
    $end = $rp;
} else {
    $start = ($page - 1) * $rp + 1;
    $end = $page * $rp;
}
$limit = "ROWS {$start} to {$end} ";
$where = "";
if ($query) {
    $where = " WHERE {$qtype} CONTAINING '" . $query . "' ";
}
$sql = "SELECT * FROM SEL_USUARIOS_EMPRESA_GRID(" . $params . "," . $params2 . ") {$where} {$sort} {$limit}";
//echo $sql."</br>";
$result = runSQL($sql);
$total = countRec('IDUSUARIO', 'SEL_USUARIOS_EMPRESA_GRID(' . $params . ',' . $params2 . ')');
$objJson = new Json();
$valorArray = $objJson->objectToArray($result);
$total = $objJson->objectToArray($total);
$total = $total[0]['COUNT'];
//header("Content-type: application/json");
$jsonData = array('page' => $page, 'total' => $total, 'rows' => array());
foreach ($valorArray as $row) {
    if ($row['ATIVO'] == 1) {
        $row['ATIVO'] = 'Sim';
    } else {
        $row['ATIVO'] = 'Não';
    }
    $entry = array('counter' => $row['IDUSUARIO'], 'cell' => array('IDUSUARIO' => $row['IDUSUARIO'], 'NOME' => strtoupper($row['NOME']), 'CODIGO' => $row['CODIGO'], 'IDIDIOMA' => $row['IDIDIOMA'], 'IDIOMA' => $row['IDIOMA'], 'LOGIN' => $row['LOGIN'], 'ATIVO' => $row['ATIVO'], 'TELEFONE' => $row['TELEFONE'], 'IDPERFIL' => $row['IDPERFIL'], 'PERFIL' => $row['PERFIL'], 'OBSERVACAO' => $row['OBSERVACAO']));
    $jsonData['rows'][] = $entry;
}
if (!$sortname) {
    $sortname = 'id';
}
if (!$sortorder) {
    $sortorder = 'desc';
}
$sort = "ORDER BY {$sortname} {$sortorder}";
if (!$page) {
    $page = 1;
}
if (!$rp) {
    $rp = 10;
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
$total = countRec();
for ($i = 1; $i <= get_option('cforms_formcount'); $i++) {
    $n = $i == 1 ? '' : $i;
    $fnames[$i] = stripslashes(get_option('cforms' . $n . '_fname'));
}
$sql = "SELECT * FROM {$wpdb->cformssubmissions} {$where} {$sort} {$limit}";
$result = $wpdb->get_results($sql);
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: text/xml");
$xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$xml .= "<rows>";
$xml .= "<page>{$page}</page>";
$xml .= "<total>{$total}</total>";
    $page = 1;
}
if (!$rp) {
    $rp = 10;
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
$query = $_POST['query'];
$qtype = $_POST['qtype'];
$where = "";
if ($query) {
    $where = " WHERE {$qtype} LIKE '%{$query}%' ";
}
$sql = "SELECT q_id,q_text,q_op1,q_op2,q_op3,q_op4,q_ans,top_id FROM questions {$where} {$sort} {$limit}";
$result = $database->query($sql);
$total = countRec("q_id", "questions {$where}");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: text/x-json");
$json = "";
$json .= "{\n";
$json .= "page: {$page},\n";
$json .= "total: {$total},\n";
$json .= "rows: [";
$rc = false;
while ($row = mysql_fetch_array($result)) {
    if ($rc) {
        $json .= ",";
    }
示例#8
0
<?php

header("Content-type: text/html; charset=ISO-8859-1");
require_once 'include/inc_db.php';
require_once 'control_login.php';
$sql = 'select * from quizzes where id = ' . $_POST['id'];
$rs_result = execute($sql);
$rs = mysql_fetch_array($rs_result);
$question_num = countRec('id', 'questions', 'where id_quiz =' . $_POST['id']);
?>
<div class="obj_title"><img src="ico.png" alt="" style="margin-right:5px;vertical-align:middle" />EDIT QUIZ</div>
<div class="buttons_barr">
  <span class="back_list"><img src="<?php 
echo path_img;
?>
/back.png" alt=""/>Return To List</span>
  <span class="add_new_item"><img src="<?php 
echo path_img;
?>
/add.png" alt=""/>New Quiz</span>
</div>
<!-- end of buttons bar -->
<script type="text/javascript">
jQuery(function($){
<?php 
if ($question_num == 1) {
    ?>
$('.delete_input:first').css('display','none');
<?php 
} else {
    ?>
示例#9
0
    $page = 1;
}
if (!$rp) {
    $rp = 10;
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
$query = $_POST['query'];
$qtype = $_POST['qtype'];
$where = "";
if ($query) {
    $where = " WHERE {$qtype} LIKE '%{$query}%' ";
}
$sql = "SELECT iso,name,printable_name,iso3,numcode FROM country {$where} {$sort} {$limit}";
$result = runSQL($sql);
$total = countRec("iso", "country {$where}");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: text/x-json");
$json = "";
$json .= "{\n";
$json .= "page: {$page},\n";
$json .= "total: {$total},\n";
$json .= "rows: [";
$rc = false;
while ($row = mysql_fetch_array($result)) {
    if ($rc) {
        $json .= ",";
    }
}
if (!$rp) {
    $rp = 10;
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
$query = $_POST['query'];
$qtype = $_POST['qtype'];
$where = "";
if ($query) {
    $where = " WHERE {$qtype} LIKE '%{$query}%' ";
}
global $database;
$sql = "SELECT username,userlevel,email,timestamp,branch_id FROM users {$where} {$sort} {$limit}";
$result = $database->query($sql);
$total = countRec("username", "users {$where}");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: text/x-json");
$json = "";
$json .= "{\n";
$json .= "page: {$page},\n";
$json .= "total: {$total},\n";
$json .= "rows: [";
$rc = false;
while ($row = mysql_fetch_array($result)) {
    if ($rc) {
        $json .= ",";
    }
    $page = 1;
}
if (!$rp) {
    $rp = 10;
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
$query = $_POST['query'];
$qtype = $_POST['qtype'];
$where = "";
if ($query) {
    $where = " WHERE {$qtype} LIKE '%{$query}%' ";
}
$sql = "SELECT sub_id,sub_title,bran_id FROM subjects {$where} {$sort} {$limit}";
$result = $database->query($sql);
$total = countRec("sub_id", "subjects {$where}");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: text/x-json");
$json = "";
$json .= "{\n";
$json .= "page: {$page},\n";
$json .= "total: {$total},\n";
$json .= "rows: [";
$rc = false;
while ($row = mysql_fetch_array($result)) {
    if ($rc) {
        $json .= ",";
    }
示例#12
0
文件: post.php 项目: chaobj001/tt
}
if (!$sortorder) {
    $sortorder = 'desc';
}
$sort = "ORDER BY {$sortname} {$sortorder}";
if (!$page) {
    $page = 1;
}
if (!$rp) {
    $rp = 10;
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
$sql = "SELECT id,qq_group,name,qq,sex,tel FROM cssrain {$sort} {$limit}";
$result = runSQL($sql);
$total = countRec('id', 'cssrain');
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: text/x-json");
$json = "";
$json .= "{\n";
$json .= "page: {$page},\n";
$json .= "total: {$total},\n";
$json .= "rows: [";
$rc = false;
while ($row = mysql_fetch_array($result)) {
    if ($rc) {
        $json .= ",";
    }
示例#13
0
    $pag = 1;
}
$limit_end = $counter;
$limit_start = ($pag - 1) * $limit_end;
if ($sqlsearch_or != '') {
    $sqlsearch = $sqlsearch . '(' . $sqlsearch_or;
}
if ($sqlsearch != '') {
    if ($sqlsearch_or != '') {
        $sqlsearch = ' Where ' . substr($sqlsearch, 0, strlen($sqlsearch) - 4) . ')' . $additional_where;
    } else {
        $sqlsearch = ' Where ' . substr($sqlsearch, 0, strlen($sqlsearch) - 5) . $additional_where;
    }
    $quanti = countRec('id', $table, $sqlsearch);
} else {
    $quanti = countRec('id', $table, $additional_where_nosearch);
}
if ($sqlsearch != '') {
    $sql = ' select * from ' . $table . ' ' . $sqlsearch . ' order by ' . $order_record . ' ' . $order_verse . '  LIMIT ' . $limit_start . ', ' . $limit_end;
} else {
    $sql = 'select * from ' . $table . $additional_where_nosearch . ' order by ' . $order_record . ' ' . $order_verse . '  LIMIT ' . $limit_start . ', ' . $limit_end;
}
$rs_result = execute($sql);
$result = "{";
$result .= "\"page\":{$pag},";
$result .= "\"total\":{$quanti}";
if ($quanti > 0) {
    $result .= ",\"rows\":[";
    while ($rs = mysql_fetch_array($rs_result)) {
        $img_del = '<img id="' . $rs['id'] . '" src="' . path_img . '/del.png" style="cursor:pointer;margin-right:5px" alt="" class="delete" title="Delete" />';
        $img_get_code = '<img id="' . $rs['id'] . '" rel="' . path_stored_quizzes . '/' . $rs['id'] . '/' . $rs['code'] . '.php" src="' . path_img . '/code.png" style="cursor:pointer;margin-right:5px" alt="" class="getcode" title="Get ShortCode to include this quiz in your pages" />';
}
if (!$rp) {
    $rp = 10;
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
$query = $_REQUEST['q'];
$qtype = $_REQUEST['qtype'];
$where = "";
if ($query) {
    $where = " WHERE {$qtype} LIKE '%{$query}%' ";
}
global $database;
$sql = "SELECT bran_id,bran_name FROM branch {$where} {$sort} {$limit}";
$result = $database->query($sql);
$total = countRec("bran_id", "branch {$where}");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: text/x-json");
$json = "";
$json .= "{\n";
$json .= "page: {$page},\n";
$json .= "total: {$total},\n";
$json .= "rows: [";
$rc = false;
while ($row = mysql_fetch_array($result)) {
    if ($rc) {
        $json .= ",";
    }