Re: Global turned off



jpb wrote:
I quite new to PHP and little confused at the present about Global
variables.

My new host has them turned off and now some of my code will not work.

I had a line of code in a menu like this.

<a href="<?php echo
$config[baseurl]; ?>/template.php?story="/includes/lake.inc.php"
id="template"><?php echo("Residents call for cleanup") ;?></a>


The following lines are in the file template.php

$story = $HTTP_GET_VARS[ "story" ];


and


<?php include $config[baseurl].$story; ?>


When I try this I receive the following


Warning: include() [function.include]: URL file-access is disabled in
the server configuration
in /template.php on line 31

What is the proper way to include the wanted file now?

Thanks

This has nothing to do with globals (although you should have them turned off - see Klaus's comment). Rather, you are trying to include the file via a URL instead of using the local file system.

It's OK to include a file from a remote server that way (in fact, the only way you can do it if you don't have a shared file system). However, including it locally means an extra call to the web server, and the additional overhead involved.

Rather, you should be including it using the file system. You can find the root directory of your website with $_SERVER['DOCUMENT_ROOT'], so you would do something like:

include($_SERVER['DOCUMENT_ROOT'] . "/{$story}");

Also, $HTTP_GET_VARS has been deprecated and replaced by the $_GET superglobal array; you should be using that instead (same with $HTTP_POST_VARS and $HTTP_COOKIE_VARS).


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.



Relevant Pages

  • Re: Global turned off
    ... Jerry Stuckle wrote: ... My new host has them turned off and now some of my code will not ... It's OK to include a file from a remote server that way (in fact, ... only way you can do it if you don't have a shared file system). ...
    (comp.lang.php)
  • Re: Global turned off
    ... Jerry Stuckle wrote: ... My new host has them turned off and now some of my code will not ... It's OK to include a file from a remote server that way (in fact, the only way you can do it if you don't have a shared file system). ...
    (comp.lang.php)
  • NetSec Security Advisory: Multiple Vulnerabilities Resulting From Use Of Apple OSX HFS+
    ... NetSec released details of a vulnerability impacting ... methods to an underlying legacy HFS+ file system: ... one method to leverage this 'feature' of the legacy HFS+ driver in OS X: ... The default configuration of several web server ...
    (Bugtraq)
  • gdm hangs
    ... gdm will hang 9 of 10 times when logging out. ... with or without the client having been connected to the Server. ... # Timed login, useful for kiosks. ... Must output the chosen host on stdout, ...
    (Debian-User)
  • problem with sendmail in solaris 9
    ... names that should be exposed as from this host, ... # save Unix-style "From_" lines at top of header? ... # work recipient factor ... # SMTP STARTTLS server options ...
    (SunManagers)