";
// Declare Required configuration files
require("/home/crown/www.crownmotorsredding.com_includes/global.php");
// Rotate header image files
$rand_header_seed = rand(1, 3);
$rand_header_model = array("", "index_01_ford.gif", "index_01_honda.gif", "index_01_dodge.gif");
$rand_header_foot = array("", "index_08_ford.gif", "index_08_honda.gif", "index_08_dodge.gif");
$img_heaader_model = $rand_header_model[$rand_header_seed];
$img_heaader_foot = $rand_header_foot[$rand_header_seed];
/* - Check for Page Forward Variables and process -*/
$cselect = '';
$pnum = '0';
$show_search_tools = 'display: none;';
$show_search_tools = '';
if($_POST['cselect'] != '') {
/*
echo "";
*/
$cselect = convert_uudecode(urldecode($_POST['cselect']));
$pnum = (($_POST['pn'] - 1) * 25) + 1;
}
/* - Post Method Search Opeations - */
if($_POST['process'] == 'true' or $_GET['topic'] != '' or $_GET['user_search'] != '') {
if($_POST['process'] == 'true') {
$bad_chars = array("'", ";", ",");
$customsearch = addslashes(str_replace($bad_chars, "", $_POST['customsearch']));
$makeselect = addslashes(str_replace($bad_chars, "", $_POST['makeDropDown']));
$modelselect = addslashes(str_replace($bad_chars, "", $_POST['selectModelcontrol']));
$price_from = addslashes(str_replace($bad_chars, "", $_POST['price_from']));
$price_to = addslashes(str_replace($bad_chars, "", $_POST['price_to']));
$year_from = addslashes(str_replace($bad_chars, "", $_POST['year_from']));
$year_to = addslashes(str_replace($bad_chars, "", $_POST['year_to']));
if($customsearch != '') {
$ssv = explode(" ", $customsearch);
foreach($ssv as $svar) {
$custom_select .= " make like '%".$svar."%' or";
$custom_select .= " carline like '%".$svar."%' or";
$custom_select .= " model_desc like '%".$svar."%' or";
$custom_select .= " year like '%".$svar."%' or";
$custom_select .= " stock_number like '%".$svar."%' or";
}
$custom_select = substr($custom_select, 0, (count($custom_select) - 3));
if($custom_select != '' ) {
$custom_select = "( ".$custom_select." ) ";
} else {
$custom_select = "( 1 = 1 ) ";
}
} else {
$custom_mod = false;
if($makeselect != 'any') {
$custom_select .= " make like '%".$makeselect."%' and";
$custom_mod = true;
}
if($modelselect != 'any') {
$modelselect = str_replace(" ", "%' '%", $modelselect);
$custom_select .= " carline like '%".$modelselect."%' and";
$custom_mod = true;
}
if($price_from != 'low' and $price_to != 'high') {
$custom_select .= " coded_cost between '".$price_from."' and '".$price_to."' and";
$custom_mod = true;
}
if($year_from != 'low' and $year_to != 'high') {
$custom_select .= " year between '".$year_from."' and '".$year_to."' and";
$custom_mod = true;
}
if($custom_mod == true) {
$custom_select = substr($custom_select, 0, (strlen($custom_select) - 4));
$custom_select = "( ".$custom_select." ) ";
} else {
$custom_select = " ( 1 = 1 ) ";
}
}
} else if($_GET['topic'] != '') {
$topic = addslashes(str_replace($bad_chars, "", $_GET['topic']));
switch ($topic) {
case "car":
$custom_select = " model_num = 'P' ";
break;
case "truck":
$custom_select = " categ = 'TK' ";
break;
case "trucks":
$custom_select = " categ = 'TK' ";
break;
case "suv":
$custom_select = " categ = 'SV' ";
break;
case "van":
$custom_select = " categ = 'VN' ";
break;
case "10k":
$custom_select = " coded_cost <= '10000' ";
break;
case "diesel":
$custom_select = " fuel = 'D' ";
break;
default:
$custom_select = "";
}
}
if($_GET['user_search'] != '') {
$user_defined_search = addslashes(str_replace("'", "%", $_GET['user_search']));
$custom_select = " ( make like '%".$user_defined_search."%' or carline like '%".$user_defined_search."%' ) ";
}
// If in Page Forward mode - overwrite $custom_select and $pn
if($cselect != '') {
$custom_select = $cselect;
}
// If POST headers include process = true, structure and comlete query, Format results and send to browser
$select .= " select * from V_INVENTORY where ";
$select .= " (status_code = '1' or status_code = '8') and nuo = 'u' and coded_cost != 0 and year != '0' and ";
$select .= $custom_select;
$select .= " limit ".$pnum.", 25 ";
//echo $select."
";
$get_count_sql = "select count(1) from V_INVENTORY where ";
$get_count_sql .= " (status_code = '1' or status_code = '8') and nuo = 'u' and coded_cost != 0 and year != '0' and ";
$get_count_sql .= $custom_select;
$results_count = $DB_site->query_first($get_count_sql);
if($results_count[0] >= 24) {
$ins_text = "the first 25 of";
if($pnum > 1) {
if(($pnum + 25) > $results_count[0]) {
$next_inc = $results_count[0];
} else {
$next_inc = $pnum + 24;
}
$ins_text = $pnum." to ".$next_inc." of";
}
} else {
$ins_text = "all";
}
$showing_results_text = "Showing ".$ins_text." ".$results_count[0]." results.> ";
$number_of_pages = number_format((($results_count[0] / 25) +.5), 0);
$page_links = "Pages ";
if($number_of_pages == 0 or $number_of_pages == 1) {
$page_links .= "1 ";
} else {
for($nn = 1; $nn <= $number_of_pages; $nn++) {
$page_links .= "".$nn." ";
}
}
// echo $select;
// echo $select;
$data = $DB_site->query($select);
while($rd = $DB_site->fetch_array($data)) {
// Row Structure
$real_path = "/home/crown/public_html/crownmotorsredding.com/preowned_images/";
$public_path = "http://www.crownmotorsredding.com/preowned_images/";
$thumb_image = $rd['stock_number']."_".last_eight($rd['vin'])."_01_100.JPG";
// Image Assignemtn
if(file_exists($real_path.$thumb_image) == true) {
$thumb = $public_path.$thumb_image;
} else {
$thumb = "http://img.crownmotors.biz/noimages.png";
}
$items = array(" ", "/");
$link = $rd['year']."-".$rd['make']."-".str_replace($items, "", $rd['carline'])."-".$rd['stock_number'];
$link = strtoupper($link);
$link = "/".$used_directory."/".$link.".html";
// Format Data for Functional Output.
if($rd['fuel'] == 'D') {
$rd['fuel'] = 'Diesel';
} else {
$rd['fuel'] = 'Gas';
}
/*if($rd['int_manufacturer_color'] == '') {
$rd['int_manufacturer_color'] = 'N/A';
}
if($rd['manufacturer_color'] == ''){
$rd['manufacturer_color'] = 'N/A';
}*/
unset($vehicle_disclaimer);
if(strpos($rd['rental'], "RENTAL") != false) {
$vehicle_disclaimer = "This vehicle has been a prior rental. This vehicle includes dealer or factory ";
$vehicle_disclaimer .= "coverage, please ask a sales associate for details!";
}
if(strpos($rd['memo2'], "CHEAP") != false) {
$vehicle_disclaimer .= "
Don't miss this incredible deal!";
}
// Build row
$row .= "
| Description | Price |
| =$topmost_navigation;?> | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| =$submenu_navigation;?> | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||