p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: userman.php


Message #1 by "Ken Goff" <macessen@a...> on Mon, 24 Feb 2003 00:46:26
In the userman.php downloaded file from this site, the "Change User Record"
button does indeed work properly and will make changes to the appropriate
table. But either "Change" button for the Access Log produces an error
message of the following:

"The requested URL /~username/$PHP_SELF" was not found on this server"
(I've inserted "username" for my actual short username)

The problem is on line 372 of userman.php.

Change:

echo "<FORM METHOD=\"POST\" ACTION=\$PHP_SELF\">";

To:

echo "<FORM METHOD=\"POST\" >";

This modification enables the "Change" buttons and seems to have no adverse
effects.

I discovered this while I was modifying a copy of the userman.php to work
with my own database. But it appears that the modified line is preventing
"edit_log_record" from collecting a value from the form. My variable,
instead of containing a date, is empty and the function then produces an error.

This same date variable is used within the "edit_record" function and
clicking on the "Change User Record" button does update to my own database.

During testing, if I hard code a date assignment to this variable, all is
well and the function works properly. Any ideas what is happening with my
date variable?
Message #2 by "Ken Goff" <macessen@a...> on Mon, 24 Feb 2003 00:48:59
The userman.php file is from Chapter 13.
Message #3 by "Nikolai Devereaux" <yomama@u...> on Mon, 24 Feb 2003 12:08:46 -0800
The problem is a typo; a missing " to be exact:

> echo "<FORM METHOD=\"POST\" ACTION=\$PHP_SELF\">";
                                      ^

The proper change would be to insert a double-quote, like so:

> echo "<FORM METHOD=\"POST\" ACTION=\"$_SERVER[PHP_SELF]\">";

(I took the liberty of also using the $_SERVER superglobal, since you should
code your script assuming register_globals is off.

Take care,

Nik


  Return to Index