page won't display for logged in user

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   page won't display for logged in user
Nuggy
CZ Newbie
Nuggy has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Sep 05, 2004
0.00 posts per day
Posts: 7
Points: 418
   
I have a page that won't display when logged in as a user. It will display for anonymous and also if logged in only as admin. Anyone have an idea how to fix this?

Thanks!!



Back to top Reply with quote
#2   re: page won't display for logged in user
Nuggy
CZ Newbie
Nuggy has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Sep 05, 2004
0.00 posts per day
Posts: 7
Points: 418
   
i do get an error after a few minutes when logged in as user.. file_get_contents blah blah ... failed to open stream.

Doesn't happen for anonymous or admin.



Back to top Reply with quote
#3   re: page won't display for logged in user
Taut
PayPal Donation
CZ Revered Member
 Codezwiz Site Donator
usa.gif california.gif
Occupation: Entrepreneur
Gender: Female
Fav. Sports Team: SF Giants
Status: Offline
Joined: May 27, 2003
0.70 posts per day
Posts: 5530
Points: 481,695
   
when you say "page" can't be seen by registered user, can oyu be more specific and please post the exact error you are getting



Back to top Reply with quote
#4   re: page won't display for logged in user
Nuggy
CZ Newbie
Nuggy has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Sep 05, 2004
0.00 posts per day
Posts: 7
Points: 418
   
sure ya, let me see..

the error is in a php file that uses a php command called 'file_get_contents". it goes something like this...

Warning: file_get_contents(http://URL-HERE): failed to open stream: HTTP request failed! in /php-file-here on line 'linenumberhere'

this file is called in by a nuke module.

the error is occuring only for logged in users not anonymous or admin, when trying to visit this module.

I do have require_once("mainfile.php"); as a line in the php file being called by the module if that might do any good. icon_smile.gif

I hope this makes more sence.



Back to top Reply with quote
#5   re: page won't display for logged in user
64bitguy
CZ Super Newbie
64bitguy has been a member for over 20 year's 20 Year Member
usa.gif newhampshire.gif
Occupation: IT Guru, IT Portal Operator
Website:
Status: Offline
Joined: Sep 04, 2004
0.00 posts per day
Posts: 34
Points: 2,699
   
What module are we talking about here?

What "page" are we talking about?

If possible, please cut and paste the entire php code of the file so we can see it.

Thanks
Steph [ Register or login to view links on this board. ]
The IT Portal for IT People!
[ Register or login to view links on this board.]



Back to top Reply with quote
#6   re: page won't display for logged in user
Nuggy
CZ Newbie
Nuggy has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Sep 05, 2004
0.00 posts per day
Posts: 7
Points: 418
   
Um, I sorta made the php code... there is just one command causing the error for logged in users... the file_get_contents one and the module is just like any other module that uses the php command 'include' to have a php file the main content for that module.

Here is what the module code looks like... icon_smile.gif

<?php
if (!eregi("modules.php", $PHP_SELF)) {
die ("You can't access this file directly...");
}
$index = 1;
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
include("header.php");
OpenTable();
include("file.php");
CloseTable();
include("footer.php");
?>


here is the line out of file.php that gives an error only for logged in users...

if (!function_exists('file_get_contents')) {
$r = fread($file, 80000);
}
else {
$r = file_get_contents($URL);
}


Hopefully this may be helpful? Thanks a bunch!!



Back to top Reply with quote
#7   re: page won't display for logged in user
64bitguy
CZ Super Newbie
64bitguy has been a member for over 20 year's 20 Year Member
usa.gif newhampshire.gif
Occupation: IT Guru, IT Portal Operator
Website:
Status: Offline
Joined: Sep 04, 2004
0.00 posts per day
Posts: 34
Points: 2,699
   
Maybe others can tell, but without seeing all of the code in question, it's really hard to say what is going on.

Sorry I can't be more help.

Steph [ Register or login to view links on this board. ]
The IT Portal for IT People!
[ Register or login to view links on this board.]



Back to top Reply with quote
#8   re: page won't display for logged in user
Nuggy
CZ Newbie
Nuggy has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Sep 05, 2004
0.00 posts per day
Posts: 7
Points: 418
   
well I listed the error message, do you know what that error means? or were you just hoping to debug my code by chance? icon_wink.gif jk



Back to top Reply with quote
#9   Re: re: page won't display for logged in user
64bitguy
CZ Super Newbie
64bitguy has been a member for over 20 year's 20 Year Member
usa.gif newhampshire.gif
Occupation: IT Guru, IT Portal Operator
Website:
Status: Offline
Joined: Sep 04, 2004
0.00 posts per day
Posts: 34
Points: 2,699
   


Originally posted by Nuggy @ Sun Sep 05, 2004 11:04 pm:

Um, I sorta made the php code... there is just one command causing the error for logged in users... the file_get_contents one and the module is just like any other module that uses the php command 'include' to have a php file the main content for that module.

Here is what the module code looks like... icon_smile.gif

<?php
if (!eregi("modules.php", $PHP_SELF)) {
die ("You can't access this file directly...");
}
$index = 1;
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
include("header.php");
OpenTable();
include("file.php");
CloseTable();
include("footer.php");
?>


here is the line out of file.php that gives an error only for logged in users...

if (!function_exists('file_get_contents')) {
$r = fread($file, 80000);
}
else {
$r = file_get_contents($URL);
}


Hopefully this may be helpful? Thanks a bunch!!

It's a different context of using it as:

}
if (!function_exists('file_get_contents')) {
   function file_get_contents($filename) {
     if ($handle = @fopen($filename,'whatever')) {
       $data = fread($handle, filesize($filename));
       fclose($fh);
       return $data;
     } else {
       return false;
     }
   }
}
if (!function_exists('constant')) {
   function constant($constant) {
     eval("\$temp=$constant;");

     return $temp;
}

The context is that the return on using that command for file handling on failure, will always be false.

If it's a url value, or has spaces or odd characters in the definition, it must be wrapped differently with a $uri.

<?php
$url = 'http://example.com/with funny characters';
list($protocol, $uri) = split('//', $url);
$html = file_get_contents($protocol . '//' . urlencode($uri));
?>


Without seeing it all, it's hard to say if it's right or wrong the way it is, but expect if you have any spaces or a url in there, it's wrong and the value will return as false and you'll get an error. Wrap your link in a uri and you probably won't.

Hope that helps
Steph [ Register or login to view links on this board. ]
The IT Portal for IT People!
[ Register or login to view links on this board.]


Back to top Reply with quote
#10   re: page won't display for logged in user
Nuggy
CZ Newbie
Nuggy has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Sep 05, 2004
0.00 posts per day
Posts: 7
Points: 418
   
sweet idea Steph, I'll give it a try next chance I get. Thank you!!!



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum