Jump to content
MakeWebGames

Swift-Fusion || Fusion

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Everything posted by Swift-Fusion || Fusion

  1. Hello there George, i just finished re-programming this: [mccode v2.x] Updated Secure lotto
  2. I was asked before to re-program a mod for you guys too see my programming. So i choose the lotto mod because i looked in the requests and someone had asked for one. So here goes. This hasnt been tested though. Original mod: http://makewebgames.io/board791/21297-mccode-v2-lottery This is the lotto file, call it what you want. <?php /* SQLS: ALTER TABLE `users` ADD `lottery` INT(11) NOT NULL DEFAULT '0'; DROP TABLE IF EXISTS `lottery`; CREATE TABLE IF NOT EXISTS `lottery` ( `id` int(11) NOT NULL auto_increment, `userid` int(11) NOT NULL, `amount` int(11) NOT NULL, `jackpot` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; */ include_once(dirname(__FILE__) .'/globals.php'); ///Settings $cost = 100; //Cost per ticket $max = 100; //Max amount of tickets //End settings $_GET['lotto'] = (is_string($_GET['a']) && isset($_GET['a']) && !empty($_GET['a']) && $_GET['a'] == 'buy') ? $_GET['lotto'] : false; $_GET['amnt'] = (isset($_GET['amnt']) && !empty($_GET['amnt']) && is_numeric($_GET['amnt']) && is_int($_GET['amnt'])) ? $_GET['amnt'] : false; switch($_GET['lotto']) { case'buy' : buy(); break; default: lottory(); break; } function lottory() { global $db, $ir, $h, $cost, $max; $lotto = $db->fetch_single($db->query("SELECT `jackpot` FROM `lottery`")); echo'<span style="color: red; size: 5; font-weight: bold;">Welcome to the National Jackpot.</span> You currently have '. number_format($ir['lottery']) .' ticket\'s. You can purchase '. number_format($max-$ir['lottery']) .' more tickets this week. Each ticket costs '. money_formatter($cost) .'. <span style="color: white; font-weight: bold; size: 5;">The jackpot is currently '. money_formatter($lotto) .'.</span> <form action="?lotto=buy" method="get"> Amount of tickets: <input type="text" name="amnt" value="'. $max-$ir['lottery'] .'" /> <input type="submit" value="Buy the tickets!" /> </form>'; $h->endpage(); exit(); } function buy() { global $db, $ir, $h, $cost, $max; if(($ir['money']*$_GET['amnt']) < $cost) { echo'You don\'t seem to have enought money.'; $h->endpage(); exit(); } if($_GET['amnt'] == 0 || $_GET['amnt'] > $max) { echo'The amount of tickets you want, cannot be purchased.'; $h->endpage(); exit(); } if($ir['lottery'] > $max) { $db->query("UPDATE `users` SET `lottery` = ". $max ." WHERE (`userid` = ". $ir['userid'] .");"); echo'Lotto tickets fixed.'; $h->endpage(); exit(); } if($ir['lottery']+$_GET['amnt'] > $max) { echo'If we let you purchase these tickets, you would have too many.'; $h->endpage(); exit(); } echo'You have purchased '. number_format($_GET['amnt']) .' tickets.'; $db->query("UPDATE `users` SET `lottery` = `lottery` + ". $_GET['amnt'] .", `money` = `money` - ". ($cost*$_GET['amnt']) ." WHERE (`userid` = ". $ir['userid'] .");"); $db->query("INSERT INTO `lottery` (`id`, `userid`, `amount`) VALUES ('', ". $ir['userid'] .", ". $cost*$_GET['amnt'] .");"); $db->query("UPDATE `lottery` SET `jackpot` = `jackpot` + ". $cost*$_GET['amnt'] .";"); $h->endpage(); exit(); } ?>   Now this is the cron, run it every week: <?php include_once(dirname(__FILE__) .'/config.php'); global $_CONFIG; if($_GET['code'] != $_CONFIG['code']) { echo'Wrong code.'; exit(); } define('mono_on', 1, true); require_once(dirname(__FILE__) .'/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; include_once(dirname(__FILE__) .'/global_func.php'); $thesql = $db->query("SELECT * FROM `lottery`"); $amnt = $db->num_rows($thesql); $lotto = $db->fetch_row($thesql); $winnerid = rand(1, $amnt); $user = $db->fetch_single($db->query("SELECT `userid` FROM `lottery` WHERE (`id` = ". $winnerid .");")); $db->query("UPDATE `users` SET `money` = `money` + ". $lotto['jackpot'] ." WHERE (`userid` = ". $user .");"); event_add($user, 'You\'ve won the weekly lottery and won '. money_formatter($lotto['jackpot']) .'.', $c); $db->query("UPDATE `users` SET `lottery` = 0;"); $db->query("TRUNCATE TABLE `lottery`"); echo'ID: '. $winnderid .' won the lotto.'; exit(); ?>
  3. If you/anyone else would donate any ideas, im here and ill be happy to program them. I currently have no ideas. Thanks anyway. Ragards
  4. Hello there. (Im sorry if this is in the wrong place) As we haven't quite finished our homepage yet, we at SF figured you couldn't know what we do. So, we have created a list of out services and our prices. So, here we go. Templates (PSD included) - $70 - $140. Template coding from PSD (PSD required) - $20 (Pre-sliced.) - $30 - (Plain PSD.) McCode Modifications: Starting at $10. McCode Security: $150 (all files.) McCode Re-code: $250 (all files.) Other Security: $5 for the first 125 files $2 after that. Other Re-Codes: $10 for the first 125 files $5 after that. We feel these are reasonable prices, especally for the work we offer. There are two ways to contact us, Via PM on here, or via MSN: My MSN: [email protected] Swifts MSN: [email protected] Regards Fusion
×
×
  • Create New...