How to make sure no scripts except those under my own domain, can include the db connection file?

Posted by Jack on Stack Overflow See other posts from Stack Overflow or by Jack
Published on 2010-04-19T20:35:13Z Indexed on 2010/04/19 20:43 UTC
Read the original article Hit count: 190

Filed under:
|

I would like to ensure that any scripts that are trying to "include" my database connection file are located under my own domain. I don't want a hacker to include the database connection file to their malicious script and gain access to my database that way. My connection file's name is pretty easy to guess, it's called "connect.php". So without renaming it and taking the security through obscurity route, how can I protect it by making sure all connection requests are made by scripts residing under my own domain name? How can this be checked using PHP?

© Stack Overflow or respective owner

Related posts about php

Related posts about include