-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Whilst lounging around on 2 Jul 2003 02:29:44 -0700,
ma**@presspley.com (presspley) amazingly managed to produce the
following with their Etch-A-Sketch:
I have bought the book on advanced dreamweaver
HAHAHAHAHAHA!!!!!
(Sorry... had to laugh at advanced WYSINWYG =D ).
and PHP recently. I
have installed MySQL and PHP server but am getting an error on the
$GET statement show below. It says there is a problem with the
variable $GET but $GET is not a variable, I thought it came from
the page that calls the PHP file?
if(($_GET['type'])==""){
this gets an error
<?php
require_once("class/displayNews.php");
require_once("class/displayArticle.php");
require_once("class/displayMenu.php");
################################################## ##
# CMS Page Class #
################################################## ##
class Page{
var $type;
var $mainContent;
var $pageTitle;
var $menu;
function Page(){
$this->getType();
$this->createMenu();
}
function getType(){
if(isset($_GET['type'])){
if(($_GET['type'])==""){
$link = $PHP_SELF . "?type=article&menuID=0";
header("Location:" . $link);
}
if($_GET['type']=="news"){
$this->news();
}
if($_GET['type']=="article"){
$this->article();
}
}
}
This is all a mix of globals enabled / disabled and bad coding
practice. Is this from your book!? if so, you've just wasted your
money! (and if so, was / is it a Wrox book? they do anything but
"rock" that's for sure).
$_GET[] is used where register_globals is disabled, yet you use
'$PHP_SELF' rather than $_SERVER['PHP_SELF'] too.
I suggest one or the other, $_SERVER / $_GET etc being the primary /
most secure choice.
$_GET['type'] won't be affected by the function, as the function is
never given the data to parse.
The header call is flawed too.. you're calling a relative path. This
needs[1] to be a full URL.
Some more information might be handy.. like specific error line,
specific error message....
My car don't start.. someone said it was to do with the engine.....
;)
Regards,
Ian
[1]: Redirecting using: '/somepage.php' is wrong accordin to the HTTP
RFC IIRC.. this is required to be a complete URL:
@header('Location: http://' .
$_SERVER['HTTP_HOST'] .
'/somepage.php'
);
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0
iQA/AwUBPwKsemfqtj251CDhEQIIfQCdFd58HyPWpO0Fx/U0RmH1lCys67kAn34P
lxHSN851joEmuSYBK0JipWEG
=lOWm
-----END PGP SIGNATURE-----
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.