Reply
Possible to read mysql_connect() from source code?
Old 01-20-2009, 02:22 PM Possible to read mysql_connect() from source code?
Average Talker

Posts: 19
Trades: 0
I have a mysql_connect in my code with my username, password, database, and host.

Is there any possible way that a viewer can hack into my source code and get this information?
rogerchin85 is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 01-20-2009, 02:28 PM Re: Possible to read mysql_connect() from source code?
tripy's Avatar
Do not try this at home!

Posts: 3,176
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
If he can see your source code, then yes, he can see everything.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is online now
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-20-2009, 02:29 PM Re: Possible to read mysql_connect() from source code?
Average Talker

Posts: 19
Trades: 0
how can i hide or protect it?
rogerchin85 is offline
Reply With Quote
View Public Profile
 
Old 01-20-2009, 03:16 PM Re: Possible to read mysql_connect() from source code?
tripy's Avatar
Do not try this at home!

Posts: 3,176
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
By securing the server, protecting your code against sql injections and XSS exploits.
But I think that mostly, you have your code on a shared hosting, so the server thing is out of your reach.

For the 2 others, search, read and document yourself.
here is nothing but "best practices" to help you learn how to program with these security problems in mind and avoid it.
First thing, for example, never use any variable from the get, post or cookies without checking them.
Those values are always unsecure and dangerous, by definition.
On the DB side, learn about stored procedure and prepared statements to lock yourself against the most evident sql injection attacks.

Try some of those http://www.security-hacks.com/2007/0...ction-scanners to see if your site is already subject to sql injection.

Another nasty thing is the cross site scripting.
In short, making your site execute something by making it run a php page that comes from the outside of your site.
I've heard of acunetix a lot recently, as they released an web site security scanner: http://www.acunetix.com/
Don't know what it's worth, but there is a free version, why not check it?

So, no simple and straight answer for your question.
It takes times and efforts. And they are both continuous (the techniques of the hackers are evolving) and out of your reach for a major point: If the web server becomes physically compromised, then there is nothing you can do.
And only the hoster can take care of that point.
And trust me, for having worked in a small ISP, this point is not often in the top 5 priorities...
At least, not in a proactive way. Generally more in a reactive way.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is online now
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-21-2009, 07:02 AM Re: Possible to read mysql_connect() from source code?
chrishirst's Avatar
Super Moderator

Posts: 22,241
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by rogerchin85 View Post
I have a mysql_connect in my code with my username, password, database, and host.

Is there any possible way that a viewer can hack into my source code and get this information?
If you are asking about the HTML source code, the answer is NO!
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Possible to read mysql_connect() from source code?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.13005 seconds with 13 queries