include_once "include/profile.php"; include_once "include/global.php"; include_once "include/language.php"; include_once "include/functions.php"; //if character name isnt provided post error message and exit if (!$_GET['char']) { message_die($language['MESSAGE_ERROR'], $language['MESSAGE_NO_CHAR']); } else { $charName = $_GET['char']; } //character initializations - rewritten 9/28/2014 $char = new profile($charName); //the profile class will sanitize the character name $charID = $char->char_id(); $name = $char->GetValue('name'); $mypermission = GetPermissions($char->GetValue('gm'), $char->GetValue('anon'), $char->char_id()); //block view if user level doesnt have permission if ($mypermission['skills']) { message_die($language['MESSAGE_ERROR'], $language['MESSAGE_ITEM_NO_VIEW']); } //drop page $d_title = " - " . $name . $language['PAGE_TITLES_SKILLS']; include "include/header.php"; $template->set_filenames(array('settings' => 'settings_body.tpl')); //build body template $template->set_filenames(array('skills' => 'skills_body.tpl')); $template->assign_vars(array('NAME' => $name, '1H_BLUNT' => $char->GetValue('1h_blunt'), '1H_SLASHING' => $char->GetValue('1h_slashing'), '2H_BLUNT' => $char->GetValue('2h_blunt'), '2H_SLASHING' => $char->GetValue('2h_slashing'), 'ARCHERY' => $char->GetValue('archery'), 'BASH' => $char->GetValue('bash'), 'BLOCK' => $char->GetValue('block'), 'DEFENSE' => $char->GetValue('defense'), 'DISARM' => $char->GetValue('disarm'), 'DODGE' => $char->GetValue('dodge'), 'DOUBLE_ATTACK' => $char->GetValue('double_attack'), 'DUAL_WIELD' => $char->GetValue('dual_wield'), 'HAND_TO_HAND' => $char->GetValue('hand_to_hand'), 'KICK' => $char->GetValue('kick'), 'OFFENSE' => $char->GetValue('offense'), 'PARRY' => $char->GetValue('parry'), 'PIERCING' => $char->GetValue('piercing'), 'RIPOSTE' => $char->GetValue('riposte'), 'THROWING' => $char->GetValue('throwing'), 'INTIMIDATION' => $char->GetValue('intimidation'), 'TAUNT' => $char->GetValue('taunt'), 'ABJURATION' => $char->GetValue('abjuration'), 'ALTERATION' => $char->GetValue('alteration'), 'CHANNELING' => $char->GetValue('channeling'), 'CONJURATION' => $char->GetValue('conjuration'), 'DIVINATION' => $char->GetValue('divination'), 'EVOCATION' => $char->GetValue('evocation'), 'SPECIALIZE_ABJURE' => $char->GetValue('specialize_abjure'), 'SPECIALIZE_ALTERATION' => $char->GetValue('specialize_alteration'), 'SPECIALIZE_CONJURATION' => $char->GetValue('specialize_conjuration'), 'SPECIALIZE_DIVINATION' => $char->GetValue('specialize_divinatation'), 'SPECIALIZE_EVOCATION' => $char->GetValue('specialize_evocation'), 'DRAGON_PUNCH' => $char->GetValue('dragon_punch'), 'EAGLE_STRIKE' => $char->GetValue('eagle_strike'), 'ROUND_KICK' => $char->GetValue('round_kick'), 'TIGER_CLAW' => $char->GetValue('tiger_claw'), 'FLYING_KICK' => $char->GetValue('flying_kick'), 'MEND' => $char->GetValue('mend'), 'FEIGN_DEATH' => $char->GetValue('feign_death'), 'PICK_LOCK' => $char->GetValue('pick_lock'), 'APPLY_POISON' => $char->GetValue('apply_poison'), 'BACKSTAB' => $char->GetValue('backstab'), 'DISARM_TRAPS' => $char->GetValue('disarm_traps'), 'PICK_POCKETS' => $char->GetValue('pick_pockets'), 'SENSE_TRAPS' => $char->GetValue('sense_traps'), 'BERSERKING' => $char->GetValue('berserking'), 'FRENZY' => $char->GetValue('frenzy'), 'BRASS_INSTRUMENTS' => $char->GetValue('brass_instruments'), 'SINGING' => $char->GetValue('sing'), 'STRINGED_INSTRUMENTS' => $char->GetValue('stringed_instruments'), 'WIND_INSTRUMENTS' => $char->GetValue('wind_instruments'), 'PERCUSSION_INSTRUMENTS' => $char->GetValue('percussion_instruments'), 'BIND_WOUND' => $char->GetValue('bind_wound'), 'FORAGE' => $char->GetValue('forage'), 'HIDE' => $char->GetValue('hide'), 'MEDITATE' => $char->GetValue('meditate'), 'SAFE_FALL' => $char->GetValue('safe_fall'), 'SENSE_HEADING' => $char->GetValue('sense_heading'), 'SNEAK' => $char->GetValue('sneak'), 'SWIMMING' => $char->GetValue('swimming'), 'TRACKING' => $char->GetValue('tracking'), 'FISHING' => $char->GetValue('fishing'), 'ALCOHOL_TOLERANCE' => $char->GetValue('alcohol_tolerance'), 'BEGGING' => $char->GetValue('begging'), 'MAKE_POISON' => $char->GetValue('make_poison'), 'TINKERING' => $char->GetValue('tinkering'), 'RESEARCH' => $char->GetValue('research'), 'ALCHEMY' => $char->GetValue('alchemy'), 'BAKING' => $char->GetValue('baking'), 'TAILORING' => $char->GetValue('tailoring'), 'BLACKSMITHING' => $char->GetValue('blacksmithing'), 'FLETCHING' => $char->GetValue('fletching'), 'BREWING' => $char->GetValue('brewing'), 'JEWELRY_MAKING' => $char->GetValue('jewelry_making'), 'POTTERY' => $char->GetValue('pottery'), 'L_TRADE' => $language['SKILLS_TRADE'], 'L_OTHER' => $language['SKILLS_OTHER'], 'L_CLASS' => $language['SKILLS_CLASS'], 'L_CASTING' => $language['SKILLS_CASTING'], 'L_COMBAT' => $language['SKILLS_COMBAT'], 'L_LANGUAGE' => $language['SKILLS_LANGUAGE'], 'L_SKILLS' => $language['SKILLS_SKILLS'], 'L_DONE' => $language['BUTTON_DONE'], 'L_AAS' => $language['BUTTON_AAS'], 'L_KEYS' => $language['BUTTON_KEYS'], 'L_FLAGS' => $language['BUTTON_FLAGS'], 'L_SKILLS' => $language['BUTTON_SKILLS'], 'L_BOOKMARK' => $language['BUTTON_BOOKMARK'], 'L_CORPSE' => $language['BUTTON_CORPSE'], 'L_FACTION' => $language['BUTTON_FACTION'], 'L_INVENTORY' => $language['BUTTON_INVENTORY'], 'L_CHARMOVE' => $language['BUTTON_CHARMOVE'])); if (!$mypermission['languageskills']) { $template->assign_block_vars("switch_language", array('COMMON_TONGUE' => $char->GetValue('common_tongue'), 'BARBARIAN' => $char->GetValue('barbarian'), 'ERUDIAN' => $char->GetValue('erudian'), 'ELVISH' => $char->GetValue('elvish'), 'DARK_ELVISH' => $char->GetValue('dark_elvish'), 'DWARVISH' => $char->GetValue('dwarvish'), 'TROLL' => $char->GetValue('troll'), 'OGRE' => $char->GetValue('ogre'), 'GNOMISH' => $char->GetValue('gnomish'), 'HALFLING' => $char->GetValue('halfling'), 'THIEVES_CANT' => $char->GetValue('thieves_cant'), 'OLD_ERUDIAN' => $char->GetValue('old_erudian'), 'ELDER_ELVISH' => $char->GetValue('elder_elvish'), 'FROGLOK' => $char->GetValue('froglok'), 'GOBLIN' => $char->GetValue('goblin'), 'GNOLL' => $char->GetValue('gnoll'), 'COMBINE_TONGUE' => $char->GetValue('combine_tongue'), 'ELDER_TEIRDAL' => $char->GetValue('elder_teirdal'), 'LIZARDMAN' => $char->GetValue('lizardman'), 'ORCISH' => $char->GetValue('orcish'), 'FAERIE' => $char->GetValue('faerie'), 'DRAGON' => $char->GetValue('dragon'), 'ELDER_DRAGON' => $char->GetValue('elder_dragon'), 'DARK_SPEECH' => $char->GetValue('dark_speech'), 'VAH_SHIR' => $char->GetValue('vah_shir'))); } $template->pparse('skills');
print "<TD width=30px><IMG SRC=blockdevice.png>\n"; print "<TD>\n"; if (!empty($name)) { ShowUserSex(); print "<A HREF={$descscript}?action=user&usrname={$name} target=_blank>{$name}</A>\n"; } print "<TD width=27px><IMG SRC=identity.png>\n"; print "<TD><A HREF={$loginscript}?url=guides.php>{$l10nstr['3']}</A><BR>\n"; /* connect as another user */ if (!empty($name)) { print "<TD width=27px><IMG SRC=document.png>\n"; print "<TD><A HREF=editguide.php?action=new>{$l10nstr['156']}</A><BR>\n"; /* create new guide */ } print "</TABLE>\n"; GetPermissions(); if (($level = IsAllowed($name)) == 0) { print "<CENTER><H1>{$l10nstr['157']}</H1>\n"; /* you are not allowed to access */ exit; } $action = $_GET['action']; if ($action == 'adduser') { $user = $_POST['new_user']; $user = str_replace("\\'", '', $user); AddUser($user); print "<CENTER><H1 dir={$langdir}>{$l10nstr['118']}: "; /* user */ print "{$user} "; print "<H1>{$l10nstr['158']}</H1>\n"; /* added to system */
function EditAdmin($user_id) { global $db; $maxLevel = $_SESSION['level']; if (isset($_POST['processed'])) { $username = addslashes($_POST['username']); $level = addslashes($_POST['level']); $all = $_POST['all']; $squadleader = $_POST['squadleader']; $adjutant = $_POST['adjutant']; $quartermaster = $_POST['quartermaster']; if (empty($username)) { echo "You must fill everything out before proceeding."; return; } $db->Query("UPDATE `bayonet_users` SET `username` = '{$username}', `level` = '{$level}', `all` = '{$all}', `squadleader` = '{$squadleader}', `adjutant` = '{$adjutant}', `quartermaster` = '{$quartermaster}' WHERE `user_id` = '{$user_id}' LIMIT 1"); echo "Admin, '{$username}' level '{$level}' has been edited.\n <br /><br /> \n\t\t\t\t\tPlease wait while you are redirected. <br /><br /> \n\t\t\t\t\t<a href=\"?op=admins\">Click here if you don't feel like waiting.</a>"; // 3 second redirect to go back to the edit page PageRedirect(2, "?op=admins&edit={$user_id}"); return; } $result = $db->Query("SELECT * FROM `bayonet_users` WHERE `user_id` = '{$user_id}' LIMIT 1"); $admin = $db->FetchRow($result); if ($maxLevel < $admin['level']) { ReportError("You do not have permission to access this user."); return; } ?> <center> Edit the attributes of this administrator.<br /> <form method="POST" action="<?php $_SERVER['PHP_SELF']; ?> "> <table> <tr><th>Username:</th><td><input type="text" value="<?php echo $admin['username']; ?> " name="username" /> <?php if ($maxLevel >= 2) { ?> <a href="?op=admins&resetpassword=<?php echo $user_id; ?> "><input type="button" value="Reset Password" /></a> <?php } ?> </td></tr> <tr> <th>Level:</th> <td> <select name="level"> <?php for ($x = $maxLevel; $x > 0; $x--) { if ($admin['level'] == $x) { echo "<option value=\"{$x}\" selected>{$x}</option>"; } else { echo "<option value=\"{$x}\">{$x}</option>"; } } ?> </select> </td> </tr> <tr> <td colspan="2" style="text-align:center;"> <input type="submit" name="processed" value="Submit" /> <a href="?op=admins&delete=<?php echo $user_id; ?> "><input type="button" value="Delete Admin" /></a> </td> </tr> </table> <br /> <?php GetPermissions($admin); ?> </form> </center> <?php }
function getPowers($AID) { $conn = conDB(); $perms = GetPermissions($AID); $permsN = count($perms); $y = 0; $pows = array(); for ($x = 0; $x < $permsN; $x++) { $Cperm = $perms[$x]; $sql = "SELECT * FROM pkeys WHERE PerID='{$Cperm}'"; $result = mysqli_query($conn, $sql); while ($row = $result->fetch_assoc()) { $pows[$y] = $row["PowID"]; $y++; } } return $pows; }