Jump to content

Recommended Posts

Sorry I have include file that has an array that holds the following information.

 

<?php $CONNECTION = array( host=>"localhost",database=>"blah",username=>"ast",password=>"q");?>

 

What i am unsure about is how do I protect this file. I might not have to but at this point I am unsure so

I am looking for some protection.

 

thanks for your direction so far

 

some frameworks like joomla, use the following to disallow direct access to certain files.

in  the index.php they define a variable and in all other files on top they place a check if a variable is defined and else throw an error . Looks a bit like this:

in index.php

<?php
define('blablabla', 1);
include('anyfolder/anyfile.php');// include the stuff you want like a config file
?>

in any other file that may not be directly accessible

<?php
defined('blablabla') or die('no direct access'); //or maybe a redirect or other error

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.