Jump to content
MakeWebGames

Macintrash

Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by Macintrash

  1. I wonder if it's mediawiki itself, or the bots that flood it. Anyway, i moved the wiki folder back a directory and replaced the index with a redirect :) I be trollin the bots. Since the move, things have gotten a lot better. I suspect it was the bots trying to spam it. A tip to everyone: host a wiki elsewhere! Even if this means a new and cheap domain purely for the wiki.
  2. A couple of days ago my host moved me to a limited server to due "excessive resource usage". My site has been going for 4 years now but i never really checked the usage monitor until now. 2% of CPU, 8% of memory, 140 SQL procs. Horrible! I know! Its never been that high. It went from 1% of each to a massive amount in 3 days. The worst part? The site is and has been offline for 3 days, and the resources are still heavily used! The crons have been cutoff from their mysql connections, the game itself also has mysql.php disabled... has been disabled for 2 days. The usage is still deadly high! The ONE thing i suspect is my WIKI. This all happened as soon as i disabled my wiki from allowing bots to spam it, rather than using robots.txt, i just disabled a useragent with "bot" in it from connecting properly. Is it possible the bots are getting revenge? Is it just my scripts infinitely looping in the memory? I can show you my usage stats if youd like. This is frustrating, anyone ever experienced this before?
  3. This code is useful, however, in a situation where you need it ran once a second, but its being ran 10 times a second because its in header.php. Say theres lots of people clicking at once, the script is unnecessarily ran more than once per second. If you were to take advantage of this, you would actually lighten the load on your server, right? It seems to work for me, correct me if im wrong.
  4. Well i suppose it wont, now that i think about it. I forgot that the server executes the PHP either way, rather than the user executing it(Oops, getting too used to C++), this is just forcing it to execute every second rather than once per click. Oh well, i guess i need to find a new way to run big scripts without problem. :(
  5. Because we have one for days and minutes. Why not seconds? Regarding the bandwidth: This is only good for people with unlimited bandwidth, if your host limits you, keep it light. I suppose it could take a lot up, IF you overload it, can someone explain to me how this would destroy your bandwidth if it just runs a little script that removes people from prison if they are under level 5?
  6. <?php //global func, mysql include, global $c... etc $i = 1; while ($i <=60) { $i++; //Your code goes here, it will be run every second. sleep(1); } ?>   Make this a cron, and make it run every minute. It will restart every minute, but it will run for 1 second for 60 loops. As soon as its done, the cron restarts and continues running. I have tested it and it works. Its great for codes that slow down header.php, large operations/checks can be moved here to put not even a dent in the server load, whereas putting them in header would slow down loading by at least 1 or 2 seconds.
  7. Ok exactly 20 seconds ago i have narrowed it down! I have found out that it allows me to have one account logged in at http://www.mygame.com, and a different account at mygame.com at the same time
  8. Now i dont know if this is common, but occasionally while playing, i will click on a profile of a new account and it will log me out. It doesnt unset my session though, because i can go right back into the game by entering in a new URL. What makes it even more confusing is i can have 2 accounts right next to each other, and i open them both in new tabs. ONE can work, and the other will send me straight to the login page. I know its not a hacker because its been happening for a year and it only happens with new accounts and while using items. I looked at the "if session=0 header:login.php" code on a page that works fine compared to a page that causes a logout, and they are identical. What is causing my account to logout when i go to specific pages? I know for a fact my session is still intact, plus it even let me login to a new account while the other is still logged in. Where can i view my cookies/sessions to see whats really going on and how can i fix this?
  9. NarutoPRG, interested in space? Lucky me, that must mean you make a lot of space graphics. Im the owner of universalcriminal, maybe you can get me some images made some time :) Ill keep you on tab if i need you :)
  10. Back in 2007 i joined a game that was only 1 year old, it was fun. Soon after that, i invited friends. We all played it and loved it. Then in 2008 it had a reset. I started coding as a complete noobie there to assist the owner because the original coder left. I became full time coder and soon had to start running the game on my own due to owner absence. Since then i made negotiations to buy the game. As you may know, internet layouts have changed a lot since 2006 when it was made. I am looking for an all in one artist. I want a brand new login page, improved table appearance, smoother corners, richer appearance and such. Since i will be the owner and it has many players and donators i will be able to afford good improvements, just not all in one. I have done new backgrounds, bars look glossy now, but other than actual images i suck at web graphics. If you think you have what it takes, please ask some questions and post pictures of your work. If i like your work, i will keep you on tab as a long term graphic artist. Thanks all :) Remember, i need samples to pick from, im like a hobo in home depot lol.
  11. That might not always work, what if an item is supposed to bring it over 100%? Then it just shows 100%. Heres what i did:   PUT IT Above the code that prints out your bars, then edit the bars to use enperc2 as the width instead of enperc. This way it will print out the real percentage while keeping the bars down to 120 width. :) It works great for me.   $enperc2 = $enperc*1.2; if($enperc2>120) { $enperc2=120; } $enopp2 = $enopp*1.2; if($enopp2>120) { $enopp2=120; } $wiperc2 = $wiperc*1.2; if($wiperc2>120) { $wiperc2=120; } $wiopp2 = $wiopp*1.2; if($wiopp2>120) { $wiopp2=120; } $brperc2 = $brperc*1.2; if($brperc2>120) { $brperc2=120; } $bropp2 = $bropp*1.2; if($bropp2>120) { $bropp2=120; } $experc2 = $experc*1.2; if($experc2>120) { $experc2=120; } $exopp2 = $exopp*1.2; if($exopp2>120) { $exopp2=120; } $hpperc2 = $hpperc*1.2; if($hpperc2>120) { $hpperc2=120; } $hpopp2 = $hpopp*1.2; if($hpopp2>120) { $hpopp2=120; }
  12. Im going to be hiring someone real soon to fix this all. Im looking for someone who can do awesome graphic layouts to improve the standard MC tabled login page, improve tables, horizontal rules, css, fonts etc. I want it to look better and load quicker at the same time. I want someone i can trust. So with that being said, is scriptlance a good place to do this? As an owner with decent donations coming in i could probably afford $100 worth of updates at a time. Should i stick with MWG or should i use something like scriptlance and use someone who's never even heard of MCCode?
  13. I notice some mccode games load so fast you dont see the page move. Others, you click a link and it turns black and re-renders everything. What can be done to increase loading speed? I heard echo/print can make a difference. I also heard the use of <div> would help. Anyone know any good specifics that dont need a complete engine conversion just to implement?
  14. Im just saying! Using this on your variables instead of figuring out what cleaners to add to them will save a lot of work. Isnt this what your supposed to use to secure a site? I thought stripping tags and such were the best way to secure it, so why not let a function do it for you?
  15. Explain to me why it wont? This IS securing the whole site, isnt it? Im saying go through EVERY script, and add this function around EVERY SINGLE post/get. So really its the same thing as adding abs/strip tags to each one individually, except the function will do it for you. BTW thanks for the is_int! :D
  16. Now i looked here in the forums, and there is a LOT of talk about security. Why not make an official "master cleaner" function that could solve these once and for all? I could do it myself but i want to be sure i got everything right, i have my own game and i write private mods for myself constantly, im a whiz with mccodes, but new php functions usually aren't in my familiarity zone. So, what i would imagine of course you have your basic post or get data, the function would be easily added to pages, and it has to do everything in one! For your data, You would have something like:   $_POST['data'];   Right? Yes. So what would simplify adding security would be to put the variable into a "Master Secure" function of sorts, something like:   MasterSecure($_POST['data']);   instead of   $_POST['data']; (replace completely with it inside of mastersecure) Now we are getting somewhere! But you may think, how will you make it work for strings, integers and such properly? Well, that's where PHP coding comes in :) You would first write your function, of course. It would have to be in header.php or your global data, i would recommend globals because it can be included in login.php/register.php without issues. SO, what we need to do is make the variable you added carry into the function:   function MasterSecure($var_to_be_cleaned) { }   So there, now every time you call the function, it will carry your $post or $get INTO IT for cleaning. So now that its going in, how do we know what to clean it with if we don't know what data type it is? Well that's where the BRAIN FART comes in, im not much with those PHP functions off the top of my head, but i know someone is. I could look them up right now but don't know what they're called! But don't worry, PHP is powerful, i know it can be done, and i know its something simple. So now your function receives your post/get, and checks what data type it is. Now comes the part where you add the IF statements.   function MasterSecure($var_to_be_cleaned){ /* Here you check for the datatype so you can decide which if statement to put it through. */ //Use string cleaners, such as strip_tags. if(data type is string) { $var_to_be_cleaned = strip_tags('$var_to_be_cleaned'); //I believe it should have the '' around it. print $var_to_be_cleaned; } else if(data type is integer){ $var_to_be_cleaned = abs($var_to_be_cleaned); print $var_to_be_cleaned; } /*Your variable is then spit back out of the function and into your script, cleaned and ready to go! */ }   So there we have it, a hopefully working master securer, working for all versions of mccodes. BELOW: I will be keeping track of the actual function in a script box and will be adding/modifying as i get new posts. function msecure($var) { if(is_int($var)) { print abs(intval($var)); } else if(is_string($var) print mysql_real_escape_string($var); } else{ print "Warning - Invalid Data"; } }
  17. hey i could code this, i recommend making it a donator only feature
  18. The one on the mccode site is gone, and i need one badly. I looked on here but the search is broken. I dont mind what version of mccode it is because i can convert it either way. Does anyone have one or know where i can find a working one for mccode games?
  19. Re: Referral Hall Of Fame? Yeah i fixed it
  20. Re: Looking for a Referal Mod ... Fatal error: Call to a member function on a non-object in /home/unive21/public_html/halloffame.php on line 155
  21. Re: Referral Hall Of Fame? That one gives me an error :( Fatal error: Call to a member function on a non-object in /home/unive21/public_html/halloffame.php on line 155
  22. I just got done with a bunch of updates, and a referral hall of fame was last on my list. I got everything done, i was so happy. Now im stuck on the hall of fame :( See, normally the hall of fame uses a code like this: function hof_level() { global $ir,$c,$userid; print "Showing the 40 users with the highest levels <table width=75%><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Level</th> </tr>"; $q=mysql_query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 7 && u.user_level != 10 && u.user_level != 0 && u.user_level != 2 ORDER BY level DESC,userid ASC LIMIT 40", $c); $p=0; while($r=mysql_fetch_array($q)) { $p++; if($r['userid'] == $userid) { $t="";$et=""; } else { $t="";$et=""; } print "<tr> <td>$t$p$et</td> <td>$t{$r['gangPREF']} {$r['username']} [{$r['userid']}]$et</td> <td>$t{$r['level']}$et</td> </tr>"; } That ones for "level" But getting a number of the amount of referrals you have involves a code like this: $rr=mysql_query("SELECT * FROM referals WHERE refREFER={$r['userid']}",$c); I was thinking of adding that in there, and changing the order by level to order by $rr, but i get errors Anyone know whats wrong? Im completely baffled, please help!
  23. Re: [mccode v1]Starter Pack Item sorry i forgot to mention, it IS the full code, but you need to add your own items to the list
  24. I Wrote a small code block into itemuse.php, its basically an item that when used, gives the user medical items, a donator day, some cash and crystals etc.   if($r['itmname'] == 'Starter Pack') { print "<center>Starter Pack Used!</br> You have been given several medical supplies,some bar refillers, a starter weapon and armor, and some spare money and moondust. Take a look at them in your inventory!</center>"; //items mysql_query("INSERT INTO inventory VALUES('',337,{$ir['userid']},1);",$c); //first '' should be left alone, 337 is the items id, the 1 is the quantity //benefits mysql_query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid SET u.money=u.money+20000,u.crystals=u.crystals+100, us.IQ=us.IQ+100,u.donatordays=u.donatordays+1 WHERE u.userid=$userid",$c); //who to inform event_add(1," Player ID [{$ir['userid']}] used a starter pack",$c,'general'); // the 1 is the users id that gets the event, the rest should be left alone }   Its really a very useful item, all you need to do is create the item and name it Starter Pack and it should work. You can also add an "event_add" to itemsend.php so that it tells you who send the item Sorry i dont know how to use colored codes :(
×
×
  • Create New...