-
Posts
2,146 -
Joined
-
Last visited
-
Days Won
149
Content Type
Profiles
Forums
Events
Everything posted by Magictallguy
-
Re: [Mccode][Free] House Pictures Using the post before mine, and the first post works fine. Why are argue when you can call it from the database? That's what it's there for..
-
Re: Updated Explore V.2 I'm tempted to create an explore that is updatable via the staff panel.. Each "box" (or <td>) will have it's own row on a table in the database..[me=Magictallguy]ponders the thought[/me]
-
Re: [V2] Crystalbank Mod [V2] Links are the same, SQL is the same. Secured Crystal Bank <?php include (DIRNAME(__FILE__) . "/globals.php"); //Learn to secure your script! //And code properly for that matter -.- //Secured by Magictallguy print "<h3>Crystal Bank</h3>"; if($ir['crystalbank']>-1) { //Addition of the functions below to stop a hidden error. (Use error_reporting(E_ALL); too see what I mean... $_GET['action'] = isset($_GET['action']) && is_string($_GET['action']) ? strtolower(trim($_GET['action'])) : ""; switch($_GET['action']) { case "deposit": deposit(); break; case "withdraw": withdraw(); break; default: index(); break; } } else { if(isset($_GET['buy'])) { if($ir['money'] > 25000) { print "Congratulations, you bought a crystal bank account for \$25,000! [url='crystalbank.php']Start using my account[/url]"; $sql = sprintf("UPDATE users SET money = money - %u WHERE (userid = %u)", 25000, $userid); $db->query($sql); } else { die("You do not have enough money to open an account, it costs \$25,000 for an account [url='explore.php']Back to town...[/url]"); } } else { print "Open a crystal bank account today, just \$25,000! [url='crystalbank.php?buy']> Yes, sign me up![/url]"; } } function index() { global $db, $ir, $c, $userid, $h; $s = ($_POST['deposit'] == 1) ? "" : "s"; //Outputs: //0 crystals //1 crystal //2 crystals echo sprintf("[b]You currently have %s crystal%s in your crystal bank.[/b] ", number_format($ir['crystalbank']), $s); echo ("<table width='85%' cellspacing=1 class='table'>"); echo ("<tr>"); echo ("<td width='50%'>[b]Deposit crystal[/b] "); echo ("<form action='crystalbank.php?action=deposit' method='post'>"); echo sprintf("Amount: <input type='text' name='deposit' value='%u' /> ", $ir['crystalbank']); echo ("<input type='submit' value='Deposit' /></form></td>"); echo ("<td width='50%'>[b]Withdraw crystals[/b] "); echo ("There is no fee on withdrawals.<form action='crystalbank.php?action=withdraw' method='post'>"); echo sprintf("Amount: <input type='text' name='withdraw' value='%u' /> ", $ir['crystalbank']); echo ("<input type='submit' value='Withdraw' /></form></td>"); echo ("</tr>"); echo ("</table>"); } function deposit() { global $db, $ir, $c, $userid, $h; $_POST['deposit'] = (float) $_POST['deposit']; if($_POST['deposit'] > $ir['crystals']) { print "You do not have enough crystals to deposit in the bank."; } else { $gain=$_POST['deposit']-$fee; $ir['crystals']+=$gain; $sql = sprintf("UPDATE users SET crystalbank = crystalbank + %u, crystals = crystals - %u WHERE (userid = %u)", mysql_real_escape_string($gain), mysql_real_escape_string($_POST['deposit']), $userid); //You MUST ALWAYS escape everything,, unless you want hackers to gain access? $db->query($sql); $s = ($_POST['deposit'] == 1) ? "" : "s"; //Outputs: //0 crystals //1 crystal //2 crystals echo sprintf("You hand over %s crystal%s to be deposited, ", number_format($_POST['deposit']), $s); echo sprintf(" is added to your account. ", number_format($gain)); echo sprintf("[b]You now have %s crystal%s in the bank.[/b] ", number_format($ir['crystalbank']), $s); echo ("[url='crystalbank.php']> Back[/url]"); } } function withdraw() { global $db,$ir,$c,$userid,$h; $_POST['withdraw'] = (float) $_POST['withdraw']; if($_POST['withdraw'] > $ir['crystalbank']) { print "You do not have enough crystals to withdraw from the bank."; } else { $gain=$_POST['withdraw']; $ir['crystalbank']-=$gain; $sql = sprintf("UPDATE users SET crystalbank = crystalbank - %u, crystals = crystals + %u WHERE (userid = %u)", mysql_real_escape_string($gain), mysql_real_escape_string($gain), $userid); $db->query($sql); $s = ($_POST['deposit'] == 1) ? "" : "s"; //Outputs: //0 crystals //1 crystal //2 crystals echo ("You ask to withdraw , ", number_format($gain), $s); echo ("the banking lady grudgingly hands it over. "); echo ("[b]You now have %s crystal%s in the bank.[/b] ", number_format($ir['crystalbank']), $s); echo ("[url='crystalbank.php']> Back[/url]"); } } $h->endpage(); ?>
-
[mccode v2] Updated Display Pic System
Magictallguy replied to Richard's topic in Free Modifications
Re: Updated Display Pic System [V2] Speak in english and we may be able to help you.. -
Re: online/offline/total users Stick inbetween those 2 lines of code..
-
Re: Quote Mod Thanks for the security LostOne. sprintf() would be a good idea there xD
-
Re: House Tax [$5] No idea who Matt is, but I'll make this for free if you wish? The screenshot no longer works so I don't know how you want it, but it's not hard to make :)
-
Re: House Rentals [V2] Ah nuts xD
-
[mccode v1] Advanced(ish) Level Upgrade Mod.
Magictallguy replied to Matty's topic in Free Modifications
Re: [Free] Advanced(ish) Level Upgrade Mod. Actually no, if you look into the globals.php, you'll find that $ir['exp_needed'] is defined there. -
Re: Updated Mailbox [v1] Instead of using include "globals.php"; Use include_once(DIRNAME(__FILE__) . '/globals.php');
-
Re: [V2] Edit/Delete Item Type [V2] Nicely done Tonka! Saves me from having to make it :P
-
Re: Cant get my head around these? I've had a friend with that problem, and we narrowed it down to the browser that the user is using. Sometimes, even simple things like clearing cache/cookies actually helps prevent that.
-
Re: NEW Explore.php[v2] <?php /*----------------------------------------------------- -- Made By squimmy -- Free Mod -- Tables fixed by MTG -- Learn to code -.- -----------------------------------------------------*/ include "globals.php"; $tresder=(int) rand(100,999); if($ir['jail'] or $ir['hospital']) { die("This page cannot be accessed while in jail or hospital."); } $q=$db->query("SELECT u.*,c.* FROM users u LEFT JOIN cities c ON u.location=c.cityid WHERE u.userid=$userid"); $r=$db->fetch_row($q); ?> [b]You begin exploring <? echo sprintf("%s", $r['cityname']); ?>, you see a bit that interests you.[/b] <table width=75% border=7> <tr height='100'> <td valign=top> <u><font color=red>[b]Coming Soon</font></u> [url='usersonline.html']Users Online[/url] [url='usersonline.php']Users Online[/url] </td> <td valign=top> <u><font color=red>[b]Coming Soon</font></u> [url='usersonline.html']Users Online[/url] [url='usersonline.php']Users Online[/url] </td> <td valign=top> <u><font color=red>[b]Coming Soon</font></u> [url='usersonline.html']Users Online[/url] [url='usersonline.php']Users Online[/url] </td> </tr> <tr height=100> <td valign=top> <u><font color=red>[b]Coming Soon</font></u> [url='usersonline.html']Users Online[/url] [url='usersonline.php']Users Online[/url] </td> <td valign=top> <u><font color=red>[b]Coming Soon</font></u> [url='usersonline.html']Users Online[/url] [url='usersonline.php']Users Online[/url] </td> <td valign=top> <u><font color=red>[b]Coming Soon</font></u> [url='usersonline.html']Users Online[/url] [url='usersonline.php']Users Online[/url] </td> </tr> <tr height=100> <td valign=top> <u><font color=red>Coming Soon[b]</u> [url='usersonline.html']Users Online[/url] [url='usersonline.php']Users Online[/url] </td> <td valign=top> <u><font color=red>[b]Coming Soon</u> [url='usersonline.html']Users Online[/url] [url='usersonline.php']Users Online[/url] </td> <td valign=top> <u>[b]<font color=red>Bargate</font></u> [url='usersonline.html']Users Online[/url] [url='usersonline.php']Users Online[/url] </td> </tr> <tr height=100> <td valign=top> <u>[b]<font color=red>Coming Soon</font></u> [url='usersonline.html']Users Online[/url] [url='usersonline.php']Users Online[/url] </td> <td valign=top> <u>[b]<font color=red>Coming Soon</font></u> [url='usersonline.html']Users Online[/url] [url='usersonline.php']Users Online[/url] [url='usersonline.php']Users Online[/url] </td> <td valign=top> <u>[b]<font color=red>Coming Soon</font></u> [url='useronline.php']Users Online[/url] </td> </tr> </table> <table cellspacing='3' border='2' cellpadding='4' class='table' width='53%'> <tr> <td colspan='2'>[b]<center>Referal Link: http://<? echo sprintf("%s", $domain); ?>/register.php?REF= <? echo sprintf("%s", $userid); ?> </td> <td colspan='2'>Every signup from this link earns you two valuable crystals!</td> </tr> </table> <? $h->endpage(); ?> Fixed up for you
-
[mccode v2] Updated Display Pic System
Magictallguy replied to Richard's topic in Free Modifications
Re: Updated Display Pic System [V2] Well said.. This aint ebay feedback system mate rofl so lets gain an extra post by taking the p*ss out of other members , so immeture. -
Re: [V1] Unlocks [V1] Would love to know what the point in this is...
-
Re: Ranger Den [$25] Nyna said it's good.. So it's gotta be good! xD
-
Re: [REVIEW]Criminal Warfare I find it sexy, yet elegent. Basic, yet professional But as Justice said, the text can be alittle hard to read.
-
Re: Tutorial: v1 - v2 Conversion *muffles laughter* Be nice people!
-
Re: upgraded lucky boxes He's not a graphics person :P
-
PHP Code to send a mail when something happens
Magictallguy replied to CHAMAVELI's topic in General Discussion
Re: PHP Code to send a mail when something happens Another idea for you, create a mail_add function (like stafflog_add, or event_add). Once that's done, you can just put mail_add(UserID, "Message"); Simplified for you :P And if you have a look at the check_level() function (I haven't looked at that for a while so this purely from memory) Add in there somewhere if($ir['exp'] == $ir['exp_needed']) { $newlevel = $ir['level']+1; $sql = sprintf("INSERT INTO mail VALUES ('', %u, '%s', %u, %u, '%s', '%s')", 0, "Upgrade", $r['userid'], "unix_timestamp()", "Level Upgrade", "You can upgrade your level! Click on the Upgrade link found wherever to become level $newlevel"); $db->query($sql); } Or something like that NOT tested -
Re: Count Backwards :D <?php $number = "4935"; echo sprintf("%s", number_format($number)); ?>
-
Re: Jail and hosp Probably set up the cron job wrong..
-
Re: i cant install HELP If you are still having trouble. Feel free to contact me on MSN [email protected]
-
Re: Free 2 - Gym Not only did I screw up, I left in an abusable bug O_o <?php /** If you don't understand it, leave it alone **/ $macropage = "gym.php"; include "globals.php"; global $db, $h, $ir, $userid; if ($ir['hospital']) { echo " You cannot access the gym whilst in hospital</p>"; $h->endpage(); exit; } $prefs = isset($_SESSION['gymprefs']) ? $_SESSION['gymprefs'] : array('what' => "all", 'expend' => "100%"); $what = $prefs['what']; $expend = $prefs['expend']; $message = false; $sql = sprintf("SELECT us.strength, us.agility, us.guard, us.labour, u.energy, u.will, u.jail FROM users u LEFT JOIN userstats us ON (u.userid = us.userid) WHERE (u.userid = %u)", $userid); $row = $db->fetch_row($db->query($sql)); $formID = preg_replace("`^([0-9A-F]{8})([0-9A-F]{4})([0-9A-F]{4})([0-9A-F]{4})([0-9A-F]{12})$`ms", "{\\1-\\2-\\3-\\4-\\5}", strtoupper(md5(serialize(array(session_id(), "Gym", null))))); if (isset($_POST['formID']) && is_string($_POST['formID']) && ($_POST['formID'] === $formID)) { $what = isset($_POST['what']) && is_string($_POST['what']) && preg_match("`^((all)|(strength)|(agility)|(guard)|(labour))$`ims", $_POST['what']) ? strtolower($_POST['what']) : $what; $expend = isset($_POST['expend']) && is_string($_POST['expend']) && preg_match("`^((100%)|(75%)|(50%)|(25%)|(value))$`ims", $_POST['expend']) ? strtolower($_POST['expend']) : $expend; $value = isset($_POST['value']) && is_string($_POST['value']) && preg_match("`^\d+$`ims", $_POST['value']) ? @intval($_POST['value']) : 0; $sql = sprintf("SELECT energy, will FROM users WHERE (userid = %u)", $userid); $rs = $db->query($sql); $info = $db->fetch_row($rs); $energy = $row['energy']; $will = $row['will']; switch ($expend) { case "100%": $value = $row['energy']; break; case "75%": $value = $row['energy'] * 0.75; break; case "50%": $value = $row['energy'] * 0.50; break; case "25%": $value = $row['energy'] * 0.25; break; default: break; } $value = floor($value); if ($value > $row['energy']) $message = "<span style='color:#C00;'>You don't have enough energy</span>"; else { $prefs = array('what' => $what, 'expend' => $expend); $gain = 0; $will = $row['will']; for ($i = 0; $i < $value; $i++) { $gain += mt_rand(1, 3) / mt_rand(500, 900) * mt_rand(500, 900) * (($will + 20) / 150); $will = max(0, $will - mt_rand(1, 3)); } if ($row['jail']) $gain *= 0.5; $row['will'] = floor($will); $row['energy'] -= $value; switch ($what) { case "all": $message = sprintf("<span style='color:#070;'>You gain %s in each stat</span>", number_format($gain * 0.25, 2)); $row['strength'] += $gain * 0.25; $row['agility'] += $gain * 0.25; $row['guard'] += $gain * 0.25; $row['labour'] += $gain * 0.25; break; case "strength": $message = sprintf("<span style='color:#070;'>You gain %s in strength</span>", number_format($gain, 2)); $row['strength'] += $gain; break; case "agility": $message = sprintf("<span style='color:#070;'>You gain %s in agility</span>", number_format($gain, 2)); $row['agility'] += $gain; break; case "guard": $message = sprintf("<span style='color:#070;'>You gain %s in guard</span>", number_format($gain, 2)); $row['guard'] += $gain; break; case "labour": $message = sprintf("<span style='color:#070;'>You gain %s in labour</span>", number_format($gain, 2)); $row['labour'] += $gain; break; } $sql1 = sprintf("UPDATE userstats SET strength = %.6f, agility = %.6f, guard = %.6f, labour = %.6f WHERE (userid = %u)", $row['strength'], $row['agility'], $row['guard'], $row['labour'], $userid); $sql2 = sprintf("UPDATE users SET will = %u, energy = %d WHERE (userid = %u)", $row['will'], $row['energy'], $userid); if($gain > 1) { $sql3 = sprintf("UPDATE users SET exp = exp + %u WHERE (userid = %d)", ($ir['level']), $userid); $db->query($sql3); } $db->query($sql1); $db->query($sql2); } $_SESSION['gymprefs'] = $prefs; } $row['ranks'] = array ( 'strength' => $db->fetch_single($db->query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (strength > %.6f)", $row['strength']))) + 1, 'agility' => $db->fetch_single($db->query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (agility > %.6f)", $row['agility']))) + 1, 'guard' => $db->fetch_single($db->query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (guard > %.6f)", $row['guard']))) + 1, 'labour' => $db->fetch_single($db->query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (labour > %.6f)", $row['labour']))) + 1, 'total' => $db->fetch_single($db->query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (strength + agility + guard + labour > %.6f)", $row['strength'] + $row['agility'] + $row['guard'] + $row['labour']))) + 1, ); echo "<div id='gym'>"; echo sprintf("<h3>[img=imageicons/stats.png] %sGym [img=imageicons/stats.png]</h3>", $ir['jail'] ? "Jail " : ""); if ($message) echo sprintf(" %s</p>", $message); echo "<form name='train' id='train' action='gym.php' method='post' style='padding:0;margin:0;'>"; echo sprintf("<input type='hidden' name='formID' value='%s' />", $formID); echo "<table cellpadding='0' cellspacing='0'>"; echo "<tr>"; echo "<td class='h' style='width:50%;'>Train</td>"; echo "<td class='h' style='width:50%;'>Expend</td>"; echo "</tr>"; echo "<tr>"; echo "<td style='line-height:200%;'>"; echo sprintf("<input type='radio' name='what' id='what0' value='all' %sstyle='vertical-align:middle;' /><label for='what0' style='cursor:pointer;'>All (25%% energy in each) [Rank #%s]</label> ", $what === "all" ? "checked='checked' " : "", number_format($row['ranks']['total'])); echo sprintf("<input type='radio' name='what' id='what1' value='strength' %sstyle='vertical-align:middle;' /><label for='what1' style='cursor:pointer;'>Strength (%s) [Rank #%s]</label> ", $what === "strength" ? "checked='checked' " : "", number_format($row['strength']), number_format($row['ranks']['strength'])); echo sprintf("<input type='radio' name='what' id='what2' value='agility' %sstyle='vertical-align:middle;' /><label for='what2' style='cursor:pointer;'>Agility (%s) [Rank #%s]</label> ", $what === "agility" ? "checked='checked' " : "", number_format($row['agility']), number_format($row['ranks']['agility'])); echo sprintf("<input type='radio' name='what' id='what3' value='guard' %sstyle='vertical-align:middle;' /><label for='what3' style='cursor:pointer;'>Guard (%s) [Rank #%s]</label> ", $what === "guard" ? "checked='checked' " : "", number_format($row['guard']), number_format($row['ranks']['guard'])); echo sprintf("<input type='radio' name='what' id='what4' value='labour' %sstyle='vertical-align:middle;' /><label for='what4' style='cursor:pointer;'>Labour (%s) [Rank #%s]</label> ", $what === "labour" ? "checked='checked' " : "", number_format($row['labour']), number_format($row['ranks']['labour'])); echo "</td>"; echo "<td style='line-height:200%;'>"; echo sprintf("<input type='radio' name='expend' id='expend0' value='100%%' %sstyle='vertical-align:middle;' /><label for='expend0' style='cursor:pointer;'>100%% Energy</label> ", $expend === "100%" ? "checked='checked' " : ""); echo sprintf("<input type='radio' name='expend' id='expend1' value='75%%' %sstyle='vertical-align:middle;' /><label for='expend1' style='cursor:pointer;'>75%% Energy</label> ", $expend === "75%" ? "checked='checked' " : ""); echo sprintf("<input type='radio' name='expend' id='expend2' value='50%%' %sstyle='vertical-align:middle;' /><label for='expend2' style='cursor:pointer;'>50%% Energy</label> ", $expend === "50%" ? "checked='checked' " : ""); echo sprintf("<input type='radio' name='expend' id='expend3' value='25%%' %sstyle='vertical-align:middle;' /><label for='expend3' style='cursor:pointer;'>25%% Energy</label> ", $expend === "25%" ? "checked='checked' " : ""); echo sprintf("<input type='radio' name='expend' id='expend4' value='value' %sstyle='vertical-align:middle;' onclick='document.train.value.focus();' /><label for='expend4' style='cursor:pointer;'><input type='text' id='value' name='value' value='{$row['energy']}' size='8' onfocus='this.select();' /> Energy</label> ", $expend === "value" ? "checked='checked' " : ""); //(C)2008,Nyna echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan='2' style='text-align:center;padding:6px;'>"; echo "<input type='submit' name='submit' value='Work Out!' />"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</form>"; echo "</div>"; $h->endpage(); ?> Code is fixed, tested, and bugless :) Edit: Well.. Now it is! xD
-
Re: Free 2 - Search Which are now referred to as "Enterprise Servers"