Web Dev Question!

Posted by Alert Games on June 10, 2012, 2:11 p.m.

(Yes this has to do with what I'm doing with AG/LG)

So what is a good practice for storing the connection to the database file? How are websites typically set up?

So lets say I have a site called livegrenade.com ( :3 )

would it work like this on the server?

/public_html/livegrenade/index.php

and the connection:

/public_html/config.php

(the config would of course check to make sure it is included and not just linked)

Then call using, for example, ../config.php

let me know guise.

Comments

flashback 12 years, 6 months ago

You should be able to reference it with ../config.php, yes.

Alert Games 12 years, 6 months ago

Yeah, it seems like this is a good option so I can set FTP permissions to the site directory so they cant see the passwords if I don't want them to right?

flashback 12 years, 6 months ago

To hide them from other site developers or something? Or do you have public FTP on for the whole site?

Alert Games 12 years, 6 months ago

Let me try it. h/o a sec

EDIT: Yeah it looks like the user can only access that directory. That will work :D

poultry 12 years, 6 months ago

If they can run PHP, they can still get to your passwords.

sirxemic 12 years, 6 months ago

You can also just use one of the many PHP frameworks out there to ensure maintainability and make everything easier, basically.

EDIT: nvm, that was completely off-topic and I should just go to bed now.

Alert Games 12 years, 6 months ago

Well you have a point there but Im not sure that the site could afford that at this stage.

Everything works, but i started coding it since I began PHP, so it will need to be redone at some point. (its not written with OOP)

leemcd56 12 years, 6 months ago

Use MVP/OOP. Best option.

Astryl 12 years, 6 months ago

Put your config.php file in a subdirectory, and use a .htaccess file to block off outside access.