I run an internet radio station and one of the features I have been working on is adding text requests to my station website.. SO far i was able to make one with a hacked up "Contact Form" script combined with "SMS Gateways" and it works great so far....only issue I have is I want to block an IP address from making multiple request in a like say a 2 hour period. Basically I want to allow a listener to only make 1 song request every 2 hours via the text request form... the way the script i have works now is it takes a simple form and when a listener hits the submit button it send me a text message via the sms gateway..the form was initially set up as a "Contact Us" form to send the station an email directly from our website..so with a little modding I just swapped the recieving email address in the form with my sms gateway email address...and the result is sent to my cell phone.. I been googling for 2 days to find something to help with this and all i find is code to permanently block an IP address that I added to a .txt file..This is not what i want to do.. ANY HELP WITH THIS WOULD BE GREATLY APPRECIATED...THANKS
Blocking by ip is a good idea. But you can also do it by the phone number or the user account. That will be easy to do also.
I dont want to block them permanently just for a set amount of time.. and the form is for the TEXT request is web based so the listener requesting a song doesn't need to send us a txt from there phone...we have listeners in 150+ countries so the request form being web based can allow any listener in any country to send the txt request..thus we wont recieve any TEXTS from a cell phone...so blocking numbers is not an option also currently I dont have a membership based website..just a really quick and easy way for people to tune in on my site so blocking by username is not an option neither... you can see a demo of my current script here... (i can't post links yet so bear with me) tm101radio dot com/indexwithvideos dot html just click the link that says "TEXT US A SONG REQUEST" and after you submit our station phone will recieve the txt.. Im still for like 4 days now been searching for a way to just temporarily block an IP address for making multiple request within a set period of time..
Hello I don't have the code but I can suggest you one thing. I have seen in some forums there is a blocking system in IP for a time limit like 5 min between two posts. You can download any php based free forum and try search for the procedure. I know it is tough but you can try it as your last option.
thanks I will look into that..but i was wondering also if maybe a session cookie can accomplish this as well.???
Yes it can but with IP it is little difficult. Generally people block IP by .htaccess but in some case it is different. try to google it. Best of luck.
It is not so simply. If I were you, I will do it with firewall (iptables). It is relative complicated script which "monitoring" the network, execute iptables commands, open/closing ports, so the client will be able to surf the site, but streaming port is closed for his IP.
I dont want to block the streaming port..Im not trying to block them from listening to the music....I want to block them from submitting a form multiple times!!!!
you have to save their ip into db (mysql) with time_end column and then you have to check it when submitting form <?php $blocked_ip = mysql_query("SELECT count(ip) as blocked FROM blocked WHERE ip = '".$_SERVER['REMOTE_ADDR'].";"); if (mysql_fetch_assoc($blocked_ip)) { if ($blocked_ip['blocked']) {die(you_already_submitted_it);} else{///pass} }
Can you walk me thru setting that up???? Do I just add that to my current script? and How do I set up the database to work with that? Thank you for your reply it looks very promising..
add time stamp on your form when submited by the ip. and the compare the time stamp with 2 hrs and same ip. or form will not show up