Jump to content

basic column positioning problem


Go to solution Solved by sxp,

Recommended Posts

The script I'm using is identical to this one http://internationaladvertiser.com/adsnet/cl/ct/merch1/appliances/1.html

 

for some reason I'm having issues positioning the "Title" and "Preview" column after the city column. The "photo" column seems to be stuck also but I have no problem with the position its in right now.

Through the admin control panel your given the option to move certain columns around but even that being the case I'm unable to move the "Title" column where I want even when I try. What is the PHP code needed to do this... or is it html and css?

Link to comment
https://forums.phpfreaks.com/topic/284698-basic-column-positioning-problem/
Share on other sites

 

What is the PHP code needed to do this... or is it html and css?

You need to the find the PHP code that generates the HTML table in order for you to change the column positions, where that is we cant tell you that as we dont have the code to look at. If the script is coded correctly you should be able to edit a template file.

Edited by Ch0cu3r

You need to the find the PHP code that generates the HTML table in order for you to change the column positions, where that is we cant tell you that as we dont have the code to look at. If the script is coded correctly you should be able to edit a template file.

 

I've been looking for that for a while but I cant seem to find the file.... i'll post the code when I find it.

<?php
$ads_fields= array(
"eventdt" => array("event date","00","nosearch","40:50","date","1","date"),
"title" => array("Event Name","00","nosearch","40:50","text","1","varchar(150)"),
"brief" => array("Event Information","12","nosearch","60:5:200","textarea","1","text"),
"initialad" => array("In the initial ad written","00","keyword","40:4:400","textarea","1","text"),
"comment" => array("comment","12","nosearch","40:4:200","text","1","text"),
"contact_name" => array("Date/ Time","2","nosearch","40:50","text","0","varchar(100)"),
"contact_phone" => array("Contact Phone","2","nosearch","20:50","text","0","varchar(100)"),
"email" => array("Contact e-mail","00","nosearch","20:50","text","1","varchar(100)"),
"homeurl" => array("Home Page URL","00","nosearch","40:50","text","0","varchar(100)"),
"passw" => array("Edit/delete password","00","nosearch","20:50","text","1","varchar(50)"),
"name" => array("Country","12","nosearch","40:50","text","1","varchar(100)"),
"country" => array("","12","nosearch","40:50","select","1","varchar(50)", "<option>England<option>France<option>Brazil<option>Portugal<option>Spain<option>Germany"),
"city" => array("Country","12","nosearch","1:30","select","1","varchar(50)", "<option>England<option>France<option>Brazil<option>Portugal<option>Spain"),
"goal" => array("","12","keyword","1:30","select","1","varchar(50)", "<option>France<option>Brazil<option>Portugal<option>Spain"),
"check1" => array("Online/Offline","00","nosearch","1:30","checkbox","0","text", "<option>Online<option>Offline"),
"type" => array("Type","00","keyword","1:30","select","0","varchar(50)", "<option>Wanted<option>Offered"),
"jobtype" => array("Type","00","keyword","1:30","select","0","varchar(50)", "<option>Job Offered<option>Job Wanted"),
"specloc" => array("Event Location","12","nosearch","50:100","text","1","varchar(150)"),
"price" => array("Price","00","minmax","10:30","checkbox","0","float(4,2)", ""),
"salary" => array("Salary","00","minmax","10:30","text","0","integer"),
"company" => array("Company","00","keyword","20:30","text","0","varchar(50)"),
"smoker" => array("Smoker","00","nosearch","1:30","select","0","varchar(50)", "<option>Yes<option>No"),
"age" => array("Age","00","keyword","1:30","select","0","varchar(40)", "<option>18-20<option>20-25<option>25-30<option>30-35<option>35-40<option>40-50<option>more 50"),
"weight" => array("Weight,kg","00","minmax","10:30","text","0","integer"),
"height" => array("Height,cm","00","minmax","10:30","text","0","integer"),
"moredetails" => array("More Details","2","nosearch","60:10:2000","textarea","0","text"),
"addrmap" => array("Map Address","2","nosearch","40:50","text","0","varchar(200)"),
"adfld1" => array("Start Date/ Start Time","12","nosearch","40:50","text","0","text"),
"keywords" => array("Keywords","2","nosearch","40:50","text","0","text")
);

$fields_sets= array(
'set1' => array( title,name,age,weight,height,smoker,goal,country,city,brief,moredetails,contact_name,contact_phone,email,homeurl,passw,keywords ), 
'set2' => array( title,jobtype,salary,company,country,city,specloc,brief,contact_name,contact_phone,email,homeurl,passw,keywords ), 
'set3' => array( title,type,price,company,country,city,specloc,brief,contact_name,contact_phone,email,homeurl,passw,check1,keywords ), 
'set4' => array( title,initialad,comment,email,homeurl,passw,keywords ), 
'set5' => array( title,country,city,specloc,brief,contact_name,contact_phone,email,homeurl,keywords,passw ), 
'set6' => array( title,country,city,brief,contact_name,contact_phone,email,homeurl,keywords,passw ), 
'set7' => array( city,title,adfld1,contact_name,brief,check1,specloc,brief,moredetails,contact_phone,email,homeurl,keywords,passw ), 
'set8' => array(  ));

$categories= array(

'title_1' => "Community", 
"commun1" => array( "Events", "set7", "")
);
$fields_comm= array(
 "title" => "place title of ads here (any comment for ad field)", 
 "brief" => "main idea of your ad (any comment for ad field)", 
 "age" => "(any comment for ad field)", 
 "homeurl" => "(any comment for ad field)", 
 "email" => "(any comment for ad field)", 
 "moredetails" => "(any comment for ad field)", 
 "contact_name" => "(any comment for ad field)", 
 "contact_phone" => "(any comment for ad field)", 
 "addrmap" => "(address format: <font COLOR='#007700'>number street, city, country</font>)"
);

$reply_catg= array(

);

$fld_dim= array(
 "weight" => "kg", 
 "height" => "cm"
);

$ctgroups_sets= array(
 "1" => "set1", 
 "2" => "set3", 
 "3" => "set3", 
 "4" => "set5", 
 "5" => "set2", 
 "6" => "set3", 
 "7" => "set3", 
 "8" => "set3", 
 "9" => "set5", 
 "10" => "set5"
);

$fld_dimd= array(
 "price" => "$", 
 "salary" => "$"
);
$allcatfields=array( 'title', 'city', 'brief');
$use_adslayer="";
$tbclhlads="";

$fields_layer=array( '' => 'yes');

$mtg_keywrds= array(
 "all" => "almond classifieds, ads,  php scripts, multiple categories,   powerful search, privacy mail,   ads moderating", 
 "job1" => "classifieds, Careers, Jobs", 
 "job2" => "classifieds, Careers, Jobs"
);

$mtg_descr= array(
 "all" => "Classifieds main idea - easy to use, configurate and install; easy set up custom categories, fields, search;", 
 "job1" => "Careers, Jobs", 
 "job2" => "Careers, Jobs"
);
$mtfldkwrs=array( 'city', 'name', 'company', 'goal');
$slctcntr="";

?>

is the php file I should be editing? I assume its the right one.

<?php

# to write root directory for categories first index page instead  "1.html" (yes, no)
$wrtrtdr="yes"; 
  
# to include simultaneously short names and full names of categories into static URL ( yes, no)
$sturlctname="yes";

# to include ad title  into static URL (yes, no)
$sturladtitle="yes";

# max length of ad title in the static URL (yes, no)
$maxlntlsturl="50";


if ($waflnscr=="yes" or $mbac_second=='m'){$sturlvar="no";}

function sturl_top()
{
global $sturlvar, $urlclscrpt;
if ($sturlvar=="yes"){$sturl=$urlclscrpt;}
else {$sturl="index.php";}
return $sturl;
}


function sturl_ct_top($ct,$getcityval, $page)
{
global $_REQUEST, $sturlvar, $urlclscrpt, $categories, $sturlctname, $wrtrtdr;
$cityvar=$_REQUEST['city'];
if ($sturlvar=="yes"){

$pgnvar="{$page}.html"; if ($wrtrtdr=="yes" and $page=="1"){$pgnvar="";}
if ($sturlctname=="yes"){$sturlctvr="/".sturl_replc($categories[$ct][0]);}else{$sturlctvr="/c";}
if ($cityvar!=''){$sturl="{$urlclscrpt}cities/$cityvar/ct/{$ct}{$sturlctvr}/{$pgnvar}";}
else{
$sturl="{$urlclscrpt}ct/{$ct}{$sturlctvr}/{$pgnvar}";
}
}
else {$sturl="index.php?ct=$ct&{$getcityval}";}
return $sturl;
}

function sturl_ads($ct, $id,$title)
{
global $_REQUEST, $sturlvar, $urlclscrpt, $categories, $sturlctname,$sturladtitle;
if ($sturlvar=="yes"){
if ($sturladtitle=="yes"){$sturlctvr="/".sturl_replc($title);}else{$sturlctvr="/c";}
$sturl="{$urlclscrpt}ads{$sturlctvr}-idn{$id}.html";
}
else {$sturl="index.php?ct=$ct&md=details&id=$id";}
return $sturl;
}

function sturl_ct_ind($ct)
{
global $_REQUEST, $sturlvar, $urlclscrpt, $categories, $sturlctname, $wrtrtdr ;
 
if ($sturlvar=="yes"){
if ($sturlctname=="yes"){$sturlctvr="/".sturl_replc($categories[$ct][0]);}else{$sturlctvr="/c";}
$pgnvar="1.html"; if ($wrtrtdr=="yes"){$pgnvar="";}
$sturl="{$urlclscrpt}ct/{$ct}{$sturlctvr}/{$pgnvar}";}else {
$sturl="index.php?md=browse&ct=$ct";
}
return $sturl;
}



function sturl_ct_pgs($ct, $i, $search_str)
{
global $_REQUEST, $sturlvar, $urlclscrpt, $categories, $sturlctname, $wrtrtdr;


if ($sturlvar=="yes" and $_REQUEST['mds']==""){

$pgnvar="{$i}.html"; if ($wrtrtdr=="yes" and $i=="1"){$pgnvar="";}

if ($sturlctname=="yes"){$sturlctvr="/".sturl_replc($categories[$ct][0]);}else{$sturlctvr="/c";}
$cityvar=$_REQUEST['city'];
if ($cityvar!=""){$sturl="{$urlclscrpt}cities/$cityvar/ct/{$ct}{$sturlctvr}/{$pgnvar}";}
else {$sturl="{$urlclscrpt}ct/{$ct}{$sturlctvr}/{$pgnvar}";}

}

else {$sturl="index.php?ct=$ct&md=browse&page=$i&$search_str";}
return $sturl;
}

function sturl_replc($vr)
{ 
global $maxlntlsturl;

$res=strToLower($vr);

if (strlen($res)>$maxlntlsturl) 
{$res=substr($res,0,$maxlntlsturl); 
$res= preg_replace ("/\s\S+$/", "", $res);
}

global $charsetcd; if(strToLower($charsetcd)=="utf-8"){$kptrn="/\PL+/u";}else{$kptrn="/\W+/";}
$res=preg_replace($kptrn, '-', $res);
$res=preg_replace("/^-|-$/", '', $res);

return $res;
}

?>

is it this one?

 

or this..

<?php
function get_short_date($time1)
{ global $months_short;
$months=$months_short;
$d=getdate($time1);
$d2=$d['mon'];  
$date_string=$months[$d2-1]." ".$d['mday'];
return $date_string;
}


function get_date_f($date1)
{ 
global $months_short, $weekdays;

$months1=array('january', 'february', 'march', 'april', 'may', 'june',  
'july', 'august', 'september', 'october', 'november','december');

$months=$months_short;
$dt_mss=split('-',$date1); 
$d2=$dt_mss[1];

$dtstr=$dt_mss[2]." ".$months1[$d2-1]." ".$dt_mss[0];
$evnttime=strtotime($dtstr)+1000;
$evntd=getdate($evnttime);
$evntd2=$evntd['wday'];  

$evntwkd=$weekdays[$evntd2];

$date_string=$months[$d2-1]." ".$dt_mss[2]." $evntwkd";
return $date_string;
}

function slctgetstr($value)
{
$value=ereg_replace(' ', '+', $value);
$value=ereg_replace('@', '%40', $value);
$value=ereg_replace('!', '%21', $value);
return $value;
}


function get_ads_count()
{
global $cat_fields, $table_ads, $ct, $page, $adsonpage, $html_header, 
$html_footer; 
 
$where_string=get_where_string();
$sql_query="select count(idnum) from $table_ads where 
$where_string ";

if( !($sql_res=@mysql_query("$sql_query")))
{echo $html_header;
echo "
<center>
<font FACE='ARIAL, HELVETICA'  COLOR='#bb0000' size=-1><b>
Error in connecting to ads MySQL table <font color='#000099'>'$table_ads'</font>.
<br> Seems, this table is not created, 
<a href='admconf.php?md=create_tb'>click here </a> to create this table.
</b></font></center>
";
echo $html_footer;
exit; 
}  
$row=mysql_fetch_row($sql_res);
$count=$row[0];
return $count;}  function adscnt1() {echo "count=".get_ads_count().";";}

function delete_expevents()
{
global $cat_fields, $table_ads, $exp_period, $exp_perdhlt,$ct, $pstdevc, $flattchext;

if ($flattchext!=""){include_once("flattch.php");}

$time1=time() - $exp_period*86400;
$sql_query="select idnum from $table_ads where (catname='$ct') and 
(CURRENT_DATE > DATE_ADD(eventdt, INTERVAL $pstdevc DAY) or  eventdt='0000-00-00') ";

$sql_res=mysql_query("$sql_query");
while ($row = mysql_fetch_array ($sql_res))
{  
$del_id=$row['idnum'];
delete_events_photos($del_id);
$sql_query="delete from $table_ads where idnum=$del_id";
mysql_query("$sql_query");
 
}
 
}



function get_ads()
{
global $cat_fields, $table_ads,$ct, $page, $adsonpage, 
$ratedads, $plhltads, $HTTP_GET_VARS, $vstminnmbr,  $evnt_cat, $hltlstk, $ordhltrate; 

$ord_ratedads="";  
if ($hltadsf='yes' and $ordhltrate=="yes"){$ord_ratedads="adrate desc,";} 

if ($evnt_cat[$ct]=="yes") {delete_expevents($ct); $ord_ratedads="eventdt,";}

if ($HTTP_GET_VARS['adsordtp']=='vote'){$ord_ratedads=$ord_ratedads." ratevtrt desc, ";}
if ($HTTP_GET_VARS['adsordtp']=='vis'){$ord_ratedads=$ord_ratedads." cntvstr desc, "; }
if ($HTTP_GET_VARS['adsordtp']=='pml'){$ord_ratedads=$ord_ratedads." cntemll desc, ";}
if ($HTTP_GET_VARS['adsordtp']=='cmmnt'){$ord_ratedads=$ord_ratedads." replcnts desc, ";}
$html_ads="";
$start_num=($page-1)*$adsonpage; 
if($page=="")$start_num=0;
$where_string=get_where_string();

if ($ct==''){$adcmord='adcommkey,';} else {$adcmord='';}
 
$sql_query="select * from $table_ads where $where_string  
order by $ord_ratedads $adcmord idnum desc limit $start_num, $adsonpage";

$sql_res=mysql_query("$sql_query");
 
$hltlstk=""; 

return $sql_res;
}



function get_mctsql($nmct)
{
global $sql_mct, $categories, $gmct_name;

if ($sql_mct=="")
{
foreach ($categories as $key => $value){
$ms22=split("_",$key); 
if($ms22[0]== 'title'){$kk1=0;}
if($kk1==1 and $key!="evntcl" and  $key!="evcl_rpl" 
and $categories[$key][2]!="h" and $ms22[0]!='newcolumn'){$sql_mct=$sql_mct." catname='$key' or";}
if($ms22[0]== 'title' and $ms22[1]== $nmct){$kk1=1; $gmct_name=$categories[$key];}
}

$sql_mct=preg_replace ("/or$/", "", $sql_mct);
$sql_mct="( $sql_mct ) and ";
}
return $sql_mct;
}




function get_where_string()
{
global $cat_fields, $ct, $table_ads, $HTTP_GET_VARS, $text_userinfo, $fntclr_1, $msg,
$vstminnmbr, $sql_mct, $categories;

if ($HTTP_GET_VARS['brief_key']!=""){
if(get_magic_quotes_gpc()){$brf_rpq="\'";}else{$brf_rpq="'";}
$HTTP_GET_VARS['brief_key']=ereg_replace("'", $brf_rpq, $HTTP_GET_VARS['brief_key']); 
}
if(!get_magic_quotes_gpc()){
foreach ($HTTP_GET_VARS as $key => $value )
{$HTTP_GET_VARS[$key]=addslashes($HTTP_GET_VARS[$key]);
}}

global $sqlaflcl;
$adctnm1="$sqlaflcl visible=1 and ";
if ($HTTP_GET_VARS['visunvis'] == "1") {$adctnm1="";}
if ($HTTP_GET_VARS['ct'] != "")
{
$adctnm1=$adctnm1."catname='$ct' and ";
}

if ($HTTP_GET_VARS['gmct']!= ""){$adctnm1=$adctnm1.get_mctsql($HTTP_GET_VARS['gmct']);}


$where_string=$adctnm1;
$tm_check=time() - $HTTP_GET_VARS['before']*86400;

if ($HTTP_GET_VARS['before'] != "")
{$where_string=$where_string."time > $tm_check and "; 
}

if ($HTTP_GET_VARS['idemail'] != "")
{
$var_idemail=$HTTP_GET_VARS['idemail'];
$sql_query="select email from $table_ads where idnum='$var_idemail'";
$sql_res=mysql_query("$sql_query");
$row = mysql_fetch_row($sql_res);
$searchemail=$row[0];
$where_string=$where_string."email='$searchemail' and "; 
$text_userinfo="
<font class='stfntb'>
<b>".$msg['ads_posted_by_user']."</b>
</font>
";
}

if ($HTTP_GET_VARS['mblogin'] != "")
{$where_string=$where_string."login='".$HTTP_GET_VARS['mblogin']."' and ";
$text_userinfo="
<font  class='stfntb'>
 ".$msg['ads_posted_by_member']."<b>'".$HTTP_GET_VARS['mblogin']."'</b>
</font>
";
}

$rplidval=$HTTP_GET_VARS['replyid'];
if ($rplidval != "")

{$where_string=$where_string."replyid=$rplidval and ";
$text_userinfo="      
<font class='stfntb'>
<b>".$msg['replies_for']." 
<a href='index.php?md=details&id=$rplidval' target='inad$rplidval'>
".$msg['ad_rp']."(#$rplidval) 
</a>
</b>
</font>
";
}


if ($HTTP_GET_VARS['ratedads'] != "")
{$where_string=$where_string."adrate > 0 and ";
}

if ($HTTP_GET_VARS['adsordtp']=='pml')
{$where_string=$where_string."cntemll > 0 and ";
}

if ($HTTP_GET_VARS['adsordtp']=='cmmnt')
{$where_string=$where_string."replcnts > 0 and ";
}
 
if ($HTTP_GET_VARS['adsordtp']=='vote')
{$where_string=$where_string."ratevtcn > 0 and ";
}

global $gladsqr;
if ($HTTP_GET_VARS['onlywithphoto'] != "" or $HTTP_GET_VARS['adsgal']=='1')
{$where_string=$where_string."adphotos='yes' and ";
}

if ($HTTP_GET_VARS['ipaddr1'] != "")
{$where_string=$where_string."ipaddr1='".$HTTP_GET_VARS['ipaddr1']."' and ";
}

if ($HTTP_GET_VARS['idnum'] != "") 
{$where_string=$where_string."idnum=".$HTTP_GET_VARS['idnum']." and ";
 }
 

global $use_fltxtind;
if ($HTTP_GET_VARS['brief_key'] != "") 
if ($use_fltxtind=="yes"){$where_string=$where_string.kw_wherestr();}
else{
{$where_string=$where_string.
"(brief like '%".$HTTP_GET_VARS['brief_key']."%' or title like '%".$HTTP_GET_VARS['brief_key']."%') and ";
}
}

if ($HTTP_GET_VARS['email']!=""){
$where_string=$where_string."email='".$HTTP_GET_VARS['email']."' and ";
 $cat_fields['email'][2]='keyword';}


foreach ($cat_fields as $key => $value )
{

if($cat_fields[$key][2] == "keyword" or $key=='city') 
{
 
if($HTTP_GET_VARS['fsloc']=='all'){$HTTP_GET_VARS['city']="";}

if ($HTTP_GET_VARS[$key] != "") {  
if (($key=="city") and 
($HTTP_GET_VARS['mblogin']!="" or $HTTP_GET_VARS['idemail']!="" 
or $HTTP_GET_VARS['replyid']!="" or $HTTP_GET_VARS['email']!="" ))

{$kkttrv=1;} else
{$where_string=$where_string."$key like '%".$HTTP_GET_VARS[$key]."%' and ";}
 }
}
if($cat_fields[$key][2] == "minmax")
{
$flmin=$key."1";
$flmax=$key."2";
if (($HTTP_GET_VARS[$flmin] != "") and ($HTTP_GET_VARS[$flmax] != "")) 
{
$HTTP_GET_VARS[$flmin]=ereg_replace(',', '', $HTTP_GET_VARS[$flmin]);
$HTTP_GET_VARS[$flmax]=ereg_replace(',', '', $HTTP_GET_VARS[$flmax]);

$HTTP_GET_VARS[$flmin]=preg_replace ('/[A-Za-z]|\$|,|\?|\+/', "", $HTTP_GET_VARS[$flmin]);
$HTTP_GET_VARS[$flmax]=preg_replace ('/[A-Za-z]|\$|,|\?|\+/', "", $HTTP_GET_VARS[$flmax]);



$where_string=$where_string."$key >= ".$HTTP_GET_VARS[$flmin]."
 and $key <= ".$HTTP_GET_VARS[$flmax]." and ";
}
}
}
$where_string=corr_wherestring($where_string);

if ($HTTP_GET_VARS['mfvrt']=='1'){$where_string=view_fv_ads();}

$valcntvstr=""; 
if ($HTTP_GET_VARS['adsordtp']=='vis'){$valcntvstr="cntvstr > $vstminnmbr and "; }
$where_string=$valcntvstr.$where_string; 

 
return $where_string;
}

function corr_wherestring($string1)
{
$string1=$string1."fdspkdsanbf";
$db_dcf="and fdspkdsanbf";
$string1=ereg_replace($db_dcf,"",$string1);
return $string1;
}


function get_jpg_path($id_count)
{
global $photo_url, $photo_path,  
$photos_url, $photos_path, $photos_count,
$previewphoto_url, $previewphoto_path, $multimedia_path,
$multimedia_url, $multim_ext;

for ($i=1; $i<=$photos_count; $i++)
{
$photo_url[$i]=$photos_url."p".$id_count."n".$i.".jpg";
$photo_path[$i]=$photos_path."p".$id_count."n".$i.".jpg";
}

$previewphoto_url=$photos_url."p".$id_count."prw".".jpg";
$previewphoto_path=$photos_path."p".$id_count."prw".".jpg";

}

function get_att_path($id_count)
{
global $photo_url, $photo_path,  
$photos_url, $photos_path, $photos_count,
$previewphoto_url, $previewphoto_path, $multimedia_path,
$multimedia_url, $multim_ext, $flattchext;

 
if ($flattchext!=""){$multim_ext=get_fl_ext($id_count);}

$multimedia_url=$photos_url."mtmd".$id_count.$multim_ext;
$multimedia_path=$photos_path."mtmd".$id_count.$multim_ext;
} 

function ads_pages_list()
{ $maxcntplnk=20;
global $ads_count, $adsonpage, $ct, $page, $idemail, $mblogin,  $ratedads, $visunvis, $msg;
$search_str=get_srch_str();
if ($idemail!=""){$search_str="idemail=$idemail";}
if ($mblogin!=""){
$search_str="mblogin=$mblogin";
if ($visunvis=="1"){$search_str="mblogin=$mblogin&visunvis=1";}
}
if ($ratedads=="1"){$search_str="ratedads=1";}
$num_pages=($ads_count-$ads_count%$adsonpage)/$adsonpage;
if ($ads_count%$adsonpage > 0) {$num_pages++;}

 
if($num_pages > $maxcntplnk){
$crntpg=$page;
if($crntpg==""){$crntpg=1;}
$maxcntpl2=round($maxcntplnk/2);
$lstpg_st=$crntpg - $maxcntpl2;
$lstpg_fn=$crntpg + $maxcntpl2;
 
if ($lstpg_st>0){$i_pgst=$lstpg_st;} else {$i_pgst=1;}
if ($lstpg_fn<$num_pages){$i_pgfn=$lstpg_fn;} else { $i_pgst=$num_pages-$maxcntplnk; $i_pgfn=$num_pages;}
if ($lstpg_st<=0 ){$i_pgfn=$maxcntplnk;}

}
else{
$i_pgst=1;
$i_pgfn=$num_pages;
}

$list_pages="";

for ($i = $i_pgst; $i <= $i_pgfn; $i++) 
{
if ($i != $page){
$list_pages=$list_pages." [<a href='".sturl_ct_pgs($ct, $i, $search_str)."'>$i</a>]";
}
else
{
$list_pages=$list_pages." [<font color='#ee0000'>$i</font>]";
}
}
if ($lstpg_st>1){
$list_pages= " [<a href='".sturl_ct_pgs($ct, 1, $search_str)."'>1</a>] ... ".$list_pages;
}

if ( ($lstpg_fn<$num_pages) and ($num_pages > $maxcntplnk) ){
$list_pages= $list_pages." ... [<a href='".sturl_ct_pgs($ct, $num_pages, $search_str)."'>$num_pages</a>]";
}


$list_pages=$msg['listingads'].":".$list_pages;
if ($ads_count == 0) $list_pages="";
return $list_pages;

}

function get_srch_str()
{
global $page, $ads_count, $adsonpage, $ct, $mds, $HTTP_GET_VARS;
$search_str="";
if($HTTP_GET_VARS['gmct'] !== ''){
# $search_str="gmct=".$HTTP_GET_VARS['gmct']."&";
$mds_res=1;
}

$mds_res=0;
#if($HTTP_GET_VARS['mds'] == 'search')
#{
foreach ($HTTP_GET_VARS as $key => $value)
{
if (($key !='md')  and ($key !='page') and ($key !='ct'))
{$mds_res=1;
$value=ereg_replace(' ', '+', $value);
$value=ereg_replace('@', '%40', $value);
$value=ereg_replace('!', '%21', $value);

if($HTTP_GET_VARS['fsearch']=='1' and $key=='brief_key'){$value="";}
if($HTTP_GET_VARS['fsearch']!='1' and $key=='keyword'){$value="";}

$search_str=$search_str."$key=$value&";
}
#}
}
if ($mds_res==0)
{
$mds="";
$HTTP_GET_VARS['mds']="";
}
return $search_str;

}

function pages_next_prev()
{
global $page, $ads_count, $adsonpage, $ct, $HTTP_GET_VARS, $idemail, $mblogin,
 $ratedads, $visunvis, $msg;
$search_str=get_srch_str();
if ($idemail!=""){$search_str="idemail=$idemail";}
if ($mblogin!=""){
$search_str="mblogin=$mblogin";
if ($visunvis=="1"){$search_str="mblogin=$mblogin&visunvis=1";}
}
if ($ratedads=="1"){$search_str="ratedads=1";}
$max_pages=($ads_count-$ads_count%$adsonpage)/$adsonpage;
if ($ads_count%$adsonpage > 0) {$max_pages++;}
$next_prev="";
if ($page>1)
{
$a1_prev=$page-1;
$next_prev=$next_prev.
"<a href='".sturl_ct_pgs($ct, $a1_prev, $search_str)."'>".$msg['previous_pg']."</a>";
}
if($page==0)$page=1;
$next_prev=$next_prev." ".$msg['page_of']." $page ".$msg['of_pg']." $max_pages ";
$a1_next=$page+1;
$a2=$page*$adsonpage;
if ($a2 < $ads_count)
{
$next_prev=$next_prev.
"<a href='".sturl_ct_pgs($ct, $a1_next, $search_str)."'>".$msg['next_pg']."</a>";
}
if ($ads_count == 0) $next_prev="";
return $next_prev;
}



function start()
{
global $ct,$ads_fields,$categories, $ads_count, $cat_fields,$fields_sets,$allcatfields;
connect_to_db();
$c_res1=0;
foreach ($categories as $key => $value)
{
if ($key == $ct ){$c_res1=1;}
}
if ($c_res1==0){
if ($ct !=""){
echo $html_header;
echo "<h3> Incorrect Category </h3>";
echo $html_footer;
exit;
}
}
 
getfldlst();
 
$ads_count=get_ads_count();
}

function getfldlst()
{
global $ct,$ads_fields, $categories, $ctgroups_sets, $_REQUEST,
$ads_count, $cat_fields,$fields_sets,$allcatfields;

if ($ct!="")
{
$a1=$categories[$ct][1];
$a2=$fields_sets[$a1];
}
if ($a2=="")
{$a2=$allcatfields;}

$gmctvl=$_REQUEST['gmct'];
if ($gmctvl!="" and $ctgroups_sets[$gmctvl]!=""){$a1=$ctgroups_sets[$gmctvl]; $a2=$fields_sets[$a1];}

foreach ($a2 as $a2_value)
{
$cat_fields[$a2_value]=$ads_fields[$a2_value];
}

}


function corr_sqlstring($string1)
{
$string1=$string1."fdspkdsnbf";
$db_dcf=", fdspkdsnbf";
$string1=ereg_replace($db_dcf,"",$string1);
return $string1;
}

function connect_to_db()
{
global $host_name, $db_user,$db_password, $html_header, 
$html_footer, $db_name, $table_ads;

if (!(@mysql_connect("$host_name","$db_user","$db_password")))
{echo $html_header;
echo "
<center>
<font FACE='ARIAL, HELVETICA'  COLOR='#bb0000' size=-1><b>
Error in connecting to your MySQL server.  <br> 
<a href='admconf.php'>Click here</a> to set up correct options for
your MySQL server.
 
</b></font></center>
";
echo $html_footer;
exit;
}
if (!(@mysql_select_db("$db_name")))
{echo $html_header;
echo "
<center>
<font FACE='ARIAL, HELVETICA'  COLOR='#bb0000' size=-1><b>
Error in connecting to your MySQL database <font color='#000099'>'$db_name'</font>.
<br> <a href='admconf.php'>Click here</a> to set up correct options for
your MySQL server.
</b></font></center>
";
echo $html_footer;
exit;
}

global $charsetcdsn; if($charsetcdsn=="1"){mysql_query("SET NAMES utf8");}
   
}

?>
Edited by sxp

or this?

<?php
require("config.php");
require("funcs1.php");
require("favrt.php");
require("adshtm.php");
require("fsturl.php");


if($affcliframe=="yes"){include_once("iframe.php");}
 
$javastl="
<script language='JavaScript'>
<!--
 function displ(nmdiv){if (document.getElementById){
if (document.getElementById(nmdiv).style.display=='none') document.getElementById(nmdiv).style.display ='block';
else document.getElementById(nmdiv).style.display ='none';} else if (document.all)
{ if(document.all[nmdiv].style.display=='none') document.all[nmdiv].style.display ='block';
else document.all[nmdiv].style.display ='none';}}
-->
</script>";  

global $indhdrcvl;$indhdrcvl="1";

$msgs_fl="msg1_".$intlang.".php"; require_once("$msgs_fl");
if (($md!="details") and ($md!="") and ($md!="browse"))
{$msgs_fl="msg2_".$intlang.".php"; require_once("$msgs_fl");} 

$select_text=$msg['Please_choose_one_sl'];

$sqlaflcl="";
if ($displaflusr=="yes"){$sqlaflcl="afprtid1='".$_REQUEST['afflprid']."' and "; 
if ($_REQUEST['afflprid']==""){$sqlaflcl="afprtid1='11111' and ";}
}


if($fb_intrfc=="yes"){include_once("fbfuncs.php"); 
if (($md=="add_form") or ($md=="submitad")){if(!fb_sbmform()){return;}}
if (($md=="privacy_mail") or ($md=="send_mail")){if(!fb_sndprml()){return;}}
}

if ($md=="rmbloc"){include("rmbloc.php"); }
if (($ct=="") and ($HTTP_GET_VARS['city']=="") and ($HTTP_COOKIE_VARS['kcity']!='') and ($HTTP_COOKIE_VARS['city']==''))
{$HTTP_GET_VARS['city']=$HTTP_COOKIE_VARS['kcity'];}
if ($_REQUEST['allc']=='1'){setcookie ("kcity"); setcookie ("$schopt"); $HTTP_GET_VARS[$schopt]=''; $_REQUEST[$schopt]='';}
if (($HTTP_GET_VARS[$schopt]!="") and ($ct=="") and ($mds==""))
{$_REQUEST[$schopt]=$HTTP_GET_VARS[$schopt]; setcookie ("$schopt", $HTTP_GET_VARS[$schopt]);} 
if (($HTTP_GET_VARS[$schopt]=="")  and (($mds=="") or (adsordtp!=""))){$HTTP_GET_VARS[$schopt]=$_REQUEST[$schopt];}
$rmmbrloc="";
if (($HTTP_COOKIE_VARS['kcity']!=$_REQUEST[$schopt]) and ($_REQUEST[$schopt]!=""))
{$rmmbrloc="      <a href='#' onclick=\"n=window.open('index.php?md=rmbloc&lc=".$HTTP_GET_VARS[$schopt]."',
 'n', 'toolbar=no, status=no, width=400, height=200');\">".$msg['rememb_loc']."</a>";}

start();

if ($md=="chct") {include("ch_catg.php");ch_categ();}

if (($md=="details") and ($mbac_second=="m"))
{
$msgs_fl="msg2_".$intlang.".php"; require("$msgs_fl");
include("mb_check.php"); check_mb_login("details&id=$id");}

if ((($md=="add_form") or ($md=="submitad")) and ($mbac_addad=="m"))
{include("mb_check.php"); check_mb_login("add_form");}
if ((($md=="privacy_mail") or ($md=="send_mail")) and ($mbac_sndml=="m"))
{include("mb_check.php"); check_mb_login("privacy_mail&idnum=$idnum");}
if ($md=="forgmbpassw"){include("mb_check.php"); forgot_mb_passw();} if ($md=="adscnt"){adscnt1();}
if ($md=="sendmbps"){include ("mb_conf.php"); include("mb_check.php"); send_mb_passw($ps_email);}
if ($md=="mblogout"){include("mb_check.php"); mb_log_out();}
 
if (($md=="") and ($ct=="") ){include("top.php"); print_categories();} 
if (($md=="browse") or ($md=="")){browse_ads();} 

if ($md=="details"){include("details.php"); ad_details();} 
if ($md=="add_form") {include("forms.php"); print_add_form();} 
if ($md=="editlogin"){ include("forms.php"); edit_login(" ");}
if ($md=="editform"){ include("forms.php");   edit_form();}
if ($md=="forgotpassw"){include("forms.php"); forgotpassw($ps_email);}
if ($md=="sendpassw"){include("funcs2.php");sendpassw($ps_email);}
if ($md=="privacy_mail"){include("forms.php"); privacy_form($idnum);}
if ($md=="send_mail"){include("funcs2.php"); send_mail($idnum);}
if ($md=="submitad") {include("submit.php"); submit_ad();}
if ($md=="edit") {include("submit.php"); edit_ad();}
if ($md=="adsvtrate"){include("funcs2.php"); adsvtrate();} 
if ($md=="chcity"){include_once("ch_city.php"); ch_city(); return; }
 
if ($md=="pclkeyw"){  pop_keywrds_lst(); }
if ($md=="aclkeyw"){  alphabet_keywrds_lst(); }

if ($md=="flgspam"){include_once("funcs2.php"); include_once("flagspam.php"); flag_spam_ad();}

if ($md=="actvt_ad"){include_once("funcs2.php"); include_once("actlink.php"); actvtl_ad();}


function category_name()
{
global $categories, $ct, $ratedads, $HTTP_GET_VARS, $schresinfo, $fntclr_1, $msg;
if ((($ct!="") and ($ratedads!="")) or  ($HTTP_GET_VARS['mds']=='search'))
{
$cat1_name="
<a href='index.php?ct=$ct'>".$categories[$ct][0]."</a>
";
 
if ($HTTP_GET_VARS['adsordtp']=='pml'){$txtinf1=$msg['top_contacted_ads'].":";}
if ($HTTP_GET_VARS['adsordtp']=='vis'){$txtinf1=$msg['top_visited_ads'].":";}
if ($HTTP_GET_VARS['adsordtp']=='vote'){$txtinf1=$msg['top_rated_ads'].":";}
if ($HTTP_GET_VARS['adsordtp']=='cmmnt'){$txtinf1=$msg['top_commented_ads'].":";}
$schresinfo="
$txtinf1
";
}
else
{
$cat1_name=$categories[$ct][0];
}
return $cat1_name;
}

function nb_best_ads()
{
global $cat_fields, $table_ads, $ct, $page, $adsonpage, $ratedads, $idemail,$plhltads,$msg; 

if ($plhltads=="2"){

if ($ratedads=="1")
{$res_mess="
<font class='stfnt'><b>
".$msg['ads_rated_by_admin']."
</b>
</font>
";}
else { 
if ($ct!=""){$qy_ct="catname='$ct' and "; } else {$qy_ct="";}
$sql_query="select count(idnum) from $table_ads where 
 $qy_ct adrate > 0";
$sql_res=mysql_query("$sql_query");
$row=mysql_fetch_row($sql_res);
$count=$row[0];
if ($count > 0)
{
$res_mess="
<font class='smallfnt'> 
<a href='index.php?ct=$ct&md=browse&ratedads=1'>".$msg['Best_Ads']."</a> 
[$count]</font>
";
}
}
}
if ($idemail!=""){$res_mess="";}
return $res_mess;
}

function check_row($row)
{
global $cat_fields, $select_text,$real_format;
 
if($row['homeurl']=='http://'){$row['homeurl']="--";}
foreach ($cat_fields as $key => $value) 
{
if (($row[$key]=="") or ($row[$key]==$select_text) or ($row[$key]=='http://')
or ($row[$key]=='NULL') or ($row[$key]=='null')) 
{$row[$key]="--";}
else {
if ($cat_fields[$key][6]=='float') {
$row[$key]=sprintf($real_format, $row[$key]);
if ($key=='price') {$row[$key]=$row[$key]+0.0001; $row[$key]=sprintf("%01.2f", $row[$key]);}
}
}

if ($cat_fields[$key][4] == 'date'){
$row[$key]=get_date_f($row[$key]);
}
 
}

global $ct,$evnt_cat;
if($evnt_cat[$ct]=='yes' and $row['catname']!=$ct){$row['eventdt']="--";}

$row['moredetails']=" ".preg_replace("/\n/", "<br>",$row['moredetails']);

return $row;
}

function check_favorites()
{
global $HTTP_COOKIE_VARS;

$val=0;

if ($HTTP_COOKIE_VARS['ckfvr']!='')
{
$val=1;
}

return $val;
}

function msg_favorites()
{
global $msg, $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $hltadsf;

$val=0;

if ($HTTP_COOKIE_VARS['ckfvr']=='' and $HTTP_GET_VARS['mfvrt']!='')
{
$msgfv="<p><center><font class='stfntb'><b> ".$msg['no_favorites']."</b></font></center> ";
}
else {$msgfv="";}

if($HTTP_GET_VARS['mfvrt']!=''){$hltadsf="";}
return $msgfv;
}

function print_subcat($key)
{
global $categories, $fntclr_1, $msg, $ads_fields, $subcnmb, $getcityval,$popctgr;

if (($categories[$key][2] != 'h') and ($categories[$key][2] != ''))
{
$sctgv='sct'.$popctgr.$key;
$vr1=split(',',$categories[$key][2]);
foreach ($vr1 as $key1){

$ads_fields[$key1][7]=ereg_replace("\n", '', $ads_fields[$key1][7]);
$ads_fields[$key1][7]=ereg_replace("\r", '', $ads_fields[$key1][7]);
$vr2=split('<option>',$ads_fields[$key1][7]);

$htmlv=$htmlv."<font class='fsct1'>".$ads_fields[$key1][0].":</font>
<br><font class='fsct2'> <div class='dv1'>
";

$sctnbmass=subctadsnumb($key, $key1);

$b11='';
foreach ($vr2 as $key2){
if($key2!=''){
if($sctnbmass[$key2]==''){$sctnbmass[$key2]='(0)';}
$trgtval="sct".$key;
$htmlv=$htmlv."$b11  <nobr><a href='index.php?".$getcityval."ct=$key&md=browse&mds=search&$key1=".checkfld2($key2)."'>$key2</a>".$sctnbmass[$key2]."</nobr>
"; $b11=',';

}
 
}

$htmlv=$htmlv."</div></font>";
}
$htmlv=$htmlv."<p>";
}

return $htmlv;
}

function print_subcat2($key)
{
global $categories, $fntclr_1, $msg, $ads_fields, $subcnmb, $getcityval,$popctgr;

if (($categories[$key][2] != 'h') and ($categories[$key][2] != ''))
{
$sctgv='sct'.$popctgr.$key;
$vr1=split(',',$categories[$key][2]);
foreach ($vr1 as $key1){

$ads_fields[$key1][7]=ereg_replace("\n", '', $ads_fields[$key1][7]);
$ads_fields[$key1][7]=ereg_replace("\r", '', $ads_fields[$key1][7]);
$vr2=split('<option>',$ads_fields[$key1][7]);

$htmlv=$htmlv."<font class='fsct1_4'>".$ads_fields[$key1][0].":</font>
<font class='fsct2_4'>  
";

$sctnbmass=subctadsnumb($key, $key1);

$b11='';
foreach ($vr2 as $key2){
if($key2!=''){
if($sctnbmass[$key2]==''){$sctnbmass[$key2]='(0)';}
$trgtval="sct".$key;
$htmlv=$htmlv."$b11  <nobr><a href='index.php?".$getcityval."ct=$key&md=browse&mds=search&$key1=".checkfld2($key2)."'>$key2</a>".$sctnbmass[$key2]."</nobr>
"; $b11=',';

}
 
}

$htmlv=$htmlv."$b11  <nobr><a href='index.php?".$getcityval."ct=$key&md=browse&mds=search&'>".$msg['all_ads1']."</a>".subctadsnumb($key, "").".</nobr>";

$htmlv=$htmlv."<br>"; 
$htmlv=$htmlv."</font>";
}
 
}

return $htmlv;
}



function subctadsnumb($ctg, $fld)
{

global $table_ads, $schopt, $_REQUEST, $sqlaflcl;
if ($_REQUEST[$schopt]!=''){$wrvl="and $schopt='".$_REQUEST[$schopt]."'";};
$sql_query="select $fld, count(idnum) from $table_ads where $sqlaflcl visible=1 and catname='$ctg' $wrvl group by $fld ";
if($fld==""){$sql_query="select count(idnum) from $table_ads where $sqlaflcl visible=1 and catname='$ctg' $wrvl";}
$sql_res=mysql_query("$sql_query"); 
while ($row = mysql_fetch_row($sql_res))
{$fldn=$row[0];  
$fmass[$fldn]="(".$row[1].")";
if($fld==""){$fmass="(".$row[0].")";}
}
return $fmass;
}

function checkfld2($value)
{
$value=ereg_replace(' ', '+', $value);
$value=ereg_replace('@', '%40', $value);
$value=ereg_replace('!', '%21', $value);
return $value;
}

function prn_subcategories()
{ global $_REQUEST, $check_subcateg, $ct, $kwsrchfrm, $msg, $brd_notnull;
 
if($check_subcateg){ 
$html="<br>";
if(($_REQUEST['mds']=='search') and ( $brd_notnull  and  $kwsrchfrm=="yes")
 and ($_REQUEST['adsordtp']=='')){$dislpval='none';} else {$dislpval='block';} 
$html=$html."<DIV id='sbctg' style='DISPLAY: {$dislpval}'>";
$html=$html."
<table width='100%' cellpadding='0' cellspacing='0'><tr><td valign='top' width='90'> 
<font class='stfnt' style='line-height: 1.8;'>".$msg['k_subcategories']."</font>
</td><td valign='top' align='left'>
<span style='line-height: 1.8;'>".print_subcat2($ct)."
</span> </td></tr></table>
</div> 
<br> 
"; 
}
return $html;
 
}

function get_tm_tags($title,$row)
{
global $mtg_keywrds, $mtg_descr,$html_header,$mtfldkwrs,$ct;

if($row=="")
{
if ($mtg_descr[$ct]!="") {$descr=$mtg_descr[$ct];} else {$descr=$mtg_descr['all'];}
if ($mtg_keywrds[$ct]!="") {$keywrds=$mtg_keywrds[$ct];} else {$keywrds=$mtg_keywrds['all'];}
}
else {
$row['title']=ereg_replace('\"', '\'',$row['title']);
$row['brief']=ereg_replace('\"', '\'',$row['brief']);

$rwmss = preg_split ("/[\W]+/", $row['title']);
foreach ($rwmss as $value){if (strlen($value) > 3) {$vlkw=$vlkw.$value.", ";}}

foreach ($mtfldkwrs as $value){if ($row[$value]!="" and $row[$value]!="--")
{ $row[$value]=ereg_replace('\"', ' ',$row[$value]); $vlkw=$vlkw.$row[$value].", ";}}

if ($mtg_keywrds[$ct]!="") {$keywrds=$mtg_keywrds[$ct];} else {$keywrds=$mtg_keywrds['all'];}
$keywrds=$vlkw." almclsfds, ".$keywrds ;
$descr=$row['brief'];

}

$mtgvl="
<title>$title</title>
<meta name=\"keywords\" content=\"$keywrds\">
<meta name=\"description\" content=\"$descr\">
";


return $mtgvl;

}  

function get_tm_tagnt($title,$row)
{
global $mtg_keywrds, $mtg_descr,$html_header,$mtfldkwrs,$ct;

$mtgvl2=get_tm_tags($title,$row);

$mtgvl2="<!--tmt $mtgvl2 tmt-->";

return $mtgvl2;
}

function ads_delete_link($idnum)
{ global $admcookpassw, $adm_passw;
if($admcookpassw == $adm_passw){
$html="<p><b><a href='index.php?md=editform&edit_delete=delete&ed_id=$idnum'>Delete Ad</a></b>";
}
return $html;
}

?>

i've narrowed it down to these last 2 php files:

<?php
require("funcs2.php");

function edit_ad()
{
global $ed_passw, $ed_id, $table_ads, $moderating,$ppactv, $adphotos,  $sndadmnotif, $adm_passw, $admcookpassw;

check_fields();

$sql_query="select passw from $table_ads where idnum=$ed_id";
$sql_res=mysql_query("$sql_query");
$row = mysql_fetch_array ($sql_res);
 
if ($row['passw']!="$ed_passw")
{
if ($adm_passw!="$ed_passw")
{
if($admcookpassw != $adm_passw)
{
echo "incorrect password";
exit;
}
}
}

#del_edtfl($ed_id);
save_photos($ed_id);

$db_entry=form_sql_entry($ed_id);
$db_entry['idnum']="";
$db_entry['adphotos']=$adphotos;
$db_entry['time']="";
$db_entry['exptime']="";
if (($moderating=='yes') and ($ppactv!='yes')) {$db_entry['visible']="3";}
$db_entry['catname']="";
$sql_string="";
foreach ($db_entry as $db_key =>$db_value)
{
 
if ($db_entry[$db_key]!=""){
$sql_string=$sql_string."$db_key='$db_entry[$db_key]', ";
}

global $cat_fields;
if (($db_entry[$db_key]=="") and ($cat_fields[$db_key][0]!=""))
{$sql_string=$sql_string."$db_key='', ";}

}

global $flattchext;
if ($flattchext!=""){$sql_string=$sql_string.updflattv($ed_id);}

$sql_string=corr_sqlstring($sql_string);

global $kwsrchfrm;
if ($kwsrchfrm=="yes"){delete_kw_ad($ed_id);}

$sql_query="update $table_ads set $sql_string where idnum=$ed_id";
mysql_query("$sql_query");

if ($kwsrchfrm=="yes"){insert_kw_ad($ed_id);}


if ( $sndadmnotif=="yes" )
{
include("admml.php"); eml_to_adm($ed_id,"edit");
}

print_subm_ad($ed_id,'editad');
exit;
}

function get_idnum()
{

global $id_count, $table_ads, $ct;
$sql_query="select idnum from $table_ads 
order by idnum desc limit 1";
$sql_res=mysql_query("$sql_query");
$row=mysql_fetch_row($sql_res);
$id_count=$row[0];
$id_count++;

 
return $id_count;

}


 function check_fields()
{
global $db_entry, $visible_val, $cat_fields, $email, 
$HTTP_POST_VARS, $photos_count, $phptomaxsize, $userfile, $prviewphotomax,
$incl_prevphoto, $incl_mtmdfile, $mtmdfile_maxs, $userfile_name, $select_text, $msg2;



if(!get_magic_quotes_gpc())
{

foreach ($HTTP_POST_VARS as $key5 => $value )
{
$HTTP_POST_VARS[$key5]=addslashes($HTTP_POST_VARS[$key5]);
}
}

foreach ( $cat_fields as $key => $value )
{
$HTTP_POST_VARS[$key]=ereg_replace('<', '<', $HTTP_POST_VARS[$key]);
$HTTP_POST_VARS[$key]=ereg_replace('>', '>', $HTTP_POST_VARS[$key]);

if ($cat_fields[$key][2]=="minmax")
{ $HTTP_POST_VARS[$key]=ereg_replace(',', '', $HTTP_POST_VARS[$key]); 

$HTTP_POST_VARS[$key]=preg_replace ('/[A-Za-z]|\$|,|\?|\+/', "", $HTTP_POST_VARS[$key]);

}

if ($cat_fields[$key][4]=="date")
{ 
$key_d=$key."_dd"; $key_m=$key."_mm"; $key_y=$key."_yy";
$HTTP_POST_VARS[$key]=$HTTP_POST_VARS[$key_y]."-".$HTTP_POST_VARS[$key_m]."-".$HTTP_POST_VARS[$key_d];

if (($HTTP_POST_VARS[$key_m] > 12)  or ($HTTP_POST_VARS[$key_m] < 1) or
($HTTP_POST_VARS[$key_d] > 31) or ($HTTP_POST_VARS[$key_d] < 1) 
or ($HTTP_POST_VARS[$key_y] < 1))
{
$message="
<center>
<font class='msgf2' >
  ".$msg2['incorr_date_f']."  ".$cat_fields[$key][0]."  </font>
</center>
"; 
output_message($message);
exit;
}

 
}

if ($cat_fields[$key][4]=="checkbox")
{
$aa5=split('<option>',$cat_fields[$key][7]);
$i_aa5=0;
foreach ($aa5 as $value1)
{
$i_aa5++;
$namechbx=$key.$i_aa5;
if ($HTTP_POST_VARS[$namechbx]!="")
{$HTTP_POST_VARS[$key]=$HTTP_POST_VARS[$key].$HTTP_POST_VARS[$namechbx]."; ";}
}
}


$str_length1=strlen($HTTP_POST_VARS[$key]);
$aa4=split(':',$cat_fields[$key][3]);
$fmaxsize=$aa4[1];
if ($aa4[2]!="") $fmaxsize=$aa4[2];

global $charsetcd; if ($charsetcd=='utf-8' or $charsetcd=='UTF-8'){$fmaxsize=2*$fmaxsize;}

if ( $str_length1 > $fmaxsize)
{
$message="
<center>
<font class='msgf2' >
  ".$msg2['Ad_info_in_field']." <font class='msgf1' >".$cat_fields[$key][0]." </font> ".$msg2['is_too_large_inf']."</font>
</center>
";
output_message($message);
exit;
}

if ($HTTP_POST_VARS[$key]==$select_text)
{$HTTP_POST_VARS[$key]="";}

if ($cat_fields[$key][5]=='1')
{
if (( $HTTP_POST_VARS[$key]=="") or ( $HTTP_POST_VARS[$key]=="http://"))
{
$message="
<center>
<font class='msgf2' >
  ".$msg2['Ad_field_c']." <font class='msgf1' > ".$cat_fields[$key][0]." </font> ".$msg2['was_mising_on_form']."</font>
</center>
";
output_message($message);
exit;
}
}
}
if ($cat_fields['email'][5]=='1'){
$HTTP_POST_VARS['email']=check_email($HTTP_POST_VARS['email']);
}

for ($i=1; $i<=$photos_count; $i++)
{
$i1=$i-1;
if (file_exists($userfile[$i1])){
if (filesize($userfile[$i1]) > $phptomaxsize)
{
$phptomaxsize1=$phptomaxsize/1000000;
$message="
<center>
<font class='msgf2' >
  ".$msg2['Your_photo_n']." $i  ( ".$userfile_name[$i1]." )  ".$msg2['is_too_large_ph']." < $phptomaxsize1 
".$msg2['mbyte_v'].".
</font></font>
</center>
";
output_message($message);
exit;
}

global $ch_pht_tp;
if ( ($ch_pht_tp=='yes') and 
!($im1 = @imagecreatefromjpeg($userfile[$i1])) and 
!($im1 = @ImageCreateFromGIF ($userfile[$i1])) and !($im1 = @imagecreatefrompng ($userfile[$i1])) )
{
$message="
<center>
<font class='msgf2' >
  ".$msg2['Your_photo_n']." $i  ( ".$userfile_name[$i1]." )  ".$msg2['photo_incorr_type']."  
</font></font>
</center>
";

output_message($message);
exit;
} 

}
}
 

if ($incl_mtmdfile=="yes")
{
$i1++;
if (file_exists($userfile[$i1])){
if (filesize($userfile[$i1]) > $mtmdfile_maxs)
{
$mtmdfile_maxs1=$mtmdfile_maxs/1000000;
$message="
<center>
<font class='msgf2' >
  ".$msg2['Your_multimedia_file']." ".$userfile_name[$i1]."
 ".$msg2['is_too_large_mmf']." < $mtmdfile_maxs1 ".$msg2['mbyte_v'].".
</font></font>
</center>
";

output_message($message);
exit;
}
}
}

 
}
 
function checknusrads()
{
global $cat_fields, $table_ads, $ct, $page, $adsonpage,
$html_header, $html_footer, $usrads_chcktime, $usrads_max, $categories,$ch_nmusr,
$REMOTE_ADDR, $msg2, $msg, $templ; 

$timech1=time() - $usrads_chcktime*86400;
$sql_query="select count(idnum) from $table_ads where
 ipaddr1='$REMOTE_ADDR' and time > $timech1";
$sql_res=mysql_query("$sql_query");
$row=mysql_fetch_row($sql_res);
$count=$row[0];

if ($count >= $usrads_max)
{
$message="
<font class='msgf2'>
<center> 
".$msg2['exceeded_max_n_ads']." ($usrads_max) ".$msg2['allowed_per_time_p']." ($usrads_chcktime ".$msg2['days_v']." 
<p>
<font class='stfnt'>
<a href='index.php?md=browse&ipaddr1=$REMOTE_ADDR&visunvis=1'>".$msg2['Click_here_v']." </a>
".$msg2['to_see_your_ads']." 
</font>
 
</center>
</font>
";

$thtml= "
<center><table width='400'><tr><td>
<font class='stfntb'>
<b><a href='index.php'>".$msg['top'].":</a></b></font>
  
<font class='stfntb'> 
<b>  
<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>
";
 
include($templ['msg']);
exit;
}
}



function submit_ad()
{
global $db_entry, $visible_val, $cat_fields, $email, $HTTP_POST_VARS, $ch_nmusr,
 $photo_url, $photo_path, $id_count, 
$userfile, $userfile_name, $visible_val, $html_header, $html_footer, $msg, $msg2, $paymgtw,
$photos_url, $photos_path, $photos_count, $moderating, $ad_idnum, $sndadmnotif,$use_spmg, $templ;

global $actadoptv; if($actadoptv=="yes"){$moderating="yes"; include_once("actlink.php");}

global $usevrfcode;
if ($usevrfcode=="yes"){include_once("vrfuncs.php");ch_vrcode();}

if($paymgtw=="yes"){include("ecmc.php"); check_pmsubmit();}

if ($ch_nmusr=="yes"){checknusrads();}

check_fields();
 
$visible_val="1";
if ($moderating=='yes') {$visible_val="0";} 

if ($use_spmg == 'yes'){
include("spamgrd.php"); $spmresult=check_spamw();
if ($spmresult == "1") {$visible_val="4";}
}

$idnum=get_idnum();
save_photos($idnum);
$sql_query=add_sql_entry($idnum);

if( !(@mysql_query("$sql_query")))
{ 
$thtml= "
<center> 
<font class='stfntb'><b>
".$msg2['Error_subm_new_ad']."
</b></font></center>
";
include($templ['msg']); 
exit;
}

global $kwsrchfrm;
if ($kwsrchfrm=="yes"){insert_kw_ad($idnum);}

if ( $sndadmnotif=="yes" )
{
include("admml.php"); eml_to_adm($idnum,"add");
}

print_subm_ad($ad_idnum,'submitad');
exit;
}

function save_photos($id_cnt)
{
global $photo_url, $photo_path,  
$userfile, $userfile_name, $HTTP_POST_VARS, 
$photos_url, $photos_path, $photos_count, $moderating, $ad_idnum, $adphotos,
$incl_prevphoto, $incl_mtmdfile, $multimedia_path, $previewphoto_path,$savepherr,
$md; 

global $resphdb, $maxpixph;

get_jpg_path($id_cnt);

$savepherr="0";

$i=1;


 $i1=$i-1;

if (($md=="submitad")  and (file_exists($photo_path[$i])))
{unlink($photo_path[$i]); }

if (($userfile_name[$i1]=="d")  and (file_exists($photo_path[$i])))
{ unlink($photo_path[$i]);}

$chbphdl="chdlpht".$i;
if (($HTTP_POST_VARS[$chbphdl]=="1")  and (file_exists($photo_path[$i])))
{ unlink($photo_path[$i]);}


if (file_exists($userfile[$i1])){ 
if (($userfile_name[$i1] !="") and ($userfile_name[$i1] !="d")){
 copy($userfile[$i1], $photo_path[$i]) ;

if ($resphdb=="yes"){phtresize($photo_path[$i], $maxpixph);} 


}
}

$adphotos="no";
$i=1;
 
if (file_exists($photo_path[$i])){$adphotos="yes";} 
 
}


function phtresize($photofile, $maxpix)
{

if ($ph_size = @getimagesize($photofile) )
{
$width = $ph_size[0]; 
$height = $ph_size[1]; 

$vsz_width=$width/$maxpix;
$vsz_height=$height/$maxpix;


if ($vsz_width > $vsz_height) {$vsz=$vsz_width;} else {$vsz=$vsz_height;}

if ($vsz > 1)
{ 
$new_width=$width/$vsz;
$new_height=$height/$vsz;

if(  $im1 = @imagecreatefromjpeg($photofile) )
{  
$im2 = imagecreatetruecolor($new_width,$new_height); 
@imagecopyresized($im2, $im1, 0, 0, 0, 0, $new_width,$new_height,$width,$height); 
imagejpeg($im2, $photofile); 
imagedestroy($im1); 
imagedestroy($im2);
} 

else {

if(  $im1 = @ImageCreateFromGIF ($photofile) )
{  
$im2 = imagecreatetruecolor($new_width,$new_height); 
@imagecopyresized($im2, $im1, 0, 0, 0, 0, $new_width,$new_height,$width,$height); 
imagegif($im2, $photofile); 
imagedestroy($im1); 
imagedestroy($im2);
} 

if  ($im1 = @imagecreatefrompng ($photofile) )
{  
$im2 = imagecreatetruecolor($new_width,$new_height); 
@imagecopyresized($im2, $im1, 0, 0, 0, 0, $new_width,$new_height,$width,$height); 
imagegif($im2, $photofile); 
imagedestroy($im1); 
imagedestroy($im2);
} 

}

}
}
}



function print_photos1($idnum, $row)
{
global  $photos_url, $photos_path, $photo_path, $photo_url, $photos_count,
$multim_link, $msg2, $msg;
$pho1="";
get_jpg_path($idnum);
for($i=1; $i<=$photos_count; $i++)
{
if (file_exists($photo_path[$i])){$pho1="1";} 
 
}
 
if ($pho1==""){return;}

$html="
<center>
<table width='100%' bgcolor='#eeeeee'>
<tr><td> 
<font class='lrfnt'>
<b> ".$msg['photo_gallery']." </b> </font>
</td></tr></table>
</center>
";
$timepho=time();
for($i=1; $i<=$photos_count; $i++)
{
if (file_exists($photo_path[$i])){
$photokey="photocaption$i";
$photocapt=$row[$photokey];

global $maximgswith; $imgsize1=GetImageSize($photo_path[$i]);
$imgwidth1=""; if ($imgsize1[0] > $maximgswith){ $imgwidth1="width='$maximgswith'";}


$html=$html."
<font class='stfntb'>
<font size='-2'>".$msg['photo_d']." $i</font>
<center>
<img src='$photo_url[$i]?$timepho' $imgwidth1> <br> $photocapt
</center>
";
}
}
return $html;
}



function print_subm_ad($ad_idnum,$ed_subm)
{
global $cat_fields, $photos_count, $html_header, $html_footer, $id, $md,
$ct, $categories, $ad_second_width, $left_width_sp, $exp_period, $incl_prevphoto,
$prphotolimits, $pr_lim_width, $pr_lim_height, $previewphoto_path, $previewphoto_url,
$moderating, $savepherr, $visible_val, $msg2, $msg,$evnt_cat, $templ, $ppactv, $pp_sett,$ppkey, $row, $exp_perdhlt;

$sdtpcol="#ffffff";
$sdtpcol1="#ffcccc";

$row=get_edit_info($ad_idnum);
$row=check_row($row);

$time1=$row['time'];
$date_posted=get_date($time1); 
$time2=$time1+$exp_period*86400;
if ($row['adrate'] > 0){$time2=$time1+$exp_perdhlt*86400;}
$expire_date=get_date($time2);

if ($ed_subm=='editad') 
{ $info11=$msg2['ad_edited_successfuly'];
}

if ($ed_subm=='submitad') 
{ $info11=$msg2['ad_submitted_successfuly'];
}

global $actadoptv; if ($actadoptv=='yes' and $md!='edit'){
$info11=$info11."
<br> ".$msg2['to_activate_ad_click_link']."
";
send_conf_email($row['idnum'],$row['email']);
}

if ((($moderating=='yes') and ($ppactv!='yes') and ($actadoptv!="yes") ) or ($visible_val=="4"))
{
$info11=$info11."
<br> ".$msg2['will_appear_as_possible']."
";
}

if ($moderating!='yes'){
$lnhledview=$lnhledview."    <a href='index.php?md=details&ct=$ct&id=".$row['idnum']."'  >".$msg2['view_ad1']."</a>";
}
$lnhledview="<p><b><font class='stfntb'> $lnhledview </font> </b><p>";


if (($ppactv=="yes")  and  ($moderating=='yes') and ($md!='edit')){$info11="";} 
 
if ($savepherr=="1")
{ $info11=$info11."
<br>
<font class='stfntb'>
".$msg2['photos_not_saved']."
</font>
";
}

$thtml_top="
<table width='650'><tr><td>
<font class='stfntb'>
<b><a href='index.php'>".$msg['top'].":</a></b> 
  
 
<b>  
<a href='index.php?ct=$ct'>".$categories[$ct][0]."</a>
</b> 
</font> 
<hr size='1'><p>
<center>
<font class='msgf1'> 
 $info11  </font>
</center><p>
";
 
$thtml="

$lnhledview
<table width='100%' border=0 cellspacing=3 cellpadding=3>
<tr>
<td class='dtb1'>
<font class='df1'>
    <b>".$row['title']."</b></font>
</td>
</tr>
</table>
<table width='100%'    cellspacing=5 cellpadding=5>
<tr><td>
<font class='smallg'> 
  ".$msg['adsid']." : </font><font class='smallr'>
".$row['idnum']."
</font>; 
 
<font class='smallg'>
   ".$msg['date_posted_d']." : </font> <font class='smallr' >
 $date_posted </font>;
 
";
if ($evnt_cat[$ct] !="yes"){
$thtml=$thtml. "
<font class='smallg' >".$msg['expire_date_d']." : </font>
<font class='smallr' > $expire_date </font>;
</font>

";
}

$thtml=$thtml. "
<table width='100%'  border=0   cellspacing=0 cellpadding=7>
"; 

foreach ( $cat_fields as $key => $value )
{

if (($key != 'title') and !($key=='initialad' and $row[$key]=='--'))
{ 
$thtml=$thtml. "
<tr><td bgcolor='$sdtpcol' width='35%' class='frmtb3'>
<font class='stfnt'>
  ".$cat_fields[$key][0].":</font>
</td><td bgcolor='$sdtpcol' width='65%' class='frmtb3'>
<font class='stfntb'>
 ".$row[$key]."   </td></tr>
 
";
} 
}

$thtml=$thtml. "
</table></td></tr></table>
";

if ($incl_prevphoto=='yes')
{
get_jpg_path($row['idnum']);
 
$phlimitinfo="";
if ($prphotolimits=='yes'){
if ($pr_lim_height==""){
$phlimitinfo="width='$pr_lim_width'";
}
else{
$phlimitinfo="width='$pr_lim_width' height='$pr_lim_height'";
}
}
 
if (file_exists($previewphoto_path)){

$thtml=$thtml. "
<center>
<font class='stfnt'>
".$msg['preview_photo'].": 
<img src='$previewphoto_url' $phlimitinfo hspace='6' align='center'> 
</font>
</center>
";
}
}

$thtml=$thtml. print_photos1($row['idnum'], $row)."
</tr></td></table>
";

include($templ['sbm']);
exit;
}

function form_sql_entry($idnum)
{
global $ct,  $table_ads, $visible_val, $cat_fields,
$HTTP_POST_VARS, $moderating, $adphotos, $cook_login;

$db_entry['login']=$cook_login;

$time_now=time();
 
$db_entry['idnum']=$idnum;

$db_entry['exptime']=$time_now + $expperiod*86400;
$db_entry['time']=$time_now;
$db_entry['catname']=$ct;
$db_entry['visible']=$visible_val;
$db_entry['adphotos']= $adphotos;

global $fb_intrfc; if($fb_intrfc=="yes"){
$fb_submfld=fb_submitfld(); if ($fb_submfld){$db_entry=$db_entry+$fb_submfld;}
}

foreach ($cat_fields as $key => $value)
{
 
$db_entry[$key]=$HTTP_POST_VARS[$key];

}
 
return $db_entry;
}
 
function add_sql_entry($idnum)
{
global $ct, $db_entry, $table_ads, $visible_val, $cat_fields,
$HTTP_POST_VARS, $ad_idnum, $oldvrsn, $REMOTE_ADDR, $waflnscr, $_REQUEST;

 
$ad_idnum=$idnum;
$db_entry=form_sql_entry($idnum);

$db_entry['cntemll']="0";
$db_entry['cntvstr']="0";
$db_entry['ratevtcn']="0";
$db_entry['ratevtrt']="0";
$db_entry['adcommkey']=0;

if ($HTTP_POST_VARS['replidf'] !=""){
$db_entry['replyid']=$HTTP_POST_VARS['replidf'];
$db_entry['adcommkey']=1;
}
 
$db_sql_string="";
$db_sql_var="";
foreach ($db_entry as $db_key => $db_value)
{
if ($db_key !="")
{
if ($db_entry[$db_key] == "" )
{
$db_sql_string=$db_sql_string."NULL, ";
}
else{
$db_sql_string=$db_sql_string."'$db_entry[$db_key]', ";
}
$db_sql_var=$db_sql_var."$db_key, ";
}
}


if($waflnscr=="yes") {$db_sql_string=$db_sql_string."'".$_REQUEST['afflusrip']."', ";}
else{$db_sql_string=$db_sql_string."'$REMOTE_ADDR', ";}
$db_sql_var=$db_sql_var."ipaddr1, "; 

if($waflnscr=="yes") {
$db_sql_string=$db_sql_string."'".$_REQUEST['afflprid']."', ";
$db_sql_var=$db_sql_var."afprtid1, "; 

$db_sql_string=$db_sql_string."'$REMOTE_ADDR', ";
$db_sql_var=$db_sql_var."afstip1, "; 


}

global $flattchext;
if ($flattchext!=""){
$db_sql_var=$db_sql_var.flattsbf(); 
$db_sql_string=$db_sql_string.flattsbv(); 
};

$db_sql_string=corr_sqlstring($db_sql_string);
$db_sql_var=corr_sqlstring($db_sql_var);
$sql="insert into $table_ads ( $db_sql_var ) values( $db_sql_string )";
return $sql;

} 

?>

and

<?php

include('funcs2.php');  

global $useajxctnv; if($useajxctnv=="yes"){include("jstop.php");}

function print_categories()
{global $useajxctnv, $ctcnt_m; 

check_expadsp();

catname_adscnt();

if($useajxctnv=="yes"){print_categories2();}
else{print_categories1();}
}

function print_categories1()
{ 
global $html_header, $html_footer, $categories,$ad_ind_width,$schopt,$ads_fields,$subcnmb,$javastl,$hghltcat,
$catl_width, $top_page_info,  $top_page_width, $topsearchfields, $top_leftcol,$catcols,$_REQUEST,$hdhctgrs,
$tbclr_1, $tbclr_2, $tbclr_3, $tbclr_4, $fntclr_1, $msg, $top_rightcol,$btmtophtml, $templ,
$top_bottom,$getcityval, $popctgr, $top_rightcol, $tmltads, $slctcntr, $locations, $use_ajax, $useajxctnv;

$top_rightcol="";

global $rmmbrloc;
if ($_REQUEST[$schopt]!=''){  

$cityhtml="<p>
<font class=stfntb> 
    <b>".$ads_fields[$schopt][0].": ".$_REQUEST[$schopt]." </b></font>
        <font class='stfnt'>( <a href='index.php?allc=1'>".$msg['all_cities']."</a> $rmmbrloc )</font> </font>
 
<br>
";

$citgtv1=$_REQUEST[$schopt];
$getcityval="$schopt=".checkgetfld($citgtv1)."&";
 
}

if ($_REQUEST[$schopt]!=""){$ltstcityv="&city=".checkgetfld($_REQUEST[$schopt]);}
else{$ltstcityv="";}

global $nbadsgrpct;
if($nbadsgrpct=="yes") {$grp_cnt=get_grpcnt();}

$popctgr=""; $divkey1="0";  
foreach ($categories as $key => $value)
{
 
$aa1=split("_",$key);

if ($aa1[0]=='newcol'){$rthkm11=0; } else {
if ($aa1[0]=='newcolumn'){$divkey1="0";   $categ[$key]="</td><td valign='top'>";}
else {
if($aa1[0] == 'title')
{   

$p_val1=""; if ($divkey1=="1"){$p_val1="<p>";}

global $nbadsgrpct; if ($nbadsgrpct=="yes"){$nmbgrptp="(".$grp_cnt[$aa1[1]].")";}else{$nmbgrptp="";}

$categ[$key]= "
$p_val1
<TABLE BORDER=0 WIDTH='90%' cellspacing=0 cellpadding=0 class='ct_group'>
<TR><td><a href='index.php?".$getcityval."md=browse&mds=search&gmct=".$aa1[1]."' class='ttl_grp'>".$categories[$key].":</a>   $nmbgrptp 
</TD></TR></table>
";

}else 
{

if (($categories[$key][2] != 'h') and ($key != 'evntcl'))
{$divkey1="1";$categ[$key]=print_cat_name($key);}

}
}
}


}

if ($schopt != '' and $use_ajax!="yes"){$locations=print_location();}
 

include ($templ['top']); 
exit;
}


function get_grpcnt()
{ 
global $categories, $sql_mct1, $table_ads, $grpcnt, $gkey2, $HTTP_GET_VARS;
 
foreach ($categories as $key => $value)
{
$aa1=split("_",$key);
if($aa1[0]== 'title'){$kk1=0; 
if ($sql_mct1!=""){

get_gcnt2();
 
}
$sql_mct1="";
}
if($kk1==1 and $key!="evntcl" and  $key!="evcl_rpl" and 
$categories[$key][2]!="h" and $aa1[0]!='newcolumn'){$sql_mct1=$sql_mct1." catname='$key' or";}
if($aa1[0]== 'title'){$kk1=1; $gkey2=$aa1[1];}
}

get_gcnt2();
 
return $grpcnt;
}

function get_gcnt2()
{ 
global $sql_mct1, $table_ads, $grpcnt, $gkey2, $HTTP_GET_VARS, $sqlaflcl;

if ($HTTP_GET_VARS['city']!=""){ $city_query=" and city='".$HTTP_GET_VARS['city']."' ";};
 
$sql_mct1=preg_replace ("/or$/", "", $sql_mct1);
$sql_mct1="( $sql_mct1 ) and ";
$sql_query="select count(idnum) from $table_ads where $sql_mct1 $sqlaflcl visible=1 $city_query";
$sql_res=mysql_query("$sql_query"); 
$row=mysql_fetch_row($sql_res);
$grpcnt[$gkey2]=$row[0];

}

 
function print_cat_name($key)
{
global $categories, $fntclr_1, $msg, $subcnmb, $getcityval,$popctgr, $ctcnt_m;

# $dtupd=get_date_update($key); if ($dtupd!=''){$dtupd=$msg['updated_t'].": ".$dtupd;}

if ($ctcnt_m[$key]!=""){$cntctvl=$ctcnt_m[$key];} else {$cntctvl="0";}

global $nmbadsctgt; if ($nmbadsctgt=="yes"){$ctnmptp=" <font class='ct_count'>({$cntctvl})</font>";}else{$ctnmptp="";}

$vhtml= "
<nobr><a href='".sturl_ct_top($key,$getcityval, "1")."'>
".$categories[$key][0]."</a> {$ctnmptp} </nobr> <br>
";
return $vhtml;
}

function catname_adscnt()
{ 
global $table_ads, $schopt, $host_name, $db_user, $db_password, $db_name, $ctcnt_m, $_REQUEST;

if ($_REQUEST[$schopt]!=''){$wrvl="and $schopt='".$_REQUEST[$schopt]."'";};

global $sqlaflcl;
$sql_query="select catname, count(idnum) from $table_ads  where $sqlaflcl   visible=1 $wrvl group by catname ";
$sql_res=mysql_query("$sql_query"); 
while ($row = mysql_fetch_row($sql_res))
{$key=$row[0];  
$ctcnt_m[$key]=$row[1];
}
return $lmass;
}


function print_location()
{
global $slctcntr,  $HTTP_GET_VARS, $ads_fields,$choosecntr ;
if ($slctcntr=='yes'){$res=print_location2();}
else{ $res=print_location1();}
return $res;
}


function print_location1()
{
global $ads_fields, $schopt, $tbclr_2, $tbclr_4,$tbclr_1, $msg, $subcnmb;

$ads_fields[$schopt][7]=ereg_replace("\n", '', $ads_fields[$schopt][7]);
$ads_fields[$schopt][7]=ereg_replace("\r", '', $ads_fields[$schopt][7]);
$vr2=split('<option>',$ads_fields[$schopt][7]);
if ($subcnmb=='yes'){$lnbmass=locadsnumb();}
$htmlv= "
 <a href='index.php?allc=1'>".$msg['all_cities']."</a>
";
foreach ($vr2 as $key2){
if($key2!=''){
if (($subcnmb=='yes') and ($lnbmass[$key2]=='')){$lnbmass[$key2]='(0)';}
$htmlv=$htmlv. "  <nobr> <a href='index.php?$schopt=".checkgetfld($key2)."'>$key2</a>".$lnbmass[$key2].",</nobr> ";}
}

return $htmlv;
}

function print_location2()
{
global $HTTP_GET_VARS, $ads_fields, $adrghtcol,$fslct, $adrghtcol, $choose_one1, 
$choosecntr,$urlclscrpt,$citdrdwn, $useajxctnv, $jscrptcctrct, $use_ajax ;
if ($use_ajax!="yes"){$jscrptcctrct="0";}
if ($useajxctnv=='yes' or $jscrptcctrct=="1"){  $res= print_location2js();}
else {$res= print_location2a(); }

return $res;
}

function print_location2a()
{
global $HTTP_GET_VARS, $ads_fields, $adrghtcol,$fslct, $adrghtcol, $choose_one1, $choosecntr,$urlclscrpt,$citdrdwn ;
 
$fld3v=$ads_fields['country'][7];
$dflt_value=$HTTP_GET_VARS['city'];
if ($citdrdwn=='yes'){$ifheight=40; $scrlvl="no";}else{$ifheight=450; $scrlvl="auto";} 

$chckvll=$choosecntr; if($HTTP_GET_VARS['country']!="")
                       {$chckvll=$HTTP_GET_VARS['country']; $chckvll2=$chckvll; $divval='block';}
                       else{$divval='none';}
 
$res= "
<script language='JavaScript'><!--
 function displ2(nmdiv){if (document.getElementById){
if (document.getElementById(nmdiv).style.display=='none') document.getElementById(nmdiv).style.display ='block';
 } else if (document.all) { if(document.all[nmdiv].style.display=='none') document.all[nmdiv].style.display ='block';}}
--></script>

<form action='index.php' method='GET' name='ctcity'>
 <select name='country' size='1' maxlength='30' class=formst STYLE='font-family: 
Verdana,Geneva,Arial; font-size: 13px; FONT-WEIGHT: bold;'  
onChange=\"document.getElementById('f$fld3v').src='index.php?md=slct3&fld=country&fld3=$fld3v&vl='+this.value; displ2('cts1');\"
>
<option value='$chckvll2'>$chckvll<checked>".sllist2('country')."</select>
</font>
<input type='hidden' name='city' id='tcity' value=''> 
<DIV id=cts1 style='DISPLAY: $divval'>
<iframe src='index.php?md=slct3&fld=".$ads_fields['city'][7]."&fld3=city&dvalue=$dflt_value&vl=$chckvll' id='fcity' frameborder=0   scrolling=$scrlvl
marginwidth='0' marginheight='0'  height='$ifheight' width='100%'></iframe>
</div>
</form>

$adrghtcol
";
return $res;
}


function locadsnumb()
{ 
global $table_ads, $schopt;
 
global $sqlaflcl;

$sql_query="select $schopt, count(idnum) from $table_ads $wrvl where $sqlaflcl visible=1 group by $schopt ";
$sql_res=mysql_query("$sql_query"); 
while ($row = mysql_fetch_row($sql_res))
{$loct=$row[0];  $loct=ereg_replace("’", '', $loct);
$lmass[$loct]="(".$row[1].")";
}
return $lmass;
}


function checkgetfld($value)
{
$value=ereg_replace(' ', '+', $value);
$value=ereg_replace('@', '%40', $value);
$value=ereg_replace('!', '%21', $value);
$value=ereg_replace("'", '%27', $value);
$value=ereg_replace("\"", '%27', $value);

return $value;
}


function get_total_count()
{
global $cat_fields, $table_ads, $ct, $page, $adsonpage, $html_header, 
$html_footer; 
 
global $sqlaflcl;

$sql_query="select count(idnum) from $table_ads where $sqlaflcl
visible=1 ";
if( !($sql_res=@mysql_query("$sql_query")))
{echo $html_header;
echo "
<center>
<font FACE='ARIAL, HELVETICA'  COLOR='#bb0000' size=-1><b>
Error in connecting to ads MySQL table <font color='#000099'>'$table_ads'</font>.
<br> Seems, this table is not created, 
<a href='createtb.php'>click here </a> to create this table.
</b></font></center>
";
echo $html_footer;
exit;
}

$row=mysql_fetch_row($sql_res);
$count=$row[0];
return $count;
} 



?>

Bingo.. I think this is the right one. someone please confirm if it is?

<?php
# Set up categories list

$categories=array(
'title_1' => "Personals",
'manw' =>array("Man Looking for Woman","set1",'age,goal'),
'womenm' =>array("Woman Looking for Man","set1",'age,goal'),
'manm' =>array("Man Looking for Man","set1",'age,goal'),
'womenw' =>array("Woman Looking for Woman","set1",'age,goal'),
'title_2' => "Merchandise",
'merch1' =>array("Appliances","set3",'type'),
'merch2' =>array("Books / Magazine","set3",'type'),
'merch3' =>array("Clothing / Accessories","set3",'type'),
'merch4' =>array("Collectibles","set3",'type'),
'merch5' =>array("Computers","set3",'type'),
'merch6' =>array("Electronics","set3",'type'),
'merch7' =>array("Furniture","set3",'type'),
'newcol_1' => "",
'merch8' =>array("Sports","set3",'type'),
'merch9' =>array("Jewelries","set3",'type'),
'merch10' =>array("Tickets","set3",'type'),
'merch11' =>array("CD / DVD","set3",'type'),
'merch13' =>array("Music Related","set3",'type'),
'merch14' =>array("Bicycles","set3",'type'),
'merch16' =>array("Other Merchandise","set3",'type'),

'title_3' => "Real Estate",
'rlest1' =>array("Commercial/Office","set3",'type'),
'rlest2' =>array("Farm and Land","set3",'type'),
'rlest3' =>array("Garage / Storage","set3",'type'),
'rlest4' =>array("Residential","set3",'type'),
'rlest5' =>array("Real Estate for Rent","set3",'type'),
'rlest6' =>array("Vacation Rentals","set3",'type'),
'rlest7' =>array("Apartments","set3",'type'),
'rlest8' =>array("Other Real Estate Ads","set3",'type'),


'title_4' => "Community",
'commun1' =>array("Activity Partners","set5"),
'commun2' =>array(" Announcements","set5"),
'commun3' =>array("Events/Parties","set5"),
'commun4' =>array("Friends","set5"),
'commun5' =>array("Lost & Found Items","set5"),
'commun6' =>array("Birthdays","set5"),
'commun7' =>array("Weddings","set5"),
'commun8' =>array("Volunteers ","set5"),

'newcolumn_1' => "",

'title_5' => "Careers, Jobs",
'job1' =>array("Accounting Jobs","set2","jobtype"),
'job2' =>array("Advertising","set2","jobtype"),
'job3' =>array("Administrative/Office","set2","jobtype"),
'job4' =>array("Agriculture ","set2","jobtype"),
'job5' =>array("Arts/Media","set2","jobtype"),
'job6' =>array("Automotive","set2","jobtype"),
'job7' =>array("Banking/Finance","set2","jobtype"),
'job8' =>array("Pharmaceutical","set2","jobtype"),
'job9' =>array("Computer Engineering","set2","jobtype"),
'job11' =>array("Computer Tech. Support","set2","jobtype"),
'job14' =>array("Education Jobs ","set2","jobtype"),
'job15' =>array("Engineering Jobs","set2","jobtype"),
'job16' =>array("Fitness/Sports","set2","jobtype"),
'job17' =>array("Work from Home","set2","jobtype"),
'newcol_2' => "",
'job18' =>array("Healthcare Jobs","set2","jobtype"),
'job20' =>array("Human Resources","set2","jobtype"),
'job21' =>array("Legal","set2","jobtype"),
'job22' =>array("Manufacturing Jobs","set2","jobtype"),
'job23' =>array("Marketing","set2","jobtype"),
'job24' =>array("General Management","set2","jobtype"),
'job25' =>array("Non Profit Jobs  ","set2","jobtype"),
'job27' =>array("Part-time Jobs","set2","jobtype"),
'job28' =>array("Publishing","set2","jobtype"),
'job29' =>array("Retail Jobs","set2","jobtype"),
'job30' =>array("Transportation","set2","jobtype"),
'job31' =>array("Veterinary Services","set2","jobtype"),
'job32' =>array("Other Jobs","set2","jobtype"),

'title_6' => " Vehicles",
'veh1' =>array("Cars","set3",'type'),
'veh2' =>array("Vans / Minivans","set3",'type'),
'veh3' =>array("Motorcycles","set3",'type'),
'veh4' =>array("Trailers & Other","set3",'type'),
'veh5' =>array("Auto Parts","set3",'type'),
'veh6' =>array("Buses","set3",'type'),
'veh7' =>array("Trucks","set3",'type'),
'veh9' =>array("Watercrafts","set3",'type'),
'veh10' =>array("Other Vehicles","set3",'type'),

'newcolumn_2' => "",

'title_7' => "Software",
'soft1' =>array("Perl Programming","set3",'type'),
'soft2' =>array("PHP Programming","set3",'type'),
'soft3' =>array("ASP Programming","set3",'type'),
'soft4' =>array("Web Design","set3",'type'),
'soft5' =>array("E-Commerce","set3",'type'),
'soft6' =>array("Java, JavaScript","set3",'type'),
'newcol_3' => "",
'soft7' =>array("C++ Development","set3",'type'),
'soft8' =>array("Delphi Programming","set3",'type'),
'soft9' =>array("Visual Basic","set3",'type'),
'soft10' =>array("UNIX Programming","set3",'type'),
'soft11' =>array("Databases","set3",'type'),
'soft12' =>array("Networking","set3",'type'),

'title_8' => "Services",
'servs1' =>array("Childcare","set3" ),
'servs2' =>array("Elderly Care","set3" ),
'servs3' =>array("Construction","set3" ),
'servs4' =>array("Household Help","set3" ),
'servs5' =>array("Labor Offered","set3" ),
'servs6' =>array("Landscape","set3" ),
'servs7' =>array("Other Services","set3" ),

'title_9' => "Music",
'mus1' =>array("Announcements","set5"),
'mus2' =>array("Musicians","set5"),
'mus3' =>array("Bands","set5"),
'mus4' =>array("Musical Instruments","set5"),
 
'mus5' =>array("Services","set5"),
'mus6' =>array("Collectibles","set5"),
'mus7' =>array("Other Music Ads","set5"),

'title_10' => "Pets",
'pet1' =>array("Birds","set5"),
'pet2' =>array("Cats","set5"),
'pet3' =>array("Dogs","set5"),
'pet4' =>array("Exotic Pets","set5"),
'pet5' =>array("Fish","set5"),
'pet6' =>array("Horses","set5"),
'pet7' =>array("Reptiles","set5"),
'pet8' =>array("Pet Services","set5")

);

# Set up the sets of the fields for categories
$fields_sets=array (
'set1' => array (title,name,age,weight,height,smoker,goal,country,city,brief,moredetails,contact_name,contact_phone,email,
homeurl,passw,keywords),
'set2' => array (title,jobtype,salary,company,country,city,specloc,brief,contact_name,contact_phone,email,homeurl,passw,keywords),
'set3' => array (title,type,price,company,country,city,specloc,brief,contact_name,contact_phone,email,homeurl,passw,check1,keywords),
'set4' => array (title,initialad,comment,email,homeurl,passw,keywords),
'set5' => array (title,country,city,specloc,brief,contact_name,contact_phone,email,homeurl,keywords,passw),
'set6' => array (eventdt,title,country,city,brief,contact_name,contact_phone,email,homeurl,keywords,passw),
'set7' => "",
'set8' => ""
);

 

#  Set up description of ad fields used in all categories:
$ads_fields= array(
'eventdt' => array('Event Date','12','nosearch','40:50','date','1','date'),
'title' => array('Title','00','nosearch','40:50','text','1','varchar(150)'),
'brief' => array('Brief Description','2','nosearch','60:5:200','textarea','1','text'),
'initialad' => array('In the initial ad written','2','nosearch','40:4:400','textarea','0','text'),
'comment' => array('Comment','2','nosearch','40:4:200','textarea','1','text'),
'contact_name' => array('Contact Name','2','nosearch','40:50', 'text', '0','varchar(100)'),
'contact_phone' => array('Contact Phone','2','nosearch','20:50', 'text', '0','varchar(100)'),
'email' => array('Contact e-mail','00','nosearch','20:50', 'text', '1','varchar(100)'),
'homeurl' => array('Home Page URL', '00','nosearch','40:50', 'text','0','varchar(100)'),
'passw' => array('Edit/delete password','00','nosearch','20:50', 'text','1','varchar(50)'),
'name' => array('Name','12','nosearch','40:50','text','0','varchar(100)'),
'country' => array('Country','12','nosearch','40:50','text','0','varchar(50)'),
'city' => array('City','12','nosearch','1:30','select','1','varchar(50)', '<option>Akron OH<option>Albany NY<option>Albuquerque NM<option>Allentown PA<option>Anchorage AK<option>Atlanta GA<option>Atlantic City NJ<option>Austin TX<option>Baltimore MD<option>Baton Rouge LA<option>Billings MT<option>Birmingham AL<option>Bismarck ND<option>Boise ID<option>Boston MA<option>Buffalo NY<option>Burlington VT<option>Casper WY<option>Charleston SC<option>Charleston WV<option>Charlotte NC
<option>Chattanooga TN<option>Cheyenne WY<option>Chicago IL<option>Cincinnati OH<option>Cleveland OH<option>Columbia SC<option>Columbus OH<option>Dallas TX<option>Dayton OH<option>Denver CO<option>Des Moines IA<option>Detroit MI<option>El Paso TX<option>Erie PA<option>Eugene OR<option>Fargo ND<option>Fort Smith AR<option>Grand Rapids MI<option>Green Bay WI<option>Greensboro NC<option>Hartford CT<option>Honolulu HI<option>Houston TX<option>Indianopolis IN<option>Jackson MS<option>Jacksonville FL<option>Jersey City NJ<option>Kansas City MO
<option>Knoxville TN<option>Las Vegas NV<option>Lexington KY<option>Little Rock AR<option>Los Angeles CA<option>Louisville KY<option>Madison WI<option>Manchester NH<option>Memphis TN<option>Miami FL<option>Milwaukee WI<option>Minneapolis MN<option>Missoula MT<option>Mobile AL<option>Montgomery AL<option>Nashville TN<option>New Haven CT<option>New Orleans LA<option>New York<option>Norfolk VA<option>Okla. City OK<option>Omaha NE<option>Orlando FL<option>Philadelphia PA<option>Phoenix AZ<option>Pittsburgh PA<option>Portland ME<option>Portland OR<option>Providence RI<option>Raleigh NC<option>Rapid City SD
<option>Reno NV<option>Richmond VA<option>Rochester NY<option>Sacramento CA<option>Saint Louis MO<option>Salt Lake UT<option>San Antonio TX<option>San Diego CA<option>S F Bay Area CA<option>Seattle WA<option>Shreveport LA<option>Sioux Falls SD<option>Spokane WA<option>Stamford CT<option>Syracuse NY<option>Tampa Bay FL
<option>Toledo OH<option>Topeka KS<option>Tucson AZ<option>Tulsa OK<option>Washington DC<option>Wichita KS<option>Wilmington DE<option>Yonkers NY<option>other'),
'goal' => array('Goal','12','keyword','1:30','select', '1', 'varchar(50)',
        '<option>Marriage<option>Sex<option>Virtual Romance<option>Penpal<option>Other'),	
'check1' => array('checkbox field','2','nosearch','1:30','checkbox','0','text', 
        '<option>checkoption 1<option>checkoption 2<option>checkoption 3' ),
'type' => array('Type','12','keyword','1:30','select', '0','varchar(50)',
'<option>Wanted<option>Offered' ),	
'jobtype' => array('Type','12','keyword','1:30','select', '1','varchar(50)',
'<option>Job Offered<option>Job Wanted' ),
'specloc' => array('Specific Location',"2",'nosearch','50:100','text', '0','varchar(150)'),
'price' =>  array('Price','12','minmax','10:30','text','0','float(4,2)'),
'salary' => array('Salary','12','minmax','10:30','text','0','integer'),
'company' => array('Company',"12",'keyword','20:30','text', '0','varchar(50)'),
'smoker' => array('Smoker','2','nosearch','1:30','select', '0', 'varchar(50)',
'<option>Yes<option>No' ),
'age' =>  array('Age','12','keyword','1:30','select', '1', 'varchar(40)',
        '<option>18-20<option>20-25<option>25-30<option>30-35<option>35-40<option>40-50<option>more 50'),
'weight' =>  array('Weight,kg','2','minmax','10:30','text','0','integer'),
'height' =>  array('Height,cm','2','minmax','10:30','text','0','integer'),	
'moredetails' => array('More Details','2','nosearch','60:10:2000','textarea','0','text'),
'addrmap' => array('Map Address','00','nosearch','40:50','text','0','varchar(200)'),
'adfld1' => array('reserved field 1 (integer type)','00','nosearch','40:50','text','0','text'),
'keywords' => array('Keywords','2','nosearch','40:50', 'text', '0','text') 
);


# Dimensions for ads fields
$fld_dim = array(
'weight' => 'kg',
'height' => 'cm',
);

# Dimensions for ads fields which will be printed before value e.g. $
$fld_dimd = array(
'price' => '$',
'salary' => '$'
);

# Set up name of fields sets which will be used  for displaying ads when user clicks on the link of  the group with several  categories; 
# e.g. for category group with key 'title_1' you can set up fields set 'set1' as the following:
#  '1' => 'set1'
$ctgroups_sets=array('1' => 'set1', '2' => 'set3', '3' => 'set3', '4' => 'set5', 
'5' => 'set2','6' => 'set3', '7' => 'set3', '8' => 'set3', '9' => 'set5', '10' => 'set5' );


# set up comments for fields on ads submitting form
$fields_comm=array(
'title' => 'place title of ads here (any comment for ad field)',
'brief' => ' main idea of your ad (any comment for ad field) ',
'age' => '(any comment for ad field)',
'homeurl' => '(any comment for ad field)',
'email' => '(any comment for ad field)',
'moredetails' => '(any comment for ad field)',
'contact_name' => '(any comment for ad field)',
'contact_phone' => '(any comment for ad field)',
'addrmap' => "(address format: <font COLOR='#007700'>number street, city, country</font>)"
);


# Set up short names of the fields which will be displayed 
# on the search form on the top page (it is necessary when search through all categories ) .
$allcatfields=array('title','city','brief');

# Set up keywords for <meta> tag for all categories and  specific keywords for separate categories
$mtg_keywrds=array(
"all" => "almond classifieds, ads,  php scripts, multiple categories, 
  powerful search, privacy mail,   ads moderating",
"job1" => "classifieds, Careers, Jobs",
"job2" => "classifieds, Careers, Jobs"
); 

# Set up description for <meta> tag for all categories and  specific description for separate categories
$mtg_descr=array(
"all" => "Classifieds main idea - easy to use, configurate and install;
 easy set up custom categories, fields, search; Try to install free version to make sure. ",
"job1" => "Careers, Jobs",
"job2" => "Careers, Jobs"
);  

# Set up fields which will be added to keywords list for <meta> tag on ads details pages
$mtfldkwrs=array('city','name','company','goal');


?>
  • Solution

or this:

<?php

function get_adsgal()
{
global $_SERVER, $_REQUEST, $ads_count, $msg, $use_adsphgal;

$qrstr=$_SERVER['QUERY_STRING'];

 $qrstr=preg_replace ("/page=.*&/U", "page=1&", $qrstr);

$qrstr=stripslashes($qrstr);
$qrstr=preg_replace('/\'/', ''', $qrstr);

if ($_REQUEST['adsgal']=='1'){
$qrstr=ereg_replace('&adsgal=1', '', $qrstr);
$rslt="
<a href='index.php?{$qrstr}'>".$msg['view_ads_list']."</a>
";
}
else {
$rslt="
<a href='index.php?{$qrstr}&adsgal=1&page=1'>".$msg['view_photos_gallery']."</a>
";
}
if ($ads_count>0 and $use_adsphgal=='yes'){$rslt="<font class='stfnt'> $rslt </font>        ";}else{$rslt="";}
return $rslt;

}


function browse_ads()
{
global $ads_count,  $ct, $mds, $schopt,$urlclscrpt,
$categories, $ad_ind_width, $text_userinfo, $cat_fields, $ratedads, $ind_leftcol, $templ,
$tpadsindd,$bc2adsfrm,$HTTP_GET_VARS,
$adbnrcll, $width_2tpf, $schresinfo, $msg, $idadcol, $_REQUEST, $javastl, 
$pltopratedln, $pltopcontln, $pltopvisitln,
$fld_dim, $fld_dimd, $check_rate, $ad_date, $ad_fields, $idnum, $ad_comment, $ad_title, 
$check_photos, $categ_name, $cat_fields, $fields_layer, $photo_path, $lr_fields, $use_gl_map, $hltadsf, $check_subcateg ; 

if ($HTTP_GET_VARS['mfvrt']=="1") {$schresinfo=$msg['your_favorite_ads'];}

if($categories[$ct][2]!=""){$check_subcateg=1;}else{$check_subcateg="";}

$idadcol='0';
if ($mds=="search") 
{$count_info=" $ads_count ".$msg['ads_match_your_query'];}
else {$count_info="$ads_count ".$msg['entries'];}  
$citygetval="";
if(($mds!='search') and ($HTTP_GET_VARS[$schopt]!="")){$citygetval="?".$schopt."=".$HTTP_GET_VARS[$schopt];}
# get_ads_captions();


if ($_REQUEST['adsgal']=='1'){include('indgal.php');}
else{include($templ['index']);}
exit;
}



function subcat_options()
{
global $ads_fields,  $HTTP_GET_VARS, $fntclr_3, $fntclr_1;

 
$vhtml="    ";

$k1='';
foreach ($ads_fields as $key => $value )
{
if ($HTTP_GET_VARS[$key] != "") { 
$vhtml=$vhtml."  <nobr><font class=stfntb><b>
".$ads_fields[$key][0].":  ".$HTTP_GET_VARS[$key]."</b></font></nobr> ";
}
}

global $rmmbrloc, $msg;

if ($HTTP_GET_VARS['city']!=""){
if ($HTTP_GET_VARS['ct']!=""){$url_val="ct=".$HTTP_GET_VARS['ct']."&";}
if ($HTTP_GET_VARS['gmct']!=""){$url_val="md=browse&mds=search&gmct=".$HTTP_GET_VARS['gmct']."&";}
$vhtml=$vhtml."   <font class='smallfnt'><nobr>(<a href='index.php?".$url_val."allc=1'>".$msg['all_cities']."</a> $rmmbrloc )</nobr></font>";
}


return $vhtml;
}


function print_ad($row)
{
global $cat_fields, $photos_count, $ct, $categories, $incl_prevphoto, $urlclscrpt,
$previewphoto_url, $previewphoto_path, $prphotolimits, $pr_lim_height, $pr_lim_width,
$prwph_layer, $colr_hltads, $capt_hltads, $prphscr,$prphscrwdth,$prwdly, $photo_path,
$tbclr_1, $tbclr_2, $tbclr_3, $tbclr_4, $fntclr_1, $lnkttlfl, $msg,
$idadcol, $colspn, $tbclhlads, $coltblayer,
$check_rate, $ad_date, $ad_fields, $idnum, $ad_comment, $ad_title,  $fld_dim, $fld_dimd,
$check_photos, $categ_name, $lr_fields, $fields_layer, $vrwcomm;

$vrwcomm=$row['adcommkey'];

$row=check_row($row);

if($row['adrate']>0){$check_rate=1;} else {$check_rate=0;}
if($row['adphotos']=='yes'){$check_photos=1;} else {$check_photos=0;}
 

$time1=$row['time'];
$ad_date=get_short_date($time1);
$idnum=$row['idnum'];

$ctval=$ct;
 
$key_ctn=$row['catname'];
$categ_name="
<a href='".sturl_ct_ind($key_ctn)."'>
".$categories[$key_ctn][0]."</a>
";

$row_title=$row['title'];
global $maxttlsz;
if (strlen($row_title)>$maxttlsz) 
{$row_title=substr($row_title,0,$maxttlsz); 
$row_title= preg_replace ("/\s\S+$/", "...", $row_title); }

$ad_title=" 
<a href='".sturl_ads($ctval, $idnum,$row['title'])."' 
  title='#$idnum' ".print_layerlink($idnum)." class='ad_title'>
".$row_title."</a> 
";

$ad_fields=""; $lr_fields="";
foreach ($cat_fields as $key => $value) 
{
if (($fields_layer[$key] == 'yes') and ($row[$key]!="") and ($row[$key]!="--") )
{$lr_fields[$key]=$row[$key];}

if ( ($cat_fields[$key][1]=='1') or ($cat_fields[$key][1] == '12'))
{
if (($row[$key]!="--") and ($row[$key]!="")) {$ad_fields[$key]=$row[$key]; }
}

}

if ($row['adcommkey']==1){
$ad_comment="
 <font class='fnt6'><nobr><a href='index.php?md=details&id=".$row['replyid']."'   >
 ".$msg['View_initia_ad']."(#".$row['replyid'].")</a></nobr></font>
";
}

if ($row['comment']!="")
{$ad_comment=$ad_comment."<br>   <font class='fnt7'>".$row['comment']."</font>";}

}

?>

last one.

<?php

function get_ads_captions()
{

global $cat_fields, $ads_count, $ct, $photos_count, $incl_prevphoto, $prwph_layer,
$tbclr_1, $tbclr_2, $tbclr_3, $tbclr_4, $fntclr_1, $fntclr_2,$tbclr_5,$colspn,
$lnkttlfl, $msg, $prphscr, $use_gl_map,  $clmnmap, $nmcolmap, $incl_prevpht1;

$bgcol21="$tbclr_5";
$bgcol22="$fntclr_2";
$colspn=0;
$captions="<tr>";

if ($incl_prevpht1=='yes')  
{$colspn=$colspn+1;
$captions=$captions." 
<td align='center' class='adscpt'>
".$msg['preview_photo']."</td>
";
}

$captions=$captions." 
<td align='center' class='adscpt' width='40%'>
".$cat_fields['title'][0]."   
 </td>
";

foreach ($cat_fields as $key => $value)
{
$ik++;
if ( ($cat_fields[$key][1]=='1') or ($cat_fields[$key][1] == '12'))
{$colspn=$colspn+1;
$captions=$captions." 
<td align='center' class='adscpt'>
".$cat_fields[$key][0]." 
 </td>
";
}
}
if ($photos_count > 0)
{$colspn=$colspn+1;
$captions=$captions."
<td align='center' class='adscpt'>
 ".$msg['photoind']."
</td>
";
}


if ($use_gl_map=='yes' and  $clmnmap=='yes'){
$colspn=$colspn+1;
$captions=$captions."
<td align='center' class='adscpt' width='5%'> 
$nmcolmap 
</td>
";
}

$colspn=$colspn+1;
$captions=$captions."
<td align='center'class='adscpt' width='5%'>
 ".$msg['posted']." 
</td>
";

global $fb_intrfc;
if ($fb_intrfc=="yes"){
$colspn=$colspn+1;
$captions=$captions."
<td align='center'class='adscpt' width='5%'  >
 ".$msg['fb_usrclmn']." 
</td>
";
}


if ($ct == '')
{$colspn=$colspn+1;
$captions=$captions." 
<td align='center' class='adscpt'>
".$msg['category']."
</td>
" ;
}

global $hltnmbv;

$captions=$captions."</tr>";
if($ads_count == 0 and $hltnmbv!="1") $captions="";
return $captions;
}

function print_ads_ind ($row)
{
global $cat_fields, $photos_count, $ct, $categories, $incl_prevphoto, $urlphtn1,
$previewphoto_url, $previewphoto_path, $prphotolimits, $pr_lim_height, $pr_lim_width,
$prwph_layer, $colr_hltads, $capt_hltads, $prphscr,$prphscrwdth,$prwdly, $photo_path,
$lnkttlfl, $msg, $idadcol, $colspn, $urlclscrpt,
$tbclhlads, $coltblayer, $use_gl_map,  $clmnmap, $hltinf,$hltlstk, $incl_prevpht1, 
$fld_dimd, $fld_dim;

$stl1_ads='adslst1';
$stl2_ads='adslst2';

$capt1_hltads="";

if($row['adrate']>0)
{
$stl1_ads='adshlt1';
$stl2_ads='adshlt2';
$capt1_hltads=$hltinf;
$coltblayer=$tbclhlads;
}

if ($idadcol=="0"){$adtbstl="class='$stl1_ads'"; $idadcol="1";} else {$adtbstl="class='$stl2_ads'"; $idadcol="0";}
$row=check_row($row); 
  
$html_ad="<tr>";
$time1=$row['time'];
$ad_date=get_short_date($time1);
$idnum=$row['idnum'];

$ctval=$ct;
 


if ($incl_prevpht1=='yes')  
{ 
if ($prphotolimits=='yes'){
if ($pr_lim_height==""){
$phlimitinfo="width='$pr_lim_width'";
}
else{
$phlimitinfo="width='$pr_lim_width' height='$pr_lim_height'";
}
}
get_jpg_path($idnum);
if(file_exists($photo_path[1])){
     $html_ad=$html_ad."
      <td bgcolor='#ffffff'  align='center' width='5%' >
<a href='".sturl_ads($ctval, $idnum,$row['title'])."' 
   title='#$idnum'>
     <img src='".$urlclscrpt."sph.php?id=$idnum&wd=$prphscrwdth&np=1' $phlimitinfo border=0 > 
</a> 
</td>
     ";}
else {
$html_ad=$html_ad."
<td $adtbstl  align='center' width='5%'  >
-- 
</td>
";
}
} 

$row_title=$row['title'];
global $maxttlsz;
if (strlen($row_title)>$maxttlsz) 
{$row_title=substr($row_title,0,$maxttlsz); 
$row_title= preg_replace ("/\s\S+$/", "...", $row_title); }

$titlfldind="$capt1_hltads  <strong>
<a href='".sturl_ads($ctval, $idnum,$row['title'])."' 
  title='#$idnum' class='ad_title2'>".$row_title."</a></strong>  

";

if ($row['adcommkey']==1){
$ttlbrf="
  <a href='index.php?md=details&id=".$row['replyid']."'  >
<font class='smallfnt'>".$msg['View_initia_ad']."(#".$row['replyid'].")</font></a>
";
}

if ($row['comment']!=""){$ttlbrf=$ttlbrf."<br>   ".$row['comment'];}

$html_ad=$html_ad."
<td $adtbstl valign='center' width='40%'  height='40'>
$titlfldind </td>";

foreach ($cat_fields as $key => $value) 
{
if ( ($cat_fields[$key][1]=='1') or ($cat_fields[$key][1] == '12'))
{
if ($row[$key]!="--"){$row[$key]=$fld_dimd[$key].$row[$key].$fld_dim[$key];}; 
$html_ad=$html_ad."
<td $adtbstl align='center'>
<nobr>".$row[$key]."</nobr>  </td>";}
}

if ($photos_count > 0)
{
if ($row['adphotos']=="yes"){$adphtovl=$msg['pictvl'];}
else {$adphtovl="-";}
$html_ad=$html_ad."
<td $adtbstl align='center' width='2%'>
<font class='smallfnt'> 
 $adphtovl 
</font>
</td>
";
}

if ($use_gl_map=='yes' and  $clmnmap=='yes'){
$html_ad=$html_ad."
<td $adtbstl  align='center' width='5%'> 
<font class='smallfnt'> 
".adsjsp($row['addrmap'],$idnum)."
</font> 
</td>
";
}

$html_ad=$html_ad."
<td $adtbstl  align='center' width='10%'>
<font class='smallfnt'> 
 $ad_date 
</font>
</td>
";

global $fb_intrfc;
if ($fb_intrfc=="yes"){
if ($row['fbvusr']=="y")
{$fbusrind="<fb:profile-pic uid=\"".$row['fbvuid']."\" size=\"t\"/> ";}
else {$fbusrind="-";}
$html_ad=$html_ad."
<td $adtbstl class='td7'   width='10%' align='center'>
<font class='smallfnt'> 
 $fbusrind
</font>
</td>
";
}


if ($ct =='')
{
 
$key_ctn=$row['catname'];
$ctval=$key_ctn;
$html_ad=$html_ad."
<td $adtbstl align='center' width='10%'>
<font class='smallfnt'>
 <a href='index.php?md=browse&ct=$ctval'>
".$categories[$key_ctn][0]."
 </a></font>
 
</td>
";
}

$html_ad=$html_ad."</tr>";

return $html_ad;
}



?>
Edited by sxp
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.