function runTest($test) { if (!empty($test['setup'])) { $func = $test['setup']; echo "Preparing " . $test['name'] . "\n"; $func(); } echo "Timing " . $test['name'] . "\n"; $result = countCalls($test['function']); showResult($result); }
function profileLang($profile = false) { global $langArr, $victim; $c = $_SESSION['yahoo_lang']; if ($c == 'vn') { if ($profile === false) { showResult($langArr[$c]['invisible'] . '<br><b>' . $victim . '</b> là nick thật'); } else { showResult($langArr[$c]['invisible'] . '<br><b>' . $victim . '</b> là Profile ( nick ảo ) của <b>' . $profile . '</b>'); } } elseif ($c == 'en') { if ($profile === false) { showResult($langArr[$c]['invisible'] . '<br><b>' . $victim . '</b> is a Main ID ( not Profile )'); } else { showResult($langArr[$c]['invisible'] . '<br><b>' . $victim . '</b> is a Profile of <b>' . $profile . '</b>'); } } }
function documentList($id, $pp_kod) { ?> <div class="row"> <div class="alert alert-sm alert-border-left alert-primary"> <?php if ($id == 5 and checkAssign($pp_kod, "docList") == 0) { ?> <input type="checkbox" id="docList" value="docList"/> <?php } ?> <b>Document Required</b> </div> <table class="table table-striped table-bordered table-hover" cellspacing="0" width="100%" id="docRequire"> <thead> <tr align="center" class="primary"> <?php if (evaluate($pp_kod) == 0 and assignDoc($pp_kod) > 0) { ?> <td width="20%"> <?php if (evaluate($pp_kod) == 0) { echo "Comply"; } elseif (evaluate($pp_kod) == 2) { echo "Result"; } else { echo "Acceptable"; } ?> </td> <td width="65%">Description</td> <td width="15%">Attachment</td> <?php } else { ?> <td width="85%">Description</td> <td width="15%">Attachment</td> <?php } ?> </tr> </thead> <tbody> <tr align="center"> <?php if (evaluate($pp_kod) == 0 and assignDoc($pp_kod) > 0) { ?> <td> <?php if ($id == 2) { docScreen("sumofMethod", $pp_kod); } else { if (evaluate($pp_kod) == 0) { docEvaluate("sumofMethod", $pp_kod, "edit"); } elseif (evaluate($pp_kod) == 2) { docEvaluate("sumofMethod", $pp_kod, "view"); } else { echo showResult($pp_kod, "sumofMethod"); } } ?> </td> <td align="left">Summary of Method Validation</td> <td><?php getFile($pp_kod, 'sumofMethod'); ?> </td> <?php } else { ?> <td align="left">Summary of Method Validation</td> <td><?php getFile($pp_kod, 'sumofMethod'); ?> </td> <?php } ?> </tr> <tr align="center"> <?php if (evaluate($pp_kod) == 0 and assignDoc($pp_kod) > 0) { ?> <td> <?php if ($id == 2) { docScreen("otherDoc", $pp_kod); } else { if (evaluate($pp_kod) == 0) { docEvaluate("otherDoc", $pp_kod, "edit"); } elseif (evaluate($pp_kod) == 2) { docEvaluate("otherDoc", $pp_kod, "view"); } else { echo showResult($pp_kod, "otherDoc"); } } ?> </td> <td align="left">Other Documents</td> <td><?php getFile($pp_kod, 'otherDoc'); ?> </td> <?php } else { ?> <td align="left">Other Documents</td> <td><?php getFile($pp_kod, 'otherDoc'); ?> </td> <?php } ?> </tr> </tbody> </table> </div> <div class="row"> <div class="section-divider"></div> </div> <?php }
?> </li> <li><i>脚本超时时间: </i><?php echo ini_get('max_execution_time') . '秒'; ?> </li> <li><i>set_time_limit: </i><?php echo showResult('set_time_limit'); ?> </li> <li><i>fsockopen: </i><?php echo showResult('fsockopen'); ?> </li> <li style="border-bottom:none;"><i>ZEND支持: </i><?php echo showResult('zend_version'); ?> </li> </ul> </div> <?php $tj_category = $this->db->GetList("SELECT cateid FROM `@#_category` WHERE `model` = '1'"); $tj_brand = $this->db->GetList("SELECT id FROM `@#_brand`"); $tj_article = $this->db->GetList("SELECT * FROM `@#_article`"); $tj_shoplist = $this->db->GetList("SELECT id FROM `@#_shoplist`"); $time = time(); $tj_shoplist_xsjx = $this->db->GetList("SELECT id FROM `@#_shoplist` where `xsjx_time`>'{$time}'"); $tj_member = $this->db->GetList("SELECT uid FROM `@#_member`"); $tm = time() - 24 * 3600; $tj_member_new = $this->db->GetList("SELECT uid FROM `@#_member` where `time`>'{$tm}' ");
} if ($config['POST']) { curl_setopt($c, CURLOPT_POST, TRUE); } if ($config['POSTFIELDS']) { curl_setopt($c, CURLOPT_POSTFIELDS, $config['POSTFIELDS']); } //if ($config['HTTPHEADER']) curl_setopt($c, CURLOPT_HTTPHEADER, $config['HTTPHEADER']); //if ($config['COOKIE']) curl_setopt($c, CURLOPT_COOKIE, $config['COOKIE']); $contents = curl_exec($c); curl_close($c); return $contents; } if (!validateID($victim)) { showResult('invalid'); } $special_list = array('redphoenix89'); if (in_array($victim, $special_list)) { showResult('forbid'); } $c = getContents('http://opi.yahoo.com/online?u=' . urlencode($victim) . '&m=t&t=1'); if ($c == '00' && !isExistsID($victim)) { showResult('exists'); } logID($victim); if ($c == '01') { showResult('online'); } $ymsg =& new YMSG($id, $pwd, $victim); showResult($ymsg->getStatus());
*/ echo 'Cordoba -> Edinburgh' . "<br>"; showResult(getRoute('Cordoba', 'Edinburgh', $test)); echo '-----------------------------------------------------------------------' . "<br>"; echo 'Edinburgh -> Cordoba' . "<br>"; showResult(getRoute('Edinburgh', 'Cordoba', $test)); echo '-----------------------------------------------------------------------' . "<br>"; echo 'Cordoba -> Astana' . "<br>"; showResult(getRoute('Cordoba', 'Astana', $test)); echo '-----------------------------------------------------------------------' . "<br>"; echo 'Astana -> Cordoba' . "<br>"; showResult(getRoute('Astana', 'Cordoba', $test)); echo '-----------------------------------------------------------------------' . "<br>"; echo 'Moscow -> Astana' . "<br>"; showResult(getRoute('Moscow', 'Astana', $test)); echo '-----------------------------------------------------------------------' . "<br>"; echo 'Astana -> Moscow' . "<br>"; showResult(getRoute('Astana', 'Moscow', $test)); echo '-----------------------------------------------------------------------' . "<br>"; echo 'Edinburgh -> Moscow' . "<br>"; showResult(getRoute('Edinburgh', 'Moscow', $test)); echo '-----------------------------------------------------------------------' . "<br>"; echo 'Cordoba -> Moscow' . "<br>"; showResult(getRoute('Cordoba', 'Moscow', $test)); echo '-----------------------------------------------------------------------' . "<br>"; echo 'Astana -> Dusseldorf' . "<br>"; showResult(getRoute('Astana', 'Dusseldorf', $test)); echo '-----------------------------------------------------------------------' . "<br>"; echo 'Dusseldorf -> Edinburgh' . "<br>"; showResult(getRoute('Dusseldorf', 'Edinburgh', $test)); echo '-----------------------------------------------------------------------' . "<br>";
?> </li> <li>FTP登录: <?php echo showResult(function_exists('ftp_login')); ?> </li> <li>显示错误信息: <?php echo showResult(get_cfg_var('display_errors')); ?> </li> <li>使用URL打开文件: <?php echo showResult(get_cfg_var('allow_url_fopen')); ?> </li> <li>压缩文件支持(Zlib): <?php echo showResult(function_exists('gzclose')); ?> </li> </ul> </div> <div class="cl"></div> </div> <div class="homeNote"> <h2 class="title">记事</h2> <div class="notearea"> <textarea name="homeNote" id="homeNote"><?php $uname = $_SESSION['admin']; $posttime = time(); $postip = GetIP(); $r = $dosql->GetOne("SELECT `body` FROM `#@__adminnotes` WHERE uname='{$uname}'");
function play($object_test, $id_param) { if (!checkPerm('view', true, 'organization') && !checkPerm('view', true, 'storage')) { die("You can't access"); } require_once _base_ . '/lib/lib.form.php'; require_once $GLOBALS['where_lms'] . '/class.module/track.test.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.param.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.test.php'; if (!isset($_SESSION['test_date_begin'])) { $_SESSION['test_date_begin'] = date('Y-m-d H:i:s'); } $lang =& DoceboLanguage::createInstance('test'); $id_test = $object_test->getId(); $id_reference = getLoParam($id_param, 'idReference'); $url_coded = urlencode(serialize($object_test->back_url)); $id_track = retriveTrack($id_reference, $id_test, Docebo::user()->getIdst()); if ($id_track === false) { $GLOBALS['page']->add(getErrorUi($lang->def('_TEST_TRACK_FAILURE') . getBackUi(Util::str_replace_once('&', '&', $object_test->back_url), $lang->def('_BACK'))), 'content'); } $test_man = new TestManagement($id_test); $play_man = new PlayTestManagement($id_test, Docebo::user()->getIdst(), $id_track, $test_man); $test_info = $test_man->getTestAllInfo(); $track_info = $play_man->getTrackAllInfo(); // cast display to one quest at time if the time is by quest if ($test_info['time_dependent'] == 2) { $test_info['display_type'] = 1; } //number of test pages------------------------------------------- $tot_page = $test_man->getTotalPageNumber(); // find the page to display $previous_page = importVar('previous_page', false, false); if ($previous_page === false) { if (isset($_POST['page_continue']) && isset($_POST['continue'])) { $page_to_display = $_POST['page_continue']; } else { $page_to_display = 1; } } else { $page_to_display = $previous_page; if (isset($_POST['next_page'])) { ++$page_to_display; } if (isset($_POST['prev_page']) && $test_info['can_travel']) { --$page_to_display; } } if ($page_to_display < $track_info['last_page_seen'] && !$test_info['can_travel']) { //the page request is alredy displayed, but the user cannot travel trought page $GLOBALS['page']->add(getErrorUi($lang->def('_ERR_INCOERENCY_WITH_PAGE_NUMBER')) . getBackUi(Util::str_replace_once('&', '&', $object_test->back_url), $lang->def('_BACK')), 'content'); return; } if ($track_info['score_status'] != 'not_complete' && $track_info['score_status'] != 'doing') { $GLOBALS['page']->add(getErrorUi($lang->def('_ERR_INCOERENCY_WITH_PAGE_NUMBER')) . getBackUi(Util::str_replace_once('&', '&', $object_test->back_url), $lang->def('_BACK')), 'content'); return; } $new_info = array('last_page_seen' => $page_to_display, 'score_status' => 'doing'); if (isset($_POST['page_to_save'])) { if ($test_info['mod_doanswer']) { $new_info['last_page_saved'] = $_POST['page_to_save']; $play_man->storePage($_POST['page_to_save'], $test_info['mod_doanswer']); $play_man->closeTrackPageSession($_POST['page_to_save']); } else { if ($_POST['page_to_save'] > $track_info['last_page_saved']) { $new_info['last_page_saved'] = $_POST['page_to_save']; $play_man->storePage($_POST['page_to_save'], $test_info['mod_doanswer']); $play_man->closeTrackPageSession($_POST['page_to_save']); } } } $re_update = Track_Test::updateTrack($id_track, $new_info); // save page track info $play_man->updateTrackForPage($page_to_display); $quest_sequence_number = $test_man->getInitQuestSequenceNumberForPage($page_to_display); $query_question = $play_man->getQuestionsForPage($page_to_display); $time_in_test = $play_man->userTimeInTheTest(); $lock_edit = false; $time_string = ''; if ($test_info['time_dependent'] == 1 || $test_info['time_dependent'] == 2) { if ($test_info['time_dependent'] == 1) { // time is for test $start_time = $test_info['time_assigned'] - $time_in_test; if ($start_time <= 0) { showResult($object_test, $id_param); return; } } elseif ($test_info['time_dependent'] == 2) { // time is for quest $re_question = sql_query($query_question); list($idQuest, $type_quest, $type_file, $type_class, $start_time) = sql_fetch_row($re_question); $time_in_quest = $play_man->userTimeInThePage($page_to_display); $start_time = $start_time - $time_in_quest; if ($start_time <= 0) { $lock_edit = true; } } $time_string .= '<div class="test_time_left">' . $lang->def('_TIME_LEFT') . ' : ' . '<span id="time_left">' . (int) ($start_time / 60) . ' m ' . $start_time % 60 . ' s</span>' . '</div>'; // Js for time counter $time_string .= "<script type=\"text/javascript\">\r\n\t\t\t<!--\r\n\t\t\t\r\n\t\t\tvar start_count_from = " . $start_time . ";\r\n\t\t\tvar step = 1;\r\n\t\t\tvar time_elapsed = 0;\r\n\t\t\t\r\n\t\t\tvar id_interval;\r\n\t\t\tvar id_timeout;\r\n\t\t\t\r\n\t\t\tif( window.document.getElementById == null ) {\r\n\t\t\t\twindow.document.getElementById = function( id ) {\r\n\t\t\t\t\treturn document.all[id];\r\n\t\t\t }\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfunction counter() {\r\n\t\t\t\t\r\n\t\t\t\ttime_elapsed += step;\r\n\t\t\t\t\r\n\t\t\t\tvar display = start_count_from - time_elapsed;\r\n\t\t\t\tvar elem = document.getElementById('time_left');\r\n\t\t\t\t\r\n\t\t\t\tif(display < 0) return;\r\n\t\t\t\t\r\n\t\t\t\tvar value = display/60;\r\n\t\t\t\tvar minute = Math.floor(value).toString(10);\r\n\t\t\t\tif( minute.length <= 1 ) minute = '0' + minute;\r\n\t\t\t\tvalue = display%60;\r\n\t\t\t\tvar second = Math.floor(value).toString(10);\r\n\t\t\t\tif( second.length <= 1 ) second = '0' + second;\r\n\t\t\t\telem.innerHTML = minute + 'm ' + second + ' s';\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfunction whenTimeElapsed() {\r\n\t\t\t\t\r\n\t\t\t\t window.clearInterval(id_interval);\r\n\t\t\t\t window.clearTimeout(id_timeout);\r\n\t\t\t\t \r\n\t\t\t\tvar submit_to_end = document.getElementById('test_play');\r\n\t\t\t\tvar time_elapsed = document.getElementById('time_elapsed');\r\n\t\t\t\ttime_elapsed.value = 1;\r\n\t\t\t\talert('" . $lang->def('_TIME_ELAPSED') . "');\r\n\t\t\t\tsubmit_to_end.submit();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfunction activateCounter() {\r\n\t\t\t\t\r\n\t\t\t\tcounter();\r\n\t\t\t\tid_interval \t= window.setInterval(\"counter()\", step * 1000);\r\n\t\t\t\tid_timeout \t\t= window.setTimeout(\"whenTimeElapsed()\", (start_count_from - 1) * 1000);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tactivateCounter();\r\n\t\t\t// -->\r\n\t\t\t</script>"; $time_string .= Form::getHidden('time_elapsed', 'time_elapsed', '0') . '<br />'; } $GLOBALS['page']->add(getTitleArea($lang->def('_TITLE') . ' : ' . $test_info['title'], 'test', $lang->def('_TEST_INFO')) . '<div class="std_block">' . Form::openForm('test_play', 'index.php?modname=test&op=play', 'std_form', 'post', 'multipart/form-data') . Form::getHidden('next_step', 'next_step', 'play') . Form::getHidden('id_test', 'id_test', $id_test) . Form::getHidden('id_param', 'id_param', $id_param) . Form::getHidden('back_url', 'back_url', $url_coded) . Form::getHidden('idTrack', 'idTrack', $id_track) . $time_string, 'content'); if ($tot_page > 1) { $GLOBALS['page']->add('<div class="align_center">' . $lang->def('_TEST_PAGES') . ' : ' . $page_to_display . ' / ' . $tot_page . '</div><br />', 'content'); } // Page info $GLOBALS['page']->add(Form::getHidden('page_to_save', 'page_to_save', $page_to_display) . Form::getHidden('previous_page', 'previous_page', $page_to_display), 'content'); // FIX sugli ordinamenti random e le risposte a tempo if ($idQuest) { $query_question = str_replace("WHERE", "WHERE q.idQuest = " . $idQuest . " AND", $query_question); } // END FIX // Get question from database $re_question = sql_query($query_question); // Page display $GLOBALS['page']->add('<div class="test_answer_space">', 'content'); $array_answer = array(); $tot_question = 0; while (list($idQuest, $type_quest, $type_file, $type_class, $time_assigned) = sql_fetch_row($re_question)) { require_once $GLOBALS['where_lms'] . '/modules/question/' . $type_file; $quest_obj = eval("return new {$type_class}( {$idQuest} );"); $GLOBALS['page']->add($quest_obj->play($quest_sequence_number, $test_info['shuffle_answer'], $id_track, !$test_info['mod_doanswer'] && !$lock_edit), 'content'); switch ($type_quest) { case 'choice_multiple': case 'choice': case 'associate': case 'text_entry': $query = "SELECT idAnswer, is_correct" . " FROM " . $GLOBALS['prefix_lms'] . "_testquestanswer" . " WHERE idQuest = " . (int) $idQuest; $result = mysql_query($query); while (list($id_answer, $is_correct) = mysql_fetch_row($result)) { $array_answer[$idQuest][$id_answer] = $is_correct; } $array_answer[$idQuest]['type'] = $type_quest; $tot_question++; break; default: break; } // Save question visualization sequence sql_query("\r\n\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_testtrack_quest\r\n\t\t(idTrack, idQuest, page) VALUES \r\n\t\t('" . (int) $id_track . "', '" . (int) $idQuest . "', '" . $page_to_display . "')"); if ($type_quest != 'break_page' && $type_quest != 'title') { ++$quest_sequence_number; } } if ($test_info['mandatory_answer'] == 1) { YuiLib::load(); Util::get_js(Get::rel_path('lms') . '/modules/question/question.js', true, true); cout('<script type="text/javascript">', 'content'); $tot_correct_array = array(); foreach ($array_answer as $id_quest => $quest_info) { switch ($quest_info['type']) { case 'choice_multiple': $tot_correct = 0; foreach ($quest_info as $id_answer => $is_correct) { if ($id_answer !== 'type') { $tot_correct += $is_correct; } } if ($tot_correct == 0) { $tot_question--; } else { cout('YAHOO.util.Event.onDOMReady(configureMultiC, \'\', \'' . (int) $id_quest . '\');' . "\n", 'content'); $tot_correct_array[$id_quest] = $tot_correct; } break; case 'choice': cout('YAHOO.util.Event.onDOMReady(configureSingleC, \'\', \'' . (int) $id_quest . '\');' . "\n", 'content'); break; case 'text_entry': cout('YAHOO.util.Event.onDOMReady(configureTextE, \'\', \'' . (int) $id_quest . '\');' . "\n", 'content'); break; case 'associate': cout('YAHOO.util.Event.onDOMReady(configureAss, \'\', \'' . (int) $id_quest . '\');' . "\n", 'content'); break; } } $js_array = '{'; $first = true; foreach ($tot_correct_array as $id_quest => $num_correct) { if ($first) { $js_array .= '\'_' . $id_quest . '\':' . $num_correct; $first = false; } else { $js_array .= ',\'_' . $id_quest . '\':' . $num_correct; } } $js_array .= '}'; cout('var num_answer_control = ' . $js_array . ';' . "\n" . 'var tot_question = ' . (int) $tot_question . ';' . "\n" . '</script>', 'content'); } $GLOBALS['page']->add('</div>' . '<span id="answer_info" style="color:#FF0000;width:97%;float:right;margin-bottom:5px;text-align:right;padding-right:30px;' . ($tot_question > 0 && $test_info['mandatory_answer'] == 1 ? 'display:block;' : 'display:none;') . '"><b>' . $lang->def('_NEED_ANSWER') . '</b></span>' . '<div class="test_button_space">', 'content'); if ($test_info['save_keep'] == 1) { //save and exit $GLOBALS['page']->add(Form::getButton('test_save_keep', 'test_save_keep', $lang->def('_TEST_SAVE_KEEP')), 'content'); } if ($test_info['can_travel'] && $page_to_display != 1) { //back to the next page $GLOBALS['page']->add(Form::getButton('prev_page', 'prev_page', $lang->def('_TEST_PREV_PAGE')), 'content'); } if ($page_to_display != $tot_page) { //button to the next page $GLOBALS['page']->add(Form::getButton('next_page', 'next_page', $lang->def('_TEST_NEXT_PAGE'), '', $tot_question > 0 && $test_info['mandatory_answer'] == 1 ? ' disabled="disabled"' : ''), 'content'); } else { //button to the result page $GLOBALS['page']->add(Form::getButton('show_result', 'show_result', $lang->def('_TEST_END_PAGE'), '', $tot_question > 0 && $test_info['mandatory_answer'] == 1 ? ' disabled="disabled"' : ''), 'content'); } $GLOBALS['page']->add('</div>' . Form::closeForm() . '</div>', 'content'); }
foreach ($categorias_juridicos as $value) { echo showResult($bd->doInsert("categorias_juridicos", array("nombre" => $value))); } echo "OK Categorias Juridicas!"; break; case "estado": echo $bd->emptyTable("estados"); foreach ($estados as $value) { echo showResult($bd->doInsert("estados", array("nombre" => $value, "paises_id" => 1))); } echo "OK Estados!"; break; case "status_usuario": echo $bd->emptyTable("status_usuarios"); foreach ($status_usuarios as $value) { echo showResult($bd->doInsert("status_usuarios", array("nombre" => $value))); } echo "OK Status Usuarios!"; break; case "amigo": $amigo = new amigos(); echo $bd->emptyTable("usuarios_amigos"); foreach ($bd->query("SELECT * FROM usuarios") as $row) { foreach ($bd->query("SELECT * FROM usuarios WHERE id != {$row["id"]}") as $row2) { if (rand(0, 30) == 30) { $amigo->nuevoAmigo(date('Y-m-d', time()), $row["id"], $row2["id"]); } } } echo "OK Amigos!"; break;
</div> <div class="form-group"> <label for="inputEmail3" class="col-sm-2 control-label">市场价</label> <div class="col-sm-10"> <input name="market_price" value="<?php echo showResult($result, 'market_price'); ?> " type="text" class="form-control" id="inputEmail3"> </div> </div> <div class="form-group"> <label for="inputPassword3" class="col-sm-2 control-label">文章详情</label> <div class="col-sm-10"> <textarea name="content" class="form-control" rows="5"><?php echo showResult($result, 'content'); ?> </textarea> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-default">提交</button> <input type="hidden" name="submit" value="yes"> </div> </div> </form> <?php foot(); } ?>
$new_user = $_GET["new_user"]; echo '<form>' . 'server <input size="80" type="text" name="server" "value="' . $server . '"/>' . '<br />ext_uid <input size="50" type="text" name="ext_uid" "value="' . $ext_uid . '"/>' . '<br />soap_pw <input size="50" type="text" name="soap_pw" "value="' . $soap_pw . '"/>' . '<br />new_user <input size="50" type="text" name="new_user" "value="' . $new_user . '"/> (1 for true, 0 for false)' . '<br /><input type="submit" /><br />' . '<b>The test server will return true/valid, if ext_uid == soap_pw.</b>' . '</form>'; echo "<br /><br />----------------------------------------------<br /><br /> Calling Server..."; // initialize soap client $client = new soap_client($server); if ($err = $client->getError()) { echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; } // isValidSession call //$valid = $client->call('isValidSession', // array('ext_uid' => $ext_uid, // 'soap_pw' => $soap_pw, // 'new_user' => $new_user)); $namespace = "http://testuri.org"; $valid = $client->call('isValidSession', array('ns1:ext_uid' => $ext_uid, 'ns1:soap_pw' => $soap_pw, 'ns1:new_user' => $new_user), $namespace, $namespace . "/isValidSession"); showResult($client, $valid, 'isValidSession'); echo "<br />End Test"; function showResult(&$client, $data, $message) { if ($client->fault) { echo '<h2>Fault</h2><pre>'; print_r($data); echo '</pre>'; } else { // Check for errors $err = $client->getError(); if ($err) { // Display the error echo '<h2>Error</h2><pre>' . $err . '</pre>'; exit; } else {
$missing = $missing . " [category] "; }*/ if (empty($_POST["media_length"]) || !isset($_POST["media_length"])) { $missing = $missing . " [length] "; } if (!is_numeric($_POST["media_length"]) || $_POST["media_length"] < 1) { $missing = $missing . " [length must be a positive number]"; } if ($missing == "") { $title = htmlspecialchars($_POST["media_title"]); $category = htmlspecialchars($_POST["media_category"]); $length = htmlspecialchars($_POST["media_length"]); addItemToTable($mysqli, $dbname, $title, $category, $length); showResult($mysqli, "ShowAll"); } else { showError("Missing information: {$missing} "); showResult($mysqli, "ShowAll"); } } $deleteRecord = isset($_POST['deleteRecord']) ? $_POST['deleteRecord'] : false; if ($deleteRecord) { removeItemFromTable($mysqli, $_POST['deleteRecord']); showResult($mysqli, "ShowAll"); } } else { showResult($mysqli, "ShowAll"); } $mysqli->close(); ?>
<tr> <td> NNTP server </td> <td> <?php showResult(empty($settings['nntp_nzb']['host']) === false, $settings['nntp_nzb']['host'], "No server entered"); ?> </td> </tr> <?php if ($settings['nntp_nzb'] != $settings['nntp_hdr']) { ?> <tr> <td> NNTP server (headers) </td> <td> <?php showResult(empty($settings['nntp_hdr']['host']) === false, $settings['nntp_hdr']['host'], "No server entered"); ?> </td> </tr> <?php } if ($settings['nntp_nzb'] != $settings['nntp_post']) { ?> <tr> <td> NNTP server (post) </td> <td> <?php showResult(empty($settings['nntp_post']['host']) === false, $settings['nntp_post']['host'], "No server entered"); ?> </td> </tr> <?php } ?> </table> <br /> <table summary="Include files"> <tr> <th> Include files </th> <th> Result </th> </tr> <tr> <td> Settings file </td> <td> <?php $result=testInclude("settings.php"); echo showResult($result, $result); ?> </td> </tr> <tr> <td> Own settings file </td> <td> <?php $result=testInclude("ownsettings.php"); echo showResult($result, $result, "optioneel"); ?> </td> </tr> <tr> <td> <a href="http://pear.php.net/">PEAR</a> </td> <td> <?php $result=testInclude("System.php"); echo showResult($result, $result); ?> </td> </tr> <tr> <td> <a href="http://pear.php.net/package/Net_NNTP">Net_NNTP</a> </td> <td> <?php $result=testInclude("Net".DIRECTORY_SEPARATOR."NNTP".DIRECTORY_SEPARATOR."Client.php"); echo showResult($result, $result); ?> </td> </tr> </table> <br /> </body> </html><?php function return_bytes($val) { $val = trim($val); $last = strtolower($val[strlen($val)-1]); switch($last) { // The 'G' modifier is available since PHP 5.1.0 case 'g': $val *= 1024; case 'm': $val *= 1024; case 'k':
echo "<h3>" . _('Error') . $sq->getErrorMessage() . "</h3>"; } else { showResult($sh, $s, $sq, 1, 0, $graph); } } } else { echo '<h2>' . $s->getTitle() . ' ( ' . $s->getNumberOfVotes() . ' Votes )</h2><p/>'; /* Get questions of this survey */ $questions =& $s->getQuestionInstances(); $question_number = 1; for ($i = 0; $i < count($questions); $i++) { if ($questions[$i]->isError()) { echo $questions[$i]->getErrorMessage(); } else { if ($questions[$i]->getQuestionType() != '4') { showResult($sh, $s, $questions[$i], $show_comment, $question_number++, $graph); } } } } } /* Show list of Surveys with result link */ /* Show list of Servey */ $sf = new SurveyFactory($g); $ss =& $sf->getSurveys(); if (!$ss) { echo _('No Survey Question is found'); } else { echo $sh->ShowSurveys($ss, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1); } $sh->footer(array());
} else { if (strtolower(trim($_POST['filterbtn'])) == "filter tournaments") { $aksi2 = "filter"; } } switch ($aksi2) { case "cancel": $template = "tour_rest.tpl"; $showList = true; reload($smarty); break; case "result": $template = "tour_result.tpl"; $showList = true; $showDetail = true; showResult($smarty); break; case "filter": $template = "tour_rest.tpl"; $smarty->assign("batas", true); $showList = true; filter($smarty); break; default: $template = "tour_rest.tpl"; $showList = true; reload($smarty); break; } // assign template $smarty->assign('judul', "Tournaments Event List");
showResult(is_writable('./cache'), true); ?> </td> </tr> </table> <br /> <table summary="Include files"> <tr> <th> Include files </th> <th> Result </th> </tr> <tr> <td> Settings file </td> <td> <?php $result = testInclude("settings.php"); echo showResult($result, true, $result); ?> </td> </tr> <tr> <td> Own settings file </td> <td> <?php $result = testInclude("ownsettings.php"); echo showResult($result, true, $result, "optional"); ?> </td> </tr> </table> <br /> <?php if ($_testInstall_Ok) { ?> <table summary="result" class="tableresult"> <tr> <th colspan="2"> Please continue to setup Spotweb </th> <th> <a href="?page=2" class="button" >Next</a> </th> </tr> </table> <br />
function playPollDispatch($object_poll, $id_param) { //-kb-play-// if(!checkPerm('view', true, 'organization') && !checkPerm('view', true, 'storage')) die("You can't access"); require_once _base_ . '/lib/lib.form.php'; require_once $GLOBALS['where_lms'] . '/class.module/track.poll.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.param.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.poll.php'; $id_poll = $object_poll->getId(); $id_reference = getLoParam($id_param, 'idReference'); $url_coded = urlencode(serialize($object_poll->back_url)); $id_track = retriveTrack($id_reference, $id_poll, getLogUserId()); if (isset($_POST['show_result'])) { // continue a poll completed, show the result showResult($object_poll, $id_param); } else { // play poll play($object_poll, $id_param); } }
<?php require_once './functions.php'; //pdo.dsn.TL = 'mysql:host=localhost;dbname=test;' //$dsn = 'TL'; //$dsn = 'uri:file:///D:/phpStudy/WWW/study/mysql/dsn.txt'; $dsn = 'mysql:host=localhost;port=3307;dbname=test'; $attrArr = array('AUTOCOMMIT', 'ERRMODE', 'CASE', 'PERSISTENT', 'ORACLE_NULLS', 'TIMEOUT', 'SERVER_INFO', 'SERVER_VERSION', 'CLIENT_VERSION', 'CONNECTION_STATUS'); try { $pdo = new PDO($dsn, 'root', 'gyz.123'); //$sql = 'show create database test'; $sql = ' show create database test_db'; $state = $pdo->prepare($sql); $res = $state->execute(); if ($res) { //echo $state->rowCount(); showResult($state); } else { $errArr = $pdo->errorInfo(); printf('Error:%d(%s)%s', $errArr[1], $pdo->errorCode(), $errArr[2]); } } catch (PDOException $e) { echo $e->getMessage; }
} // Process the file /* At this point we are ready to process the valid file. This sample code shows how to save the file. Other tasks could be done such as creating an entry in a database or generating a thumbnail. Depending on your server OS and needs you may need to set the Security Permissions on the file after it has been saved. */ if (!@move_uploaded_file($_FILES[$upload_name]["tmp_name"], $save_path . $file_name)) { HandleError("File could not be saved."); exit(0); } // success $file_url = getUploadedFileUrl($upload_path, $file_name); showResult(true, $file_url, "upload completed"); exit(0); function generateFilename($filename) { $ext = substr($filename, strripos($filename, '.')); $result = base64_encode($filename) . '_' . time() . $ext; return $result; } function getUploadedFileUrl($upload_path, $file_name) { $url = getUploadedPath($upload_path) . $file_name; return $url; } function showResult($success, $fileurl, $message) { $result = array('success' => $success, 'file_url' => $fileurl, 'message' => $message);
<?php } ?> </table> <br /> <table summary="Include files"> <tr> <th> Include files </th> <th> Result </th> </tr> <tr> <td> Settings file </td> <td> <?php $result = testInclude("settings.php"); echo showResult($result, $result); ?> </td> </tr> <tr> <td> Own settings file </td> <td> <?php $result = testInclude("ownsettings.php"); echo showResult($result, $result, "optioneel"); ?> </td> </tr> </table> <br /> </body> </html><?php function return_bytes($val) { $val = trim($val); $last = strtolower($val[strlen($val) - 1]); switch ($last) { // The 'G' modifier is available since PHP 5.1.0 case 'g': $val *= 1024;
function getCalleeLink($fromHash, $toHash) { global $link; $fromHash = mysql_real_escape_string($fromHash); $toHash = mysql_real_escape_string($toHash); $callerName = getDisplayName($toHash); $userClient = new SoapClient(OM_SERVER_ADDRESS . '/services/UserService?wsdl'); $roomClient = new SoapClient(OM_SERVER_ADDRESS . '/services/RoomService?wsdl'); $session = $userClient->getSession(); $loginResult = $userClient->loginUser(array('SID' => $session->return->session_id, 'username' => OM_ADMIN_LOGIN, 'userpass' => OM_ADMIN_PASS)); if ($loginResult > 0) { //Successfully logged in, searching for a room, if its created $confs = $roomClient->getRooms(array('SID' => $session->return->session_id, 'start' => 0, 'max' => 100, 'orderby' => 'name', 'asc' => true))->return->result; $roomId = null; foreach ($confs as $value) { if ($value->name == $fromHash . $toHash) { //room exists, returning link to it $roomId = $value->rooms_id; } } if ($roomId == null) { //room doesn't exist, creating one and returning a link $addRoomResult = $roomClient->addRoomWithModeration(array('SID' => $session->return->session_id, 'name' => $fromHash . $toHash, 'roomtypes_id' => 1, 'comment' => 'Call room', 'numberOfPartizipants' => 2, 'ispublic' => true, 'appointment' => false, 'isDemoRoom' => false, 'demoTime' => 0, 'isModeratedRoom' => true))->return; if ($addRoomResult > 0) { $roomId = $addRoomResult; } else { dieWithMessage(METHOD_GETCALLEELINK, 'Failed to add a room'); } } $setUserObjectResult = $userClient->setUserObjectAndGenerateRoomHash(array('SID' => $session->return->session_id, 'username' => $callerName, 'firstname' => $callerName, 'lastname' => '', 'profilePictureUrl' => '', 'email' => '', 'externalUserId' => 0, 'externalUserType' => 'caller', 'room_id' => $roomId, 'becomeModeratorAsInt' => 0, 'showAudioVideoTestAsInt' => 2))->return; if ($setUserObjectResult != null) { showResult(METHOD_GETCALLEELINK, OM_SERVER_ADDRESS . '/openmeetings/main.lzx.swf8.swf?secureHash=' . $setUserObjectResult); } else { dieWithMessage(METHOD_GETCALLEELINK, "Setting user object failed"); } } else { dieWithMessage(METHOD_GETCALLEELINK, "Login failed"); } }
break; case 'searchSubmit': $ids = NULL; if (isset($_POST['ircuserid'])) { $posted = $_POST['ircuserid']; foreach ($posted as $id) { $ids .= $id . ","; } $len = strlen($ids); $ids = substr($ids, 0, $len - 1); } switch ($_POST['submitAction']) { case 'explore': if (!is_null($ids)) { $matches = $thispage->exploreRelatedUsers($ids); showResult($matches); } break; case 'Generate image': if (!is_null($ids)) { $key = $thispage->static_put($ids); echo "<img src=getimage.php?type=" . $_POST['maptype'] . "&ids={$key}>"; } break; case 'relation': if (!is_null($ids)) { echo "<table border=1>"; $relarray = $thispage->getUserRelations($ids); foreach ($relarray as $reluser) { echo "<tr><td>"; echo "<a href='?action=search&nicksearch=is&nickvalue=" . $reluser[0] . "'>" . $reluser[0] . "</a>";
function performAndPrintTests() { global $settings; global $_testInstall_Ok; ?> <table summary="PHP settings"> <tr> <th> PHP settings </th> <th> Value </th> <th> Result </th> </tr> <tr> <td> PHP version </td> <td> <?php echo phpversion(); ?> </td> <td> <?php showResult(version_compare(PHP_VERSION, '5.3.0') >= 0, true, "", "PHP 5.3 or later is recommended"); ?> </td> </tr> <tr> <td> timezone settings </td> <td> <?php echo ini_get("date.timezone"); ?> </td> <td> <?php showResult(ini_get("date.timezone"), true, "", "Please specify date.timezone in your PHP.ini"); ?> </td> </tr> <tr> <td> Open base dir </td> <td> <?php echo ini_get("open_basedir"); ?> </td> <td> <?php showResult(!ini_get("open_basedir"), true, "", "Not empty, <strong>might</strong> be a problem"); ?> </td> </tr> <tr> <td> Allow furl open </td> <td> <?php echo ini_get("allow_url_fopen"); ?> </td> <td> <?php showResult(ini_get("allow_url_fopen") == 1, true, "", "allow_url_fopen not on -- will cause problems to retrieve external data"); ?> </td> </tr> <tr> <td> PHP safe mode </td> <td> <?php echo ini_get("safe_mode"); ?> </td> <td> <?php showResult(!ini_get("safe_mode"), true, "", "Safe mode set -- will cause problems for retrieve.php"); ?> </td> </tr> <tr> <td> Memory limit </td> <td> <?php echo ini_get("memory_limit"); ?> </td> <td> <?php showResult(return_bytes(ini_get("memory_limit")) >= 128 * 1024 * 1024, true, "", "memory_limit below 128M"); ?> </td> </tr> </table> <br /> <table summary="PHP extensions"> <tr> <th colspan="2"> PHP extension </th> <th> Result </th> </tr> <tr> <td colspan="2"> ctype </td> <td> <?php showResult(extension_loaded('ctype'), true); ?> </td> </tr> <tr> <td colspan="2"> curl </td> <td> <?php showResult(extension_loaded('curl'), true); ?> </td> </tr> <tr> <td colspan="2"> DOM </td> <td> <?php showResult(extension_loaded('dom'), true); ?> </td> </tr> <tr> <td colspan="2"> gettext </td> <td> <?php showResult(extension_loaded('gettext'), false); ?> </td> </tr> <tr> <td colspan="2"> mbstring </td> <td> <?php showResult(extension_loaded('mbstring'), true); ?> </td> </tr> <tr> <td colspan="2"> xml </td> <td> <?php showResult(extension_loaded('xml'), true); ?> </td> </tr> <tr> <td colspan="2"> zip </td> <td> <?php showResult(extension_loaded('zip'), false, "", "You need this module to select multiple NZB files"); ?> </td> </tr> <tr> <td colspan="2"> zlib </td> <td> <?php showResult(extension_loaded('zlib'), true); ?> </td> </tr> <tr> <th colspan="2"> Database support </th> <td> <?php showResult(extension_loaded('mysql') || extension_loaded('pdo_mysql') || extension_loaded('pdo_pgsql'), true); ?> </td> </tr> <tr> <td colspan="2"> DB::mysql </td> <td> <?php showResult(extension_loaded('mysql'), false); ?> </td> </tr> <tr> <td colspan="2"> DB::pdo_mysql </td> <td> <?php showResult(extension_loaded('pdo_mysql'), false); ?> </td> </tr> <tr> <td colspan="2"> DB::pgsql </td> <td> <?php showResult(extension_loaded('pdo_pgsql'), false); ?> </td> </tr> <?php if (extension_loaded('gd')) { $gdInfo = gd_info(); } ?> <tr> <th colspan="2"> GD </th> <td> <?php showResult(extension_loaded('gd'), true); ?> </td> </tr> <tr> <td colspan="2"> FreeType Support </td> <td> <?php showResult($gdInfo['FreeType Support'], true); ?> </td> </tr> <tr> <td colspan="2"> GIF Read Support </td> <td> <?php showResult($gdInfo['GIF Read Support'], true); ?> </td> </tr> <tr> <td colspan="2"> GIF Create Support </td> <td> <?php showResult($gdInfo['GIF Create Support'], true); ?> </td> </tr> <tr> <td colspan="2"> JPEG Support </td> <td> <?php showResult($gdInfo['JPEG Support'] || $gdInfo['JPG Support'], true); ?> </td> </tr> <!-- Previous to PHP 5.3.0, the JPEG Support attribute was named JPG Support. --> <tr> <td colspan="2"> PNG Support </td> <td> <?php showResult($gdInfo['PNG Support'], true); ?> </td> </tr> <tr> <th colspan="3"> OpenSSL </th> </tr> <?php require_once "lib/services/Signing/Services_Signing_Base.php"; require_once "lib/services/Signing/Services_Signing_Php.php"; require_once "lib/services/Signing/Services_Signing_Openssl.php"; $spotSigning = Services_Signing_Base::newServiceSigning(); $privKey = $spotSigning->createPrivateKey($settings['openssl_cnf_path']); /* We need either one of those 3 extensions, so set the error flag manually */ if (!extension_loaded('openssl') && !extension_loaded('gmp') && !extension_loaded('bcmath')) { $_testInstall_Ok = false; } # if ?> <tr> <td rowspan="3"> At least 1 of these must be OK <br />these modules are sorted from fastest to slowest</td> <td> openssl </td> <td> <?php showResult(extension_loaded('openssl'), false); ?> </td> </tr> <tr> <td> gmp </td> <td> <?php showResult(extension_loaded('gmp'), false); ?> </td> </tr> <tr> <td> bcmath </td> <td> <?php showResult(extension_loaded('bcmath'), false); ?> </td> </tr> <tr> <td colspan="2"> Can create private key? </td> <td> <?php showResult(isset($privKey['public']) && !empty($privKey['public']) && !empty($privKey['private']), true); ?> </td> </tr> </table> <br /> <table summary="Include files"> <tr> <th> Include files </th> <th> Result </th> </tr> <tr> <td> Settings file </td> <td> <?php $result = testInclude("settings.php"); echo showResult($result, true, $result); ?> </td> </tr> <tr> <td> Own settings file </td> <td> <?php $result = testInclude("ownsettings.php"); echo showResult($result, true, $result, "optional"); ?> </td> </tr> </table> <br /> <?php if ($_testInstall_Ok) { ?> <table summary="result" class="tableresult"> <tr> <th colspan="2"> Please continue to setup Spotweb </th> <th> <a href="?page=1" class="button" >Next</a> </th> </tr> </table> <br /> <?php } else { ?> <table summary="result"> <tr> <th> Please fix above errors before you can continue to install Spotweb </th> </tr> </table> <br /> <?php } ?> </body> </html> <?php }
function performAllUpgrades() { global $default; $query = sprintf('SELECT value FROM %s WHERE name = "databaseVersion"', $default->system_settings_table); $lastVersion = DBUtil::getOneResultKey($query, 'value'); $currentVersion = $default->systemVersion; $upgrades = describeUpgrade($lastVersion, $currentVersion); foreach ($upgrades as $upgrade) { if ($GLOBALS['row'] % 2 == 1) { $class = "odd"; } else { $class = "even"; } printf('<div class="row %s"><div class="foo">%s</div>' . "\n", $class, htmlspecialchars($upgrade->getDescription())); $GLOBALS['row']++; ob_flush(); flush(); $res = $upgrade->performUpgrade(); printf('<div class="bar">%s</div>', showResult($res)); print '<br style="clear: both">' . "\n"; ob_flush(); flush(); print "</div>\n"; if (PEAR::isError($res)) { if (!is_a($res, 'Upgrade_Already_Applied')) { break; } else { $res = true; } } if ($res === false) { $res = PEAR::raiseError("Upgrade returned false"); break; } } return $res; }
$journal[$date][$company] = array(array($drug), $amount); } } else { if ($startDate <= $date) { // new date $new_company = array(array($drug), $amount); $journal[$date] = array($company => $new_company); } } } foreach ($journal as $date => &$values) { ksort($values); foreach ($values as &$items) { sort($items[0]); } } ksort($journal); echo showResult($journal); function showResult($array) { $result = "<ul>"; foreach ($array as $date => $company) { $result .= "<li><p>" . date("d/m/Y", $date) . "</p>"; foreach ($company as $name => $values) { $result .= "<ul><li><p>{$name}</p><ul>"; $result .= "<li><p>" . implode(',', $values[0]) . "-{$values[1]}lv</p></li></ul></li></ul>"; } $result .= "</li>"; } return "{$result}</ul>"; }
function outputSuccess($value) { // ************************************************* // function outputSuccess // Parameters: // $value: value or return string of an function (should be TRUE or FALSE) // Return value: $value // // Outputs OK or NOK for the operation incl. a CSS-class // ************************************************* $this->success = showResult($value, "OK", "NOK"); }