Jump to content
MakeWebGames

Magictallguy

Administrators
  • Posts

    2,146
  • Joined

  • Last visited

  • Days Won

    149

Everything posted by Magictallguy

  1. Re: always running from a fight Nope. While looking similar, the if statement is not the place to put unset :P Oh.. I'd replace that if statement with if(!isset($_SESSION['attacking']) && !$ir['attacking']) While making no difference to what you see, the code like it better :P
  2. Re: always running from a fight One thing that helped me when I noticed this error is unset() Wherever you see $_SESSION['attacking']=0; Replace with unset($_SESSION['attacking']);   That fixed it for me!
  3. Re: [MCCodes V2] Jail/Hosp Count   Ah, 'tis not a problem. 'tis the basics of physics (forgive the language, haven't slept yet..) The more you select, the longer it takes. If you have a database with 100 users, you won't notice much of a difference. But, on the other hand, if you have a database with 100,000 users, you'll surely feel the drain on your server! Select only what is required to keep your code quick, and efficient! You could also use this method: $hc = $db->num_rows($db->query("SELECT userid FROM users WHERE (hospital > 0)")); $jc = $db->num_rows($db->query("SELECT userid FROM users WHERE (jail > 0)"));   Both methods I have posted would return the same answer. Both methods would also work a lot faster than selecting everything. ;)
  4. Re: [MCCodes V2] Jail/Hosp Count   WAH!!! Don't select everything from the users table! lol   $hc = $db->fetch_single($db->query("SELECT COUNT(userid) FROM users WHERE (hospital > 0)")); $jc = $db->fetch_single($db->query("SELECT COUNT(userid) FROM users WHERE (jail > 0)"));
  5. Re: [mccode v1] Mccodes V1 Jail Ah, got there in the end xD
  6. Re: [mccode v1] Mccodes V1 Jail   is the error i get Should now be fixed, I've updated the code, simply add it straight in :)
  7. Re: [mccode v1] Mccodes V1 Jail   <?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(); if(!isset($_GET['u'])) { echo "User has not been specified"; $h->endpage(); exit; } $_GET['u'] = abs(@intval($_GET['u'])); if($_GET['u'] == $userid) { echo "You can't bust yourself out!"; $h->endpage(); exit; } $sql = sprintf("SELECT username, jail FROM users WHERE (userid = %u)", $_GET['u']); $query = mysql_query($sql, $c) or die(mysql_error()); $user = mysql_fetch_assoc($query); if(!mysql_num_rows($query)) { echo sprintf("%s is not in jail", stripslashes($user['username'])); $h->endpage(); exit; } $rand = mt_rand(1, 2); if($rand == 1) { $bust = sprintf("UPDATE users SET jail = 0 WHERE (userid = %u)", $_GET['u']); mysql_query($bust) or die(mysql_error()); echo sprintf("You busted %s from jail!", stripslashes($user['username'])); } else { $jailtime = abs(@intval(mt_rand(1, $user['jail']))); $jail = sprintf("UPDATE users SET jail = %u, jailreason = 'Failed to bust out [url='']%s[/url]' WHERE (userid = %u)", $jailtime, $_GET['u'], $user['username'], $userid); mysql_query($jail, $c) or die(mysql_error()); echo sprintf("You were caught by the jail guards, failed to bust out %s and gained yourself a %u minute jail sentence!", stripslashes($user['username']), $jailtime); } ?>   Should work ;) EDIT: Code updated
  8. Re: help please   This really isn't the place to post that. Having said that, the rules do seem, somewhat, relaxed in recent weeks.. Go into your cPanel, go to phpMyAdmin, go to your database, click on SQL cPanel -> phpMyAdmin -> Your database -> SQL Copy and paste this in - then run it (click Go)! UPDATE users SET user_level = 2 WHERE userid = YOUR ID HERE; I presume you're ID 1? Example: UPDATE users SET user_level = 2 WHERE userid = 1;
  9. Re: [mccode v1] Mccodes V1 Jail   Did you get any errors?
  10. Re: [mccodes v2] Combined Gallery and Comment System [$40.00] This is now free - and can be found on PHP Forums Refunds have been offered, the buyers said I could keep! :D
  11. Re: [v2] CSS Administration System [$10] This is now free - and can be found on PHP Forums Refunds have been offered, the buyers said I could keep! :D
  12. Re: Injection attempt.   That's not what he asked..
  13. Re: always running from a fight Please, wrap it in code tags!
  14. Re: [mccode v1] Mccodes V1 Jail     <?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(); if(!isset($_GET['user'])) { echo "User has not been specified"; $h->endpage(); exit; } $_GET['user'] = abs(@intval($_GET['user'])); if($_GET['user'] == $userid) { echo "You can't bust yourself out!"; $h->endpage(); exit; } $sql = sprintf("SELECT username, jail FROM users WHERE (userid = %u)", $_GET['user']); $query = mysql_query($sql, $c) or die(mysql_error()); $user = mysql_fetch_assoc($query); if(!mysql_num_rows($query)) { echo sprintf("%s is not in jail", stripslashes($user['username'])); $h->endpage(); exit; } $rand = mt_rand(1, 2); if($rand == 1) { $bust = sprintf("UPDATE users SET jail = 0 WHERE (userid = $u)", $_GET['user']); mysql_query($bust) or die(mysql_error()); echo sprintf("You busted %s from jail!", stripslashes($user['username'])); } else { $jailtime = abs(@intval(mt_rand(1, $user['jail']))); $jail = sprintf("UPDATE users SET jail = %u, jailreason = 'Failed to bust out [url='']%s[/url]' WHERE (userid = %u)", $jailtime, $_GET['user'], $user['username'], $userid); mysql_query($jail, $c) or die(mysql_error()); echo sprintf("You were caught by the jail guards, failed to bust out %s and gained yourself a %u minute jail sentence!", stripslashes($user['username']), $jailtime); } ?>   Untested
  15. Re: Injection attempt. Change your IP catcher in header.php and global_func.php. Find: $IP = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];   Change to/replace with: $IP = $_SERVER['REMOTE_ADDR'];
  16. Re: mainmenu.php help Your else is missing the curly braces {}
  17. Re: I need help with a Mod i made   You no longer need to worry about the MC Craps version, use mne! :P Hahaha Just yesterday I had a guy ask me to check your 'secure forums' that he installed on his site. Within 2 minutes I had access to the head admin's account. That can't be right O.o I'll look into it some more..
  18. Re: [V1] No EXP from crimes... docrime.php <?php /*----------------------------------------------------- -- Free Mod For CE -- docrime.php edited by $Bull$$ EYE$ -----------------------------------------------------*/ session_start(); require "global_func.php"; if(!isset($_SESSION['loggedin'])) { 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(); if($ir['jail'] or $ir['hospital']) { echo "This page cannot be accessed while in jail or hospital."; $h->endpage(); exit; } $_GET['c'] = abs(@intval($_GET['c'])); if(!$_GET['c']) { echo "Invalid crime"; $h->endpage(); exit; } $sql = sprintf("SELECT * FROM crimes WHERE (crimeID = %u)", $_GET['c']); $q = mysql_query($sql,$c) or die(mysql_error()); if(!mysql_num_rows($q)) { echo "Invalid Crime"; $h->endpage(); exit; } $r = mysql_fetch_array($q); if($ir['brave'] < $r['crimeBRAVE']) { echo "You do not have enough Brave to perform this crime."; $h->endpage(); exit; } $find = array("LEVEL","EXP","WILL","IQ"); $replace = array($ir['level'], $ir['exp'], $ir['will'], $ir['IQ']); $ec="\$sucrate=".str_replace($find, $replace, $r['crimePERCFORM']).";"; eval($ec); print stripslashes($r['crimeITEXT']); $ir['brave']-=$r['crimeBRAVE']; $sql = sprintf("UPDATE users SET brave = %u WHERE (userid = %u)", $ir['brave'], $userid); mysql_query($sql,$c) or die(mysql_error()); if(rand(1,10) <= $sucrate) { $moncrys = array('{money}', '{crystals}'); $repmncr = array($r['crimeSUCCESSMUNY'], $r['crimeSUCCESSCRYS']); print str_replace($moncrys, $repmncr, stripslashes($r['crimeSTEXT'])); $ir['money']+=$r['crimeSUCCESSMUNY']; $ir['exp']+=(int) ($r['crimeXP']/8); $sql = sprintf("UPDATE users SET crimes = crimes + 1, money = %s, exp = %s WHERE (userid = %u)", $ir['money'], $ir['exp'], $userid); mysql_query($sql,$c) or die(mysql_error()); } else { print stripslashes($r['crimeFTEXT']); $jailtime = (int) rand(1,15); $sql = sprintf("UPDATE users SET jail = %u, jailreason = 'Failed a crime' WHERE (userid = %u)", $jailtime, $userid); mysql_query($sql, $c) or die(mysql_error()); } echo sprintf(" [url='docrime.php?c=%u']Try Again[/url] ", $_GET['c']); echo "[url='criminal.php']Crimes[/url]"; $h->endpage(); ?>
  19. Re: I need help with a Mod i made   You no longer need to worry about the MC Craps version, use mne! :P
  20. Re: [V2] New Five Minute Cron   This is a v2 cron... You could always learn MySQL's LEAST though..
  21. Re: [any version] Removal of 1 minute crons Thanks to Haunted_Dawg's (Kyle's) code, I have conquered crons! xD I've got the solution to all crons, not just 1 minute.. They go by seconds, There's a clue ;)
  22. Re: Wanting to purchase a few mods   Does not, it will log you out of the game after a period of time. I have had reports of it on my game but I haven't had time to come up with a fix yet. Perhaps an internal "refresh" of the session? if($_SERVER['PHP_SELF'] == '/flash-game-link-whatever') { //Do some update query //Do some keep-alive thing }
  23. Re: I need help with a Mod i made   Right, not a clue then xD Both the query and that code is fine..
  24. Re: I need help with a Mod i made   You don't have to...
  25. Re: I need help with a Mod i made   Some people seem to misunderstand the query() function. Although not required, you can safely use $c without any errors popping up. Go into the class files and have a look at the query() function. Also, the query he posted was fine. The problems lays on line 64. Chances are, he is missing a semi-colon ;.
×
×
  • Create New...