Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

94 users online



Notice: Undefined index:

Notice: Undefined index:

Currently viewing this thread: 1 (0 members and 1 guests)


deathy

deathy

Status: Offline!

Notice: Undefined index:

i keep getting the following error

Notice: Undefined index: act in D:\web\wwwroot\plat\index.php on line 32

[QUOTE]$page = array(
'idx' => 'news',
'join' => 'join'
);

$_REQUEST['act'] = $_REQUEST['act'] == '' ? "idx" : $_REQUEST['act'];

if (!isset($page[ $_REQUEST['act'] ]) )
{
$_REQUEST['act'] = 'idx';
}

require $root.'/sources/'.$page[ $_REQUEST['act'] ].'.'.EXT;[/QUOTE]

that is the code for it.

how can i resolve this without turning of error reporting

Aki

Aki

Neverside Newbie
Status: Offline!

Are you trying to do query strings... like index.php?type=this&something=that?

And which line is line 32? Wink

Please answer both questions.

SlappyMcCracken

SlappyMcCracken

Status: Offline!

That message means that 'act' is not a known index in the $_REQUEST array, meaning that it hasn't been succesfully set to a value.

That probably means the part of the code that causes trouble is this:

PHP:

<?php
$_REQUEST
['act'] = $_REQUEST['act'] == '' "idx" $_REQUEST['act'];
?>

If that's the problem, then the code that this variable is used for shouldn't work. But i've had some weird problems myself with superglobal arrays, it could have something to do with the setup of php. On a host i use for testing when i have no other options, i get the same "undefined index " error while the variable actually does exist and it can be used properly. In this case, i used error suppression by putting a @ in front of the statement.

Alekz

Alekz

So what's up :)
Status: Offline!

I would suggest using $_GET rather than $_REQUEST Smile

___________________

"¿Por qué buscais la felicidad, oh, mortales, fuera de vosotros mismos?"
~Boecio

phpmonkey

phpmonkey

whoa, wtf?
Status: Offline!

www.php.net/isset

PHP:

<?php

$_REQUEST
['act'] = isset($_REQUEST['act']) ? $_REQUEST['act']: "idx" 

?>

that should do what you want.

___________________

Fomerly known as lasnaranjas. Holler.
http://card.mygamercard.net/gelsig/blackdood.png

Rad

Rad

thinking of something witty to put here
Status: Offline!
Quote:

Originally posted by Alekz
I would suggest using $_GET rather than $_REQUEST Smile

Me too. $_REQUEST isn't much more secure than registered globals.

phpmonkey

phpmonkey

whoa, wtf?
Status: Offline!
Quote:

Originally posted by Radley
Me too. $_REQUEST isn't much more secure than registered globals.

*sigh*

$_GET/$_POST is preferred, but they're essentially the same thing. Register globals lets you set an arbitrary amount of variables/values in a person's script. You can't do that with $_REQUEST.

-Jerome

___________________

Fomerly known as lasnaranjas. Holler.
http://card.mygamercard.net/gelsig/blackdood.png

Rad

Rad

thinking of something witty to put here
Status: Offline!

Yes, but another one of the flaws was that POST and GET data are invisibly interchanged. Of course you should still validate all of your data on the server, but it's nice to have good habits.

By the way, save the attitude please.

Last edited by Rad, November 19th, 2004 11:25 AM (Edited 1 times)

phpmonkey

phpmonkey

whoa, wtf?
Status: Offline!
Quote:

Originally posted by Radley
Yes, but another one of the flaws was that POST and GET data are invisibly interchanged. Of course you should still validate all of your data on the server, but it's nice to have good habits.

By the way, save the attitude please.

That shouldn't really cause an issue in your code. As long as your checking the data and it can't leak, there's no reason why you can't get it through a different method.

By the way, there wasn't an attitude, merely making a statement.

___________________

Fomerly known as lasnaranjas. Holler.
http://card.mygamercard.net/gelsig/blackdood.png

Alekz

Alekz

So what's up :)
Status: Offline!

I think also that you can carry less data in GET than in POST Smile

___________________

"¿Por qué buscais la felicidad, oh, mortales, fuera de vosotros mismos?"
~Boecio

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0093 seconds.