Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

Only valid after 20 seconds

SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
SpaceshipSpaceship
Watch

SiKing

Registered MemberEstablished Member
Impact
6
Ok, this may be confusing but here goes.

I have a traffic exchange website. When the user surfs the websites, they earn credits and this is done with a frames page (surf.php). They can only continue to the next URL when the countdown reaches 0 (from 20) and then the link is displayed (surf.php - so it basically refreshes the page and shows another random URL). However, there is nothing stopping the user from refreshing the page. How can I make it so they HAVE to wait the 20 seconds before they can continue.

What would be good: a validation method so they have to click either the right number or letter before moving onto the next site or they will not be given any credits.

Thanks
 
Last edited:
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Probably an image validation is the best way to go.
 
0
Close
I thought about that but the user would have to type something out to earn half a credit and I don't think they'll really be bothered.

However, I had another idea: I could have a hidden input field with a value of a random number between 1 and 4. Then they have to click the same number. eg
(Click number 3, 1 - 2 - 3 - 4). But my Javascript won't let me add query strings to the URL
 
0
Close
I see that you'v'e asked about a countdown timer http://www.namepros.com/programming/171144-countdown-timer.html

I'm guessing that you want to use this countdown timer in your application so I'm taking this into consideration.

Why don't you insert an ID into the javascript. If they're going to get ad credit, and the amount of credit along with their user ID is stored in a database, you could query it like this:
Code:
<div id="dl">
If you're seeing this message, you need to enable JavaScript.
</div>
<script language="Javascript">
xtimer=20;
function countdown() 
{
 if ((0 <= 100) || (0 > 0))
 {
  xtimer--;
  if(xtimer == 0)
  {
   document.getElementById("dl").innerHTML = '<a onclick="%78%74%69%6D%65%72%3D%32%30%3B%63%6F%75%6E%74%64%6F%77%6E%28%29%3B" href="http://www.domain-name.com/track.php?%63%6F%64%65%3D%31%32%33%34%35">Your Link</a>'; // track.php?code=12345
  }
  if(xtimer > 0)
  {
   document.getElementById("dl").innerHTML = 'Please wait <b>'+xtimer+'</b> seconds...';
   setTimeout('countdown()',1000);
  }
 }
}
countdown();
</script>
track.php would be your file that can write to the database only and say if that certain person did complete the task or not. If they did, then they get the credit, and if not, sorry.

-Steve
 
0
Close
Thanks Steve. I'm not too advanced in PHP nor JavaScript. Please can you explain what "%78%74%69%6D%65%72%3D%32%30%3B%63%6F%75%6E%74%64%6" in the URLs mean? thanks
 
0
Close
Run it through urldecode(); ;)
 
0
Close
ah, Thanks for all the help. I'm not sure what to put in track.php as I do not want people running scripts to click the link.
 
0
Close
What to do:
1- store current time() in database next to user's id
2- give user timer javascript with link
3- when user clicks link, check to see if the current time is 20+ seconds after the time stored
-- if too early, go back to step 1 and yell at the user
4- say 'click successfully tracked.' and give them the next link
 
0
Close
Thanks Eric and Jim for replying. Got distracted by a bad phone bill. :(

-Steve
 
0
Close
Why not just don't display the link until 20 seconds has passed. When they enter the page store the time in a session variable. When the page is refreshed check that variable against the current time and only display the link if 20 seconds has passed.
 
0
Close
Then they think that the page is stilll loading.
 
0
Close
Excellent So they realise their refresh trick didn't work and wait for it to finish loading at which point it refreshes and the link is displayed.
 
0
Close
Thanks very much for the help guys :)

Now getting "No input file specified" in my frames page. However, when looking at the page source, it clearly says the URL :td:

Nevermind, it's all screwed up and I cannot be bothered with this anymore!!
 
Last edited:
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back