Jump to content


  • Posts

  • Joined

  • Last visited


Profile Information

  • Gender
    Not Telling

zelig's Achievements


Member (2/5)



  1. Okay, so I need to pull a second query just on the `created` field to be able to present it in the right format? I have an initial query that pulls everything from the `users` table, as I'm trying to make it so that the administrators can see everything as it relates to that specific user. Here's my whole code. Maybe that will help. function edituser($id) { global $player; if (isset($_POST["submit"])) { extract($_POST); $errors = 0; $errorlist = ""; if ($email == "") { $errors++; $errorlist .= "Email is required.<br />"; } if ($hometown == "") { $errors++; $errorlist .= "Hometown is required.<br />"; } if ($password == "") { $errors++; $errorlist .= "Password is required.<br />"; } if ($race == "") { $errors++; $errorlist .= "Race is required.<br />"; } if ($class == "") { $errors++; $errorlist .= "Class is required.<br />"; } if ($rank == "") { $errors++; $errorlist .= "Rank is required.<br />"; } if ($gender == "") { $errors++; $errorlist .= "Gender is required.<br />"; } if ($eyes == "") { $errors++; $errorlist .= "Eyes is required.<br />"; } if ($hair == "") { $errors++; $errorlist .= "Hair is required.<br />"; } if ($skin == "") { $errors++; $errorlist .= "Skin is required.<br />"; } if ($build == "") { $errors++; $errorlist .= "Build is required.<br />"; } if ($height == "") { $errors++; $errorlist .= "Height is required.<br />"; } if ($gender == "") { $errors++; $errorlist .= "Gender is required.<br />"; } if ($hp == "") { $errors++; $errorlist .= "Current HP is required.<br />"; } if ($mp == "") { $errors++; $errorlist .= "Current MP is required.<br />"; } if ($energy == "") { $errors++; $errorlist .= "Current energy is required.<br />"; } if ($maxhp == "") { $errors++; $errorlist .= "Max HP is required.<br />"; } if ($maxmp == "") { $errors++; $errorlist .= "Max MP is required.<br />"; } if ($maxenergy == "") { $errors++; $errorlist .= "Max energy is required.<br />"; } if (!is_numeric($hp)) { $errors++; $errorlist .= "Current HP must be a number.<br />"; } if (!is_numeric($mp)) { $errors++; $errorlist .= "Current MP must be a number.<br />"; } if (!is_numeric($energy)) { $errors++; $errorlist .= "Current energy must be a number.<br />"; } if (!is_numeric($maxhp)) { $errors++; $errorlist .= "Max HP must be a number.<br />"; } if (!is_numeric($maxmp)) { $errors++; $errorlist .= "Max MP must be a number.<br />"; } if (!is_numeric($maxenergy)) { $errors++; $errorlist .= "Max energy must be a number.<br />"; } if ($errors == 0) { $updatequery = <<<END UPDATE users SET email="$email", admin="$admin", hometown="$hometown", password="$password", race="$race", class="$class", rank="$rank", gender="$gender", eyes="$eyes", hair="$hair", skin="$skin", build="$build", height="$height", spouse="$spouse", fame="$fame", gfame="$gfame", quests="$quests", flags="$flags", gold="$gold", credits="$credits", bank="$bank", hp="$hp", maxhp="$maxhp", energy="$energy", maxenergy="$maxenergy", mp="$mp", maxmp="$maxmp", plevel="$plevel", experience="$experience", strength="$strength", agility="$agility", vitality="$vitality", wisdom="$wisdom", escape="$escape", interest="$interest", minecount="$minecount", stat_bonus="$stat_bonus" WHERE id="$id" END; $query = doquery($updatequery, "users"); admindisplay("User updated.","Edit Users"); } else { admindisplay("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Edit Users"); } } $query = doquery("SELECT * FROM users WHERE id='$id'", "users"); $row = mysql_fetch_array($query); $iclass = $player->class; global $controlrow; $page = <<<END <b><u>Edit Users</u></b><br /><br /> <form action="admin_panel.php?do=edituser:$id" method="post"> <table width="90%"> <tr><td width="20%">ID:</td><td>{{id}}</td></tr> <tr><td width="20%">Username:</td><td>{{username}}</td></tr> <tr><td width="20%">Email:</td><td><input type="text" name="email" size="30" maxlength="100" value="{{email}}" /></td></tr> <tr><td width="20%">Password:</td><td><input type="text" name="password" size="30" maxlength="8" value="{{password}}" /></td></tr> <tr><td width="20%">Admin Level:</td><td><input type="text" name="admin" size="30" maxlength="30" value="{{admin}}" /></td></tr> <tr><td width="20%">Registered On:</td><td>{{created}}</td></tr> <tr><td width="20%">Last Online:</td><td>{{last_login}}</td></tr> <tr><td width="20%">Last IP:</td><td>{{ip}}</td></tr> <tr><td width="20%">Flags:</td><td><input type="text" name="flags" size="30" maxlength="1055" value="{{flags}}" /></td></tr> <tr><td colspan="2" style="background-color:#cccccc;"> </td></tr> <tr><td width="20%">Hometown:</td><td><input type="text" name="hometown" size="15" maxlength="30" value="{{hometown}}" /></td></tr> <tr><td width="20%">Race:</td><td><input type="text" name="race" size="10" maxlength="30" value="{{race}}" /></td></tr> <tr><td width="20%">Class:</td><td><input type="text" name="class" size ="10" maxlength="30" value="{{class}}" /></td></tr> <tr><td width="20%">Rank:</td><td><input type="text" name="rank" size="15" maxlength="15" value="{{rank}}" /></td></tr> <tr><td width="20%">Gender:</td><td><input type="text" name="gender" size="15" maxlength="25" value="{{gender}}" /></td></tr> <tr><td width="20%">Eyes:</td><td><input type="text" name="eyes" size="15" maxlength="30" value="{{eyes}}" /></td></tr> <tr><td width="20%">Hair:</td><td><input type="text" name="hair" size="15" maxlength="30" value="{{hair}}" /></td></tr> <tr><td width="20%">Skin:</td><td><input type="text" name="skin" size="15" maxlength="30" value="{{skin}}" /></td></tr> <tr><td width="20%">Build:</td><td><input type="text" name="build" size="15" maxlength="30" value="{{build}}" /></td></tr> <tr><td width="20%">Height:</td><td><input type="text" name="height" size="15" maxlength="30" value="{{height}}" /></td></tr> <tr><td width="20%">Spouse:</td><td><input type="text" name="spouse" size="15" maxlength="30" value="{{spouse}}" /></td></tr> <tr><td colspan="2" style="background-color:#cccccc;"> </td></tr> <tr><td width="20%">Fame:</td><td><input type="text" name="fame" size="5" maxlength="10" value="{{fame}}" /></td></tr> <tr><td width="20%">GFame:</td><td><input type="text" name="gfame" size="5" maxlength="2" value="{{gfame}}" /></td></tr> <tr><td width="20%">Quests:</td><td><input type="text" name="quests" size="5" maxlength="5" value="{{quests}}" /></td></tr> <tr><td width="20%">Gold:</td><td><input type="text" name="gold" size="5" maxlength="6" value="{{gold}}" /></td></tr> <tr><td width="20%">Bank:</td><td><input type="text" name="bank" size="5" maxlength="30" value="{{bank}}" /></td></tr> <tr><td width="20%">Interest:</td><td><input type="text" name="interest" size="5" maxlength="3" value="{{bank}}" /></td></tr> <tr><td width="20%">Credits:</td><td><input type="text" name="credits" size="5" maxlength="3" value="{{credits}}" /></td></tr> <tr><td colspan="2" style="background-color:#cccccc;"> </td></tr> <tr><td width="20%">Current Player Level:</td><td><input type="text" name="plevel" size="5" maxlength="6" value="{{plevel}}" /></td></tr> <tr><td width="20%">Current HP:</td><td><input type="text" name="hp" size="5" maxlength="6" value="{{hp}}" /></td></tr> <tr><td width="20%">Max HP:</td><td><input type="text" name="maxhp" size="5" maxlength="6" value="{{maxhp}}" /></td></tr> <tr><td width="20%">Current MP:</td><td><input type="text" name="mp" size="5" maxlength="6" value="{{mp}}" /></td></tr> <tr><td width="20%">Max MP:</td><td><input type="text" name="maxmp" size="5" maxlength="6" value="{{maxmp}}" /></td></tr> <tr><td width="20%">Current Energy:</td><td><input type="text" name="energy" size="5" maxlength="6" value="{{energy}}" /></td></tr> <tr><td width="20%">Max Energy:</td><td><input type="text" name="maxenergy" size="5" maxlength="6" value="{{maxenergy}}" /></td></tr> <tr><td width="20%">Strength:</td><td><input type="text" name="strength" size="5" maxlength="5" value="{{strength}}" /></td></tr> <tr><td width="20%">Agility:</td><td><input type="text" name="agility" size="5" maxlength="5" value="{{agility}}" /></td></tr> <tr><td width="20%">Vitality:</td><td><input type="text" name="vitality" size="5" maxlength="5" value="{{vitality}}" /></td></tr> <tr><td width="20%">Wisdom:</td><td><input type="text" name="wisdom" size="5" maxlength="5" value="{{wisdom}}" /></td></tr> <tr><td width="20%">Escape:</td><td><input type="text" name="escape" size="5" maxlength="5" value="{{escape}}" /></td></tr> <tr><td width="20%">Bonus:</td><td><input type="text" name="stat_bonus" size="5" maxlength="3" value="{{stat_bonus}}" /></td></tr> <tr><td colspan="2" style="background-color:#cccccc;"> </td></tr> <tr><td width="20%">Description:</td><td>{{description}}</td></tr> <tr><td width="20%">Weapon:</td><td>{{weapon}}</td></tr> <tr><td width="20%">Head:</td><td>{{head}}</td></tr> <tr><td width="20%">Neck:</td><td>{{neck}}</td></tr> <tr><td width="20%">Body:</td><td>{{body}}</td></tr> <tr><td width="20%">Shield:</td><td>{{shield}}</td></tr> <tr><td width="20%">Shoulders:</td><td>{{shoulders}}</td></tr> <tr><td width="20%">Arms:</td><td>{{arm}}</td></tr> <tr><td width="20%">Hands:</td><td>{{hands}}</td></tr> <tr><td width="20%">Fingers:</td><td>{{finger}}</td></tr> <tr><td width="20%">Wrists:</td><td>{{wrists}}</td></tr> <tr><td width="20%">Legs:</td><td>{{legs}}</td></tr> <tr><td width="20%">Feet:</td><td>{{feet}}</td></tr> <tr><td width="20%">Guild:</td><td>{{guild}}</td></tr> <tr><td colspan="2" style="background-color:#cccccc;"> </td></tr> <tr><td width="20%">Frozen:</td><td>{{frozen}}</td></tr> <tr><td width="20%">Muted:</td><td>{{muted}}</td></tr> <tr><td width="20%">Deaf:</td><td>{{deaf}}</td></tr> </table> <input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /> </form> END; $page = parsetemplate($page, $row); admindisplay($page, "Edit Users"); }
  2. Okay, I have a field called "created" in my `users` table, and I'd like to be able to view it in-game on an administrator panel. However, it's being captured in a long number format (i.e. 1335076320) which, I believe, has to deal with seconds and such. How can I take that number and convert it to an actual date/time output? Here's how I currently have it coded in my php form: <tr><td width="20%">Registered On:</td><td>{{created}}</td></tr> So, obviously it's not converting it to any format, rather just pulling that 1335076320 number out. Thanks in advance!
  3. Okay, I have a healing spell that allows people to regain stats when it's cast. But, how do I limit it so that they can't go over their maxhp? Here's what I have so far: $db->execute("UPDATE `users` SET `hp`=?, `mp`=?, `energy`=? WHERE `id`=?", array($player->hp + $healspell, $player->mp - $spell['mp'], $player->energy - $spell['energy'], $player->id)); What do I need to do in this to tell it to limit it to the maxhp but never going over it? $healspell is a random number, so it is quite possible to go over the maxhp at the moment. Thank you!
  4. How can I post this variable $healspell when I already have an echo within a php? Here's what I have: echo '<p>You cast Nature\'s Cure (Recovered <?=$healspell?>)</p>'; It's not printing anything out at the moment, obviously, and if I just put $healspell, it just echos out: $healspell. Thanks!
  5. Found the problem. Fixed it. Now, I get this error: qry failed: Unknown column 'admin' in 'where clause' The coordinates I'm are are: x = 1 y = 0 z = admin plane = batai It doesn't like z for some reason... Here's my current code: error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); define("PAGENAME", "Shops"); $player = check_user($secret_key, $db); $x = $player->x; $y1 = $player->y; $z = $player->z; $plane = $player->plane; if($_SESSION['234asdfas']){$y = $_SESSION['234asdfas'];}else{echo 'Error: You do not have a session variable set'; exit;} $query = mysql_query("SELECT * FROM `shop` WHERE `x`=$x AND `y`=$y1 AND `z`=$z AND `plane`=$plane") or die("qry failed: ".mysql_error()); while($row = mysql_fetch_array($query)) { // echo out the contents of each row echo $row['id']."<br />"; echo $row['name']."<br />"; echo $row['location']."<br />"; echo $row['itemslist']."<br />"; echo $row['x']."<br />"; echo $row['y']."<br />"; echo $row['z']."<br />"; echo $row['plane']."<br />"; }
  6. Up above: $player = check_user($secret_key, $db); $x = $player->id; It's pulling the login information and putting it into the $player variable. (I believe that's how you explain it...)
  7. So, why is it placing my username id# into those spots instead of getting the information from the shop table which should be: x = 1 y = 0 z = admin plane = batai
  8. The echo $query pulls: SELECT * FROM `shop` WHERE `x`='9' AND `y`='9' AND `z`='9' AND `plane`='9' So... it's inserting my user id # into those spots... And I have the error reporting stuff in there. Still, just a blank white screen.
  9. Hmm... This just brings up a white screen. $q1 = mysql_query("SELECT * FROM `shop` WHERE `x`='".$x["x"]."' AND `y`='".$x["y"]."' AND `z`='".$x["z"]."' AND `plane`='".$x["plane"]."'") or die("qry failed: ".mysql_error()); while($row = mysql_fetch_array($q1)) { // echo out the contents of each row echo $row['id']."<br />"; echo $row['name']."<br />"; echo $row['x']."<br />"; echo $row['y']."<br />"; echo $row['z']."<br />"; echo $row['plane']."<br />"; }
  10. Okay, so, I'm trying to pull the info from my `shop` table where the `users` table matches at x, y, z, and plane. Instead, I'm getting this: Resource id #22 Where is this coming from? I only have 1 row in my shop table, and it has: id = 7 name = admin shop x = 1 y = 0 z = admin plane = batai I'm standing in the shop right now (as my character, so my users table has the exact same x, y, z, plane)... Any help would be appreciated! $q1 = mysql_query("SELECT * FROM `shop` WHERE `x`='".$x["x"]."' AND `y`='".$x["y"]."' AND `z`='".$x["z"]."' AND `plane`='".$x["plane"]."'") or die("qry failed: ".mysql_error()); Variables: $x = $x = $player->username; (so it's pulling my username, which it is doing correctly ==> i echoed out $x and it came up with my username)
  11. Okay, I have a question. Is there a way to combine three fields within a single table (x, y, z) into a single variable? Something like: x~y~z? (the ~ would be needed)
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.