[SOLVED] function errors

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

[SOLVED] function errors

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

sounds like multiple inclusion... are you using include/require or include_once/require_once ???
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post by pinehead18 »

require(;');
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

try switching those to require_once..
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post by pinehead18 »

works good thank you
Post Reply