I would advise against doing that unless you really know what your doing. Doing it 
that way will allow anyone to type in any file on your server that PHP has access to 
and load it, or possibly load a file off of another server.

That said, if you have a url like page.php?file=foo.inc

Then that value will be present in $_GET["file"] (PHP 4.1+) or $HTTP_GET_VARS["file"] 
(PHP <4.1)

include($_GET["file"]);
include($HTTP_GET_VARS["file"]);

---John Holmes...
  ----- Original Message ----- 
  From: [EMAIL PROTECTED] 
  To: 
[EMAIL PROTECTED] 
  Sent: Monday, May 06, 2002 5:28 AM
  Subject: [PHP] Defining PHP varibles from URL


  I don't mean to be a pain but could someone send me a working example?

  I am what you would probably call a 'newbie'

  For those who don't know here is my previous message

   can't seem to define a varible from the url entered into a browser. 

  I wish to use the following code or something like it.
  <script language="php">

  $file = "";
  //the above is defined from the url


  include "$file";



  </script>

  It could be what I was typing in the url bar.

  file.php?file=foobar.inc



  Thanks,

  JJ Harrison
  [EMAIL PROTECTED]
  www.tececo.com



------------------------------------------------------------------------------


  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to