make a database file invisible php

Discussion in 'Software' started by mastermosley, Oct 7, 2008.

  1. mastermosley

    mastermosley Sergeant

    Ok I can't remember I haven't done this stuff in ages but I'm wondering how I can make my database.php file invisible so people can't access it and download my database information. Is it in the .htaccess or in the file itself?
     
  2. PC-XT

    PC-XT Master Sergeant

    I think you can use .htaccess to do this, but I usually just add the following line to the beginning of the code:
    PHP:
    <?php exit;?>
    You could also use die with a message.
    This is only for non-code php, that is a php file that doesn't have actual php code to run, but only data. If you have code, you can check the script name variable to make sure another script is calling it, and terminating otherwise, or enclose the data in a variable declaration so that it isn't actually sent out.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds