if ($p_rate < 1 || $p_rate > 5) {
        $success = false;
        array_push($errors, "Please provide a valid rate.");
    }
    if ($p_comment == '') {
        $success = false;
        array_push($errors, "The comment field is required!");
    }
    if ($p_comment != '' && !preg_match('/^[\\s\\S]{0,500}$/u', $p_comment)) {
        $success = false;
        array_push($errors, "The comment must be no more than 500 character long.");
    }
    if ($success) {
        $update = array('rate' => $p_rate, 'comment' => $p_comment);
        AdReview::update($g_id, $update);
        $adreview = AdReview::get_one($g_id);
    }
}
include "page-header.php";
?>

<div id="wrapper">

	<?php 
include "page-left.php";
?>

	<div id="content">
			
		<form name="form_adreview_edit" id="form_adreview_edit" method="post" enctype='application/x-www-form-urlencoded' accept-charset="UTF-8" class="form">