function test($title, $cb) { test_stack($title); test_count(1, 0); try { call_user_func($cb); echo "[1;32mPASSED[0m: {$title}" . PHP_EOL; } catch (Exception $ex) { } }
<h3 class="titlenav">Like us on Facebook</a></h3> <div class="fb-like-box" data-href="https://www.facebook.com/<?php echo settings("fb_id_page"); ?> " data-width="288" data-show-faces="true" data-stream="false" data-show-border="false" data-header="false"></div> <div class="clear"></div> </div> <div class="boxnav"> <h3 class="titlenav">Thống kê</h3> <ul class="menunav"> <li><a><b class='Statistics'><?php echo user_count(); ?> </b> Thành viên</a></li> <li><a><b class='Statistics'><?php echo test_count(); ?> </b> Đề kiểm tra</a></li> <li><a><b class='Statistics'><?php echo download_count(); ?> </b> Lượt download</a></li> <li style="margin-bottom: -14.6px; border-bottom-color: #cfcdcd; padding-bottom: 2px;"><a><b class='Statistics'><?php echo settings(view); ?> </b> Lượt truy cập</a></li> <br/> </ul> <div class="clear"></div> </div> <div class="boxnav">
<?php require_once "../config.php"; require_once "../function.php"; ob_start(); session_start(); date_default_timezone_set('Asia/Ho_Chi_Minh'); $_SESSION["admin"] = $_COOKIE["admin"]; if ($_SESSION["admin"] != 1) { header("refresh: 0; url=/admin.php"); } require_once "header.php"; echo "<script>\ndocument.getElementById('container').setAttribute('style', 'background: #fff;');\ndocument.getElementById('x1').setAttribute('class', 'active');\n</script>"; echo "\n \t<li style='border: 0;'></li>\n </ul>\n </div>\n <div id='main' style='width: 100%; float: left; padding-left: 19px;'>\n\t\t\t\t<br/>\n\t\t\t\t<form action='' class='jNice'>\n \t<fieldset style='width:93%;padding: 10px;margin: 0 0 12px 0;'>\n\t\t\t\t\t\t<legend><b> <img src='./img/statistiques.png'> Thống kê </b></legend>\n\t\t\t\t\t\t<table style='width: 100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Số thành viên</td>\n\t\t\t\t\t\t<td>" . user_count() . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='odd'>\n\t\t\t\t\t\t<td>Số đề kiểm tra</td>\n\t\t\t\t\t\t<td>" . test_count() . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Số lượt xem</td>\n\t\t\t\t\t\t<td>" . settings(view) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='odd'>\n\t\t\t\t\t\t<td>Số lượt tải về</td>\n\t\t\t\t\t\t<td>" . download_count() . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n </fieldset>\n\t\t\t\t\t\t<fieldset style='width:93%;padding: 10px;margin: 0 0 12px 0;'>\n\t\t\t\t\t\t<legend><b> <img src='./img/test.png'> Đề kiểm tra mới nhất </b></legend>\n\t\t\t\t\t\t<table cellpadding='0' cellspacing='0' style='width: 100%'>"; $sql = "SELECT * FROM `tests` order by `id` DESC LIMIT 0,5"; $query = @mysql_query($sql); $record = @mysql_num_rows($query); // Gán biến tổng số CSDL $record if ($record != 0) { while ($row = @mysql_fetch_array($query)) { $i++; if ($i % 2 == 0) { echo "<tr>"; } else { echo "<tr class='odd'>"; } echo "\n <td><a target='_blank' href='../" . strtolower(str_filter($row['title'])) . "." . $row['id'] . ".php'>" . cu_t($row[title], 135) . "</a></td>\n <td class='action'><a target='_blank' href='../" . strtolower(str_filter($row['title'])) . "." . $row['id'] . ".php' class='view'>Xem</a><a href='edittest.php?id=" . $row[id] . "' class='edit'>Sửa</a><a href='deltest.php?id=" . $row[id] . "' class='delete'>Xóa</a></td>\n </tr>\n"; } } else { echo "Chưa có đề kiểm tra nào\n "; }
if (is_null($ret)) { echo "range error! \n"; return -1; } echo "range count: {$ret->count} \n"; $item = $ret->root; while ($item) { echo "range item: {$item->value} {$item->mask} \n"; $item = $item->next; } return 0; } function test_count($m, $key) { $ret = $m->count($key, ""); if (is_null($ret)) { echo "range error! \n"; return -1; } return 0; } $m = new MemLinkClient("127.0.0.1", 11001, 11002, 10); $key = "haha"; test_create($m, $key); test_stat($m, $key); test_insert($m, $key); test_count($m, $key); test_range($m, $key); test_tag($m, $key); test_delete($m, $key); test_range($m, $key);