initvars.php
<?php
if (!defined("INIT_DONE")) {
function handle_security_attack($msg="«") {
die($msg);
}
function check_variable_injection($varname, &$var, $strict) {
if(isset($var)) {
if ($strict) {
if (isset($_REQUEST[$varname]) || isset($_GET[$varname])
|| isset($_POST[$varname]) || isset($_COOKIE[$varname])) {
handle_security_attack();
}
} else {
if ((isset($_REQUEST[$varname]) && $var == $_REQUEST[$varname])
|| (isset($_GET[$varname]) && $var == $_GET[$varname])
|| (isset($_POST[$varname]) && $var == $_POST[$varname])
|| (isset($_COOKIE[$varname]) && $var == $_COOKIE[$varname])) {
handle_security_attack();
}
}
} else {
$var = "";
}
}
function check_numeric($var) {
if(isset($var)) {
if ($var == "") {
$var = 0;
} else if(strval(0+$var) !== "{$var}") {
handle_security_attack();
}
}
}
function check_numeric_parameter($var) {
if(isset($_GET[$var])) check_numeric($_GET[$var]);
if(isset($_POST[$var])) check_numeric($_POST[$var]);
if(isset($_COOKIE[$var])) check_numeric($_COOKIE[$var]);
if(isset($_REQUEST[$var])) check_numeric($_REQUEST[$var]);
}
function numerize(&$var) {
if(isset($var)) $var += 0;
}
function numerize_parameter($var) {
if(isset($_GET[$var])) numerize($_GET[$var]);
if(isset($_POST[$var])) numerize($_POST[$var]);
if(isset($_COOKIE[$var])) numerize($_COOKIE[$var]);
if(isset($_REQUEST[$var])) numerize($_REQUEST[$var]);
}
$xcatid = "";
$xsubcatid = "";
$xcityid = "";
$xcountryid = "";
$xadid = "";
$xdate = "";
$xpostmode = "";
$specialdates = "";
$xcatname = "";
$xsubcatname = "";
$xsubcathasprice = FALSE;
$xsubcatfields = array();
$syndicate = FALSE;
$msg = "";
$err = "";
$title_extra = "";
$in_admin = FALSE;
$admin_mode = FALSE;
/* Begin Version 5.0 */
$postable_country = FALSE;
$postable_category = FALSE;
/* End Version 5.0 */
//$path_escape = "";
// Some more sanitization
check_variable_injection("path_escape", $path_escape, TRUE);
check_numeric_parameter("cityid");
check_numeric_parameter("catid");
check_numeric_parameter("subcatid");
check_numeric_parameter("adid");
check_numeric_parameter("imgid");
check_numeric_parameter("countryid");
check_numeric_parameter("areaid");
check_numeric_parameter("pos");
check_numeric_parameter("picid");
check_numeric_parameter("page");
check_numeric_parameter("foptid");
check_numeric_parameter("eoptid");
check_numeric_parameter("isevent");
/* Begin Version 5.0 */
check_numeric_parameter("shortcutcat");
check_numeric_parameter("shortcutregion");
/* End Version 5.0 */
numerize_parameter("pricemin");
numerize_parameter("pricemax");
define("INIT_DONE", TRUE);
}
?>
cities.php
<?php
require_once("initvars.inc.php");
require_once("config.inc.php");
?>
<table width="100%"><tr><td valign="top">
<?php
// Show city list
if($location_sort)
{
$sort1 = "ORDER BY countryname";
$sort2 = "ORDER BY cityname";
}
else
{
$sort1 = "ORDER BY c.pos";
$sort2 = "ORDER BY ct.pos";
}
if ($show_region_adcount || $show_city_adcount)
{
// First get ads per city and country
$country_adcounts = array();
$city_adcounts = array();
$sql = "SELECT ct.cityid, c.countryid, COUNT(*) as adcnt
FROM $t_ads a
INNER JOIN $t_cities ct ON ct.cityid = a.cityid AND ($visibility_condn)
INNER JOIN $t_countries c ON ct.countryid = c.countryid
WHERE ct.enabled = '1' AND c.enabled = '1'
GROUP BY ct.cityid";
$res = mysql_query($sql) or die(mysql_error().$sql);
while($row=mysql_fetch_array($res))
{
$country_adcounts[$row['countryid']] += $row['adcnt'];
$city_adcounts[$row['cityid']] += $row['adcnt'];
}
}
$sql = "SELECT * FROM $t_countries c INNER JOIN $t_cities ct ON c.countryid = ct.countryid AND ct.enabled = '1' WHERE c.enabled = '1' GROUP BY c.countryid $sort1";
$resc = mysql_query($sql);
$country_count = mysql_num_rows($resc);
//$split_at = ($country_count%3?((int)($country_count/3))+2:($country_count/3)+1);
$percol = floor($country_count/$location_cols);
$percolA = array();
for($i=1;$i<=$location_cols;$i++) $percolA[$i]=$percol+($i<=$country_count%$location_cols?1:0);
$i = 0; $j = 0;
$col = 1;
while($country = mysql_fetch_array($resc))
{
/* Begin Version 5.0 */
$country_url = buildURL("main", array((0-$country['countryid']), $country['countryname']));
/* End Version 5.0 */
?>
<div><a href="<?php echo $country_url; ?>" class="citylist_country"><?php echo $country['countryname']; ?> <?php if($show_region_adcount) echo "(".(0+$country_adcounts[$country['countryid']]).")"; ?></a></div>
<?php
if($country['countryid'] == $xcountryid || !$expand_current_region_only)
{
$sql = "SELECT * FROM $t_cities ct WHERE countryid = $country[countryid] AND enabled = '1' $sort2";
$resct = mysql_query($sql);
/* Begin Version 5.0 */
$citycount = mysql_num_rows($resct);
/* End Version 5.0 */
while($city=mysql_fetch_array($resct))
{
/* Begin Version 5.0 */
if ($shortcut_regions && $citycount == 1
&& $city['cityname'] == $country['countryname']) {
continue;
}
$city_url = buildURL("main", array($city['cityid'], $city['cityname']));
/* End Version 5.0 */
?>
<a href="<?php echo $city_url; ?>" class="citylist_city"><?php echo $city['cityname']; ?> <?php if($show_city_adcount) echo "(".(0+$city_adcounts[$city['cityid']]).")"; ?></a><br>
<?php
}
}
?>
<?php
$i++; $j++;
//if($i%$split_at == 0) echo "</td><td valign=\"top\">";
if ($j%$percolA[$col]==0 && $i<$country_count) { echo "</td><td valign=\"top\">"; $col++; $j=0; }
}
?>
</tr></td></table>
And the file I'm tring to get to add the image of that states flag.
header.php
<?php if ($beta) {?>
<div style="background-color: lightyellow; border-bottom: 1px solid brown; text-align: center; padding: 10px 0px; margin-bottom: 10px; font-size: 12px; color: crimson; font-weight: bold;">
This demo contains features in beta that may not be present in the <a href="http://xzeroscripts.com/demos/xzero_classifieds/">script available for purchase</a> at this time.
</div>
<?php }?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="header">
<tr><td>
<div id="logo">
<br />
<br />
<?php
/* Begin Version 5.0 */
$homeurl = buildURL("main", array(0));
/* End Version 5.0 */
?>
<a href="<?php echo $homeurl;?>">
<img src="images/logo.gif" border="0"><br>
</a>
</div>
<?php if ($demo) {?>
<div id="demo">Demo mode.
<a href="http://www.xzeroscripts.com/products/xzero_classifieds/buy.php">Buy it now!</a>
</div>
<?php }?>
</td>
<td align="right" valign="top">
<div id="today">
<?php echo QuickDate(time(), FALSE);?>
</div>
<?php
$cityurl = buildURL("main", array($xcityid, $xcityname));
?>
<div id="citytitle">
<a href="<?php echo $cityurl;?>">
<?php echo $xcityid > 0 && !$postable_country ? "$xcityname, $xcountryname" : $xcountryname;?>
</a>
</div>
<b>
<?php if ($xview != "main" && !$show_sidebar_always) {?>
<!-- Begin Version 5.0 -->
<a href="<?php echo $homeurl;?>"><?php echo $lang['HOME_LINK'];?></a>
<!-- End Version 5.0 -->
<span class="flatnavsep">•</span>
<a href="<?php echo $postlink;?>" <?php if ($syndicate) echo "target=\"_blank\"";?>><?php echo $lang['POST_LINK'];?></a>
<?php if ($forum_dir) {?>
<span class="flatnavsep">•</span>
<a href="<?php echo $forum_dir;?>" target="_blank"><?php echo $lang['FORUM_LINK'];?></a><?php }?>
<?php }?>
<?php if ($demo) {?>
<span class="flatnavsep">•</span>
<a href="admin/" target="_blank">Admin</a>
<?php }?>
</b>
</td>
</tr></table>
What would I need to add to have the image of the state that is located in the dir
/classifieds/images/category/flag
The States are listed in the dB.