If you are not registered or logged in, you may still use these forums but with limited features. Show recent topics
  [Search] Search   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [FAQ]  FAQ 
[Register] Register / 
[Login] Login 
poll - fclose() error  XML
Forum Index » Support Forum
Author Message
stevendude
Beginner

Joined: 03/08/2004 05:58:40
Messages: 26
Location: CA
Offline

I just downloaded and installed the poll becasue I want to quit using the Bravenet poll that I currently use. I changed permissions as per the readme file. But when I access mydomain/poll/admin I get the following errors:

Warning: fclose() has been disabled for security reasons in /home/obsessed/public_html/poll/include/class_template.php on line 75

Warning: Cannot modify header information - headers already sent by (output started at /home/obsessed/public_html/poll/include/class_template.php:75) in /home/obsessed/public_html/poll/admin/common.inc.php on line 15

Warning: Cannot modify header information - headers already sent by (output started at /home/obsessed/public_html/poll/include/class_template.php:75) in /home/obsessed/public_html/poll/admin/common.inc.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at /home/obsessed/public_html/poll/include/class_template.php:75) in /home/obsessed/public_html/poll/admin/common.inc.php on line 17

Warning: Cannot modify header information - headers already sent by (output started at /home/obsessed/public_html/poll/include/class_template.php:75) in /home/obsessed/public_html/poll/admin/common.inc.php on line 18

The login box shows below that but a graphic is missing. Please help!

Thank you

Stevendude
www.obsessed-with-music.com
[WWW]
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

fclose has been banned but not fopen :-/ really stupid security that one. I came across this problem with the guestbook on some servers and the fix is easy. I'm about to hit the sack after a 12 hour night shift so will look at the code later. So long as it's only the template stuff I should be able to replace the fopen, fread, fclose bit with just file_get_contents

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
Anonymous



Thank you, I appreciate whatever help you can be with this.
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

Sorry forgot all about this busy and all that

Open class_templates.php

replace


with


Should work but as I haven't tried it no promises.

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
Anonymous



That worked! But now, on the next page I get the errors below:

What should I substitute there?


Warning: fclose() has been disabled for security reasons in /home/obsessed/public_html/poll/include/class_session.php on line 52

Warning: Cannot modify header information - headers already sent by (output started at /home/obsessed/public_html/poll/include/class_session.php:52) in /home/obsessed/public_html/poll/admin/common.inc.php on line 15

Warning: Cannot modify header information - headers already sent by (output started at /home/obsessed/public_html/poll/include/class_session.php:52) in /home/obsessed/public_html/poll/admin/common.inc.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at /home/obsessed/public_html/poll/include/class_session.php:52) in /home/obsessed/public_html/poll/admin/common.inc.php on line 17

Warning: Cannot modify header information - headers already sent by (output started at /home/obsessed/public_html/poll/include/class_session.php:52) in /home/obsessed/public_html/poll/admin/common.inc.php on line 18


Thank you!!!
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

At a guess the same thing that is in class_templates.php exists in class_session.php. Open it in a text editor and look for the same as before.

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
stevendude
Beginner

Joined: 03/08/2004 05:58:40
Messages: 26
Location: CA
Offline

That file is a little different. The error is from the fclose in this chunk of code (below). How can I fix this one? Thanks!!

function generate_new_session_id($user_id) {
srand((double)microtime()*1000000);
$session = md5 (uniqid (rand()));
$unix_time = time();
$config="<?php\n";
$config.="\$auth['session']=\"$session\";\n";
$config.="\$auth['uid']=\"$user_id\";\n";
$config.="\$auth['expire']=\"$unix_time\";\n";
$config.="?>";
$fp = fopen("$this->include_path/session.php","w");
flock($fp, 2);
fwrite($fp, $config);
flock($fp, 3);
fclose($fp);
return $session;
}
[WWW]
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

Ah you are using the text version of the poll. This could be a problem. Let me look into it. Still say it's weird locking fclose but not fopen.

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
stevendude
Beginner

Joined: 03/08/2004 05:58:40
Messages: 26
Location: CA
Offline

I have emailed my hosting company about why they are disabling fclose, have not heard back yet. Thank you for any work-around you can provide.
[WWW]
stevendude
Beginner

Joined: 03/08/2004 05:58:40
Messages: 26
Location: CA
Offline

Thanks for any help.

My hosting company is giving me the run-a-round.
Is there a fix for this fclose being disabled?
Can I use something else instead?
And, please be patient with me, what happens if I just delete that line(s) and don't fclose at all (will it work)?
[WWW]
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

I'm trying to see if there is a different way to write to files.

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
stevendude
Beginner

Joined: 03/08/2004 05:58:40
Messages: 26
Location: CA
Offline

Thank you, that would be great. Another developer told me that he thought, that anything that I did an fopen() for, would automatically be closed when the script terminates. Other than sloppy coding, is this true?

But yes, it there is a better way that is fine too.
[WWW]
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

In theory yes. But it may end up corrupting the file in some extreme cases. Make a regular back up of the files and you should be ok.

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
 
Forum Index » Support Forum
Go to:   
Based on the open source JForum