"Wes Spikes" <Mo******@NOSPAMverizon.net> wrote in message news:<3GdYc.640$O85.477@trnddc05>...
include("file_path/file_name.php");
function_name(arg1,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($conterfile);
if(!$cookie_val) {
setcookie("user_ip", "$_SERVER[REMOTE_ADDR]", time()+36000);
if ($line[0] == NULL) {
$line[0] = 0;
}
$line[0]++;
$cf = @fopen($counterfile, "w+");
fputs($cf, "$line[0]");
fclose($cf);
}
elseif ($cookie_val != "$_SERVER[REMOTE_ADDR]") {
$line[0]++;
$cf = @fopen($counterfile, "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\htdocs\phpfunc.php:26) in
D:\Apache Group\Apache2\htdocs\phpfunc.php on line 8
I also uncommented "include_path" in php.ini and added the path to my
localhost web server which is "D:\Apache Group\Apache2\htdocs\" but
nothing changed...
Hope this shows my problem more clearly..
Thanx!
Ben