<?

require("config.php");
require("funcs1.php");
$msgs_fl="msg1_".$intlang.".php"; require("$msgs_fl");
$msgs_fl="msg2_".$intlang.".php"; require("$msgs_fl");
#############################################################
$check_key="1h";
$prstop_key="2h";

$id_hl=$HTTP_COOKIE_VARS['idhl'];
$var_cook=$HTTP_COOKIE_VARS['vckh'];
if ($HTTP_GET_VARS['md']=="finish"){fin_close();}
if ($var_cook==$prstop_key){ incorr_proc2();}

if ($HTTP_COOKIE_VARS['chvlh']!="2") {incorr_proc();} 
 
 
if ($var_cook!=$check_key){
setcookie("vckh", $check_key);
}

if (($HTTP_GET_VARS['md']=="hlt") or ($id_hl!="")){ setcookie("chvlh", "0"); hlt_ad();  }
if ($HTTP_GET_VARS['md']==""){print_hltform();}
print_hltform();

exit;


function hlt_ad()
{
global $HTTP_POST_VARS, $prstop_key, $table_ads, $id_hl, $html_header, 
$html_footer, $msg, $msg2;

$ad_id=$HTTP_POST_VARS['lhtid'];
if ($id_hl!=""){$ad_id=$id_hl; setcookie("idhl", "");}

connect_to_db();
$sql_query="update $table_ads set adrate=1 
where idnum=$ad_id ";
mysql_query("$sql_query");

setcookie("vckh", $prstop_key);
echo $html_header;
echo "
<center><table width='500'><tr><td>
<font FACE='ARIAL, HELVETICA' COLOR='BLACK'> <font size=-1>
<b><a href='index.php'>".$msg['top'].":</a></b></font>
&nbsp; 
</font> 
<hr size='1'>
<p>
<font FACE='ARIAL, HELVETICA' COLOR='#000088' size='-1'>
<b>
".$msg2['Your_ad_hl']." #$ad_id ".$msg2['highlt_success']."
</b><p>
<a href='hltads.php?md=finish'>
".$msg2['cl_to_finish_s']."
</font>

</td></tr></table></center>
$html_footer
";

exit;
}

function print_hltform()
{
global $html_footer, $html_header, $msg, $msg2;
echo $html_header;
echo "
<center><table width='500'><tr><td>
<font FACE='ARIAL, HELVETICA' COLOR='BLACK'> <font size=-1>
<b><a href='index.php'>".$msg['top'].":</a></b></font>
&nbsp; 
</font> 
<hr size='1'>
<p>
<font FACE='ARIAL, HELVETICA' COLOR='#000088' size='-1'>
<form action='hltads.php?md=hlt' method='post'>
".$msg2['Input_ad_id_hl'].": <input type='text' size='5' name='lhtid'>
<input type='submit' value='".$msg2['Submit_hl']."'>
<p>
</font>

</td></tr></table></center>
$html_footer
";
 
exit;
}

function incorr_proc()
{

global $html_footer, $html_header, $msg, $msg2;
echo $html_header;
echo "
<center><table width='500'><tr><td>
<font FACE='ARIAL, HELVETICA' COLOR='BLACK'> <font size=-1>
<b><a href='index.php'>".$msg['top'].":</a></b></font>
&nbsp; 
</font> 
<hr size='1'>
<p>
<font FACE='ARIAL, HELVETICA' COLOR='#000088' size='-1'>
<b> ".$msg2['Incorr_processing_hl']."<br>
<a href='hltads.php?md=finish'>
".$msg2['cl_to_finish_s']."
</b>
<p>
</font>
</td></tr></table></center>
$html_footer
";

exit;
}

function incorr_proc2()
{

global $html_footer, $html_header, $id_hl, $msg, $msg2;
echo $html_header;
echo "
<center><table width='500'><tr><td>
<font FACE='ARIAL, HELVETICA' COLOR='BLACK'> <font size=-1>
<b><a href='index.php'>".$msg['top'].":</a></b></font>
&nbsp; 
</font> 
<hr size='1'>
<p>
<font FACE='ARIAL, HELVETICA' COLOR='#000088' size='-1'>

<p><b>
".$msg2['Your_ad_hl']."<a href='index.php?md=details&id=$id_hl'> #$id_hl</a>
".$msg2['already_highlighted']."
<p><a href='hltads.php?md=finish'>
".$msg2['cl_to_finish_s']."
</b>
</font>
</td></tr></table></center>
$html_footer
";

exit;

}

function fin_close()
{
setcookie("vckh", "");
echo "
<html>
<body onload='self.close()'>
</body>
</html>
";
exit;
}

?>