Jump to content

Gumball Machine


gintjack

Recommended Posts

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";

 

?>

Link to comment
Share on other sites

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");

}

 

?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.