function sendRequest() { global $action; if (count($action) !== 2 || $action[0] === '' || $action[1] === '') { handle(ERROR_INPUT . '00' . 'Request Error.'); } $requestFile = $action[0] . '.request.php'; if (file_exists($requestFile)) { include $requestFile; } else { handle(ERROR_INPUT . '01' . 'Request Error.'); } }
<?php /** * Author : Jan Germann * Datum : 03.05.2010 * Modul : config * Beschreibung : Persönliche Einstellungen. */ $_SESSION['content'] = handle(); function handle() { if (!$_POST['submit']) { return showForm(); } else { return editData(); } } /** * Zeigt das Formular mit eigenen Daten an */ function showForm() { global $mysql, $user; $qUser = $mysql->query("SELECT * FROM " . _PREFIX_ . "user WHERE id='" . $user->id . "'"); $o = mysql_fetch_object($qUser); $tpl = @file_get_contents(dirname(__FILE__) . "/template/form.edit.tpl"); $tpl = str_replace(array("%vorname%", "%nachname%", "%email%"), array(isset($_POST['vorname']) ? $_POST['vorname'] : $o->vorname, isset($_POST['nachname']) ? $_POST['nachname'] : $o->nachname, isset($_POST['email']) ? $_POST['email'] : $o->email), $tpl); return $tpl; } /** * Bearbeitet die im POST-Array übergebenen Werte
<?php //url取得 $params = explode('/', $_GET['url']); //一つ目の要素を$modelに $model = array_shift($params); //対応したファイルのモデル名をinclude include './models/' . $model . '.php'; //$retに関数を渡す $ret = handle($params); //$retを展開 extract($ret); //実際の表示 include './views/template.html';
/** * This file is part of the sfSearch package. * (c) Carl Vondrick <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ require dirname(__FILE__) . '/../../bootstrap/unit.php'; require 'event/sfEventDispatcher.class.php'; require 'event/sfEvent.class.php'; require 'log/xfLogger.interface.php'; require 'log/xfLoggerEventDispatcher.class.php'; $t = new lime_test(3, new lime_output_color()); $dispatcher = new sfEventDispatcher(); $logger = new xfLoggerEventDispatcher($dispatcher); $logger->setEventName('search.test'); function handle(sfEvent $event = null) { static $got; if ($event) { $got = $event; } else { return $got; } } $dispatcher->connect('search.test', 'handle'); $logger->log('foobar', 'MySearch'); $t->is(handle()->getName(), 'search.test', '->setEventName() changes the event name'); $t->is(handle()->getSubject(), $logger, '->log() sets the index name'); $t->is(handle()->getParameters(), array('foobar', 'section' => 'MySearch'), '->log() logs a message');
if (($sqlUser = @mysql_query('UPDATE `user` SET `level` = "' . $level . '" WHERE `uid` = "' . $uid . '";')) === false) { handle(ERROR_SYSTEM . '01'); } handle('0000'); break; case 'resetPassword': if (!checkAuthority(9)) { handle(ERROR_PERMISSION . '01'); } $_p = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $currentUser = new User(); $currentUser->uid = $uid = getRequest('uid'); $username = json_decode($currentUser->getData(), true)['username']; $pwd = ''; for ($_i = 0; $_i < 10; $_i++) { $pwd .= $_p[mt_rand(0, strlen($_p) - 1)]; } $password = password_hash(md5($username . md5($pwd) . '.cc'), PASSWORD_BCRYPT); if (($sqlUser = @mysql_query('UPDATE `user` SET `password` = "' . $password . '" WHERE `uid` = "' . $uid . '";')) === false) { handle(ERROR_SYSTEM . '01'); } handle('0000{"password":"******"}'); break; default: ERROR(ERROR_INPUT . '02', 'Request Error.'); break; }
<?php require_once __DIR__ . "/logic.php"; $data = file_get_contents("php://input"); try { $response = handle($data); } catch (Exception $e) { $data = time() . '(' . $_SERVER['REMOTE_ADDR'] . ') ' . var_export($e, true); file_put_contents(__DIR__ . '/errors.log', $data, FILE_APPEND); die; } if ($response !== false) { echo $response; } else { die; }
<?php require_once __DIR__ . "/../lib.php"; require_once __DIR__ . "/../logic.php"; $config = (include __DIR__ . "/../config.php"); const GET = "GETJOB"; const ACCEPT = "ACCEPTEDJOB"; const DONE = "DONEJOB"; $json = ["appid" => "04", "time" => "1435093393", "type" => GET, "customField" => []]; $json_string = json_encode($json, true); $data = openssl_encrypt($json_string, $config['cipherTypeDecryption'], $config["keyDecryption"], true); $_SERVER["REMOTE_ADDR"] = "37.49.216.74"; echo $json_string . "\n"; echo print_r(handle($data), true) . "\n";
function handle($module) { switch ($module) { case "login": //{ $v = Engine::loadmod('login', 'login.class.php', 'Login'); $v->fetchtemplate('login', 'index.php'); //Module directory, template filename if (isset($_POST["login"])) { $username = $_POST["username"]; $password = $_POST["password"]; $han = $v->doLogin($username, $password); //sanitize and try to login if ($han == true) { echo 'Login successful!'; } else { echo 'Login invalid!'; } //$v->dx($username,$password); } //} break; case "register": //{ $v = Engine::loadmod('register', 'register.class.php', 'Register'); if (isset($_GET['r'])) { if ($_GET['r'] == "true") { $v->fetchtemplate('register', 'validate.php'); } } else { $v->fetchtemplate('register', 'index.php'); //Module directory, template filename } if (isset($_POST["register"])) { $email = $_POST["email"]; $username = $_POST["username"]; $password = $_POST["password"]; $v->doRegister($email, $username, $password); //Sanitize and register variables } if (isset($_POST["validate"])) { $username = $_POST["username"]; $vkey = $_POST["vkey"]; $v->doValidate($username, $vkey); //Check if validation input is valid } //} break; case "news": //{ $v = Engine::loadmod('news', 'news.class.php', 'News'); $v->fetchtemplate('news', 'index.php'); //Module directory, template filename $v->show(10); //Ammount of news articles to display //} break; /*case "forum": //{ $v = Engine::loadmod('forum','forum.class.php','Forum'); $v->fetchtemplate('forum','index.php'); if(isset($_GET['cat']) && !empty($_GET['cat'])) { $v->getCat($_GET['cat']); } //}*/ /*case "forum": //{ $v = Engine::loadmod('forum','forum.class.php','Forum'); $v->fetchtemplate('forum','index.php'); if(isset($_GET['cat']) && !empty($_GET['cat'])) { $v->getCat($_GET['cat']); } //}*/ default: //{ handle(IDX); //} } }
echo $Username; ?> </a> <?*/ return true; } else { return false; } } $AccessLog = null; } $DB->query("SELECT ID, Username FROM users_main WHERE LastAccess>NOW()-INTERVAL 24 HOUR LIMIT $_GET[start], $_GET[limit]"); while(list($ID, $Username) = $DB->next_record()) { if(handle($ID, $Username, URL) && handle($ID, $Username, URL2) && handle($ID, $Username, URL3)) { ?><a href="user.php?id=<?php echo $ID; ?> "><?php echo $Username; ?> </a><? } } echo 'Done'; ?> </body></head></html>
case 'renew': $currentCalculation = new Calculation(); $currentCalculation->cid = getRequest('cid'); $response = json_decode($currentCalculation->getData(), true); require_once 'site.class.php'; $uid = Site::getSessionUid(); if ($uid == 0) { handle(ERROR_PERMISSION . '00' . '请先登陆!'); } if ($response['uid'] !== $uid && !checkAuthority(9)) { handle(ERROR_PERMISSION . '00'); } $priority = $response['priority']; if (checkAuthority(9) && getRequest('priority') !== '') { $priority = getRequest('priority'); } $currentCalculation->init($response['pid'], $response['uid'], $priority, (int) getRequest('public'), getRequest('password'), $response['status'], $response['input']); if (!$currentCalculation->checkVariables()) { handle(ERROR_INPUT . '01'); } $response = $currentCalculation->modify(); if ($response === false) { handle(ERROR_SYSTEM . '00'); } else { handle('0000'); } break; default: ERROR(ERROR_INPUT . '02', 'Request Error.'); break; }
<?php require_once 'site.class.php'; switch ($action[1]) { case 'data': $response = []; require_once 'article.class.php'; $response['notices'] = json_decode(Article::listData(true), true); handle('0000' . json_encode($response)); break; default: ERROR(ERROR_INPUT . '02', 'Request Error.'); break; }
function handle($ldap, &$config_space, &$faiobject, &$skiplist, $children_only) { $dn = $faiobject['dn']; if (!isset($faiobject['..'])) { $faiobject['..'] = array('dn' => substr($dn, strpos($dn, ',') + 1), 'count' => 0); // dummy parent reference } if (!$children_only) { foreach (array("FAIpartitionEntry", "FAIpartitionDisk", "FAIpartitionTable", "FAIpackageList", "FAIdebconfInfo", "FAIscriptEntry", "FAIscript", "FAItemplateEntry", "FAItemplate", "FAIvariableEntry", "FAIvariable", "FAIhookEntry", "FAIhook") as $oc) { if (in_array($oc, $faiobject['objectclass'])) { call_user_func_array($oc, array(&$config_space, &$faiobject)); break; } } } $result = ldap_list($ldap, $dn, 'objectClass=*'); $result or ldapdie($ldap, "ldap_list()"); $entries = ldap_get_entries($ldap, $result); $entries or ldapdie($ldap, "ldap_get_entries()"); for ($i = 0; $i < $entries["count"]; $i++) { $child = $entries[$i]; $rdn = substr($child["dn"], 0, strpos($child["dn"], ",")); if (isset($skiplist[$rdn])) { continue; } $skiplist[$rdn] = TRUE; if (array_key_exists("faistate", $child) and strpos($child["faistate"][0], "removed") !== FALSE) { continue; } $child['..'] = $faiobject; handle($ldap, $config_space, $child, $skiplist, FALSE); } }
function handle_delete($conversation) { return handle($conversation, 'handle_delete'); }
/** * Bootstrap server. * * @param swoole_server_port $swoole * @return $this */ public function bootstrap(swoole_server_port $swoole = null) { if (!$this->isBooted()) { $this->swoole = null === $swoole ? $this->initSwoole() : $swoole; $this->swoole->set($this->config); handle($this); $this->booted = true; } return $this; }
if (array_key_exists('user_location_longitude', $_POST)) { $user_location_longitude = $_POST["user_location_longitude"]; } if (array_key_exists('user_location_latitude', $_POST)) { $user_location_latitude = $_POST["user_location_latitude"]; } if (array_key_exists('section', $_GET)) { $section = $_GET["section"]; } if (array_key_exists('sub_section', $_GET)) { $sub_section = $_GET["sub_section"]; } if (array_key_exists('item', $_GET)) { $item = $_GET["item"]; } handle(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> <!-- jQuery library --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- Latest compiled JavaScript --> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
* This file is part of the sfSearch package. * (c) Carl Vondrick <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ require dirname(__FILE__) . '/../../bootstrap/unit.php'; require 'log/xfLogger.interface.php'; require 'log/xfLoggerTask.class.php'; require 'event/sfEvent.class.php'; require 'event/sfEventDispatcher.class.php'; require 'command/sfFormatter.class.php'; $t = new lime_test(3, new lime_output_color()); $formatter = new sfFormatter(); $dispatcher = new sfEventDispatcher(); function handle(sfEvent $event = null) { static $got; if ($event) { $got = $event; } else { return $got; } } $dispatcher->connect('command.log', 'handle'); $logger = new xfLoggerTask($dispatcher, $formatter); $logger->log('Did something', 'MySearch'); $t->is(handle()->getSubject(), $logger, '->log() logs with the logger as the subject'); $t->is(handle()->getParameters(), array('MySearch >> Did something'), '->log() formats the message'); $t->is(handle()->getName(), 'command.log', '->log() notifies the correct event');
public function fire() { $ls = $this->listeners; $len = count($ls); if ($len > 0) { $this->firing = true; $args = array_slice(func_get_args(), 0); for ($i = 0; $i < $len; $i++) { $l = $ls[i]; if ($l . handle($this, $args) === false) { $this->firing = false; return false; } } $this->firing = false; } return true; }
<?php require "tests.php"; require "argout.php"; check::functions(array(incp, incr, inctr, new_intp, copy_intp, delete_intp, intp_assign, intp_value, voidhandle, handle)); $ip = copy_intp(42); check::equal(42, incp($ip), "42==incp({$ip})"); check::equal(43, intp_value($ip), "43={$ip}"); $p = copy_intp(2); check::equal(2, incp($p), "2==incp({$p})"); check::equal(3, intp_value($p), "3=={$p}"); $r = copy_intp(7); check::equal(7, incr($r), "7==incr({$r})"); check::equal(8, intp_value($r), "8=={$r}"); $tr = copy_intp(4); check::equal(4, inctr($tr), "4==incr({$tr})"); check::equal(5, intp_value($tr), "5=={$tr}"); # Check the voidhandle call, first with null unset($handle); voidhandle(&$handle); check::resource($handle, "_p_void", '$handle is not _p_void'); $handledata = handle($handle); check::equal($handledata, "Here it is", "\$handledata != \"Here it is\""); unset($handle); // without reference, should fatal error so can't test here //voidhandle($handle); //check::isnull($handle,'$handle not null'); check::done();
<?php require_once 'mail.func.php'; switch ($action[1]) { case 'feedback': $subject = '【用户反馈】CloudCalc'; $body = '<h3>用户: ' . getRequest('basic')['name'] . '</h3>' . '<h3>联系方式:' . getRequest('basic')['contact'] . '</h3>' . '<hr>' . '反馈内容:' . '<br>' . '<pre>' . getRequest('feedback') . '</pre>'; // echo $subject; // echo $body; if (sendNotificationEmail($subject, $body)) { handle('0000'); } else { handle(ERROR_SYSTEM . '00'); } break; case 'plugin': $subject = '【插件提交】CloudCala'; $body = '<h3>用户: ' . getRequest('basic')['name'] . '</h3>' . '<h3>联系方式:' . getRequest('basic')['contact'] . '</h3>' . '<hr>' . '提交用户:' . getRequest('plugin')['username'] . '<br>' . '插件名字:' . getRequest('plugin')['name'] . '<br>' . '插件作者:' . getRequest('plugin')['author'] . '<br>' . '插件Git地址:' . getRequest('plugin')['git'] . '<br>'; // echo $subject; // echo $body; if (sendNotificationEmail($subject, $body)) { handle('0000'); } else { handle(ERROR_SYSTEM . '00'); } break; default: ERROR(ERROR_INPUT . '02', 'Request Error.'); break; }