I've never really used include files to execute code...only to include things like copyright
footers.

I want some code to execute when the page loads and write to a table. As the same code
needs to be used on multiple pages, I thought using the include() function would be best.
But, I'm getting an error that I don't understand.

Here is the error:
Warning: main(): URL file-access is disabled in the server configuration in /home/user/
www/db/index2.php on line 6

Warning: main(http://www.domain.com/include/log.php): failed to open stream: no
suitable wrapper could be found in /home/user/www/db/index2.php on line 6

Warning: main(): Failed opening 'http://www. domain.com/include/log.php' for inclusion
(include_path='.:/usr/local/share/pear:/usr/local/lib/php') in /home/user/www/db/
index2.php on line 6

This is what is at the top of the pages:

$main = 'X';

include("http://www.domain.com/include/log.php");

And then the included file:

$dt_logged = date("Y-n-j H:i:s");
$ip_addr = GetHostByName($REMOTE_ADDR);

@ $db = mysql_pconnect("localhost", "x", "x");

  if (!$db)
  {
     print 'Error: Could not connect to database.  Please try again later.';
     exit;
  }

mysql_select_db("x");
$insert_query = "insert into userlog values ('".$main."' and other columns)";
$insert_result = mysql_query($insert_query) or die(mysql_error());

Both the code at the top of page and the code in the included file are enclosed in <? ?>.

What am I doing wrong?

Thanks for any help.

Jer






Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list




SPONSORED LINKS
Php mysql Job postings


YAHOO! GROUPS LINKS




Reply via email to