Jump to content

Browser handling of php 'require'


RonnieR

Recommended Posts

Hi,

 

I have a forum, based on SMF, as this one is.  The forum is in the public_html root.  Members are controlled by the SSI.php file and not htaccess.

There is a page created by php that I only wish logged in members to be able to view.

I was advised to include the following code right at the top of the php file, before anything else:

 

<?PHP

require('/home/user/public_html/SSI.php');

if ($user_info['is_guest'])

  $_SESSION['http://www.sitename.com'] = 'http://www.sitename.com/directory_where_my_php_file_is/';

is_not_guest();

 

The rest of the code produces a form page which collects information to a database.

 

The 'require' is dealt with fine in IE8 or 9; Safari; and Firefox, users are referred to the log in screen; but not in Opera or Google Chrome, where the page is immediately displayed.

 

The 'require' path is for cPanel.

 

I have looked at the headers produced in the pages produced, but can't find the issue as I really have no idea what I might be looking for.  I've also done some reading up, and run the following:

 

<?php phpinfo(); ?>

 

which shows my server has PHP v5.2.15, and I assume that is all ok.

 

I then ran the <?php phpinfo(); ?> with the 'require':

 

<?php

require('/home/user/public_html/sitename.com/SSI.php');

if ($user_info['is_guest'])

  $_SESSION['http://www.sitename.com'] = 'http://www.sitename.com/directory_where_my_php_file_is/';

is_not_guest();

phpinfo();

?>

 

and I get exactly the same results; i.e. the 'require' is handled fine except in Chrome and Opera.

 

Is there a defect in my 'require' syntax, or the information sent to the browser?

 

Apologies, but I am very new at this  :)

 

No doubt a schoolboy error on my part, I would be grateful for some advice.

 

Regards

 

Paul

 

Link to comment
https://forums.phpfreaks.com/topic/235093-browser-handling-of-php-require/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.