Fires of Heaven Guild Message Board  

Go Back   Fires of Heaven Guild Message Board > General forums > Development
User Name
Password
ForumSpy Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 18 votes, 5.00 average. Display Modes
Old 06-24-2005, 03:27 AM   #1 (permalink)
frott
Banned
 
frott's Avatar
 
Join Date: Jan 2003
Posts: 3,390
+0 Internets
Login / Password admin security

I've set up a PHP driven MySQL backed website for a client. I've decided with this project to learn it all myself rather than just package/configure scripts.

The final piece is building a content management system so that they can:

1. login
2. edit/add/delete stuff from the database

A few questions...

first, the directory structure is:
cgi-bin
htdocs

inside the htdocs are all of the nonsensitive php files, which link via include to a php file in the cgi-bin that holds all of the MySQL db info. I am under the impression that this file with the login/pass etc. is secure because its not in the public web folder. Is this necessarily true or do I have to have it set up a certain way?

When I set up the login/password, I am assuming that I will simply set a cookie in PHP that stores the login/pass and check that against a php script stored in the cgi-bin directory (if it is indeed secure) that is pulling user info from the database, at every page load of the CMS.


Is that as good as it gets, granted that my code itself is as secure as possible? This is going to be storing a store inventory and a user would literally get access to be able to delete the entire thing.
frott is offline   Reply With Quote
Old 06-24-2005, 05:56 AM   #2 (permalink)
Kallian
CHARLIE DON'T SURF!
 
Kallian's Avatar
 
Join Date: Jul 2004
Posts: 777
+0 Internets
Quote:
Originally Posted by frott
I've set up a PHP driven MySQL backed website for a client. I've decided with this project to learn it all myself rather than just package/configure scripts.

The final piece is building a content management system so that they can:

1. login
2. edit/add/delete stuff from the database

A few questions...

first, the directory structure is:
cgi-bin
htdocs

inside the htdocs are all of the nonsensitive php files, which link via include to a php file in the cgi-bin that holds all of the MySQL db info. I am under the impression that this file with the login/pass etc. is secure because its not in the public web folder. Is this necessarily true or do I have to have it set up a certain way?

When I set up the login/password, I am assuming that I will simply set a cookie in PHP that stores the login/pass and check that against a php script stored in the cgi-bin directory (if it is indeed secure) that is pulling user info from the database, at every page load of the CMS.


Is that as good as it gets, granted that my code itself is as secure as possible? This is going to be storing a store inventory and a user would literally get access to be able to delete the entire thing.
Damn, I'm reading this like 5 mins before my ride comes for work. I'm a PHP programmer and have done all the login stuff, etc...

I will get back to this when I get home.

PS: For login, look up crypt. Just compare the hashes when they login.
__________________
In Soviet Russia, Exception throws you!
Kallian is offline   Reply With Quote
Old 06-24-2005, 01:40 PM   #3 (permalink)
Kallian
CHARLIE DON'T SURF!
 
Kallian's Avatar
 
Join Date: Jul 2004
Posts: 777
+0 Internets
One way hashes work good for logins. When the user first registers, the password is hashed. The hashed value is stored in the database (server side). When the user goes to login, the user's password is hashed again and compared with the existing hash on the server.

This code works on session IDs, you don't directly mess with cookies. If you want to be REALLY secure, you might want to read and toy with https, otherwise, one-way hashing is pretty good. Remember, no one sees your PHP code unless they have access (physical or remote) to the server. When someone goes to wtf.com/index.php, the PHP server parses the PHP code and sends only HTML code back to the client. So, your salt or database strings will never be seen.

I assume you know PHP or are learning it - here is the register & login script (along with the dbconnect.php script that is included in these files).

Screw PHP tags - I PM'd them to you.
__________________
In Soviet Russia, Exception throws you!

Last edited by Kallian : 06-24-2005 at 02:05 PM.
Kallian is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
uberguilds network



All times are GMT -7. The time now is 07:27 PM.


Powered by vBulletin® Version 3.6.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0 RC6