PHP script executed only from a certain machine

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
AccesInterzis
Forum Newbie
Posts: 4
Joined: Wed Nov 25, 2009 4:00 am

PHP script executed only from a certain machine

Post by AccesInterzis »

I have a PHP script on my index.php file and I want this script to be executed ONLY when I access index.php file from my computer (which is at home). I want this PHP script NOT to be executed when someone else access index.php file from another machine.
My problem is that I don`t know how to do this. I was thinking to use the IP addresse of my computer but, unfortunately, it is dinamyc. So, every time when I get on the Internet I have a completely different IP addresse. It would work only if the IP addresse would be static.
In this moment I have no idea and I wonder if someone can give a tip.
Virvo
Forum Newbie
Posts: 3
Joined: Wed Nov 25, 2009 4:20 am

Re: PHP script executed only from a certain machine

Post by Virvo »

You could require a parameter to be added to the url... index.php?is_me=1 and then only do what you want if ($_GET['is_me'] == 1)
Post Reply