Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,157,941 members, 7,835,137 topics. Date: Tuesday, 21 May 2024 at 05:44 AM

Web Security: How To Access Important Files Outside The Public_html Directory - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Web Security: How To Access Important Files Outside The Public_html Directory (496 Views)

How Save And Access Important Websites For Later Reading Offline / Please I Need Help, I Mistakenly Deleted Important Files From Cpanel / How To Send Document Files Like PDF On Whatsapp (2) (3) (4)

(1) (Reply)

Web Security: How To Access Important Files Outside The Public_html Directory by emmanbol: 4:00pm On May 08, 2016
For the sake of security, it is advised to put some important files outside of the public_html directory on your web host directory. In this tutorial, I will be showing how to put files outside of the public_html directory and accessing those files from the public_html.

When a website is accessed from every web browser, they serve request from the public_html directory which makes the public_html directory susceptible to attack from intruders. Files that contains database configs like username and password can be kept outside the public_html directory.

Going straight into the tutorial, I will be using php to create a function that can return files outside of the public_html directory. For example, this is how public_html looks like; home/locations/public_html, so what i will be doing is to put an important file here; home/locations/secret_file.php instead of putting it in home/locations/public_html/secret_file.php.

This below is the php script:

[php]

function call_in($filename){

$save_Url = $_SERVER['DOCUMENT_ROOT'];//outputs eg home/locations/public_html
$tell_pos = strrpos($save_Url, '/');//tells the position of where '/' appeared last on a string.
return substr($save_Url, 0,$tell_pos) . '/'. $filename;//returns eg home/locations/secret_file.php
}

[/php]

This php function can be used anywhere in your public_html directory. You simply call the function and provide the filename you uploaded outside the public_html directory. You can upload your various files into your web hosting space via filezilla.

Source: http://naijatech.com.ng/2016/05/how-to-keep-and-access-important-files-outside-the-public_html-directory/

(1) (Reply)

Convert Your Web Visitors Into Money. Learn How To Make Money With Your Blog. / Need Sitemap.. Can You Help / Cloner Needed.

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 9
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.