Author Topic: Using <?php include inside a members only site  (Read 6852 times)

Offline arizonakid

  • New User
  • *
  • Posts: 6
    • View Profile
Using <?php include inside a members only site
« on: June 10, 2010, 07:38:02 AM »
I am trying to use a <?php include statement in my members pages to allow members to view topics but I keep getting an error reference authorization failure

failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required

How can I code the authorization within the php file

Thanks

Tony Prodger

kiosk2

  • Guest
Re: Using <?php include inside a members only site
« Reply #1 on: June 11, 2010, 02:00:39 PM »
Are you logged in when you try to view the page?

Offline arizonakid

  • New User
  • *
  • Posts: 6
    • View Profile
Re: Using <?php include inside a members only site
« Reply #2 on: June 11, 2010, 03:10:23 PM »
I am logged in as the administrator

Tony

kiosk2

  • Guest
Re: Using <?php include inside a members only site
« Reply #3 on: June 12, 2010, 12:43:01 AM »
Try logging in as a user and viewing. If not, PM me log in details and I'll take a look.

Offline arizonakid

  • New User
  • *
  • Posts: 6
    • View Profile
Re: Using <?php include inside a members only site
« Reply #4 on: June 12, 2010, 05:30:06 AM »
I have created a user id = fredsmith with a password of password.
the members site is http://www.reallybasic.com/members. If you select PHP from the top menu  you will see my error. The right mouse button is not disabled so you should be able to see the source

Many thanks

Tony
ps.  I am away for periods today but will check in as often as I can and no it has nothing to do with the Football World Cup

kiosk2

  • Guest
Re: Using <?php include inside a members only site
« Reply #5 on: June 15, 2010, 07:25:54 AM »
Hi Tony

I see what you mean - does that page open ok if it's not included in the locked area?  I can't see how it could be affected.
« Last Edit: June 16, 2010, 02:28:10 AM by David Allen »

Offline arizonakid

  • New User
  • *
  • Posts: 6
    • View Profile
Re: Using <?php include inside a members only site
« Reply #6 on: June 15, 2010, 10:06:48 AM »
Yes I have no problems with the page outside the protected area

Tony

Offline Johnny Slater

  • SMP/SGP Designer
  • Pro User
  • **
  • Posts: 219
    • View Profile
    • Viral Membership Script

kiosk2

  • Guest
Re: Using <?php include inside a members only site
« Reply #8 on: June 16, 2010, 02:27:51 AM »
Good spot Johnny - Tony, does that fix it?

Offline arizonakid

  • New User
  • *
  • Posts: 6
    • View Profile
Re: Using <?php include inside a members only site
« Reply #9 on: June 16, 2010, 03:31:34 AM »
Yes Good spot Johnny - but it doesn't appear to have solved the problem, my error codes are now as below. I need to reboot and clean off the old files to give it a clean restart. Thanks for your time guys

Tony

'Warning: include(http://www.reallybasic.com/members/php/includes/contents.html) [function.include]: failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required in /home/reallyba/public_html/members/php/index.php on line 28

Warning: include() [function.include]: Failed opening 'http://www.reallybasic.com/members/php/includes/contents.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/reallyba/public_html/members/php/index.php on line 28

Warning: include(http://www.reallybasic.com/members/php/includes/optinbox.html) [function.include]: failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required in /home/reallyba/public_html/members/php/index.php on line 29

Warning: include() [function.include]: Failed opening 'http://www.reallybasic.com/members/php/includes/optinbox.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/reallyba/public_html/members/php/index.php on line 29'

Offline arizonakid

  • New User
  • *
  • Posts: 6
    • View Profile
Re: Using <?php include inside a members only site
« Reply #10 on: June 18, 2010, 04:38:16 AM »
Hi guys

Kevin Yank from Sitepoint gave me the solution. He said it was bad practice to use URL's in include statements. I changed the include statement to point to the file. i.e <?php include('includes/contents.html');?>

Works brilliantly

Thanks again for all your advice and suggestions

Tony