offline
- Gad
- Počasni građanin
- Pridružio: 19 Maj 2005
- Poruke: 932
|
Dakle, ono sto trebam je da napravim da ne registrovani korsinici mogu pristupiti dijelu stranice za upis oglasa: http://www.autoprofil.net/index.php?option=com_aut.....p;Itemid=1
Potrebno je nekako zaobici provjeru. Napraviti da je onaj ko dodje na sajt i klikne na link se automatski
loguje kao gost user, tu postaviti neki id od registrovanog clana recimo 63,
gdje je 63 id korisnika koji je napravljen u Joomla backendu. Sto znaci kad
neko salje oglas a nije se ulogovao joomla smatra da je on registrovani clan
pod id-om 63...
Nadam se da razumijete sta hocu reci. Bio bih mnogo zahvalan kad bi mi neko pomogao. U pitanju je sledeci fajl:
<?php
/**
* MAFiASCRiPTS
**/
/**
* Generate ccode and return code number
*/
function getCcode()
{
$ccode = substr(time().rand(10000,99999),-15);
return $ccode;
}
// check if the current server is running GD version 2 or higher
function checkgd()
{
ob_start(); // turn on output buffering
phpinfo(8); // display loaded modules and their settings
$phpinfo = ob_get_contents(); // get contents of output buffer
ob_end_clean(); // erase contents of output buffer and turn buffering off
$phpinfo = strip_tags($phpinfo); // strip html and php tags
$phpinfo = stristr($phpinfo, "gd version"); // return everything after...
$phpinfo = stristr($phpinfo, "version"); // return everything after...
$tmp = explode("\n", $phpinfo);
$phpinfo = $tmp[0];
preg_match('/\d/', $phpinfo, $version); // grab 1st single digit character
if($version[0] >= '2') { return true; }
else { return false; }
}
function spaceOffPrice($data)
{
$str = "";
// cut spaces in to the string
for($i = 0; $i <= strlen($data); $i++)
{
if($data{$i} == " ")
continue;
else
if($data{$i} == "," || $data{$i} == ".")
continue;
else if(is_numeric($data{$i}))
$str .= $data{$i};
}
return $str;
}
// Thumbs images resolution
$maxx = 90;
$maxy = 70;
/*-------------------------------------------------------------------------------------------------
Name: resize
Created: 2004
Format: resize(source name, thumbnail width, thumbnail height, resized image name);
Returns: 0 or 1 depending on success of function
Description: creates a resized image (JPG) from the specified source image (JPG)
-------------------------------------------------------------------------------------------------*/
function resize($original, $newx, $newy, $resized) {
$backup = $resized.'_BAK.JPG'; // NAME OF BACKUP
copy ($original, $backup); // COPY SOURCE TO BACKUP
$properties = getimagesize($backup); // GET IMAGE PROPERTIES
if($properties[2] != '2') { // IF THE IMAGE IS NOT A .JPG
return(0); // RETURN ERROR
} else {
$source = imagecreatefromjpeg($backup); // CREATE IMAGE IDENTIFIER
$sourcex = imagesx($source); // GET WIDTH
$sourcey = imagesy($source); // GET HEIGHT
$destination = imagecreatetruecolor($newx, $newy); // CREATE A NEW TRUE COLOR IMAGE
unlink($backup); // DELETE BACKUP FILE
if(!imagecopyresampled($destination, $source, 0, 0, 0, 0, $newx, $newy, $sourcex, $sourcey)) {
imagedestroy($source); // FREE MEMORY FROM $source
imagedestroy($destination); // FREE MEMORY FROM $destination
return(0); // RETURN ERROR
} else {
imagedestroy($source);
if(imagejpeg($destination, $resized)) { // CREATE RESIZED IMAGE
imagedestroy($destination);
return(1); // RETURN SUCCESS
}
imagedestroy($destination);
}
return(0);
}
}
// -------------------------------------------------------------------------------------------------
// Dont allow direct linking
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
include($mosConfig_absolute_path."/components/com_autoexp/classes/table.php");
//include($mosConfig_absolute_path."/components/com_autoexp/debug.php");
?>
<link rel="stylesheet" href="/components/com_autoexp/autoexp.css" type="text/css" />
<script language="JavaScript">
<!-- Begin
// verify required fields
function checkrequired(form) {
var pass = true;
for(i = 0; i < form.length; i++) {
var tempobj = form.elements[i];
if(tempobj.alt == "required") {
if(tempobj.value == '') {
pass = false;
break;
}
}
}
if(!pass) {
alert("Please enter the required information.");
tempobj.focus(); // set focus to missing field
return false;
}
else { return true; }
}
// End -->
</script>
<?php
global $database;
if(isset($_POST["txt_data"]))
{
$usr_vincode = $_POST['usr_vincode'];
$usr_stock = $_POST['usr_stock'];
$usr_exmodel = $_POST['usr_exmodel'];
$usr_zip = $_POST['usr_zip'];
$usr_city = $_POST['usr_city'];
$usr_street = $_POST['usr_street'];
$usr_country = $_POST['usr_country'];
$usr_year = $_POST['usr_year'];
$usr_name = $_POST['usr_name'];
$usr_surname = $_POST['usr_surname'];
$usr_door = $_POST['usr_door'];
$usr_engine = $_POST['usr_engine'];
$usr_mileage = $_POST['usr_mileage'];
$usr_firmname = $_POST['usr_firmname'];
$usr_occupation = $_POST['usr_occupation'];
$usr_email = mosGetParam($_POST,'usr_email', '');
$usr_web = mosGetParam($_POST,'usr_web', '');
$usr_phone1 = $_POST['usr_phone1'];
$usr_phone2 = $_POST['usr_phone2'];
$usr_price = $_POST['usr_price'];
$usr_disprice = $_POST['usr_disprice'];
$usr_text = $_POST['usr_text'];
$usr_make = mosGetParam($_POST, 'usr_make', 0);
$usr_condition = mosGetParam($_POST, 'usr_condition', 0);
$usr_extcolor = mosGetParam($_POST, 'usr_extcolor', 0);
$usr_intcolor = mosGetParam($_POST, 'usr_intcolor', 0);
$usr_fuel = mosGetParam($_POST, 'usr_fuel', 0);
$usr_trans = mosGetParam($_POST, 'usr_trans', 0);
$usr_drive = mosGetParam($_POST, 'usr_drive', 0);
$usr_model = mosGetParam($_POST, 'usr_model', 0);
}
if(isset($_POST['usr_adid']))
{
$img_remove = $_POST['img_remove'];
$usr_adid = $_POST['usr_adid'];
$r_thumb = $_POST['r_thumb'];
}
$database->setQuery( "SELECT language_file FROM #__autoexp_config");
$language_file = $database->loadResult();
if (file_exists($mosConfig_absolute_path.'/components/com_autoexp/languages/'.$mosConfig_lang.'.php')) {
include($mosConfig_absolute_path.'/components/com_autoexp/languages/'.$mosConfig_lang.'.php');
} else {
include($mosConfig_absolute_path.'/components/com_autoexp/languages/english.php');
}
$userid = $my->id;
$ccode1 = getCcode();
$post_flag = false;
$mainframe->appendPathWay(JOO_WRITE_AD);
$mainframe->SetPageTitle(JOO_WRITE_AD);
// get configuration data
$database->setQuery("SELECT * FROM #__autoexp_config LIMIT 1");
$config = $database->loadObjectList();
$use_surname = $config[0]->use_surname;
$use_street = $config[0]->use_street;
$use_zip = $config[0]->use_zip;
$use_country = $config[0]->use_country;
$use_city = $config[0]->use_city;
$use_firm = $config[0]->use_firm;
$use_ocupation = $config[0]->use_ocupation;
$use_web = $config[0]->use_web;
$use_phone1 = $config[0]->use_phone1;
$use_phone2 = $config[0]->use_phone2;
$use_mileage = $config[0]->use_mileage;
$use_condition = $config[0]->use_condition;
$use_bprice = $config[0]->use_bprice;
$use_vincode = $config[0]->use_vincode;
$use_stock = $config[0]->use_stock;
$use_extcolor = $config[0]->use_extcolor;
$use_intcolor = $config[0]->use_intcolor;
$use_bodytype = $config[0]->use_bodytype;
$use_door = $config[0]->use_door;
$use_fuel = $config[0]->use_fuel;
$use_engine = $config[0]->use_engine;
$use_drive = $config[0]->use_drive;
$use_trans = $config[0]->use_trans;
$use_email = $config[0]->use_email;
$use_footer = $config[0]->use_footer;
$use_extmodel = $config[0]->use_extmodel;
$use_duration = $config[0]->duration;
$max_image_size = $config[0]->max_image_size;
$image_size = $config[0]->image_size;
$ad_default = $config[0]->ad_default;
$def_curr = $config[0]->def_curr;
// required fields verification from POST
$bool_usr_make = false;
if(isset($usr_make))
{
if($usr_make > "0")
$bool_usr_make = true;
}
$bool_usr_model = false;
if(isset($usr_model))
{
if($usr_model > "0")
$bool_usr_model = true;
}
$bool_usr_name = false;
if(isset($usr_name))
{
if(strlen($usr_name) >= 2)
{
$usr_name = ucfirst(strtolower($usr_name));
$bool_usr_name = true;
}
}
$bool_usr_phone1 = false;
if(isset($usr_phone1))
{
if(strlen($usr_phone1) >= 7)
$bool_usr_phone1 = true;
}
$bool_usr_year = false;
if(isset($usr_year))
{
if(strlen($usr_year) == 4)
{
$bad_counter = 0;
for($i = 0; $i < 4; $i++)
{
if(!is_numeric($usr_year{$i}))
$bad_counter++;
}
if($bad_counter == 0)
$bool_usr_year = true;
}
}
$bool_usr_price = false;
if(isset($usr_price))
{
$usr_price = spaceOffPrice($usr_price);
if(strlen($usr_price) > 1)
$bool_usr_price = true;
}
if(isset($usr_disprice) && strlen($usr_disprice) > 1)
{
$usr_disprice = spaceOffPrice($usr_disprice);
}
$bool_fields_flag = false;
if($bool_usr_price && $bool_usr_model && $bool_usr_make && $bool_usr_year &&
$bool_usr_phone1 && $bool_usr_name)
{
$bool_fields_flag = true;
}
if(!$bool_fields_flag && isset($usr_make) && $userid > 0)
{
echo "<br>";
echo "<table cellspacing=\"10\" cellpadding=\"5\">";
echo "<tr>";
echo "<td width=\"20\">";
echo " ";
echo "</td>";
echo "<td>";
echo "<img src=\"".$mosConfig_live_site."/components/com_autoexp/images/system/warning2.gif\" border=\"0\" align=\"center\">";
echo "</td>";
echo "<td>";
echo "<b>";
echo JOO_WRITE_ERROR;
echo "</b>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
echo "<br>";
}
if($bool_fields_flag)
{
$rq = "INSERT INTO #__autoexp_add (user_id, mark_id, model_id, model_name, transmis, fuel,"
."drivetrain, inner_color, extend_color, bodytype, vin_code, stock_num, year_num, name, surname,"
."street, zip_code, city, doors, car_engine, mileage, country, firm_name, occupation, email,"
."web, phone1, phone2, conditions, price1, price2, text1, ccode, date_created, date_modified,"
."duration, published)"
."VALUES ('$userid', '$usr_make', '$usr_model', '$usr_exmodel', '$usr_trans', '$usr_fuel',"
."'$usr_drive','$usr_intcolor', '$usr_extcolor', '$usr_body', '$usr_vincode','$usr_stock',"
."'$usr_year', '$usr_name', '$usr_surname', '$usr_street', '$usr_zip', '$usr_city',"
."'$usr_door', '$usr_engine', '$usr_mileage', '$usr_country', '$usr_firmname',"
."'$usr_occupation', '$usr_email', '$usr_web', '$usr_phone1', '$usr_phone2', '$usr_condition',"
."'$usr_price', '$usr_disprice', '$usr_text', '$usr_ccode', CURRENT_DATE(), CURRENT_DATE(), "
."'$use_duration', '$ad_default')";
$database->setQuery($rq);
if ($database->getErrorNum())
{
echo $database->stderr();
}
else
{
$database->query();
$post_flag = true;
$adid = mysql_insert_id();
}
}
if(isset($img_remove) && isset($usr_adid) && isset($r_thumb))
{
$post_flag = true;
$adid = $usr_adid;
//get ***img.jpg name
$rq = "SELECT image FROM #__autoexp_imagelist WHERE thumb = '$r_thumb'";
$database->setQuery($rq);
$data2 = $database->loadObjectList();
$image1 = $mosConfig_absolute_path."/components/com_autoexp/images/img/".$data2[0]->image;
$thumb1 = $mosConfig_absolute_path."/components/com_autoexp/images/tmb/".$r_thumb;
if(@unlink($image1) && @unlink($thumb1))
{
$rq = "UPDATE #__autoexp_add SET image_count = image_count - 1 "
."WHERE id = '$adid'";
$database->setQuery($rq);
$database->query();
$rq = "DELETE FROM #__autoexp_imagelist WHERE thumb = '$r_thumb'";
$database->setQuery($rq);
$database->query();
}
}
if(isset($usr_adid) && !isset($img_remove))
{
$post_flag = true;
$adid = $usr_adid;
/// image operation
// generate icode
$icode = getCcode();
$rq = "SELECT image_count FROM #__autoexp_config LIMIT 1";
$database->setQuery($rq);
$img_count1 = $database->loadObjectList();
$rq = "SELECT image_count FROM #__autoexp_add WHERE id = '$adid'";
$database->setQuery($rq);
$img_count2 = $database->loadObjectList();
// settype($img_count1[0]->image_count, "integer");
// settype($img_count2[0]->image_count, "integer");
$if_null = $img_count1[0]->image_count - $img_count2[0]->image_count;
$image = $_FILES[image][tmp_name];
// copy image to temp folder
$tempname = $mosConfig_absolute_path."/components/com_autoexp/images/tmp".$icode.'TEMP.JPG';
copy($image, $tempname);
unlink($image);
if($_FILES[image][size] <= $max_image_size && $if_null > 0)
{
// get iamge properties
$properties = getimagesize($tempname);
if($properties[2] == 2)
{ // if the image is a .jpg
$source = imagecreatefromjpeg($tempname); // create image identifier
$imagex = imagesx($source);
$imagey = imagesy($source);
//echo "Image X= ".$imagex."<br>";
//echo "Image Y= ".$imagey."<br>";
// copy image to images folder
$imagename = $icode.'IMG.JPG'; // this will be stored in db
$image_loc = $mosConfig_absolute_path."/components/com_autoexp/images/img/$imagename";
copy($tempname, $image_loc);
unlink($tempname);
// resize the image if neccessary
if($imagex > $image_size) {
$newy = round(($image_size * $imagey) / $imagex);
//echo "imagex = $imagex<br>imagey = $imagey<br>newy = $newy<br>"; exit(); // TEST
resize($image_loc, $image_size, $newy, $image_loc);
}
// create thumbnail
$thumbname = $icode.'TMB.JPG'; // this will be stored in db
$thumb_loc = $mosConfig_absolute_path."/components/com_autoexp/images/tmb/$thumbname";
$thumbx = $maxx;
$thumby = round(($imagey * $thumbx) / $imagex);
if($thumby > $maxy) {
$thumbx = round(($thumbx * $maxy) / $thumby);
$thumby = $maxy;
}
if(resize($image_loc, $thumbx, $thumby, $thumb_loc))
{
// store file names in imagelist database
$rq = "INSERT INTO #__autoexp_imagelist (thumb, image, user_id) "
."VALUES ('$thumbname', '$imagename', '$adid')";
$database->setQuery($rq);
if ($database->getErrorNum())
echo $database->stderr();
else
$database->query();
// increment image counter in table of cars.
$rq = "UPDATE #__autoexp_add SET image_count = image_count + 1 "
."WHERE id = '$adid'";
$database->setQuery($rq);
if ($database->getErrorNum())
echo $database->stderr();
else
$database->query();
}
}
@unlink($tempname);
}
else
{
echo "<br>";
echo "<table cellspacing=\"10\" cellpadding=\"5\">";
echo "<tr>";
echo "<td width=\"20\">";
echo " ";
echo "</td>";
echo "<td>";
echo "<img src=\"".$mosConfig_live_site."/components/com_autoexp/images/system/warning2.gif\" border=\"0\" align=\"center\">";
echo "</td>";
echo "<td>";
echo "<b>";
echo JOO_IMAGETOOBIG;
echo "</b>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
echo "<br>";
echo "<br>";
}
@unlink($tempname); // delete the temp file if an error occurs
}
/* load car's marks */
$rq = "SELECT * FROM #__autoexp_mark WHERE published = '1'";
$database->setQuery($rq);
$make = $database->loadObjectList();
/* load condition */
$rq = "SELECT * FROM #__autoexp_ad_condition WHERE published = '1'";
$database->setQuery($rq);
$condition = $database->loadObjectList();
/* load color */
$rq = "SELECT * FROM #__autoexp_color WHERE published = '1'";
$database->setQuery($rq);
$color = $database->loadObjectList();
/* load BodyType */
$rq = "SELECT * FROM #__autoexp_bodytype WHERE published = '1'";
$database->setQuery($rq);
$bodytype = $database->loadObjectList();
/* load Fuel */
$rq = "SELECT * FROM #__autoexp_fuel WHERE published = '1'";
$database->setQuery($rq);
$fuel = $database->loadObjectList();
/* load DriveTrain */
$rq = "SELECT * FROM #__autoexp_drive WHERE published = '1'";
$database->setQuery($rq);
$drive = $database->loadObjectList();
/* load Transmission */
$rq = "SELECT * FROM #__autoexp_trans WHERE published = '1'";
$database->setQuery($rq);
$trans = $database->loadObjectList();
/* load Countries */
$rq = "SELECT * FROM #__autoexp_country WHERE published = '1'";
$database->setQuery($rq);
$country = $database->loadObjectList();
/* load default type of Currency */
$rq = "SELECT code FROM #__autoexp_currencies WHERE id = '".$def_curr."'";
$database->setQuery($rq);
$currency1 = $database->loadResult();
$currency1 = strtoupper($currency1);
if ($userid == "0")
{
echo "<br>";
echo "<br>";
echo "<table cellspacing=\"10\" cellpadding=\"5\">";
echo "<tr>";
echo "<td width=\"20\">";
echo " ";
echo "</td>";
echo "<td>";
echo "<img src=\"".$mosConfig_live_site."/components/com_autoexp/images/system/warning.gif\" border=\"0\" align=\"center\">";
echo "</td>";
echo "<td>";
echo "<b>";
echo JOO_ADD_NOTALLOWED;
echo "</b>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
echo "<br>";
echo "<br>";
echo "<br>";
}
else if(!$post_flag)
{
?>
<form class="autoexp" name="form1" method="post" action="<?php echo $mosConfig_live_site;?>/index.php?option=com_autoexp&page=write_ad<?php echo "&Itemid=".$Itemid;?>" onSubmit='return checkrequired(this)'>
<table width="100%" class="autoexp" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3"><div align="center" id ="show2"><?= JOO_DCONTACT; ?></div><br /></td>
</tr>
<tr>
<td width="40%"><div align="right"><? echo JOO_FORM_NAME."*"; ?></div></td>
<td width="20%"><div align="center">
<input class='autoexp' type="text" name="usr_name" alt='required' value='<?
if(isset($usr_name)) echo $usr_name;
?>'>
</div></td>
<td width="40%"><div align="left"><? echo JOO_FORM_NAME_TEXT; ?></div></td>
</tr>
<?
if($use_surname == "1")
{
?>
<tr>
<td width="40%"><div align="right"><? echo JOO_FORM_SURNAME; ?> <br>
</div></td>
<td width="20%" ><div align="center">
<input class='autoexp' type="text" name="usr_surname" value='<? if(isset($usr_surname)) echo $usr_surname; ?>'>
</div></td>
<td width="40%" ><div align="left"><? echo JOO_FORM_SURNAME_TEXT; ?></div></td>
</tr>
<?
}
if($use_street == "1")
{
?>
<tr>
<td width="40%"><div align="right"><? echo JOO_FORM_STREET; ?></div></td>
<td width="20%" ><div align="center">
<input class='autoexp' type="text" name="usr_street" value='<? if(isset($usr_street)) echo $usr_street; ?>'>
</div></td>
<td width="40%" ><div align="left"><? echo JOO_FORM_STREET_TEXT; ?></div></td>
</tr>
<?
}
if($use_zip == "1")
{
?>
<tr>
<td width="40%"><div align="right"><? echo JOO_FORM_ZIP; ?></div></td>
<td width="20%" ><div align="center">
<input class='autoexp' type="text" name="usr_zip" value='<? if(isset($usr_zip)) echo $usr_zip; ?>'>
</div></td>
<td width="40%" ><div align="left"><? echo JOO_FORM_ZIP_TEXT; ?></div></td>
</tr>
<?
}
if($use_country == "1")
{
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_FORM_COUNTRY; ?></div></td>
<td ><div align="center">
<select class='autoexp2' name="usr_country" onChange='update_model(this.selectedIndex);'>
<option value='0'><?= JOO_SELECT; ?></option>
<?
foreach($country as $mak)
{
if(isset($usr_country))
{
if($usr_country == $mak->id)
echo "<option value='".$mak->id."' selected>".$mak->country."</option>\r\n";
else
echo "<option value='".$mak->id."'>".$mak->country."</option>\r\n";
}
else
echo "<option value='".$mak->id."'>".$mak->country."</option>\r\n";
}
?>
</select>
</div></td>
<td ><div align="left"><? echo JOO_COUNT_INFO; ?></div></td>
</tr>
<?
}
if($use_city == "1")
{
?>
<tr>
<td width="40%"><div align="right"><? echo JOO_FORM_CITY; ?></div></td>
<td width="20%" ><div align="center">
<input class='autoexp' type="text" name="usr_city" value='<? if(isset($usr_city)) echo $usr_city; ?>'>
</div></td>
<td width="40%" ><div align="left"><? echo JOO_FORM_CITY_TEXT; ?></div></td>
</tr>
<?
}
if($use_firm == "1")
{
?>
<tr>
<td width="40%"><div align="right"><? echo JOO_FORM_FIRM; ?></div></td>
<td width="20%" ><div align="center">
<input class='autoexp' type="text" name="usr_firmname" value='<? if(isset($usr_firmname)) echo $usr_firmname; ?>'>
</div></td>
<td width="40%" ><div align="left"><? echo JOO_FORM_FIRM_TEXT; ?></div></td>
</tr>
<?
}
if($use_ocupation == "1")
{
?>
<tr>
<td width="40%"><div align="right"><? echo JOO_FORM_OCUPATION; ?></div></td>
<td width="20%" ><div align="center">
<input class='autoexp' type="text" name="usr_occupation" value='<? if(isset($usr_occupation)) echo $usr_occupation; ?>'>
</div></td>
<td width="40%" ><div align="left"><? echo JOO_FORM_OCUPATION_TEXT; ?></div></td>
</tr>
<?
}
if($use_email == "1")
{
?>
<tr>
<td width="40%"><div align="right"><? echo JOO_FORM_EMAIL; ?></div></td>
<td width="20%" ><div align="center">
<input class='autoexp' type="text" name="usr_email" value='<? if(isset($usr_email)) echo $usr_email; ?>' >
</div></td>
<td width="40%" ><div align="left"><? echo JOO_FORM_EMAIL_TEXT; ?></div></td>
</tr>
<?
}
if($use_web == "1")
{
?>
<tr>
<td width="40%"><div align="right"><? echo JOO_FORM_WEB; ?></div></td>
<td width="20%" ><div align="center">
<input class='autoexp' type="text" name="usr_web" value='<? if(isset($usr_web)) echo $usr_web; ?>'>
</div></td>
<td width="40%" ><div align="left"><? echo JOO_FORM_WEB_TEXT; ?></div></td>
</tr>
<?
}
if($use_phone1 == "1")
{
?>
<tr>
<td width="40%"><div align="right"><? echo JOO_FORM_PHONE1."*"; ?></div></td>
<td width="20%" ><div align="center">
<input class='autoexp' type="text" name="usr_phone1" alt='required' value='<? if(isset($usr_phone1)) echo $usr_phone1; ?>' >
</div></td>
<td width="40%" ><div align="left"><? echo JOO_FORM_PHONE1_TEXT; ?></div></td>
</tr>
<?
}
if($use_phone2 == "1")
{
?>
<tr>
<td width="40%"><div align="right"><? echo JOO_FORM_PHONE2; ?></div></td>
<td width="20%" ><div align="center">
<input class='autoexp' type="text" name="usr_phone2" value='<? if(isset($usr_phone2)) echo $usr_phone2; ?>' >
</div></td>
<td width="40%" ><div align="left"><? echo JOO_FORM_PHONE2_TEXT; ?></div></td>
</tr>
<?
}
?>
<tr>
<td colspan="3"><br /></td>
</tr>
<tr>
<td colspan="3"><div align="center" id ="show2"><?= JOO_CARS_INFO; ?></div><br /></td>
</tr>
<?
if($use_vincode == "1")
{
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_VINCODE; ?></div></td>
<td ><div align="center">
<input class='autoexp' type="text" name="usr_vincode" value='<? if(isset($usr_vincode)) echo $usr_vincode; ?>' >
</div></td>
<td ><div align="left"><? echo JOO_VINCODE_INFO; ?></div></td>
</tr>
<?
}
if($use_stock == "1")
{
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_STOCK; ?></div></td>
<td ><div align="center">
<input class='autoexp' type="text" name="usr_stock" value='<? if(isset($usr_stock)) echo $usr_stock; ?>' >
</div></td>
<td ><div align="left"><? echo JOO_STOCK_INFO; ?></div></td>
</tr>
<?
}
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_FORM_MARK."*"; ?></div></td>
<td ><div align="center">
<select class='autoexp2' name="usr_make" onChange='update_model(this.selectedIndex);'>
<option value='0'><?= JOO_SELECT; ?></option>
<?
foreach($make as $mak)
{
if(isset($usr_make) && $usr_make != 0)
{
if($usr_make == $mak->id)
echo "<option value='".$mak->id."' selected >".$mak->name."</option>\r\n";
else
echo "<option value='".$mak->id."'>".$mak->name."</option>\r\n";
}
else
echo "<option value='".$mak->id."'>".$mak->name."</option>\r\n";
}
?>
</select>
</div></td>
<td ><div align="left"><? echo JOO_FORM_MARK_INFO; ?></div></td>
</tr>
<tr>
<td width="20%"><div align="right"><? echo JOO_FORM_MODEL."*"; ?></div></td>
<td ><div align="center">
<select class='autoexp2' name="usr_model">
<?
if(isset($usr_make) && $usr_make != 0)
{
if(isset($usr_model) && $usr_model != 0)
{
$rq = "SELECT * FROM #__autoexp_model WHERE mark_id = '".$usr_make."' AND "
."published = '1'";
$database->setQuery($rq);
$data_models = $database->loadObjectList();
foreach($data_models as $row)
{
if($usr_model == $row->id)
echo "<option value='".$row->id."' selected >".$row->name."</option>\r\n";
else
echo "<option value='".$row->id."'>".$row->name."</option>\r\n";
}
}
}
?>
</select>
</div></td>
<td ><div align="left"><? echo JOO_FORM_MODEL_INFO; ?></div></td>
</tr>
<?
if($use_extmodel == "1")
{
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_EXTEND_MODEL; ?></div></td>
<td ><div align="center">
<input class='autoexp' type="text" name="usr_exmodel" value='<? if(isset($usr_exmodel)) echo $usr_exmodel; ?>' >
</div></td>
<td ><div align="left"><? echo JOO_EXTEND_MODEL_INFO; ?></div></td>
</tr>
<?
}
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_FORM_YEAR."*"; ?></div></td>
<td ><div align="center">
<input class='autoexp' type="text" maxlength="4" name="usr_year" alt='required' value='<? if(isset($usr_year)) echo $usr_year; ?>' >
</div></td>
<td ><div align="left">( <? echo date("Y");?> )</div></td>
</tr>
<?
if($use_mileage == "1")
{
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_FORM_MILEAGE; ?></div></td>
<td ><div align="center">
<input class='autoexp' type="text" name="usr_mileage" value='<? if(isset($usr_mileage)) echo $usr_mileage; ?>' >
</div></td>
<td ><div align="left"><? echo JOO_FORM_MILEAGE_INFO; ?></div></td>
</tr>
<?
}
if($use_condition == "1")
{
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_FORM_CONDITION; ?></div></td>
<td ><div align="center">
<select class='autoexp2' name="usr_condition" >
<option value='0'><?= JOO_SELECT; ?></option>
<?
foreach($condition as $mak)
{
if(isset($usr_condition))
{
if($usr_condition == $mak->id)
echo "<option value='".$mak->id."' selected>".$mak->ad_condition."</option>\r\n";
else
echo "<option value='".$mak->id."'>".$mak->ad_condition."</option>\r\n";
}
else
echo "<option value='".$mak->id."'>".$mak->ad_condition."</option>\r\n";
}
?>
</select>
</div></td>
<td ><div align="left"><? echo JOO_FORM_CONDIT_INFO; ?></div></td>
</tr>
<?
}
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_FORM_AD_PRICE."*"; ?></div></td>
<td ><div align="center">
<input class='autoexp' type="text" name="usr_price" alt='required' value='<? if(isset($usr_price)) echo $usr_price; ?>' >
</div></td>
<td ><div align="left"><? echo "( ".$currency1." )"; ?></div></td>
</tr>
<?
if($use_bprice == "1")
{
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_FORM_BPRICE; ?></div></td>
<td ><div align="center">
<input class='autoexp' type="text" name="usr_disprice" value='<? if(isset($usr_disprice)) echo $usr_disprice; ?>' >
</div></td>
<td ><div align="left"><? echo "( ".$currency1." )"; ?></div></td>
</tr>
<?
}
if($use_extcolor == "1")
{
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_EXT_COLOR; ?></div></td>
<td ><div align="center">
<select class='autoexp2' name="usr_extcolor">
<option value='0'><?= JOO_SELECT; ?></option>
<?
foreach($color as $mak)
{
if(isset($usr_extcolor))
{
if($usr_extcolor == $mak->id)
echo "<option value='".$mak->id."' selected>".$mak->color."</option>\r\n";
else
echo "<option value='".$mak->id."'>".$mak->color."</option>\r\n";
}
else
echo "<option value='".$mak->id."'>".$mak->color."</option>\r\n";
}
?>
</select>
</div></td>
<td ><div align="left"><? echo JOO_EXT_COLOR_INFO; ?></div></td>
</tr>
<?
}
if($use_intcolor == "1")
{
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_INT_COLOR; ?></div></td>
<td ><div align="center">
<select class='autoexp2' name="usr_intcolor">
<option value='0'><?= JOO_SELECT; ?></option>
<?
foreach($color as $mak)
{
if(isset($usr_intcolor))
{
if($usr_intcolor == $mak->id)
echo "<option value='".$mak->id."' selected>".$mak->color."</option>\r\n";
else
echo "<option value='".$mak->id."'>".$mak->color."</option>\r\n";
}
else
echo "<option value='".$mak->id."'>".$mak->color."</option>\r\n";
}
?>
</select>
</div></td>
<td ><div align="left"><? echo JOO_INT_COLOR_INFO; ?></div></td>
</tr>
<?
}
if($use_bodytype == "1")
{
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_FORM_BODYTYPE; ?></div></td>
<td ><div align="center">
<select class='autoexp2' name="usr_body" >
<option value='0'><?= JOO_SELECT; ?></option>
<?
foreach($bodytype as $mak)
{
if(isset($usr_body))
{
if($usr_body == $mak->id)
echo "<option value='".$mak->id."' selected>".$mak->bodytype."</option>\r\n";
else
echo "<option value='".$mak->id."'>".$mak->bodytype."</option>\r\n";
}
else
echo "<option value='".$mak->id."'>".$mak->bodytype."</option>\r\n";
}
?>
</select>
</div></td>
<td ><div align="left"><? echo JOO_FORM_BODYTYPE_INFO; ?></div></td>
</tr>
<?
}
if($use_door == "1")
{
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_FORM_DOOR; ?></div></td>
<td ><div align="center">
<input class='autoexp' type="text" name="usr_door" value='<? if(isset($usr_door)) echo $usr_door; ?>' >
</div></td>
<td ><div align="left"><? echo JOO_FORM_DOOR_INFO; ?></div></td>
</tr>
<?
}
if($use_fuel == "1")
{
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_FORM_FUEL; ?></div></td>
<td ><div align="center">
<select class='autoexp2' name="usr_fuel">
<option value='0'><?= JOO_SELECT; ?></option>
<?
foreach($fuel as $mak)
{
if(isset($usr_fuel))
{
if($usr_fuel == $mak->id)
echo "<option value='".$mak->id."' selected>".$mak->fuel."</option>\r\n";
else
echo "<option value='".$mak->id."'>".$mak->fuel."</option>\r\n";
}
else
echo "<option value='".$mak->id."'>".$mak->fuel."</option>\r\n";
}
?>
</select>
</div></td>
<td ><div align="left"><? echo JOO_FORM_FUEL_INFO; ?></div></td>
</tr>
<?
}
if($use_trans == "1")
{
?>
<tr>
<td width="20%"><div align="right"><?php echo JOO_FORM_TRANS; ?></div></td>
<td ><div align="center">
<select class='autoexp2' name="usr_trans">
<option value='0'><?= JOO_SELECT; ?></option>
<?
foreach($trans as $mak)
{
if(isset($usr_trans))
{
if($usr_trans == $mak->id)
echo "<option value='".$mak->id."' selected>".$mak->trans."</option>\r\n";
else
echo "<option value='".$mak->id."'>".$mak->trans."</option>\r\n";
}
else
echo "<option value='".$mak->id."'>".$mak->trans."</option>\r\n";
}
?>
</select>
</div></td>
<td ><div align="left"><? echo JOO_FORM_TRANS_INFO; ?></div></td>
</tr>
<?
}
if($use_drive == "1")
{
?>
<tr>
<td width="20%"><div align="right"><?php echo JOO_FORM_DRIVE; ?></div></td>
<td ><div align="center">
<select class='autoexp2' name="usr_drive">
<option value='0'><?= JOO_SELECT; ?></option>
<?
foreach($drive as $mak)
{
if(isset($usr_drive))
{
if($usr_drive == $mak->id)
echo "<option value='".$mak->id."' selected>".$mak->drive."</option>\r\n";
else
echo "<option value='".$mak->id."'>".$mak->drive."</option>\r\n";
}
else
echo "<option value='".$mak->id."'>".$mak->drive."</option>\r\n";
}
?>
</select>
</div></td>
<td ><div align="left"><? echo JOO_FORM_DRIVE_INFO; ?></div></td>
</tr>
<?
}
if($use_engine == "1")
{
?>
<tr>
<td width="20%"><div align="right"><?php echo JOO_FORM_ENGINE; ?></div></td>
<td ><div align="center">
<input class='autoexp' type="text" name="usr_engine" value='<? if(isset($usr_engine)) echo $usr_engine; ?>' >
</div></td>
<td ><div align="left"><? echo JOO_FORM_ENGINE_INFO; ?></div></td>
</tr>
<?
}
?>
<tr>
<td width="20%"><div align="right"><? echo JOO_PRICE_EQUIP; ?></div></td>
<td ><div align="center">
<?
// parameters : areaname, content, hidden field, width, height, rows, cols
editorArea( 'editor1', $usr_text, 'usr_text', '300', '170', '10', '50');
?>
</div></td>
<td ><div align="left"><? echo JOO_PRICE_EQUIP_INFO; ?></div></td>
</tr>
<input type='hidden' name='usr_ccode' value='<?= $ccode1; ?>'>
<tr>
<td colspan="3"><br /></td>
</tr>
<tr>
<td width="20%"><div align="right"></div></td>
<td ><div align="center">
<input type='hidden' name='txt_data' value='1'>
<input class="button" type="submit" name="Submit" value="<?= JOO_BTN_NEXT; ?>">
</div></td>
<td ><div align="left"></div></td>
</tr>
<tr>
<td colspan="3"><br /></td>
</tr>
</table>
</form>
<?
}
else if($post_flag)
{
?>
<table width="100%" class="autoexp" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3"><div align="center" id ="show2"><?= JOO_ADDIMGLIST ?></div><br /></td>
</tr>
<form action='' method='post' name='form2' enctype='multipart/form-data' onSubmit='return checkrequired(this)'>
<?
// only display image upload form if GD version meets requirements
if(checkgd())
{
$rq = "SELECT image_count FROM #__autoexp_config LIMIT 1";
$database->setQuery($rq);
$img_count1 = $database->loadObjectList();
$rq = "SELECT image_count FROM #__autoexp_add WHERE id = '$adid'";
$database->setQuery($rq);
$img_count2 = $database->loadObjectList();
$img_count_f = $img_count1[0]->image_count - $img_count2[0]->image_count;
?>
<tr>
<td width="20%"><div align="right"></div></td>
<td width="60%"><div align="center">
<input class='text' type='file' name='image' alt='required' style='width:250'>
</div><br /></td>
<td width="20%"><div align="left"></div></td>
</tr>
<tr>
<td width="20%"><div align="right"></div></td>
<td width="60%"><div align="center">
<?= JOO_ADDIMG_ISSUE ?>
<br />
<? echo JOO_IMG_COUNT_START.$img_count_f.JOO_IMG_COUNT_END; ?>
<br />
<? // last car ID ?>
<input type=hidden name='usr_adid' value='<?= $adid; ?>'>
<input class="button" type='submit' style='width:250;' value='Upload' <? if($img_count_f == 0) echo "disabled"; ?>>
</div><br /></td>
<td width="20%"><div align="left"></div></td>
</tr>
<tr>
<td width="20%"><div align="right"></div></td>
<td width="60%"><div align="center" id ="show2">
<?= JOO_CURRENTIMG ?>
</div></td>
<td width="20%"><div align="left"></div></td>
</tr>
<?
}
else
{
?>
<?= JOO_ADDIMG_ISSUE_ERR ?>
<?
} // end 'esle'
?>
</td>
</form>
</table>
<!-- IMAGES -->
<?
/*
* Show uploaded images
*/
// Get number of images
$rq = "SELECT image_count FROM #__autoexp_add WHERE id = '$adid'";
$database->setQuery($rq);
$num_img = $database->loadObjectList();
if($num_img[0]->image_count >= 1)
{
$rq = "SELECT thumb FROM #__autoexp_imagelist WHERE user_id = '$adid'";
$database->setQuery($rq);
$thumb_img = $database->loadObjectList();
}
// get images for this listing and display thumbnails
if($num_img[0]->image_count >= 1)
{
echo "<table align='center' width='50%' border='0'>";
echo "<tr>";
$i=0;
$kr=4; // ñòðîê
for($n = 0; $n < count($thumb_img); $n++)
{
if (($i%$kr)==0){
echo "</tr>";
echo "<tr align='center' valign='top'>";
}
echo "
<form action='' method='post' name='rem_".$n."'>
<td width=140 valign='top'>
<img src='".$mosConfig_live_site."/components/com_autoexp/images/tmb/".$thumb_img[$n]->thumb."' vspace=5><br>
<input type='hidden' name='img_remove' value='0'>\r\n
<input type='hidden' name='usr_adid' value='".$usr_adid."'>\r\n
<input type='hidden' name='r_thumb' value='".$thumb_img[$n]->thumb."'>\r\n
<input class='button' type='submit' value='Remove'>
</td>
</form>
";
$i++;
}
echo "</tr>";
echo "</table>";
}
else {
?>
<center>
<? echo JOO_EMPTY; ?>
</center>
<?
}
?>
<br>
<center>
<form action='<? echo $mosConfig_live_site."/index.php?option=com_autoexp&page=show_success&Itemid=$Itemid"; ?>' name='form_done' method='post'>
<input class='button' style='width: 157px;' type='submit' value='Done'>
</form>
</center>
<br><br>
<?
}
if($use_footer == "1")
include($mosConfig_absolute_path.'/components/com_autoexp/footer.php');
// build JS array
echo "<!-- Sobiraem JS Massive -->\r\n";
echo "<script language=\"JavaScript\">\r\n"; //type=\"text/javascript\"
echo "var model = new Array();\r\n";
echo "var model_id = new Array();\r\n";
echo "model[0] = [\"select\"];\r\n";
echo "model_id[0] = [\"\"];\r\n";
$j = 1;
foreach($make as $key1)
{
$strs = "model[".$j."]=[";
$str2s = "model_id[".$j."]=[";
$database->setQuery("SELECT id, mark_id, name FROM #__autoexp_model WHERE published = '1' AND mark_id = '".$key1->id."'");
$models = $database->loadObjectList();
foreach($models as $key3)//for($f = 0; $f < count($s_models)-1; $f++)
{
$strs .= "\"".$key3->name ."\", ";
$str2s .= "\"".$key3->id ."\", ";
}
if(substr($strs, strlen($strs) -2, 2) == ", ")
{
$strs = substr($strs, 0, strlen($strs) -2);
}
$strs .= "];\r\n";
$str2s .= "];\r\n";
echo $strs;
echo $str2s;
$j++;
}
echo "var makelist1 = document.form1.usr_make;\r\n";
echo "var modellist1 = document.form1.usr_model;\r\n";
echo "modellists.options[0] = new Option(modelss[0][0], 0);\r\n";
//echo "modellist.options[0] = new Option(models[0][0], 0);\r\n";
$method_update = "function update_model(selectedgroup)\r\n";
$method_update .= "{\r\n";
//$method_update .= "alert('go..go..go..' + selectedgroup);\r\n";
$method_update .= "modellist1.options.length = 0;\r\n";
$method_update .= "if(selectedgroup > 0)\r\n";
$method_update .= "{\r\n";
$method_update .= "for(i = 0; i <= model[selectedgroup].length; i++)\r\n";
$method_update .= "{\r\n";
$method_update .= "if( i == 0)\r\n";
$method_update .= "modellist1.options[modellist1.options.length] = new Option(model[0][0], 0);\r\n else \r\n";
$method_update .= "modellist1.options[modellist1.options.length] = new Option(model[selectedgroup][i-1],";
$method_update .= " model_id[selectedgroup][i-1]);\r\n";
$method_update .= "}\r\n";
$method_update .= "}\r\n";
$method_update .= "if(selectedgroup == 0){\r\n";
$method_update .= "modellist1.options[modellist1.options.length] = new Option(model[0][0], 0);\r\n";
$method_update .= "}\r\n";
$method_update .= "}\r\n";
echo $method_update;
echo "</script>\r\n";
?>
|