RE: [PHP] SEARCHING for an answer...
| From: | Jay Blanchard | Date: | Tue, 11 Sep 2007 20:14:11 +0000 |
| Subject: | RE: [PHP] SEARCHING for an answer... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-261982@lists.php.net to get a copy of this message | ||
[snip]
Son of a Bitch... Soon as I closed that down at line 265 the search
now isn't redirecting to edit.php.... Do you debug by hand? Or do you
have something that helps you to do that? I've been tearing my hair
out for hours trying to find that and I couldn't see it...
[/snip]
Debugged by hand. And I never tried to load in a browser.
1. Searched for edit.php in the file to make sure it appeared nowhere
else.
2. When I found the form call I looked for the closing form tag. None
found till after your search query. BINGO! Knew that if you viewed the
source that your opening form tag (subsequent ones get ignored, you must
close each form tag first) would have an action of edit.php, not
PHP_SELF
Now, I am old school and your code had reasonable whitespace and
indentations...BUT NO COMMENTS! Well some, but not enough...you never
explain the logic, just things like // Show your login form here. YOU
MUST EXPLAIN THE LOGIC OR YOU WILL HAVE PROBLEMS MAINTAINING THE CODE 2
WEEKS FROM NOW MUCH LESS 2 MONTHS FROM NOW.
So Jason you learned three valuable lessons today.
a. plan your code (use paper and pencil or something like it)
b. always account for security
c. comment properly
Now, here is something you can do for a project; create a file parser
that will look for all opening/closing tag pairs. I did not need one in
this short code, but had it been longer I might have thrown something
like this at it.