Jump to content
MakeWebGames

sniko

Members
  • Posts

    2,210
  • Joined

  • Last visited

  • Days Won

    47

Everything posted by sniko

  1. camelCase is really nice snake_case is horrible I adopt a spin of the Hungarian notation, and camelCase "feels/looks" better. For example; $str_user_name = "foo"; $strUserName = "foo";
  2. sniko

    Games List

    What mobile? A native app would be more stable. Search your phones app-store.
  3. 60$ is nowhere near what i was hoping, especially looking at the list of expected functionality.
  4. I may be interested, if you up your budget.
  5. It's nice, however your class lacks the reason of using a class - if that makes sense. I would re-arrange your class structure, and make it more object-oriented (although there is only so much you can do with just two methods) <?php class HitList { private $intId; //This will hold the ID of the hitlist public $arrHitListDetails; //This will hold the details of the histlist public function __construct($intId) { $this->intId = $intId; $this->getHitList(); } final private function getHitList() { /** * Pretend we've queried MySQL for the hitlist * using $this->intId, set in the construct * * $this->arrHitListDetails = $arrResultSet; */ $this->arrHitListDetails = array( "target" => 1, "reason" => "foo bar", "placed" => 2, "prize" => 500 ); } } $objHitList = new HitList(1); echo print_r($objHitList->arrHitListDetails, true);
  6. Nice. But 1.   $maxMembs = $db->fetch_row($db->query("SELECT COUNT(`userid`) AS `u` FROM `users`")); if($_POST['ID'] > $maxMembs['u']) { echo "Invalid ID specified. Try again."; $h->endpage(); }   This isn't a valid check. What if (for some reason), I delete user id 3, and a new user signs up at user id 4 - but the count will be 3 (because there are 3 rows).   2.   $_POST['ID'] = abs(floatval($_POST['ID']));   Why are you using floatval?! ID's have never been floats, always integers. Something like this would be much better; $_POST['ID'] = filter_var($_POST['ID'], FILTER_VALIDATE_INT) ? (int) $_POST['ID'] : 0; if( (int) $_POST['ID'] == 0) { echo "Invalid ID"; $h->endpage(); die; }     3.   You're also not sanitizing $_POST['Reason']
  7. You seem to have misinterpreted me. I agree with the "self absorbed person", and I've publicly said it to him multiple times on this very forum. When I said he knew who the owner of Torn is, I didn't mean personally. I just meant that he knew it wouldn't be someone going by the name "Cordell" as his psuedoname is "Chedburn". (I'm not implying you cannot have more than 1 psudeoname.) Sure, he knew his stuff, but he wasn't the self-acclaimed god. And I see what you're getting at. I'm one of those old CE guys (at least I like to think I am; 2006/2007 guy), and I know k1ngscorpion when I read his posts. So we can agree that Cavell Anderson isn't Cordell, like my first post, right?
  8.   Cordell is a player, not a developer. Cavell Anderson has been in the programming game near 14 years, and very active in the Criminal Existence days - he knows who the owner of Torn is. Their posts differ in quality. Cavell Andersons were mainly about him being the best, whereas Cordells are mostly questions and compliments to game developers - Cavell Anderson never really asked questions or complimented openly as he was "the best ever"
  9. Cordell isn't Cavell Anderson, bud.
  10. Updated main post to fix the attack won bug to not account for separate days/hours.
  11. No need to create a regular expression for this. Use nl2br. See a preview. In bbparse, put return nl2br($text);
  12. I'll fix this for you. Put a shoe on your head, hold a banner saying "sniko", and take 5 pictures, then send it to me via Skype.
  13. Congratulations to Tangled for earning my attention by completing my requests! Here is the reward. Mugger of the hour. Original thread Thread created in 2010. Author last active on 07-05-2013 11:12 PM Run this SQL statement; create table mugger_oth ( uid int(11) not null, total_mugged int(11) not null default 0, date_start datetime not null, foreign key (uid) references users(userid) on delete cascade ) engine=myisam; create table mugger_oth_global ( entry_type enum('top_ever', 'top_hour', 'top_24') not null default 'top_24', uid int(11) not null, total_mugs int(11) not null, total_mugged int(11) not null, primary key (entry_type), foreign key (uid) references users(userid) ) engine=myisam; INSERT INTO `mugger_oth_global` (`entry_type`, `uid`, `total_mugs`, `total_mugged`) VALUES ('top_24', 1, 0, 0), ('top_hour', 1, 0, 0), ('top_ever', 1, 0, 0); mugger_leaderboard.php <?php //Mugger of the hour. //sniko //Free system //Code for show on head selfie. //2014. include_once('globals.php'); ?> <h3>Mugger of the hour</h3> <table class="table" width="70%"> <tr> <th>Username</th> <th>Total cash mugged</th> <th>Total mugs</th> </tr> <?php $strSqlQuery = "SELECT moth.`uid`,moth.`total_mugs`,moth.`total_mugged`,u.`username` FROM `mugger_oth` moth INNER JOIN `users` u ON moth.`uid` = u.`userid` WHERE `date_start` >= DATE_SUB(DATE_FORMAT(NOW(), '%Y-%m-%d %k:%i:%s'), INTERVAL 1 hour) AND `date_start` <= DATE_ADD(DATE_FORMAT(NOW(), '%Y-%m-%d %k:%i:%s'), INTERVAL 1 hour) ORDER BY `total_mugged` DESC LIMIT 20"; $objDb = $db->query($strSqlQuery); while( $arrResults = $db->fetch_row($objDb) ) { echo "<tr> <td>". $arrResults['username'] ."</td> <td>". money_formatter($arrResults['total_mugged']) ."</td> <td>". number_format($arrResults['total_mugs']) ."</td> </tr>"; } echo "</table>"; $h->endpage(); die; ?> cron_mugger.php Set this up so it runs every hour, on the hour <?php //Mugger of the hour. //sniko //Free system //Code for show on head selfie. //2014. ini_set('display_errors', 1); error_reporting(E_ALL); define("NO1_CRYSTALS", 100); //Top hour reward define("TOP_EVER_CRYSTALS", 500); //Top ever reward define("TOP_24_CRYSTALS", 300); //Top 24 hour mugger require_once('globals_nonauth.php'); if (!isset($_GET['code']) || $_GET['code'] !== $_CONFIG['code']) { echo "Wrong code"; exit; } //Grab all of the muggers $strDbQuery = "SELECT `uid`,`total_mugs`,`total_mugged` FROM `mugger_oth` WHERE `date_start` >= DATE_SUB(DATE_FORMAT(NOW(), '%Y-%m-%d %k:%i:%s'), INTERVAL 1 hour) AND `date_start` <= DATE_ADD(DATE_FORMAT(NOW(), '%Y-%m-%d %k:%i:%s'), INTERVAL 1 hour) ORDER BY `total_mugs` DESC LIMIT 1"; $arrTopPerson = $db->fetch_row( $db->query($strDbQuery) ); if( empty($arrTopPerson) == FALSE ) { echo PHP_EOL ."<br />"; echo "Awarding the top mugger of this hour. ID: ". $arrTopPerson['uid']; echo PHP_EOL ."<br />"; //Awards to the top guy (or girl) for this hour. $db->query("UPDATE `users` SET `crystals`=`crystals`+". NO1_CRYSTALS ." WHERE `userid` = ". $arrTopPerson['uid']); $db->query("UPDATE mugger_oth_global SET `uid` = ". $arrTopPerson['uid'] .", `total_mugs` = ". $arrTopPerson['total_mugs'] .", `total_mugged` = ". $arrTopPerson['total_mugged'] ." WHERE `entry_type` = 'top_hour'"); unset($arrTopPerson); } //@todo: update mugger_oth_global //Update top ever mugger (if they've participated this hour) $objDb = $db->query("SELECT `uid`,`total_mugs`,`total_mugged` FROM `mugger_oth` WHERE `date_start` >= DATE_SUB(DATE_FORMAT(NOW(), '%Y-%m-%d %k:%i:%s'), INTERVAL 1 hour) AND `date_start` <= DATE_ADD(DATE_FORMAT(NOW(), '%Y-%m-%d %k:%i:%s'), INTERVAL 1 hour) AND `uid` = (SELECT `uid` FROM `mugger_oth_global` WHERE `entry_type` = 'top_ever')"); if( $db->num_rows($objDb) ) { //He (or she!) participated this hour! $arrTopEver = $db->fetch_row($objDb); echo PHP_EOL ."<br />"; echo "Updating top muggers total mugs: ". $arrTopEver['uid']; echo PHP_EOL ."<br />"; echo "Top mugger has ". $arrTopEver['total_mugs'] ." this hour!"; $db->query("UPDATE `mugger_oth_global` SET `total_mugs` = `total_mugs` + ". $arrTopEver['total_mugs'] .", `total_mugged` = `total_mugged` + ". $arrTopEver['total_mugged'] ." WHERE `uid` = ". $arrTopEver['uid']); } //Now, see if anybody has beaten the top mugger ever. $strDbQuery = "SELECT `uid`,`total_mugs` FROM mugger_oth_global WHERE `entry_type` = 'top_ever'"; $arrTopEver = $db->fetch_row($db->query($strDbQuery)); $strDbQuery = "SELECT `uid`,SUM(`total_mugs`) AS total_ever_mugs,SUM(`total_mugged`) AS `total_ever_mugged` FROM `mugger_oth` GROUP BY `uid` HAVING SUM(`total_mugs`) > ". $arrTopEver['total_mugs'] ." ORDER BY SUM(`total_mugs`) DESC LIMIT 1"; $objDb = $db->query($strDbQuery); if( $db->num_rows($objDb) ) { //Holy balls. //Someone has beat the total ever guy (or girl!) $arrNewTopEver = $db->fetch_row($objDb); echo PHP_EOL ."<br />"; echo "Someone beat the top mugger of all time. New top mugger: ". $arrNewTopEver['uid']; echo PHP_EOL ."<br />"; echo "Old top mugger: ". $arrTopEver['uid']; $db->query("UPDATE mugger_oth_global SET `uid` = ". $arrNewTopEver['uid'] .", `total_mugs` = ". $arrNewTopEver['total_ever_mugs'] .", `total_mugged` = ". $arrNewTopEver['total_ever_mugged'] ." WHERE `entry_type` = 'top_ever'"); $db->query("UPDATE `users` SET `crystals`=`crystals`+". TOP_EVER_CRYSTALS ." WHERE `userid` = ". $arrNewTopEver['uid']); event_add($arrNewTopEver['uid'], "You are now the top ever mugger ever! You are rewarded with ". TOP_EVER_CRYSTALS ." crystals."); event_add($arrTopEver['uid'], "You are not the top ever mugger!"); } unset($objDb, $arrTopEver); //Now, see if anybody has overtaken the previous top hour guy (or girl!) $strDbQuery = "SELECT `uid`,`total_mugs` FROM mugger_oth_global WHERE `entry_type` = 'top_24'"; $arrTop24 = $db->fetch_row($db->query($strDbQuery)); $strDbQuery = "SELECT `uid`,SUM(`total_mugs`) AS total_24_mugs,SUM(`total_mugged`) AS total_24_mugged FROM `mugger_oth` WHERE `date_start` >= DATE_SUB(DATE_FORMAT(NOW(), '%Y-%m-%d %k:%i:%s'), INTERVAL 24 hour) AND `date_start` <= DATE_ADD(DATE_FORMAT(NOW(), '%Y-%m-%d %k:%i:%s'), INTERVAL 24 hour) GROUP BY `uid` HAVING SUM(`total_mugs`) > ". $arrTop24['total_mugs'] ." ORDER BY SUM(`total_mugs`) DESC LIMIT 1"; $objDb = $db->query($strDbQuery); if( $db->num_rows($objDb) ) { //Holy balls. //Someone has beat the total 24 guy (or girl!) $arrNewTopEver = $db->fetch_row($objDb); echo PHP_EOL ."<br />"; echo "Someone beat the top mugger 24hour mugger. New top 24hour mugger: ". $arrNewTopEver['uid']; echo PHP_EOL ."<br />"; echo "Old top mugger: ". $arrTop24['uid']; $db->query("UPDATE mugger_oth_global SET `uid` = ". $arrNewTopEver['uid'] .", `total_mugs` = ". $arrNewTopEver['total_24_mugs'] .", `total_mugged` = ". $arrNewTopEver['total_24_mugged'] ." WHERE `entry_type` = 'top_24'"); $db->query("UPDATE `users` SET `crystals`=`crystals`+". TOP_24_CRYSTALS ." WHERE `userid` = ". $arrNewTopEver['uid']); event_add($arrNewTopEver['uid'], "You are now the top 24 hour mugger! You are rewarded with ". TOP_24_CRYSTALS ." crystals."); event_add($arrTop24['uid'], "You are not the top 24 hour mugger!"); } unset($objDb, $arrTopEver); Add this is the end of attack won.php Code mucked up? //Mugger of the hour. //sniko //Free system //Code for show on head selfie. //2014. $strDbQuery = "SELECT `uid` FROM `mugger_oth` WHERE `uid` = ". $userid ." AND DATE_FORMAT(`date_start`, '%Y-%m-%d %k') = DATE_FORMAT(NOW(), '%Y-%m-%d %k')"; $objThisHour = $db->query($strDbQuery); if( $objThisHour->num_rows ) { $strDbQuery = "UPDATE `mugger_oth` SET `total_mugged` = `total_mugged` + ". $stole .", `total_mugs` = `total_mugs` + 1 WHERE `uid` = ". $userid ." AND DATE_FORMAT(`date_start`, '%Y-%m-%d %k') = DATE_FORMAT(NOW(), '%Y-%m-%d %k')')"; $db->query($strDbQuery); } else { $strDbQuery = "INSERT INTO `mugger_oth` (`uid`,`total_mugged`,`date_start`, `total_mugs`) VALUES (". $userid .", ". $stole .", NOW(), 1)"; $db->query($strDbQuery); } If there are any bugs, reply and I'll sort them. This wasn't tested on a game with multiple users - I was alone, so test results may be not near perfect. There is a bug with the attack won.php query - I'll continue work on it tomorrow :D Would recommend installing it on your test server until I can fully test this and fix the issue with attackwon.php file
  14. You know the deal. Paypal issue fix - 5 selfies with you throwing a donut in the air, trying to catch it in your mouth whilst holding a sign with the word "sniko" on it. - Or, combine it into a nice small .gif for me. No attacks or mug on my account - 2 selfies with a shoe on your head, holding a sign with my name on it. Forums - 10 selfies with a small wooden chair on your head (wear it like a medieval helmet), holding a sign with my name on it. Logs - Make a gif on you holding a sign with my name on it, doing jumping jacks. Gif must last for at least 3 individual jumping jacks. Events pagination - Provide on of the above, and I'll throw this in for free. Staff Panel Access - Cannot say until you tell how you want it adjusted Gang system - Pass. Not enough time.
  15. Sure, I'll do it for you Send me 5 pictures of you with a shoe on your head, holding a piece of paper with the word "sniko" on it. It'll free code after all ;) - - - Updated - - -   Sure, I'll do it for you Send me 5 pictures of you with a shoe on your head, holding a piece of paper with the word "sniko" on it. It'll free code after all ;) I do deliver http://makewebgames.io/showthread.php/45111-banner-issue?p=306561&viewfull=1#post306561 Add me on skype: harry.sniko
  16. What issues are you having?
  17. Well, i didn't think he'd deliver - but he did. Ensure you have GD library installed. Make sure you have CURL installed. Make sure you have the gif in the same directory as the .php script and name it "hothhotel.gif" Make sure your .php script can be accessed by the public. <?php $strPageToScrape = "http://www.hothhotel.eu/index"; $objCurl = curl_init(); curl_setopt($objCurl, CURLOPT_URL, $strPageToScrape); curl_setopt($objCurl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($objCurl, CURLOPT_CONNECTTIMEOUT, 0); $strPage = curl_exec($objCurl); curl_close($objCurl); $arrMatch = array(); preg_match("/<span class=\"stats-fig\">[0-9]*<\/span>/", $strPage, $arrMatch); if( empty($arrMatch) ) { $intPlayersOnline = "-"; } else { $intPlayersOnline = abs( filter_var($arrMatch[0], FILTER_SANITIZE_NUMBER_INT) ); } //Create the image try { $objImage = imagecreatefromgif("hothhotel.gif"); $text = imagecolorallocate($objImage, 255, 255, 255); imagestring($objImage, 5, 450, 10, $intPlayersOnline, $text); Header('Content-Type: image/gif'); imagegif($objImage); imagedestroy($objImage); } catch (Exception $objException) { Header('Content-Type: image/gif'); echo file_get_contents('hothhotel.gif'); } For those interested, I didn't do this for money. I did this for something way better than money. Here; I present to you my payment. Here is me proposing the deal; Payment has been attached to this post. Enjoy. A sneak preview; (Holy Sh**. That was fun xD) // Will code for selfies with "sniko" sign and shoe on head.
  18. Check your McCodes account. I hope I transferred the FREE version to your account :)
  19. I really hope you're sanitizing _POST's. As that would just throw your "There are no SQL vulnerabilities" claim straight out the water Why are you hard-coding parameters; like the "From" field, and the "Subject" field? Why are you mixing a lot of HTML with your model/back-end logic? Why are you relying on mail()? Putting it in an if() statement doesn't notify you if the e-mail gets delivered, if mail() returns TRUE Why are you not either passing the e-mail to a 3rd party, or a library - SwiftMailer for example?   Honestly, there are some questionable methods in the 10 lines you've posted, I can't wait to play and see the source of RC engine 2.0. Further,   Make sure your subject fields complies with RFC-2047 standards. Your mail body doesn't comply with the notes in the manual. "Each line should be separated with a CRLF (\r\n). Lines should not be larger than 70 characters."   But, To answer your question;   Ensure port 25 isn't blocked Ensure your mail service is running Look at the maillog, and see why it wasn't accepted for delivery Have you configured your mail service?
  20. Please set-up a test site so we can experiment against your claims
  21. No, please provide a snippet of code - perhaps even a small application to prove your object-oriented skills, too?
  22. Evidence in this thread suggests otherwise...
  23. To note, you'd need PHP 5 or above installed for this to work. Pretty sure most hosting companies are at PHP 5, but I thought I might as well post it   function valid_email($email) { if( filter_var($email, FILTER_VALIDATE_EMAIL) == FALSE ) { // Email invalid return false; } return true; }   Live Preview
  24. £2 is more of an insult than not being paid at all. I think I've given you enough information to correctly implement the code into your system.
  25. Then your "brain capacity" won't enhance - you won't learn.
×
×
  • Create New...