Jump to content
MakeWebGames

Tonka

Members
  • Posts

    450
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Tonka

  1. Re: securing against mysql injection any and all injection
  2. i need some help securing against mysql injection
  3. Re: online/offline/total users no prob
  4. Re: online/offline/total users no prob, i actually had nyna help me with this
  5. i use this on my login page but it can be put anywhere in login.php find print <<<EOF   add above   $sql = "SELECT COUNT(userid) FROM users"; $rs = mysql_query($sql); $row = mysql_fetch_array($rs); $total_users = $row[0]; $sql = sprintf("SELECT COUNT(userid) FROM users WHERE (laston > %u)", time() - 900); $rs = mysql_query($sql); $row = mysql_fetch_array($rs); $users_online = $row[0]; $users_offline = $total_users - $users_online;   then put this wherever you want to display the info Users Online: {$users_online} Users Offline: {$users_offline} Total Users: {$total_users}
  6. Re: Clean up cron nice mod yuri
  7. Tonka

    crons

    Re: crons here are the snippet's that aren't working   here is the education days, the education days have been separated from the main cron day file and are working fine % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0   here is the actual file for education days <?php include "config.php"; global $_CONFIG; if($_GET['code'] != $_CONFIG['code']) { die(""); } define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $db->query("UPDATE users SET cdays=cdays-1 WHERE course > 0"); $q=$db->query("SELECT * FROM users WHERE cdays=0 AND course > 0"); while($r=$db->fetch_row($q)) { $cd=$db->query("SELECT * FROM courses WHERE crID={$r['course']}"); $coud=$db->fetch_row($cd); $userid=$r['userid']; $db->query("INSERT INTO coursesdone VALUES({$r['userid']},{$r['course']})"); $upd=""; $ev=""; if($coud['crSTR'] > 0) { $upd.=",us.strength=us.strength+{$coud['crSTR']}"; $ev.=", {$coud['crSTR']} strength"; } if($coud['crGUARD'] > 0) { $upd.=",us.guard=us.guard+{$coud['crGUARD']}"; $ev.=", {$coud['crGUARD']} guard"; } if($coud['crLABOUR'] > 0) { $upd.=",us.labour=us.labour+{$coud['crLABOUR']}"; $ev.=", {$coud['crLABOUR']} labour"; } if($coud['crAGIL'] > 0) { $upd.=",us.agility=us.agility+{$coud['crAGIL']}"; $ev.=", {$coud['crAGIL']} agility"; } if($coud['crIQ'] > 0) { $upd.=",us.IQ=us.IQ+{$coud['crIQ']}"; $ev.=", {$coud['crIQ']} IQ"; } $ev=substr($ev,1); if ($upd) { $db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid SET us.userid=us.userid $upd WHERE u.userid=$userid"); } $db->query("INSERT INTO events VALUES('',$userid,unix_timestamp(),0,'Congratulations, you completed the {$coud['crNAME']} and gained $ev!')"); } $db->query("UPDATE users SET course=0 WHERE cdays=0"); $db->disconnect(); ?>   here is the OC timer $db->query("UPDATE gangs SET gangCHOURS=gangCHOURS-1 WHERE gangCRIME>0"); $q=$db->query("SELECT g.*,oc.* FROM gangs g LEFT JOIN orgcrimes oc ON g.gangCRIME=oc.ocID WHERE g.gangCRIME > 0 AND g.gangCHOURS = 0"); while($r=$db->fetch_row($q)) { $suc=rand(0,1); if($suc) { $log=$r['ocSTARTTEXT'].$r['ocSUCCTEXT']; $muny=(int) (rand($r['ocMINMONEY'],$r['ocMAXMONEY'])); $log=str_replace(array("{muny}","'"),array($muny,"''"),$log); $db->query("UPDATE gangs SET gangMONEY=gangMONEY+$muny,gangCRIME=0 WHERE gangID={$r['gangID']}"); $db->query("INSERT INTO oclogs VALUES ('',{$r['ocID']},{$r['gangID']}, '$log', 'success', $muny, '{$r['ocNAME']}', unix_timestamp())"); $i=$db->insert_id(); $qm=$db->query("SELECT * FROM users WHERE gang={$r['gangID']}"); while($rm=$db->fetch_row($qm)) { event_add($rm['userid'],"Your Gang's Organised Crime Succeeded. Go [url='oclog.php?ID=$i']here[/url] to view the details.",$c); }} else { $log=$r['ocSTARTTEXT'].$r['ocFAILTEXT']; $muny=0; $log=str_replace(array("{muny}","'"),array($muny,"''"),$log); $db->query("UPDATE gangs SET gangCRIME=0 WHERE gangID={$r['gangID']}"); $db->query("INSERT INTO oclogs VALUES ('',{$r['ocID']},{$r['gangID']}, '$log', 'failure', $muny, '{$r['ocNAME']}', unix_timestamp())"); $i=$db->insert_id(); $qm=$db->query("SELECT * FROM users WHERE gang={$r['gangID']}"); while($rm=$db->fetch_row($qm)) { event_add($rm['userid'],"Your Gang's Organised Crime Failed. Go [url='oclog.php?ID=$i']here[/url] to view the details.",$c); } } }   Here is the job pay if(date('G')==17) { $db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON u.jobrank=jr.jrID SET u.money=u.money+jr.jrPAY, u.exp=u.exp+(jr.jrPAY/20) WHERE u.job > 0 AND u.jobrank > 0"); $db->query("UPDATE userstats us LEFT JOIN users u ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON u.jobrank=jr.jrID SET us.strength=(us.strength+1)+jr.jrSTRG-1,us.labour=(us.labour+1)+jr.jrLABOURG-1,us.IQ=(us.IQ+1)+jr.jrIQG-1 WHERE u.job > 0 AND u.jobrank > 0"); } $db->disconnect(); i was thinking of moving the jobpay into a seperate cron file, i'm not sure if that would make a difference }
  8. Tonka

    crons

    Re: crons i don't use a free host i'm on a VPS, and as i said before all my other crons work fine
  9. Tonka

    crons

    Re: crons all my other crons are working
  10. Tonka

    crons

    Re: crons i have the crons working, they just randomly stop working and i'm not sure why
  11. Tonka

    crons

    i keep having problems with my crons and i'm not sure how to fix them. the problems i'm having are that the education days are going into the negative the gang crime timer is going into the negative the jobs are not getting paid EDIT: all my other crons are working, these ones just randomly stop
  12. Re: free welfare mod   this one won't work because you are only blocking out any user who's user level is above 2, a normal member has a user level 1
  13. Re: Items Pic mod [v2] i know this code is not open source, can some one just send me the edit section then
  14. Re: Items Pic mod [v2] i'm having trouble getting this to work, i was wondering if someone would mind uploading their "staff_items.php" "iteminfo.php" for me
  15. Re: No crime XP do you mean EXP or crime EXP? if you mean crime EXP, you need to set that when you create the crime
  16. Re: How would i set level requirements?? i just use   ($ir['level'] > 49);
  17. Re: [mccode] item images   mysql.php=v1 config.php=v2
  18. Re: Transferring Crimes? it won't work because the v2 crimes have an extra table, the only way to do what your asking to copy and paste everything one by one and create the crimes from scratch
  19. Re: Energy Orb [$5] would this work if we have our energy using the %?
  20. Re: Puzzled.... this may also help $h->endpage(); ?>
  21. Re: Puzzled.... it would help if you posted the code
  22. Re: Ive got One Problem it's an easy fix, just don't use IE, it sucks, put on your login page best viewedwith firefox
  23. Re: Game info on login.... the only way to have the info from the database shown is to use {$set['game_description']}
  24. Re: Game info on login.... if you are talking about the about box here is the code <fieldset> <legend>About {$set['game_name']}</legend> {$set['game_description']} </fieldset>
  25. Re: Times in phpMyAdmin.... this is called unix time, all you need is a simple converter, i use either http://www.unixtimestamp.com/ or http://www.onlineconversion.com/unix_time.htm
×
×
  • Create New...