Kid Cudi
Kid Cudi

Reputation: 7

Block current users ip using javascript

I have a website where your able to advertise things on my website. The problem is that people are able to do it more than once. Is there a way that people are allowed to visit the website and when they join back they will be redirected to another page saying you have already advertised. People are still able to use vpn's but i have a way to stop that.

How can i use javascript or php to record the users ip first when the visit the website, But if they leave the website or reload the page they will be redirected to another page saying you have already advertised. Is this to much work?

Upvotes: 0

Views: 109

Answers (2)

scripter
scripter

Reputation: 130

You cannot stop people doing that 100% for sure. if you block their IPs they use proxy. if you use session they change their browsers or reset it to default. if you block their hardware like in facebook block hard disk serial again they use vpn servers. if ..
there is no way bro. Ask for paying instead of making it for free.

Upvotes: 0

gfish3000
gfish3000

Reputation: 1567

Technically yes, you could use JS and PHP to grab a user's IP address and work with it in a database but proxies and dynamic IPs would make it a very easy check to circumvent. You can also use PHP to create a persistent cookie to identify the user and his/her actions and see if you're getting a returning visitor who posted an ad, but cookies can easily be deleted.

So it's not that what you're trying to do is too much work, it's that it's fairly easily circumvented and not very reliable. Your best bet is an authentication system that requires a valid login to post an ad, logging what the advertisers do, and creating logic which will disallow spammy behavior based on your logs.

You won't be able to stop abuses by very, very determined users but you can make it harder and make them think twice about whether it's worth investing all that time and effort into spamming on your site when there are bound to be much softer targets, giving you the time to deal with the most egregious cases personally instead of trying to stop a torrent of spammy ads.

Upvotes: 2

Related Questions