10)
{
$i = $i / 10;
}
$check = $userid . $trick[$i] . ((($userid * 10) / 2) * 3);
if ($password != $check)
{
errorPage("You have entered either a wrong password or userid");
exit;
}
elseif ($prop_opt == 'change')
{
$action = 'Change_Property';
}
elseif ($prop_opt == 'remove')
{
$action = 'Lease_Property';
}
}
if(isset($private) && $action == 'Add_Property')
{
// Initialize template
$tpl = new FastTemplate("/www/pages/global/pages/ssl/realty");
}
else
{
// Initialize template
$tpl = new FastTemplate("../templates");
$tpl->define(
array(
main => "rental-form-template.tpl",
)
);
$tpl->define_dynamic ( "suburb", "main");
$tpl->define_dynamic ( "contact", "main");
$tpl->define_dynamic ( "yesprv", "main");
$tpl->define_dynamic ( "notprv", "main");
}
$start = $tpl->utime(); // Benchmarking
/*
// Initialize template
$tpl = new FastTemplate("../templates");
$start = $tpl->utime(); // Benchmarking
$tpl->define(
array(
main => "rental-form-template.tpl",
)
);
$tpl->define_dynamic ( "suburb", "main");
$tpl->define_dynamic ( "contact", "main");
$tpl->define_dynamic ( "yesprv", "main");
$tpl->define_dynamic ( "notprv", "main");
*/
if (!isset($agent)) {$agent = $clientc;}
if (isset($property_form))
{
$property = $property_form;
}
else
{
$property = substr($PropertyCode, 4);
}
if (substr($agent,0,2) == 'pr')
{
$_SESSION['privileges'] = 'realty';
$tpl->clear_dynamic(notprv);
}
else
{
$tpl->clear_dynamic(yesprv);
}
// First we check if the user has login properly, if not we open the login page.
if (!isset($_SESSION['privileges']) || !isset($action)) {
header ("refresh: 2; url=/login.php");
processingPage("
Your session has expired");
exit;
}
# -----------------------------------------------------------------------------------------
# Got here so we open the database
# -----------------------------------------------------------------------------------------
$link = connectToDatabase(); #if error let user know.
if (!$link)
{
errorPage("
DATABASE CONNECTION ERROR **** " . mysql_error());
exit();
}
$includes_array = Array
(
'House' => '',
'Flat' => '',
'Holiday' => '',
'Commercial' => '',
'Unfurnished' => '',
'Fully furnished' => '',
'Partly furnished' => '',
'Fridge' => '',
'Freezer' => '',
'Microwave' => '',
'Air Conditioning' => '',
'Dishwasher' => '',
'Outdoor Area' => '',
'Fireplace' => '',
'Cable ready' => '',
'Laundry' => '',
'Pool' => '',
'Washing Machine' => '',
'Built-in wardrobes'=> '',
'Dryer' => '',
'Hardwood floors' => '',
'Pets Allowed' => '',
'Carpet floors' => '',
'Storage Space' => ''
);
$selects_array = Array
(
'LEASE0'=>'','LEASE1'=>'','LEASE3'=>'','LEASE6'=>'','LEASE12'=>'',
'BED00'=>'','BED01'=>'','BED02'=>'','BED03'=>'','BED04'=>'','BED05'=>'','BED06'=>'','BED07'=>'','BED08'=>'','BED09'=>'','BED10'=>'', 'BED11'=>'', 'BED12'=>'','BED13' =>'', 'BED14'=>'', 'BED15'=>'',
'BAT00'=>'','BAT01'=>'','BAT02'=>'','BAT03'=>'','BAT04'=>'','BAT05'=>'','BAT06'=>'','BAT07'=>'','BAT08'=>'','BAT09'=>'','BAT10'=>'',
'VEH0'=>'','VEH1'=>'','VEH2'=>'','VEH3'=>'','VEH4'=>'','VEH5'=>'','VEH6'=>'','VEH7'=>''
);
$veh_array = Array('-','Single Garage','Double Garage','Three Car Garage','Single Carport',
'Double Carport','Off Street Parking','Carport & Garage');
# -----------------------------------------------------------------------------------------
#
# choice was new rental so we open an empty form
#
# -----------------------------------------------------------------------------------------
if($action == 'New_Rental')
{
$sql = "select * from Properties where PropertyCode = '".$agent.$property . "'";
$result = mysql_query($sql,$link);
// $data = mysql_fetch_assoc($result);
// if the property already exist send the user back with an error message
if (mysql_num_rows($result) > 0 )
{
header ("location: RealEstateMenu.php?action=Enter&whatToDo=rental&error=AlreadyExist&ag=$ag&cORg=$cORg");
exit;
}
// otherwise open the form
else
{
$sql = "select * from PropertiesArchive where PropertyCode = '".$agent.$property . "'";
$r = mysql_query($sql,$link);
// $data = mysql_fetch_assoc($result);
// if the property already exist send the user back with an error message
if (mysql_num_rows($r) > 0 )
{
$error_msg = "This property code ($property) exists in you leased properties archive ";
$error_msg .= "You may reactivate the property and then change its details ";
$error_msg .= "or You should enter a new code
\n";
mysql_close($link);
exit;
}
# -----------------------------------------------------------------------------------------
#
# the use wants to add a new property
#
# -----------------------------------------------------------------------------------------
elseif($action == 'Add_Property')
{
if(isset($private))
{
if (!isset($ContactEmail) || $ContactEmail == '')
{
$error_msg = "The field Contact Email is compulsory";
$error_msg .= " Click here to go back to the previous page and correct the errors";
$error_msg .= " don't forget to re-attach the photos, if this is the case.";
errorPage($error_msg);
exit;
}
$sql = "select Property, Max(FLOOR(Property)) as lastRef from Properties where Agent = '$agent' AND LOCATE('-r',PropertyCode) != 0 GROUP BY Agent";
$res = mysql_unbuffered_query($sql);
$data = mysql_fetch_assoc($res);
if (mysql_affected_rows() == 0 )
{
$lastPrivProp = 1000;
}
else
{
$lastPrivProp = $data['lastRef'] + 1;
}
$sql = "select Property, Max(FLOOR(Property)) as lastRef from PropertiesArchive where Agent = '$agent' AND LOCATE('-r',PropertyCode) != 0 GROUP BY Agent";
$res = mysql_unbuffered_query($sql);
$data = mysql_fetch_assoc($res);
if (mysql_affected_rows() == 0 )
{
$lastPrivPropArchive = 1000;
}
else
{
$lastPrivPropArchive = $data['lastRef'] + 1;
}
if ($lastPrivProp > $lastPrivPropArchive)
{
$unique_id = $lastPrivProp . '-r';
$u_id = $lastPrivProp;
}
else
{
$unique_id = $lastPrivPropArchive . '-r';
$u_id = $lastPrivPropArchive;
}
if(!isset($howLong) || $howLong == '') {$howLong = '01';}
$Status = 'Normal-'.$howLong;
// $Status = 'Private';
// $agent = 'priv';
$property = $unique_id;
$PropertyCode = $agent . $property;
$confirme = "orderNumber = $unique_id\n";
$confirme .= "CardHolderName = $Cardname\n";
$confirme .= "ContactPhone = $ContactPhone\n";
$confirme .= "ContactEmail = $ContactEmail\n";
$confirme .= "expiry_month = $Expmonth\n";
$confirme .= "expiry_year = $Expyear\n";
$confirme .= "amount = $amount\n\n";
$confirme .= "Agent = $agent\n";
$confirme .= "Property = $property\n";
$sql = "INSERT INTO PropertiesArchive";
}
else
{
$Status = 'Normal';
$sql = "INSERT INTO Properties";
}
$DateEntered = date ("y\/m\/d", time());
$DateModified = date ("y\/m\/d", time());
//
switch ($property_type) {
case 'house':
$House = True;
break;
case 'flat':
$Flat = True;
break;
case 'holiday':
$Holiday = True;
break;
case 'commercial':
$Commercial = True;
break;
}
$Prop_includes = "";
for ($i = 0; $i < (sizeOf($Includes)); $i++) {
$Prop_includes .= $Includes[$i];
if (($i + 1) < sizeOf($Includes))
{
$Prop_includes .= ":";
}
}
// here we check if the file uploading went ok
$uploadfile = Array ('descr','thumb','photo_1','photo_2','photo_3','photo_4','photo_5','floorp');
$NoPhotos = 0;
for($i=0;$i<8;$i++)
{
$varname = $uploadfile[$i];
$filen = $$uploadfile[$i];
$varname_name = $uploadfile[$i]."_name";
$varname_type = $uploadfile[$i]."_type";
$varname_size = $uploadfile[$i]."_size";
$thisfiletype = $$varname_type;
if ( $$varname != "" && $$varname != "none" )
{
//echo ("Your File = " . $$varname . " (" . $$varname_name . " ," . $$varname_type ." ," . $$varname_size . " bytes) ");
$arr_basename = explode(".",$$varname_name);
$file_ext = $arr_basename[1];
if ($i == 0)
{
//if file specified isn't a gif/jpeg, output error message
if (($$varname_type != "text/plain")
&& ($$varname_type != "text/html")
&& ($file_ext != "emb"))
{
$error_msg .= "Your Description file is not a valid type. ";
$error_msg .= "valid types are: ";
$error_msg .= ".emb / .txt / .htm ";
$error_msg .= "Your File = " . $$varname . " (" . $$varname_name . " ," . $$varname_type ." ," . $$varname_size . " bytes) ";
$error_msg .= "Please try again ";
}
}
elseif (($$varname_type != "image/gif")
&& ($$varname_type != "image/jpeg")
&& ($$varname_type != "image/pjpeg"))
{
$error_msg .= "Your photo(s) is(are) not a valid type. ";
$error_msg .= "valid types are: ";
$error_msg .= ".jpg / .gif ";
$error_msg .= "Your File = " . $$varname . " (" . $$varname_name . " ," . $$varname_type ." ," . $$varname_size . " bytes) ";
$error_msg .= "Please try again ";
}
// if ($i != 1) {$NoPhotos++;} // counting the number of photos
//if the file is larger than 500kb (500 kilobytes), output error message
if ( $$varname_size > 500000 )
{
$error_msg .= "Sorry, your file is too large maximum size is 500 Kb. ";
}
if (!is_uploaded_file($$varname))
{
$error_msg .= "Sorry, unidentified error with your upload file please attach a new one . ";
}
//if there's no error, print info about the uploaded file
if (!$error_msg)
{
// Change $upload_dir to the directory that you have write permission for
if ($i == 0 ) // description file
{
$upload_dir = "/www/pages/ontas/pages/realty/embed";
$local_uploadfile = "$upload_dir/$agent$property-descrfile.$file_ext";
$DescriptionFile = "$agent$property-descrfile.$file_ext";
}
elseif ($i == 1 ) // thumbnail
{
$upload_dir = "/www/pages/ontas/pages/realty/photos";
$local_uploadfile = "$upload_dir/$agent$property-thumb.$file_ext";
$Thumbnail = "$agent$property-thumb.$file_ext";
}
elseif ($i == 2 ) // photo 1
{
$upload_dir = "/www/pages/ontas/pages/realty/photos";
$local_uploadfile = "$upload_dir/$agent$property-1.$file_ext";
$Photo1 = "$agent$property-1.$file_ext";
$NoPhotos++;
}
elseif ($i == 3 ) // photo 2
{
$upload_dir = "/www/pages/ontas/pages/realty/photos";
$local_uploadfile = "$upload_dir/$agent$property-2.$file_ext";
$Photo2 = "$agent$property-2.$file_ext";
$NoPhotos++;
}
elseif ($i == 4 ) // photo 3
{
$upload_dir = "/www/pages/ontas/pages/realty/photos";
$local_uploadfile = "$upload_dir/$agent$property-3.$file_ext";
$Photo3 = "$agent$property-3.$file_ext";
$NoPhotos++;
}
elseif ($i == 5 ) // photo 4
{
$upload_dir = "/www/pages/ontas/pages/realty/photos";
$local_uploadfile = "$upload_dir/$agent$property-4.$file_ext";
$Photo4 = "$agent$property-4.$file_ext";
$NoPhotos++;
}
elseif ($i == 6 ) // photo 5
{
$upload_dir = "/www/pages/ontas/pages/realty/photos";
$local_uploadfile = "$upload_dir/$agent$property-5.$file_ext";
$Photo5 = "$agent$property-5.$file_ext";
$NoPhotos++;
}
elseif ($i == 7 ) // floor plan
{
$upload_dir = "/www/pages/ontas/pages/realty/photos";
$local_uploadfile = "$upload_dir/$agent$property-floorplan.$file_ext";
$FloorPlan = "$agent$property-floorplan.$file_ext";
}
Exec("cp $filen $local_uploadfile");
$arrayAttachments["$local_uploadfile"]=$thisfiletype;
Exec("chmod 744 $local_uploadfile");
Exec("chown $local_uploadfile ontas");
// copy($$varname,$local_uploadfile);
}
else
{
// link to go back and correct errors
$error_msg .= " Click here to go back to the previous page and correct the errors";
errorPage($error_msg);
exit;
}
unlink ($$varname);
}
$error_msg = '';
}
// here we find out to what region the suburb belong to.
$sql1 = "SELECT Region FROM Suburbs WHERE Suburb= '" . $Suburb . "' AND LEFT(Region,3)='" . $State . "'";
$res = mysql_query($sql1,$link);
// $rows = mysql_num_rows($res);
$data = mysql_fetch_assoc($res);
$region = $data['Region'];
$Grabber = addslashes ($Grabber);
$DisplayAddress = addslashes ($DisplayAddress);
$Aspect = addslashes ($Aspect);
$Other = addslashes ($Other);
$TitleRef = addslashes ($TitleRef);
$Description = addslashes ($Description);
$PriceText = addslashes ($PriceText);
// append the retrieved information to the database
$sql .= " (PropertyCode,Agent,Property,Status,";
$sql .= "DateEntered ,DateModified ,DateSold ,";
$sql .= "Suburb ,State ,Region ,";
$sql .= "DisplayAddress ,Grabber ,";
$sql .= "Price ,PriceText ,Bond ,";
$sql .= "NumBedrooms ,NumBathrooms,";
$sql .= "HouseSize ,LandSize ,Construction ,Year ,";
$sql .= "Housing ,Includes ,";
$sql .= "MunicipalRates ,TitleReference ,";
$sql .= "Heating ,VehicleAccommodation ,WaterViews ,";
$sql .= "Aspect ,Other ,";
$sql .= "Contact ,ContactPhone ,ContactEmail ,";
$sql .= "Description ,DescriptionFile ,";
$sql .= "Farm ,Residence ,Commercial ,VacantLand ,Business ,";
$sql .= "House ,Flat ,Holiday ,";
$sql .= "Thumbnail ,Photo1 ,Photo2 ,Photo3 ,";
$sql .= "Photo4 ,Photo5 ,Photo6 ,FloorPlan, NoPhotos, LeaseLength)";
$sql .= "values ('$PropertyCode','$agent','$property','$Status',";
$sql .= "'$DateEntered','$DateModified','',";
$sql .= "'$Suburb','$State','$region',";
$sql .= "'$DisplayAddress','$Grabber',";
$sql .= "'$Price','$PriceText','$Bond',";
$sql .= "'$NumBedrooms','$NumBathrooms',";
$sql .= "'$HouseSize','$LandSize','$Construction','$Year',";
$sql .= "'$housing','$Prop_includes',";
$sql .= "'$Rates','$TitleRef',";
$sql .= "'$Heating','$VehicleAccommodation','$WaterViews',";
$sql .= "'$Aspect','$Other',";
$sql .= "'$Contact','$ContactPhone','$ContactEmail',";
$sql .= "'$Description','$DescriptionFile',";
$sql .= "'$Farm','$Residence','$Commercial','$VacantLand','$Business',";
$sql .= "'$House','$Flat','$Holiday',";
$sql .= "'$Thumbnail','$Photo1','$Photo2','$Photo3',";
$sql .= "'$Photo4','$Photo5','$Photo6','$FloorPlan', '$NoPhotos', '$LengthLease')";
$result = mysql_query($sql,$link);
if ($result) {
if(isset($private))
{
$i = $u_id;
while ($i > 10)
{
$i = $i / 10;
}
$pass = $u_id . $trick[$i] . ((($u_id * 10) / 2) * 3);
$msg = "Agent: $agent \n";
$msg .= "Property reference: $u_id \n";
$msg .= "Password: $pass \n";
$msg .= "Date: $DateEntered \n";
$msg .= "$confirme \n";
if ($bycheque == 'checkbox')
{
$sub = 'RealEstate-NewPrivatePropertyRental - paid by cheque';
}
else
{
$sub = 'RealEstate-NewPrivateRentalProperty';
}
// mail('property@global-online.com.au', $sub, $msg, "From: $agent$property-Rental@$agent.com.au");
$msg1 = "Dear user,\n";
$msg1 .= "Keep this information in a safe place you will need it\n";
$msg1 .= "to make changes in or to remove your property\n";
$msg1 .= "from the list.\n\n";
$msg = $msg1 . $msg;
mail($ContactEmail, $sub, $msg, "From: property@global-online.com.au");
// $all = "$agent:$property:$Suburb:$State:$howLong:";
// $all .= "$name:$address:$from:";
// $all .= "$sub:$country:$CanExport:$action_PHP:$bycheque:";
// $all .= "$to:$product:$GST:$merchant:$merchantABN:$amount:";
// $all .= "$Cardno:$Cardtype:$Expyear:$Expmonth:$Cardname";
// virtual("/realty/globalrealty.cgi?all=$all");
// header ("refresh: 2; url=http://www.global-online.com.au/ssl/realty/$agent-rental-property-form.htm");
// processingPage("
The Property $agent$property has been added to database");
$msg .= "\n$sql \n";
$m= new Mail; // create the mail
$m->From( "$agent$property-Rental@$agent.com.au" );
$m->To( "property@global-online.com.au" );
$m->Subject( "RealEstate-NewRentalProperty" );
$m->Body( $msg); // set the body
$m->Priority(3) ; // set the priority to Low
foreach ( $arrayAttachments as $key => $value ) {
$m->Attach( "$key", "$value" ) ; // attach a file of type ?
}
$m->Send(); // send the mail
$tpl->define(
array(
creditcard => "$nexturl",
));
$tpl->assign(
array(
AGENTCODE => $agent,
REFERENCE => $property,
PASSWORD => $pass,
CLIENTNAME => $Contact,
CLIENTPHONE => $ContactPhone,
CLIENTEMAIL => $ContactEmail,
));
$tpl->parse(PAYM, creditcard);
$tpl->FastPrint(PAYM);
mysql_close($link);
exit();
}
else
{
$msg = "Agent: $agent \n";
$msg .= "Property: $property \n";
$msg .= "Date: $DateEntered \n";
$msg .= "$confirme \n\n";
$msg .= "$sql \n";
header ("refresh: 2; url=RealEstateMenu.php?action=Enter&whatToDo=rental&ag=$agent");
processingPage("
The Property $agent$property has been added to database");
$m= new Mail; // create the mail
$m->From( "$agent$property-Rental@$agent.com.au" );
$m->To( "property@global-online.com.au" );
$m->Subject( "RealEstate-NewRentalProperty" );
$m->Body( $msg); // set the body
$m->Priority(3) ; // set the priority to Low
foreach ( $arrayAttachments as $key => $value ) {
$m->Attach( "$key", "$value" ) ; // attach a file of type ?
}
$m->Send(); // send the mail
exit();
}
}
else
{
errorPage("
Please ensure that a Property with the same code doesn't already exist.
");
exit();
}
mysql_close($link);
exit();
}
# -----------------------------------------------------------------------------------------
#
# Action was change this property
#
# -----------------------------------------------------------------------------------------
elseif($action == 'Change_Property')
{
if (!strstr($property,'-r') && substr($agent,0,2) == 'pr')
{
$property .= '-r';
}
$sql = "select * from Properties where PropertyCode = '" . $agent.$property . "'";
$result = mysql_query($sql,$link);
$data = mysql_fetch_assoc($result);
// if the property doen't exist send the user back with an error message
if (mysql_affected_rows() == 0 && !isset($private))
{
header ("location: RealEstateMenu.php?action=Enter&whatToDo=rental&error=DoesNotExist&ag=$agent&cORg=$cORg");
exit;
}
elseif (mysql_affected_rows() == 0 && isset($private))
{
errorPage("
This Property does not exist on database Please check if you have entered the right reference code.
");
exit();
}
// otherwise open the form
else
{
// now we add the form colours
$sql = "SELECT * FROM AgentColours Where Agent = '".$agent."'";
$res = mysql_unbuffered_query($sql);
$dat = mysql_fetch_assoc($res);
$tpl->assign(array(
AGENTCODE => $agent,
COLOURBG => $dat['colourBg'],
COLOURTEXT => $dat['colourText'],
COLOURLINK => $dat['colourLink'],
COLOURVLINK => $dat['colourvLink'],
COLOURALINK => $dat['colouraLink'],
COLOUR1 => $dat['colour1'],
COLOUR2 => $dat['colour2'],
COLOUR3 => $dat['colour3'],
COLOUR4 => $dat['colour4'],
FONT1 => $dat['font1'],
FONT2 => $dat['font2'],
FONT3 => $dat['font3'],
FONT4 => $dat['font4']
));
$colour3 = $dat['colour3'];
$font3 = $dat['font3'];
$contactname = $data['Contact'];
$contactphone = $data['ContactPhone'];
$contactemail = $data['ContactEmail'];
if (substr($agent,0,2) != 'pr')
{
// first we select the consultants and their details
$sql = "SELECT * FROM SalesConsultant WHERE Agent= '" . $agent . "'";
$res = mysql_unbuffered_query($sql);
while ($dat = mysql_fetch_assoc($res))
{
if ($dat['Consultant'] == $data['Contact']){$selected = 'selected';}
else {$selected = '';}
$tpl->assign(array(
CONTACTNAME => $dat['Consultant'],
CONTACTPHONE => $dat['ConsultantPhone'],
CONTACTEMAIL => $dat['ConsultantEmail'],
SELECTED => $selected
));
$tpl->parse(CONTACTS,".contact");
}
$tpl->parse(NOTPRVS,"notprv");
}
$sql = "SELECT Suburb FROM Suburbs Where LEFT(Region, LOCATE('-',Region)-1)= '" . $data['State'] . "' ORDER BY Suburb";
$res = mysql_unbuffered_query($sql);
while ($dat = mysql_fetch_assoc($res))
{
if ($dat['Suburb'] == $data['Suburb']){$selected = 'selected';}
else {$selected = '';}
$tpl->assign(array(
SUBURBNAME => $dat['Suburb'],
SUBURBSTATE => $dat['Suburb'].'-'.$data['State'],
SELECTED => $selected
));
$tpl->parse(SUBURBS,".suburb");
}
// check the original options for includes
$arr_includes = explode(":",$data['Includes']);
for ($i=0; $i < sizeOf($arr_includes); $i++)
{
$includes_array["$arr_includes[$i]"] = checked;
}
// check the options for house type and housing
if ($data['House'] == 1){$includes_array['House'] = checked;}
elseif ($data['Flat'] == 1) {$includes_array['Flat'] = checked;}
elseif ($data['Holiday'] == 1){$includes_array['Holiday'] = checked;}
elseif ($data['Commercial'] == 1){$includes_array['Commercial'] = checked;}
$includes_array["{$data['Housing']}"] = checked;
$selects_array["LEASE{$data['LeaseLength']}"] = selected;
if ($data['NumBedrooms'] >= 10) {$num_bed = "BED{$data['NumBedrooms']}";}
else {$num_bed = "BED0{$data['NumBedrooms']}";}
$selects_array[$num_bed] = selected;
if ($data['NumBathrooms'] >= 10) {$num_bat = "BAT{$data['NumBathrooms']}";}
else {$num_bat = "BAT0{$data['NumBathrooms']}";}
$selects_array[$num_bat] = selected;
for ($i=0; $i < 8; $i++)
{
if ( $veh_array[$i] == $data['VehicleAccommodation']) {$selects_array["VEH$i"] = selected;}
}
if ($data['DescriptionFile'] != "")
{
$mydescr ="
To delete/change this description clear the field or
The Property $agent$property has been updated on database");
}
else
{
header ("refresh: 2; url=RealEstateMenu.php?action=Enter&ag=$agent&whatToDo=rental&ag=$agent");
processingPage("
The Property $agent$property has been updated on database");
}
// $m= new Mail; // create the mail
// $m->From( "$agent$property-Rental@$agent.com.au" );
// $m->To( "property@global-online.com.au" );
// $m->Subject( "RealEstate-ChangedRentalProperty" );
$m->Body( $msg); // set the body
// $m->Priority(3) ; // set the priority to Low
// foreach ( $arrayAttachments as $key => $value ) {
// $m->Attach( "$key", "$value" ) ; // attach a file of type ?
// }
$m->Send(); // send the mail
}
mysql_close($link);
exit();
}
#-----------------------------------------------------------------------------------------------------------------
#
# Lease the property
#
#-----------------------------------------------------------------------------------------------------------------
elseif ($action == "Lease_Property")
{
if (!strstr($property,'-r') && substr($agent,0,2) == 'pr')
{
$property .= '-r';
}
$DateEnt = date ("y\/m\/d", time());
$sql = "INSERT INTO PropertiesArchive SELECT * FROM Properties";
$sql .= " Where PropertyCode = '" . $agent.$property . "'";
$result = mysql_query($sql,$link);
$sql = "UPDATE PropertiesArchive SET ";
if (substr($agent,0,2) != 'pr')
{
$sql .= "Status='Leased',";
}
$sql .= "DateSold='$DateEnt' ";
$sql .= "WHERE PropertyCode='" . $agent.$property . "'";
if (!mysql_query($sql,$link))
{
errorPage("
An error has occured while leasing this property. Please check if the Property realy exist - " . mysql_error() . "
");
exit();
}
$sql = "DELETE FROM Properties Where PropertyCode = '" . $agent.$property . "'";
if (! mysql_query($sql,$link))
{
errorPage("
An error has occured while leasing this property. Please check if the Property realy exist - " . mysql_error() . "