May 8, 2012

PHP user-agent allowing to post on my site

Question by AlanPHP

I have a voting site that my users can use to promote my game. When they click the voting link, it passes a variable called ‘reference’ to the voting site. If it is a valid vote (in the past 24 hours) it will then send a request back to my site with two variables.

$reference = $_POST['referense'];
$success = $_POST['success']; // 0 or 1

I’ve read that the user-agent must be changed to allow them to post things to my site? How do I let them do this? It is a valid voting site, so there is no need to be scared.

Thanks.

Answer by Starx

What you read is completely wrong.

User agents have nothing to do with. how a PHP code performs. And even if it does, IT SHOULDN’T


You said that a reference is passed to the site, which is then sent to the voting system. So, your system should only check if the reference coming is a valid one or NOT. Not how the request is coming.

NOTE that, User Agents can be spoofed so easily. So, creating a system relying on such is very risky.

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!