Bug : Cookies conflicts

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
JeffPHP
Posts: 2
Joined: Sun Nov 24, 2002 2:13 pm

Bug : Cookies conflicts

Post by JeffPHP »

Hi Rax,

I have been installing Cacti on my Debian and I had many errors provided by MySQL saying "Invalid resource on mysql index...".

After exploring the code of Cacti I figured out that cacti wasn't using the "id" parameter in the URL, but the one I use on commentcamarche.com...

Then in order to fix this kind of tiny bug you should add for every parameter that you pass by URL in your config.php file or in whatever file used by all your scripts :

parameter = $_GET[parameter]

For your "id" parameter it'll be :

$id = $_GET["id"];

Thank you for your PHPware ;-)
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

Thanks for pointing this out. Just one of the many problems that seem to crop up when you rely on PHP's register_globals :-? Anyhow, I am doing just what you are suggesting for the next version.

-Ian
JeffPHP
Posts: 2
Joined: Sun Nov 24, 2002 2:13 pm

Post by JeffPHP »

Actually, since you sometimes use POST, the code is a little bit more complicated :

if (isset($_GET["id"])) $id = $_GET["id"];
else if (isset($_POST["id"])) $id = $_POST["id"];
else unset($id);


either you (hard-)change each parameter sent by POST or GET in the code, or you put some code like this one in a common header.

Good luck ;-)
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

You could also use the $_REQUEST variable assuming that both $_POST["id"] and $_GET["id"] are not set at the same time.

-Ian
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests