/** * 获取一道测试题目和题目选项 * * @param integer $offset; * return array; */ function get_test_one($offset) { $tc_id = get_tcid($offset); $count = get_count($tc_id); $num = get_total($tc_id); $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}test_question WHERE `tc_id`='{$tc_id}' \n\t\tLIMIT {$num},1"; echo $sql, '<br>'; $question = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true); $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}test_question_option WHERE `qid`='{$question['qid']}'"; //echo $sql,'<br>'; $option = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql); $temp = array(); $temp['tc_id'] = $tc_id; $temp['count'] = $count; $temp['num'] = $num; $temp['question'] = $question; $temp['option'] = $option; return $temp; }
} // end of if for Postgraduate ?> <?php /*End of Post-Graduate Summary*/ echo '<div class="span5">'; if ($total_applicant > 0) { echo '<h4 align="center">Admission Status <span class="badge badge-success">' . $total_applicant . '</span></h4>'; } else { echo '<h4 align="center">Admission Status <span class="badge badge-Important">' . $total_applicant . '</span></h4>'; } $Pending_applicants = get_total(1); $ineligible_applicants = get_total(2); $Eligible_applicants = get_total(3); $rejected_applicants = get_total(4); $accepted_applicants = get_total(5); ?> <table class="table table-bordered table-hover"> <thead> <tr> <th>Status</th> <th width="10%">Total</th> </tr> </thead> <tbody> <tr> <td>Pending</td> <td width="10%"><?php if (isset($Pending_applicants)) { echo $Pending_applicants; }
//title website ================================================================ $title = CONTACT_TITLE_INDEX; //paging ======================================================================= if (isset($_GET['page'])) { $page = intval($_GET['page']); } else { $page = 1; } $page = $page > 0 ? $page : 1; $limit = 10; $offset = ($page - 1) * $limit; $options = array('limit' => $limit, 'offset' => $offset, 'order_by' => 'id ASC'); //data of paging =============================================================== //Search data ================================================================== $url = 'admin.php?controller=contact'; if (isset($_POST['search'])) { header('location:admin.php?controller=contact&search=' . $_POST['search']); } if (isset($_GET['search'])) { $search = escape($_GET['search']); $options['where'] = "LOWER(contact.NAME) LIKE LOWER('%{$search}%') "; $url = 'admin.php?controller=contact&search=' . $_GET['search']; } $total_rows = get_total('contact', $options); $total = ceil($total_rows / $limit); $pagination = pagination($url, $page, $total); //data show ==================================================================== $status = array(0 => CONTACT_STATUS_WAIT, 1 => CONTACT_STATUS_RESPONE); $contacts = get_all('contact', $options); //load view ==================================================================== require 'backend/views/contact/index.php';
function get_counts(&$hash) { $counts['unique'] = get_unique($hash); $counts['total'] = get_total($hash); $counts['hapax'] = get_hapax($hash); return $counts; }
function add_cart_to_session($cart_item) { $order_details = array(); $order = get_order_array(); $cart = get_cart_array(); $temp = (array) $_SESSION[session_id()]; if (!(is_array($temp) && ($temp['order'] && $temp['order_details']))) { $order_details[] = $cart_item; } else { $order_details = $temp['order_details']; $order_details[] = $cart_item; $order = $temp['order']; } $order['total'] = get_total($order_details); $cart['order'] = $order; $cart['order_details'] = $order_details; $_SESSION[session_id()] = $cart; if ($_SESSION[session_id()]) { return true; } else { return false; } }
function lxguard_main($clearflag = false) { include_once "htmllib/lib/lxguardincludelib.php"; lxfile_mkdir("__path_home_root/lxguard"); $lxgpath = "__path_home_root/lxguard"; $file = "/var/log/secure"; $fp = fopen($file, "r"); $fsize = filesize($file); $newtime = time(); $oldtime = time() - 60 * 10; $rmt = lfile_get_unserialize("{$lxgpath}/hitlist.info"); if ($rmt) { $oldtime = max((int) $oldtime, (int) $rmt->ddate); } $ret = FindRightPosition($fp, $fsize, $oldtime, $newtime, "getTimeFromSysLogString"); $list = lfile_get_unserialize("{$lxgpath}/access.info"); if ($ret) { parse_sshd_and_ftpd($fp, $list); lfile_put_serialize("{$lxgpath}/access.info", $list); } get_total($list, $total); //dprintr($list['192.168.1.11']); dprintr($total); $deny = get_deny_list($total); $hdn = lfile_get_unserialize("{$lxgpath}/hostdeny.info"); $deny = lx_array_merge(array($deny, $hdn)); $string = null; foreach ($deny as $k => $v) { if (csb($k, "127")) { continue; } $string .= "ALL : {$k}\n"; } dprint($string); $stlist[] = "###Start Program Hostdeny config Area"; $stlist[] = "###Start Lxdmin Area"; $stlist[] = "###Start Kloxo Area"; $stlist[] = "###Start Lxadmin Area"; $endlist[] = "###End Program HostDeny config Area"; $endlist[] = "###End Kloxo Area"; $endlist[] = "###End Lxadmin Area"; $startstring = $stlist[0]; $endstring = $endlist[0]; file_put_between_comments($stlist, $endlist, $startstring, $endstring, "/etc/hosts.deny", $string); if ($clearflag) { lxfile_rm("{$lxgpath}/access.info"); $rmt = new Remote(); $rmt->hl = $total; $rmt->ddate = time(); lfile_put_serialize("{$lxgpath}/hitlist.info", $rmt); } return $list; }
<td><b>Descripcion</b></td> <td align='center'><b>Total de Incidencias</b></td> <td align='center'><b>Pendientes</b></td> <td><b>Acciones</b></td> </thead> </tr> <?php foreach ($get_incidencias as $incidencia): ?> <tr> <?php $atributo_boton_modificar = array('class' => 'btn btn-cm-linkedin btn-xs glyphicon glyphicon-pencil'); $atributo_boton_eliminar = array('class' => 'btn btn-danger glyphicon glyphicon-remove', 'onclick' => "javascript:return confirm('Seguro que desea eliminar este dato?')"); ?> <td><?php echo $incidencia->adscripcion;?></td> <td><?php echo $incidencia->descripcion;?></td> <td align='center'><span class="badge badge-cm-linkedin"><?php echo get_total($incidencia->qna_id,$incidencia->adscripcion_id);?></span></td> <td align='center'><span class="badge badge-cm-linkedin"><?php echo get_total_pendientes($incidencia->qna_id,$incidencia->adscripcion_id);?></span></td> <td> <?php echo anchor('admin/capturar_all_centro/'.$incidencia->qna_id.'/'.$incidencia->adscripcion_id,' ',$atributo_boton_modificar);?> </td> </tr> <?php endforeach;?> </table> <?php echo anchor('admin/capturar', '<i class="fa fa-chevron-circle-left fa-2x"></i>'); ?>
$total = $row['count']; return $total; } if (isset($_POST['submit'])) { $keywords = $_POST['keywords']; } if (isset($_GET['keywords'])) { $keywords = $_GET['keywords']; } $user_id = $_SESSION[id]; // Calculate pagination information $cur_page = isset($_GET['page']) ? $_GET['page'] : 1; $results_per_page = 10; // number of results per page $skip = ($cur_page - 1) * $results_per_page; $total = get_total($keywords, $user_id, $dbc); $num_pages = ceil($total / $results_per_page); if (isset($_GET['deleted_file'])) { $deleted_file = get_title_by_id($dbc, $_GET['deleted_file']); delete_resource($dbc, $db_name, $_GET['deleted_file']); //echo '<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">×</button>'; //echo '文献"' . $deleted_file . '"已被删除!</div>'; render_success('文献"' . $deleted_file . '"已被删除!'); } ?> <p></p> <div class="container"> <?php include_once 'resource_header.php'; ?> <table class="table table-hover">
private function write_csv(&$hash, $end, $style = null) { $DELIM = "\t"; //$file = $this->folder . "/$style/csv/" . $this->id . "_$end.csv"; $file = $this->folder . "/tsv/" . $this->id . "_{$end}.tsv"; $total = get_total($hash); $unique = get_unique($hash); $hapax = get_hapax($hash); hash_sort($hash, 'c'); $csvarr = array(); // start the csv $csvarr[] = array($this->id . "_{$end}.txt", $total, $unique, $hapax); $csvarr[] = array("RANK", "WORD", "COUNT", "RELATIVE FREQUENCY"); $rank = 0; $allrank = 1; $prevcount = null; // iterate through the list of word printing them out foreach ($hash as $word => $count) { $prop = round($count / $total, 10); if ($count != $prevcount) { $rank = $allrank; } $prevcount = $count; $allrank++; // update csv $csvarr[] = array($rank, utf8_decode($word), $count, $prop); } // write out file $FH = fopen($file, 'w'); if (!$FH) { return "Could not open file '{$file}' in mode 'c+'."; } foreach ($csvarr as $line) { if (!fputcsv($FH, $line, "{$DELIM}")) { return "Could not write " . implode(",", $line) . " to file '{$file}'."; } } fclose($FH); return null; }
} if (isset($_POST['pid'])) { foreach ($_POST['pid'] as $pid) { $pid = intval($pid); products_delete($pid); } } if (isset($_GET['page'])) { $page = intval($_GET['page']); } else { $page = 1; } $page = $page > 0 ? $page : 1; $limit = 10; $offset = ($page - 1) * $limit; $options = array('limit' => $limit, 'offset' => $offset, 'order_by' => 'id DESC'); $url = 'admin.php?controller=product'; if (isset($_GET['search'])) { $search = escape($_GET['search']); $options['where'] = "name LIKE '%{$search}%'"; $url = 'admin.php?controller=product&search=' . $_GET['search']; } $total_rows = get_total('products', $options); $total = ceil($total_rows / $limit); //data $title = 'Sản phẩm'; $user = $_SESSION['user']; $products = get_all('products', $options); $pagination = pagination($url, $page, $total); //load view require 'backend/views/product/index.php';
<?php //load model require_once 'backend/models/unit.php'; if (isset($_GET['page'])) { $page = intval($_GET['page']); } else { $page = 1; } $page = $page > 0 ? $page : 1; $limit = 10; $offset = ($page - 1) * $limit; $options = array('limit' => $limit, 'offset' => $offset, 'order_by' => 'unit_name ASC'); $url = 'admin.php?controller=unit'; $total_rows = get_total('unit', $options); $total = ceil($total_rows / $limit); //data $title = UNIT_TITLE_INDEX; $categories = get_all('unit', $options); $pagination = pagination($url, $page, $total); //load view require 'backend/views/unit/index.php';
function gateway_check() { //pokazh($_SESSION,"session"); $label_line = ""; $label_line2 = ""; $label_line3 = ""; $my_img = "./img/check-2.png"; $my_img = @imagecreatefrompng($my_img); $text_colour = imagecolorallocate($my_img, 0, 0, 0); $line_colour = imagecolorallocate($my_img, 128, 255, 0); $font = imageloadfont('./fonts/ArialUnicode.gdf'); $arrContent = get_content(); $arrSize = count($arrContent); $arr1 = array_slice($arrContent, 0, 3); $label_line = implode(",", $arr1); if ($arrSize > 3) { $label_line2 = implode(",", array_slice($arrContent, 3, 4)); } if ($arrSize > 7) { $label_line3 = implode(",", array_slice($arrContent, 7, 4)); } $label_line = iconv("UTF-8", "windows-1251", $label_line); $label_line2 = iconv("UTF-8", "windows-1251", $label_line2); $label_line3 = iconv("UTF-8", "windows-1251", $label_line3); imagestring($my_img, $font, 338, 186, $label_line, $text_colour); // pay for images 1 imagestring($my_img, $font, 338, 473, $label_line, $text_colour); // pay for images 2 imagestring($my_img, $font, 215, 214, $label_line2, $text_colour); // pay for images 1a imagestring($my_img, $font, 210, 503, $label_line2, $text_colour); // pay for images 2a imagestring($my_img, $font, 215, 241, $label_line3, $text_colour); // pay for images 1b imagestring($my_img, $font, 210, 530, $label_line3, $text_colour); // pay for images 2b $label_line = get_total(); // "9024 руб.00 коп."; $label_line = iconv("UTF-8", "windows-1251", $label_line); imagestring($my_img, $font, 258, 270, $label_line, $text_colour); // Total 1 imagestring($my_img, $font, 258, 560, $label_line, $text_colour); // Total 2 header("Content-type: image/png"); imagepng($my_img); //imagecolordeallocate( $line_color ); //imagecolordeallocate( $text_color ); imagedestroy($my_img); }
//load model require_once 'backend/models/products.php'; //title website ================================================================ $title = BRANCH_TITLE_INDEX; //============ if (isset($_POST['search'])) { header('location:admin.php?controller=wheretobuy&search=' . $_POST['search']); } if (isset($_GET['page'])) { $page = intval($_GET['page']); } else { $page = 1; } $page = $page > 0 ? $page : 1; $limit = 10; $offset = ($page - 1) * $limit; $options = array('limit' => $limit, 'offset' => $offset); $url = 'admin.php?controller=wheretobuy'; if (isset($_GET['search'])) { $search = escape($_GET['search']); $options['where'] = "LOWER(branches.NAME_BRANCH) LIKE LOWER('%{$search}%') "; $url = 'admin.php?controller=wheretobuy&search=' . $_GET['search']; } $total_rows = get_total('branches', $options); $total = ceil($total_rows / $limit); //data $branches = get_all('branches', $options); $pagination = pagination($url, $page, $total); //load view ==================================================================== require 'backend/views/wheretobuy/index.php';
echo "<input type='hidden' name='kw' value='{$key_word}' size='0' >"; ?> <input type='submit' value='生成GIF' class="btn btn-info btn-xs"> </form> </td> <td> <a href='help.html' target='_blank'>使用说明</a> </td> </tr> </table> </td> </tr> <tr> <td > <?php $total = get_total($key_word); echo "<table class='main_frame_width'><tr><td>"; show_list($key_word, $pn, $total, 12, $page_size); echo "</td><td > </td><td class='text-right'>"; echo "Total:{$total}"; echo "</td></tr></table>"; ?> </td> </tr> <tr><td> <?php show_search_result($key_word, $total, $pn * $page_size, $page_size); ?> </td></tr> <tr > <td align="right"> <table >
$value = $row[value]; if (array_key_exists($id, $recommended)) { $recommended[$id][] = array($property, $value); } else { $recommended[$id] = array(array($property, $value)); } } } if (count($recommended) > 5) { $recommended = array_slice($recommended, 0, 5, true); } $cur_page = isset($_GET['page']) ? $_GET['page'] : 1; $results_per_page = 10; // number of results per page $skip = ($cur_page - 1) * $results_per_page; $total = get_total($keywords, array_keys($recommended), $dbc); $num_pages = ceil($total / $results_per_page); ?> <div class="container"> <form class="form-search" action="search.php" method="get" class="form-horizontal" enctype="multipart/form-data"> <div class="container" > <?php include_once "./search_form.php"; ?> <div class="row"> <div class="container"> <?php
<?php //load model require_once 'backend/models/orders.php'; if (isset($_POST['oid'])) { foreach ($_POST['oid'] as $oid) { $oid = intval($oid); orders_delete($oid); } } if (isset($_GET['page'])) { $page = intval($_GET['page']); } else { $page = 1; } $page = $page > 0 ? $page : 1; $limit = 10; $offset = ($page - 1) * $limit; $options = array('limit' => $limit, 'offset' => $offset, 'order_by' => 'status ASC, id DESC'); $url = 'admin.php?controller=order'; $total_rows = get_total('orders', $options); $total = ceil($total_rows / $limit); //data $title = 'Đơn hàng'; $user = $_SESSION['user']; $orders = get_all('orders', $options); $pagination = pagination($url, $page, $total); $status = array(0 => 'Chưa xử lý', 1 => 'Đã xử lý'); //load view require 'backend/views/order/index.php';
$row = mysqli_fetch_array($result); $total = $row['count']; return $total; } if (isset($_POST['submit'])) { $keywords = $_POST['keywords']; } if (isset($_GET['keywords'])) { $keywords = $_GET['keywords']; } // Calculate pagination information $cur_page = isset($_GET['page']) ? $_GET['page'] : 1; $results_per_page = 10; // number of results per page $skip = ($cur_page - 1) * $results_per_page; $total = get_total($keywords, $dbc); $num_pages = ceil($total / $results_per_page); $url = $_SERVER['PHP_SELF'] . '?keywords=' . $keywords . '&db_name=' . $db_name; ?> <div class="container"> <?php include_once 'entity_search_form.php'; echo '<hr>'; if ($db_name == "tcmls" && (!isset($keywords) || $keywords == '')) { include_once $db_name . '_recommended_entities.php'; } else { ?> <div class="row"> <div class="col-md-10">
function get_offline() { return get_total() - get_online(); }
<tr> <?php $atributo_boton_modificar = array('class' => 'btn btn-success glyphicon glyphicon-pencil'); $atributo_boton_eliminar = array('class' => 'btn btn-danger glyphicon glyphicon-remove', 'onclick' => "javascript:return confirm('Seguro que desea eliminar este dato?')"); ?> <td><?php echo $incidencia->adscripcion; ?> </td> <td><?php echo $incidencia->descripcion; ?> </td> <td align='center'><span class="badge"><?php echo get_total($incidencia->qna_id, $incidencia->adscripcion_id); ?> </span></td> <td align='center'><span class="badge"><?php echo get_total_pendientes($incidencia->qna_id, $incidencia->adscripcion_id); ?> </span></td> <td> <?php echo anchor('admin/capturar_all_centro/' . $incidencia->qna_id . '/' . $incidencia->adscripcion_id, ' ', $atributo_boton_modificar); ?> </td>
return $query; } if (isset($_GET['subject']) && $_GET['subject'] != '') { $subject = $_GET['subject']; } if (isset($_GET['predicate']) && $_GET['predicate'] != '') { $predicate = $_GET['predicate']; } if (isset($_GET['object']) && $_GET['object'] != '') { $object = $_GET['object']; } $cur_page = isset($_GET['page']) ? $_GET['page'] : 1; $results_per_page = 10; // number of results per page $skip = ($cur_page - 1) * $results_per_page; $total = get_total($dbc, $subject, $predicate, $object); $num_pages = ceil($total / $results_per_page); $url = 'hypo.php?db_name=' . $db_name . '&subject=' . $subject . '&predicate=' . $predicate . '&object=' . $object; $subject_link = render_value($dbc, $db_name, $subject, $with_def = false); $object_link = render_value($dbc, $db_name, $object, $with_def = false); ?> <div class="container"> <h1><?php echo $subject_link . " " . $predicate . " " . $object_link; ?> </h1> <p></p> <ul class="nav nav-tabs"> <li class="active"><a href="#">推理依据</a></li>
header('Location: /login.php?error=' . urlencode($error)); die; } if (isset($_POST['to'])) { if ($_POST['to'] == "") { $error = "You must enter a username or id"; } } else { $error = ""; } if (!$error) { # Check to see if username was supplied, if it was convert to id $amount = intval($_POST['amount']); $from = $_SESSION['id']; $comment = $_POST['comment']; $users_total = get_total($conn, $from); $error = False; $to_user = lookup_user($conn, $_POST['to']); if (isset($to_user['error'])) { $error = $to_user['error']; } else { $to = $to_user['id']; } if (!((is_int($amount) || ctype_digit($amount)) && (int) $amount > 0)) { $error = "You can't transfer negative Kitten Coins"; } if ($users_total) { if ($users_total['total'] < $amount) { $error = "You can't transfer more than is in your account"; } } else {
function print_hash_table(&$hash, $title = "") { $total = get_total($hash); $unique = get_unique($hash); $hapax = get_hapax($hash); // start the csv $csv = "{$title},{$total},{$unique},{$hapax}\n"; $csv = "{$csv}RANK,WORD,COUNT,FREQUENCY\n"; // print table header ?> <div class="results"> <table class="resultstable"> <tr> <th>Rank</th> <th>Word</th> <th>Count</th> <th>Frequency</th> </tr> <?php $color = 1; $rank = 0; $allrank = 1; $prevcount; // iterate through the list of word printing them out foreach ($hash as $word => $count) { $prop = round($count / $total, 10); if ($count != $prevcount) { $rank = $allrank; } $prevcount = $count; $allrank++; $rowclass = $color % 2 ? "oddrow" : "evenrow"; $color++; ?> <tr class="<?php echo $rowclass; ?> "> <td><?php echo $rank; ?> </td> <td class="intext"><?php echo $word; ?> </td> <td><?php echo $count; ?> </td> <td><?php echo $prop; ?> </td> </tr> <?php // update csv $csv = "{$csv}{$rank},{$word},{$count},{$prop}\n"; } ?> </table> </div> <?php // return the csv return $csv; }
} else { render_warning('无相关实体信息'); } ?> <div class="container"> <?php $relation_tab_id = 'docs'; include_once "./relation_header.php"; //$query = "SELECT * FROM resource where title like '%$keywords%' or description like '%$keywords%' ORDER BY title ASC LIMIT 0,10"; // Calculate pagination information $cur_page = isset($_GET['page']) ? $_GET['page'] : 1; $results_per_page = 10; // number of results per page $skip = ($cur_page - 1) * $results_per_page; $total = get_total($docs, $dbc); $num_pages = ceil($total / $results_per_page); echo '<p></p>'; echo '<p><font color="gray">该语义关系出现于如下' . $total . '篇文献之中:</font></p>'; echo '<hr>'; $query = build_query($docs) . " LIMIT {$skip}, {$results_per_page}"; $result = mysqli_query($dbc, $query) or die('Error querying database.'); while ($row = mysqli_fetch_array($result)) { render_content($row); } if ($num_pages > 1) { generate_page_links($id, $cur_page, $num_pages); } ?> </div>
$data = "'',\n\t\t\t\t\t'{$get_transaction_id}',\n\t\t\t\t\t'{$menu_id}', \n\t\t\t\t\t'" . $get_menu_price['menu_original_price'] . "',\n\t\t\t\t\t'" . $get_menu_price['menu_margin_price'] . "',\n\t\t\t\t\t'" . $get_menu_price['menu_price'] . "',\n\t\t\t\t\t'" . $tnt_discount . "',\n\t\t\t\t\t'{$tnt_grand_price}',\n\t\t\t\t\t'1',\n\t\t\t\t\t'{$tnt_grand_price}'\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t"; create_config("transaction_tmp_details", $data); } header("Location: transaction_new.php?page=list_edit&table_id={$table_id}"); break; case 'save': extract($_POST); $i_date = get_isset($_GET['date']); $i_date = format_back_date($i_date); $i_jam = date("h:i:s"); $table_id = get_isset($_GET['table_id']); $member_id = get_isset($_GET['member_id']); $tanggal = $i_date . " " . $i_jam; //echo "ok"; $get_building_id = get_building_id($table_id); $get_total = get_total($table_id); $data = "'',\n\t\t\t\t\t'{$table_id}',\t\n\t\t\t\t\t'{$member_id}',\n\t\t\t\t\t'{$tanggal}'\n\t\t\t\t\t\n\t\t\t\t"; create_config("transactions_tmp", $data); $transaction_id = mysql_insert_id(); $query_item = select_item(); while ($row_item = mysql_fetch_array($query_item)) { $get_data_menu = get_data_menu($row_item['menu_id']); $data_item = "'',\n\t\t\t\t\t\t\t'{$transaction_id}',\n\t\t\t\t\t\t\t'" . $row_item['menu_id'] . "',\n\t\t\t\t\t\t\t'" . $get_data_menu['menu_original_price'] . "',\n\t\t\t\t\t\t\t'" . $get_data_menu['menu_margin_price'] . "',\n\t\t\t\t\t\t\t'" . $get_data_menu['menu_price'] . "',\n\t\t\t\t\t\t\t'" . $row_item['tnt_discount'] . "',\n\t\t\t\t\t\t\t'" . $row_item['tnt_grand_price'] . "',\n\t\t\t\t\t\t\t'" . $row_item['tnt_qty'] . "',\n\t\t\t\t\t\t\t'" . $row_item['tnt_total'] . "'\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t"; create_config("transaction_tmp_details", $data_item); } delete($table_id); if ($table_id == 0) { header("Location: payment.php?table_id={$table_id}&building_id={$get_building_id}"); } else { header("Location: order.php?building_id={$get_building_id}"); }
$i_branch_id = get_isset($i_branch_id); $i_payment_type = get_isset($i_payment_type); if ($i_payment_type == 1) { $status = 1; } else { $status = 2; } $i_code = get_isset($i_code); $tanggal = date("Y-m-d"); //$get_item_name = get_item_name($i_item_id); $data = "'',\n\t\t\t\t\t'{$i_date}', \n\t\t\t\t\t'0', \n\t\t\t\t\t'0',\n\t\t\t\t\t'0',\n\t\t\t\t\t'0',\n\t\t\t\t\t'{$i_supplier}',\n\t\t\t\t\t'{$i_branch_id}',\n\t\t\t\t\t'{$i_payment_type}',\n\t\t\t\t\t'{$status}',\n\t\t\t\t\t'{$tanggal}',\n\t\t\t\t\t'{$i_code}'\n\t\t\t"; //echo $data; create($data); $data_id = mysql_insert_id(); // simpan jurnal $harga_total = get_total($data_id); create_journal($data_id, "purchase.php?page=form&id=", 2, $harga_total['total'], $i_code, '', $i_branch_id); //add_stock($i_item_id, $i_branch_id, $i_qty); update_detail($data_id, $_SESSION['user_id']); $query_item = select_detail_tmp($data_id); while ($row_item = mysql_fetch_array($query_item)) { //echo $row_item['transaction_production_detail_id']; //Minus stock $select_stock = select_stock($row_item['branch_id'], $row_item['item_id']); $stock_plus = $select_stock['item_stock_qty'] + $row_item['purchase_detail_qty']; //echo $stock_plus; update_stock($row_item['branch_id'], $row_item['item_id'], $stock_plus); } header("Location: purchase.php?page=list&did=1"); break; case 'edit':
<?php //load model require_once 'backend/models/categories.php'; if (isset($_POST['cid'])) { foreach ($_POST['cid'] as $cid) { $cid = intval($cid); categories_delete($cid); } } if (isset($_GET['page'])) { $page = intval($_GET['page']); } else { $page = 1; } $page = $page > 0 ? $page : 1; $limit = 10; $offset = ($page - 1) * $limit; $options = array('limit' => $limit, 'offset' => $offset, 'order_by' => 'position ASC'); $url = 'admin.php?controller=category'; $total_rows = get_total('categories', $options); $total = ceil($total_rows / $limit); //data $title = 'Danh mục sản phẩm'; $user = $_SESSION['user']; $categories = get_all('categories', $options); $pagination = pagination($url, $page, $total); //load view require 'backend/views/category/index.php';
<?php $file = 'adv_day_8.txt'; echo '<pre>'; var_dump(get_total($file)); echo '</pre>'; function get_total($file) { $total = 0; $handle = fopen($file, 'r'); while ($str = fgets($handle)) { $str = trim($str); $enc_str = addslashes($str); $enc_str = '"' . $enc_str . '"'; $current_nr = strlen($enc_str) - strlen($str); $total += $current_nr; } return $total; }
//title website ================================================================ $title = CUSTOMER_TITLE_INDEX; //paging ======================================================================= if (isset($_GET['page'])) { $page = intval($_GET['page']); } else { $page = 1; } $page = $page > 0 ? $page : 1; $limit = 10; $offset = ($page - 1) * $limit; $options = array('where' => 'role = 0', 'limit' => $limit, 'offset' => $offset, 'order_by' => 'id ASC'); //data of paging =============================================================== //Search data ================================================================== $url = 'admin.php?controller=user'; if (isset($_POST['search'])) { header('location:admin.php?controller=user&search=' . $_POST['search']); } if (isset($_GET['search'])) { $search = escape($_GET['search']); $options['where'] = "(LOWER(`user`.USERNAME) LIKE LOWER('%{$search}%') OR LOWER(`user`.NAME) LIKE LOWER('%{$search}%')) AND `user`.ROLE = 0"; $url = 'admin.php?controller=user&search=' . $_GET['search']; } $total_rows = get_total('user', $options); $total = ceil($total_rows / $limit); $pagination = pagination($url, $page, $total); //data show ==================================================================== $users = get_all('user', $options); //load view ==================================================================== require 'backend/views/user/index.php';
return $search_query; } function get_total($dbc, $keywords, $active_relation, $dbc) { $query = build_query($dbc, $keywords, $active_relation, true); $result = mysqli_query($dbc, $query); $row = mysqli_fetch_array($result); $total = $row['count']; return $total; } $keywords = $_GET['keywords']; $cur_page = isset($_GET['page']) ? $_GET['page'] : 1; $results_per_page = 10; // number of results per page $skip = ($cur_page - 1) * $results_per_page; $total = get_total($dbc, $keywords, $active_relation, $dbc); $num_pages = ceil($total / $results_per_page); $url = $_SERVER['PHP_SELF'] . '?db_name=spleen&' . 'active_relation=' . $active_relation . '&keywords=' . $keywords; ?> <p></p> <div class="container"> <nav class="navbar navbar-default" role="navigation"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">关系管理</a>
function build_query($dbc, $type, $count_only = false) { if ($count_only) { $query = "SELECT count(*) as count FROM triple_type WHERE type = " . $type; } else { $query = "SELECT * FROM triple_type t, graph g where t.triple = g.id and t.type = " . $type . " order by subject, value"; } return $query; } $type = $_GET['type']; $header = get_header($dbc, $type); $cur_page = isset($_GET['page']) ? $_GET['page'] : 1; $results_per_page = 10; // number of results per page $skip = ($cur_page - 1) * $results_per_page; $total = get_total($dbc, $type); $num_pages = ceil($total / $results_per_page); $url = $_SERVER['PHP_SELF'] . '?db_name=' . $db_name . '&type=' . $type; ?> <script> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-146052-10']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();