public function actionSearch() { $request = \Yii::$app->request; $start = $request->get('iDisplayStart'); $limit = $request->get('iDisplayLength'); $andWhere = []; $order = ''; $id_phone_name = $request->get('id_phone_name'); if ($request->get('id_phone_name') != '') { // 电话、ID、姓名 if (is_numeric($id_phone_name)) { if (strlen($id_phone_name . '') == 11) { $andWhere[] = ["=", "phone", $id_phone_name]; } else { $andWhere[] = ["=", "id", $id_phone_name]; } } else { $andWhere[] = ["like", "json_extract(info,'\$.real_name')", $id_phone_name]; } } else { User::getInstance()->searchWhere($andWhere, $request->get(), $order); } $list = User::getInstance()->lists($start, $limit, $andWhere, $order); $count = User::getInstance()->count($andWhere); foreach ($list as $k => $v) { $list[$k]['info'] = json_decode($v['info']); $list[$k]['info']->level = getLevel($list[$k]['info']->level); $list[$k]['info']->is_marriage = getMarriage($list[$k]['info']->is_marriage); $list[$k]['sex'] = getSex($list[$k]['sex']); } $data = ['draw' => \Yii::$app->request->get('sEcho'), 'recordsTotal' => $count, 'recordsFiltered' => $count, 'data' => $list]; $this->renderAjax($data, false); }
function checkHelperLevel($dbmysql) { $level = getLevel($dbmysql); // Benutzerdaten speichern $sql_stmt = "UPDATE user SET Level='" . $level . " '" . "WHERE User_ID=" . $_SESSION['userid'] . " AND Level!=" . $level; $dbmysql->query($sql_stmt); }
function checkLoggedIn() { // if logged in: if (isset($_SESSION['user_id']) && $_SESSION['user_id'] > 0) { $user = array("username" => getUsername(), "wood" => calcCurrentResources()["wood"], "iron" => calcCurrentResources()["iron"], "clay" => calcCurrentResources()["clay"], "level" => getLevel(), "villagers_in_use" => getVillagers(), "max_villagers" => getMaxVillagers()); } else { // not logged in: $user = null; } return $user; }
function getLevel($level, $arr, $current = 0) { $ret = array(); foreach ($arr as $key => $value) { if ($current >= $level) { $ret[$key] = is_array($value) ? getLevel($level, $value, $current + 1) : $value; } else { if (is_array($value)) { $ret = array_merge($ret, getLevel($level, $value, $current + 1)); } } } return $ret; }
} } $is_not_logged_in = !$is_logged_in; $username = get_username(); $user_id = get_user_id(); // Player counts. $stats = membership_and_combat_stats($sql); $player_count = $stats['player_count']; $players_online = $stats['players_online']; $header = render_html_for_header('Live By the Sword', 'main-body', $is_index = true); // render_html_for_header Writes out the html,head,meta,title,css,js. $version = 'NW Version 1.7.1 2009.11.22'; // Display main iframe page unless logged in. $main_src = 'main.php'; if ($is_logged_in) { $level = getLevel($username); $main_src = 'list_all_players.php'; if ($level == 1) { $main_src = 'tutorial.php'; } elseif ($level < 6) { $main_src = 'attack_player.php'; } } $parts = get_certain_vars(get_defined_vars(), array('vicious_killer')); if (!$is_logged_in) { echo render_template('splash2.tpl', $parts); // Non-logged in template. } else { echo render_template('index.tpl', $parts); // Logged in template. }
function runBountyExchange($username, $defender) { // *** BOUNTY EQUATION *** $user_id = get_user_id($username); $defender_id = get_user_id($defender); // *** Bounty Increase equation: (attacker's level - defender's level) / an increment, rounded down *** $levelRatio = floor((getLevel($user_id) - getLevel($defender_id)) / 10); $bountyIncrease = min(25, max($levelRatio * 25, 0)); //Avoids negative increases, max of 30 gold, min of 0 $bountyForAttacker = rewardBounty($user_id, $defender_id); //returns a value if bounty rewarded. if ($bountyForAttacker) { // *** Reward bounty whenever available. *** return "You have received the {$bountyForAttacker} gold bounty on {$defender}'s head for your deeds!"; $bounty_msg = "You have valiantly slain the wanted criminal, {$defender}! For your efforts, you have been awarded {$bountyForAttacker} gold!"; sendMessage("Village Doshin", $username, $bounty_msg); } else { if ($bountyIncrease > 0) { // *** If Defender has no bounty and there was a level difference. *** addBounty($user_id, $bountyIncrease); return "Your victim was much weaker than you. The townsfolk are angered. A bounty of {$bountyIncrease} gold has been placed on your head!"; } else { return null; } } }
subtractKills($username, getLevel($username) * 5); addLevel($username, 1); addStrength($username, 5); addTurns($username, 50); addHealth($username, 100); } else { echo "You do not have enough kills to proceed at this time.<br>\n"; } } } else { if ($nextlevel > $MAX_LEVEL) { $msg = "You enter the dojo as one of the elite ninja. No trainer has anything left to teach you.<br>\n"; } else { if (getKills($username) < getLevel($username) * 5) { $msg = "Your trainer finds you lacking. You are instructed to prove your might against more ninja before you return.<br>\n"; } else { echo "<form id=\"level_up\" action=\"dojo.php\" method=\"post\" name=\"level_up\">\n"; echo "<div>\n"; echo "<br>Do you wish to upgrade to level " . $nextlevel . "?<br>\n"; echo "<input id=\"upgrade\" type=\"hidden\" value=\"1\" name=\"upgrade\">\n"; echo "<input type=\"submit\" value=\"Upgrade\" class=\"formButton\"><br>\n"; echo "</div>\n"; echo "</form>\n"; } } } echo "Your current level is " . getLevel($username) . ". <br>Your current kills are " . getKills($username) . ".<br><br>\n"; echo "Level " . (getLevel($username) + 1) . " requires " . getLevel($username) * 5 . " kills.<br><br>\n"; echo $msg; } include SERVER_ROOT . "interface/footer.php";
function saveUserData($dbmysql) { $level = getLevel($dbmysql); // Benutzerdaten speichern $sql_stmt = "UPDATE user SET EMail='" . $_POST['f_email'] . "', " . "Usergroup='0', " . "Vorname='" . $_POST['f_vorname'] . "', " . "Name='" . $_POST['f_name'] . "', " . "Adresse='" . $_POST['f_adresse'] . "', " . "PLZ='" . $_POST['f_plz'] . "', " . "Ort='" . $_POST['f_ort'] . "', " . "Telefon='" . $_POST['f_telefon'] . "', " . "Level='" . $level . "', " . "Geburtsdatum=STR_TO_DATE('" . $_POST['f_geburtsdatum'] . "','%d.%m.%Y') " . "WHERE User_ID=" . $_SESSION['userid']; if ($resupd = $dbmysql->query($sql_stmt)) { getUserData($dbmysql); } }
unlink($_FILES["torrent"]["tmp_name"]); stdfoot(); die; } } else { $status = 0; } $uploadtpl = new bTemplate(); /* Mod by losmi -sticky torrent */ $query = "SELECT * FROM {$TABLE_PREFIX}sticky"; $rez = do_sqlquery($query, true); $rez = mysql_fetch_assoc($rez); $rez_level = $rez['level']; $current_level = getLevel($CURUSER['id_level']); $level_ok = false; if ($CURUSER["uid"] > 1 && $current_level >= $rez_level && $CURUSER['can_upload'] == 'yes') { $uploadtpl->set("LEVEL_OK", true, FALSE); } else { $uploadtpl->set("LEVEL_OK", false, TRUE); } unset($rez); /* Mod by losmi -sticky torrent */ /* Mod by losmi -visible torrent */ $query = "SELECT * FROM {$TABLE_PREFIX}visible"; $rez = do_sqlquery($query, true);
$target = in('target'); $selfTarget = in('selfTarget'); $item = in('item'); $give = in('give'); $victim_alive = true; $using_item = true; $starting_turns = getTurns($username); $username_turns = $starting_turns; $username_level = getLevel($username); $item_count = $sql->QueryItem("SELECT sum(amount) FROM inventory WHERE owner = '{$username}' AND lower(item)=lower('{$item}')"); $ending_turns = null; if ($selfTarget) { $target = $username; } $targets_turns = $target ? getTurns($target) : false; $targets_level = $target ? getLevel($target) : NULL; $target_hp = $sql->QueryItem("SELECT health FROM players WHERE uname = '{$target}'"); $target_status = getStatus($target); $target_ip = $sql->QueryItem("SELECT ip FROM players WHERE uname = '{$target}'"); $gold_mod = NULL; $result = NULL; $max_power_increase = 10; $level_difference = $targets_level - $players_level; $level_check = $username_level - $targets_level; $near_level_power_increase = nearLevelPowerIncrease($level_difference, $max_power_increase); $turns_to_take = null; // *** Take at least one turn away even on failure. if ($give == "on" || $give == "Give") { $turn_cost = 0; $using_item = false; }
// View that clan name. $clan_long_searched = in('clan_long_name', null, 'none'); // View that clan long name. $new_clan_name = in('new_clan_name', ''); $sure = in('sure', ''); $kicked = in('kicked', ''); $person_invited = in('person_invited', ''); $clan_creation_level_requirement = 15; $clan = null; $viewer_level = 0; if (!isset($username)) { echo "<p>You are not part of any clan.</p>"; } else { $clan = getClan($username); $player_clan_long_name = getClanLongName($username); $viewer_level = getLevel($username); $message = in('message'); if ($message) { message_to_clan($message); echo "<div id='message-sent' class='ninja-notice'>Message sent.</div>"; } if ($command == "new") { // *** Clan Creation Action *** if ($viewer_level > $clan_creation_level_requirement) { setClan($username, $username); $default_clan_name = "Clan_" . $username; renameClan($username, $default_clan_name); $command = "rename"; // *** Shortcut to rename after. *** $clan = getClan($username); echo "<div class='notice'>You have created a new clan!</div><p>Name your clan: </p>\n";
<?php // PICROSS require __DIR__ . '/inc.functions.php'; $g_arrMaps = getMaps(); if (!($level = getLevelFromInput($map))) { $level = getLevel(); $map = prepareMap($g_arrMaps[$level]); } $levelName = $level == 999 ? hashMap($map) : $level; if (isset($_POST['cheat'])) { header('Content-type: text/json'); exit(strtr(json_encode(array('map' => $map['map'])), ['x' => 1, '_' => 0])); } ?> <!doctype html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>PICROSS <?php echo $levelName; ?> </title> <link rel="stylesheet" href="119.css" /> </head> <body> <table id="picross"> <thead> <tr>
function runBountyExchange($username, $defender) { // Bounty Increase equation: attacker'slevel-defender'slevel/5,roundeddown,times25goldperpoint $levelRatio = floor((getLevel($username) - getLevel($defender)) / 5); if ($levelRatio > 0) { $bountyIncrease = $levelRatio * 25; } else { $bountyIncrease = 0; } $bountyForAttacker = rewardBounty($username, $defender); //returns a value if bounty rewarded. if ($bountyForAttacker) { echo "You have received the {$bountyForAttacker} gold bounty on {$defender}'s head for your deeds!<br>\n"; $bounty_msg = "You have valiantly slain the wanted criminal, {$defender}! For your efforts, you have been awarded {$bountyForAttacker} gold!"; sendMessage("Village Doshin", $username, $bounty_msg); } else { if ($bountyIncrease > 0) { addBounty($username, $bountyIncrease); echo "Your victim was much weaker than you. The townsfolk are angered. A bounty of " . $bountyIncrease . " gold has been placed on your head!<br>\n"; } } }
echo "The Guard sees you and prepares to defend!<br><br>\n"; echo "<img src=\"images/characters/guard.png\" alt=\"Guard\">\n"; $guard_attack = rand(1, $attacker_str + 10); // *** Guard Damage *** if (!subtractHealth($username, $guard_attack)) { echo "The Guard has slain you!<br>\n"; echo "Go to the <a href=\"shrine.php\">shrine</a> to resurrect.<br>\n"; } else { $guard_gold = rand(1, $attacker_str + 40); // *** Guard Gold *** addGold($username, $guard_gold); echo "The guard is defeated!<br>\n"; echo "Guard does {$guard_attack} points of damage.<br>\n"; echo "You have gained {$guard_gold} gold.<br>\n"; if (getLevel($username) > 15) { $added_bounty = floor((getLevel($username) - 10) / 5); echo "You have slain a member of the military! A bounty of " . $added_bounty * 10 . " gold has been placed on your head!<br>\n"; addBounty($username, $added_bounty * 10); } } } else { if ($victim == "thief") { // Check the counter to see whether they've attacked a thief multiple times in a row. if (SESSION::is_set('counter')) { $counter = SESSION::get('counter'); } else { $counter = 1; } $counter = $counter + 1; SESSION::set('counter', $counter); // Save the current state of the counter.
$target = $username; $link_back = "<a href=\"skills.php\">Skills</a>"; } $user_ip = $_SESSION['ip']; $username_status = getStatus($username); $class = getClass($username); $target_hp = getHealth($target); $target_ip = $sql->QueryItem("SELECT ip FROM players WHERE uname = '{$target}'"); $target_turns = $sql->QueryItem("SELECT turns FROM players WHERE uname = '{$target}'"); $level = getLevel($username); $covert = false; $victim_alive = true; $attacker_id = $username; $starting_turns = getTurns($username); $ending_turns = null; $level_check = $level - getLevel($target); if ($username_status && $status_array['Stealth']) { $attacker_id = "A Stealthed Ninja"; } // TODO: Make attackLegal use self_use param. // TODO: Make attackLegal also check that the skill can be used on an outside target. // *** Checks the skill use legality, as long as the target isn't self. $params = array('required_turns' => $turn_cost, 'ignores_stealth' => $ignores_stealth, 'self_use' => $self_use); $AttackLegal = new AttackLegal($username, $target, $params); $attack_allowed = $AttackLegal->check(); $attack_error = $AttackLegal->getError(); if ($attack_error) { // Use AttackLegal if not attacking self. echo "<div class='ninja-notice'>{$attack_error}</div>"; // Display the reason for the attack failure. } elseif (!$has_skill || $class == "" || $command == "") {
<?php //$input=getInput(); // $result = getLevel($text); // $level = $result['level']; // $message = $result['latest_message']; $text = $_REQUEST['text']; $myLevel = getLevel($text); $levelUserAt = $myLevel['level']; $message = $myLevel['latest_message']; switch ($levelUserAt) { case 0: $response = getMenu1(); break; case 1: $response = getMenu2($message); break; case 2: $response = getMenu3($message); break; case 3: $response = getMenu4($message); break; default: $response = getMenu1(); break; } sendOutput($response, 1); exit; function getInput() {
function isValidLevel() { return getLevel() == $this->user_level; }
function getLevel($tree, $level = '0') { $max_level = 0; if (is_array($tree)) { $level = $level + 1; foreach ($tree as $k => $children) { if ($k !== '@attributes') { $nl = getLevel($children, $level); $max_level = $max_level > $nl ? $max_level : $nl; } } return $max_level; } else { return $level - 1; } }
/** * permit tool * @class admin */ function scriptPermit() { global $mini, $option_site; ?> <!-- tmp 폼들 --> <div id='formPermit' style='display:none;'> <input type='text' name='tmp_permit_value' class='formText' style='width: 60px;' /> </div> <div id='formPermit_no' style='display:none;'> <input type='text' id='ajaxPermitMember' name='tmp_permit_value' class='formText' style='width: 60px;' /> </div> <div id='formPermit_confirm_cp' style='display:none;'> <select name='tmp_permit_value' class='formSelect'><option value='0'>미인증</option><option value='1'>인증완료</option></select> </div> <div id='formPermit_confirm_mail' style='display:none;'> <select name='tmp_permit_value' class='formSelect'><option value='0'>미인증</option><option value='1'>인증완료</option></select> </div> <div id='formPermit_confirm_co' style='display:none;'> <select name='tmp_permit_value' class='formSelect'><?php echo getOption("str:[미인증:][확인요청:request][확인완료:ok][거부:denied]"); ?> </select> </div> <div id='formPermit_sex' style='display:none;'> <select name='tmp_permit_value' class='formSelect'><option value='man'>남자</option><option value='woman'>여자</option></select> </div> <div id='formPermit_level' style='display:none;'> <select name='tmp_permit_value' class='formSelect'> <?php echo getLevel(); ?> </select> </div> <div id='formPermit_site' style='display:none;'> <select name='tmp_permit_value' class='formSelect'><?php echo $option_site; ?> </select> </div> <div id='formPermit_admin' style='display:none;'> <select name='tmp_permit_value' class='formSelect'> <option value='god'>최고관리자</option> <option value='admin'>총관리자</option> <option value='site'>그룹관리자</option> <option value='board'>게시판관리자</option> </select> </div> <div id='formPermit_date' style='display:none;'> <input type='text' name='tmp_permit_value' class='formText' style='width: 60px;' /> <img src='image/icon/calendar.gif' border='0' style='vertical-align:middle; cursor:pointer;' onclick='myCal.initialize($(this).getPrevious());' alt='달력선택' /> <img src='image/icon/clock.gif' border='0' style='vertical-align:middle; cursor:pointer;' alt='오늘' onclick='$(this).getPrevious().getPrevious().value="<?php echo date("Y-n-j"); ?> ";' /> </div> <div id='formPermit_date_login' style='display:none;'> <input type='text' name='tmp_permit_value' class='formText' style='width: 60px;' /> <img src='image/icon/calendar.gif' border='0' style='vertical-align:middle; cursor:pointer;' onclick='myCal.initialize($(this).getPrevious());' alt='달력선택' /> <img src='image/icon/clock.gif' border='0' style='vertical-align:middle; cursor:pointer;' alt='오늘' onclick='$(this).getPrevious().getPrevious().value="<?php echo date("Y-n-j"); ?> ";' /> </div> <?php }
$order = $i; $pi = 0; $orders[$new_level]++; } else { if ($old_level > $last_parent_level) { $l = $old_level - $last_parent_level; $new_parent = $last_parent_id; $new_level = getLevel('', $new_parent) + 1; $add_parent = ', parent = ' . $new_parent; $order = $i; $pi = 0; $orders[$new_level] = 1; } else { $l = $last_parent_level - $old_level; $new_parent = getParentAtLevel($last_parent_id, $l + 1); $new_level = getLevel('', $new_parent); $add_parent = ', parent = ' . $new_parent; $order = $i; $pi = 0; $orders[$new_level]++; } } if ($new_parent) { $add_parent = ', parent=' . $new_parent; } // echo "new level: ".$new_level." new_parent".$new_parent."<br>"; $last_parent_id = $value; $last_parent_level = $new_level; $i++; $query = "UPDATE " . $wpdb->prefix . "menuitems SET `order` = " . $orders[$new_level] . " {$add_parent} WHERE id = {$value} AND menu = {$menu_id}"; //echo $query."<br><br>";
<?php //Getting user input $input = getInput(); //Getting user level $level = getLevel($input); $message = $level['latest_message']; //Switch through user level to give specific menus switch ($level) { case 0: $response = getHomeMenu(); break; case 1: $response = getLevelOneMenu($message); break; case 2: $response = getLevelTwoMenu($message); break; case 3: $response = getLevelThreeMenu($message); default: $response = getHomeMenu(); break; } function getInput() { $input = array(); $input['sessionId'] = $_REQUEST["sessionId"]; $input['serviceCode'] = $_REQUEST["serviceCode"]; $input['phoneNumber'] = $_REQUEST["phoneNumber"]; $input['text'] = $_REQUEST["text"];
<?php include 'connect.php'; //$text = $_REQUEST['text']; $sessionId = $_REQUEST["sessionId"]; $serviceCode = $_REQUEST["serviceCode"]; $phoneNumber = $_REQUEST["phoneNumber"]; $text = $_REQUEST["text"]; $level = getLevel($text); if ($level == 0) { $reply = "Please enter the drug code"; echo "CON " . $reply; exit; } else { //check if the drug is valid $is_valid = validateDrugCode($text); //$valid_drug_code = "xyz"; if ($is_valid) { $reply = "The drug is valid"; } else { $reply = "The drug is invalid"; } echo "END " . $reply; } //User dials the code and is requested to enter the drug verification //code //step 2 the code is compared to valid code and if valid gets valid Message //end at this function validateDrugCode($text) { $query = mysql_query("SELECT * FROM drugs WHERE verification_code='{$text}'");
<?php //text bt //text is blank = Level 0 //second text is not empty but does have * = level 1 //third text has one star = level 2 $text = $_REQUEST['text']; $result = getLevel($text); $level = $result['level']; $message = $result['latest_message']; switch (strtolower($level)) { case 0: $response = getHomeMenu(); break; case 1: $response = getLevelOneMenu($message); break; case 2: $response = getLevelOneMenu($message); break; default: $response = getHomeMenu(); break; } sendOutput($response, 1); exit; $exploded_text = explode('*', $text); print_r($exploded_text); exit; //1*1*3*5 $input = getInput();
// TODO: Turn this page/system into an object to be run. // *** ********* GET VARS FROM POST - OR GET ************* *** $attacked = in('attacked'); // boolean for attacking again $target = $attackee = either(in('target'), in('attackee')); $username = get_username(); // Pulls from an internal source. $attacker = $username; // *** Target's stats. *** $attackee_health = getHealth($target); $attackee_level = getLevel($target); $attackee_str = getStrength($target); $attackee_status = getStatus($target); // *** Attacker's stats. *** $attacker_health = getHealth($username); $attacker_level = getLevel($username); $user_turns = getTurns($username); $attacker_str = getStrength($username); $attacker_status = getStatus($username); $class = getClass($username); // *** Attack System Initialization *** $starting_attackee_health = $attackee_health; $starting_turns = $user_turns; $killpoints = 0; // *** Starting state for killpoints. *** $attack_turns = 1; // *** Default cost, will go to zero if an error prevents combat. *** $required_turns = $attack_turns; $level_check = $attacker_level - $attackee_level; $what = ""; // *** This will be the attack type string, e.g. "duel". ***
function nextLevel($IP, $Feature) { $level = getLevel($IP, $Feature); if (++$level > 3) { $level = 0; } $Sql = "REPLACE INTO AclDetails (AclDtTournament, AclDtIP, AclDtFeature, AclDtLevel) \n\t\t\tVALUES (" . StrSafe_DB($_SESSION['TourId']) . ", " . StrSafe_DB($IP) . "," . StrSafe_DB($Feature) . "," . $level . ")"; if (!$level) { $Sql = "DELETE FROM AclDetails WHERE AclDtTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND AclDtIP=" . StrSafe_DB($IP) . " AND AclDtFeature=" . StrSafe_DB($Feature); } $Rs = safe_w_sql($Sql); return getLevel($IP, $Feature); }