TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Stumbled upon something here.. (http://www.talkphp.com/general/5029-stumbled-upon-something-here.html)

cachepl0x 10-15-2009 08:22 AM

Stumbled upon something here..
 
Well, I was looking through the PHP documentation, and I came across a neat function called parse_str. I was wondering, would it be wise to use this for storing, and using database details?

PHP Code:

$str "host=localhost&user=root&pass=pass&name=db_name";

parse_str($str); 

Then:

PHP Code:

echo "$host$user$pass$name"

Would output "localhost, root, pass, db_name."

adamdecaf 10-15-2009 09:39 PM

If you're going to grab the string via a HTTP request (such as $_POST, $_GET) then I would say NO! Those would be instantly hackable by anyone who viewed them.

If you're going to store the string in a file and load it I have to ask why not just store them as separate variables?

cachepl0x 10-16-2009 12:36 AM

Oh, no, of course not. I would never dream of doing something as amateurish as that.

Well, I was just wondering. No harm in curiosity.

adamdecaf 10-16-2009 01:48 AM

Quote:

Originally Posted by cachepl0x (Post 28851)
Oh, no, of course not. I would never dream of doing something as amateurish as that.

Well, I was just wondering. No harm in curiosity.

Alright, I just always ask. If you're doing it server side I don't see a problem, just a question as to why would pop up.


All times are GMT. The time now is 02:47 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0