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!
hello, I had a few question, I did this thing to were it includes the header and footer for the template to work, so I didnt want people to just be able to do to the files so I did something like this:
but then I realized, what if somebody included it on one of there pages like http://example2.com/link.php like included my header.php page, then it would display stuff, so is there anyway to get the full file path like http://mysite.com/header.php
elecktricity wrote:hello, I had a few question, I did this thing to were it includes the header and footer for the template to work, so I didnt want people to just be able to do to the files so I did something like this:
but then I realized, what if somebody included it on one of there pages like http://example2.com/link.php like included my header.php page, then it would display stuff, so is there anyway to get the full file path like http://mysite.com/header.php
Actually, if someone remotely included your header.php file with that code in they would be including your full site since the redirect would be actioned if the HTTP protocol is being used. It would only display the header contents alone if they included the file locally or using another transfer protocol.
If you want the server name then it's $_SERVER['SERVER_NAME'] but even then, it will show as your own server regardless of where the output is going when HTTP is used.
well that gave an error message if it wasnt first so it kinda worked, but I found another way of doing what I wanted, when I included the file, I assigned a $_GET variable like this: