so

PHP Code:
<?php
if ($_GET['main_page'] == 'create_account' && CREATE_ACCOUNT_VALIDATION == 'true' || $_GET['main_page'] == 'login' && LOGIN_VALIDATION == 'true') { 
?>

<?php
  
if ($is_read_only == false || $_GET['main_page'] == 'create_account' || $_GET['main_page'] == 'login') {
    
$sql "DELETE FROM " TABLE_ANTI_ROBOT_REGISTRATION " WHERE timestamp < '" . (time() - 3600) . "' OR session_id = '" zen_session_id() . "'";
    if( !
$result $db->Execute($sql) ) { die('Could not delete validation key'); }
    
$reg_key generate_captcha_code();
    
$sql "INSERT INTO "TABLE_ANTI_ROBOT_REGISTRATION " VALUES ('" zen_session_id() . "', '" $reg_key "', '" time() . "')";
    if( !
$result $db->Execute($sql) ) { die('Could not check registration information'); }
?>
and

PHP Code:
<?php
if ($_GET['main_page'] == 'contact_us') && CONTACT_US_VALIDATION == 'true' 
?>

<?php
  
if ($is_read_only == false || ($_GET['main_page'] == 'contact_us')) || (strstr($_SERVER['REQUEST_URI'],'login'))) {
    
$sql "DELETE FROM " TABLE_ANTI_ROBOT_REGISTRATION " WHERE timestamp < '" . (time() - 3600) . "' OR session_id = '" zen_session_id() . "'";
    if( !
$result $db->Execute($sql) ) { die('Could not delete validation key'); }
    
$reg_key generate_captcha_code();
    
$sql "INSERT INTO "TABLE_ANTI_ROBOT_REGISTRATION " VALUES ('" zen_session_id() . "', '" $reg_key "', '" time() . "')";
    if( !
$result $db->Execute($sql) ) { die('Could not check registration information'); }
?>
is this the correct way ?

thanks for your help
bryan