Only run code from my computer

I have a nice php page which I guess anyone can run. I want to make it so that only I can run it
heres my page,


<?php

if(isset($_POST['submit'])) { 
    
include $_SERVER['DOCUMENT_ROOT'].'/db/config.php'; 

...
...

}
?>

So im thinking I need to make sure the page im coming from is mine and in order to ensure its coming from my computer (Is there a way to also check the IP address?

Thanks…

Try testing for $_SERVER[‘REQUEST_URI’]

This is really a poormans check, but I had used this for years …

On your C:\ drive put an empty file named local.flag

Then,


if (file_exists('/local.flag'))
   echo 'this will only run locally';

Or just put this script in a location not accessible to the outside world.

.htaccess for your ip only?