file organization question

From: Date: Fri, 21 Jul 2000 00:03:40 +0000
Subject: file organization question
Groups: php.db 
Request: Send a blank email to php-db+get-1376@lists.php.net to get a copy of this message
I'm trying to figure out the best way to organize my html and php files; no doubt others have already addressed these issues. If there is a web page that explains this feel free to post the url. For the record, I'm using php-4.0.1pl2, apache_1.3.12, and mysql-3.23.21-beta. There isn't anything involving money or sensitive information so I'm not using SSL. I've set myself a task to learn mysql and php with a project that hopefully will result in something useful for a non-profit I do volunteer work for. At the moment I'm working on the login page and the new user page. The new user page is an html file with a form that has fields for their name, address, phone numbers, email address and password. Their email address will be their login id. The login page is also an html file with a form with two fields, for email address and password. The html for the page starts like the following: <html><head><title>title</title></head><body> <form name="test0" action="output0.php" method=post> <table> <tr> <td><label for="pr_email">Email address:</label></td> <td><input name="pr_email" id="pr_email" type="text" value="" size="20"></td> </tr> ... The output0.php file does all the "usual" stuff; checks to see if the email address is not empty, same with the password, connects to mysql and fetches the password, compares the password with the stored password, etc. etc. The first thing that bothers me is that the output0.php file that is called by this form has two jobs; the first is to verify the user and sign them in. The second job is to generate the next web page they see after a successful login. It seems like it would be cleaner, and more logical, if the output0.php file only signed them in and then an .html file presented the next page. But I can't see how to have another page sent separately by the output0.php file; it seems that the best I can do is to have it do something like include("nextpage.html"). By "sent separately" I mean that the Address or Location box in the web browser shows the url for nextpage.html and not output0.php. Is this possible? (And don't tell me about mod_rewrite; I'm wondering if it can be done for real, not faked). The other thing that bothers me is that the output0.php file is using php's sessions, so all of the code that verifies them has to go before the <html> start tag so that session_start() can try to use cookies. And because of that none of that code can do any error output since it won't be properly formatted by my .css file, which is pulled in via a <link> in the <head>. This tends to make for a certain amount of bending over backwards. I was wondering if people had any suggestions or thoughts about this, or is what I'm doing just the way it's done?

« previous php.db (#1376) next »