"Wes Spikes" <Mo******@NOSPA Mverizon.net> wrote in message news:<3GdYc.640 $O85.477@trnddc 05>...
include("file_p ath/file_name.php") ;
function_name(a rg1,arg2,[...],argX);
Basically, you include the file, then call the function contained in the
file.
Thanx Wes!
That's exactly what I did but it doesn't work...
My external php file is below (this sets a cookie):
<?php
function counter() {
$cookie_val = @$_COOKIE["user_ip"];
$counterfile = "counter";
$line = @file($conterfi le);
if(!$cookie_val ) {
setcookie("user _ip", "$_SERVER[REMOTE_ADDR]", time()+36000);
if ($line[0] == NULL) {
$line[0] = 0;
}
$line[0]++;
$cf = @fopen($counter file, "w+");
fputs($cf, "$line[0]");
fclose($cf);
}
elseif ($cookie_val != "$_SERVER[REMOTE_ADDR]") {
$line[0]++;
$cf = @fopen($counter file, "w+");
fputs($cf, "$line[0]");
fclose($cf);
}
}
?>
My main (calling) php file is like this:
<?php
include 'phpfunc.php';
counter();
?>
<html>
<head></head>
<body></body>
</html>
I get the following warning:
Warning: Cannot modify header information - headers already sent by
(output started at D:\Apache Group\Apache2\h tdocs\phpfunc.p hp:26) in
D:\Apache Group\Apache2\h tdocs\phpfunc.p hp on line 8
I also uncommented "include_pa th" in php.ini and added the path to my
localhost web server which is "D:\Apache Group\Apache2\h tdocs\" but
nothing changed...
Hope this shows my problem more clearly..
Thanx!
Ben