gintjack Posted September 12, 2010 Share Posted September 12, 2010 Could Someone Help Me Make A Gumball Machine My Site Is Toxicpets.co.cc And the page is gumballs.php but i need it to give gumballs Quote Link to comment https://forums.phpfreaks.com/topic/213221-gumball-machine/ Share on other sites More sharing options...
PaulRyan Posted September 12, 2010 Share Posted September 12, 2010 This might help: Link:http://www.phpfreaks.com/forums/index.php/topic,309695.0.html Quote Link to comment https://forums.phpfreaks.com/topic/213221-gumball-machine/#findComment-1110264 Share on other sites More sharing options...
gintjack Posted September 12, 2010 Author Share Posted September 12, 2010 Ive seen this but it wont work for me Quote Link to comment https://forums.phpfreaks.com/topic/213221-gumball-machine/#findComment-1110265 Share on other sites More sharing options...
PaulRyan Posted September 12, 2010 Share Posted September 12, 2010 Ohh right I see. Well if you tell us your exact problem, and hit us with a bit of source code we will be much more inclined to help GintJack Thanks, Paul. Quote Link to comment https://forums.phpfreaks.com/topic/213221-gumball-machine/#findComment-1110267 Share on other sites More sharing options...
gintjack Posted September 12, 2010 Author Share Posted September 12, 2010 Well heres the page <?php /* Daily Item (daily_item.php) */ $rank_check = 1; $page_title = "Daily Item"; include "header.inc.php"; print "$openHTML"; $findFingerPrizes = fetch("SELECT * FROM items2 WHERE game = '$game'"); if ((!$findFingerPrizes[item_name]) OR (!$findFingerPrizes[item_name]) or (!$findFingerPrizes[item_name])) { if ($rank == 7) { $ifAdmin = "Admins: Click <a href=admin/admin_setup_finger.php?game=$game>here</a> to setup this game!<br>"; } die("<p>" . $ifAdmin . "This game is not ready to be played yet.</p>"); } // Start Check $checking2 = "gumball"; $limit1 = $datestamp; $findCheck = fetch("SELECT * FROM checking2 WHERE userid = '$userid' AND check_what = '$checking2' AND timestamp = '$limit1' AND game = '$game'"); if ($findCheck[id]) { $page_title = "Gumball - Already Played"; $findPage = fetch("SELECT * FROM game_pages WHERE page_title = '$page_title' AND game = '$game'"); if ($findPage[page_info] == "") { print "<p>You approach The Gumball Game It Said 'Come back tomorrow!'</p><p align=center><img src=http://vectortuts.s3.amazonaws.com/tuts/58_Gumball_Machine/step35.jpg></p>"; } else { include "showpage.inc.php"; print "$findPage[page_info]"; } } if (!$findCheck[id]) { $page_title = "Gumball - About to Play"; $findPage = fetch("SELECT * FROM game_pages WHERE page_title = '$page_title' AND game = '$game'"); if ($findPage[page_info] == "") { print "<p>Hi Welcome To The Gumball Game!</p><p align=center><a href=$base_url/gumballs.pro.php?game=$game><img src=http://vectortuts.s3.amazonaws.com/tuts/58_Gumball_Machine/step35.jpg></a></p>"; } else { include "showpage.inc.php"; print "$findPage[page_info]"; } } // End Check print "$closeHTML"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/213221-gumball-machine/#findComment-1110268 Share on other sites More sharing options...
gintjack Posted September 12, 2010 Author Share Posted September 12, 2010 And Heres the submit code <?php /* Pull my finger (finger.pro.php) */ ob_start(); $interactive = 1; $page_title = "Gumball"; $rank_check = 1; include "header.inc.php"; $findFingerPrizes = fetch("SELECT * FROM items2 WHERE game = '$game'"); if ((!$findFingerPrizes[item_name]) OR (!$findFingerPrizes[item_name]) or (!$findFingerPrizes[item_name])) { if ($rank == 7) { $ifAdmin = "Admins: Click <a href=admin/admin_setup_finger.php?game=$game>here</a> to setup this game!<br>"; } die("$openHTML<p>" . $ifAdmin . "This game is not ready to be played yet.</p>$closeHTML"); } // Start Check $checking2 = "gumball"; $limit1 = $datestamp; $findCheck = fetch("SELECT * FROM checking2 WHERE userid = '$userid' AND check_what = '$checking2' AND timestamp = '$limit1' AND game = '$game'"); if ($findCheck[id]) { die(header(error("gumballs.php?game=$game","Don't cheat."))); } mysql_query("DELETE FROM checking2 WHERE userid = '$userid' AND check_what = '$checking2' AND game = '$game'"); mysql_query("INSERT INTO checking2 (userid,check_what,timestamp,game) VALUES ('$userid','$checking2','$datestamp','$game')"); // End Check $num_prizes = rand(1,3); $prize_1 = explode(", ", $findFingerPrizes[item_name]); $prize_2 = explode(", ", $findFingerPrizes[item_name]); $prize_3 = explode(", ", $findFingerPrizes[item_name]); $count_1 = count($prize_1) - 1; $count_2 = count($prize_2) - 1; $count_3 = count($prize_3) - 1; $rand_1 = rand(0,$count_1); $rand_2 = rand(0,$count_2); $rand_3 = rand(0,$count_3); if ($num_prizes == 1) { $first = $prize_1[$rand_1]; $cookie_1 = fetch("SELECT * FROM items2 WHERE item_name = '$first' AND game = '$game'"); mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','$cookie_1[id]','$cookie_1[parts]','$game')"); mysql_query("INSERT INTO pullmyfinger2 (user,date,game) VALUES ('$userid','$datestamp','$game')"); $message .= "<img src=$base_url/images/user_images/opg_$game/items/item_$cookie_1[id].gif>"; $message2 .= "$cookie_1[item_name]"; die("$openHTML<p align=center>You won a $message2!</p><p align=center>$message</p><p align=center><a href=games.php?game=$game>Back to the Game Room</a></p>$closeHTML"); } if ($num_prizes == 2) { $first = $prize_1[$rand_1]; $cookie_1 = fetch("SELECT * FROM items2 WHERE item_name = '$first' AND game = '$game'"); mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','$cookie_1[id]','$cookie_1[parts]','$game')"); $second = $prize_2[$rand_2]; mysql_query("UPDATE members2 SET points=$points+$second WHERE username = '$username' AND game = '$game'"); mysql_query("INSERT INTO pullmyfinger2 (user,date,game) VALUES ('$userid','$datestamp','$game')"); $message .= "<img src=$base_url/images/user_images/opg_$game/items/item_$cookie_1[id].gif>"; $message2 .= "$cookie_1[item_name]"; die("$openHTML<p align=center>You won a $message2 and $second $pointVar!</p><p align=center>$message</p><p align=center><a href=games.php?game=$game>Back to the Game Room</a></p>$closeHTML"); } if ($num_prizes == 3) { $first = $prize_1[$rand_1]; $cookie_1 = fetch("SELECT * FROM items2 WHERE item_name = '$first' AND game = '$game'"); mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','$cookie_1[id]','$cookie_1[parts]','$game')"); $second = round($prize_2[$rand_2]); mysql_query("UPDATE members2 SET points=$points+$second WHERE username = '$username' AND game = '$game'"); $third = $prize_3[$rand_3]; $cookie_3 = fetch("SELECT * FROM items2 WHERE item_name = '$third' AND game = '$game'"); mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','$cookie_3[id]','$cookie_3[parts]','$game')"); mysql_query("DELETE FROM pullmyfinger2 WHERE date != '$datestamp'"); mysql_query("INSERT INTO pullmyfinger2 (user,date,game) VALUES ('$userid','$datestamp','$game')"); $message .= "<img src=$base_url/images/user_images/opg_$game/items/item_$cookie_1[id].gif><img src=$base_url/images/user_images/opg_$game/items/item_$cookie_3[id].gif>"; $message2 .= "$cookie_1[item_name], and a $cookie_3[item_name]"; die("$openHTML<p align=center>You won a $message2! You also got $second $pointVar!</p><p align=center>$message</p><p align=center><a href=games.php?game=$game>Back to the Game Room</a></p>$closeHTML"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/213221-gumball-machine/#findComment-1110269 Share on other sites More sharing options...
PFMaBiSmAd Posted September 12, 2010 Share Posted September 12, 2010 What exact problem, error, or specific question did you have about doing this? Just posting code without a statement of what problem, error, or other symptom it exhibits is pointless because without complete access to your development system or server we cannot execute your code and necessarily get the same result that you did. We must rely solely on the information that you supply in your posts. This forum is for help with problems, errors, or questions with php code that you have written, keeping in mind that in the few hundred words that will be in a typical reply that no one can possibly convey enough information to help you write a complete application. Quote Link to comment https://forums.phpfreaks.com/topic/213221-gumball-machine/#findComment-1110270 Share on other sites More sharing options...
gintjack Posted September 12, 2010 Author Share Posted September 12, 2010 Well its give the wrong item it is ment to give a gumball but it give food Quote Link to comment https://forums.phpfreaks.com/topic/213221-gumball-machine/#findComment-1110272 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.