Page 1 of 1

[SOLVED] function errors

Posted: Wed Jun 16, 2004 10:40 pm
by pinehead18
Ok, i have a page called functions.inc.php which contains the following code.

Code: Select all

function user_check() {
          session_start();
        header("Cache-control: private");
        if(isset($_SESSION['name'])) { header("Location: http://www.kcc.com/loginbox.php"); exit; }
}
On a seperate page i call the functoin by doing this

Code: Select all

user_check();
and i get the following errors

Fatal error: Cannot redeclare user_check() (previously declared in /home/pinehead/www/functions.inc.php:5) in /home/pinehead/www/functions.inc.php on line 4


Any ideas? Thank you for your time.

Anthony

Posted: Wed Jun 16, 2004 10:42 pm
by feyd
sounds like multiple inclusion... are you using include/require or include_once/require_once ???

Posted: Wed Jun 16, 2004 10:45 pm
by pinehead18
require(;');

Posted: Wed Jun 16, 2004 10:57 pm
by feyd
try switching those to require_once..

Posted: Wed Jun 16, 2004 11:29 pm
by pinehead18
works good thank you