473,412 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

How to protect password for mysql_connect in php script?

I am adding some database driven functionality to my web site and will need a php script like to sample below to connect to the database. I have found some solutions for protecting the password by storing it in a file outside the web directory. But my web-hosting is a shared linux account @ Go Daddy and I don't appear to have access outside the root. Any suggestions for how I can secure the password?

Thanks
Gary

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';.
mysql_close($link);
?>
Nov 25 '07 #1
3 2596
you can't go to the directory below public_html ?
Nov 25 '07 #2
Markus
6,050 Expert 4TB
I don't think you should worry about it really..

Just save it in a directory 'library'

I dont see how someone would get access to it..
Nov 25 '07 #3
ak1dnar
1,584 Expert 1GB
The end users (web browser) will get the generated HTML out put only. They can't see the source codes. No matter about, inside or out side public root. anyhow the hosting company can read them all. If it is a problem for you, there are so many Third party tools to encode your php scripts. but sure the execution of the php engine will slow down on this process. but still the hosting company guys can access the database. no way to prevent it. but if you want to prevent, the only way is, use your own Server to host the Application.
Nov 25 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Phil W | last post by:
Hi, I'm a bit of a newbie to PHP and mySQL. I'm trying to get things running on my W2K machine. I'm having a problem using the mysql_connect() function (although the problem's probably rooted in...
2
by: Flier_75 | last post by:
Hi, I just password-protected an intranet site by including a password authentication script in each page of a private section. The script checks the login against the mySQL database....
11
by: siliconmike | last post by:
Is there a way to protect data files from access by root ? I have a data-centered website and would like to protect data piracy from any foot-loose hosting company employee. Any ideas? ...
3
by: Narlen | last post by:
Hi there, I don't know much about web design but I proudly managed to password protect a page on my site. Later I realized that everyone looking at the source in any web browser can see the...
4
by: David LACASSAGNE | last post by:
Is it possible to set a password to protect the code of an Access VBA project by automation (I already know how to to it manually)? David.
22
by: teejayem | last post by:
Hi, I am new to programming with databases and was wanting some help. Is there any way to password protect an access database and access sent sql commands to it via vb.net code? Any help...
8
by: Sheik Ishmael | last post by:
Hi, I'm trying to get password recognition calling data froma table called users('user_name' and 'user_password' using the below (bottom of page) code. However, I get the following warning...
2
by: sharmilah | last post by:
I have the following code in my script and it's giving a syntax error at line *** when using the password function. My password in the mysql database is encrypted using the password function itself...
5
by: Shmuel | last post by:
Hello, Is it possible to give to mysql_connect an encrypted (md5 or sha1) password? If not is there a workaround? I store passwords for users in database and don't want to use plain text...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.