-
Posts
2,124 -
Joined
-
Last visited
-
Days Won
144
Content Type
Profiles
Forums
Events
Everything posted by Magictallguy
-
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"
-
Re: Free 2 - Gym <?php $macropage = "gym.php"; include "v1.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); $sql3 = sprintf("UPDATE `users` SET `exp` = (%d + %d * %d / %d) WHERE (`userid` = $u)", $ir['exp'], $_POST['amnt'], $ir['maxwill'], 750); $db->query($sql1); $db->query($sql2); $db->query($sql3); } $_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 "<style type='text/css'>"; echo "#gym { }"; echo "#gym h3, #gym p { }"; echo "#gym table { width:90%;border-collapse:collapse; }"; echo "#gym th { border:solid 1px #333;background:#F6F6F6 url(titlebg.gif);padding:3px;color:#333; }"; echo "#gym td { border:solid 1px #333;padding:3px;color:#333; }"; echo "#gym { }"; echo "</style>"; echo "<div id='gym'>"; echo sprintf("<h3>%sGym</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 "<th class='sub' style='width:50%;'>Train</th>"; echo "<th class='sub' style='width:50%;'>Expend</th>"; 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='Train' />"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</form>"; echo "</div>"; echo "<p style='color:#CCC;'>An open-source extension from [url='http://nyna.co.uk/']Nyna[/url]</p>"; $h->endpage(); ?> There you go!
-
Re: Free 2 - Search I forgot to mention that I've made things slightly easier.. Contents of v1.php <? session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); ?> 'tis very simple stuff - same idea as v2's include "globals.php";
-
Re: Free 2 - Search For v1! <?php include "v1.php"; echo "<style type='text/css'>"; echo "table.search { border-collapse:collapse;width:95%; }"; echo "table.search th { background:#F6F6F6 url(titlebg.gif);padding:0.25em;border:solid 1px #999; }"; echo "table.search td { padding:0.25em;border:solid 1px #999; }"; echo "</style>"; function time_format( $seconds, $mode = "short" ) { $names = array('long' => array("day", "hour", "minute", "second"), 'short' => array("day", "hr", "min", "sec")); $seconds = floor($seconds); $minutes = intval($seconds / 60); $seconds -= ($minutes * 60); $hours = intval($minutes / 60); $minutes -= ($hours * 60); $days = intval($hours / 24); $hours -= ($days * 24); $result = array(); if ($days) $result[] = sprintf("%s %s%s", number_format($days), $names[$mode][0], $days == 1 ? "" : "s"); if ($hours) $result[] = sprintf("%s %s%s", number_format($hours), $names[$mode][1], $hours == 1 ? "" : "s"); if (($minutes) && (count($result) < 2)) $result[] = sprintf("%s %s%s", number_format($minutes), $names[$mode][2], $minutes == 1 ? "" : "s"); if ((($seconds) && (count($result) < 2)) || !count($result)) $result[] = sprintf("%s %s%s", number_format($seconds), $names[$mode][3], $seconds == 1 ? "" : "s"); return implode(" and ", $result); } $what = ""; if (isset($_POST['what']) && is_string($_POST['what'])) { $what = trim(substr(trim($_POST['what']) . " ", 0, 50)); $what = trim(str_replace("%", "", $what)); if (strlen($what)) { if (preg_match("`\d+`ims", $what)) { $sql = sprintf ( "SELECT `userid`, `username`, `level`, `laston`, `user_level`, `donatordays` ". "FROM `users` ". "WHERE ((`userid` = %u) OR (`username` LIKE '%%%s%%'))", $what, mysql_escape($what) ); } else { $sql = sprintf ( "SELECT `userid`, `username`, `level`, `laston`, `user_level`, `donatordays` ". "FROM `users` ". "WHERE (`username` LIKE '%%%s%%') ". "ORDER BY `username` ". "LIMIT 25", mysql_escape($what) ); } $rs = mysql_query($sql); $rows = array(); $colors = array ( 'staff' => "#C00", 'member' => "#009", 'donator' => "#070", ); while ($row = mysql_fetch_array($rs)) $rows[] = array ( 'id' => intval($row['userid']), 'name' => $row['username'], 'level' => intval($row['level']), 'ping' => intval($row['laston']), 'staff' => ($row['user_level'] > 1), 'donator' => ($row['donator'] > 0), ); // comment out these 2 lines of you do NOT want to automatically // jump to the user's profile IF there is only one result. if (count($rows) == 1) header(sprintf("Location: viewuser.php?u=%u", $rows[0]['id'])); // display results echo "<h3>Search Results</h3>"; echo "<table cellpadding='0' cellspacing='0' class='search'>"; echo "<tr>"; echo "<th style='text-align:left;'>User</th>"; echo "<th style='text-align:center;'>Level</th>"; echo "<th style='text-align:left;'>Last Seen</th>"; echo "</tr>"; foreach ($rows as $user) { echo "<tr>"; echo sprintf("<td>[url='viewuser.php?u=%u']%s [%u][/url]</td>", $user['id'], $user['staff'] ? $colors['staff'] : ($user['donator'] ? $colors['donator'] : $colors['member']), htmlspecialchars($user['name']), $user['id']); echo sprintf("<td style='text-align:center;'>%u</td>", number_format($user['level'])); echo sprintf("<td>%s ago</td>", time_format(time() - $user['ping'])); echo "</tr>"; } if (!count($rows)) { echo "<tr>"; echo "<td colspan='3'>No results found</td>"; echo "</tr>"; } echo "</table>"; } } echo "<h3>Search</h3>"; echo "<form action='search.php' method='post'>"; echo sprintf("Name or ID# <input type='text' name='what' maxlength='50' value='%s' /> ", htmlspecialchars($what)); echo "<input type='submit' value='Search' />"; echo "</form>"; echo "<p style='color:#CCC;'>An open-source extension from [url='http://nyna.co.uk/']Nyna[/url]</p>"; $h->endpage(); ?> Tested and works perfectly!
-
Re: Multiple Item Use Mod {v1} That won't work with v2 as the itemname and so on is different..
-
Re: Tutorial: v2 - v1 Conversion Oh shush xD
-
Re: Tutorial: v2 - v1 Conversion Right, so... include "globals.php"; becomes session_start(); require_once __DIR__.'/mysql.php'; global $c; require_once __DIR__.'/global_func.php'; if (!array_key_exists('loggedin', $_SESSION) or 0 == $_SESSION['loggedin']) { exit(header('Location: /login.php')); } $userid = array_key_exists('userid', $_SESSION) && ctype_digit($_SESSION['userid']) && $_SESSION['userid'] > 0 ? $_SESSION['userid'] : null; $is = mysql_query('SELECT u.*, us.* FROM users AS u INNER JOIN userstats AS us ON u.userid = us.userid WHERE u.userid = '.$userid, $c) or die(mysql_error()); if (!mysql_num_rows($is)) { session_unset(); session_destroy(); exit(header('Location: /login.php')); } $ir = mysql_fetch_assoc($is); check_level(); $fm = money_formatter($ir['money']); $cm = money_formatter($ir['crystals'], ''); $lv = date('F j, Y, g:i a', $ir['laston']); require_once __DIR__.'/header.php'; $h = new headers(); $h->startheaders(); $h->userdata($ir, $lv, $fm, $cm); $h->menuarea(); include "sglobals.php"; becomes session_start(); require_once __DIR__.'/mysql.php'; global $c; require_once __DIR__.'/global_func.php'; if (!array_key_exists('loggedin', $_SESSION) or 0 == $_SESSION['loggedin']) { exit(header('Location: /login.php')); } $userid = array_key_exists('userid', $_SESSION) && ctype_digit($_SESSION['userid']) && $_SESSION['userid'] > 0 ? $_SESSION['userid'] : null; $is = mysql_query('SELECT u.*, us.* FROM users AS u INNER JOIN userstats AS us ON u.userid = us.userid WHERE u.userid = '.$userid, $c) or die(mysql_error()); if (!mysql_num_rows($is)) { session_unset(); session_destroy(); exit(header('Location: /login.php')); } $ir = mysql_fetch_assoc($is); if(!in_array($ir['user_level'], array(2, 3, 5))) { exit(header('Location: /index.php')); } require_once __DIR__.'/header.php'; $h = new headers(); $h->startheaders(); check_level(); $fm = money_formatter($ir['money']); $cm = money_formatter($ir['crystals'], ''); $lv = date('F j, Y, g:i a', $ir['laston']); $h->userdata($ir, $lv, $fm, $cm); $h->smenuarea(); $db->query becomes mysql_query $db->fetch_row becomes mysql_fetch_assoc $db->num_rows becomes mysql_num_rows $db->fetch_single becomes mysql_result
-
Re: [FAQ] sprintf - no, it's not a phone company I feel I must agree :)
-
[mccode] NEW USERS IMAGE GALLERY FREE!!!!!
Magictallguy replied to canibalstew's topic in Free Modifications
Re: NEW USERS IMAGE GALLERY FREE!!!!! Well that's an interesting mod... A lot of security will need to be implemented into that. That way you're not uploading to someone else's server! A few backdoors/worms could easiy be uploaded there lol -
Re: Paper Ads I might add this to my update paper mod :)
-
mccode-v2 Updated Newspaper - more than one page
Magictallguy replied to Magictallguy's topic in Free Modifications
Re: Updated Newspaper - more than one page Staff Functions!! SQL's Add more for more pages :) ALTER TABLE `papercontent` ADD `page2_content` LONGTEXT NOT NULL , ADD `page3_content` LONGTEXT NOT NULL ; Open: staff_special.php Add these cases case 'editnews2': newspaper_page_2_form(); break; case 'editnews3': newspaper_page_3_form(); break; Find this function newspaper_form() { global $db,$ir,$c,$h,$userid; $q=$db->query("SELECT * FROM papercontent LIMIT 1"); $news=$db->fetch_single($q); print "<h3>Editing Newspaper</h3><form action='staff_special.php?action=subnews' method='post'> <textarea rows='7' cols='35' name='newspaper'>$news</textarea> <input type='submit' value='Change' /></form>"; } function newspaper_submit() { global $db,$ir,$c,$h,$userid; $news=$_POST['newspaper']; $db->query("UPDATE papercontent SET content='$news'"); print "Newspaper updated!"; stafflog_add("Updated game newspaper"); } And replace with <?php function newspaper_form() { global $db; if(!isset($_POST['submit'])) { $news = $db->fetch_single($db->query("SELECT content FROM papercontent LIMIT 1")); echo "<h3>Editing Newspaper Page 1</h3> <form action='staff_special.php?action=editnews' method='post'> <textarea rows='7' cols='35' name='newspaper'>".stripslashes($news)."</textarea> <input type='submit' name='submit' value='Change' /> </form>"; } else { $db->query("UPDATE papercontent SET content = '".$db->escape($_POST['newspaper'])."'"); echo "Newspaper updated!"; stafflog_add("Updated game newspaper page 1"); } } function newspaper_page_2_form() { global $db; if(!isset($_POST['submit'])) { $news = $db->fetch_single($db->query("SELECT page2_content FROM papercontent LIMIT 1")); echo "<h3>Editing Newspaper Page 2</h3> <form action='staff_special.php?action=editnews2' method='post'> <textarea rows='7' cols='35' name='newspaper'>".stripslashes($news)."</textarea> <input type='submit' name='submit' value='Change' /> </form>"; } else { $db->query("UPDATE papercontent SET page2_content = '".$db->escape($news)."'"); echo "Newspaper updated!"; stafflog_add("Updated game newspaper page 2"); } } function newspaper_page_3_form() { global $db; if(!isset($_POST['submit'])) { $news = $db->fetch_single($db->query("SELECT page3_content FROM papercontent LIMIT 1")); echo "<h3>Editing Newspaper Page 3</h3> <form action='staff_special.php?action=editnews3' method='post'> <textarea rows='7' cols='35' name='newspaper'>".stripslashes($news)."</textarea> <input type='submit' name='submit' value='Change' /></form>"; } else { $db->query("UPDATE papercontent SET page3_content = '".$db->escape($news)."'"); echo "Newspaper updated!"; stafflog_add("Updated game newspaper page 3"); } } Remove the current newspaper link from your smenu.php and add these ones > [url='staff_special.php?action=editnews']Edit Newspaper Page 1[/url] > [url='staff_special.php?action=editnews2']Edit Newspaper Page 2[/url] > [url='staff_special.php?action=editnews3']Edit Newspaper Page 3[/url] You'll also have to update the newspaper - which I'll add in to my original post :)