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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.