Jump to content
MakeWebGames

peterisgb

Members
  • Posts

    759
  • Joined

  • Last visited

  • Days Won

    46

Everything posted by peterisgb

  1. Hi i'm trying to make a lottery cron for my lotto system i am making, i aint very good at cron files so i was wondering if i could get help with it. Below is what i have done so far: <?php include "config.php"; global $_CONFIG; define("MONO_ON", 1); require "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; $db->query("TRUNCATE TABLE lottolast;"); $num1=rand(1, 15); $num2=rand(1, 15); $num3=rand(1, 15); $num4=rand(1, 15); $num5=rand(1, 15); $uc = $db->query("SELECT * FROM lotto"); $cl = $db->fetch_row($uc); $pc = $db->query("SELECT lotto1 FROM users WHERE userid={$cl['userid']}"); $pl = $db->fetch_row($pc); if($cl['lottery1'] == $num1) { $cor1="1000000"; } else { $cor1="0"; } if($cl['lottery2'] == $num2) { $cor2="1000000"; } else { $cor2="0"; } if($cl['lottery3'] == $num3) { $cor3="1000000"; } else { $cor3="0"; } if($cl['lottery4'] == $num4) { $cor4="1000000"; } else { $cor4="0"; } if($cl['lottery5'] == $num5) { $cor5="1000000"; } else { $cor5="0"; } if($pl['lotto1'] == 1) { $prize=$cor1+$cor2+$cor3+$cor4+$cor5; } else { $prize=0; } $db->query("UPDATE users SET bankmoney=bankmoney+$prize WHERE userid={$cl['userid']}"); $db->query("UPDATE users SET lotto1=0"); $db->query("INSERT INTO lottolast SET lotto1=$num1, lotto2=$num2, lotto3=$num3, lotto4=$num4, lotto5=$num5"); print " Prize: $prize <br /> Number 1: $num1 <br /> Number 2: $num2 <br /> Number 3: $num3 <br /> Number 4: $num4 <br /> Number 5: $num5 <br /> Users {$cl['userid']} <br /> "; ?>   I have also attached lotto.php. this does work. <?php include "globals.php"; switch($_GET['action']) { case 'play2': do_play(); break; case 'play': conf_play(); break; default: prefs_home(); break; } function prefs_home() { global $db,$ir,$c,$userid,$h; $uc = $db->query("SELECT * FROM lotto WHERE userid=$userid"); $cl = $db->fetch_row($uc); $dc = $db->query("SELECT * FROM lottolast"); $ll = $db->fetch_row($dc); $num1=rand(1, 15); $num2=rand(1, 15); $num3=rand(1, 15); $num4=rand(1, 15); $num5=rand(1, 15); print "<h3>Lottery HQ</h3> You can enter each set once. <table width='75%'> <tr> <td><b>Set</b></td> <td><b>Prize</b><small> (per correct number)</small></td> <td><b>Ticket Cost</b></td> <td><b>Action</b></td> </tr> <tr> <td>1</td> <td>$1,000,000</td> <td>$5,000</td> <td>"; if($ir['lotto1'] == 1) { print "NONE"; } else { print "<a href='lotto?action=play'>Play Set 1</a>"; } print " </td> </tr>"; if($ir['lotto1'] == 1) { print " <tr> <td align='center' colspan='4'>Your Numbers are. {$cl['lottery1']}, {$cl['lottery2']}, {$cl['lottery3']}, {$cl['lottery4']}, {$cl['lottery5']}"; } print " </td></tr> </table> <br /><br /> Last Weeks lotto Numbers <br /> {$ll['lotto1']} , {$ll['lotto2']} , {$ll['lotto3']} , {$ll['lotto4']} , {$ll['lotto5']}."; } function conf_play() { global $ir,$c,$userid,$h; if($ir['lotto1'] == 1) { die ("You have already entered this lotto set.<a href='lotto'>Lotto Home</a>"); } if($ir['money'] <= 4999) { die ("You Either do not have cash in hand or you dont have enough to buy a ticket.<a href='lotto'>Lotto Home</a>"); } print " <div class='form_description'> <h2>Pick one number from each line</h2> </div> <form action='lotto?action=play2' method='post'> <table width='100%'> <tr><td align='center'> <hr /> </td></tr> <tr><td align='center'> <INPUT type='radio' name='lottery1' value='1'>1. <INPUT type='radio' name='lottery1' value='2'>2. <INPUT type='radio' name='lottery1' value='3'>3. <INPUT type='radio' name='lottery1' value='4'>4. <INPUT type='radio' name='lottery1' value='5'>5. <INPUT type='radio' name='lottery1' value='6'>6. <INPUT type='radio' name='lottery1' value='7'>7. <INPUT type='radio' name='lottery1' value='8'>8. <INPUT type='radio' name='lottery1' value='9'>9. <INPUT type='radio' name='lottery1' value='10'>10. <INPUT type='radio' name='lottery1' value='11'>11. <INPUT type='radio' name='lottery1' value='12'>12. <INPUT type='radio' name='lottery1' value='13'>13. <INPUT type='radio' name='lottery1' value='14'>14. <INPUT type='radio' name='lottery1' value='15'>15. </td></tr> <tr><td> <hr /> </td></tr> <tr><td align='center'> <INPUT type='radio' name='lottery2' value='1'>1. <INPUT type='radio' name='lottery2' value='2'>2. <INPUT type='radio' name='lottery2' value='3'>3. <INPUT type='radio' name='lottery2' value='4'>4. <INPUT type='radio' name='lottery2' value='5'>5. <INPUT type='radio' name='lottery2' value='6'>6. <INPUT type='radio' name='lottery2' value='7'>7. <INPUT type='radio' name='lottery2' value='8'>8. <INPUT type='radio' name='lottery2' value='9'>9. <INPUT type='radio' name='lottery2' value='10'>10. <INPUT type='radio' name='lottery2' value='11'>11. <INPUT type='radio' name='lottery2' value='12'>12. <INPUT type='radio' name='lottery2' value='13'>13. <INPUT type='radio' name='lottery2' value='14'>14. <INPUT type='radio' name='lottery2' value='15'>15. </td></tr> <tr><td> <hr /> </td></tr> <tr><td align='center'> <INPUT type='radio' name='lottery3' value='1'>1. <INPUT type='radio' name='lottery3' value='2'>2. <INPUT type='radio' name='lottery3' value='3'>3. <INPUT type='radio' name='lottery3' value='4'>4. <INPUT type='radio' name='lottery3' value='5'>5. <INPUT type='radio' name='lottery3' value='6'>6. <INPUT type='radio' name='lottery3' value='7'>7. <INPUT type='radio' name='lottery3' value='8'>8. <INPUT type='radio' name='lottery3' value='9'>9. <INPUT type='radio' name='lottery3' value='10'>10. <INPUT type='radio' name='lottery3' value='11'>11. <INPUT type='radio' name='lottery3' value='12'>12. <INPUT type='radio' name='lottery3' value='13'>13. <INPUT type='radio' name='lottery3' value='14'>14. <INPUT type='radio' name='lottery3' value='15'>15. </td></tr> <tr><td> <hr /> </td></tr> <tr><td align='center'> <INPUT type='radio' name='lottery4' value='1'>1. <INPUT type='radio' name='lottery4' value='2'>2. <INPUT type='radio' name='lottery4' value='3'>3. <INPUT type='radio' name='lottery4' value='4'>4. <INPUT type='radio' name='lottery4' value='5'>5. <INPUT type='radio' name='lottery4' value='6'>6. <INPUT type='radio' name='lottery4' value='7'>7. <INPUT type='radio' name='lottery4' value='8'>8. <INPUT type='radio' name='lottery4' value='9'>9. <INPUT type='radio' name='lottery4' value='10'>10. <INPUT type='radio' name='lottery4' value='11'>11. <INPUT type='radio' name='lottery4' value='12'>12. <INPUT type='radio' name='lottery4' value='13'>13. <INPUT type='radio' name='lottery4' value='14'>14. <INPUT type='radio' name='lottery4' value='15'>15. </td></tr> <tr><td> <hr /> </td></tr> <tr><td align='center'> <INPUT type='radio' name='lottery5' value='1'>1. <INPUT type='radio' name='lottery5' value='2'>2. <INPUT type='radio' name='lottery5' value='3'>3. <INPUT type='radio' name='lottery5' value='4'>4. <INPUT type='radio' name='lottery5' value='5'>5. <INPUT type='radio' name='lottery5' value='6'>6. <INPUT type='radio' name='lottery5' value='7'>7. <INPUT type='radio' name='lottery5' value='8'>8. <INPUT type='radio' name='lottery5' value='9'>9. <INPUT type='radio' name='lottery5' value='10'>10. <INPUT type='radio' name='lottery5' value='11'>11. <INPUT type='radio' name='lottery5' value='12'>12. <INPUT type='radio' name='lottery5' value='13'>13. <INPUT type='radio' name='lottery5' value='14'>14. <INPUT type='radio' name='lottery5' value='15'>15. </td></tr> <tr><td> <hr /> </td></tr> </table> <input type='submit' value='Play these numbers' class='loginbox' /></form> <a href='lotto'>Lotto Home</a> "; } function do_play() { global $db,$ir,$c,$userid,$h; $db->query("UPDATE lotto SET lottery1='{$_POST['lottery1']}', lottery2='{$_POST['lottery2']}', lottery3='{$_POST['lottery3']}', lottery4='{$_POST['lottery4']}', lottery5='{$_POST['lottery5']}'"); $db->query("UPDATE users SET lotto1='1', money=money-5000 WHERE userid=$userid"); print "Your Numbers Are <h3> {$_POST['lottery1']}, {$_POST['lottery2']}, {$_POST['lottery3']}, {$_POST['lottery4']}, {$_POST['lottery5']}.</h3> Good Luck. <a href='lotto'>Back</a>"; } $h->endpage(); ?>
  2. can anyone help with a working mockup so i can work on from there please
  3. not a bad idea, i believe that Chaotic-wars has already this.
  4. ok most of this you guys said has confuzzled me lol. I use this in the header.php if($ir['display_pic']) { $display = "<img src='{$ir['display_pic']}' width='17' height='17' />"; } else { $display = "<img src='images/nopic.png' width='17' height='17' />"; } if($ir['user_level'] == 1) { $rankcolour = "#ffffff"; } if($ir['user_level'] == 2) { $rankcolour = "#06519b"; } if($ir['user_level'] >= 3) { $rankcolour = "#49b536"; } if($ir['donatordays']) { $d = "<img src='donator.gif' alt='Donator: {$ir['donatordays']} Days Left' />"; $rankcolour = "red"; } $user = $ir['username']; $usernamei = "<font color='$rankcolour'>$display $user $d</font>";   and $usernamei in the header file of course which this works well.
  5. well thats the thing, i want it to show other users, userlist/usersonline. so in my case $r is needed. or it would be peterisgb 1 1,000,000 peterisgb 1 1,000,000....... which isnt what i'm looking for. it needs to show each user by itself. using the $ir already works. i want it to be used for all usernames.
  6. Hi, i'm trying to make names in my game universal. Eg have a code like this   if($r['display_pic']) { $display = "<img src='{$r['display_pic']}' width='17' height='17' />"; } else { $display = "<img src='images/nopic.png' width='15' height='15' />"; } if($r['user_level'] == 1) { $rankcolour = "#ffffff"; } if($r['user_level'] == 2) { $rankcolour = "#06519b"; } if($r['user_level'] >= 3) { $rankcolour = "#49b536"; } if($ir['donatordays']) { $d = "<img src='donator.gif' alt='Donator: {$r['donatordays']} Days Left' />"; $rankcolour = "red"; } $user = $r['username']; $usernamei = "<font color='$rankcolour'>$display $user $d</font>";   in the global_func file. Then put anywhere on the site $usernamei like useronline/userlist, This don't work, but how or what do i need to do to get this to work. Thanks in Advance Pete
  7. ok can this be moved to the right board/
  8. Got a Demo anywhere?
  9. I think this sounds good and worth a gander if you release it, probs use it as i don't like the basic one.
  10. could you post a screeny
  11. oh right, on my old site i iframed it.
  12. i must be a complete idiot of something, but what does it exactly do....
  13. screenshot?
  14. just wondering and bringing this up after so long but its now 10th May 2014. (Nearly 2 years later.) Is there any chance of some news now......
  15. I'm stuck here, looking at main menu ideas... i look at it and not sure what i want to do to it, can someone throw a few ideas or screenys of theres to see if it can spark an idea. Thanks.
  16. You should be able to edit it in the header file.
  17. well so far the ? is still there like so viewuser?u=1 instead of viewuser.php?u=1. i dont mind the ?u=1. i just though it would of been easier to use .htaccess to change the link looks instead of going through each page (which will takes for ages)
  18. so isnt there a code that i can just stick in .htaccess
  19. well i am completely new to .htaccess files and i hardly know anything about it.
  20. Hello, i'm playing around with the .htaccess file. I've got this   RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L]   Which does this to links: http://www.example.com/usersonline.php to http://www.example.com/usersonline Is there a way in the .htaccess file to make all pages display like the above link without editing every link on the site?
  21. oh it takes 5 minutes to double one seed, it costs 5 minutes per seed, so if you do 12 seeds it'll take an hour to complete. so it does take time. I do have intentions on making this bigger and better, just though i would chuck it on here to see if any other people had some good ideas to make it better.
  22. hmm, well as i said it was a quick throw together.
  23. Ok this is quick Grow Weed mod. I didn't spend alot of time on this but i might have intentions to update this as it goes along. run these sql's ALTER TABLE `users` ADD `weed` int(11) NOT NULL DEFAULT '0', ADD `weedtime` int(11) NOT NULL DEFAULT '0', ADD `treatedweed` int(11) NOT NULL DEFAULT '0'; grow.php <?php include "globals.php"; if($ir['weedtime'] > 0) { echo "<h2>You have <font color='red'>{$ir['weedtime']}</font> Minutes until your weed is done.<br /><br /><a href='grow.php'>Reload</a>"; $h->endpage(); exit; } echo "<h2>Grow House</h2><br />"; switch($_GET['action']) { default: grow_index(); break; case "grow": grow_weed(); break; case "grow1": grow_weed1(); break; case "sell": grow_sell(); break; case "sell1": grow_sell1(); break; case "sellt": grow_sellt(); break; case "sellt1": grow_sellt1(); break; case "treat": grow_treat(); break; case "treat1": grow_treat1(); break; } function grow_index() { global $db,$ir,$c,$userid; echo " Welcome to your Grow Room.<br /><br /> <table class='table1' width='75%'><tr> <td align='center'>You have <b><font color='red'>{$ir['weed']}</font></b> weed</td></tr><tr> <td align='center'>You have <b><font color='red'>{$ir['treatedweed']}</font></b> treated weed</td> </tr><tr></tr><tr> <td><a href='grow.php?action=grow'>Grow</a></td> <td><a href='grow.php?action=sell'>Sell</a></td> </tr> <tr> <td><a href='grow.php?action=treat'>Treat Weed</a></td> <td><a href='grow.php?action=sellt'>Sell Treated Weed</a></td> </tr> </table> "; } function grow_weed() { global $db,$ir,$userid; echo "It will cost you $10,000 per seed grown.<br /> It will take you 5 Minutes for every 1 seed grown.<br /> How many seeds do you want to grow? <form action='grow.php?action=grow1' method='post'>Qty: <input type='text' name='qty' value='{$ir['weed']}' class='loginbox' /><input type='submit' value='Grow' class='loginbox' /></form> <br /><a href='grow.php'>Go Back</a>"; } function grow_weed1() { global $db,$ir,$userid; $_POST['qty']= abs((int) $_POST['qty']); $cost=($_POST['qty']*10000); $time=($_POST['qty']*5); $quty=($_POST['qty']); if($ir['money'] < $cost) { echo "Your trying to grow more weed than you can afford.<br /><br /><a href='grow.php'>Go Back</a>"; exit; if($_POST['qty'] <= 0) { echo "Your trying to grow no weed!<br /><a href='grow.php'>Go back</a>"; } exit; } else { $db->query("UPDATE users SET money=money-$cost, weed=weed+$quty, weedtime=weedtime+$time WHERE userid=$userid"); echo "You started to grow {$_POST['qty']} ounces costing you $cost.<br /> Your weed will be ready in $time Minutes. <br /><br /><a href='grow.php'>Go back</a>"; } } function grow_sell() { global $db,$ir,$userid; echo "You currently have <b><font color='red'>{$ir['weed']}</font></b> ounce of Weed.<br /> One ounce will get you $7,500 <form action='grow.php?action=sell1' method='post'>Qty: <input type='text' name='qty' value='{$ir['weed']}' class='loginbox' /><input type='submit' value='Sell' class='loginbox' /></form> <br /><a href='grow.php'>Go Back</a>"; } function grow_sell1() { global $db,$ir,$userid; $_POST['qty']= abs((int) $_POST['qty']); if($_POST['qty'] <= 0) { echo "You dont have that much weed<br /><a href='grow.php'>Go back</a>"; } else { $price=($_POST['qty']*7500); $db->query("UPDATE users SET money=money+$price, weed=weed-{$_POST['qty']} WHERE userid=$userid"); echo "You sold {$_POST['qty']} ounces of weed for $price.<br /><br /><a href='grow.php'>Go back</a>"; } } function grow_treat() { global $db,$ir,$userid; echo "You currently have <b><font color='red'>{$ir['weed']}</font></b> ounce of Weed.<br /> It will cost you $1,000 to treat your weed.<br /> It will take 1 minute for each ounce of weed to complete.<br /> Treating your weed will allow you to see you weed at double its price.<br /> <form action='grow.php?action=treat1' method='post'>Qty: <input type='text' name='qty' value='{$ir['weed']}' class='loginbox' /><input type='submit' value='Treat' class='loginbox' /></form> <br /><a href='grow.php'>Go Back</a>"; } function grow_treat1() { global $db,$ir,$userid; $_POST['qty']= abs((int) $_POST['qty']); if($_POST['qty'] <= 0) { echo "You dont have that much weed to treat<br /><a href='grow.php'>Go back</a>"; } else { $price=($_POST['qty']*1000); $time=($_POST['qty']*1); $db->query("UPDATE users SET money=money-$price, weed=weed-{$_POST['qty']}, treatedweed=treatedweed+{$_POST['qty']}, weedtime=weedtime+$time WHERE userid=$userid"); echo "You treated {$_POST['qty']} ounces of weed for $price.<br /><br /><a href='grow.php'>Go back</a>"; } } function grow_sellt() { global $db,$ir,$userid; echo "You currently have <b><font color='red'>{$ir['treatedweed']}</font></b> ounce of treated Weed.<br /> One ounce will get you $20,000 <form action='grow.php?action=sellt1' method='post'>Qty: <input type='text' name='qty' value='{$ir['weed']}' class='loginbox' /><input type='submit' value='Sell' class='loginbox' /></form> <br /><a href='grow.php'>Go Back</a>"; } function grow_sellt1() { global $db,$ir,$userid; $_POST['qty']= abs((int) $_POST['qty']); if($_POST['qty'] <= 0) { echo "You dont have that much weed<br /><a href='grow.php'>Go back</a>"; } else { $price=($_POST['qty']*20000); $db->query("UPDATE users SET money=money+$price, treatedweed=treatedweed-{$_POST['qty']} WHERE userid=$userid"); echo "You sold {$_POST['qty']} ounces of weed for $price.<br /><br /><a href='grow.php'>Go back</a>"; } } $h->endpage(); ?> and then in explore add <a href='grow.php'>Grow Weed</a> The Cron: $db->query("UPDATE `users` SET weedtime=weedtime-1 WHERE `weedtime` > 0"); And your done, if you have any ideas on where i could expand etc please post here.
  24. I like this, would a CSS code added in overide the default chatbox style.
  25. oh right, well i aint that good yet, i did it this way as i noticed i dont always get the log in staff log. plus this way i can keep an eye on the staff without them really knowing. i shall improve on this once i learnt abit more./
×
×
  • Create New...