Page 1 of 1

Hesk Rating not working throw a blank page after store rate

Posted: Sat Aug 24, 2013 10:29 pm
by Monclee
Script URL: Not yet localhost
Version of script: 2.4.2
Hosting company: -NA-
URL of phpinfo.php: -NA-
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

hesk raiting blank page, hesk rating not working, rating php errors hesk,

Write your message below:

I just made a fresh install of hesk in my system the funny thing is rating is working, but the "location" in php is not working cause after you rank you stay on a blank page, you do not return no the previews page.. as it suppose..

I check the php code..

Code: Select all

/* Rating? */
if (isset($_GET['rating']) && !hesk_detect_bots())
{
	$rating = intval($_GET['rating']);

	/* Rating can only be 1 or 5 */
	if ($rating != 1 && $rating != 5)
	{
		hesk_error($hesklang['attempt']);
	}

    $artid = intval($_GET['id']) or hesk_error($hesklang['kb_art_id']);

    $_COOKIE['hesk_kb_rate'] = isset($_COOKIE['hesk_kb_rate']) ? $_COOKIE['hesk_kb_rate'] : '';

    if (strpos($_COOKIE['hesk_kb_rate'],'a'.$artid.'%')===false)
    {
		$sql = 'UPDATE `'.hesk_dbEscape($hesk_settings['db_pfix']).'kb_articles` SET `rating`=((`rating`*`votes`)+'.hesk_dbEscape($rating).')/(`votes`+1), `votes`=`votes`+1 WHERE `id`=\''.hesk_dbEscape($artid).'\' AND `type`=\'0\' LIMIT 1';
		hesk_dbQuery($sql);
    }
	echo "merin";
    setcookie('hesk_kb_rate', $_COOKIE['hesk_kb_rate'].'a'.$artid.'%', time()+2592000);
    header('Location: knowledgebase.php?article='.$artid.'&rated=1');
    exit();
}

As you can see i add a line (echo "merin";) just to test, and it actually echo this ok.. so the problem must be on setcookie or the header location , but i dont get any erros.

Any ideas?

I need to present this project to a client, if he aprobes i will buy license, but this must work to show everythings works, or he will not want to buy

Re: Hesk Rating not working throw a blank page after store

Posted: Sun Aug 25, 2013 6:41 pm
by Klemen
I am 99% sure this is a problem with broken headers.

Did you modify any of the files?

This usually happens when files are modified and saved as UTF with BOM, for example if a language file is modified and saved as UTF-8 with BOM (viewtopic.php?t=2713).

Can't say for sure without seeing it though.

Re: Hesk Rating not working throw a blank page after store

Posted: Sun Aug 25, 2013 6:43 pm
by Klemen
Also, you should upgrade to version 2.5.1 and check if it works fine with default unmodified files (and English language pack).