what is the
defined('ABSPATH') or die();
for a non-wordpress SQL.
I've done some research and googling, but can't seem to find an answer. I've developed WordPress plugins in the past, and know this line of code is important for security.
Now I'm making a website outside of WordPress, and have some files I don't want users to directly access, because those files open the connection to the SQL database, without closing it(closing is done on the page that calls it). but if I put defined('ABSPATH') or die(); on the page, it keeps the user from accessing the home page that has
include 'dbconnect.php';
what would I need to have "defined()" to keep users from accessing the file directly, but still be able to include it in another file? thanks.
also, I'm using "mysqli" for the SQL, and editing the files in Cpanel.
This seems to work, just needed to learn a bit more about how wordpress ABSPATH works, and was able to word my search better :D
in the page calling the file, I have:
define('SITE_PATH', true);
and in the file I have:
if(!defined('SITE_PATH')){
echo '<script>window.location.replace("/404");</script>';
die('404 Page Not Found');
}