function _moduleContent(&$smarty, $module_name) { //global variables global $arrConf; //folder path for custom templates $local_templates_dir = getWebDirModule($module_name); //conexion resource //$str_conn = "sqlite3:////var/www/db/iptables.db"; $pDB = new paloDB($arrConf['dsn_conn_database']); //actions $accion = getAction(); switch ($accion) { case "new": $content = newRules($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, array()); break; case "desactivate": $content = desactivateFirewall($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case "save": $content = saveRules($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case "getPorts": $content = getPorts($pDB); break; case "change": $content = change($pDB); break; case "changeOtherPage": $content = changeOtherPage($pDB, $module_name); break; case "exec": $content = execRules($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case "delete": $content = deleteFilter($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; default: $content = reportRules($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; } return $content; }
$timed = date('Y-m-d H:i:n', $timed); if ($usenum == 1) { $sql = "UPDATE xuliehao SET fristtime = '{$timed}' , lasttime = '{$timed}' \r\n\t\t\t WHERE id = '{$id}'"; $result = MYSQL_QUERY($sql); } if ($usenum > 1) { $sql = "UPDATE xuliehao SET secondtime = '{$timed}' , lasttime = '{$timed}' \r\n\t\t\t WHERE id = '{$id}'"; $result = MYSQL_QUERY($sql); } $numten = $xuliehao1 . $xuliehao2; $anzhuangnums1 = $anzhuangnum1 . $anzhuangnum2; $anzhuangnums2 = $anzhuangnum3 . $anzhuangnum4; $lTestV[0] = change($numten); $lTestV[1] = change($miyao); $key[0] = change($anzhuangnums1); $key[1] = change($anzhuangnums2); $key[2] = 2563761818.0; $key[3] = 1374324473; $delta = 2654435769.0; $y = $lTestV[0]; $z = $lTestV[1]; $sum = 0; $a = $key[0]; $b = $key[1]; $c = $key[2]; $d = $key[3]; $temp1 = 0; $temp2 = 0; for ($i = 0; $i < 32; $i++) { $sum += $delta; if ($sum > 4294967296.0) {
site($_GET); break; case isset($_GET['sortindex']): sortItem($_GET); break; case isset($_GET['delid']) && !empty($_COOKIE[md5("role")]): delete($_GET); break; case (isset($_GET['deldoc']) || isset($_GET['item'])) && !empty($_COOKIE[md5("role")]): deleteDoc($_GET); break; case isset($_GET['chgdoc']) || isset($_POST['chgdoc']): changeDoc($_POST, $_GET); break; case isset($_GET['chid']) || isset($_POST['chid']): change($_POST, $_GET, $_FILES); break; case isset($_GET['ins']) || isset($_POST['ins']): insert($_GET, $_POST, $_FILES); break; case isset($_GET['users']) || isset($_POST['users']): users($_GET, $_POST); break; case isset($_GET['delusr']) && !empty($_COOKIE[md5("role")]): deleteUsr($_GET); break; case isset($_GET['chgusr']) || isset($_POST['chgusr']): changeUsr($_POST, $_GET); break; case isset($_GET['admin']): admin();
<?php require "config/config.php"; require "model/change_model.php"; if ($_GET['id'] != null and is_numeric($_GET['id'])) { if (!empty($_POST)) { if ($_POST['prompt'] == "save") { change($conn, $_POST['omschrijving'], $_GET['id']); } header("Location: index.php"); } $omschrijving = read($conn, $_GET['id']); require "view/header.php"; require "view/change.php"; require "view/footer.php"; } else { header("Location: index.php"); }
function variabilityOfAssociationProfiles($filename, $series, $keywordToTrack, $ap) { if (empty($series) || empty($keywordToTrack)) { die('not enough data'); } $filename = get_filename_for_export("hashtagVariability", "_variabilityOfAssociationProfiles", "gexf"); // group per slice // per keyword // get associated words (depth 1) per slice // get frequency, degree, ap variation (calculated on cooc frequency), words in, words out, ap keywords $degree = array(); foreach ($series as $time => $cw) { $cw = $cw->getCowords(); foreach ($cw as $word => $cowords) { foreach ($cowords as $coword => $frequency) { // save how many time slices the word appears $words[$word][$time] = 1; $words[$coword][$time] = 1; // keep track of degree per word per time slice if (array_key_exists($word, $degree) === false) { $degree[$word] = array(); } if (array_key_exists($coword, $degree) === false) { $degree[$coword] = array(); } if (array_key_exists($time, $degree[$word]) === false) { $degree[$word][$time] = 0; } if (array_key_exists($time, $degree[$coword]) === false) { $degree[$coword][$time] = 0; } $degree[$word][$time]++; $degree[$coword][$time]++; } } } // count nr of time slices the words appears in foreach ($words as $word => $times) { $documentsPerWords[$word] = count($times); } // calculate similarity and changes foreach ($ap as $word => $times) { $times_keys = array_keys($times); for ($i = 1; $i < count($times_keys); $i++) { $im1 = $i - 1; $v1 = $times[$times_keys[$im1]]; $v2 = $times[$times_keys[$i]]; $cos_sim[$word][$times_keys[$i]] = cosineSimilarity($v1, $v2); $change_out[$word][$times_keys[$i]] = change($v1, $v2); $change_in[$word][$times_keys[$i]] = change($v2, $v1); $stable[$word][$times_keys[$i]] = array_intersect(array_keys($v1), array_keys($v2)); } } // @todo, frequency $out = "key\ttime\tdegree\tsimilarity\tassociational profile\tchange in\tchange out\tstable\n"; foreach ($ap as $word => $times) { foreach ($times as $time => $profile) { if (isset($change_in[$word][$time])) { $inc = ""; foreach ($change_in[$word][$time] as $w => $c) { $inc .= "{$w} ({$c}), "; } $inc = substr($inc, 0, -2); } else { $inc = ""; } if (isset($change_out[$word][$time])) { $outc = ""; foreach ($change_out[$word][$time] as $w => $c) { $outc .= "{$w} ({$c}), "; } $outc = substr($outc, 0, -2); } else { $outc = ""; } if (isset($stable[$word][$time])) { $stablec = array(); foreach ($stable[$word][$time] as $w) { $stablec[] = $w; } $stablec = implode(", ", $stablec); } else { $stablec = ""; } $prof = ""; foreach ($profile as $w => $c) { $prof .= "{$w} ({$c}), "; } $prof = substr($prof, 0, -2); if (isset($degree[$word][$time])) { $deg = $degree[$word][$time]; } else { $deg = ""; } if (isset($cos_sim[$word][$time])) { $cs = $cos_sim[$word][$time]; } else { $cs = ""; } $out .= $word . "\t" . $time . "\t" . $deg . "\t" . $cs . "\t" . $prof . "\t" . $inc . "\t" . $outc . "\t" . $stablec . "\n"; } } file_put_contents($filename, chr(239) . chr(187) . chr(191) . $out); echo '<fieldset class="if_parameters">'; echo '<legend>Your co-hashtag variability File</legend>'; echo '<p><a href="' . filename_to_url($filename) . '">' . $filename . '</a></p>'; echo '</fieldset>'; }
function _moduleContent(&$smarty, $module_name) { //include module files include_once "modules/{$module_name}/configs/default.conf.php"; include_once "modules/{$module_name}/libs/paloSantoRules.class.php"; //include file language agree to elastix configuration //if file language not exists, then include language by default (en) $lang = get_language(); $base_dir = dirname($_SERVER['SCRIPT_FILENAME']); $lang_file = "modules/{$module_name}/lang/{$lang}.lang"; if (file_exists("{$base_dir}/{$lang_file}")) { include_once "{$lang_file}"; } else { include_once "modules/{$module_name}/lang/en.lang"; } //global variables global $arrConf; global $arrConfModule; global $arrLang; global $arrLangModule; $arrConf = array_merge($arrConf, $arrConfModule); $arrLang = array_merge($arrLang, $arrLangModule); //folder path for custom templates $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes'; $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme']; //conexion resource //$str_conn = "sqlite3:////var/www/db/iptables.db"; $pDB = new paloDB($arrConf['dsn_conn_database']); //actions $accion = getAction(); switch ($accion) { case "new": $content = newRules($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, array()); break; case "desactivate": $content = desactivateFirewall($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case "save": $content = saveRules($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case "getPorts": $content = getPorts($pDB); break; case "change": $content = change($pDB); break; case "changeOtherPage": $content = changeOtherPage($pDB, $module_name); break; case "exec": $content = execRules($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case "delete": $content = deleteFilter($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; default: $content = reportRules($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; } return $content; }
function change($source) { $string = ""; foreach ($source as $k => $v) { $string .= "<" . $k . ">"; if (is_array($v) || is_object($v)) { //判断是否是数组,或者,对像 $string .= change($v); //是数组或者对像就的递归调用 } else { $string .= $v; //取得标签数据 } $string .= "</" . $k . ">"; } return $string; }
} elseif ($announcement_name == 'footer_Announcement') { change($announcement_name); } elseif ($announcement_name == 'tos_content') { change($announcement_name); } elseif ($announcement_name == 'code_Announcement') { change($announcement_name); } elseif ($announcement_name == 'user_index_Announcement') { change($announcement_name); } elseif ($announcement_name == 'user_node_Announcement_node') { change($announcement_name); } elseif ($announcement_name == 'user_node_Announcement_node_pro') { change($announcement_name); } elseif ($announcement_name == 'user_invite_Announcement_color_orange') { change($announcement_name); } elseif ($announcement_name == 'user_invite_Announcement_color_blue') { change($announcement_name); } } else { $a['code'] = '0'; $a['msg'] = "没有这个公告名称"; echo json_encode($a, JSON_UNESCAPED_UNICODE); exit; } } else { header("Location: change_announcement.php"); } function change($announcement_name) { global $sqlitedates; if (empty($_POST['new_content'])) { $a['code'] = '0';
die; } require './../config.php'; require './../src/security.php'; $action = @$_POST['action']; if ($action == 'show_table') { show_table(); } if ($action == 'delete_row') { delete_row(); } if ($action == 'new_row') { new_row(); } if (preg_match('/change/', $action)) { change($action); } function show_table() { $data = $GLOBALS['DB']->query("SELECT * FROM user"); echo json_encode($data); } function delete_row() { $id = (int) @$_POST['id']; $GLOBALS['DB']->query("DELETE FROM user WHERE id=?", array($id)); } function change($action) { $id = (int) @$_POST['id']; $value = security_filter(@$_POST['value']);
/** * @param string $edit * @param PDO $link * @return bool */ function change_email($edit, $link) { $error = 0; if (isset($_POST[$edit])) { $_POST[$edit] = trim($_POST[$edit]); } $change = isset($_POST['edit']) ? $_POST['edit'] == $edit && ($error = parse_email($_POST[$edit])) === 0 ? true : false : false; if ($change) { if ($_POST[$edit] === $_SESSION['user_array']['email']) { change($edit, $link); return true; } } if ($change) { if ($_POST[$edit] === "") { change($edit, $link); $_SESSION['user_array']['confirmed_email'] = chr(0); return true; } if (captcha_verify_word()) { $sql = "SELECT user, email FROM confirmed_emails where email = :email"; $stmt = $link->prepare($sql); $stmt->bindValue(':email', $_POST[$edit], PDO::PARAM_STR); if ($stmt->execute() !== false && ($row = $stmt->fetch(PDO::FETCH_ASSOC))) { if ($row['user'] !== $_SESSION['user_array']['user']) { $error = 3; } } if (!$error) { if (change($edit, $link)) { send_confirmation_email($_POST[$edit], $link); $_SESSION['user_array']['email'] = $_POST[$edit]; echo PR_EMAIL . ': ' . $_SESSION['user_array']['email'] . " "; echo (ord($_SESSION['user_array']['hemail']) ? PR_HIDDEN : PR_VISIBLE) . " [<a href=\"profile.phtml?user="******"&edit=email\">" . PR_EDIT . "</a>] <span style=color:red>" . PR_SENT_1_A . "</span><script type='text/javascript'>alert(\"" . PR_SENT_1 . "\\n" . PR_SENT_2 . "\")</script><br />" . PHP_EOL; return false; } } } else { $error = 4; } } echo "<form id=\"editForm\" method=\"POST\">" . PR_EMAIL . ": <input type=\"text\" id=\"" . $edit . "\" name=\"" . $edit . "\" value=\"" . $_SESSION['user_array'][$edit] . "\" onfocus=\"javascript:document.getElementById('focusId').value='" . $edit . "';\" />"; echo "<input type=\"hidden\" id=\"focusId\" name=\"focusId\" value=\"" . $edit . "\">" . PHP_EOL; echo "<input type=\"hidden\" name=\"edit\" value=\"" . $edit . "\">" . PHP_EOL; echo "<input type=\"hidden\" name=\"user\" value=\"" . $_SESSION['user_array']['user'] . "\">" . PHP_EOL; echo "<input type=\"checkbox\" name=\"h" . $edit . "\" value=\"true\""; if (ord($_SESSION['user_array']['h' . $edit])) { echo " checked=\"checked\" "; } echo '/>' . PR_HIDE; switch ($error) { case 1: echo "<span style=\"color:red\"> " . PR_ERR_MAIL_LONG . "</span><script type='text/javascript'>focusId='" . $edit . "'</script>"; break; case 2: echo "<span style=\"color:red\"> " . PR_ERR_MAIL_INVALID . "</span><script type='text/javascript'>focusId='" . $edit . "'</script>"; break; case 3: echo "<span style=\"color:red\"> " . PR_ERR_MAIL_ALREADY_ASSOC . "</span><script type='text/javascript'>focusId='" . $edit . "';document.getElementById('" . $edit . "').value='" . $_POST[$edit] . "';</script>"; break; } echo "<br /><span id=\"captchaImage\" style=\"border:0;width:140px;\"><img src=\"." . SYNAPP_CAPTCHA_PATH . "/captcha.image.php?nocache=" . hash("sha256", time() . mt_rand()) . "\" alt=\"captcha\"/></span><a \nhref=\"#\" onclick=\"updateCaptcha(null, '." . SYNAPP_CAPTCHA_PATH . "' );return false;\"><img src=\"." . SYNAPP_UI_RESOURCES_PATH . "/images/refresh.png\" style=\"border:0\" alt=\"" . PR_REFRESH . "\" title=\"" . PR_REFRESH . "\"/></a>"; echo "<br />" . PR_CAPT . "<input type=\"text\" id=\"magicword\" " . "onfocus=\"javascript:document.getElementById('focusId').value='magicword';\" name=\"magicword\" autocomplete=\"off\" />"; if ($error == 4) { echo "<span style=\"color:red\"> " . PR_ERR_CAPT . "</span><script type='text/javascript'>" . "focusId='magicword';document.getElementById('" . $edit . "').value='" . $_POST[$edit] . "';</script>"; } echo '<br /></form>' . PHP_EOL; if (isset($_GET['alert']) && !count($_POST)) { if ($_GET['alert'] === "true") { echo "<script type='text/javascript'>alert(\"" . PR_VALIDATE_MAIL . "\")</script>"; } } return false; }
$context = array("user_id" => 1); Exceptional::context($context); // control which errors are caught with error_reporting error_reporting(E_ALL | E_STRICT); // start testing echo $hi; $math = 1 / 0; function backtrace($i) { if ($i < 6) { return backtrace($i + 1); } echo $cool; } backtrace(0); function change(&$var) { } change($var = 5); class Foo { public function bar() { throw new Exception("This is pretty neat!"); } } $f = new Foo(); $f->bar(); // execution halts after exception_handler is called (PHP behavior) // so code below never gets called echo "This never gets called!";
$con = mysql_connect($dbhost, $dbuser, $dbpasswd); if (!$con) { die('{"status":false,"message":"Error connection to db"}'); } mysql_select_db($dbname); switch ($method) { case 'get': get($catid); break; case 'post': if (isset($catname)) { add($catname); } break; case 'put': change($catid, $catname); break; case 'delete': if (isset($catid)) { delete($catid); } break; } function change($catid, $catname) { $query = "UPDATE categories SET catname = '" . $catname . "' WHERE id = " . $catid; if (mysql_query($query)) { echo '{"status":true}'; } else { echo '{"status":false,"message":"Error executing query to db"}'; }
if ($money < 0) { return "ERROR"; } elseif ($money == 0) { return "ZERO"; } else { $cash_reg = testCurrency($remaining, 'ONE HUNDRED', 100, $change); $cash_reg = testCurrency($cash_reg->remainder, 'FIFTY', 50, $cash_reg->change); $cash_reg = testCurrency($cash_reg->remainder, 'TWENTY', 20, $cash_reg->change); $cash_reg = testCurrency($cash_reg->remainder, 'TEN', 10, $cash_reg->change); $cash_reg = testCurrency($cash_reg->remainder, 'FIVE', 5, $cash_reg->change); $cash_reg = testCurrency($cash_reg->remainder, 'TWO', 2, $cash_reg->change); $cash_reg = testCurrency($cash_reg->remainder, 'ONE', 1, $cash_reg->change); $cash_reg = testCurrency($cash_reg->remainder, 'HALF DOLLAR', 0.5, $cash_reg->change); $cash_reg = testCurrency($cash_reg->remainder, 'QUARTER', 0.25, $cash_reg->change); $cash_reg = testCurrency($cash_reg->remainder, 'DIME', 0.1, $cash_reg->change); $cash_reg = testCurrency($cash_reg->remainder, 'NICKEL', 0.05, $cash_reg->change); $cash_reg = testCurrency($cash_reg->remainder, 'PENNY', 0.01, $cash_reg->change); } $change = $cash_reg->change; sort($change); return implode(",", $change); } $fh = fopen($argv[1], "r"); while (!feof($fh)) { $test = trim(fgets($fh)); if ($test != "") { $args = explode(";", $test); echo change($args[1] - $args[0]) . "\n"; } } fclose($fh);
$data = change($data, 3, 0, 1, 2); } if ($dir == "down") { usort($data, "cmp"); } if ($dir == "up") { usort($data, "rcmp"); } if ($sort == "creator") { $data = change($data, 1, 0, 2, 3); } if ($sort == "skin_pack") { $data = change($data, 1, 2, 0, 3); } if ($sort == "release_date") { $data = change($data, 1, 2, 3, 0); } if ($count_filtered) { if ($action == "filter_creator") { $creator = explode("/", $data[0])[1]; $line = "<h3>All skins by creator '" . $creator . "' "; $line .= "<span style=\"font-size:10px\"><a href=\"edit/rename_creator.php" . $args . "&creator=" . urlencode($creator) . "\">rename</a></span> "; $line .= "<span style=\"font-size:10px\"><a href=\"edit/remove_creator.php" . $args . "&creator=" . urlencode($creator) . "\">remove</a></span> "; $line .= ": <a href=\"zip/creator/" . $creator . ".zip\" download=\"" . $creator . ".zip\">"; $line .= "Download [" . $count_filtered . "]</a></h3>\n"; } if ($action == "filter_skin_pack") { $skin_pack = explode("/", $data[0])[2]; $line = "<h3>All skins from skin pack '" . $skin_pack . "' "; $line .= "<span style=\"font-size:10px\"><a href=\"edit/rename_skin_pack.php" . $args . "&skin_pack=" . urlencode($skin_pack) . "\">rename</a></span> "; $line .= "<span style=\"font-size:10px\"><a href=\"edit/remove_skin_pack.php" . $args . "&skin_pack=" . urlencode($skin_pack) . "\">remove</a></span> ";
<?php // Les fonctions se déclarent simplement comme cela: function ajoute_dix($x) { return $x + 10; } $x = 32; $x = ajoute_dix($x); echo "x = {$x}\n"; // x = 42 // PHP Permet de faire des références, on peut // ainsi créer des variables qui ne sont que des // alias $a = 30; $b =& $a; $b += 12; echo "a = {$a}\n"; // a = 42 // Les références peuvent aussi se faire en apellant // des fonctions function change(&$x) { $x += 10; } $x = 32; change($x); echo "x = {$x}\n"; // x = 42
<?php include_once("common.php"); $connectSql=new mysql(); $connectSql->__header(); $connectSql->__construct(); $newstitle=$_REQUEST['newstitle']; $newstitle=change($newstitle); $newsimg=$_REQUEST['newsimg']; $newsimg=change($newsimg); $newscontent=$_REQUEST['newscontent']; $newscontent=change($newscontent); $addtime=$_REQUEST['addtime']; $sql="INSERT INTO `news`(`newstitle`, `newsimg`, `newscontent`, `addtime`) VALUES ('".$newstitle."','".$newsimg."','".$newscontent."','".$addtime."')"; $result=$connectSql->query($sql); if(!$result) { echo json_encode("error"); die('Error'.mysql_error()); }else { echo json_encode("success"); } $connectSql->dbClose(); //转义英文单双引号为中文 function change($string){ $newStr=str_replace("\"", "“", $string); $newStr=str_replace('\'', "‘", $newStr);
$password = $row['password']; return $password; } $name = $_POST["usr_email"]; $passwd = $_POST["pwd"]; $op = $_POST["doLogin"]; $oldpass = $_POST["oldpwd"]; $newpass = $_POST["newpwd1"]; $newpass2 = $_POST["newpwd2"]; $pwd1 = $_POST["pwd1"]; $pwd2 = $_POST["pwd2"]; #echo "name $name, passwd $passwd"; if ($op == "Change") { if ($newpass == $newpass2) { echo "Going to change password for {$name}"; change($name, $oldpass, $newpass); } else { echo "retype password didn't match"; } } elseif ($op == "Register") { if ($pwd1 == $pwd2) { register($name, $pwd1); } else { echo "retype password didn't match"; } } elseif ($op == "Recovery") { $pass = recovery($name); exec("sudo ./sendpass.pl {$name} {$pass} &"); echo "An email is delivering to your mailbox"; header('Location: ./login.php'); } else {
<th>容量</th> <th>状态</th> <th>投影仪</th> <th>话筒</th> <th>写字板</th> <th>详情</th> </tr> </thead> <tbody> <?php $row = new room(); $total_arr = array(); for ($i = 0; $i < $num; $i++) { $single = $re[$i]; $arr = change($single); $total_arr[$i] = $arr; $row->initRoom($single, $arr); ?> <tr> <td><?php echo $row->getNum(); ?> </td> <td><?php
* $Id$ */ ?> <h2>Administration</h2> <?php if ($runlevel == 1) { // If logged in and everything is well, give full access print "<p class=\"menu\">\n<a href=\"?page=admin\">User List</a> |\n<a href=\"?page=admin&action=logout\">Logout</a>\n</p>\n"; $action = addslashes($_GET["action"]); $id = addslashes($_GET["id"]); // These functions are included from libs/admin.lib.php switch ($action) { case "change": change($id); break; case "delete": delete($id); break; case "open": closed($id, 0); break; case "close": closed($id, 1); break; default: list_users(); } } else { // If not logged in, logged out or something failed, print login form
function projectionTest($n) { global $planner; $planner = new Planner(); $scale = new Variable("scale", 10); $offset = new Variable("offset", 1000); $src = null; $dst = null; $dests = new OrderedCollection(); for ($i = 0; $i < $n; ++$i) { $src = new Variable("src" . $i, $i); $dst = new Variable("dst" . $i, $i); $dests->add($dst); new StayConstraint($src, $GLOBALS['NORMAL']); new ScaleConstraint($src, $scale, $offset, $dst, $GLOBALS['REQUIRED']); } change($src, 17); if ($dst->value != 1170) { echo "Projection test 1 failed!"; } change($dst, 1050); if ($src->value != 5) { echo "Projection test 2 failed!"; } change($scale, 5); for ($i = 0; $i < $n - 1; ++$i) { if ($dests->at($i)->value != $i * 5 + 1000) { echo "Projection test 3 failed!"; } } change($offset, 2000); for ($i = 0; $i < $n - 1; ++$i) { if ($dests->at($i)->value != $i * 5 + 2000) { echo "Projection test 4 failed!"; } } }
break; case 'edit_submit': editSubmit(); break; case 'save_submit': case 'apply_submit': saveSubmit($task); break; case 'cancel_submit': cancelSubmit(); break; case 'publish': change(1); break; case 'unpublish': change(0); break; case 'gotoedit': gotoedit(); break; case 'country_list': country_list(); break; case 'show_map': show_map(); break; case 'show_matrix': show_matrix(); break; default: showredirect();
require_once 'lib2/edithelper.inc.php'; $tpl->name = 'mydetails'; $tpl->menuitem = MNU_MYPROFILE_DETAILS; $login->verify(); if ($login->userid == 0) { $tpl->redirect_login(); } if (isset($_REQUEST['cancel'])) { $tpl->redirect('mydetails.php'); } $action = isset($_REQUEST['action']) ? mb_strtolower($_REQUEST['action']) : 'view'; if ($action != 'change' && $action != 'changetext' && $action != 'view') { $action = 'view'; } if ($action == 'change') { change(); } else { if ($action == 'changetext') { changetext(); } else { display(); } } exit; function change() { global $tpl, $login, $opt; $useroptions = new useroptions($login->userid); if (isset($_REQUEST['save'])) { $rs = sql('SELECT `id` FROM `profile_options` WHERE `optionset`=1 ORDER BY `id`'); $bError = false;
<?php require "config/config.php"; require "logic/change_logic.php"; $id = isset($_GET['id']) ? $_GET['id'] : null; if ($id != null and is_numeric($id)) { if (!empty($_POST)) { if ($_POST['prompt'] == "opslaan") { change($conn, $id, $_POST['omschrijving']); } header("Location: index.php"); } $omschrijving = read($conn, $id); require "templates/header.php"; require "templates/change.php"; require "templates/footer.php"; } else { header("Location: index.php"); }
/** * This test constructs a two sets of variables related to each * other by a simple linear transformation (scale and offset). The * time is measured to change a variable on either side of the * mapping and to change the scale and offset factors. */ function projectionTest($n) { global $planner; $planner = new Planner(); $scale = new Variable("scale", 10); $offset = new Variable("offset", 1000); $src = null; $dst = null; $dests = new OrderedCollection(); for ($i = 0; $i < $n; $i++) { $src = new Variable("src{$i}", $i); $dst = new Variable("dst{$i}", $i); $dests->add($dst); new StayConstraint($src, Strength::Normal()); new ScaleConstraint($src, $scale, $offset, $dst, Strength::Required()); } change($src, 17); if ($dst->value != 1170) { alert("Projection 1 failed"); } change($dst, 1050); if ($src->value != 5) { alert("Projection 2 failed"); } change($scale, 5); for ($i = 0; $i < $n - 1; $i++) { if ($dests->at($i)->value != $i * 5 + 1000) { alert("Projection 3 failed"); } } change($offset, 2000); for ($i = 0; $i < $n - 1; $i++) { if ($dests->at($i)->value != $i * 5 + 2000) { alert("Projection 4 failed"); } } }
<?php include_once('ressources/class.templates.inc'); include_once('ressources/class.ldap.inc'); include_once('ressources/class.users.menus.inc'); include_once('ressources/class.mysql.inc'); $user=new usersMenus(); if($user->AsSystemAdministrator==false){ $tpl=new templates(); echo "alert('". $tpl->javascript_parse_text("{ERROR_NO_PRIVS}")."');"; die();exit(); } if(isset($_GET["popup"])){popup();exit;} if(isset($_POST["change_password"])){change();exit;} js(); function js(){ $page=CurrentPageName(); $tpl=new templates(); $title=$tpl->javascript_parse_text("{root_password_not_changed}"); $html="YahooWin5(550,'$page?popup=yes','$title');"; echo $html; } function popup(){ $tpl=new templates(); $page=CurrentPageName(); $root_error_pass=$tpl->javascript_parse_text("{root_error_pass}");
<th>Mei</th> <th>Jun</th> <th>Jul</th> <th>Agu</th> <th>Sep</th> <th>Okt</th> <th>Nov</th> <th>Des</th> </tr>'; $q3 = mysql_query("SELECT\n\t\t\t\t\t\tprogram,\n\t\t\t\t\t\tCOUNT(IF(bulan = 1,1,NULL)) AS '1',\n\t\t\t\t\t\tCOUNT(IF(bulan = 2,1,NULL)) AS '2',\n\t\t\t\t\t\tCOUNT(IF(bulan = 3,1,NULL)) AS '3',\n\t\t\t\t\t\tCOUNT(IF(bulan = 4,1,NULL)) AS '4',\n\t\t\t\t\t\tCOUNT(IF(bulan = 5,1,NULL)) AS '5',\n\t\t\t\t\t\tCOUNT(IF(bulan = 6,1,NULL)) AS '6',\n\t\t\t\t\t\tCOUNT(IF(bulan = 7,1,NULL)) AS '7',\n\t\t\t\t\t\tCOUNT(IF(bulan = 8,1,NULL)) AS '8',\n\t\t\t\t\t\tCOUNT(IF(bulan = 9,1,NULL)) AS '9',\n\t\t\t\t\t\tCOUNT(IF(bulan = 10,1,NULL)) AS '10',\n\t\t\t\t\t\tCOUNT(IF(bulan = 11,1,NULL)) AS '11',\n\t\t\t\t\t\tCOUNT(IF(bulan = 12,1,NULL)) AS '12',\n\t\t\t\t\t\tCOUNT(bulan) AS totBul\n\t\t\t\t\t\tFROM (\n\t\t\t\t\t\tSELECT MONTH(tgl_transaksi) AS bulan, id_muzakki , program\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\tcorez_transaksi a\n\t\t\t\t\t\t\tINNER JOIN setting_program b ON b.id_program = a.id_program\n\t\t\t\t\t\t\tWHERE id_muzakki='10111-1506240001' AND YEAR(tgl_transaksi) = {$_POST['tahun']}\n\t\t\t\t\t\t) AS dummy_table\n\t\t\t\t\t\tGROUP BY program\n\t\t\t\t\t"); for ($i = 1; $i <= 12; $i++) { ${'jmlhProg' . $i} = 0; } $grand_totProg = 0; while ($dataD = mysql_fetch_array($q3)) { echo "\n\t\t\t\t\t<tr>\n\t\t\t \t\t<td>" . $dataD['program'] . "</td>\n\t\t\t \t\t<td>" . change($dataD['1']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['2']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['3']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['4']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['5']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['6']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['7']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['8']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['9']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['10']) . "</td>\t\n\t\t\t \t\t<td>" . change($dataD['11']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['12']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['totBul']) . "</td>\n\t\t\t \t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Setoran Tunai</b></td>\n\t\t\t\t\t\t<td>" . change($dataD['1']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['2']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['3']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['4']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['5']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['6']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['7']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['8']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['9']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['10']) . "</td>\t\n\t\t\t \t\t<td>" . change($dataD['11']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['12']) . "</td>\n\t\t\t \t\t<td>" . change($dataD['totBul']) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t"; for ($i = 1; $i <= 12; $i++) { ${'jmlhProg' . $i} = ${'jmlhProg' . $i} + $dataD[$i]; } $grand_totProg = $grand_totProg + $dataD['totBul']; } echo "\t<tr style='background:#99ccff'>\n\t\t\t\t\t\t<td><b>Grand Total</b></td>"; for ($i = 1; $i <= 12; $i++) { echo "<td>" . ${'jmlhProg' . $i} . "</td>"; } echo "\t\t<td>" . $grand_totProg . "</td>\n\t\t\t\t\t</tr>\n\t\t</table>"; } else { if ($_GET['aksi'] == 'pencarian0') { $qr = mysql_query("SELECT \n\t\t\t\t\t\t\tid_muzakki, muzakki, telpon\n\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\tcorez_muzakki a\t\t\n\t\t\t\t\t\tWHERE YEAR(a.tgl_reg) <=2015"); echo '<div class="modal-dialog modal-lg"> <div class="modal-content">
<?php $arr = array(array('local_path' => 'aaaaa', 'picture_id' => 1), array('local_path' => 'bbbbbbb', 'picture_id' => 2), array('local_path' => 'ccccccc', 'picture_id' => 3)); var_dump($arr); function change($arrr, $a = 0) { foreach ($arrr as $key => $value) { $arr[$a][$value['picture_id']] = $value['local_path']; $arr[$a]['picture_id'] = $value['picture_id']; $a++; } return $arr; } $arry = change($arr); var_dump($arry); $arr = array(array('depart_name' => 'sale', array('group_name' => 'no.1', array('name' => 'jack', 'age' => '12', 'addr' => 'beijing'), array('name' => 'lucy1', 'age' => '12', 'addr' => 'beijing')), array('group_name' => 'no.2', array('name' => 'jack', 'age' => '12', 'addr' => 'beijing'))), array('depart_name' => 'xx', array('group_name' => 'no.1', array('name' => 'jack', 'age' => '12', 'addr' => 'beijing'), array('name' => 'lucy1', 'age' => '12', 'addr' => 'beijing'), array('name' => 'lucy2', 'age' => '12', 'addr' => 'beijing')), array('group_name' => 'no.2', array('name' => 'jack', 'age' => '12', 'addr' => 'beijing'), array('name' => 'jack1', 'age' => '12', 'addr' => 'beijing'), array('name' => 'jack2', 'age' => '12', 'addr' => 'beijing')))); var_dump($arr);