PHP script doesn't work with new linux cpanel/whm web host

This is a discussion on PHP script doesn't work with new linux cpanel/whm web host within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi, I have a simple php script which takes a variable from the url and prints it out. I've ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-10-2007
Nathan
 
Posts: n/a
Default PHP script doesn't work with new linux cpanel/whm web host

Hi,

I have a simple php script which takes a variable from the url and
prints it out. I've recently changed linux cpanel/whm servers and it no

longer runs. What modules do I need to install/how do I get it running
again?

The script is shown below:

Example url:

http://www.domain.com/file.php?variable=helloworld

The following code is in the <head> of the php file:

<?php
$qsdata = split("&", $QUERY_STRING);
foreach( $qsdata as $pair ) {
$kv = split("=", $pair);
$QS[$kv[0]] = rawurldecode($kv[1]);

}

?>

The following code is in the <body> of the php file where a variable
needs to be printed out:

<?php print "$QS[variable]"; ?>

Thanks for your help,

Nathan.

Reply With Quote
  #2 (permalink)  
Old 01-10-2007
Rik
 
Posts: n/a
Default Re: PHP script doesn't work with new linux cpanel/whm web host

Nathan wrote:
> Hi,
>
> I have a simple php script which takes a variable from the url and
> prints it out. I've recently changed linux cpanel/whm servers and it
> no
>
> longer runs. What modules do I need to install/how do I get it running
> again?
>
> The script is shown below:
>
> Example url:
>
> http://www.domain.com/file.php?variable=helloworld
>
> The following code is in the <head> of the php file:
>
> <?php
> $qsdata = split("&", $QUERY_STRING);
> foreach( $qsdata as $pair ) {
> $kv = split("=", $pair);
> $QS[$kv[0]] = rawurldecode($kv[1]);
>
> }
>
>>

>
> The following code is in the <body> of the php file where a variable
> needs to be printed out:
>
> <?php print "$QS[variable]"; ?>
>



Check register_globals in the manual, and learn to use the $_GET array.
Omitting the first script and doing a search/replace on $QS to $_GET in the
rest of the files should do it.
--
Rik Wasmus


Reply With Quote
  #3 (permalink)  
Old 01-10-2007
Arjen
 
Posts: n/a
Default Re: PHP script doesn't work with new linux cpanel/whm web host

Rik schreef:

>> <?php print "$QS[variable]"; ?>


> Check register_globals in the manual, and learn to use the $_GET array.
> Omitting the first script and doing a search/replace on $QS to $_GET in the
> rest of the files should do it.


That would get you
<?php print "$_GET[variable]"; ?>

Wich is bad in so many ways
Better use
echo $_GET['variable'];

note $x[''] insetd of "$x[]"

--
Arjen
http://www.hondenpage.com
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:17 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0