rocker_angad Posted October 25, 2008 Share Posted October 25, 2008 well i am very very new to mysql and php so after reading lots of tutorial the problem i am facing is to add or get data from mysql you have to put your username and password in the script in the php file for eg the code we use to connect is mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error()); mysql_select_db("address") or die(mysql_error()); now the problem is anyone can view this page and see my username and password and hit me hard i am new dont flame me. IF this problem has already been solved please give me the link Of the forum as i dont want everyone to see my username and password Some one who is a professional or know how to do it please tell me, waiting for reply THANK YOU angad Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted October 25, 2008 Share Posted October 25, 2008 I have a file placed behind teh root of the site I require_once in any page requireing the connection. that way you only have to manage one file... but in your case if you run your page and its showing the username and password details then it sounds like php is not running properly - none of your source code should be available to view in the browser when you run a page. If it is doing then the installation has not been successful. Quote Link to comment Share on other sites More sharing options...
rocker_angad Posted October 25, 2008 Author Share Posted October 25, 2008 thanx for the info but i want to ask that by this way i do my connection it is ok if someone tries to use ftp or download the file from my directory then ?? he can use that file ?? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 25, 2008 Share Posted October 25, 2008 Your FTP access should be setup with a username/password. Don't setup an anonymous FTP account for a folder that would contain any important files. When you browse to a .php file, the code in it is parsed and executed and you only receive content that is output by that file. Unless you echo the host, username, and password, no one can get those details by visiting your site. The http/https protocols don't allow downloading of files unless you explicitly cause a file to be downloaded. Quote Link to comment Share on other sites More sharing options...
rocker_angad Posted October 25, 2008 Author Share Posted October 25, 2008 thanx a lot sir you solved a very important problem of mine thanx dude Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.