check_result()){ add_message(LNG_ERROR_BAD_CAPTCHA, 'error'); } if ($_POST['s_gbook_name'] == '') { add_message(LNG_ERROR_BAD_NAME, 'error'); } if (! ereg("^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+", $_POST['s_gbook_email'])) { add_message(LNG_ERROR_BAD_EMAIL, 'error'); } if ($_POST['s_gbook_comment'] == '') { add_message(LNG_ERROR_BAD_COMMENT, 'error'); } if (!is_messages()) { $oGbookEntity = & new GbookEntity(0, $oDesign->oSite->GetId(), $_SESSION['iLanguageId']); $oGbookEntity->Import($_POST); $oGbookEntity->SetIp($_SERVER['REMOTE_ADDR']); $oGbookEntity->SetDate('NOW()'); if ($oGbookEntity->Insert()) { add_message(LNG_SUCCESS_INSERT); } else { add_message(LNG_ERROR_INSERT, 'error'); } } else { save_data($_POST); } redir(); } $oPager = & new Pager(); $oPager->Query('SELECT * FROM gbook ORDER BY gbook_date DESC'); $oDesign->assign_by_ref('oPager', $oPager); $oDesign->SetTitle("Guest Book"); $oDesign->assign('aData', load_data()); $oDesign->ShowPage('gbook.tpl'); ?>