function getKikakuNearby() { checkParam(); global $x, $y, $z, $coord, $type, $kikaku_all; if ($type == 'coord') { $x = $coord[0]; $y = $coord[1]; $z = $coord[2]; } for ($i = 0; $i < count($kikaku_all); $i++) { //全件の現在地と企画との距離を算出 $distance = pow($kikaku_all[$i]->coordinate[0] - $x, 2) + pow($kikaku_all[$i]->coordinate[1] - $y, 2) + pow($kikaku_all[$i]->coordinate[2] - $z, 2); //二乗して距離取得 $dist_all[$i] = $distance; //連想配列作成 } asort($dist_all); //近い順に配列をソート→JSONの順番入れ替え $json_output = '[' . "\n"; foreach ($dist_all as $key => $val) { //JSON出力 $json_output .= json_encode($kikaku_all[$key], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); if (!(end($dist_all) == $val)) { $json_output .= ",\n"; } //最後の行にカンマを挿入しない } $json_output .= "\n" . ']'; return $json_output; }
function newtask($nom, $deadline, $content) { $ligne = searchtask($nom); if ($ligne == 0) { $fichier = fopen('db_task.txt', 'a+'); if ($fichier) { fputs($fichier, "1;:!:;{$nom};:!:;{$deadline}"); if (checkParam($content)) { fputs($fichier, ";:!:;" . escapedesc($content)); } fputs($fichier, "\n"); fclose($fichier); } } return $ligne; }
/* Designed & Maintained by /* - Softon Technologies /* Developer /* - Manzovi /* For Support Contact @ /* - proquiz@softon.org /* version 2.0.0 beta (2 Feb 2011) /* Licensed under GPL license: /* http://www.gnu.org/licenses/gpl.html */ if (file_exists('../config.inc.php')) { die('<center>Install Script Disabled.</center>'); } include_once 'functions.php'; if ($_POST['step'] == 'install') { $_SESSION['VALID'] = checkParam($_POST); //print_r($_SESSION['VALID']); if ($_SESSION['VALID']['status'] == 'yes') { $_SESSION['step'] = 3; processSetup(); } else { $_SESSION['step'] = 2; header('Location:step2.php?error=invalid'); } } else { header('Location:index.php?error=nodirect'); } global $i, $c; function processSetup() { global $i, $c;
<?php include 'sessionstarter.php'; include 'function_task.php'; if (!checkParam($_POST['nom']) || !checkParam($_POST['deadline'])) { $_SESSION['error'] = 10; header('location: newtask.php'); } elseif (strpbrk($_POST['nom'], ";:!") || strpbrk($_POST['deadline'], ";:!")) { $_SESSION['error'] = 40; header('location: newtask.php'); } else { if (0 == newtask($_POST['nom'], $_POST['deadline'], $_POST['content'])) { header('location:tasklist.php'); } else { $_SESSION['error'] = 30; header('location: newtask.php'); } }
$DB = $DBMan->load($_POST['database-type']); $DB->connect($_POST['database-host'], $_POST['database-user'], $_POST['database-password']); if ($errors == $curErrors) { $canrun = true; } break; case PHASE_INSTALLDB: $t = checkParam($_POST, 'admin-email', 'Admin email'); if ($t == false) { break; } $t = checkParam($_POST, 'admin-password', 'Admin password'); if ($t == false) { break; } $t = checkParam($_POST, 'admin-account', 'Admin account'); if ($t == false) { break; } $canrun = true; break; default: break; } } $execPhase = true; switch ($doPhase) { case PHASE_START: include 'install/license.php'; break; case PHASE_CHECK:
/** @api */ function callSvr($ac, $param = null, $data = null, $opt = null) { $h = curl_init(); checkParam($param); checkParam($data); $dbgLevel = intval(getenv("P_DEBUG")); if (isset($dbgLevel) && $dbgLevel > 0) { self::addParam($param, "_debug", $dbgLevel); if ($dbgLevel >= 9) { self::addParam($param, "XDEBUG_SESSION_START", "netbeans-xdebug"); } } $_app = getenv("P_APP"); if ($_app != "") { self::addParam($param, "_app", $_app); } $_test = self::getTestMode(); if ($_test) { self::addParam($param, "_test", $_test); } $url = makeUrl($ac, $param); curl_setopt($h, CURLOPT_URL, $url); curl_setopt($h, CURLOPT_RETURNTRANSFER, 1); curl_setopt($h, CURLOPT_HEADER, 1); curl_setopt($h, CURLOPT_COOKIEFILE, $this->cookieFile); curl_setopt($h, CURLOPT_COOKIEJAR, $this->cookieFile); curl_setopt($h, CURLOPT_USERAGENT, 'RTEST'); $header = array(); if ($this->markInitDB) { $header[] = "bc-initdb: 1"; $this->markInitDB = false; } if (isset($data)) { $boundary = null; if (!@$opt["forBatch"]) { $contentType = "application/x-www-form-urlencoded"; } else { $boundary = "WebTest" . rand(1000, 9999); $contentType = "multipart/form-data; boundary={$boundary}"; } if (is_array($data)) { $data = makeParam($data, $boundary); } else { // use file as content if (is_string($data) && $data[0] === '@') { $fname = substr($data, 1); $data = file_get_contents($fname); if ($data === false) { die("cannot read file {$fname}"); } } } curl_setopt($h, CURLOPT_POST, 1); curl_setopt($h, CURLOPT_POSTFIELDS, $data); if ($boundary) { # show in log $data = "(uploaded files)\n"; } } else { $contentType = 'text/plain'; } $header[] = "Content-Type: {$contentType}"; if (isset($data)) { $header[] = 'Expect:'; } # disable header: "Expect: 100-continue". direct post, dont ask server. curl_setopt($h, CURLOPT_HTTPHEADER, $header); // log request $this->logit(sprintf("=== REQUEST: %s\r\n%s %s\r\n%s\r\n\r\n%s", $ac, isset($data) ? "POST" : "GET", $url, empty($header) ? "" : join("\r\n", $header), isset($data) ? "{$data}\r\n\r\n" : "")); # for https, ignore cert errors (e.g. for self-signed cert) curl_setopt($h, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($h, CURLOPT_SSL_VERIFYHOST, 0); $rv = curl_exec($h); $this->logit(sprintf("=== RESPONSE: %s\r\n", $ac)); if ($rv === false) { $err = curl_error($h); curl_close($h); $this->logit($err); throw new BadHttpReponseException($err); } curl_close($h); $outputFile = @$opt["outputFile"]; // log response if (!$outputFile) { $this->logit($rv); $res = new HttpResponse($rv); } else { $p1 = strpos($rv, "\r\n\r\n"); if ($p1 === false) { $hdr = $rv; } else { $hdr = substr($rv, 0, $p1 + 4); } $this->logit($hdr); $res = new HttpResponse($hdr); if ($p1 !== false) { file_put_contents($outputFile, substr($rv, $p1 + 4)); $this->logit("=== content is saved in file `{$outputFile}`"); } } return $res; }
function main($i_argc, $a_argv) { $a_opt = getopt("of:p:m:s", array()); $a_trade = array(); if (checkParam($i_argc, $a_argv) === false) { return; } if (checkOpt($a_opt) === false) { return; } if (checkFile($a_opt['f']) === false) { return; } init($a_trade, $a_opt); trade($a_trade, $a_opt); tradeInfo($a_trade, $a_opt); }
$new_pass = substr($new_pass, 0, 20); $new_pass_verif = substr($new_pass_verif, 0, 20); $pass = sha1($pass); $new_pass = sha1($new_pass); $new_pass_verif = sha1($new_pass_verif); //Sign in_test if (checkParam($new_pseudo) && checkParam($new_pass) && checkParam($new_pass_verif)) { if (Register($new_pseudo, $new_pass, $new_pass_verif)) { //successful sign in $_SESSION['log'] = 1; setcookie("login", $new_pseudo, time() + 31536000); header('Location: http://fc.isima.fr/~rophelizon/devweb_projet/accueil.php'); } else { //failed sign in header('Location: http://fc.isima.fr/~rophelizon/devweb_projet/index.php'); } } //login_test if (checkParam($pseudo) && checkParam($pass)) { if (checkUser($pseudo, $pass)) { //known user $_SESSION['log'] = 1; setcookie("login", $pseudo, time() + 31536000); header('Location: http://fc.isima.fr/~rophelizon/devweb_projet/accueil.php'); exit; } else { //unknown user header('Location: http://fc.isima.fr/~rophelizon/devweb_projet/index.php'); exit; } }
apiRequest("sendMessage", array('chat_id' => $chat_id, "text" => 'I understand only text messages')); } } function checkParam($param_name) { if (defined($param_name)) { return true; } if (php_sapi_name() == 'cli') { echo $param_name . " is not defined.\n"; } exit; } checkParam('CHAT_ID'); checkParam("LOG_PREFIX"); checkParam("LOG_FORMAT"); checkParam("DATE_FORMAT"); if (php_sapi_name() == 'cli') { // if run from console, set or delete webhook apiRequest('setWebhook', array('url' => isset($argv[1]) && $argv[1] == 'delete' ? '' : WEBHOOK_URL)); exit; } $content = file_get_contents("php://input"); $update = json_decode($content, true); if (!$update) { // receive wrong update, must not happen exit; } if (isset($update["message"])) { processMessage($update["message"]); }
include 'sessionstarter.php'; include 'function_connexion.php'; ?> <html> <head> <meta charset="utf_8"/> <title> Connexion </title> </head> <body> <?php if (!checkParam($_POST['pseudo']) || !checkParam($_POST['password'])) { $_SESSION['error'] = 10; $_SESSION['connexion'] = 0; if (checkParam($_POST['pseudo'])) { $_SESSION['login'] = $_POST['pseudo']; } header('location:index.php'); } else { if (verificationConnexion($_POST['pseudo'], $_POST['password'])) { $_SESSION['connexion'] = 1; $_SESSION['admin'] = isAdmin($_POST['pseudo']); $_SESSION['login'] = $_POST['pseudo']; header('Location:tasklist.php'); } else { $_SESSION['login'] = $_POST['pseudo']; $_SESSION['error'] = 20; $_SESSION['connexion'] = 0; header('Location:index.php'); }
if (!isset($_REQUEST['setting_credit']) || $_REQUEST['setting_credit'] == '0') { showmessage(lang('plugin/bigapp', 'checkin_credit_wrong')); } $credit = $_REQUEST['setting_credit']; ///////////////////////////////////////////// if (isset($_REQUEST['setting_credit_plus']) && checkParam(trim($_REQUEST['setting_credit_plus']))) { $credit_plus = trim($_REQUEST['setting_credit_plus']); } else { showmessage(lang('plugin/bigapp', 'wrong_credit_msg')); } if (isset($_REQUEST['setting_bonus_day']) && checkParam(trim($_REQUEST['setting_bonus_day']))) { $bonus_day = trim($_REQUEST['setting_bonus_day']); } else { showmessage(lang('plugin/bigapp', 'wrong_credit_msg')); } if (isset($_REQUEST['setting_bonus_plus']) && checkParam(trim($_REQUEST['setting_bonus_plus']))) { $bonus_plus = trim($_REQUEST['setting_bonus_plus']); } else { showmessage(lang('plugin/bigapp', 'wrong_credit_msg')); } $setting = array('enabled' => $enabled, 'credit_plus' => $credit_plus, 'bonus_day' => $bonus_day, 'bonus_plus' => $bonus_plus); //////////////////////////////////////// // add by mawentao $setting["credit"] = $credit; //////////////////////////////////////// $settings = array('bigapp_settings_checkin' => $setting); C::t('common_setting')->update_batch($settings); //update cache $_G['setting']['bigapp_settings_checkin']['enabled'] = $enabled; $_G['setting']['bigapp_settings_checkin']['credit_plus'] = $credit_plus; $_G['setting']['bigapp_settings_checkin']['bonus_day'] = $bonus_day;
<!DOCTYPE html> <?php include 'sessionstarter.php'; include 'function_connexion.php'; ?> <html> <head> <title> Bijour </title> </head> <body> <?php if (!checkParam($_POST['pseudo']) || !checkParam($_POST['password']) || !checkParam($_POST['confpass'])) { $_SESSION['error'] = 10; header('location: registeration.php'); } elseif (strpbrk($_POST['pseudo'], ";:!:;") || strpbrk($_POST['password'], ";:!:; ")) { $_SESSION['error'] = 40; header('location: registeration.php'); } elseif ($_POST['confpass'] != $_POST['password']) { } elseif (!logcheck($_POST['password'])) { $_SESSION['error'] = 50; header('location: registeration.php'); } else { if (registerationcheck($_POST['pseudo'])) { newuser($_POST['pseudo'], $_POST['password']); $_SESSION['login'] = $_POST['pseudo']; header('location: index.php'); } else { $_SESSION['error'] = 30; header('location: registeration.php'); } }