473,218 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,218 software developers and data experts.

$GET CMS

I have bought the book on advanced dreamweaver 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();
}
}
}
Jul 16 '05 #1
3 3446
-----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.
Jul 16 '05 #2
Also I should add the actual error was

Parse error: parse error, unexpected T_IS_EQUAL, expecting ',' or ')'
in c:\inetpub\wwwroot\cms\class\createPage.php on line 23
ma**@presspley.com (presspley) wrote in message news:<7a**************************@posting.google. com>...
I have bought the book on advanced dreamweaver 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();
}
}
}

Jul 16 '05 #3
ma**@presspley.com (presspley) wrote in message news:<7a**************************@posting.google. com>...
I have bought the book on advanced dreamweaver 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'])==""){


I could only suggest it's the extra ( ) around the variable that's
causing the problem, although it works fine on PHP 4.3.2.

However, the whole function isn't well written, IMO. If you have more
than two statement blocks executed by IF, you should use switch
instead. As Ian.H pointed out relative redirects are not RFC compliant
and only work if the browser allows it. They also drop in and out of "
to build strings. You don't need to do that. PHP will swap variable
names in strings very happily and if you enclose array variables in {
} it will work with them too. I'd write the routine like this.

function getType() {
if (isset($_GET['type'])) {
switch ($_GET['type']) {
case "" :
$link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?type=article&menuID=0";
header ("Location: $link");
break;
case "news" :
$this->news();
break;
case "article" :
$this->article();
}
}
}
Jul 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: R.Wieser | last post by:
Hello All, I'm trying to get a "Virtual Listbox" to work. I've currently got a form, and used CreateWindowExA to create a ListBox with the LBS_OWNERDRAWFIXED and LBS_NODATA flags on it. I've...
0
by: Al Dente | last post by:
Round round get around I get around Yeah Get around round round I get around I get around Get around round round I get around From town to town Get around round round I get around I'm a real...
11
by: Ken Varn | last post by:
I want to be able to determine my current line, file, and function in my C# application. I know that C++ has the __LINE__, __FUNCTION__, and __FILE___ macros for getting this, but I cannot find a...
19
by: LP | last post by:
I am using (trying to) CR version XI, cascading parameters feature works it asks user to enter params. But if page is resubmitted. It prompts for params again. I did set...
1
by: dx | last post by:
I'm extremely frustrated with ASP.NET...again! To me this should be as simple as setting oCheckBox.Checked = True.. yet for some reason it isn't. I have a user control (ascx) that that has a...
12
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press...
2
by: Schorschi | last post by:
Can't seemd to get ReadFile API to work! Returns invalid handle error? =========================================================================== Ok, the visual basic gurus, help! The...
5
by: IcingDeath via DotNetMonster.com | last post by:
I am building this SQL Server database app in which i can store files. In order to display files I want to have the app show the associated icon for the extension of the file that is in the...
11
by: ucasesoftware | last post by:
If i have this property Dim m_name as string Property name() as string Get return m_name end Get Set (byval Value as string) m_name = Value
0
by: georges the man | last post by:
The purpose: • Sorting and Searching • Numerical Analysis Design Specification You are to write a program called “StockAnalyser”. Your program will read a text file that contains historical...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.