function getLesson($id) { global $db; $fnk_result = array(); $query = "SELECT `name`, `duration` FROM `lessons` WHERE `lid` = '" . mysql_real_escape_string(trim($id)) . "'"; $result = mysql_query($query) or die(OUT(mysql_error())); $row = mysql_fetch_array($result, MYSQL_ASSOC); //TODO if (mysql result count) != 1 then ERROR return $row; }
function getTraining($id) { global $db; $query = "SELECT tt.id, tt.date, WEEKDAY(tt.`date`) as `weekday`, DATE_FORMAT(tt.`time_start`, '%H:%i') as time_start, DATE_FORMAT(tt.`time_end`, '%H:%i') as time_end, tt.hall, tt.trainer, tt.lesson, tr.name as trainer_name, tr.phone, le.name as lesson_name, le.color\nFROM `training_times` as tt JOIN (`trainers` as tr, `lessons` as le) ON ( tt.trainer = tr.tid AND tt.lesson = le.lid)\nWHERE tt.id = {$id}"; //OUT($query); $result = mysql_query($query) or die(OUT(mysql_error())); $row = mysql_fetch_array($result, MYSQL_ASSOC); //TODO if (mysql result count) != 1 then ERROR return $row; }
function getLessons() { global $db; $fnk_result = array(); $query = "SELECT `lid`, `name` FROM `lessons` ORDER BY `name`"; $result = mysql_query($query) or die(OUT(mysql_error())); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $fnk_result[$row['lid']] = $row['name']; } return $fnk_result; }
function template_header_sort($paramstr, $sort, $fname, $ftitle) { global $p, $act, $action, $draw; if ($act == "smadbisrept") { OUT($ftitle); return; } ?> <a href="<?php $sort == ">{$fname}" ? $ssort = "<{$fname}" : ($ssort = ">{$fname}"); OUT("?p={$p}&act={$act}&action={$action}&draw={$draw}&{$paramstr}&sort={$ssort}"); ?> "><?php echo $ftitle; ?> </a> <?php if ($sort == "<{$fname}") { OUT("<img src=\"" . SK_DIR . "/img/asc.gif\">"); } elseif ($sort == ">{$fname}") { OUT("<img src=\"" . SK_DIR . "/img/desc.gif\">"); } }
<?php global $_funcsPHP; if (!isset($_funcsPHP) || $_funcsPHP != "defined") { require_once "funcs.php"; } $BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]); $cur = $BILL->GetMonthTotalAccts(); $mon = $BILL->GetMonthMaxAccts(); $imgnum = 20.0; $prc_tr = (double) $cur["traffic"] / (double) $mon["traffic"] * 100.0; $perimg = 100.0 / $imgnum; $imgnum = (int) ((double) $prc_tr / $perimg); $decrs = array(0 => "Можно качать всё что угодно, и сколько угодно", 1 => "Можно качать всё что угодно, и сколько угодно", 2 => "Можно качать сколько угодно", 3 => "Можно качать сколько угодно", 4 => "Можно качать", 5 => "Можно качать", 6 => "Можно качать", 7 => "Можно качать", 8 => "Можно качать", 9 => "Можно, но только осторожно", 10 => "Можно, но только осторожно", 11 => "Можно, но только очень осторожно", 12 => "Только чуть полазить по сайтам", 13 => "Только почту проверить", 14 => "Можно, только по договоренности с админами", 15 => "Можно, только по договоренности с админами", 16 => "Можно, только админам", 17 => "Можно, только админам", 18 => "Можно, только админам", 19 => "НИЗЯЯ!!!"); $imgnum += 1; if ($imgnum > 20) { $imgnum = 20; } ?> <div align=center> <img width=35 src="<?php OUT(SK_DIR . "/billing/state_img.php"); ?> "><br> <?php OUT($decrs[$imgnum - 1] . "<br>(" . bytes2gb($cur["traffic"]) . " из " . bytes2gb($mon["traffic"]) . " Гб)"); ?> </div>
</table> </td></tr> <tr><td width=50% class=tbl1> <table width=100% class=tbl2 style="cursor:hand;" cellspacing=0 cellpadding=0 onclick="document.location.href='./?p=smadbis&act=topofurl';"> <td height=100px width=30% align=center bgcolor=#F0F6F8><img src="<?php OUT(SK_DIR); ?> /img/bill_statistic.gif"></td> <td bgcolor=#F0F6F8><div align=center><b><a href="./?p=smadbis&act=topofurl">Top посещаемых ресурсов Интернет</a></b></div><br> </td> </table> </td></tr> <tr><td width=50% class=tbl1> <table width=100% class=tbl2 style="cursor:hand;" cellspacing=0 cellpadding=0 onclick="document.location.href='./?p=smadbis&act=stats';"> <td height=100px width=30% align=center bgcolor=#DDEEF3><img src="<?php OUT(SK_DIR); ?> /img/bill_statistic.gif"></td> <td bgcolor=#DDEEF3><div align=center><b><a href="./?p=smadbis&act=stats">Ваша статистика</a></b></div><br> </td> </table> </td></tr> </table> <?php } break; case 1: $BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]); ?> <div align=center><b><font class=fontheader>Ваша статистика:</font></b></div> <?php
<div align=center> <a href="<?php OUT("?p={$p}&act={$act}&id={$id}"); ?> ">назад</a></div> <?php // } } else { include SK_DIR . "/pager_admin.php"; } } else { if ($_MODULE) { if ($id && file_exists($DIRS["pager_data"] . "/" . $id)) { OUT(get_file($DIRS["pager_data"] . "/" . $id)); if (check_auth() && _isroot()) { ?> <div align=center> <a href="?p=user_page&act=root&id=pager&a=edit&pgrec=<?php OUT($id); ?> ">Редактировать</a> </div> <?php } } else { global $page; $page = "404"; $this->LoadModule("error", false); } } } }
<?php } ?> </table><br><br> <?php } if (!count($messages)) { OUT("<div align=center>нет сообщений</div>"); } echo "<CENTER>Страница: " . $pagestext . "</CENTER>"; if (check_auth() && $CURRENT_USER["level"] >= 5) { ?> <div align=center> <a href="?p=<?php OUT($p); ?> &a=admin">Администрирование</a> </div> <?php } } } else { include SK_DIR . "/guestbook.php"; } } else { if (!file_exists(SK_DIR . "/guestbookbar.php")) { $ERR->Warning("Skin '" . $GV["skin"] . "' doesn't support this module!"); } else { include SK_DIR . "/guestbookbar.php"; }
?> <?php if ($CURRENT_USER["level"] >= 8) { ?> </a><?php } ?> <br> <?php if ($CURRENT_USER["level"] >= 5) { ?> <a style="font-size:10px" href="?p=smadbis&act=online"><?php } ?> сейчас он-лайн: <?php OUT(count($inlist)); ?> <?php if ($CURRENT_USER["level"] >= 5) { ?> </a><?php } ?> <?php // } } else { include SK_DIR . "/userssbar.php"; } } } }
</tr> <tr> <td width=50%>Описание тарифа </td><td width=50%><textarea name=vars[] class=inputbox style="width:100%" rows=5><?php ++$k; OUT($vars[$k++]); ?> </textarea></td> </tr> <tr> <td width=50%>Ранг данного тарифа </td><td width=50%><input type=text class=inputbox style="width:100%" name=vars[] value="<?php OUT($vars[$k++]); ?> "></td> </tr> <tr> <td width=50%>Максимальное дневное превышение трафика (раз) </td><td width=50%><input type=text class=inputbox style="width:100%" name=vars[] value="<?php OUT($vars[$k++]); ?> "></td> </tr> </table> <div align=center><input type=submit name=submform class=button value="Сохранить"></div> </form><br> <div align=center><a href="<?php OUT("?p={$p}&act={$act}"); ?> ">назад</a></div> <?php }
<?php //----------------------------------------------------------------------// // TITLE: PHP Class for bottom // // MAKER: SMStudio // // specially for SMS CMS (SM & Shurup Content Management System) // //----------------------------------------------------------------------// $MDL_TITLE = "Bottom"; $MDL_DESCR = "For bottom"; $MDL_UNIQUEID = "bottom"; $MDL_MAKER = "SMStudio"; if (!$_GETINFO) { global $timer; $timer->stop(); OUT("Page generated by: " . $timer->elapsed()); ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// }
if ($id != "NULL" && $id != "") { $query = "DELETE FROM lessons WHERE lid={$id}"; mysql_query($query) or die(json_encode(array('error' => OUT(mysql_error())))); echo json_encode(array('error' => "Success")); } } elseif (isset($_GET['m']) && $_GET['m'] == 'lesson_save') { $id = mysql_real_escape_string(trim($_GET['id'])); $name = mysql_real_escape_string(trim($_GET['name'])); $color = mysql_real_escape_string(trim($_GET['color'])); $duration = mysql_real_escape_string(trim($_GET['duration'])); $desc = mysql_real_escape_string(trim($_GET['desc'])); if ($id != 'NULL' && $id != "") { $query = "UPDATE lessons SET name='{$name}', duration='{$duration}', color='{$color}' WHERE lid={$id}"; mysql_query($query) or die(json_encode(array('error' => OUT(mysql_error())))); echo json_encode(array('error' => "Success")); } else { echo json_encode(array('error' => "Null id")); } } elseif (isset($_GET['m']) && $_GET['m'] == 'create_trainer') { $name = mysql_real_escape_string(trim($_GET['name'])); $phone = mysql_real_escape_string(trim($_GET['phone'])); $query = "INSERT INTO trainers VALUES (NULL, '{$name}', '{$phone}')"; mysql_query($query) or die(json_encode(array('error' => OUT(mysql_error())))); echo json_encode(array('error' => "Success")); } elseif (isset($_GET['m']) && $_GET['m'] == 'copyweek_copy') { $weekday = mysql_real_escape_string(trim($_GET['weekday'])); $countToAdd = mysql_real_escape_string(trim($_GET['countToAdd'])); $query = "insert into training_times (`date`,`time_start`, `time_end`, `hall`,\n`trainer`, `lesson`)\nselect\nINTERVAL (7*{$countToAdd}) DAY + `date`,\n `time_start`, `time_end`, `hall`, `trainer`, `lesson`\nfrom training_times\nwhere WEEKOFYEAR(`date`) = WEEKOFYEAR('{$weekday}')"; mysql_query($query) or die(json_encode(array('error' => OUT(mysql_error())))); echo json_encode(array('error' => "Success")); }
for ($i = count($alist) - 1; $i >= 0 && $i >= count($alist) - 3; --$i) { $data = $ANN->GetAnnData($alist[$i]); ?> <a style="font-size:9px" href="?p=users&act=userinfo&id=<?php $ud = get_user_data($data['login']); OUT($ud["id"]); ?> "><?php OUT($ud["nick"]); ?> </a>:<?php OUT($data['title']); ?> <br> <font color=gray style="font-size:8.5px">/<?php OUT(norm_date($data['date'])); ?> </font><br> <?php } ?> <b><div align=center><a style="font-size:8.5px" href=?p=annoucements>подробнее</a></div> <?php } else { include SK_DIR . "/annoucementsbar.php"; } } } } ?>
mysql_query($query) or die(OUT(mysql_error())); $error = mysql_error(); $error = $error == "" ? "Success" : $error; echo json_encode(array('error' => $error)); } elseif (isset($_GET['m']) && $_GET['m'] == 'create_lesson') { $name = mysql_real_escape_string(trim($_GET['name'])); $color = mysql_real_escape_string(trim($_GET['color'])); $duration = mysql_real_escape_string(trim($_GET['duration'])); $query = "INSERT INTO lessons VALUES (NULL, '{$name}', '{$duration}', '{$color}')"; mysql_query($query) or die(OUT(mysql_error())); $error = mysql_error(); $error = $error == "" ? "Success" : $error; echo json_encode(array('error' => $error)); } elseif (isset($_GET['m']) && $_GET['m'] == 'create_trainer') { $name = mysql_real_escape_string(trim($_GET['name'])); $phone = mysql_real_escape_string(trim($_GET['phone'])); $query = "INSERT INTO trainers VALUES (NULL, '{$name}', '{$phone}')"; mysql_query($query) or die(OUT(mysql_error())); $error = mysql_error(); $error = $error == "" ? "Success" : $error; echo json_encode(array('error' => $error)); } function normalizeZero($v) { if ($v <= 9) { return "0" . $v; } return $v; } //OUT($_REQUEST); //print_r(getTimeTableForWeek("'2011-04-15'"));
function log_url_protocol_template($session) { ?> <table class=tbl1 width=100%> <tr> <td width=100% class=tbl1> <div align=center><b><STRONG>Protocol:</STRONG></b></div> <?php OUT(nl2br($session['protocol']['data'])); ?> </td> </tr> <tr> <td width=100% class=tbl1><div align=center><b>Total data recieved: <?php OUT(make_fsize_str($session['protocol']['length'])); ?> </b></div></td> </tr> </table> <?php }
<?php global $MDL, $GV, $DIRS; ?> <div align=center><b>root menu:</b></div> <div align=center> <a href="?act=root&id=pass">пароль</a><br> <a href="?act=root&id=modules">модули</a><br> <a href="?act=root&id=vars">настройки</a><br> <?php if ($MDL->IsModuleExists("menu")) { ?> <a href="?act=root&id=menu">пункты меню</a><br><?php } if ($MDL->IsModuleExists("pager")) { ?> <a href="?act=root&id=pager">странички</a><br><?php } if ($MDL->IsModuleExists("users")) { ?> <a href="?act=root&id=users">пользователи</a><br><?php } ?> <br> <a href="?act=root&id=logout&fwdto=<?php OUT($FLTR->DirectProcessURL(getfullurl())); ?> ">logout root</a><br> </div>
<td class=tbl1><b>TOTAL:</b></td> <td class=tbl1></td> <?php if (!$uid) { ?> <td class=tbl1>MAX: <?php echo $total_ucount; ?> </td><?php } ?> <td class=tbl1><?php echo $total_count; ?> </td> <td class=tbl1><?php echo make_fsize_str($total_length); ?> </td> </tr> </table> <?php if ($BILLEVEL >= 3) { ?> <a target=_blank href="<?php OUT("?act=noskin&page={$p}&noskinact=smadbisrept&action={$action}&sort={$sort}&modurl={$modurl}&hideother={$hideother}&limit={$limit}&graf={$graf}&uid={$uid}&showdenied={$showdenied}&modurl={$modurl}&gid={$gid}&groupby={$groupby}&uid={$uid}&mod=show&monsel[]=" . $monsel[0] . "&monsel[]=" . $monsel[1] . "&daysel[]=" . $daysel[0] . "&daysel[]=" . $daysel[1] . "&yearsel[]=" . $yearsel[0] . "&yearsel[]=" . $yearsel[1]); ?> ">Версия для печати</a><br> <?php }
function Forbidden($str) { global $MDL; $page = "403"; if ($MDL->IsModuleExists("error")) { $MDL->LoadModule("error", "false"); } else { OUT("<BIG><br>This page is denied for you!</BIG><br>Cause: '{$str}';<br>"); } exit; }
</td><td width=50%> <?php OUT($month_traffic_limit); ?> </td></tr> <tr><td width=50%> Недельное ограничение траффика: </td><td width=50%> <?php OUT($week_traffic_limit); ?> </td></tr> <tr><td width=50%> Ограничение траффика в день: </td><td width=50%> <?php OUT($day_traffic_limit); ?> </td></tr> </table> </td> </table> <?php } ?> <br> <?php } else { OUT("<br><br><div align=center><b>нет ни одного тарифа!</b></div><br><br>"); }
OUT($list[$i]["title"]); ?> </a></b></div> <?php OUT(substr($list[$i]["descr"], 0, 100) . "..."); ?> <br>(<a style="font-size:9px;" href="?p=articles&topic=<?php OUT($list[$i]["tid"]); ?> &act=view&page=1&art=<?php OUT($list[$i]["id"]); ?> ">читать целиком</a>)<br> <font color=gray style="font-size:8.5px"><a style="font-size:8.5px;" href="?p=users&act=userinfo&id=<?php OUT($ud["id"]); ?> "><?php OUT($ud["nick"]); ?> </a> /<?php OUT(norm_date($list[$i]["date"])); ?> </font><br> <?php } } else { include SK_DIR . "/articlesbar.php"; } } } }
<tr><td background="<?php OUT(SK_DIR); ?> /img/menu_item.gif" style="cursor:hand" onclick="document.location.href='<?php OUT($LINK); ?> ';"> <table width=206px height=42px><td align=center valign=center width=100% height=100%> <A href="<?php OUT($LINK); ?> " title="<?php OUT($LINKTITLE); ?> "> <font class=menuitem> <?php OUT($TITLE); ?> </font> </a> </td></table> </td></tr> </table> <?php } } ?>
$colorr = dechex($color) . dechex($color); $color = (int) (15.0 / 200.0 * (200.0 - $prci)); $colorg = dechex($color) . dechex($color); } ?> <td width=10px height=100% valign=bottom> <font style="font-size:7px;font-color:#000000"><?php OUT(bytes2mb($history[$i]["traffic"])); ?> </font><br> <table align=center bgcolor="#<?php OUT($colorr); OUT($colorg); ?> 00" height="<?php OUT($prc); ?> px" width=10px valign=bottom border=0> <td class=tbl1 style="font-size:7px;font-color:#000000"></td> </table> <font style="font-size:7px;font-color:#000000"><br> <?php echo date("j") != $i + 1 ? $i + 1 : "<BIG><b>" . ($i + 1) . "</b></BIG>"; ?> </font> </td> <?php } ?> </table> </td>
?> </td> <td class=tbl1><?php OUT($accts[$i]["stop_time"]); ?> </td> <td class=tbl1><?php OUT(bytes2mb($accts[$i]["out_bytes"], 3)); ?> Мб</td> <td class=tbl1><?php OUT(get_terminate_cause_str($accts[$i]["terminate_cause"])); ?> </td> </tr> <?php } ?> <tr> <td class=tbl1><b>Итог</b></td> <td class=tbl1></td> <td class=tbl1></td> <td class=tbl1></td> <td class=tbl1><b><?php OUT(bytes2mb($sumtra, 3)); ?> Мб</b></td> <td class=tbl1></td> </tr> </table>
$db_pass = "******"; $db = mysql_connect($db_host, $db_login, $db_pass) or die(mysql_error()); if (!mysql_select_db($db_name, $db)) { echo "Error: select db fail"; } mysql_query("SET NAMES 'utf8'"); if (isset($_GET['m']) && $_GET['m'] == 'table') { $where = " AND `hall` = '" . mysql_real_escape_string(trim($_GET['hall'])) . "'"; if (isset($_GET['trainer']) && $_GET['trainer'] != 'NULL') { $where .= " AND tr.tid ='" . mysql_real_escape_string(trim($_GET['trainer'])) . "'"; } if (isset($_GET['lesson']) && $_GET['lesson'] != 'NULL') { $where .= " AND le.lid ='" . mysql_real_escape_string(trim($_GET['lesson'])) . "'"; } $res = json_encode(getTimeTableForWeek("'" . $_GET['pikDate'] . "'", $where)); OUT($res); echo $res; } elseif (isset($_GET['m']) && $_GET['m'] == 'trainers') { //OUT(json_encode(getTrainers())); echo json_encode(getTrainers()); } elseif (isset($_GET['m']) && $_GET['m'] == 'lessons') { echo json_encode(getLessons()); } elseif (isset($_GET['m']) && $_GET['m'] == 'update') { $query = "SELECT id, `lesson` FROM `training_times` WHERE id > 8"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $id = $row['id']; $res = $row['lesson']; $res1 = mysql_query("SELECT `duration` FROM lessons WHERE lid = {$res}") or die(mysql_error()); $row1 = mysql_fetch_array($res1, MYSQL_ASSOC) or die(mysql_error()); $time = $row1['duration'];
</td> </table> </td></tr> <tr><td width=50% class=tbl1> <table width=100% class=tbl2 style="cursor:hand;" cellspacing=0 cellpadding=0 onclick="document.location.href='?p=smadbis&act=tarifs&action=delete';"> <td height=100px width=30% align=center bgcolor=#F0F6F8><img src="<?php OUT(SK_DIR); ?> /img/bill_delete_tarif.gif"></td> <td bgcolor=#F0F6F8><div align=center><b><a href="?p=smadbis&act=tarifs&action=delete">Удалить тариф</a></b></div><br> Удаление существующих тарифов. </td> </table> </td></tr> <tr><td width=50% class=tbl1> <table width=100% class=tbl2 style="cursor:hand;" cellspacing=0 cellpadding=0 onclick="document.location.href='?p=smadbis&act=tarifs&action=edit';"> <td height=100px width=30% align=center bgcolor=#DDEEF3><img src="<?php OUT(SK_DIR); ?> /img/bill_edit_tarif.gif"></td> <td bgcolor=#DDEEF3><div align=center><b><a href="?p=smadbis&act=tarifs&action=edit">Список тарифов</a></b></div><br> Вывести список всех тарифов с возможностью просмотра пользователей или редактирования. </td> </table> </td></tr> </table> <br> <div align=center><a href="<?php OUT("?p={$p}"); ?> ">назад</a></div>
function GetNewsPost($id) { if (file_exists($this->files_dir . "/" . $id)) { OUT(get_file($this->files_dir . "/" . $id)); } else { die("no such file: " . $this->files_dir . "/" . $id); } }
</table> </td></tr> <tr><td width=100% height=100%> <table width=228px height=100% cellspacing=0 cellpadding=0 valign=top align=left border=0> <td width=46px height=100%><img src="<?php OUT(SK_DIR); ?> /img/right_ldc.gif"></td> <td bgcolor=#F0F6F8 width=100% background="<?php OUT(SK_DIR); ?> /img/right_dm.gif"></td> </table> </td></tr> </table> </td> </table> </td></tr> </table> </td> </table> <div align=center> <SMALL style="font-size:9px;">Page generated by <?php $timer->stop(); OUT($timer->elapsed()); ?> ms.<br> </div> </body> </html>
$mselect .= "</select>"; ?> <?php OUT($mselect); ?> </td> </table> <?php } $pc++; ?> <div align=center><a href="?act=root&id=menu&pc=<?php OUT($pc); ?> ">Добавить пункт</a></div> <div align=center><input class=button type=submit value="Сохранить"></div> </form> <?php } } else { echo "У ВАС ОТСУТСТВУЕТ НЕОБХОДИМЫЙ МОДУЛЬ!"; } break; case "users": if ($MDL->IsModuleExists("users")) { //показываем форму ?> <div align=center><b>Пользователи</b></div>
<td class=tbl1><?php OUT(bytes2mb($accts[$k]["traffic"], 3)); ?> Мб</td> <td class=tbl1><?php OUT(gethours($accts[$k]["time"]) . ":" . getmins($accts[$k]["time"]) . ":" . getsecs($accts[$k]["time"])); ?> </td> </tr> <?php } ?> <tr> <td class=tbl1><b>Всего</b></td> <td class=tbl1></td> <td class=tbl1><b><?php OUT(bytes2mb($sumtra, 3) . " Mb"); ?> </b></td> <td class=tbl1><b><?php OUT(gethours($sumtim) . ":" . getmins($sumtim) . ":" . getsecs($sumtim)); ?> </b></td> </tr> </table> <?php } } ?> </body> </html>