Allen Gingrich
Allen Gingrich

Reputation: 5657

Verifying POST data sent from same server WITHOUT using a token using PHP?

For reasons beyond the scope of this post, I would like to verify in PHP if post data was sent from the same server, but I would like to avoid using a token. If completely necessary, I can use one, but I would be very helpful if I didn't have to.

Is this possible? If not, why?

Thanks!

Upvotes: 2

Views: 519

Answers (1)

shamittomar
shamittomar

Reputation: 46692

Yes, you can check the remote address for the IP address of the request sender using $_SERVER['REMOTE_ADDR']. Do it like this:

if( $_SERVER['REMOTE_ADDR'] == $your_Server_IP_Address)
     echo 'From same server';
else
     echo 'from different server';

Upvotes: 2

Related Questions