Administrator password problem

Dr. GBooky is here to help you with your guestbook problems ...
Post Reply
jwebcode
Posts: 1
Joined: Thu Feb 02, 2012 1:40 pm

Administrator password problem

Post by jwebcode »

Script URL: Gbook
Version of script: 1.7
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:
administrator password error
Write your message below:

Hi,
your script is great, but I've found a bug. I've tried to serach a solution in the forum, but I didn't find.
When I reply to a post, I've noticed that if the password is not entered, I see the error message but in the same time the reply message is published.
I've correct this bug changing the origina postreply function

Code: Select all


function postReply()
{
	global $settings, $lang;

    $error_buffer = '';

	$num = isset($_POST['num']) ? intval($_POST['num']) : false;
    if ($num === false)
    {
    	problem($lang['e02']);
    }

    /* Check password */
    if (empty($_POST['pass']))
    {
    	$error_buffer .= $lang['e09'] . '<br />';
		print_r($_POST);
    }
    elseif ( gbook_input($_POST['pass']) != $settings['apass'] )
    {
    	$error_buffer .= $lang['e12'];
    }// else {

    /* Check message */
    $comments = (isset($_POST['comments'])) ? gbook_input($_REQUEST['comments']) : false;
    if (!$comments)
    {
    	$error_buffer .= $lang['e10'];
        $comments = '';
    }

    /* Any errors? */
    if ($error_buffer)
    {
		$error_buffer;
    	writeReply($error_buffer);
    } else { //START INSERT REPLY

		writeReply($error_buffer, $comments);
	
	} //END INSERT REPLY
	
	/* All OK, process the reply */
	$comments = wordwrap($comments,$settings['max_word'],' ',1);
	$comments = preg_replace('/\&([#0-9a-zA-Z]*)(\s)+([#0-9a-zA-Z]*);/Us',"&$1$3; ",$comments);
	$comments = preg_replace('/(\r\n|\n|\r)/','<br />',$comments);
	$comments = preg_replace('/(<br\s\/>\s*){2,}/','<br /><br />',$comments);
	if ($settings['smileys'] == 1 && !isset($_REQUEST['nosmileys']) )
    {
    	$comments = processsmileys($comments);
    }

	$myline = array(0=>'',1=>'',2=>'',3=>'',4=>'',5=>'',6=>'',7=>'',8=>'');
	$lines  = file($settings['logfile']);
	$myline = explode("\t",$lines[$num]);
	foreach ($myline as $k=>$v)
    {
		$myline[$k]=rtrim($v);
	}
	$myline[7] = $comments;
	$lines[$num] = implode("\t",$myline)."\n";
	$lines = implode('',$lines);
	$fp = fopen($settings['logfile'],'wb') or problem($lang['e13']);
	fputs($fp,$lines);
	fclose($fp);
	}
    /* Notify visitor? */
    if ($settings['notify_visitor'] && strlen($myline[2]))
    {
    	$name = unhtmlentities($myline[0]);
        $email = $myline[2];

	    $char = array('.','@');
	    $repl = array('&#46;','&#64;');
	    $email=str_replace($repl,$char,$email);
		$message = sprintf($lang['t76'],$name)."\n\n";
        $message.= sprintf($lang['t77'],$settings['gbook_title'])."\n\n";
        $message.= "$lang[t78]\n";
        $message.= "$settings[gbook_url]\n\n";
        $message.= "$lang[t79]\n\n";
        $message.= "$settings[website_title]\n";
        $message.= "$settings[website_url]\n";

	    mail($email,$lang['t80'],$message,"From: $settings[website_title] <$settings[admin_email]>\nReply-to: $settings[admin_email]\nReturn-path: $settings[admin_email]\nContent-type: text/plain; charset=".$lang['enc']);

	define('NOTICE', $lang['t12']);

} // END postReply

Now if I reply to a post without enter the password I see the error message, but the reply is not published.
But I've another problem. After published the reply, the reply form is visible and i can't return to the board.
How can I redirect the visitor to the board?

Thanks.

PS: excuse me for my bad english. :)
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Administrator password problem

Post by Klemen »

I just tested this and I am NOT able to post a reply without a password. Feel free to test the demo here:
http://www.phpjunkyard.com/gbook/gbook.php

This bug is probably due to your editing of gbook.php file? Try uploading the original gbook.php back to the server.
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
Post Reply