Jump to content
MakeWebGames

Karlos

Members
  • Posts

    951
  • Joined

  • Last visited

    Never

Everything posted by Karlos

  1. This code is simple.... :wink:   <?php include_once (DIRNAME(__FILE__) . '/globals.php'); ### Start Configuration ### $EnergyRefill = '10'; $WillRefill = '10'; $BraveRefill = '10'; $DonatorDays = '10'; $Protection = '10'; ### End Configuration ### function Error($Message) { global $h; echo sprintf("<span style='color: #FF0000;'>Error! %s</span>", stripslashes($Message)); exit($h->endpage()); } $_GET['spend'] = isset($_GET['spend']) && ctype_alpha($_GET['spend']) ? trim($_GET['spend']) : FALSE; if (!in_array($_GET['spend'], array('', 'EnergyR', 'WillR', 'BraveR', 'Donator', 'Protect'))) { Error('Invalid Command!'); } if (!$_GET['spend']) { echo '<span style="text-decoration: underline; font-size: 14px; font-weight: 600">Welcome To The Crystal Temple!</span> '; echo sprintf("You have [b]%s[/b] crystals. ", number_format($ir['crystals'])); echo 'What would you like to spend your crystals on? '; echo sprintf(" [url='ctemple.php?spend=EnergyR']Energy Refill - %s Crystals[/url] ", number_format($EnergyRefill)); echo sprintf("[url='ctemple.php?spend=WillR']Will Refill - %s Crystals[/url] ", number_format($WillRefill)); echo sprintf("[url='ctemple.php?spend=BraveR']Brave Refill - %s Crystals[/url] ", number_format($BraveRefill)); echo sprintf("[url='ctemple.php?spend=Donator']3 Donator Days - %s Crystals[/url] ", number_format($DonatorDays)); echo sprintf("[url='ctemple.php?spend=Protect']Protection - %s Crystals (30 Minutes Only)[/url] ", number_format($Protection)); } else { if ($_GET['spend'] == 'EnergyR') { if ($ir['crystals'] < $EnergyRefill) { Error('You Don\'t Have Enough Crystals!'); } else if ($ir['energy'] == $ir['maxenergy']) { Error('You Already Have Full Energy.'); } else { $db->query(sprintf("UPDATE users SET energy=maxenergy, crystals=crystals-%d WHERE userid=%d", $EnergyRefill, $userid)); echo sprintf("You Have Paid %d Crystals To Refill Your Energy Bar.", number_format($EnergyRefill)); } } else if ($_GET['spend'] == 'WillR') { if ($ir['crystals'] < $WillRefill) { Error('You Don\'t Have Enough Crystals!'); } else if ($ir['will'] == $ir['maxwill']) { Error('You Already Have Full Will.'); } else { $db->query(sprintf("UPDATE users SET will=maxwill, crystals=crystals-%d WHERE userid=%d", $WillRefill, $userid)); echo sprintf("You Have Paid %d Crystals To Refill Your Will Bar.", number_format($WillRefill)); } } else if ($_GET['spend'] == 'BraveR') { if ($ir['crystals'] < $BraveRefill) { Error('You Don\'t Have Enough Crystals!'); } else if ($ir['brave'] == $ir['maxbrave']) { Error('You Already Have Full Brave.'); } else { $db->query(sprintf("UPDATE users SET brave=maxbrave, crystals=crystals-%d WHERE userid=%d", $BraveRefill, $userid)); echo sprintf("You Have Paid %d Crystals To Refill Your Brave Bar.", number_format($BraveRefill)); } } else if ($_GET['spend'] == 'Donator') { if ($ir['crystals'] < $DonatorDays) { Error('You Don\'t Have Enough Crystals!'); } else if ($ir['donatordays'] > '0') { Error('You Already Have Some Donator Days...'); } else { $db->query(sprintf("UPDATE users SET donatordays=donatordays+3, crystals=crystals-%d WHERE userid=%d", $DonatorDays, $userid)); echo sprintf("You Have Paid %d Crystals For 3 Donator Days.", number_format($DonatorDays)); } } else if ($_GET['spend'] == 'Protect') { if ($ir['crystals'] < $Protection) { Error('You Don\'t Have Enough Crystals!'); } else if ($ir['protection'] > '0') { Error('You Already Have Protection...'); } else { $db->query(sprintf("UPDATE users SET protection=protection+30, crystals=crystals-%d WHERE userid=%d", $Protection, $userid)); echo sprintf("You Have Paid %d Crystals For 30 Minutes Protection.", number_format($Protection)); } } } $h->endpage(); ?>   Add this SQL: ALTER TABLE `users` ADD `protection` TINYINT(2) NOT NULL DEFAULT '0';   Find the following in attack.php   $oabbr=($ir['gender']=="Male") ? "his" : "her";   And add this under it..   if ($odata['protection'] > '0') { echo 'This Person Is Protected..'; exit($h->endpage()); }
  2. Re: [v2]Ctemple Heck dude... It's not hard to update a crystal temple.. :wink:
  3. Re: [v2]Ctemple High horse? Geeez. I'm not the best coder on CE because i'm not.. But i am better than the average game owner though. Heck.. I have a 79 line code which contains all what you have that I know... (Including my own function and a little configuration, but untested at the moment.)
  4. Re: [v2]Ctemple This will be nothing against you by the way... I'm fed up of people making easy mods...
  5. Re: [v2]Ctemple Seriously... You put error_reporting(E_ALL || E_STRICT); I wonder how many undefined index there are :-P
  6. Re: [v2]Ctemple I might make one of these but free.. :wink: and no offense or nothing and more likely at a higher standard.
  7. Re: [mccodes v2] Find random items while playing the game... Meh, A better idea... use a cron/timestamp make it change once a day... Have about 5 numbers, maybe use an array, explode it.. Harder as well ;)
  8. Re: [mccode v2] Secure Bank! Add this to you global_funcs.php You only use one.. I added three so people can choose for personal choices like some prefer printf(); over echo sprintf(); // With sprintf(); function Error($Message) { global $h; echo sprintf("<span style='color: #FF0000;'>Error! %s</span>", stripslashes($Message)); exit($h->endpage()); } // With printf(); function Error($Message) { global $h; printf("<span style='color: #FF0000;'>Error! %s</span>", stripslashes($Message)); exit($h->endpage()); } //Without sprintf(); or printf(); function Error($Message) { global $h; echo '<span style="color: #FF0000;">Error! '.stripslashes($Message).'</span>'; exit($h->endpage()); }
  9. Re: My jailescape   <?php include_once (DIRNAME(__FILE__) . '/globals.php'); if (!function_exists('Error')) { function Error($Message) { global $h; echo sprintf("<span style='color: #FF0000;'>Error! %s</span>", $Message); $h->endpage(); exit(); } } echo ' <span style="color: #FFFFFF;"><hr width="70%"><h3>Jail</h3></span> <hr width="70%"/> '; if ($ir['brave'] < '7') { Error('<span style="color: #FFFFFF">It costs seven brave to try to escape. Come back later. <hr width="70%">[url="#"]Back[/url] <hr width="70%"></span>'); } $_GET['ID']= abs((float) $_GET['ID']); $r=$db->fetch_row($db->query("SELECT * FROM users WHERE userid={$_GET['ID']}")); // You should optimize this query.... -.-" if (!$ir['userid']) { Error('<span style="color: #FFFFFF">Invalid user. <hr width="70%">[url="#"]Back[/url] <hr width="70%"></span>'); } if (!$ir['jail']) { Error('<span style="color: #FFFFFF">You are not in jail! <hr width="70%">[url="#"]Back[/url] <hr width="70%"></span>'); } if ($ir['brave'] < '7') { Error('<span style="color: #FFFFFF">Not enough brave! <hr width="70%">[url="#"]Back[/url] <hr width="70%"></span>'); } if (mt_rand('1', '100') <= abs((float) (mt_rand('1', '100') + ($ir['jail'] / $ir['crimexp'])) + '5')) { echo '<span style="color: #FFFFFF;">You successfully escaped from jail.</span>'; $db->query(sprintf("UPDATE users SET crimexp=crimexp+%d, brave=brave-7, jail=0 WHERE userid=%d", $gain = abs((float) $ir['jail'] / '10'), $userid)); } else { echo '<span style="color: #FFFFFF;">While trying to escape from jail, a guard spots you. Looks like you are going to be here even longer than we thought! </span>'; $db->query(sprintf("UPDATE users SET jail=jail+%d WHERE userid=%d", mt_rand('30', '100'), $userid); } echo ' <hr width="70%">[url="#"]Back[/url] <hr width="70%">'; $h->endpage(); ?>   Completely Untested..
  10. Re: [mccode v2] Weather Gym [$1.00] Because this is a good idea... I'll buy it for the heck of it. :-D   You have sent $1.00 USD to [email protected]. We have sent you a receipt for this transaction and an email has also been sent to your recipient.
  11. Re: [V2] New Small Accuracy Mod [V2] Your Accuracy $acc <font color='green'>Total Hits:</font> {$ir['totalhits']} <font color='red'>Total Misses:</font> {$ir['totalmisses']} </table> <hr><h3>Stats Info:</h3>"; There's your fix.... Now place it :-P
  12. Re: [mccode v2] Looking for someone to secure   At what work quality though?
  13. Re: Monkey Wrench Well from what I see you wrote a nice part of what you want to achieve basically and this could be better than MC Code V2 for the final product. For the version name I'd think it sounds good.. :lol: Just off the top of my head maybe you could call it Codestryke's Lite, but hey ho just an idea. I like the idea you would like people to adapt and make mods for it (Hopefully secure and bugless). I do think this recode could be better as well, I'd think CE should and hopefully will make a board for these codes and hopefully your codes will encourage new mod writers and hopefully new Website Developers who can learn from a high standard. I will personally use these code's to adapt and better my current coding standards, so from where I currently see your actually doing more than stopping say "Help! My game has been hax0rd! :cry: ". I would like to wish the best of luck to you and thank you for a very nice contribution.
  14. Re: [mccode v2] Secure Bank!   <?php include_once (DIRNAME(__FILE__) . '/globals.php'); echo '<h3 style="text-decoration: underline;">Bank</h3>'; $OpenPrice = '10000'; $PercentTakenDep = '15'; // Do Not Add A % Sign! $MaxTakenDep = '5000'; if ($ir['bankmoney'] > '-1') { $_GET['act'] = isset($_GET['act']) && ctype_alpha($_GET['act']) ? trim($_GET['act']) : FALSE; switch ($_GET['act']) { case 'Deposit': Deposit(); break; case 'Withdraw': Withdraw(); break; default: Index(); break; } } else { if (isset($_GET['Buy'])) { if ($ir['money'] >= $OpenPrice) { echo sprintf("Congratulations, you bought a bank account for %s gold! ", number_format($OpenPrice)); echo '[url="bank.php"]Start using my account[/url]'; $db->query(sprintf("UPDATE users SET money=money-%d, bankmoney=0 WHERE userid=%d", $OpenPrice, $ir['userid'])); } else { echo 'You do not have enough gold to open an account. [url="explore.php"]Back to town...[/url]'; } } else { echo sprintf("Open a bank account today, just %s gold! ", number_format($OpenPrice)); echo '[url="bank.php?Buy"]> Yes, sign me up![/url]'; } } function Index() { global $ir, $PercentTakenDep, $MaxTakenDep; echo sprintf("[b]You currently have %s Gold in the bank.[/b] ", number_format($ir['bankmoney'])); echo ' <table width="95%" cellspacing="1"> <tr> <td width="50%"> [b]Deposit gold[/b] '; echo sprintf("It Will Cost You %d%% Of The Gold You Deposit (Rounded Up). The Maximum Fee Is %s Gold.", $PercentTakenDep, number_format($MaxTakenDep)); echo '<form action="bank.php?act=Deposit" method="post">'; echo sprintf("Amount: <input type='text' name='deposit' value='%s' /> ", $ir['money']); echo '<input type="submit" value="Deposit" /> </form> </td> <td width="50%"> [b]Withdraw gold[/b] There Is No Fee On Withdrawing Gold! <form action="bank.php?act=Withdraw" method="post">'; echo sprintf("Amount: <input type='text' name='withdraw' value='%s' /> ", $ir['bankmoney']); echo '<input type="submit" value="Withdraw" /> </form> </td> </tr> </table>'; } function Deposit() { global $db, $ir, $PercentTakenDep, $MaxTakenDep; $_POST['deposit'] = abs((float) $_POST['deposit']); if ($_POST['deposit'] > $ir['money']) { Error('You Don\'t Have Enough Gold To Deposit This Amount.'); } else { $Fee = $_POST['deposit'] * $PercentTakenDep / '100'; $Fee = ($Fee >= $MaxTakenDep) ? $MaxTakenDep : $Fee; $Gain = @intval($_POST['deposit'] - $Fee); $ir['bankmoney'] += $Gain; $db->query(sprintf("UPDATE users SET bankmoney=bankmoney+%u, money=money-%u WHERE userid=%u", $Gain, $_POST['deposit'], $ir['userid'])); echo sprintf("You Hand Over %s Gold To Be Deposited, ", number_format($_POST['deposit'])); echo sprintf("After The Fee Is Taken (%s Gold), %s Gold Is Added To Your Account. ", number_format($Fee), number_format($Gain)); echo sprintf("[b]You Now Have %s Gold In The Bank.[/b] ", number_format($ir['bankmoney'])); echo '> [url="bank.php"]Back[/url]'; } } function Withdraw() { global $db, $ir; $_POST['withdraw'] = abs((float) $_POST['withdraw']); if ($_POST['withdraw'] > $ir['bankmoney']) { Error('You Don\'t Have Enough Banked Gold To Withdraw This Amount.'); } else { $Gain = $_POST['withdraw']; $ir['bankmoney'] -= $Gain; $db->query(sprintf("UPDATE users SET bankmoney=bankmoney-%u, money=money+%u WHERE userid=%u", $Gain, $Gain, $ir['userid'])); echo sprintf("You Ask To Withdraw %s Gold , ", number_format($Gain)); echo 'The Banking Lady Grudgingly Hands It Over. '; echo sprintf("[b]You Now Have %s Gold In The Bank.[/b] ", number_format($ir['bankmoney'])); echo '> [url="bank.php"]Back[/url]'; } } $h->endpage(); ?>
  15. Re: [mccode v2] Secure Bank! I'll take alook now.. :wink:
  16. Re: Promo Codes   if (isset($_POST['promo']) == 'Teh Promo Code')
  17. Re: Questions about languages. 1) 14 2) UK 3) English.. I know some French, German, Spanish, Arabic and tiny bits of Japanese :-P 4) Mainly self taught but French was at school. :wink: EDIT: Wouldn't say i'm fluent in the except English.
  18. Karlos

    Eregi - Ereg

    Re: Eregi - Ereg preg_* functions are generally better :-P
  19. Re: [v2] Fish & Chippy mod Well Ummm... You did not code this! Funny how this is a spaced out verison of my coding (When I was noobier :-P) Still this is not you mod! You hardly editted it! Original Coding: <?php /* Bar23 Mod Made By Karlos Made For Mccode V2 Date Made: 20 - Sep - 2008 Fixed Up By Kyle */ include("globals.php"); if(!$_GET['spend']) { echo " Welcome To The Famous Bar23 [i]Bar23 Was Established In 2008 For The Needy Population Of '.$set['game_name'].'[/i] [i]These Are Not Items, These Add On To Your Bars Sratight Away.[/i] [b]Lunches[/b] <table border='1'> <tr> <th>Lunch</th> <th>Cost</th> <th>Buy</th> </tr> <tr> <td>Curry</td> <td>$250</td> <td>[url='?spend=1']Buy[/url]</td> </tr> <tr> <td>Fish</td> <td>$400</td> <td>[url='?spend=2']Buy[/url]</td> </tr> <tr> <td>Pizza</td> <td>$700</td> <td>[url='?spend=3']Buy[/url]</td> </tr> <tr> <td>Roast Dinner</td> <td>$1000</td> <td>[url='?spend=4']Buy[/url]</td> </tr> <tr> <td>Salad</td> <td>$1500</td> <td>[url='?spend=5']Buy[/url]</td> </tr> <table> [b]Alcohol[/b] <table border='1'> <tr> <th>Lunch</th> <th>Cost</th> <th>Buy</th> </tr> <tr> <td>Carlsberg</td> <td>$250</td> <td>[url='?spend=6']Buy[/url]</td> </tr> <tr> <td>Jack Daniels</td> <td>$400</td> <td>[url='?spend=7']Buy[/url]</td> </tr> <tr> <td>Moonshine</td> <td>$700</td> <td>[url='?spend=8']Buy[/url]</td> </tr> <tr> <td>Southern Comfort</td> <td>$1000</td> <td>[url='?spend=9']Buy[/url]</td> </tr> <tr> <td>Vodka</td> <td>$1500</td> <td>[url='?spend=10']Buy[/url]</td> </tr> </table>"; } else if($_GET['spend'] == 1) { if($ir['money'] < 249) { echo "You don\'t have enough money to buy the Curry, you need $250!"; } else { $sql = sprintf("UPDATE users SET money=money-250, energy=energy+3 WHERE userid=%s", $userid); mysql_query($sql); echo "Congratulations, you bought a Curry for $250! [url='bar23.php']Back to Shop[/url] "; } } else if($_GET['spend'] == 2) { if($ir['money'] <399) { echo "You don\'t have enough money to buy the Fish, you need $400!"; } else { $sql = sprintf("UPDATE users SET money=money-400, energy=energy+5 WHERE userid=%s", $userid); mysql_query($sql); echo "Congratulations, you bought a Fish for $400! [url='bar23.php']Back to Shop[/url] "; } } else if($_GET['spend'] == 3) { if($ir['money'] <699) { echo "You don\'t have enough money to buy the Pizza, you need $700!"; } else { $sql = sprintf("UPDATE users SET money=money-700, energy=energy+10 WHERE userid=%s", $userid); mysql_query($sql); echo "Congratulations, you bought a Pizza for $700! [url='bar23.php']Back to Shop[/url] "; } } else if($_GET['spend'] == 4) { if($ir['money'] < 999) { echo "You don\'t have enough money to buy the Roast Dinner, you need $1000!"; } else { $sql = sprintf("UPDATE users SET money=money-1000, energy=energy+13 WHERE userid=%s", $userid); mysql_query($sql); echo "Congratulations, you bought a Roast Dinner for $1000! [url='bar23.php']Back to Shop[/url] "; } } else if($_GET['spend'] == 5) { if($ir['money'] < 1499) { echo "You don\'t have enough money to buy the Salad, you need $1500!"; } else { $sql = sprintf("UPDATE users SET money=money-250, energy=energy+18 WHERE userid=%s", $userid); mysql_query($sql); echo "Congratulations, you bought a Salad for $1500! [url='bar23.php']Back to Shop[/url] "; } } else if($_GET['spend'] == 6) { if($ir['money'] < 249) { echo "You don\'t have enough money to buy the Carlsberg, you need $250!"; } else { $sql = sprintf("UPDATE users SET money=money-250, brave=brave+3 WHERE userid=%s", $userid); mysql_query($sql); echo "Congratulations, you bought a Carlsberg for $250! [url='bar23.php']Back to Shop[/url] "; } } else if($_GET['spend'] == 7) { if($ir['money'] <399) { echo "You don\'t have enough money to buy the Jack Daniels, you need $400!"; } else { $sql = sprintf("UPDATE users SET money=money-400, brave=brave+5 WHERE userid=%s", $userid); mysql_query($sql); echo "Congratulations, you bought a Jack Daniels for $400! [url='bar23.php']Back to Shop[/url] "; } } else if($_GET['spend'] == 8) { if($ir['money'] <699) { echo "You don\'t have enough money to buy the Moonshine, you need $700!"; } else { $sql = sprintf("UPDATE users SET money=money-700, brave=brave+10 WHERE userid=%s", $userid); mysql_query($sql); echo "Congratulations, you bought a Moonshine for $700! [url='bar23.php']Back to Shop[/url] "; } } else if($_GET['spend'] == 9) { if($ir['money'] < 999) { echo "You don\'t have enough money to buy the Southern Comfort, you need $1000!"; } else { $sql = sprintf("UPDATE users SET money=money-1000, brave=brave+13 WHERE userid=%s", $userid); mysql_query($sql); echo "Congratulations, you bought a Southern Comfort for $1000! [url='bar23.php']Back to Shop[/url] "; } } else if($_GET['spend'] == 10) { if($ir['money'] < 1499) { echo "You don\'t have enough money to buy the Vodka, you need $1500!"; } else { $sql = sprintf("UPDATE users SET money=money-250, brave=brave+18 WHERE userid=%s", $userid); mysql_query($sql); echo "Congratulations, you bought a Vodka for $1500! [url='bar23.php']Back to Shop[/url] "; } } $h->endpage(); ?>
  20. Re: Need help with this Fix your cron then... :lol:
  21. Re: Fast & Furious Haven't watched it yet, though I do plan to. The previous 3 films are pretty nice, oh well, at least Han stays alive this time :lol:
  22. Re: [mccode v1 + v2] Lucky Boxes Because of the colours?   SQL have a different Syntax highlighting to PHP... :roll:
  23. Re: Help with security please No, No and NO! Just filter what the put in.. :wink:
  24. Re: New Banner The solider and tank still let it down in my opinion..
  25. Re: Need help with this Maybe you could use in_array(); aswell.
×
×
  • Create New...