<?

function output_message($message)
{
global $cat_fields, $photos_count, $html_header, $html_footer, $id,
$ct, $categories, $ad_second_width, $left_width_sp, $exp_period, $msg;
echo $html_header;
echo "
<center><table width='600'><tr><td>
<font FACE='ARIAL, HELVETICA' COLOR='BLACK'> <font size=-1>
<b><a href='index.php'>".$msg['top'].":</a></b></font>
&nbsp; 
<font FACE='ARIAL, HELVETICA' COLOR='#000099'> 
<b>&nbsp; 
<a href='index.php?ct=$ct'>".$categories[$ct][0]."
</b></a> 
</font> 
<hr size='1'><p>
$message
<p><hr size='1'>
</tr></td></table>
</center>
";
echo $html_footer;
exit;
}
 
function getuseradsnum($searchemail)
{
global  $table_mb;
$sql_query="select count(idnum) from $table_mb where email='$searchemail' and visible=1";
$sql_res=mysql_query("$sql_query");
$row = mysql_fetch_row($sql_res);
$mcount=$row[0];

return $mcount;
}


function check_email($email)
{
global $msg2;
$email=ereg_replace(' ', '', $email);
$a1=split('@', $email);
$a2=split('\.',$email);
if (($a1[0] == "") or ($a1[1] == "") or ($a2[0] == "") or ($a2[1] == ""))
{
$message="
<font FACE='ARIAL, HELVETICA' COLOR='#000000' >
<b> ".$msg2['email_3']." <font color='#AA0000'> $email</font> ".$msg2['has_incr_format']." </b>  
 <font size='-1' color='#000088'>
<p> ".$msg2['return_and_fillfl']."
</font></font>
";
output_message($message);
exit;
}
return $email;
}




function get_date($time1)
{
$d=getdate($time1);
$date_string=$d['month']." ".$d['mday'].", ".$d['year'];
return $date_string;
}

function get_ad_details($id)
{
global $cat_fields, $table_mb;
$sql_query="select * from $table_mb where idnum=$id";
$sql_res=mysql_query("$sql_query");
$row = mysql_fetch_array ($sql_res);
if ($row['idnum']==""){
$message="
<font FACE='ARIAL, HELVETICA' COLOR='#880000' >
<b>
No Ad with ID# $id
</b>
</font>
";
output_message($message);
exit;
}
return $row; 
}

function get_edit_info($ed_id)
{
global $cat_fields, $table_mb;
$sql_query="select * from $table_mb where idnum=$ed_id";
$sql_res=mysql_query("$sql_query");
$row = mysql_fetch_array ($sql_res);

foreach ($row as $key => $value)
{
$row[$key]=ereg_replace("'", "&#039;", $row[$key]);
}
return $row; 
}

function delete_ad($ed_id)
{
global  $table_mb, $msg2;
$sql_query="delete from $table_mb where idnum=$ed_id";
mysql_query("$sql_query");
 

$message="
<font FACE='ARIAL, HELVETICA' COLOR='BLACK'> 
<b> ".$msg2['your_profile_deleted']." </b>
</font>
";
output_message($message);
exit;
}

function get_cat_count($ct)
{
global $cat_fields, $table_mb,  $page, $adsonpage; 
 
 
$sql_query="select count(idnum) from $table_mb where 
catname='$ct' and visible=1";
 
$sql_res=mysql_query("$sql_query");
$row=mysql_fetch_row($sql_res);
$count=$row[0];
return $count;
}

function get_date_update($ct)
{
global $cat_fields, $table_mb,  $page, $adsonpage; 
$sql_query="select time from $table_mb where 
catname='$ct' and visible=1 order by time desc ";
$sql_res=mysql_query("$sql_query");
$row=mysql_fetch_row($sql_res);
$time1=$row[0];
$date_update=get_short_date($time1);
if ($time1==0) {$date_update="";}
return $date_update;
}


?>
