Jump to content

Another really hard and stupid question.


HazelRah

Recommended Posts

Hi again!. No, dont be scared :o

 

I need to know if it's possible to do this:

 

I am going to have an image, (01.png) when you click on this image, it is random, 1 in 2 that you'll find some fake online money. When you find this money (random amounts!!!), this money will go on a counter on a different page. (not the type of counter that you refresh and +1 adds on But a counter that will add your money.) And i want this counter viewable by EVERYONE. And everyone to be allowed to add on to the counter.

 

Lol

 

Thanks in advance,

Link to comment
Share on other sites

Here is an example of how you could have them click on the image and they have a 1 out of 2 chance of getting the money. Is that enough to get you started?

 

<?php

if (isset($_GET['click'])){
   $rand = rand(1,2);
   
   if ($rand == 1){
      echo "You Win!";
      //process their money here
   } else {
      echo "Awww, you lose";
   }
}

?>

<p>
<a href="index.php?click=yes"><img src="01.png"></a>

 

Link to comment
Share on other sites

<?php

if (isset($_GET['click'])){
   $rand = rand(1,2);
   
   if ($rand == 1){
      $amount_won = rand(1,100);
      echo $amount_won."GP MONEY FOUND";
      //process their money here
   } else {
      echo "Awww, you lose";
   }
}

?>

<p>
<a href="index.php?click=yes"><img src="01.png"></a>

Link to comment
Share on other sites

you will also perhaps need to the the $_SESSION[''] value if you want the site to remember how much money they and then add this on.

 

They want to add the money the person won into a pot of money won by all users. So I think a database would be the best way to go.

 

Now how do i make the money found get added to a counter :o lol

 

Database. Make a table like this

 

TABLE counter

--------------

winnerID - the userID of the winner of the money

amount - the amount of money they won

 

Now, whenever you want to get the total amount of money won, you would just do a query like this

SELECT SUM(amount) as amount FROM counter

Link to comment
Share on other sites

Check the flat file database forum, should be something in there.  But basically you are reading and writing .txt files.

 

I have looked. There's nothing there and no-one's replying to my post.

 

Go through all the "file" tutorials on this site

http://www.tizag.com/phpT/files.php

 

I have looked through there, I already said i dont understand it.

Link to comment
Share on other sites

I think that you need to not try to do a massive and perfect project to start with. You need to go through those and other tutorials, having a little tinker with bits to see what the affect was, developing them, then by the time you done that you can put them all together to have a big whole. As, if I remember correctly, someone said to you yesterday, you won't understand or learn if someone else does it for you. Sorry to sound grumpy but there are a lot of people who come here and get others to do ALL their work for them, so this is a contentious issue, and I avoid the blatant non triers! It's sometimes hard, it get's easier, and it's very rewarding when it does...

 

P.S. I've just looked through this post and it seems that you've not even posted any code whatsoever...

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.