//get the settings
$qset = "select * from yellow_settings";
$rset = mysql_query($qset) or die(mysql_error());
$aset = mysql_fetch_array($rset);
//get the total vehicle listed
$usercount = "select * from yellow_posts";
$usercountqry = mysql_query($usercount) or die(mysql_error());
$usercountline = mysql_num_rows($usercountqry);
//get the total vehicle listed
$usercount2 = "select * from yellow_agents";
$usercountqry2 = mysql_query($usercount2) or die(mysql_error());
$usercountline2 = mysql_num_rows($usercountqry2);
function country($c) {
// $countries = array('Afghanistan', 'Albania', 'American Samoa', 'Andorra', 'Antigua', 'Argentina', 'Armenia', 'Australia', 'Austria', 'Azerbaijan', 'Bahrain', 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Bolivia', 'Bosnia-Herzegovina', 'Brazil', 'Brunei Darussalam', 'Bulgaria', 'Cambodia', 'Canada', 'Chile', 'China', 'Colombia', 'Costa Rica', 'Croatia', 'Cuba', 'Cyprus', 'Czech Republic', 'Denmark', 'Ecuador', 'Egypt', 'El Salvador', 'Estonia', 'Falkland Islands', 'Fiji', 'Finland', 'France', 'French Guyana', 'Georgia', 'Germany', 'Gibraltar', 'Greece', 'Greenland', 'Grenada', 'Guatemala', 'Honduras', 'Hong Kong', 'Hungary', 'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Israel', 'Italy', 'Japan', 'Jordan', 'Kazakhstan', 'Kenya', 'Kuwait', 'Kyrgyzstan', 'Laos', 'Latvia', 'Lebanon', 'Libya', 'Liechtenstein', 'Lithuania', 'Luxembourg', 'Malaysia', 'Maldives', 'Malta', 'Mauritius', 'Mexico', 'Mongolia', 'Morocco', 'Nepal', 'Netherlands', 'New Zealand', 'Nicaragua', 'North Korea', 'Norway', 'Oman', 'Pakistan', 'Panama', 'Paraguay', 'Peru', 'Philippines', 'Poland', 'Portugal', 'Puerto Rico', 'Qatar', 'Romania', 'Russian Federation', 'Saudi Arabia', 'Singapore', 'Slovak Republic', 'Slovenia', 'South Africa', 'South Korea', 'Spain', 'Sri Lanka', 'Sweden', 'Switzerland', 'Syria', 'Taiwan', 'Thailand', 'Tunisia', 'Turkey', 'Turkmenistan', 'Ukraine', 'United Arab Emirates', 'United Kingdom', 'United States', 'Uruguay', 'Uzbekistan', 'Venezuela', 'Vietnam', 'Yemen', 'Yugoslavia', 'Zimbabwe');
$countries = array('Pakistan');
$SelectCountry = "";
return $SelectCountry;
}
function city($c) {
$cities = array('Abbotabad', 'Bahawalpur', 'Bhawalnagar', 'Burewala', 'D.G.Khan', 'D.I.Khan', 'Faisalabad', 'Gilgit', 'Gujranwala', 'Gujrat', 'Hasalpur', 'Hyderabad', 'Islamabad', 'Jhang', 'Jhelum', 'Karachi', 'Kasoor', 'Khanpur', 'Kharian', 'Lahore', 'Lalamusa', 'Mianwali', 'Mirpur', 'Multan', 'Muridke', 'Murree', 'Nowshera', 'Peshawar', 'Quetta', 'Rahim Yar Khan', 'Raiwind', 'Rawalpindi', 'Sadiqabad', 'Sahiwal', 'Sakhur', 'Sakurdu', 'Sargodha', 'Sheikhupura', 'Sialkot', 'Swat', 'Taxila', 'Wazirabad', 'Ziarat','-- Other --');
$SelectCity = "";
return $SelectCity;
}
function adexpirydate($c) {
$expiry = array('15', '30', '45', '60', '75', '90');
$SelectExpiry = "";
return $SelectExpiry;
}
function state($c) {
$state = array('Balochistan', 'NWFP', 'Punjab', 'Sindh');
$SelectState = "";
return $SelectState;
}
function years($MyYear) {
$SelectYear = "";
return $SelectYear;
}
function ptypes($x) {
$qt = "select * from yellow_categories order by CategoryName";
$rt = mysql_query($qt) or die(mysql_error());
if(mysql_num_rows($rt) > '0')
{
$SelectType = "";
}
return $SelectType;
}
$q1 = "update yellow_agents set AccountStatus = 'pending' where ExpDate <= '$t' and AccountStatus != 'pending' ";
mysql_query($q1) or die(mysql_error());
# GET THE CATEGORIES
$qi = "select * from yellow_categories order by CategoryName";
$ri = mysql_query($qi) or die(mysql_error());
$Categories = "";
if (mysql_num_rows($ri) > '0')
{
while ($ai = mysql_fetch_array($ri))
{
$Categories .= "
";
/* if($ai[CategoryID] == $_GET[c])
{
//get the subcategories
$qs = "select * from yellow_subcat where rootcatid = '$_GET[c]' order by subcatname ";
$rs = mysql_query($qs) or die(mysql_error());
if(mysql_num_rows($rs) > '0')
{
while($as = mysql_fetch_array($rs))
{
//get the items at this subcategory
$qi2 = "select count(*) from yellow_agents where CategoryID = '$_GET[c]' and SubCategoryID = '$as[subcatid]' ";
$ri2 = mysql_query($qi2) or die(mysql_error());
$ai2 = mysql_fetch_array($ri2);
$Categories .=" $as[subcatname] ($ai2[0])\n\t
\n";
}
}
}*/
}
}
if(empty($_SESSION[AgentID]))
{
// $TopNav = " | \n\n\t | ";
$TopNav = "";
// $BottomNav = "Login | Register | ";
$BottomNav = "login";
}
else
{
// $TopNav = " | \n\n\t | ";
$TopNav = "";
if($aset[Sitefee]=="0")
{
$ace = date('d M Y', $_SESSION[AccountExpireDate]);
$after = ($_SESSION[AccountExpireDate] - $t)/(24*60*60);
if($after <= '10')
{
$RenewAccount = "Renew Account";
}
if($_SESSION[regtype]=='1')
{
$BottomNav = "Edit profile
Saved Listing
Manage Listing
Add Listing
Logout
Expire Date: $ace $RenewAccount";
}
else
{
$BottomNav = "Edit profile
Saved Listing
Logout
Expire Date: $ace $RenewAccount";
}
}
else
{
$ace = date('d M Y', $_SESSION[AccountExpireDate]);
$after = ($_SESSION[AccountExpireDate] - $t)/(24*60*60);
if($after <= '10')
{
$RenewAccount = "Renew Account";
}
if($_SESSION[regtype]=='1')
{
$BottomNav = "
Edit profile
Saved Listing
Manage Listing
Add Listing
Logout";
}
else
{
$BottomNav = "Edit profile
Saved Listing
Logout
";
}
}
}
if(ereg("index.php", $_SERVER[SCRIPT_NAME]))
{
$qrand = "select * from yellow_agents,yellow_posts, yellow_priority, yellow_categories where yellow_posts.CategoryID = yellow_categories.CategoryID and yellow_agents.PriorityLevel = yellow_priority.PriorityLevel and yellow_agents.AccountStatus = 'active' and yellow_posts.logo != '' and yellow_posts.AgentID=yellow_agents.AgentID order by rand() limit 0,1 ";
$rrand = mysql_query($qrand) or die(mysql_error());
if(mysql_num_rows($rrand) > '0')
{
$arand = mysql_fetch_array($rrand);
$rimage = $arand[logo];
$MyPrice = number_format($arand[Price], "", "", "'");
$RandomProperty .= "\n\n";
}
}
if($aset[Sitefee]=="0")
{
//send emails to the expire agents
// 10 days to the Expire Date (ExpDate)
$ten1 = mktime(0,0,0,date(m),date(d) + 10,date(Y));
$ten2 = mktime(23,59,59,date(m),date(d) + 10,date(Y));
$qexp = "select * from yellow_agents where ExpDate between '$ten1' and '$ten2' and days10 = 'n' ";
$rexp = mysql_query($qexp) or die(mysql_error());
if(mysql_num_rows($rexp) > '0')
{
while($aexp = mysql_fetch_array($rexp))
{
//send an email
$to = $aexp[email];
$subject = "10 days to the expiration date!";
$message = "Hello $aexp[FirstName] $aexp[LastName],\nyour account at $_SERVER[HTTP_HOST] will expire in 10 days!\n\nTo renew your account, login with your username and password and follow the \"Renew Account\" link.\n\nThank you!\n$_SERVER[HTTP_HOST]";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "From: $_SERVER[HTTP_POST] <$aset[ContactEmail]>\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: PHP/" . phpversion()."\n";
mail($to, $subject, $message, $headers);
mysql_query("update yellow_agents set days10 = 'y' where AgentID = '$aexp[AgentID]' ") or die(mysql_error());
}
}
// 5 days to the Expire Date (ExpDate)
$five1 = mktime(0,0,0,date(m),date(d) + 5,date(Y));
$five2 = mktime(23,59,59,date(m),date(d) + 5,date(Y));
$qexp = "select * from yellow_agents where ExpDate between '$five1' and '$five2' and days5 = 'n' ";
$rexp = mysql_query($qexp) or die(mysql_error());
if(mysql_num_rows($rexp) > '0')
{
while($aexp = mysql_fetch_array($rexp))
{
//send an email
$to = $aexp[email];
$subject = "5 days to the expiration date!";
$message = "Hello $aexp[FirstName] $aexp[LastName],\nyour account at $_SERVER[HTTP_HOST] will expire in 5 days!\n\nTo renew your account, login with your username and password and follow the \"Renew Account\" link.\n\nThank you!\n$_SERVER[HTTP_HOST]";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "From: $_SERVER[HTTP_POST] <$aset[ContactEmail]>\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: PHP/" . phpversion()."\n";
mail($to, $subject, $message, $headers);
mysql_query("update yellow_agents set days5 = 'y' where AgentID = '$aexp[AgentID]' ") or die(mysql_error());
}
}
// 1 day to the Expire Date (ExpDate)
$one1 = mktime(0,0,0,date(m),date(d) + 1,date(Y));
$one2 = mktime(23,59,59,date(m),date(d) + 1,date(Y));
$qexp = "select * from yellow_agents where ExpDate between '$one1' and '$one2' and days1 = 'n' ";
$rexp = mysql_query($qexp) or die(mysql_error());
if(mysql_num_rows($rexp) > '0')
{
while($aexp = mysql_fetch_array($rexp))
{
//send an email
$to = $aexp[email];
$subject = "1 day to the expiration date!";
$message = "Hello $aexp[FirstName] $aexp[LastName],\nyour account at $_SERVER[HTTP_HOST] will expire in 1 day!\n\nTo renew your account, login with your username and password and follow the \"Renew Account\" link.\n\nThank you!\n$_SERVER[HTTP_HOST]";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "From: $_SERVER[HTTP_POST] <$aset[ContactEmail]>\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: PHP/" . phpversion()."\n";
mail($to, $subject, $message, $headers);
mysql_query("update yellow_agents set days1 = 'y' where AgentID = '$aexp[AgentID]' ") or die(mysql_error());
}
}
// 1 day AFTER the Expire Date (ExpDate) WAS PASSED
//$qexp = "select * from yellow_agents where ExpDate > ExpDate + 86400 and days1 = 'y' ";
$qexp = "select * from yellow_agents where (($t - ExpDate) > 86400) and days1 = 'y' ";
$rexp = mysql_query($qexp) or die(mysql_error());
if(mysql_num_rows($rexp) > '0')
{
while($aexp = mysql_fetch_array($rexp))
{
$DelAgents[] = $aexp[AgentID];
//get the agent's listings with images
/* $q2 = "select * from yellow_listings where AgentID = '$aexp[AgentID]' and image != '' ";
$r2 = mysql_query($q2) or die(mysql_error());
if(mysql_num_rows($r2) > '0')
{
while($a2 = mysql_fetch_array($r2))
{
$DelImages[] = explode("|", $a2[image]);
while(list(,$v) = each($DelImages))
{
//delete the images from our server
unlink("re_images/$v");
}
}
*/
//delete the agent's banners
$q4 = "select * from yellow_banners where ClientID = '$aexp[AgentID]' ";
$r4 = mysql_query($q4) or die(mysql_error());
if(mysql_num_rows($r4) > '0')
{
while($a4 = mysql_fetch_array($r4))
{
//delete the banners from our server
unlink("banners/$a4[BannerFile]");
$BannerIDs[] = $a4[BannerID];
}
$DelBan = implode("', '", $BannerIDs);
//delete banner info
$q5 = "delete from yellow_banners where ClientID = '$aexp[AgentID]' ";
mysql_query($q5) or die(mysql_error());
//delete stats
$q6 = "delete from yellow_stats where BannerID in ('$DelBan') ";
mysql_query($q6) or die(mysql_error());
}
//}
}
$DelStr = implode("', '", $DelAgents);
mysql_query("delete from yellow_agents where AgentID in ('$DelStr')") or die(mysql_error());
}
}
?>