Old 09-02-2005   #1 (permalink)
hmmmmmmm......
 
Join Date: Sep 2005
Posts: 22

MySQL question

In a php script when you connect to a database through db, you write in your hosting provider, username, databse URL, and password to your server control panel; whats stopping someone from looking at the code, finding your database, then looking through your users passwords? Can you protect a database by adding a password to your directory? Any help is appreciated, Thanks.
jumbosheep is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 09-02-2005   #2 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
if you are talking about mysql connectivity on a linux or unix platform, then your database is not publically accessible through the HTTP protocol (someone can't just type in a link and download your database).

you provide your host name, username, password and database name, nowhere do you provide a URL unless using a remote database.

your mysql database details stored in a php script are completely safe from being read from anyone other than you, the server administrators and anyone else who has access to that file through the backend. people can't simply go view source in their browser and see your database password if you store it in a php variable, as php is a server side language and is processed before anything is sent to your browser.

you can set higher security levels and settings on your webserver and/or mysql server, but with most set ups, it is perfectly safe anyway and doesn't need to be safer. your passwords should be stored in hashed form in your database anyway, so even if someone did get in, they would only see a bunch of nonsense instead of a password.

if you are really paranoid about your database security or feel as if your content requires a higher level of security than what mysql databases generally offer, you may want to try using an Oracle database instead.
__________________
BioRUST Tutorials - the birthplace
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 09-02-2005   #3 (permalink)
Recursively call who?
 
GoldNetX's Avatar
 
Join Date: Nov 2003
Location: Pittsburgh, PA
Posts: 294

Send a message via AIM to GoldNetX
Something I suggest is trying this. Create a file called mysql_connect.php. Have this file store the information and also the mysql_connect() function. Then put this file in a directory or two above wherever you haved your website. Such as:

If you website index is at:
folder1\folder2\www\index.php

Put the mysql_connect.php file in folder2, so that no one could link to it and download it. Then whenever you need to connect do something like this:

Code:
<?php include(../mysql_connect.php); ?>
I'm a bit rusty with my coding so that may not be exactly how to include it. But I find this method to work quite well.

You could also protect your connecting php file with a .htaccess, but I'm not very good at explainging that. There are plenty of tutorials on it though.
__________________

www.gusmayo.com
- Maybe a story or two -


www.jaloobie.com
... your new home ...

www.webinkproductions.com
- professional web application design -
GoldNetX is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 09-02-2005   #4 (permalink)
hmmmmmmm......
 
Join Date: Sep 2005
Posts: 22

Re

Thanks for your help
jumbosheep is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 09-04-2005   #5 (permalink)
Local Biorust Beast
 
Order's Avatar
 
Join Date: Oct 2003
Location: San Diego, CA, USA
Posts: 2,253

Send a message via AIM to Order Send a message via MSN to Order Send a message via Yahoo to Order
PHP code is not shown to the public, it is kept complete safe from their beady eyes.
__________________
Order is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Content Mangament System Question LimitLess HTML / PHP / ASP / JS 3 06-01-2006 12:32 AM
Newbie Question c_rogue69 Adobe Photoshop 3 09-18-2004 08:47 AM
flash and mysql ahmedtheking Flash & Dynamic Media 12 08-11-2004 06:15 PM
PHP Syntax question BlodoPKNZ HTML / PHP / ASP / JS 9 08-08-2004 09:58 PM


All times are GMT +1. The time now is 09:44 AM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2008 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT