NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page [PHP] Help with Script

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 12-20-2005, 01:20 PM THREAD STARTER               #1 (permalink)
NamePros Member
Join Date: Dec 2005
Posts: 186
chronic will become famous soon enoughchronic will become famous soon enough
 



[PHP] Help with Script


Can anyone help me with this? I need to make a script which gives a user +1 click everytime someone clicks a personalized link. Also, I want the script to disallow the same IP to click it more than once within a 15 minute period.
????: NamePros.com http://www.namepros.com/programming/149816-php-help-with-script.html

I already have a login system made but I need to add the thing where it gives the link to you when you sign up. The only problem I am going to have it how to "give" the user +1 clicks and do the 15 minute period thing.

For the disallowing clicking within 15 minute period someone came up with the idea to get the time the link was clicked and then do olddate - currentdate = $x; then do $x >= 15 and then echo that they clicked the link and whatever else. Can someone maybe make a little script like that because I don't know how to retreive a time only date.

Also, for the +1 click, I was thinking of using Javascript but since I don't know that, I might have to use PHP. I was also thinking of how to do it; I came up with updating a mysql table everytime it was clicked but I am not sure about that. Any ideas on what I can do?

Sorry that I don't have anything to offer as my PayPal is empty and anything else I can give is too much.. So if any of you could be nice and help, that would be appreciated.
__________________
DNFind.net - For sale, PM me.
chronic is offline  
Old 12-20-2005, 10:19 PM   #2 (permalink)
Awesome™
 
MasterB's Avatar
Join Date: May 2005
Location: Boston
Posts: 77
MasterB is on a distinguished road
 



As for time, what I would do is the following:

time() will get the time in seconds starting from the the Unix Epoch (January 1 1970 00:00:00 GMT). So, you could do something like the following:
Code:
$oldtime = $whatever_the_old_time_was;
$newtime = time();
if($newtime - $oldtime < 900) {
    // 900 Seconds = 15 Minutes
    dont_allow_the_click();
}
Reguarding the storing of the 15 mins thing. There's several ways of doing this. You could use cookies, sessions, or MySQL. Your best choice would be MySQL but if you don't have that resource available, I'd use cookies.
????: NamePros.com http://www.namepros.com/showthread.php?t=149816
For MySQL, you could store the IP and time clicked in a table, and query the table every time, like below:
Code:
$ip = $_SERVER['remote_addr'];
$query = "SELECT * FROM `ip_table` WHERE ip=`" . $ip . "` LIMIT 0,1";
// connect to mysql here
$query_result = mysql_query($query);
$query_array = mysql_fetch_assoc($query_result);
$oldtime = $query_array['time'];
$newtime = time();
if($newtime - $oldtime < 900) {
    // 900 Seconds = 15 Minutes
    dont_allow_the_click();
} else {
    allow_the_click();
}
Catch my drift? If you need any help, throw some NP$ my way and I'll generously help you along with the script.

Oops! Read your post and saw that you don't have anything... well I'll be nice, if you need help just PM me . Just leave me some rep if you do.
MasterB is offline  
Old 12-20-2005, 10:57 PM THREAD STARTER               #3 (permalink)
NamePros Member
Join Date: Dec 2005
Posts: 186
chronic will become famous soon enoughchronic will become famous soon enough
 



Okay, thanks for all your help. I got some help on SitePoint already but you still helped me with a few things.
__________________
DNFind.net - For sale, PM me.
chronic is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Great Scripts for Sale With Resale Rights! Zeeble Scripts For Sale 20 01-04-2006 02:39 AM
Huge Xmas script pack sale $5.00 KPR Scripts For Sale 1 12-08-2005 07:25 PM
Huge Script Pack for $5 with Resale Rights dsforsaken Scripts For Sale 32 12-03-2005 09:46 PM
60.000 Templates, scripts, fonts, banners etc. $9.95 atkims Web Development Wanted 19 11-16-2004 10:48 AM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 03:59 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger