url problem only on wamp server
Posted by: mki (---.antik.sk)
Date: November 16, 2006 04:23PM

Hi

i have this problem:

<a href="index.php?action=update">blabla</a><br />

so in url will be this
[localhost]

and now i want echo variable $update in index.php
<?
echo $action;
?>

but variable $action is empty , why ?

this problem is only on my wamp server , if i copy giles to hosting server , there is everythink OK

OR WRITE HERE IF IT WORKS ON YOUR COMPUTER

thanks



Post Edited (11-16-06 16:54)

Options: ReplyQuote
Re: url problem only on wamp server
Posted by: jazzymass (---.3g.vodacom.co.za)
Date: November 16, 2006 05:28PM

Hi,

You need to edit your php.ini file. You can find php.ini in the wampserver menu under "Config files" > php.ini. Scroll down to "Data Handling" and find register_globals = Off. Change this to On. Restart Apache under the wampserver menu and it should work fine. The problem with this though is it has a lot of security vulnerabilities and has been switched off by default and is not suggested for usage. I normally access url variables with $_REQUEST['var'] in your case $_REQUEST['action']. You can read more about this at www.php.net.

If you are running under a fresh installation of wampserver and haven't changed anything yet, you might want to change short_open_tag in php.ini under Language Options to On as well or you can use <?php /* code here */ ?>.

Hope this helps!


--- POSTED EDITED BY WAMP ADMIN ---
----------------------------------------------------

do not follow any of the instructions in this post. check out my
reply below for the right way to solve this problem
----------------------------------------------------
CyberSpatium

WAMP English Forum Admin

Options: ReplyQuote
Re: url problem only on wamp server
Posted by: mki (---.antik.sk)
Date: November 16, 2006 05:38PM

thanks a lot

Options: ReplyQuote
Re: url problem only on wamp server
Posted by: Arion (---.hsd1.co.comcast.net)
Date: November 17, 2006 12:16AM

Come on....
Quote

The problem with this though is it has a lot of security vulnerabilities and has been switched off by default and is not suggested for usage.

I'm sure that won't work, but you get the picture...

Look up the GET and POST variables at www.php.net

The suggested use is $_GET['action']

Options: ReplyQuote
Re: url problem only on wamp server
Posted by: CyberSpatium (71.237.217.---)
Date: November 17, 2006 02:53PM

-- PLEASE DISREGARD EVERYTHING jazzymass POSTED ABOVE --


for the love of god do not enabled register globals. this is a HUGE security problem, that is why the php community set this setting disabled by default in php 4.2.0. you need to learn how to develop your scripts with register globals disabled because nearly all webhosts have that setting disabled.

so, to get your code to work, you need to first change if to work with register globals off, and also use full php tags, so change your script to this

<?php
echo $_GET['action'];
?>

more on register globals
[www.php.net]

also, jazzymass stated that you should should enable the open_tag setting in your php.ini file. do not do it, it is not the standard php coding practice to use short tags. also it you will be using xml, it needs to use short style tags, and if you have php set to use those short tags, it will not work.

jazzymass, should learn to develop your scripts with the recommended defaults php such as register globals disabled and short style tags disabled. just because there is a setting in the php.ini file to change something does not mean you should change it.

most, if not all web hosts by now have register globals disabled. this means if you which to use get a web hosting account and upload your scripts there, you will run into huge problems getting your scripts to work correctly have having to do massive code rewrites that could have been easy avoided by writing deployable code. also, if you will be selling your code for others to use, when they try to use it on their servers they too will have all these same problems. talk about a giant headache trying to solve all the tech suport requests for that mess.


CyberSpatium
WAMP English Forum Admin

Options: ReplyQuote
Re: url problem only on wamp server
Posted by: jazzymass (---.3g.vodacom.co.za)
Date: November 18, 2006 03:22PM

I did advise on the above said.

Quote

The problem with this though is it has a lot of security vulnerabilities and has been switched off by default and is not suggested for usage.

AND

Quote

or you can use <?php /* code here */ ?>

Apologies for any misconceptions! smiling smiley



Thats the way the cookie crumbles.

Options: ReplyQuote


Sorry, only registered users may post in this forum.