[HELP] MySQL Connect

Status
Not open for further replies.

Jo$h

Posting Freak
Jul 7, 2010
1,030
79
I am a beginner with PHP and I need help with connecting to the MySQL database without making my database credentials vulnerable for anyone to use. Is there any way That I can keep them hidden aside from the other content on the page?

Thanks In Advance, Josh
 

Kryptos

prjRev.com
Jul 21, 2010
2,205
1,252
As PHP is server-side normal users can't see the credentials, so you don't have to worry about getting your credentials taken away.
 

Cablink

http://www.vroleplay.net - join now!
Feb 4, 2011
382
27
I am a beginner with PHP and I need help with connecting to the MySQL database without making my database credentials vulnerable for anyone to use. Is there any way That I can keep them hidden aside from the other content on the page?

Thanks In Advance, Josh
Well, there is a way, if you are using xampp there probably isnt I mean i dont know bout xampp.
But in webhosting you can for sure. >_> Hoped this helped. xd
 

Jo$h

Posting Freak
Jul 7, 2010
1,030
79
As PHP is server-side normal users can't see the credentials, so you don't have to worry about getting your credentials taken away.
Kryptos, I mean the user being able to view them by looking at the source code with their browser.

Well, there is a way, if you are using xampp there probably isnt I mean i dont know bout xampp.
But in webhosting you can for sure. >_> Hoped this helped. xd
Yes I am using webhosting. I just need to know how >.<
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
If your MySQL details are in the php tags:

PHP:
<?php
?>

The user viewing the site won't be able to view the details of it.
Everything between them php tags will not be shown in the source code of the website on the browser unless you echo something out, which I highly doubt you would do if you're dealing with your MySQL details ;)

This would do perfectly:

PHP:
<?php
$connect = @mysql_connect( 'localhost', 'dbuser', 'dbpass' ) or die( 'Can not connect to db:<br><br>' . mysql_error() );
@mysql_select_db( 'dbname', $connect ) or die( 'Can not open DB<br><br>' . mysql_error() );
?>
 
Status
Not open for further replies.

Users who are viewing this thread

Top