Fatal error

Dr. GBooky is here to help you with your guestbook problems ...
Post Reply
Rienk
Posts: 1
Joined: Thu Jun 01, 2006 8:41 am

Fatal error

Post by Rienk »

Script URL: http://www.eastermar.nl/php/gbook14/gbook.php
Version of script: Version: 1.41
Version of PHP: PHP Version 4.1.2
Hosting company: syntraks
Have you searched THIS FORUM for your problem:
(if not please do before posting)
If so, what terms did you try:
fatal error, no solutions found
Write your message below:

The first time to put in entry wurks allright, every other time this message appears:

Fatal error: Call to undefined function: session_regenerate_id() in /home/sites/site033/web/php/gbook14/gbook.php on line 49

It looks there are more people with this problem but I couldn't find the solution in this forum
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Hi,

You have too old version of PHP (PHP Version 4.1.2), you need at least PHP 4.3

Ask your host to update their PHP version to 4.4 because 4.1.2 is a very old and not secure version.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
gtk
Posts: 2
Joined: Mon Jun 19, 2006 5:32 pm

Post by gtk »

For those who cannot upgrade their PHP version, you can try this easy modification to get around the "Call to undefined function: session_regenerate_id()" error . I found this workaround over at php discussion forums. ( http://us3.php.net/session_regenerate_id )

Make backups first !!!!

#1 In the directory where you have installed guestbook, create a new file called
chk_sess_func.php and cut and paste the followign code into it.
<?php
if (!function_exists('session_regenerate_id')) {
function php_combined_lcg() {
$tv = gettimeofday();
$lcg['s1'] = $tv['sec'] ^ (~$tv['usec']);
$lcg['s2'] = posix_getpid();

$q = (int) ($lcg['s1'] / 53668);
$lcg['s1'] = (int) (40014 * ($lcg['s1'] - 53668 * $q) - 12211 * $q);
if ($lcg['s1'] < 0)
$lcg['s1'] += 2147483563;

$q = (int) ($lcg['s2'] / 52774);
$lcg['s2'] = (int) (40692 * ($lcg['s2'] - 52774 * $q) - 3791 * $q);
if ($lcg['s2'] < 0)
$lcg['s2'] += 2147483399;

$z = (int) ($lcg['s1'] - $lcg['s2']);
if ($z < 1) {
$z += 2147483562;
}

return $z * 4.656613e-10;
}

function session_regenerate_id() {
$tv = gettimeofday();
$buf = sprintf("%.15s%ld%ld%0.8f", $_SERVER['REMOTE_ADDR'], $tv['sec'], $tv['usec'], php_combined_lcg() * 10);
session_id(md5($buf));
if (ini_get('session.use_cookies'))
setcookie('PHPSESSID', session_id(), NULL, '/');
return TRUE;
}
}
?>
Sorry, but for some reason the indentions do not line up correctly in this post.

#2 Save the file

#3 edit your gbook.php and find require_once('settings.php');
Add this line right under it.
require('chk_sess_func.php');
#4 Save your work & test.

----------------------------------------------
geekster
Posts: 1
Joined: Mon Jun 19, 2006 8:27 pm

Post by geekster »

gtk wrote:For those who cannot upgrade their PHP version, you can try this easy modification to get around the "Call to undefined function: session_regenerate_id()" error . I found this workaround over at php discussion forums. ( http://us3.php.net/session_regenerate_id )

Make backups first !!!!
//much snipped\\
I was also seeing this error even though working under PHP 4.3.0 under FreeBSD - tried the fix you posted and all problems with session_regenerate_id() went away.

Many thanks!

-=geekster=-
So many toys.... So little time...
Villa Bussola
Posts: 9
Joined: Tue Jul 25, 2006 8:25 am

Post by Villa Bussola »

Hi there,


I have the same problem with:
Fatal error: Call to undefined function: session_regenerate_id() in /home/sites/site033/web/php/gbook14/gbook.php on line 49
My hostingcompany is running PHP Version 4.1.2

I tried the workaround posted by "gtk" with the following result:

When i open the guestbook now, at the top there are these messages:
Warning: Cannot add header information - headers already sent by (output started at /home/httpd/vhosts/villabussola.com/httpdocs/guestbook/chk_sess_func.php:37) in /home/httpd/vhosts/villabussola.com/httpdocs/guestbook/gbook.php on line 852

Warning: Cannot add header information - headers already sent by (output started at /home/httpd/vhosts/villabussola.com/httpdocs/guestbook/chk_sess_func.php:37) in /home/httpd/vhosts/villabussola.com/httpdocs/guestbook/gbook.php on line 853

Warning: Cannot add header information - headers already sent by (output started at /home/httpd/vhosts/villabussola.com/httpdocs/guestbook/chk_sess_func.php:37) in /home/httpd/vhosts/villabussola.com/httpdocs/guestbook/gbook.php on line 854

Warning: Cannot add header information - headers already sent by (output started at /home/httpd/vhosts/villabussola.com/httpdocs/guestbook/chk_sess_func.php:37) in /home/httpd/vhosts/villabussola.com/httpdocs/guestbook/gbook.php on line 855
And underneath these messages the normal guestbook starts.


Anny idees on how to solve this?
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

You should delete any blank lines or extra (html) code you have before <?php or after ?> in chk_sess_func.php file.

If that doesn't work you can try changing line 49 in gbook.php from

Code: Select all

session_regenerate_id();
to

Code: Select all

// session_regenerate_id();
Like mentioned before you should also ask your host to UPDATE their PHP version from the old an buggy version to a never and more secure one.


Oh, by the way, I never said "thanks" to gtk for sharing, so thanks :)
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Villa Bussola
Posts: 9
Joined: Tue Jul 25, 2006 8:25 am

Post by Villa Bussola »

Thanks Klemen,

I did ask my host and they actually transfered my site to a server with PHP version 4.3.9. So that solved the problem!

But.....
when i was configuring the site again, first thing that happened was ,
I got a spam entry in my guestbook.
i'm running the latest version of guestbook,

junkmark_limit']=60;

Only thing I allow is "your website"
Hello!

Someone has just signed your guestbook!

Name: ForisMo
From: Argetina
E-mail: nax_z@yahoo.com
Website: http://thanks4.atspace.com

Message (without smileys):
Welcome!


Visit the below URL to view your guestbook:
http://www.villabussola.com/guestbook/gbook.php

End of message
it came from this ip
This post has been submitted from: 203.150.49.80 (203-150-49-80.inter.net.th)
Just to let you know.

Greetz Peter
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Hi,

Try this:
viewtopic.php?p=3970#3970

Also come back in a day or two, a new GBook update should be out with fixes to this kind of spam.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Villa Bussola
Posts: 9
Joined: Tue Jul 25, 2006 8:25 am

Post by Villa Bussola »

Klemen,

Thanks for that.

I updated to 1.42 rev 2

I'll let you know what happens.

Greetz Peter

By the way, really love the guestbook!
kor.middel
Posts: 3
Joined: Mon Jul 31, 2006 6:49 pm

Fatal error: Call to undefined function: gbook_input()

Post by kor.middel »

URL:www.lesboulesfleuries.nl
Version of script:134
Version of PHP: ?
Host: unix
Have you searched for your problem: Yes
If so, what terms did you try:

After a update of my site the guestbook does'nt work anymore.
however I did not modify gbook ad all.
I get the following error.

Fatal error: Call to undefined function: gbook_input() in /home/boules/public_html/gbook134_xhtml/gbook.php on line 118

What causes the error?


I use this version of the gbook:

php
# PHP guestbook (GBook)
# Modificiation version: HL.03 - Dec 14, 2005
# Based on Gbook version: 1.34
# File last modified: November 16 2005 18:08
# File name: gbook.php
# Written 27th December 2004 by Klemen Stirn (info@phpjunkyard.com)
# http://www.PHPJunkYard.com
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

hello Kor,

On line 118 is this function

Code: Select all

$ip=gbook_input($_SERVER['REMOTE_ADDR']);
which is part of the ipban function which i have added to the XHTML version of GBook.

The only thing i can think of is that your server does not understand the $_SERVER['REMOTE_ADDR'] request, which i can't really believe.
Has anything on your server changed?

Please upload the following file to your server (the phpinfo.php file inside the zip file) and post a link to it in this forum, then we'll have a look:
http://www.phpjunkyard.com/extras/phpinfo.zip

Greetings,
Henrie
kor.middel
Posts: 3
Joined: Mon Jul 31, 2006 6:49 pm

Post by kor.middel »

Henrie this is the the link
Thanks for helping me out of this problem.
Regards Kor Middel

http://www.lesboulesfleuries.nl/gbook13 ... hpinfo.php


quote="Henrie"]hello Kor,

On line 118 is this function

Code: Select all

$ip=gbook_input($_SERVER['REMOTE_ADDR']);
which is part of the ipban function which i have added to the XHTML version of GBook.

The only thing i can think of is that your server does not understand the $_SERVER['REMOTE_ADDR'] request, which i can't really believe.
Has anything on your server changed?

Please upload the following file to your server (the phpinfo.php file inside the zip file) and post a link to it in this forum, then we'll have a look:
http://www.phpjunkyard.com/extras/phpinfo.zip

Greetings,
Henrie[/quote]
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Hi,

Kor, if you get the undefined function error I suggest that you upload your gbook.php file again and don't make any changes at all to it.

You should also consider getting the latest modified version from Henrie:
viewtopic.php?p=4052#4052

Regards,
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

Hello Kor,

I just looked at your phpinfo.php file results and the $_SERVER['REMOTE_ADDR'] is not the problem.

I don't know if you use the ipban function but you also could remove it out of the gbook.php file to to test if that solves the problem.
To do this, find the following lines (in XHTML version 1.34 mod HL.03) and remove them:

Code: Select all

$ip=gbook_input($_SERVER['REMOTE_ADDR']);
$checkban =1; 
foreach ($settings['checkip'] as $banlist)
{if (preg_match("/$banlist/i",$ip)) 
{$checkban=0; break; } } 
if (!$checkban) 
{problem($lang['err11']);} 
Although i don't think that the error message will disappear, i think you will get the same error with a different line number.

I think you should also try the solutions suggested by Klemen, and upgrading is always good.

Greetings,
Henrie
kor.middel
Posts: 3
Joined: Mon Jul 31, 2006 6:49 pm

Post by kor.middel »

Henrie,
I solved the problem by restoring a backup.
I don't no why but for some reason the contents of the gbook file was changed. I located it by comparing my backup and the current file.
Thank you for your time end effort.
I will implement your new version ASAP.
Best regards kor Middel

Henrie wrote:Hello Kor,

I just looked at your phpinfo.php file results and the $_SERVER['REMOTE_ADDR'] is not the problem.

I don't know if you use the ipban function but you also could remove it out of the gbook.php file to to test if that solves the problem.
To do this, find the following lines (in XHTML version 1.34 mod HL.03) and remove them:

Code: Select all

$ip=gbook_input($_SERVER['REMOTE_ADDR']);
$checkban =1; 
foreach ($settings['checkip'] as $banlist)
{if (preg_match("/$banlist/i",$ip)) 
{$checkban=0; break; } } 
if (!$checkban) 
{problem($lang['err11']);} 
Although i don't think that the error message will disappear, i think you will get the same error with a different line number.

I think you should also try the solutions suggested by Klemen, and upgrading is always good.

Greetings,
Henrie
Post Reply