help need for a secred link for a wargame
Moderators: egami, macek, gesf
- swirlee
- Moderator
- Posts: 2257
- Joined: Sat Jul 05, 2003 1:18 pm
- Location: A bunk in the back
- Contact:
weskuhh112 wrote:i have a wargame and i need a secred link the clicks you know
No, I don't know. I have no idea what "a secred link the clicks" is. Please try to spend more than one sentence describing your situation. And more punctuation. What do you mean by "secret"? What "link" are you talking about? Whose "clicks" are you referring to?
- Alexej Kubarev
- Site Admin
- Posts: 2213
- Joined: Fri Mar 05, 2004 7:15 am
- Location: Täby, Stockholms län
- Contact:
Well..thats not really hard..
All you need to so is create a unique ID for your members... ten you should create a page that will process that id and check how many clicks are made per day.. that should be a peace of cake... and simply add a bit of logic.. If less then 500 click/if more than 500 clicks... number of clicks should be stored in the database and the last clcik date too... so when a person submits a query your script should check the last day... if the last click date is the same as today -- it should check number of clicks... if its not the same as todays date -- set the number to 0..
In any case the number of clicks should rise every time the link is clicked... you are also able to add a bit more logic and stop the counter if the number of clicks is 500..
For more information on how to use date function could be found here
http://se2.php.net/manual/en/function.date.php
Good luck?
All you need to so is create a unique ID for your members... ten you should create a page that will process that id and check how many clicks are made per day.. that should be a peace of cake... and simply add a bit of logic.. If less then 500 click/if more than 500 clicks... number of clicks should be stored in the database and the last clcik date too... so when a person submits a query your script should check the last day... if the last click date is the same as today -- it should check number of clicks... if its not the same as todays date -- set the number to 0..
In any case the number of clicks should rise every time the link is clicked... you are also able to add a bit more logic and stop the counter if the number of clicks is 500..
For more information on how to use date function could be found here
http://se2.php.net/manual/en/function.date.php
Good luck?
I know exactly what you're trying to do ( i run http://www.thunderarena.com ) secret links are really easy...what i do is this...
every link clicked gets put into a table (ip / userid clicked / etc.) this is mostly used so that when someone clicks someone elses link, it checks to see if their ip address has already clicked the userid's link...(and this table gets truncated at midnight in cron jobs)
also in the main database where all user information is kept are a couple columns to have, (clicks_today and total_clicks)...they both get +1 when someone clicks on the secret link(clicks_today gets reset to 0 at midnight), clicks_today is checked everytime someone clicks another player's link, so it's like...
if you need anymore help just send me a pm
every link clicked gets put into a table (ip / userid clicked / etc.) this is mostly used so that when someone clicks someone elses link, it checks to see if their ip address has already clicked the userid's link...(and this table gets truncated at midnight in cron jobs)
also in the main database where all user information is kept are a couple columns to have, (clicks_today and total_clicks)...they both get +1 when someone clicks on the secret link(clicks_today gets reset to 0 at midnight), clicks_today is checked everytime someone clicks another player's link, so it's like...
Code: Select all
$rowquery = mysql_query("SELECT * FROM `user_database` WHERE `userid`='$id'");
$row = mysql_fetch_array($rowquery);
if ($row[clicks_today] >= 500)
{
echo "This player has maxed their clicks for today";
}
else
{
echo "You have just clicked ".$row[username]."'s secret link";
mysql_query("UPDATE `user_database` SET `clicks_today`=clicks_today + 1, `total_clicks`=total_clicks + 1 WHERE `userid`='$id'") or die(mysql_error());
}
if you need anymore help just send me a pm