Jump to content
MakeWebGames

-BRAIDZ-

Members
  • Posts

    403
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by -BRAIDZ-

  1. Well how do I secure my game? And how could someone hack it?
  2. Incorrect, I haven't spammed any games, which I stated in the post about my game, and no incorrect, the version you're working on is full of bugs. Also I do have a legit licence, and yes it is the same copy as Mr Killers, but I have also upgraded it myself better than his version. And that is in companies2.php And what about my style_top?
  3. How would I secure it? I have removed most of the mysql_real_escape_string's. I have tried and sql injection, I have tried uploading a shell and everything like that, seems pretty secure to me. Mail me
  4. True, im not one for being called a liar, which is what Jc has pretty much called me, I purchased my copy from the owner of RC Engine, then I purchased an upgraded version, already having my valid license, I was well in my own rights to purchase the upgraded copy. This all started because he is working on a game currently (RC Engine) and he has done nothing to it, and there is a loop hole that allows you access to PlayerId 1's account, no not hacking, its just something that needs patching, because it changes your session ID to the owners if you get my drift. So I thought I'd be a nice person and post in the staff panel about it, letting him know I can help, and also that I can create banners and stuff for the game.. I did not deface the game, I have no info from the game, I don't know any passwords or anything... This is the bug $_SESSION['playerid'] = 1; echo "<center><main>Company</main><hr width='750px'>"; if($pl['my_jail'] > gmtime() || $pl['my_hosp'] > gmtime())   Which I didn't mention that, I wanted to see if he knew. It's within one of the PHP Files. And this is the response I got back from him on my game. I would greatly appreciate it if you stayed away from my clients, as you have nothing to do with them, As for your copy of RC your version isn't valid nor is it any different to my copy of RC, you just have a template and very simplistic mods, Every mod you have on this sill excuse of a game I have on my desktop as trash! Theres no need to slander my name to my client David, When i've complete his end product of his game we will see what's funny then. As for he constant slandering you clearly don't know who I am and what I own, I could have your site taken down in minutes and I could sue you for slander as I have proof, if you do not heed this warning he action will be taken against you, that's all Nice day Now I could be a right ass hole, and post what game he is working on, and my game, and let everyone compare.. But I'm not going to, I find it funny to be honest ;)
  5. Note from KyleMassacre: This thread was split and I had no idea where to put it or what to name it. If you have any ideas feel free and PM me or find me here: makewebgames.slack.com /Note Hey, I just thought I would let you know that you reckon my copy of RC is invalid, incorrect, I purchased it from the owner of RC, I'm not going to name drop, but if you want the proof, message me, because my license for RC is valid thank you very much. You can try take my site down all you like, but it won't work because I purchased the original copy from the owner of RC, ask him yourself, I originally purchased it for my old game, which is now UOTS instead of RC, and I do not use it, I keep in regular contact with the owner, so try take my game down all you like buddy, it's not an illegal copy, it is legit :) Cheers champ
  6. It is not me spamming other games, it was Joker, I have since warned him, he thought he was staff, but unless you're on the staff list you're not a staff member. His grammar is shocking, I don't want someone like that on my staff list. I apologise to anyone who had my game spammed on theirs. I have spammed in the past, but will no longer do it :) Enjoy your day everyone :) Any spamming on your game, contact me directly, let me know who is doing it, and what their IP address is, so I can catch them in the act. Thank you, I do not wish to have my game spammed all over other games. That is not a way to get players.. Cheers
  7. Nothing I need to change about the updated code? I'd like to thank everyone here for the help, I am slowly learning, and learning to code has been a great experience, it's something I've always wanted to do, I've just never had the motivation. But now I've got the motivation, I'm going to look into doing a course in Web development, or just do one of the short courses that are free online, one day I aim to be able to build a custom engine. This may take me years, and I will overcome a lot of obstacles and need some help, but I will get there. I think it's easier to learn from someone else of other work rather than via doing a course, because I've read heaps of stuff on the net, and it's like wait hold on, you lost me at the first sentence, they don't get straight to the point, they like to blabber crap first, then it's like hey wait up, I've got to go back now haha. All you guys here are awesome, I have come across so many different ways people code though. :)
  8. Here is the code now, I have done a Syntax check online, and I'm getting these and that's all, so it should be fine, I worked out why it was updating twice, thank you for the help everyone :) From : PHP Code Checker. Warning: There are 6 functions in your code that have been deprecated in the current version of PHP : mysql_connect() mysql_error() mysql_fetch_array() mysql_num_rows() mysql_query() mysql_select_db()   Code: <?php ini_set('error_reporting', E_ALL); $dbhost = "localhost"; $dbuser = "usernamehere"; $dbpass = "passwordhere"; $dbbase = "dbnamehere"; $cron_are_so_cool = "trick_is_da_bomb"; $db = "mysql_tut"; $con = mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbbase); if ($_GET['code_to_run'] < 0) { die("<center><font color=red>Fatal error!</font> <br/><blink>IP logged as {$_SERVER['REMOTE_ADDR']}</blink></center>"); } else { /*----------------------------------Start cron minutes--------------------------*/ mysql_query("UPDATE members SET my_mailban = my_mailban - 1 WHERE my_mailban >= 1 ") or die(mysql_error()); mysql_query("UPDATE members SET my_forumban = my_forumban - 1 WHERE my_forumban >= 1 ") or die(mysql_error()); mysql_query("UPDATE none_agressive SET na_days = na_days - 1 WHERE na_days >= 1 ") or die(mysql_error()); mysql_query("DELETE FROM none_agressive WHERE na_days <= 0") or die(mysql_error()); mysql_query("UPDATE city_shop_dogs SET csd_daysold = csd_daysold + 1") or die(mysql_error()); mysql_query("UPDATE members_dogs SET md_daysold = md_daysold + 1") or die(mysql_error()); $newones = rand(1, 15); $morf = array( 1 => 'male', 2 => 'female' ); for ($i = 1; $i <= $newones; $i++) { $q_ry = array(); $q_ry = "INSERT INTO city_shop_dogs VALUES('NULL', '" . rand(1, 8) . "', '" . $morf[rand(1, 2)] . "', 0)"; mysql_query($q_ry) or die(mysql_error()); } $withjob = array(); $wj = array(); $q_ry = array(); $q_ry = "SELECT me.my_job,me.my_job_rank,me.playerid, sjr.*,m.my_level FROM members_extra me INNER JOIN system_job_ranks AS sjr ON me.my_job_rank = sjr.r_ID INNER JOIN members AS m ON me.playerid = m.playerid WHERE me.my_job > 0"; $withjob = array(); $withjob = mysql_query($q_ry) or die(mysql_error()); $wj = array(); while ($wj = mysql_fetch_array($withjob)) { $q_ry = array(); $q_ry = "UPDATE memberstats SET my_labor = my_labor + " . $wj['r_MANUALGAIN'] . " , my_intelligence = my_intelligence + " . $wj['r_INTELGAIN'] . " , my_endurance = my_endurance + " . $wj['r_ENDURGAIN'] . " WHERE playerid = " . $wj['playerid'] . " "; mysql_query($q_ry) or die(mysql_error()); $job = array( 1 => 'armypoints', 2 => 'grocpoints', 3 => 'casipoints', 4 => 'medipoints', 5 => 'educpoints', 6 => 'lawpoints' ); $wj['r_POINTS'] *= $wj['my_level']; $q_ry = array(); $q_ry = "UPDATE members_extra SET " . $job[$wj['my_job']] . " = " . $job[$wj['my_job']] . " + " . $wj['r_POINTS'] . " WHERE playerid = " . $wj['playerid'] . " "; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "UPDATE members SET wallet = wallet + " . $wj['r_WAGES'] . " WHERE playerid = " . $wj['playerid'] . " "; mysql_query($q_ry) or die(mysql_error()); } function remove_staff($id) { $q_ry = array(); $q_ry = "SELECT p_maids,p_butler,p_guard,p_doctor,p_pilot FROM members_properties WHERE p_id = $id "; $uptime = array(); $uptime = mysql_query($q_ry); $ut = array(); $ut = mysql_fetch_array($uptime); $happloss = 0; if ($ut['p_maids'] != 0) { $q_ry = array(); $q_ry = "SELECT ps_name FROM property_staff WHERE ps_id = " . $ut['p_maids'] . " "; $wichmaids = array(); $wichmaids = mysql_query($q_ry); $wms = mysql_fetch_array($wichmaids); $wms = array(); if ($wms['ps_name'] == '5x Maid Service') { $happloss += 100; } if ($wms['ps_name'] == '3x Maid Service') { $happloss += 85; } if ($wms['ps_name'] == '2x Maid Service') { $happloss += 75; } if ($wms['ps_name'] == 'Maid Service') { $happloss += 50; } } if ($ut['p_butler'] != 0) { $q_ry = array(); $q_ry = "SELECT ps_name FROM property_staff WHERE ps_id = " . $ut['p_butler'] . " "; $wichbutlers = array(); $wichbutlers = mysql_query($q_ry); $wmb = mysql_fetch_array($wichbutlers); $wmb = array(); if ($wmb['ps_name'] == '3x Butler Service') { $happloss += 125; } if ($wmb['ps_name'] == '2x Butler Service') { $happloss += 100; } if ($wmb['ps_name'] == 'Butler Service') { $happloss += 75; } } if ($ut['p_guard'] != 0) { $q_ry = array(); $q_ry = "SELECT ps_name FROM property_staff WHERE ps_id= " . $ut['p_guard'] . " "; $wichguards = array(); $wichguards = mysql_query($q_ry); $wmg = mysql_fetch_array($wichguards); $wmg = array(); if ($wmg['ps_name'] == '10x Guard Service') { $happloss += 500; } if ($wmg['ps_name'] == '5x Guard Service') { $happloss += 300; } if ($wmg['ps_name'] == '3x Guard Service') { $happloss += 200; } if ($wmg['ps_name'] == '2x Guard Service') { $happloss += 150; } if ($wmg['ps_name'] == 'Guard Service') { $happloss += 100; } } if ($ut['p_doctor'] != 0) { $happloss += 25; } if ($ut['p_pilot'] != 0) { $happloss += 50; } $q_ry = array(); $q_ry = "UPDATE members_properties SET p_happy = p_happy - $happloss ', p_maids = 0, p_butler = 0, p_guard = 0, p_doctor = 0, p_pilot = 0, p_priceofstaff = 0, p_daysofstaff = 0 WHERE p_id = $id "; mysql_query($q_ry); $q_ry = array(); $q_ry = "UPDATE members SET my_maxhappy = my_maxhappy - $happloss ' WHERE my_property = $id "; mysql_query($q_ry); } function in_event($player, $text) { $player = abs(intval($player)); $text = stripslashes($text); mysql_query("INSERT INTO member_events VALUES('NULL', $player , $text , unix_timestamp(), 0)") or die(mysql_error()); mysql_query("UPDATE city_statistic SET cs_value = cs_value + 1 WHERE cs_id = 1") or die(mysql_error()); } function stock_credit($id, $credit) { $q_ry = array(); $q_ry = "UPDATE stock_market SET s_profit = s_profit + $credit , s_losses = s_losses - $credit WHERE s_id = $id "; mysql_query($q_ry); $q_ry = array(); $q_ry = "UPDATE stock_market SET s_profit = 0 WHERE s_profit <= 0"; mysql_query($q_ry); $q_ry = array(); $q_ry = "UPDATE stock_market SET s_losses = 0 WHERE s_losses <= 0"; mysql_query($q_ry); } mysql_query("UPDATE members_properties SET p_ltime = p_ltime - 1 WHERE p_leasedto > 0"); mysql_query("UPDATE members_properties SET p_daysofstaff = p_daysofstaff + 1 WHERE p_priceofstaff > 0"); //Check for expired rentings $q_ry = array(); $q_ry = "SELECT * FROM members_properties mp LEFT JOIN properties h ON mp.p_property = h.house_id WHERE mp.p_leasedto != 0 AND mp.p_ltime = 0"; $uptime = array(); $uptime = mysql_query($q_ry); while ($ut = mysql_fetch_array($uptime)) { $message1 = "The rent period for your " . htmlentities($ut['house_name']) . " has now finished, The " . htmlentities($ut['house_name']) . " has been returned to you."; $q_ry = array(); $q_ry = "INSERT INTO member_events VALUES ('NULL', " . $ut['p_playerid'] . ", $message1 , unix_timestamp(), 0)"; mysql_query($q_ry); $message2 = "The rent period for the " . htmlentities($ut['house_name']) . " has now finished, The " . htmlentities($ut['house_name']) . " has been returned to its owner."; $q_ry = array(); $q_ry = "INSERT INTO member_events VALUES ('NULL', " . $ut['p_leasedto'] . " , $message2 , unix_timestamp(), 0)"; mysql_query($q_ry); $q_ry = array(); $q_ry = "SELECT playerid FROM members WHERE my_property = " . $ut['p_id'] . " "; $mys = array(); $mys = mysql_query($q_ry); if (mysql_num_rows($mys)) { $my = array(); while ($my = mysql_fetch_array($mys)) { $q_ry = array(); $q_ry = "SELECT p_id FROM members_properties WHERE p_playerid = " . $my['playerid'] . " AND p_property = 1"; $myshack = array(); $myshack = mysql_query($q_ry); $msh = array(); $msh = mysql_fetch_array($myshack); $q_ry = array(); $q_ry = "UPDATE members SET my_property = " . $msh['p_id'] . " my_happy = 100 my_maxhappy = 100 WHERE playerid = " . $my['playerid'] . " "; mysql_query($q_ry); } } remove_staff($ut['p_id']); $q_ry = array(); $q_ry = "UPDATE members_properties SET p_leasedto = 0, p_ltime = 0 WHERE p_id = " . $ut['p_id'] . " "; mysql_query($q_ry); } //Check for expired rentings //Charge daily upkeep $q_ry = array(); $q_ry = "SELECT * FROM members_properties mp LEFT JOIN properties h ON mp.p_property = h.house_id WHERE mp.p_property != 1 "; $upprops = array(); $upprops = mysql_query($q_ry); $up = array(); while ($up = mysql_fetch_array($upprops)) { $total = ($up['p_priceofstaff'] + $up['house_tax']); if ($up['p_leasedto'] != 0) { //Check money of tenant $q_ry = array(); $q_ry = "SELECT playerid FROM members WHERE playerid = " . $up['p_leasedto'] . " AND wallet <= - $total "; $myc = array(); $myc = mysql_query($q_ry); if ($up['p_priceofstaff']) { stock_credit(5, 1); if (mysql_num_rows($myc)) { remove_staff($up['p_id']); $message3 = "You did not have enough to pay your staff for today, They have packed up and left!"; in_event($up['p_leasedto'], $message3); } } $q_ry = array(); $q_ry = "UPDATE members SET wallet = wallet - $total WHERE playerid = " . $up['p_leasedto'] . " "; } else { //Check money of member $q_ry = array(); $q_ry = "SELECT wallet FROM members WHERE playerid = " . $up['p_playerid'] . " AND wallet <= - $total "; $myc = array(); $myc = mysql_query($q_ry); if ($up['p_priceofstaff']) { stock_credit(5, 1); if (mysql_num_rows($myc)) { remove_staff($up['p_id']); $message3 = "You did not have enough to pay your staff for today, They have packed up and left!"; in_event($up['p_playerid'], $message3); } } $q_ry = array(); $q_ry = "UPDATE members SET wallet = wallet - $total WHERE playerid = " . $up['p_playerid'] . " "; } mysql_query($q_ry); } //Charge daily upkeep /*-----------------------------------End cron minutes---------------------------*/ function award_check($user, $number, $award) { $q_ry = array(); $q_ry = "SELECT ma_id,ma_tier FROM members_awards WHERE ma_playerid = $user AND ma_award = $award "; $got_award = array(); $got_award = mysql_query($q_ry) or die(mysql_error()); if (mysql_num_rows($got_award)) { $ga = array(); $ga = mysql_fetch_array($got_award); if ($ga['ma_tier'] >= $number) { //Got it } else { $q_ry = array(); $q_ry = "UPDATE members_awards SET ma_tier = $number , ma_viewed = 0, ma_time = unix_timestamp() WHERE ma_id = " . $ga['ma_id'] . " "; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "UPDATE members SET my_merits = my_merits + 1 WHERE playerid = $user "; mysql_query($q_ry) or die(mysql_error()); } } else { $q_ry = array(); $q_ry = "INSERT INTO members_awards VALUES ('NULL', $award , $number ', $user , 0, unix_timestamp())"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "UPDATE members SET my_merits = my_merits + 1 WHERE playerid = $user "; mysql_query($q_ry) or die(mysql_error()); } } $q_ry = array(); $q_ry = "SELECT * FROM award_checks ac LEFT JOIN awards a ON ac.ac_award_id = a.a_id"; $award_checks = array(); $award_checks = mysql_query($q_ry) or die(mysql_error()); while ($aw = mysql_fetch_array($award_checks)) { $q_ry = array(); $q_ry = "SELECT " . $aw['ac_identify'] . "," . $aw['ac_what'] . " FROM " . $aw['ac_table'] . " WHERE " . $aw['ac_what'] . " >= '" . $aw['ac_amount'] . "'"; $thisaward = array(); $thisaward = mysql_query($q_ry) or die(mysql_error()); if (mysql_num_rows($thisaward)) { while ($ta = mysql_fetch_array($thisaward)) { award_check($ta[$aw['ac_identify']], $aw['ac_number'], $aw['ac_award_id']); } } } mysql_query("UPDATE members SET my_dondays = my_dondays - 1 WHERE my_dondays > 0"); mysql_query("UPDATE members SET my_maxenergy = 100 WHERE my_dondays <= 0"); mysql_query("UPDATE members SET my_partner_days = my_partner_days + 1 WHERE my_partner > 0"); mysql_query("UPDATE members SET brew = 0"); mysql_query("UPDATE members_extra SET my_daysold = my_daysold + 1"); mysql_query("UPDATE members_extra SET my_ctokens = my_ctokens_daily,my_cstreak = 0"); mysql_query("UPDATE members_extra SET energy_refill = 0"); $q_ry = array(); $q_ry = "SELECT playerid FROM members WHERE my_faction > 0"; $facdays = array(); $facdays = mysql_query($q_ry) or die(mysql_error()); $fd = array(); $q_ry = array(); while ($fd = mysql_fetch_array($facdays)) { $q_ry = "UPDATE members_extra SET my_faction_days = my_faction_days + 1 WHERE playerid = " . $fd['playerid'] . " "; mysql_query($q_ry) or die(mysql_error()); } $q_ry = array(); $q_ry = "DELETE FROM votes_count WHERE vc_site = 'apex' || vc_site = 'ultra'"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "SELECT * FROM stock_holdings WHERE sh_saletime > 0 AND (sh_saletime+1036800) <= '" . (time()) . "' AND sh_playerid != '3'"; $validstocks = array(); $validstocks = mysql_query($q_ry) or die(mysql_error()); $v = array(); while ($v = mysql_fetch_array($validstocks)) { $qty = $v['sh_qty']; $creditamnt = $v['sh_nowprice'] * $qty; $newprice = $v['sh_nowprice']; $q_ry = array(); $q_ry = "UPDATE members SET wallet = wallet + $creditamnt ' WHERE playerid = " . $v['sh_playerid'] . " "; mysql_query($q_ry); $message = "Someone bought " . $qty . " of your stocks for \$" . number_format($creditamnt) . "!"; in_event($v['sh_playerid'], $message); $q_ry = array(); $q_ry = "UPDATE stock_holdings SET sh_playerid = 1, sh_payed = ($newprice) , sh_time = '" . time() . "', sh_sale = 1, sh_saletime = '" . time() . "' WHERE sh_id = " . $v['sh_id'] . " "; mysql_query($q_ry) or die(mysql_error()); } $yearago = (time() - 32140800); $sixmonths = $yearago / 2; $threemonths = $sixmonths / 2; $onemonth = $sixmonths / 6; $twoweeks = $onemonth / 2; $q_ry = array(); $q_ry = "DELETE FROM member_mail WHERE mm_time <= $onemonth "; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "DELETE FROM member_events WHERE e_time <= $onemonth "; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "DELETE FROM attack_logs WHERE time <= $onemonth "; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "DELETE FROM faction_events WHERE fe_time <= $onemonth "; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "DELETE FROM stock_history WHERE h_time <= $sixmonths "; mysql_query($q_ry) or die(mysql_error()); } ?>
  9. Okay mate, thanks, I will fix it all up when I get back on the computer
  10. Thanks mate, do I need to declare interval?
  11. So like this then? $q_ry = "UPDATE memberstats SET my_labor = my_labor + ($wj['r_MANUALGAIN']) , my_intelligence = my_intelligence + ($wj['r_INTELGAIN']) , my_endurance = my_endurance + ($wj['r_ENDURGAIN']) WHERE playerid = ($wj['playerid']) "; mysql_query($q_ry) or die(mysql_error());
  12. Like this? $q_ry = "UPDATE memberstats SET my_labor = my_labor + " . ($wj['r_MANUALGAIN']) . " , my_intelligence = my_intelligence + " . ($wj['r_INTELGAIN']) . " , my_endurance = my_endurance + ". ($wj['r_ENDURGAIN']) . " WHERE playerid = " . ($wj['playerid']) . " "; mysql_query($q_ry) or die(mysql_error());
  13. Thanks, do I have to have the quotation mark in the bottom one? And yes it's referencing the playerid not the name, I will go through and change all these when I get back on the computer.
  14. I'm not sure, it's saying about line two, but line two is the the host.. And that's correct. All it doing is running twice, but there is nothing about it running twice in the logs, so it's either a problem with the code itself, or its updating from two separate locations? Not sure how though, seems that was the problem with one of my other daily crons. And I'll look into it thanks
  15. Okay, so I have removed most of the mysql_real_escape_string's but these ones here, I didn't want to touch them and screw the whole thing up, what do I do with these ones? And the name string?   mysql_real_escape_string($ut['p_leasedto'])
  16. I'm using SSH Crontab.. My company cron was updating twice, so I removed it from the cron tab, and it updated once, so I think I might remove the daily cron and see if that's the problem, it is probably updating from two separate locations.. So from the updated cron I have posted where I've removed the mysql_real_escape_string from most of the queries, do I have to remove anymore? Because the ones left I don't want to touch. Unless someone could explain to me what to do? Thank you
  17. Thanks, I now understand :) Hopefully I can work this out :)
  18. Okay, why does the others have the me bit?
  19. This bit here? FROM members_extra me INNER JOIN system_job_ranks AS sjr ON me.my_job_rank = sjr.r_ID INNER JOIN members AS m ON me.playerid = m.playerid WHERE me.my_job > 0"; I think I see the problem? me.playerid = m.playerid Should be: me.playerid = $me.playerid I will change this and see what happens and see if I get anymore errors and will post them here :)
  20. This is the only error I am getting when I manually run the cron You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= + '200' WHERE playerid = '5'' at line 2
  21. I have removed most of the "mysql_real_escape_string()" and all of the back-ticks, theres some of the mysql_real_escape_string() that I don't want to touch... Is this correct? <?php $dbhost = "localhost"; $dbuser = "blah"; $dbpass = "nottellingyou"; $dbbase = "mygameduh"; $cron_are_so_cool = "trick_is_da_bomb"; $db = "mysql_tut"; $con = mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbbase); if ($_GET['code_to_run'] < 0) { die("<center><font color=red>Fatal error!</font> <blink>IP logged as {$_SERVER['REMOTE_ADDR']}</blink></center>"); } else { /*----------------------------------Start cron minutes--------------------------*/ mysql_query("UPDATE members SET my_mailban = my_mailban - 1 WHERE my_mailban >= 1 ") or die(mysql_error()); mysql_query("UPDATE members SET my_forumban = my_forumban - 1 WHERE my_forumban >= 1 ") or die(mysql_error()); mysql_query("UPDATE none_agressive SET na_days = na_days - 1 WHERE na_days >= 1 ") or die(mysql_error()); mysql_query("DELETE FROM none_agressive WHERE na_days <= 0") or die(mysql_error()); mysql_query("UPDATE city_shop_dogs SET csd_daysold = csd_daysold + 1") or die(mysql_error()); mysql_query("UPDATE members_dogs SET md_daysold = md_daysold + 1") or die(mysql_error()); $newones = rand(1, 15); $morf = array( 1 => 'male', 2 => 'female' ); for ($i = 1; $i <= $newones; $i++) { $q_ry = array(); $q_ry = "INSERT INTO city_shop_dogs VALUES('NULL', '" . rand(1, 8) . "', '" . $morf[rand(1, 2)] . "', 0)"; mysql_query($q_ry) or die(mysql_error()); } $withjob = array(); $wj = array(); $q_ry = array(); $q_ry = "SELECT me.my_job,me.my_job_rank,me.playerid, sjr.*,m.my_level FROM members_extra me INNER JOIN system_job_ranks AS sjr ON me.my_job_rank = sjr.r_ID INNER JOIN members AS m ON me.playerid = m.playerid WHERE me.my_job > 0"; $withjob = array(); $withjob = mysql_query($q_ry) or die(mysql_error()); $wj = array(); while ($wj = mysql_fetch_array($withjob)) { $q_ry = array(); $q_ry = "UPDATE memberstats SET my_labor = my_labor + '" . mysql_real_escape_string($wj['r_MANUALGAIN']) . "', my_intelligence = my_intelligence + '" . mysql_real_escape_string($wj['r_INTELGAIN']) . "', my_endurance = my_endurance + '" . mysql_real_escape_string($wj['r_ENDURGAIN']) . "' WHERE playerid = '" . mysql_real_escape_string($wj['playerid']) . "'"; mysql_query($q_ry) or die(mysql_error()); $job = array( 1 => 'armypoints', 2 => 'grocpoints', 3 => 'casipoints', 4 => 'medipoints', 5 => 'educpoints', 6 => 'lawpoints' ); $wj['r_POINTS'] *= $wj['my_level']; $q_ry = array(); $q_ry = "UPDATE members_extra SET " . $job[$wj['my_job']] . " = " . $job[$wj['my_job']] . " + '" . mysql_real_escape_string($wj['r_POINTS']) . "' WHERE playerid = '" . mysql_real_escape_string($wj['playerid']) . "'"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "UPDATE members SET wallet = wallet + '" . mysql_real_escape_string($wj['r_WAGES']) . "' WHERE playerid = '" . mysql_real_escape_string($wj['playerid']) . "'"; mysql_query($q_ry) or die(mysql_error()); } function remove_staff($id) { $q_ry = array(); $q_ry = "SELECT p_maids,p_butler,p_guard,p_doctor,p_pilot FROM members_properties WHERE p_id = $id "; $uptime = array(); $uptime = mysql_query($q_ry); $ut = array(); $ut = mysql_fetch_array($uptime); $happloss = 0; if ($ut['p_maids'] != 0) { $q_ry = array(); $q_ry = "SELECT ps_name FROM property_staff WHERE ps_id = '" . mysql_real_escape_string($ut['p_maids']) . "'"; $wichmaids = array(); $wichmaids = mysql_query($q_ry); $wms = mysql_fetch_array($wichmaids); $wms = array(); if ($wms['ps_name'] == '5x Maid Service') { $happloss += 100; } if ($wms['ps_name'] == '3x Maid Service') { $happloss += 85; } if ($wms['ps_name'] == '2x Maid Service') { $happloss += 75; } if ($wms['ps_name'] == 'Maid Service') { $happloss += 50; } } if ($ut['p_butler'] != 0) { $q_ry = array(); $q_ry = "SELECT ps_name FROM property_staff WHERE ps_id = '" . mysql_real_escape_string($ut['p_butler']) . "'"; $wichbutlers = array(); $wichbutlers = mysql_query($q_ry); $wmb = mysql_fetch_array($wichbutlers); $wmb = array(); if ($wmb['ps_name'] == '3x Butler Service') { $happloss += 125; } if ($wmb['ps_name'] == '2x Butler Service') { $happloss += 100; } if ($wmb['ps_name'] == 'Butler Service') { $happloss += 75; } } if ($ut['p_guard'] != 0) { $q_ry = array(); $q_ry = "SELECT ps_name FROM property_staff WHERE ps_id='" . mysql_real_escape_string($ut['p_guard']) . "'"; $wichguards = array(); $wichguards = mysql_query($q_ry); $wmg = mysql_fetch_array($wichguards); $wmg = array(); if ($wmg['ps_name'] == '10x Guard Service') { $happloss += 500; } if ($wmg['ps_name'] == '5x Guard Service') { $happloss += 300; } if ($wmg['ps_name'] == '3x Guard Service') { $happloss += 200; } if ($wmg['ps_name'] == '2x Guard Service') { $happloss += 150; } if ($wmg['ps_name'] == 'Guard Service') { $happloss += 100; } } if ($ut['p_doctor'] != 0) { $happloss += 25; } if ($ut['p_pilot'] != 0) { $happloss += 50; } $q_ry = array(); $q_ry = "UPDATE members_properties SET p_happy = p_happy - $happloss ', p_maids = 0, p_butler = 0, p_guard = 0, p_doctor = 0, p_pilot = 0, p_priceofstaff = 0, p_daysofstaff = 0 WHERE p_id = $id "; mysql_query($q_ry); $q_ry = array(); $q_ry = "UPDATE members SET my_maxhappy = my_maxhappy - $happloss ' WHERE my_property = $id "; mysql_query($q_ry); } function in_event($player, $text) { $player = abs(intval($player)); $text = stripslashes($text); mysql_query("INSERT INTO member_events VALUES('NULL', $player , $text , unix_timestamp(), 0)") or die(mysql_error()); mysql_query("UPDATE city_statistic SET cs_value = cs_value + 1 WHERE cs_id = 1") or die(mysql_error()); } function stock_credit($id, $credit) { $q_ry = array(); $q_ry = "UPDATE stock_market SET s_profit = s_profit + $credit , s_losses = s_losses - $credit WHERE s_id = $id "; mysql_query($q_ry); $q_ry = array(); $q_ry = "UPDATE stock_market SET s_profit = 0 WHERE s_profit <= 0"; mysql_query($q_ry); $q_ry = array(); $q_ry = "UPDATE stock_market SET s_losses = 0 WHERE s_losses <= 0"; mysql_query($q_ry); } mysql_query("UPDATE members_properties SET p_ltime = p_ltime - 1 WHERE p_leasedto > 0"); mysql_query("UPDATE members_properties SET p_daysofstaff = p_daysofstaff + 1 WHERE p_priceofstaff > 0"); //Check for expired rentings $q_ry = array(); $q_ry = "SELECT * FROM members_properties mp LEFT JOIN properties h ON mp.p_property = h.house_id WHERE mp.p_leasedto != 0 AND mp.p_ltime = 0"; $uptime = array(); $uptime = mysql_query($q_ry); while ($ut = mysql_fetch_array($uptime)) { $message1 = "The rent period for your " . htmlentities($ut['house_name']) . " has now finished, The " . htmlentities($ut['house_name']) . " has been returned to you."; $q_ry = array(); $q_ry = "INSERT INTO member_events VALUES ('NULL', '" . mysql_real_escape_string($ut['p_playerid']) . "', $message1 , unix_timestamp(), 0)"; mysql_query($q_ry); $message2 = "The rent period for the " . htmlentities($ut['house_name']) . " has now finished, The " . htmlentities($ut['house_name']) . " has been returned to its owner."; $q_ry = array(); $q_ry = "INSERT INTO member_events VALUES ('NULL', '" . mysql_real_escape_string($ut['p_leasedto']) . "', $message2 , unix_timestamp(), 0)"; mysql_query($q_ry); $q_ry = array(); $q_ry = "SELECT playerid FROM members WHERE my_property = '" . mysql_real_escape_string($ut['p_id']) . "'"; $mys = array(); $mys = mysql_query($q_ry); if (mysql_num_rows($mys)) { $my = array(); while ($my = mysql_fetch_array($mys)) { $q_ry = array(); $q_ry = "SELECT p_id FROM members_properties WHERE p_playerid = '" . mysql_real_escape_string($my['playerid']) . "' AND p_property = 1"; $myshack = array(); $myshack = mysql_query($q_ry); $msh = array(); $msh = mysql_fetch_array($myshack); $q_ry = array(); $q_ry = "UPDATE members SET my_property = '" . mysql_real_escape_string($msh['p_id']) . "', my_happy = '100', my_maxhappy = '100' WHERE playerid = '" . mysql_real_escape_string($my['playerid']) . "'"; mysql_query($q_ry); } } remove_staff($ut['p_id']); $q_ry = array(); $q_ry = "UPDATE members_properties SET p_leasedto = 0, p_ltime = 0 WHERE p_id = '" . mysql_real_escape_string($ut['p_id']) . "'"; mysql_query($q_ry); } //Check for expired rentings //Charge daily upkeep $q_ry = array(); $q_ry = "SELECT * FROM members_properties mp LEFT JOIN properties h ON mp.p_property = h.house_id WHERE mp.p_property != 1"; $upprops = array(); $upprops = mysql_query($q_ry); $up = array(); while ($up = mysql_fetch_array($upprops)) { $total = ($up['p_priceofstaff'] + $up['house_tax']); if ($up['p_leasedto'] != 0) { //Check money of tenant $q_ry = array(); $q_ry = "SELECT playerid FROM members WHERE playerid = '" . mysql_real_escape_string($up['p_leasedto']) . "' AND wallet <= '- $total "; $myc = array(); $myc = mysql_query($q_ry); if ($up['p_priceofstaff']) { stock_credit(5, 1); if (mysql_num_rows($myc)) { remove_staff($up['p_id']); $message3 = "You did not have enough to pay your staff for today, They have packed up and left!"; in_event($up['p_leasedto'], $message3); } } $q_ry = array(); $q_ry = "UPDATE members SET wallet = wallet - $total WHERE playerid = '" . mysql_real_escape_string($up['p_leasedto']) . "'"; } else { //Check money of member $q_ry = array(); $q_ry = "SELECT wallet FROM members WHERE playerid = '" . mysql_real_escape_string($up['p_playerid']) . "' AND wallet <= '- $total "; $myc = array(); $myc = mysql_query($q_ry); if ($up['p_priceofstaff']) { stock_credit(5, 1); if (mysql_num_rows($myc)) { remove_staff($up['p_id']); $message3 = "You did not have enough to pay your staff for today, They have packed up and left!"; in_event($up['p_playerid'], $message3); } } $q_ry = array(); $q_ry = "UPDATE members SET wallet = wallet - $total WHERE playerid = '" . mysql_real_escape_string($up['p_playerid']) . "'"; } mysql_query($q_ry); } //Charge daily upkeep /*-----------------------------------End cron minutes---------------------------*/ function award_check($user, $number, $award) { $q_ry = array(); $q_ry = "SELECT ma_id,ma_tier FROM members_awards WHERE ma_playerid = $user AND ma_award = $award "; $got_award = array(); $got_award = mysql_query($q_ry) or die(mysql_error()); if (mysql_num_rows($got_award)) { $ga = array(); $ga = mysql_fetch_array($got_award); if ($ga['ma_tier'] >= $number) { //Got it } else { $q_ry = array(); $q_ry = "UPDATE members_awards SET ma_tier = $number , ma_viewed = 0, ma_time = unix_timestamp() WHERE ma_id = '" . mysql_real_escape_string($ga['ma_id']) . "'"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "UPDATE members SET my_merits = my_merits + 1 WHERE playerid = $user "; mysql_query($q_ry) or die(mysql_error()); } } else { $q_ry = array(); $q_ry = "INSERT INTO members_awards VALUES ('NULL', $award , $number ', $user , 0, unix_timestamp())"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "UPDATE members SET my_merits = my_merits + 1 WHERE playerid = $user "; mysql_query($q_ry) or die(mysql_error()); } } $q_ry = array(); $q_ry = "SELECT * FROM award_checks ac LEFT JOIN awards a ON ac.ac_award_id = a.a_id"; $award_checks = array(); $award_checks = mysql_query($q_ry) or die(mysql_error()); while ($aw = mysql_fetch_array($award_checks)) { $q_ry = array(); $q_ry = "SELECT " . $aw['ac_identify'] . "," . $aw['ac_what'] . " FROM " . $aw['ac_table'] . " WHERE " . $aw['ac_what'] . " >= '" . $aw['ac_amount'] . "'"; $thisaward = array(); $thisaward = mysql_query($q_ry) or die(mysql_error()); if (mysql_num_rows($thisaward)) { while ($ta = mysql_fetch_array($thisaward)) { award_check($ta[$aw['ac_identify']], $aw['ac_number'], $aw['ac_award_id']); } } } mysql_query("UPDATE members SET my_dondays = my_dondays - 1 WHERE my_dondays > 0"); mysql_query("UPDATE members SET my_maxenergy = '100' WHERE my_dondays <= 0"); mysql_query("UPDATE members SET my_partner_days = my_partner_days + 1 WHERE my_partner > 0"); mysql_query("UPDATE members SET brew = 0"); mysql_query("UPDATE members_extra SET my_daysold = my_daysold + 1"); mysql_query("UPDATE members_extra SET my_ctokens = my_ctokens_daily,my_cstreak = 0"); mysql_query("UPDATE members_extra SET energy_refill = 0"); $q_ry = array(); $q_ry = "SELECT playerid FROM members WHERE my_faction > 0"; $facdays = array(); $facdays = mysql_query($q_ry) or die(mysql_error()); $fd = array(); $q_ry = array(); while ($fd = mysql_fetch_array($facdays)) { $q_ry = "UPDATE members_extra SET my_faction_days = my_faction_days + 1 WHERE playerid = '" . mysql_real_escape_string($fd['playerid']) . "'"; mysql_query($q_ry) or die(mysql_error()); } $q_ry = array(); $q_ry = "DELETE FROM votes_count WHERE vc_site = 'apex' || vc_site = 'ultra'"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "SELECT * FROM stock_holdings WHERE sh_saletime > 0 AND (sh_saletime+1036800) <= '" . (time()) . "' AND sh_playerid != '3'"; $validstocks = array(); $validstocks = mysql_query($q_ry) or die(mysql_error()); $v = array(); while ($v = mysql_fetch_array($validstocks)) { $qty = $v['sh_qty']; $creditamnt = $v['sh_nowprice'] * $qty; $newprice = $v['sh_nowprice']; $q_ry = array(); $q_ry = "UPDATE members SET wallet = wallet + $creditamnt ' WHERE playerid = '" . mysql_real_escape_string($v['sh_playerid']) . "'"; mysql_query($q_ry); $message = "Someone bought " . $qty . " of your stocks for \$" . number_format($creditamnt) . "!"; in_event($v['sh_playerid'], $message); $q_ry = array(); $q_ry = "UPDATE stock_holdings SET sh_playerid = 1, sh_payed = '" . mysql_real_escape_string($newprice) . "', sh_time = '" . time() . "', sh_sale = 1, sh_saletime = '" . time() . "' WHERE sh_id = '" . mysql_real_escape_string($v['sh_id']) . "'"; mysql_query($q_ry) or die(mysql_error()); } $yearago = (time() - 32140800); $sixmonths = $yearago / 2; $threemonths = $sixmonths / 2; $onemonth = $sixmonths / 6; $twoweeks = $onemonth / 2; $q_ry = array(); $q_ry = "DELETE FROM member_mail WHERE mm_time <= $onemonth "; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "DELETE FROM member_events WHERE e_time <= $onemonth "; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "DELETE FROM attack_logs WHERE time <= $onemonth "; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "DELETE FROM faction_events WHERE fe_time <= $onemonth "; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "DELETE FROM stock_history WHERE h_time <= $sixmonths "; mysql_query($q_ry) or die(mysql_error()); } ?>
  22. I'm using a vps, and it's just a 500 error. I will turn error reporting on and manually run it
  23. Yes it is timing out, then my site goes to a 500 error for around 15 minutes, I contacted my service provider, because this problem has only started to occur over the last four or so days. At first I didn't pay much attention to it at all, untill I noticed that my age (days I've been playing) is going up by two. No there's no duplicate query. - - - Updated - - -   Why would that cause it to time out and update twice?
  24. Okay so my daily cron updates twice for some reason and times out.. Even when manually run it will time out.. Is anyone able go tell me why please? The mysql_real_escape_string's do need removing I know that, but there's some.parts of the cron I don't want to touch with the mres just incase I stuff it up. Any suggestions would be great please. Or what I can do with the mres?   <?php $dbhost = "localhost"; $dbuser = "blah"; $dbpass = "nottellingyou"; $dbbase = "mygameduh"; $cron_are_so_cool = "trick_is_da_bomb"; $db = "mysql_tut"; $con = mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbbase); if ($_GET['code_to_run'] < 0) { die("<center><font color=red>Fatal error!</font> <br/><blink>IP logged as {$_SERVER['REMOTE_ADDR']}</blink></center>"); } else { /*----------------------------------Start cron minutes--------------------------*/ mysql_query("UPDATE `members` SET `my_mailban` = `my_mailban` - '1' WHERE `my_mailban` >= '1'") or die(mysql_error()); mysql_query("UPDATE `members` SET `my_forumban` = `my_forumban` - '1' WHERE `my_forumban` >= '1'") or die(mysql_error()); mysql_query("UPDATE `none_agressive` SET `na_days` = `na_days` - '1' WHERE `na_days` >= '1'") or die(mysql_error()); mysql_query("DELETE FROM `none_agressive` WHERE `na_days` <= '0'") or die(mysql_error()); mysql_query("UPDATE `city_shop_dogs` SET `csd_daysold` = `csd_daysold` + '1'") or die(mysql_error()); mysql_query("UPDATE `members_dogs` SET `md_daysold` = `md_daysold` + '1'") or die(mysql_error()); $newones = rand(1, 15); $morf = array( 1 => 'male', 2 => 'female' ); for ($i = 1; $i <= $newones; $i++) { $q_ry = array(); $q_ry = "INSERT INTO `city_shop_dogs` VALUES('NULL', '" . rand(1, 8) . "', '" . $morf[rand(1, 2)] . "', 0)"; mysql_query($q_ry) or die(mysql_error()); } $withjob = array(); $wj = array(); $q_ry = array(); $q_ry = "SELECT me.my_job,me.my_job_rank,me.playerid, sjr.*,m.my_level FROM `members_extra` me INNER JOIN `system_job_ranks` AS sjr ON me.my_job_rank = sjr.r_ID INNER JOIN `members` AS m ON me.playerid = m.playerid WHERE me.my_job > '0'"; $withjob = array(); $withjob = mysql_query($q_ry) or die(mysql_error()); $wj = array(); while ($wj = mysql_fetch_array($withjob)) { $q_ry = array(); $q_ry = "UPDATE `memberstats` SET `my_labor` = `my_labor` + '" . mysql_real_escape_string($wj['r_MANUALGAIN']) . "', `my_intelligence` = `my_intelligence` + '" . mysql_real_escape_string($wj['r_INTELGAIN']) . "', `my_endurance` = `my_endurance` + '" . mysql_real_escape_string($wj['r_ENDURGAIN']) . "' WHERE `playerid` = '" . mysql_real_escape_string($wj['playerid']) . "'"; mysql_query($q_ry) or die(mysql_error()); $job = array( 1 => 'armypoints', 2 => 'grocpoints', 3 => 'casipoints', 4 => 'medipoints', 5 => 'educpoints', 6 => 'lawpoints' ); $wj['r_POINTS'] *= $wj['my_level']; $q_ry = array(); $q_ry = "UPDATE `members_extra` SET " . $job[$wj['my_job']] . " = " . $job[$wj['my_job']] . " + '" . mysql_real_escape_string($wj['r_POINTS']) . "' WHERE `playerid` = '" . mysql_real_escape_string($wj['playerid']) . "'"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "UPDATE `members` SET `wallet` = `wallet` + '" . mysql_real_escape_string($wj['r_WAGES']) . "' WHERE `playerid` = '" . mysql_real_escape_string($wj['playerid']) . "'"; mysql_query($q_ry) or die(mysql_error()); } function remove_staff($id) { $q_ry = array(); $q_ry = "SELECT `p_maids`,`p_butler`,`p_guard`,`p_doctor`,`p_pilot` FROM `members_properties` WHERE `p_id` = '" . mysql_real_escape_string($id) . "'"; $uptime = array(); $uptime = mysql_query($q_ry); $ut = array(); $ut = mysql_fetch_array($uptime); $happloss = 0; if ($ut['p_maids'] != '0') { $q_ry = array(); $q_ry = "SELECT `ps_name` FROM `property_staff` WHERE `ps_id` = '" . mysql_real_escape_string($ut['p_maids']) . "'"; $wichmaids = array(); $wichmaids = mysql_query($q_ry); $wms = mysql_fetch_array($wichmaids); $wms = array(); if ($wms['ps_name'] == '5x Maid Service') { $happloss += 100; } if ($wms['ps_name'] == '3x Maid Service') { $happloss += 85; } if ($wms['ps_name'] == '2x Maid Service') { $happloss += 75; } if ($wms['ps_name'] == 'Maid Service') { $happloss += 50; } } if ($ut['p_butler'] != '0') { $q_ry = array(); $q_ry = "SELECT `ps_name` FROM `property_staff` WHERE `ps_id` = '" . mysql_real_escape_string($ut['p_butler']) . "'"; $wichbutlers = array(); $wichbutlers = mysql_query($q_ry); $wmb = mysql_fetch_array($wichbutlers); $wmb = array(); if ($wmb['ps_name'] == '3x Butler Service') { $happloss += 125; } if ($wmb['ps_name'] == '2x Butler Service') { $happloss += 100; } if ($wmb['ps_name'] == 'Butler Service') { $happloss += 75; } } if ($ut['p_guard'] != '0') { $q_ry = array(); $q_ry = "SELECT `ps_name` FROM `property_staff` WHERE `ps_id`='" . mysql_real_escape_string($ut['p_guard']) . "'"; $wichguards = array(); $wichguards = mysql_query($q_ry); $wmg = mysql_fetch_array($wichguards); $wmg = array(); if ($wmg['ps_name'] == '10x Guard Service') { $happloss += 500; } if ($wmg['ps_name'] == '5x Guard Service') { $happloss += 300; } if ($wmg['ps_name'] == '3x Guard Service') { $happloss += 200; } if ($wmg['ps_name'] == '2x Guard Service') { $happloss += 150; } if ($wmg['ps_name'] == 'Guard Service') { $happloss += 100; } } if ($ut['p_doctor'] != '0') { $happloss += 25; } if ($ut['p_pilot'] != '0') { $happloss += 50; } $q_ry = array(); $q_ry = "UPDATE `members_properties` SET `p_happy` = `p_happy` - '" . mysql_real_escape_string($happloss) . "', `p_maids` = '0', `p_butler` = '0', `p_guard` = '0', `p_doctor` = '0', `p_pilot` = '0', `p_priceofstaff` = '0', `p_daysofstaff` = '0' WHERE `p_id` = '" . mysql_real_escape_string($id) . "'"; mysql_query($q_ry); $q_ry = array(); $q_ry = "UPDATE `members` SET `my_maxhappy` = `my_maxhappy` - '" . mysql_real_escape_string($happloss) . "' WHERE `my_property` = '" . mysql_real_escape_string($id) . "'"; mysql_query($q_ry); } function in_event($player, $text) { $player = abs(intval($player)); $text = stripslashes($text); mysql_query("INSERT INTO `member_events` VALUES('NULL', '" . mysql_real_escape_string($player) . "', '" . mysql_real_escape_string($text) . "', unix_timestamp(), '0')") or die(mysql_error()); mysql_query("UPDATE `city_statistic` SET `cs_value` = `cs_value` + '1' WHERE `cs_id` = '1'") or die(mysql_error()); } function stock_credit($id, $credit) { $q_ry = array(); $q_ry = "UPDATE `stock_market` SET `s_profit` = `s_profit` + '" . mysql_real_escape_string($credit) . "', `s_losses` = `s_losses` - '" . mysql_real_escape_string($credit) . "' WHERE `s_id` = '" . mysql_real_escape_string($id) . "'"; mysql_query($q_ry); $q_ry = array(); $q_ry = "UPDATE `stock_market` SET `s_profit` = '0' WHERE `s_profit` <= '0'"; mysql_query($q_ry); $q_ry = array(); $q_ry = "UPDATE `stock_market` SET `s_losses` = '0' WHERE `s_losses` <= '0'"; mysql_query($q_ry); } mysql_query("UPDATE `members_properties` SET `p_ltime` = `p_ltime` - '1' WHERE `p_leasedto` > '0'"); mysql_query("UPDATE `members_properties` SET `p_daysofstaff` = `p_daysofstaff` + '1' WHERE `p_priceofstaff` > '0'"); //Check for expired rentings $q_ry = array(); $q_ry = "SELECT * FROM `members_properties` mp LEFT JOIN `properties` h ON mp.p_property = h.house_id WHERE mp.p_leasedto != '0' AND mp.p_ltime = '0'"; $uptime = array(); $uptime = mysql_query($q_ry); while ($ut = mysql_fetch_array($uptime)) { $message1 = "The rent period for your " . htmlentities($ut['house_name']) . " has now finished, The " . htmlentities($ut['house_name']) . " has been returned to you."; $q_ry = array(); $q_ry = "INSERT INTO `member_events` VALUES ('NULL', '" . mysql_real_escape_string($ut['p_playerid']) . "', '" . mysql_real_escape_string($message1) . "', unix_timestamp(), '0')"; mysql_query($q_ry); $message2 = "The rent period for the " . htmlentities($ut['house_name']) . " has now finished, The " . htmlentities($ut['house_name']) . " has been returned to its owner."; $q_ry = array(); $q_ry = "INSERT INTO `member_events` VALUES ('NULL', '" . mysql_real_escape_string($ut['p_leasedto']) . "', '" . mysql_real_escape_string($message2) . "', unix_timestamp(), '0')"; mysql_query($q_ry); $q_ry = array(); $q_ry = "SELECT `playerid` FROM `members` WHERE `my_property` = '" . mysql_real_escape_string($ut['p_id']) . "'"; $mys = array(); $mys = mysql_query($q_ry); if (mysql_num_rows($mys)) { $my = array(); while ($my = mysql_fetch_array($mys)) { $q_ry = array(); $q_ry = "SELECT `p_id` FROM `members_properties` WHERE `p_playerid` = '" . mysql_real_escape_string($my['playerid']) . "' AND `p_property` = '1'"; $myshack = array(); $myshack = mysql_query($q_ry); $msh = array(); $msh = mysql_fetch_array($myshack); $q_ry = array(); $q_ry = "UPDATE `members` SET `my_property` = '" . mysql_real_escape_string($msh['p_id']) . "', `my_happy` = '100', `my_maxhappy` = '100' WHERE `playerid` = '" . mysql_real_escape_string($my['playerid']) . "'"; mysql_query($q_ry); } } remove_staff($ut['p_id']); $q_ry = array(); $q_ry = "UPDATE `members_properties` SET `p_leasedto` = '0', `p_ltime` = '0' WHERE `p_id` = '" . mysql_real_escape_string($ut['p_id']) . "'"; mysql_query($q_ry); } //Check for expired rentings //Charge daily upkeep $q_ry = array(); $q_ry = "SELECT * FROM `members_properties` mp LEFT JOIN `properties` h ON mp.p_property = h.house_id WHERE mp.p_property != '1'"; $upprops = array(); $upprops = mysql_query($q_ry); $up = array(); while ($up = mysql_fetch_array($upprops)) { $total = ($up['p_priceofstaff'] + $up['house_tax']); if ($up['p_leasedto'] != '0') { //Check money of tenant $q_ry = array(); $q_ry = "SELECT `playerid` FROM `members` WHERE `playerid` = '" . mysql_real_escape_string($up['p_leasedto']) . "' AND `wallet` <= '-" . mysql_real_escape_string($total) . "'"; $myc = array(); $myc = mysql_query($q_ry); if ($up['p_priceofstaff']) { stock_credit(5, 1); if (mysql_num_rows($myc)) { remove_staff($up['p_id']); $message3 = "You did not have enough to pay your staff for today, They have packed up and left!"; in_event($up['p_leasedto'], $message3); } } $q_ry = array(); $q_ry = "UPDATE `members` SET `wallet` = `wallet` - '" . mysql_real_escape_string($total) . "' WHERE `playerid` = '" . mysql_real_escape_string($up['p_leasedto']) . "'"; } else { //Check money of member $q_ry = array(); $q_ry = "SELECT `wallet` FROM `members` WHERE `playerid` = '" . mysql_real_escape_string($up['p_playerid']) . "' AND `wallet` <= '-" . mysql_real_escape_string($total) . "'"; $myc = array(); $myc = mysql_query($q_ry); if ($up['p_priceofstaff']) { stock_credit(5, 1); if (mysql_num_rows($myc)) { remove_staff($up['p_id']); $message3 = "You did not have enough to pay your staff for today, They have packed up and left!"; in_event($up['p_playerid'], $message3); } } $q_ry = array(); $q_ry = "UPDATE `members` SET `wallet` = `wallet` - '" . mysql_real_escape_string($total) . "' WHERE `playerid` = '" . mysql_real_escape_string($up['p_playerid']) . "'"; } mysql_query($q_ry); } //Charge daily upkeep /*-----------------------------------End cron minutes---------------------------*/ function award_check($user, $number, $award) { $q_ry = array(); $q_ry = "SELECT `ma_id`,`ma_tier` FROM `members_awards` WHERE `ma_playerid` = '" . mysql_real_escape_string($user) . "' AND `ma_award` = '" . mysql_real_escape_string($award) . "'"; $got_award = array(); $got_award = mysql_query($q_ry) or die(mysql_error()); if (mysql_num_rows($got_award)) { $ga = array(); $ga = mysql_fetch_array($got_award); if ($ga['ma_tier'] >= $number) { //Got it } else { $q_ry = array(); $q_ry = "UPDATE `members_awards` SET `ma_tier` = '" . mysql_real_escape_string($number) . "', `ma_viewed` = '0', `ma_time` = unix_timestamp() WHERE `ma_id` = '" . mysql_real_escape_string($ga['ma_id']) . "'"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "UPDATE `members` SET `my_merits` = `my_merits` + '1' WHERE `playerid` = '" . mysql_real_escape_string($user) . "'"; mysql_query($q_ry) or die(mysql_error()); } } else { $q_ry = array(); $q_ry = "INSERT INTO `members_awards` VALUES ('NULL', '" . mysql_real_escape_string($award) . "', '" . mysql_real_escape_string($number) . "', '" . mysql_real_escape_string($user) . "', '0', unix_timestamp())"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "UPDATE `members` SET `my_merits` = `my_merits` + '1' WHERE `playerid` = '" . mysql_real_escape_string($user) . "'"; mysql_query($q_ry) or die(mysql_error()); } } $q_ry = array(); $q_ry = "SELECT * FROM `award_checks` ac LEFT JOIN `awards` a ON ac.ac_award_id = a.a_id"; $award_checks = array(); $award_checks = mysql_query($q_ry) or die(mysql_error()); while ($aw = mysql_fetch_array($award_checks)) { $q_ry = array(); $q_ry = "SELECT " . $aw['ac_identify'] . "," . $aw['ac_what'] . " FROM " . $aw['ac_table'] . " WHERE " . $aw['ac_what'] . " >= '" . $aw['ac_amount'] . "'"; $thisaward = array(); $thisaward = mysql_query($q_ry) or die(mysql_error()); if (mysql_num_rows($thisaward)) { while ($ta = mysql_fetch_array($thisaward)) { award_check($ta[$aw['ac_identify']], $aw['ac_number'], $aw['ac_award_id']); } } } mysql_query("UPDATE `members` SET `my_dondays` = `my_dondays` - '1' WHERE `my_dondays` > '0'"); mysql_query("UPDATE `members` SET `my_maxenergy` = '100' WHERE `my_dondays` <= '0'"); mysql_query("UPDATE `members` SET `my_partner_days` = `my_partner_days` + '1' WHERE `my_partner` > '0'"); mysql_query("UPDATE `members` SET `brew` = '0'"); mysql_query("UPDATE `members_extra` SET `my_daysold` = `my_daysold` + '1'"); mysql_query("UPDATE `members_extra` SET `my_ctokens` = `my_ctokens_daily`,`my_cstreak` = '0'"); mysql_query("UPDATE `members_extra` SET `energy_refill` = '0'"); $q_ry = array(); $q_ry = "SELECT `playerid` FROM `members` WHERE `my_faction` > '0'"; $facdays = array(); $facdays = mysql_query($q_ry) or die(mysql_error()); $fd = array(); $q_ry = array(); while ($fd = mysql_fetch_array($facdays)) { $q_ry = "UPDATE `members_extra` SET `my_faction_days` = `my_faction_days` + '1' WHERE `playerid` = '" . mysql_real_escape_string($fd['playerid']) . "'"; mysql_query($q_ry) or die(mysql_error()); } $q_ry = array(); $q_ry = "DELETE FROM `votes_count` WHERE `vc_site` = 'apex' || `vc_site` = 'ultra'"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "SELECT * FROM `stock_holdings` WHERE `sh_saletime` > '0' AND (`sh_saletime`+1036800) <= '" . (time()) . "' AND `sh_playerid` != '3'"; $validstocks = array(); $validstocks = mysql_query($q_ry) or die(mysql_error()); $v = array(); while ($v = mysql_fetch_array($validstocks)) { $qty = $v['sh_qty']; $creditamnt = $v['sh_nowprice'] * $qty; $newprice = $v['sh_nowprice']; $q_ry = array(); $q_ry = "UPDATE `members` SET `wallet` = `wallet` + '" . mysql_real_escape_string($creditamnt) . "' WHERE `playerid` = '" . mysql_real_escape_string($v['sh_playerid']) . "'"; mysql_query($q_ry); $message = "Someone bought " . $qty . " of your stocks for \$" . number_format($creditamnt) . "!"; in_event($v['sh_playerid'], $message); $q_ry = array(); $q_ry = "UPDATE `stock_holdings` SET `sh_playerid` = '1', `sh_payed` = '" . mysql_real_escape_string($newprice) . "', `sh_time` = '" . time() . "', `sh_sale` = '1', `sh_saletime` = '" . time() . "' WHERE `sh_id` = '" . mysql_real_escape_string($v['sh_id']) . "'"; mysql_query($q_ry) or die(mysql_error()); } $yearago = (time() - 32140800); $sixmonths = $yearago / 2; $threemonths = $sixmonths / 2; $onemonth = $sixmonths / 6; $twoweeks = $onemonth / 2; $q_ry = array(); $q_ry = "DELETE FROM `member_mail` WHERE `mm_time` <= '" . mysql_real_escape_string($onemonth) . "'"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "DELETE FROM `member_events` WHERE `e_time` <= '" . mysql_real_escape_string($onemonth) . "'"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "DELETE FROM `attack_logs` WHERE `time` <= '" . mysql_real_escape_string($onemonth) . "'"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "DELETE FROM `faction_events` WHERE `fe_time` <= '" . mysql_real_escape_string($onemonth) . "'"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "DELETE FROM `profile_comments` WHERE `pc_time` <= '" . mysql_real_escape_string($twoweeks) . "'"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "DELETE FROM `profile_replies` WHERE `pr_time` <= '" . mysql_real_escape_string($twoweeks) . "'"; mysql_query($q_ry) or die(mysql_error()); $q_ry = array(); $q_ry = "DELETE FROM `stock_history` WHERE `h_time` <= '" . mysql_real_escape_string($sixmonths) . "'"; mysql_query($q_ry) or die(mysql_error()); } ?>
  25. Thanks, I might start looking at some Bootstrap 3 Tuts or something, not sure yet, and no, not a template
×
×
  • Create New...