} else { $archive_type = $archive_type - 1; // Нормализуем (0 - норм, 1 - варн, 2 - авар) $query = "SELECT adress, archivetype, time, data FROM `archive_devices` WHERE time > '{$start_time}' and time < '{$end_time}' and adress={$address} and archivetype={$archive_type} ORDER BY time LIMIT {$offset}, {$count}"; } } if ($result = $mysqli->query($query)) { // выборка данных и помещение их в массив while ($row = $result->fetch_row()) { $row[3] = base64_encode($row[3]); // заранее перекодируем бинарные данные в base64 $rows[] = $row; } $result->close(); // очищаем результирующий набор } return $rows; } /*--------- Тело программы ---------*/ // массив накопитель $data = array(); $data['error'] = ""; if ($_GET['OFFSET'] === NULL) { $data['error'] = "Offset not set"; } else { $data['count'] = count_data_rows($mysqli, $_GET['STARTT'], $_GET['ENDT'], $_GET['ADDRESS'], $_GET['ARCHIVETYPE']); $data['rows'] = select_data($mysqli, $_GET['STARTT'], $_GET['ENDT'], $_GET['ADDRESS'], $_GET['ARCHIVETYPE'], $_GET['OFFSET'], $_GET['COUNT']); } // Отключимся от базы db_disconnect($mysqli); print json_encode($data);
// Insert a row using c2 commit($c2); // Commit using c2 select_data($c1); // Result of c2 insert is returned delete_data($c1); // Delete all rows in table using c1 select_data($c1); // No rows returned select_data($c2); // No rows returned commit($c1); // Commit using c1 select_data($c1); // No rows returned select_data($c2); // No rows returned drop_table($c1); $db = ""; $c1 = oci_connect("scott", "tiger", $db); $c2 = oci_connect("scott", "tiger", $db); echo "</pre>"; function create_table($conn) { $stmt = oci_parse($conn, "create table scott.hallo (test varchar2(64))"); oci_execute($stmt); echo $conn . " created table\n\n"; } function drop_table($conn) { $stmt = oci_parse($conn, "drop table scott.hallo");
?> </td> <td><?php echo $member['member_username']; ?> </td> <td><?php echo $member['member_status']; ?> </td> <td><?php echo select_data('packages', 'package_name', "package_id=" . $member['package_id']); ?> </td> <td><?php echo select_data('bonus', 'bonus_name', "bonus_id=" . $member['bonus_id']); ?> </td> <td><?php echo number_format($member['income'], 2); ?> </td> </tr> <?php } ?> <tr> <td colspan="2" align="right"><b>Total</b></td> <td><b><?php echo $total_member; ?>
<a id="mutual-friend" href="mutual-friend.php">Mutual Friends</a><br><br> <img rel="icon" src="public/img/settings.png" style="width:40px;height:40px;margin-left:-10px; margin-top:-10px;position:absolute;"> <a id="settings" href="settings.php">Settings</a> </div> <?php if (isset($_GET["id"])) { echo "<div id='" . $_GET["id"] . "'>" . $_GET["v"] . "</div>"; } ?> <div id="right-panel"> <?php include "db.php"; $connectionStatus = connect_db(); if (isset($_POST["submit"]) and !empty($_POST['search'])) { $value = $_POST['search']; $data = select_data($connectionStatus, $value); /*echo "<pre>"; print_r($data); echo"</pre>";*/ if ($data) { echo "<table>"; echo "<tr>"; echo "<th>ID </th> <th>First Name </th> <th>Last Name </th><th>Batch </th><th>Degree</th>"; ?> <?php while ($d = mysqli_fetch_assoc($data)) { echo "<tr>"; echo "<td>" . $d["id"] . "</td>"; echo "<td>" . $d['fname'] . "</td>";
}, { period: '<?php echo $year; ?> Q4', shop: <?php echo select_data('orders', 'SUM(order_total)', "order_date BETWEEN '{$q4_start}' AND '{$q4_end}' AND shipping_method='at-shop' AND order_comment!='signup_package_from_jSystem'") + 0; ?> , online: <?php echo select_data('orders', 'SUM(order_total)', "order_date BETWEEN '{$q4_start}' AND '{$q4_end}' AND shipping_method='ems'") + 0; ?> , jsystem: <?php echo select_data('orders', 'SUM(order_total)', "order_date BETWEEN '{$q4_start}' AND '{$q4_end}' AND shipping_method='at-shop' AND order_comment='signup_package_from_jSystem' ") + 0; ?> }, <?php } ?> ], lineColors: ['#ED5D5D', '#D6D23A', '#32D2C9'], xkey: 'period', ykeys: ['shop', 'online', 'jsystem'], labels: ['At-Shop', 'Online', 'J-System'], pointSize: 0, lineWidth: 0, hideHover: 'auto'
return ""; } // Приведем список к удобоваримому виду if (strpos($events, ",")) { // Составим строку с перечислением всех событий foreach (explode(",", $events) as $key => $value) { $event_section = $event_section . " or event=" . $value; } // Отрежем лишний or $event_section = substr($event_section, 4); // Создадим окончательный фильтр событий return " and (" . $event_section . ")"; } else { // Если событие только одно return " and (event =" . $events . ")"; } } /*--------- Тело программы ---------*/ // массив накопитель $data = array(); // Запись об ошибках $data['error'] = ""; if ($_GET['OFFSET'] === NULL) { $data['error'] = "Offset not set"; } else { $data['count'] = count_data_rows($mysqli, $_GET['STARTT'], $_GET['ENDT'], $_GET['EVENTTYPES']); $data['rows'] = select_data($mysqli, $_GET['STARTT'], $_GET['ENDT'], $_GET['EVENTTYPES'], $_GET['OFFSET'], $_GET['COUNT']); } print json_encode($data); // Отключимся от базы db_disconnect($mysqli);
<h3 class="prf-border-head">Transactions</h3> <?php $transactions_query = mysqli_query($connect, "SELECT * FROM transactions WHERE member_id={$member_id} ORDER BY transaction_date DESC LIMIT 30"); while ($transactions = mysqli_fetch_array($transactions_query)) { ?> <div class=" wk-progress pf-status"> <div class="col-md-3 col-xs-3"><?php echo $transactions['transaction_date']; ?> </div> <div class="col-md-3 col-xs-3"><?php echo str_replace('_', ' ', $transactions['transaction_description']); ?> </div> <div class="col-md-3 col-xs-3 text-center"><?php echo select_data('members', 'member_username', "member_id=" . $transactions['member_refer']); ?> </div> <div class="col-md-3 col-xs-3"> <strong> <?php if ($transactions['transaction'] == "pay" or $transactions['transaction'] == "transfer") { ?> <span style="color:red"> -<?php echo $transactions['expend']; ?> </span> <?php } else { ?> <span style="color:green"> <?php
?> </td> <td class="center hidden-phone"><?php echo $member['jWallet']; ?> </td> <td class="center hidden-phone"><?php echo $member['jPoint']; ?> </td> <td class="center hidden-phone"><?php echo select_data('members', 'member_username', "member_id=" . $member['sponsor']); ?> </td> <td class="center hidden-phone"><?php echo select_data('members', 'member_username', "member_id=" . $member['upline']); ?> </td> <td class="center hidden-phone"><?php echo $member['member_status']; ?> </td> <td class="center hidden-phone"><?php echo $member['member_registered']; ?> </td> <?php } ?> </tbody> </table>
$selected_countries = selected_countries($parliaments_selected); // prepare questions/categories (add weight) $questions_ordered = prepare_questions($questions); $categories_used_codes = array_keys($questions_ordered); $categories_used = prepare_categories($categories_used_codes, $categories); //filter and sort questions $questions_selected = filter_questions($questions); usort($questions_selected, 'compare_weights'); usort($questions_selected, 'compare_category_weights'); //get 1st question only: foreach ($questions_selected as $qs) { $question_id = $qs->id; break; } //select data $data_selected = select_data($data, $parliaments_selected, $questions_selected); //add color to selected countries // grey: 0, green: 1, yellow: 2, red: 3 foreach ($parliaments_selected as $key => $ps) { $country_code = $ps->country_code; if (isset($selected_countries[$country_code]['color'])) { //adding second chamber if (isset($question_id) and isset($data_selected[$ps->id][$question_id]->value)) { $selected_countries[$country_code]['color'] = color_sum($data_selected[$ps->id][$question_id]->value, $selected_countries[$country_code]['color']); } } else { //first chamber if (isset($question_id) and isset($data_selected[$ps->id][$question_id]->value)) { $selected_countries[$country_code]['color'] = $data_selected[$ps->id][$question_id]->value; } else { $selected_countries[$country_code]['color'] = 0;
?> </h1> <h2 style=""> <?php echo wordvar("Sponsor"); ?> </h2> </div> <div class="col-sm-6 " > <h1 style="font-size:42px;font-weight:bold;"> <img class="img-circle" src="<?php echo $site_main . "/gallery/avatar/" . select_data('members', 'member_avatar', "member_id=" . $me['upline']); ?> " style="height:60px;width:60px;"> <?php echo select_data('members', "CONCAT(member_name,' ',member_surname)", "member_id=" . $me['upline']); ?> </h1> <h2 style=""> <?php echo wordvar("Upline"); ?> </h2> </div> </div> </div> <hr> </div> </div>
echo $withdraws['member_name'] . " " . $withdraws['member_surname']; ?> </h4> </div> <div class="modal-body "> <div class="row"> วันที่ขอถอนเงิน : <?php echo $withdraws['withdraw_date']; ?> </div> <table class="table table-hover" data-sort="table"> <thead> <tr> <th>Money in J-Wallet:</th> <td>฿<?php echo number_format(select_data('members', 'jWallet', "member_id=" . $withdraws['member_id']) * 35); ?> </td> </tr> </thead> <tbody> <tr> <th>Withdraw amount:</th> <td>฿<?php echo number_format($withdraws['withdraw_amount'] * 35); ?> </td> </tr> <tr> <th>Bank account:</th> <td><?php
foreach ($root_items as $root_item) { $dom = new Zend_Dom_Query($root_item->ownerDocument->saveXML($root_item)); $output = new stdClass(); foreach ($definitions->properties as $property => $def) { list($selectors, $type) = $def; if (!is_array($selectors)) { $selectors = array($selectors); } foreach ($selectors as $selector) { if (preg_match('/(.+)?\\battr\\((.+?)\\)$/', $selector, $matches)) { list($null, $selector, $attr) = $matches; } else { $attr = NULL; } if ($selector) { $result = select_data($dom, $selector); } else { $result = $root_item; } $output->{$property} = node_data($result, $type, $attr); break; } } array_walk($output, 'fix_data'); $entries[] = $output; } $page++; } while (should_continue($page, $root_dom)); debug($entries); function select_data($dom, $selector) {
function bonus_direct($member_id = 0, $bonus_direct = 0) { $connect = Database(); $sponsor = select_data('members', 'sponsor', "member_id={$member_id}"); $sponsor_result = mysqli_fetch_assoc(mysqli_query($connect, "SELECT jWallet,rMoney FROM members WHERE member_id={$sponsor};")); $jWallet = $sponsor_result['jWallet']; $rMoney = $sponsor_result['rMoney']; $jWallet_received = $bonus_direct * 0.97 * 0.7; $rMoney_received = $bonus_direct * 0.97 * 0.3; $jWallet = $jWallet + $jWallet_received; //jWallet get 70% of bonus $rMoney = $rMoney + $rMoney_received; //rMoney get 30% of bonus if ($bonus_direct > 0) { $bonus_direct_query = mysqli_query($connect, "UPDATE members SET jWallet={$jWallet},rMoney={$rMoney} WHERE member_id={$sponsor}"); if ($bonus_direct_query and $jWallet_received > 0 and $rMoney_received > 0) { mysqli_query($connect, "INSERT INTO transactions(member_id,member_refer,transaction_date,transaction,transaction_description,bonus_id,income,expend,notification_status) VALUES({$sponsor},{$member_id},NOW(),'receive','received_direct_bonus',1,{$jWallet_received}+{$rMoney_received},'0','unread') "); echo "bonus_direct<br>"; } } }
$product_edit = mysqli_query($connect, "UPDATE products SET\n\tproduct_name='{$product_name}',\n\tproduct_description='{$product_description}',\n\tproduct_detail='{$product_detail}',\n\tproduct_price='{$product_price}',\n\tproduct_price_member='{$product_price_member}',\n\tproduct_point='{$product_pv}',\n\tproduct_weight='{$product_weight}',\n\tproduct_qty='{$product_qty}',\n\tproduct_barcode='{$product_barcode}',\n\tproduct_url='{$product_url}',\n\tproduct_category_id='{$product_category}'\n\tWHERE product_id={$product_id}"); if ($product_edit) { $file_ary = reArrayFiles($_FILES['image']); $picture_main = select_data('product_pictures', 'COUNT(picture_index)', "product_id={$product_id} AND picture_index='#'") + 0; $i = 0; if ($file_ary[0]['tmp_name'] != "") { foreach ($file_ary as $file) { $picture_id = select_data('product_pictures', 'MAX(picture_id)') + 1; $file_tmp = $file['tmp_name']; $file_part = explode('.', $file['name']); $file_type = end($file_part); $file_name = $picture_id . "." . $file_type; if ($i == 0 and $picture_main == 0) { $product_index = "#"; } else { $product_index = select_data('product_pictures', 'MAX(picture_index)', "product_id={$product_id}") + 1; } mysqli_query($connect, "INSERT INTO product_pictures VALUES({$picture_id},'{$file_type}','{$product_index}','{$product_id}')"); copy($file_tmp, "../gallery/products/" . $file_name); image_resize($file, 270, 405, "../gallery/products/thumb/{$file_name}"); $i++; } } } } elseif ($process == "product_delete") { $product_id = $_REQUEST['product_id']; $product_delete = mysqli_query($connect, "DELETE FROM products WHERE product_id='{$product_id}'"); if ($product_delete) { $picture_query = mysqli_query($connect, "SELECT * FROM product_pictures WHERE product_id={$product_id}"); while ($picture = mysqli_fetch_array($picture_query)) { unlink("../gallery/product/" . $picture['picture_id'] . "." . $picture['picture_type']);
</form> </div> </div> <div class="col-md-10" id="right-section"> <table class="table table-hover table-condensed"> <tr> <th>ID</th> <th>First Name</th> <th>Last Name</th> <th>Marks</th> <th>Result</th> </tr> <?php $PASSING_MARKS = 40; //passing marks $query_result = select_data($connectionStatus); while ($query_row = mysqli_fetch_assoc($query_result)) { $marks_scored = (int) $query_row["marks"]; if ($marks_scored > 100 || $marks_scored <= 0) { echo ' <tr class="warning">'; } else { echo ' <tr>'; } echo "\r\n\t\t\t\t\t\t<td>" . $query_row["id"] . "</td>\r\n\t\t\t\t\t\t<td>" . $query_row["fname"] . "</td>\r\n\t\t\t\t\t\t<td>" . $query_row["lname"] . "</td>\r\n\t\t\t\t\t\t<td>" . $marks_scored . "</td>\r\n\t\t\t\t\t\t<td>"; echo $PASSING_MARKS < $marks_scored ? '<span id="success">PASS</span>' : '<span id="danger">FAIL</span>'; echo "</td>\r\n\t\t\t\t\t</tr>"; } ?>