Jump to content

Recommended Posts

I am using shared SSL space on a web server.. therefore due to it being shared i cannot keep my database connection file outside in a directory at a level higher than the root directory... therefore someone theoretically could type in www.abc.com/dbconnection.php

 

I was just wondering how unsecure is this ?.. and given the above limitations..is there anything I can do to security wise to make it more secure?

 

thanks in advance..

 

 

Link to comment
https://forums.phpfreaks.com/topic/153998-solved-db-connection-file-security/
Share on other sites

its simply database connection info:

 

e.g

 

<?php
    
error_reporting(0);


	$dbhost = "xxx";
	$dbusername = "xxx";
	$dbpassword = "xxx";
	$db = "xxx";


$conn = mysql_connect($dbhost, $dbusername, $dbpassword) or die("could not connect to server");
$select_db = mysql_select_db($db,$conn);
?>

 

I was just wondering how safe this is from hackers.. maybe they have a way to view the php code etc.. and it is recommended that db info is kept outside of root (so there must be some reason, I'm guessing)..

 

thanks for your help

 

theoretically could type in www.abc.com/dbconnection.php
No theory is necessary, why don't you just try that and see what exactly you do get in your browser. You only get output that your code sends. As long as your usrname/password is in the form of php code in the file, it cannot be seen.
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.