Xavier Van Nieuwenhuyse - 2007-02-27 09:44:02 -
In reply to message 1 from Xavier Van Nieuwenhuyse
I guess this script works with Register Globals off?
Here are some modifications that will make the script work in both cases:
In the sample script:
Line 55-59:
$this->data['id'] = (empty($_REQUEST['id'])) ? "":$_REQUEST['id'];
$this->data['name'] = (empty($_REQUEST['name'])) ? "":$_REQUEST['name'];
$this->data['email'] = (empty($_REQUEST['email'])) ? "":$_REQUEST['email'];
$this->data['website'] = (empty($_REQUEST['website'])) ? "":$_REQUEST['website'];
$this->data['active'] = (empty($_REQUEST['active'])) ? "1":$_REQUEST['active'];
Line 98:
$action = (isset($_GET['action'])) ? $_GET['action'] : "none";
Line 101:
echo "<HTML>\n<BODY>\n<CENTER>\n<A HREF=".$_SERVER['PHP_SELF'].">List All</A> - <A HREF=".$PHP_SELF."?action=add>Add Entry</A><P>\n<TABLE>\n\n";
Probably all the $PHP_SELF need to replaced, but the script works with this only replacement.
Remove line 46 and 47:
// You only need to make all variables used GLOBAL here. All other functions use the internal $this->data variable...
GLOBAL $id, $name, $email, $website, $active;
In the class, in the add and edit section:
Change lines 16 and 36
switch ($_SERVER['REQUEST_METHOD']) {
Remove lines 15 and 35 (or just above the two lines you changed):
GLOBAL $REQUEST_METHOD;