Try enclosing the function code in brackets:
function Check_Session() { code goes here } Mick Quoting Mark Colvin <[EMAIL PROTECTED]>: > I have the following .php script and .inc file which doesn't work: > > ===== .php file ===== > > <?PHP > // Include function files > require_once "includefiles/session_functions.inc"; > > // Create instances of the required class > $sess = new Sessions; > > // chech for valid session > $sess->Check_Session(); > > phpinfo(); > ?> > > <html> > <head> > <title>Untitled</title> > </head> > <body> > <table summary=""> > <tr><td>admin</td></tr> > </table> > </body> > </html> > > > ===== .inc file ===== > > <?PHP > class Sessions > { > > function Check_Session() > > session_start(); > if (!session_is_registered("SESSION")) > { > header("Location: http://???.???.??.?/index.php?logintext=Please > login."); > exit(); > } > > } > > The session was created in a previous login script. When I enter the > .php > script I get the following error: > > Parse error: parse error, expecting `'{'' in > /var/www/html/includefiles/session_functions.inc on line 7 > > Fatal error: Cannot instantiate non-existent class: sessions in > /var/www/html/adminoutput.php on line 8 > However, if I copy the code from the function in the .inc file and place > it > at the top of my php script, and delete the class code in the php > script > everything works OK. Why is this happening? I also tried placing > session_start() in the php script before calling the class method > Check_Session but this had no effect. > > Thanks in advance > > > Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php