function expect_times($expected, $times, $testCase) { $totalDuration = 0; for ($run = 0; $run < $times; $run++) { $testResult = expect($expected, $testCase); if (!$testResult->success) { print "Run " . $run . " failed"; print_result($testResult); break; } $totalDuration += $testResult->duration; } $averageDuration = $totalDuration / $times; print "Average duration: " . format_duration($averageDuration) . " \n"; }
function boolean_expressions($c) { $t = \hacklib_cast_as_boolean(is_array($c)) ? "Array" : $c->__toString(); $isEmpty = \hacklib_cast_as_boolean(is_array($c)) ? !isset($c) || \hacklib_equals($c, false) : $c->isEmpty(); $isEmptyStr = \hacklib_cast_as_boolean($isEmpty) ? "Empty" : "Not Empty"; echo "\nTesting a {$t} that is {$isEmptyStr} \n"; $b = (bool) \hacklib_cast_as_boolean($c); print_result("(bool) Cast", $b); $b = (bool) \hacklib_cast_as_boolean($c); print_result("(boolean) Cast", $b); print_result("&& left", \hacklib_cast_as_boolean($c) && true); print_result("&& right", true && \hacklib_cast_as_boolean($c)); print_result("&& both", \hacklib_cast_as_boolean($c) && \hacklib_cast_as_boolean($c)); print_result("|| left", \hacklib_cast_as_boolean($c) || false); print_result("|| right", false || \hacklib_cast_as_boolean($c)); print_result("|| both", \hacklib_cast_as_boolean($c) || \hacklib_cast_as_boolean($c)); print_result("! ", !\hacklib_cast_as_boolean($c)); print_result("Eif", \hacklib_cast_as_boolean($c) ? true : false); }
if ($row['bg_flag'] == 'good') { $status = '추천'; } else { $status = '비추천'; } $error = "이미 {$status} 하신 글 입니다."; print_result($error, $count); } else { // 추천(찬성), 비추천(반대) 카운트 증가 sql_query(" update {$g5['write_prefix']}{$bo_table} set wr_{$good} = wr_{$good} + 1 where wr_id = '{$wr_id}' "); // 내역 생성 sql_query(" insert {$g5['board_good_table']} set bo_table = '{$bo_table}', wr_id = '{$wr_id}', mb_id = '{$member['mb_id']}', bg_flag = '{$good}', bg_datetime = '" . G5_TIME_YMDHIS . "' "); $sql = " select wr_{$good} as count from {$g5['write_prefix']}{$bo_table} where wr_id = '{$wr_id}' "; $row = sql_fetch($sql); $count = $row['count']; print_result($error, $count); } } } else { include_once G5_PATH . '/head.sub.php'; if (!$is_member) { $href = './login.php?$qstr&url=' . urlencode('./board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id); alert('회원만 가능합니다.', $href); } if (!($bo_table && $wr_id)) { alert('값이 제대로 넘어오지 않았습니다.'); } $ss_name = 'ss_view_' . $bo_table . '_' . $wr_id; if (!get_session($ss_name)) { alert('해당 게시물에서만 추천 또는 비추천 하실 수 있습니다.'); }
#****************************************************************************** # This file is a sample demonstrating integration with the PxPay interface using PHP with the cURL extension installed. #Inlcude PxPay objects include "PxPay_Curl.inc.php"; $PxPay_Url = "https://www.paymentexpress.com/pxpay/pxaccess.aspx"; $PxPay_Userid = "UserId"; #Important! Update with your UserId $PxPay_Key = "Encryptionkey"; #Important! Update with your Key # # MAIN # $pxpay = new PxPay_Curl($PxPay_Url, $PxPay_Userid, $PxPay_Key); if (isset($_REQUEST["result"])) { # this is a redirection from the payments page. print_result(); } elseif (isset($_REQUEST["Submit"])) { # this is a post back -- redirect to payments page. redirect_form(); } else { # this is a fresh request -- display the purchase form. print_form(); } #****************************************************************************** # This function receives information back from the payments page, # and displays it to the user. #****************************************************************************** function print_result() { global $pxpay; $enc_hex = $_REQUEST["result"];
} else { $s = 1; } // loop through classes $scan = scandir('extractors'); $done = FALSE; foreach ($scan as $entry) { if ($pos = strpos($entry, '.php')) { $classname = substr($entry, 0, $pos); include 'extractors/' . $entry; $object = new $classname(); if ($object->can_extract($url)) { echo 'Calling ' . $classname; $result = $object->extract(expand_columns($cols), $s, $n, $url); $result = merge_result($cols, $result); print_result($cols, $result); $done = TRUE; break; } } } if (!$done) { echo 'NOT SUPPORTED'; } } ?> </div> <script> var item = -1;
<?php require dirname(__DIR__) . '/vendor/autoload.php'; use Footstones\RPC\Client; // $client = new Client('http://localhost/footstones/rpc/example/server.php'); $client = new Client('http://127.0.0.1:10000'); print_result('result1', $client->echoName('li lei')); function print_result($label, $result) { echo "<p>{$label}:</p>"; echo "<pre>"; var_dump($result); echo "</pre>"; }
print_result($result); if (isset($result['entry_list'][0]['id'])) { $note_id = $result['entry_list'][0]['id']; echo '<br><br><b>Get attachment to a note - portal_get_note_attachment test:</b><BR>'; $result = $soapclient->call('portal_get_note_attachment', array('session' => $session, 'id' => $note_id)); print_result($result); print_r($result); echo '<br>It Reads:' . base64_decode($result['note_attachment']['file']); } else { echo '<br> Note attaching failed<br>'; } echo '<br><br><b>logout - portal_logout test:</b><BR>'; $result = $soapclient->call('portal_logout', array('session' => $session)); print_result($result); echo '<br><br>Now test entry_lists<br>'; echo '<br><br><b>LOGIN: -portal_login test</b><BR>'; $result = $soapclient->call('portal_login', array('user_auth' => array('user_name' => $user_name, 'password' => md5($user_password), 'version' => '.01'), 'user_name' => $contact_name, 'application_name' => 'SoapTest')); $session = $result['id']; echo '<b>Get Portal Contact Id: - portal_get_portal_id test</b><BR>'; $result = $soapclient->call('portal_get_sugar_id', array('session' => $session)); print_result($result); echo '<br><br><b>Get cases - portal_get_entry_list test:</b><BR>'; $timestart = microtime(true); $result = $soapclient->call('portal_get_entry_list', array('session' => $session, 'module_name' => 'Cases', 'where' => '', 'order_by' => '', 'offset' => 0, 'select_fields' => array('name', 'date_modified', 'description'))); $diff = microtime(true) - $timestart; echo "<b>Time for retrieving Cases is {$diff} </b> <br><br>"; print_result($result); echo '<br><br><b>logout - portal_logout test:</b><BR>'; $result = $soapclient->call('portal_logout', array('session' => $session)); print_result($result); }
$interface_map = array('getUserByUid' => 'getUserByUid', 'getOrderInfo' => 'getOrderInfo', 'getInfo' => 'getInfo', 'getLists' => 'getLists', 'update' => 'update', 'delete' => 'delete'); $module = array_rand($module_map); $interface = array_rand($interface_map); $msg_array = array('参数错误', '数据库链接超时', '数据库无法链接,请稍后重试', '用户不存在', '网络繁忙,请稍后再试'); $msg = $msg_array[array_rand($msg_array)]; $code = rand(11011, 11100); $suc = rand(1, 9999) < 9997 ? true : false; // === 上报结果 === $ret = StatisticClient::report($module, $interface, $code, $msg, $suc); } print_result(); exit(""); } } while (!empty($pid_array)) { $pid = pcntl_wait($status); if ($pid > 0) { unset($pid_array[$pid]); } } echo "DONE ........"; print_result($req_cnt * $proc_cnt); die; function print_result($cnt = null) { global $fail_cnt, $time_start, $proc_cnt, $req_cnt; if ($cnt == null) { $cnt = $req_cnt; } echo "\n", $cnt / (microtime(true) - $time_start), "req/S fail count {$fail_cnt}\n"; }
sql_query(" update {$g5['board_new_table']} set as_{$good} = as_{$good} + 1 where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' ", false); // 내역 생성 sql_query(" insert {$g5['board_good_table']} set bo_table = '{$bo_table}', wr_id = '{$wr_id}', mb_id = '{$member['mb_id']}', bg_flag = '{$good}', bg_datetime = '" . G5_TIME_YMDHIS . "' "); // APMS : 내글반응 apms_response('wr', $good, '', $bo_table, $wr_id, $write['wr_subject'], $write['mb_id'], $member['mb_id'], $member['mb_nick']); $sql = " select wr_{$good} as count from {$g5['write_prefix']}{$bo_table} where wr_id = '{$wr_id}' "; $row = sql_fetch($sql); $count = $row['count']; if ($good == 'good') { $status = $txt_good ? $txt_good : '추천'; } else { $status = $txt_nogood ? $txt_nogood : '비추천'; } $success = $status . " 하셨습니다."; @(include_once $board_skin_path . '/good.tail.skin.php'); print_result($error, $success, $count); } } } else { include_once G5_PATH . '/head.sub.php'; if (!$is_member) { $href = './login.php?' . $qstr . '&url=' . urlencode('./board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id); alert('회원만 가능합니다.', $href); } if (!($bo_table && $wr_id)) { alert('값이 제대로 넘어오지 않았습니다.'); } $ss_name = 'ss_view_' . $bo_table . '_' . $wr_id; if (!get_session($ss_name)) { alert('해당 게시물에서만 추천 또는 비추천 하실 수 있습니다.'); }
} } } $DEBUG = 1; $index = 0; foreach ($tests as $testname) { // Test just this one rule. $MATCH_LIST = array($testname); $firstname = $names[$index]; $secondname = $names[$index + 1]; $firstresult = gender($firstname); $secondresult = gender($secondname); $firstexpected = $genders[$firstname]; $secondexpected = $genders[$secondname]; print_result($testname, $firstname, $firstresult, $firstexpected); print_result($testname, $secondname, $secondresult, $secondexpected); $index += 1; } print '</body></html>'; function user_sub($name) { if (preg_match('/^eamon/', $name)) { return 'm'; } } function print_result($testname, $name, $result, $expected) { if (isset($result)) { if ($result['gender'] !== $expected) { print "ERROR: {$testname} produced '{$result['gender']}' for {$name}, expected '{$expected}'<br>"; } else {
if (top.HEURIST && top.HEURIST.firedEvents["heurist-search-html-loaded"] && top.HEURIST.firedEvents["heurist-search-js-loaded"] && top.HEURIST.firedEvents["heurist-obj-common-loaded"]) top.HEURIST.search.searchNotify(results); <?php $num = 0; $page = 0; $results = array(); $first_of_page = true; $rectypes = array(); print "results.records.push(\n"; while ($row = mysql_fetch_row($res)) { if (!$first_of_page) { print ",\n"; } $rectypes[$row[4]] = $row[4]; print_result($row); $first_of_page = false; if ($num % RESULTS_PER_PAGE == 0) { print "\n);\n"; print "if (top.HEURIST && top.HEURIST.firedEvents[\"heurist-search-html-loaded\"] && top.HEURIST.firedEvents[\"heurist-search-js-loaded\"] && top.HEURIST.firedEvents[\"heurist-obj-common-loaded\"]) top.HEURIST.search.searchResultsNotify(results, " . $page * RESULTS_PER_PAGE . ");\n"; print "</script>\n"; ob_flush(); print " <script type=\"text/javascript\">\n"; print "results.records.push(\n"; ++$page; $first_of_page = true; } array_push($results, $row); if ($num_rows <= SEARCH_SET_SAVE_LIMIT) { array_push($_SESSION[HEURIST_SESSION_DB_PREFIX . 'heurist']['search-results'][$sid]["infoByDepth"][0]["recIDs"], $row[2]); $_SESSION[HEURIST_SESSION_DB_PREFIX . 'heurist']['search-results'][$sid]["infoByDepth"][0]["count"]++;
if (trim($out) == "") { break; } sleep(1); } if (isset($_POST['search_smart'])) { print_result("SMART"); } if (isset($_POST['search_lehreronline'])) { print_result("Lehrer-Online"); } if (isset($_POST['search_learnline'])) { print_result("Learnline-NRW"); } if (isset($_POST['search_problem'])) { print_result("Problemloesenlernen.de"); } } echo '<br><div align="right"><a href="' . $download_url . '#top">Nach oben >></a></div>'; echo '<style type="text/css">.download_remark { display: none; visible: none }</style>'; } else { echo '<form name="mat_suche" enctype="multipart/form-data" action="' . $download_url . '" method="POST">'; ?> <div> <table> <tr><td colspan="3" align="left"><h3>Schlagwortsuche</h3></td></tr> <tr><td align="right"><nobr>Schlagworte </td> <td align="left"><input name="search_light" type="text" size="32" maxlength="64"></nobr></td> <td align="right"><nobr><input type="radio" name="search_light_form" value="AND" checked="checked">UND<input type="radio" name="search_light_form" value="OR">ODER</nobr></td> <tr><td align="right" rowspan="4">Kooperierende Materialserver <a href="javascript:alert('Bitte beachten Sie folgende Punkte bei einer Integration\nder kooperierenden Server:\n\n- Es kann zu Zeitverzögerungen (maximal 60 Sekunden) kommen.\n- Es ist nur eine (UND / ODER) Schlagwortsuche möglich.\n- Eingegebene Kategorien und Datumsangaben werden bei der\n externen Suche nicht berücksichtigt.')">(Hinweis!)</a></td><td align="left"><nobr><input type="checkbox" name="search_smart">SMART</nobr></td><td></td></tr> <tr><td align="left"><nobr><input type="checkbox" name="search_lehreronline">Lehrer-Online</nobr></td><td></td></tr>
); // Actual Tests run foreach ($tests as $test) { if (isset($config->run_only) && $config->run_only->test_name != $test->name) { continue; } $start = 1; if (isset($config->run_only->start_with_run_num)) { $start = $config->run_only->start_with_run_num; } foreach (range($start, $test->repetitions) as $run_num) { check_pool_is_empty(); $ok = call_user_func($test->code, $run_num); print_result($test->name, $ok); wait(); check_pool_is_empty(); } } // Functions function print_result($test, $ok) { global $num_test; echo date("M ") . sprintf('%2d', (int) date("d")) . date(" H:i:s "); echo " Test #" . ($num_test++) . ": $test: " . ($ok ? 'OK' : 'FAILED') . "\n"; if (!$ok) { die("\n"); } }
function show_result() { $id = intval($_REQUEST['id']); $sql = mysql_query("SELECT * FROM lab3_result WHERE r_result={$id}"); $row = mysql_fetch_assoc($sql); print_result($row['r_text']); }
} for ($j = $i; $j < $n - $i; $j++) { $v = array_shift($left); if ($v != 'X') { $result[$j][$i] = $v; } $v = array_shift($right); if ($v != 'X') { $result[$j][$n - $i - 1] = $v; } } $i++; } while ($i < $n / 2 - 1); $final_result = $result; foreach ($final_result as $r => $row) { foreach ($row as $c => $col) { if ($col == 'X') { $final_result[$r][$c] = $items[$r][$c]; } } } print_result($final_result); function print_result($result = array()) { foreach ($result as $row) { foreach ($row as $col) { echo $col . ' '; } echo "\n"; } }