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

    "; $error_msg .= "Click on List Properties button to see the properties you have in archive
    "; $error_msg .= "Thank You
    "; errorPage($error_msg); exit; } // first we select the consultants and their details $sql = "SELECT * FROM SalesConsultant WHERE Agent= '" . $agent . "'"; $res = mysql_unbuffered_query($sql); while ($data = mysql_fetch_assoc($res)) { $tpl->assign( array( CONTACTNAME => $data['Consultant'], CONTACTPHONE => $data['ConsultantPhone'], CONTACTEMAIL => $data['ConsultantEmail'] ) ); $tpl->parse(CONTACTS,".contact"); } // now we select the suburbs and regions for the agent state // $sql = "SELECT Suburb,Region FROM Suburbs LEFT JOIN Agents ON LEFT(Suburbs.Region, LOCATE('-',Suburbs.Region)-1)=Agents.AgentState WHERE Agents.Agent= '" . $agent . "' ORDER BY Suburbs.Suburb"; $sql = "SELECT Suburb FROM Suburbs Where LEFT(Region, LOCATE('-',Region)-1)= '" . $agent_state . "' ORDER BY Suburb"; $res = mysql_unbuffered_query($sql); while ($data = mysql_fetch_assoc($res)) { $state = $agent_state; // $state = substr($data['Region'],0,strpos($data['Region'],'-')); $tpl->assign( array( SUBURBNAME => $data['Suburb'], SUBURBSTATE => $data['Suburb'].'-'.$state, SELECTED => '' ) ); $tpl->parse(SUBURBS,".suburb"); } // now we clear all the ather fields $tpl->assign( array( EMAILSUBJECT => 'RealEstate-NewRentalProperty', AGENTCODE => '', PROPERTYREFERENCE => $agent.$property, GRABBER => '', STATE => $state, DISPLAYADDRESS => '', PRICE => '', PRTEXT => '', BOND => '', LEASE0 => 'selected', LEASE1 => '', LEASE3 => '', LEASE6 => '', LEASE2 => '', BED00 => 'selected', BED01 => '', BED02 => '', BED03 => '', BED04 => '', BED05 => '', BED06 => '', BED07 => '', BED08 => '', BED09 => '', BED10 => '', BED11 => '', BED12 => '', BED13 => '', BED14 => '', BED15 => '', BAT00 => 'selected', BAT01 => '', BAT02 => '', BAT03 => '', BAT04 => '', BAT05 => '', BAT06 => '', BAT07 => '', BAT08 => '', BAT09 => '', BAT10 => '', VEH0 => 'selected', VEH1 => '', VEH2 => '', VEH3 => '', VEH4 => '', VEH5 => '', VEH6 => '', VEH7 => '', LANDSIZE => '', HOUSESIZE => '', ASPECT => '', OTHER => '', CONSTRUCTION => '', YEAR => '', HEATING => '', MUNICIPALRATES => '', TITLEREFERENCE => '', DESCRIPTION => '', MYDESCR => '', MYTHUMB => '', MYPHOT1 => '', MYPHOT2 => '', MYPHOT3 => '', MYPHOT4 => '', MYPHOT5 => '', MYFLOOR => '', CONTNAME => '', CONTPHONE => '', CONTEMAIL => '', HOUSE => $includes_array["House"], FLAT => $includes_array["Flat"], HOLIDAY => $includes_array["Holiday"], COMMERCIAL => $includes_array["Commercial"], UNFURNISHED => $includes_array["Unfurnished"], FULLY => $includes_array["Fully furnished"], PARTLY => $includes_array["Partly furnished"], FRIDGE => $includes_array["Fridge"], FREEZER => $includes_array["Freezer"], MICROWAVE => $includes_array["Microwave"], AIRCOND => $includes_array["Air Conditioning"], DISHWASHER => $includes_array["Dishwasher"], OUTDOOR => $includes_array["Outdoor Area"], FIREPLACE => $includes_array["Fireplace"], CABLE => $includes_array["Cable ready"], LAUNDRY => $includes_array["Laundry"], POOL => $includes_array["Pool"], WASHING => $includes_array["Washing Machine"], WARDROBES => $includes_array['Built-in wardrobes'], DRYER => $includes_array["Dryer"], HARDWOOD => $includes_array["Hardwood floors"], PETSALLOWED => $includes_array["Pets Allowed"], CARPET => $includes_array["Carpet floors"], STORAGE => $includes_array["Storage Space"], ACTIONNAME => 'Add_Property', ) ); // now we add the form colours $sql = "SELECT * FROM AgentColours Where Agent = '".$agent."'"; $res = mysql_unbuffered_query($sql); $data = mysql_fetch_assoc($res); $tpl->assign( array( AGENTCODE => $agent, COLOURBG => $data['colourBg'], COLOURTEXT => $data['colourText'], COLOURLINK => $data['colourLink'], COLOURVLINK => $data['colourvLink'], COLOURALINK => $data['colouraLink'], COLOUR1 => $data['colour1'], COLOUR2 => $data['colour2'], COLOUR3 => $data['colour3'], COLOUR4 => $data['colour4'], FONT1 => $data['font1'], FONT2 => $data['font2'], FONT3 => $data['font3'], FONT4 => $data['font4'] ) ); } $tpl->parse(MAIN, main); $tpl->FastPrint(MAIN); $end = $tpl->utime(); $runtime = round(($end - $start),2); echo "
    Processed in $runtime seconds
    \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
    attach a new one. -->  Existing Description File:
    "; } else { $mydescr = ""; } if ($data['FloorPlan'] != "") { $myfloorp =" To delete/change this photo clear the field or attach a new one.
    -->  Existing Floor plan photo:
    "; } else { $myfloorp = ""; } if ($data['Thumbnail'] != "") { $mythumb =" To delete/change this photo clear the field or attach a new one.
    -->  Existing Thumbnail:
    "; } else { $myfloorp = ""; } for ($i=1; $i < 6; $i++) { if ($data["Photo$i"] != "") { $eph[$i] =" To delete/change this photo clear the field or attach a new one.
    -->  Existing photo $i:
     
     
    "; } else { $eph[$i] =''; } } $grabber_treated = stripslashes ($data['Grabber']); $displayaddress_treated = stripslashes ($data['DisplayAddress']); $aspect_treated = stripslashes ($data['Aspect']); $other_treated = stripslashes ($data['Other']); $titlereference_treated = stripslashes ($data['TitleReference']); $description_treated = stripslashes ($data['Description']); $PriceText_treated = stripslashes ($data['PriceText']); $tpl->assign(array( EMAILSUBJECT => 'RealEstate-UpdateRentalProperty', AGENTCODE => $data['Agent'], PROPERTYREFERENCE => $agent.$property, GRABBER => $grabber_treated, STATE => $data['State'], DISPLAYADDRESS => $displayaddress_treated, PRICE => $data['Price'], PRTEXT => $PriceText_treated, BOND => $data['Bond'], LEASE0 => $selects_array['LEASE0'], LEASE1 => $selects_array['LEASE1'], LEASE3 => $selects_array['LEASE3'], LEASE6 => $selects_array['LEASE6'], LEASE2 => $selects_array['LEASE12'], BED00 => $selects_array['BED00'], BED01 => $selects_array['BED01'], BED02 => $selects_array['BED02'], BED03 => $selects_array['BED03'], BED04 => $selects_array['BED04'], BED05 => $selects_array['BED05'], BED06 => $selects_array['BED06'], BED07 => $selects_array['BED07'], BED08 => $selects_array['BED08'], BED09 => $selects_array['BED09'], BED10 => $selects_array['BED10'], BED11 => $selects_array['BED11'], BED12 => $selects_array['BED12'], BED13 => $selects_array['BED13'], BED14 => $selects_array['BED14'], BED15 => $selects_array['BED15'], BAT00 => $selects_array['BAT00'], BAT01 => $selects_array['BAT01'], BAT02 => $selects_array['BAT02'], BAT03 => $selects_array['BAT03'], BAT04 => $selects_array['BAT04'], BAT05 => $selects_array['BAT05'], BAT06 => $selects_array['BAT06'], BAT07 => $selects_array['BAT07'], BAT08 => $selects_array['BAT08'], BAT09 => $selects_array['BAT09'], BAT10 => $selects_array['BAT10'], VEH0 => $selects_array['VEH0'], VEH1 => $selects_array['VEH1'], VEH2 => $selects_array['VEH2'], VEH3 => $selects_array['VEH3'], VEH4 => $selects_array['VEH4'], VEH5 => $selects_array['VEH5'], VEH6 => $selects_array['VEH6'], VEH7 => $selects_array['VEH7'], LANDSIZE => $data['LandSize'], HOUSESIZE => $data['HouseSize'], ASPECT => $aspect_treated, OTHER => $other_treated, CONSTRUCTION => $data['Construction'], YEAR => $data['Year'], HEATING => $data['Heating'], MUNICIPALRATES => $data['Rates'], TITLEREFERENCE => $titlereference_treated, DESCRIPTION => $description_treated, MYDESCR => $mydescr, MYTHUMB => $mythumb, MYPHOT1 => $eph[1], MYPHOT2 => $eph[2], MYPHOT3 => $eph[3], MYPHOT4 => $eph[4], MYPHOT5 => $eph[5], MYFLOOR => $myfloorp, CONTNAME => $contactname, CONTPHONE => $contactphone, CONTEMAIL => $contactemail, HOUSE => $includes_array["House"], FLAT => $includes_array["Flat"], HOLIDAY => $includes_array["Holiday"], COMMERCIAL => $includes_array["Commercial"], UNFURNISHED => $includes_array["Unfurnished"], FULLY => $includes_array["Fully furnished"], PARTLY => $includes_array["Partly furnished"], FRIDGE => $includes_array["Fridge"], FREEZER => $includes_array["Freezer"], MICROWAVE => $includes_array["Microwave"], AIRCOND => $includes_array["Air Conditioning"], DISHWASHER => $includes_array["Dishwasher"], OUTDOOR => $includes_array["Outdoor Area"], FIREPLACE => $includes_array["Fireplace"], CABLE => $includes_array["Cable ready"], LAUNDRY => $includes_array["Laundry"], POOL => $includes_array["Pool"], WASHING => $includes_array["Washing Machine"], WARDROBES => $includes_array['Built-in wardrobes'], DRYER => $includes_array["Dryer"], HARDWOOD => $includes_array["Hardwood floors"], PETSALLOWED => $includes_array["Pets Allowed"], CARPET => $includes_array["Carpet floors"], STORAGE => $includes_array["Storage Space"], ACTIONNAME => 'Update_Property' ) ); } $tpl->parse(MAIN, main); $tpl->FastPrint(MAIN); $end = $tpl->utime(); $runtime = round(($end - $start),2); echo "
    Processed in $runtime seconds
    \n"; mysql_close($link); exit; #----------------------------------------------------------------------------------------------------------------- # # show the chosen region details for modification # #----------------------------------------------------------------------------------------------------------------- } elseif ($action == "Update_Property") { $DateEnt = date ("y\/m\/d", time()); $sql = "select * from Properties where PropertyCode = '" . $agent.$property . "'"; $res = mysql_query($sql,$link); $dat = mysql_fetch_assoc($res); if ($description != '') { $mydescr == ""; } $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->Priority(3) ; // set the priority to Low foreach ( $arrayAttachments as $key => $value ) { $m->Attach( "$key", "$value" ) ; // attach a file of type ? } /* if ($description == '') { $DescriptionFile = $mydescr; } $Thumbnail = $mythumb; $Photo1 = $myphoto_1; $Photo2 = $myphoto_2; $FloorPlan = $myfloorp; */ // here we check if the file uploading went ok $db_field = Array ('DescriptionFile','Thumbnail','Photo1','Photo2','Photo3','Photo4','Photo5','Photo6','FlooPlan'); $uploadfile = Array ('descr','thumb','photo_1','photo_2','photo_3','photo_4','photo_5','photo_6','floorp'); $upload_dir = Array ('embed','photos','photos','photos','photos','photos','photos','photos','photos'); $new_name = Array ("descrfile","thumb","1","2","3","4","5","6","floorplan"); $old_file = Array ("$mydescr","$mythumb","$myphoto_1","$myphoto_2","$myphoto_3","$myphoto_4","$myphoto_5","$myphoto_6","$myfloorp"); $NoPhotos = 0; for($i=0;$iAttach( "$base_dir/$upload_dir[$i]/$filename[$i]", "$thisfiletype" ); chmod ("$base_dir/$upload_dir[$i]/$filename[$i]", 0755); chown ("$base_dir/$upload_dir[$i]/$filename[$i]", 'ontas'); $NoPhotos++; } else { $field = $db_field[$i]; if ($old_file[$i] == '' && file_exists("$base_dir/$upload_dir[$i]/{$dat[$field]}") && $dat[$field] != '') {unlink ("$base_dir/$upload_dir[$i]/{$dat[$field]}");} if ($old_file[$i] != '') {$NoPhotos++;} $filename[$i] = $old_file[$i]; } } /* $uploadfile = Array ('descr','thumb','photo_1','photo_2','floorp'); $NoPhotos = 0; for($i=0;$i<5;$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" ) { $arr_basename = explode(".",$$varname_name); $file_ext = $arr_basename[1]; if ($i == 0) { 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 ( $$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 (!$error_msg) { if ($i == 0) { $upload_dir = "/www/pages/ontas/pages/realty/embed"; $local_uploadfile = "$upload_dir/$agent$property-descrfile.$file_ext"; $DescriptionFile = "$agent$property-descrfile.$file_ext"; $Description = ""; } elseif ($i == 1) { $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) { $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) { $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) { $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"); } else { $error_msg .= "
    Click here to go back to the previous page and correct the errors"; errorPage($error_msg); exit; } unlink ($$varname); } $error_msg = ''; } */ 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 find out to what region the suburb belong to. $sql = "SELECT Region FROM Suburbs WHERE Suburb= '" . $Suburb . "' AND LEFT(Region,LOCATE('-',Region)-1)='" . $State . "'"; $res = mysql_query($sql,$link); $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 = "UPDATE Properties SET "; $sql .= " Suburb = '$Suburb'"; $sql .= ", State = '$State'"; $sql .= ", Region = '$region'"; $sql .= ", DisplayAddress = '$DisplayAddress'"; $sql .= ", Grabber = '$Grabber'"; $sql .= ", Price = '$Price'"; $sql .= ", PriceText = '$PriceText'"; $sql .= ", Bond = '$Bond'"; $sql .= ", NumBedrooms = '$NumBedrooms'"; $sql .= ", NumBathrooms = '$NumBathrooms'"; $sql .= ", HouseSize = '$HouseSize'"; $sql .= ", LandSize = '$LandSize'"; $sql .= ", Construction = '$Construction'"; $sql .= ", Year = '$Year'"; $sql .= ", Housing = '$housing'"; $sql .= ", Includes = '$Prop_includes'"; $sql .= ", MunicipalRates = '$MunicipalRates'"; $sql .= ", TitleReference = '$TitleReference'"; $sql .= ", Heating = '$Heating'"; $sql .= ", VehicleAccommodation = '$VehicleAccommodation'"; $sql .= ", WaterViews = '$WaterViews'"; $sql .= ", Aspect = '$Aspect'"; $sql .= ", Other = '$Other'"; $sql .= ", Contact = '$Contact'"; $sql .= ", ContactPhone = '$ContactPhone'"; $sql .= ", ContactEmail = '$ContactEmail'"; $sql .= ", Description = '$Description'"; $sql .= ", DescriptionFile = '$filename[0]'"; $sql .= ", House = '$House'"; $sql .= ", Flat = '$Flat'"; $sql .= ", Holiday = '$Holiday'"; $sql .= ", Commercial = '$Commercial'"; $sql .= ", Thumbnail = '$filename[1]'"; $sql .= ", Photo1 = '$filename[2]'"; $sql .= ", Photo2 = '$filename[3]'"; $sql .= ", Photo3 = '$filename[4]'"; $sql .= ", Photo4 = '$filename[5]'"; $sql .= ", Photo5 = '$filename[6]'"; $sql .= ", FloorPlan = '$filename[8]'"; $sql .= ", NoPhotos = '$NoPhotos'"; $sql .= ", LeaseLength = '$LengthLease'"; $sql .= " WHERE PropertyCode = '" .$PropertyCode."'"; $result = mysql_query($sql,$link); if(!$result){ #if packages could not be deleted errorPage("
  • An error has occured while updating this property. Please check if the Property realy exist
    - " . mysql_error() . "
  • "); exit(); } else { $msg = "Agent: $agent \n"; $msg .= "Property: $property \n"; $msg .= "Date: $DateEnt \n\n"; $msg .= "$sql \n"; if (substr($agent,0,2) == 'pr') { header ("refresh: 2; url=https://www.global-online.com.au/ssl/realty/$agent-rental-property-form.htm"); processingPage("
  • 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() . "
  • "); exit(); } if(isset($private)) { $msg = "Agent: $agent \n"; $msg .= "Property: $property \n"; $msg .= "Date: $DateEnt \n"; $msg .= "$sql \n"; mail('property@global-online.com.au', "RealEstate-LeasedRentalProperty", $msg, "From: $agent$property-Rental@$agent.com.au"); header ("refresh: 2; url=http://www.global-online.com.au/ssl/realty/$agent-rental-property-form.htm"); processingPage("
  • The Property $agent$property has been leased"); mysql_close($link); exit(); } else { $msg = "Agent: $agent \n"; $msg .= "Property: $property \n"; $msg .= "Date: $DateEnt \n"; $msg .= "$sql \n"; mail('property@global-online.com.au', "RealEstate-LeasedRentalProperty", $msg, "From: $agent$property-Rental@$agent.com.au"); header ("refresh: 2; url=RealEstateMenu.php?action=Enter&whatToDo=rental&ag=$agent"); processingPage("
  • The Property $agent$property has been leased"); mysql_close($link); exit(); } } #----------------------------------------------------------------------------------------------------------------- # # Sold the property # #----------------------------------------------------------------------------------------------------------------- elseif ($action == "Leased_Sign") { $DateEnt = date ("y\/m\/d", time()); $sql = "UPDATE Properties SET "; $sql .= "Status='Leased Display',"; $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(); } $msg = "Agent: $agent \n"; $msg .= "Property: $property \n"; $msg .= "Date: $DateEnt \n"; $msg .= "$sql \n"; mail('property@global-online.com.au', "RealEstate-LeasedSignRentalProperty", $msg, "From: $agent$property-Rental@$agent.com.au"); header ("refresh: 2; url=RealEstateMenu.php?action=Enter&whatToDo=rental&ag=$agent"); processingPage("
  • The Property $agent$property has been Leased with Sign"); mysql_close($link); exit(); } #----------------------------------------------------------------------------------------------------------------- # # under offer property # #----------------------------------------------------------------------------------------------------------------- elseif ($action == "Application_Pending_Property") { $DateEnt = date ("y\/m\/d", time()); $sql = "UPDATE Properties SET "; $sql .= "Status='Application Pending',"; $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(); } $msg = "Agent: $agent \n"; $msg .= "Property: $property \n"; $msg .= "Date: $DateEnt \n"; $msg .= "$sql \n"; mail('property@global-online.com.au', "RealEstate-AppiclationPendingRentalProperty", $msg, "From: $agent$property-Rental@$agent.com.au"); header ("refresh: 2; url=RealEstateMenu.php?action=Enter&whatToDo=rental&ag=$agent"); processingPage("
  • The Property $agent$property has now an application pending"); mysql_close($link); exit(); } #----------------------------------------------------------------------------------------------------------------- # # Reactivate the property # #----------------------------------------------------------------------------------------------------------------- elseif ($action == "Reactivate_Property") { $DateEnt = date ("y\/m\/d", time()); $result = mysql_query("SELECT * from Properties WHERE PropertyCode = '" . $agent.$property . "'",$link); if (mysql_affected_rows() == 0 ) { $sql = "INSERT INTO Properties SELECT * FROM PropertiesArchive"; $sql .= " Where PropertyCode = '" . $agent.$property . "'"; if (! mysql_query($sql,$link)) { errorPage("
  • An error has occured while reactivating this property. Please check if the Property realy exist
    - " . mysql_error() . "
  • "); exit(); } $sql = "UPDATE Properties SET "; if (substr($agent,0,2) != 'pr') { $sql .= "Status='Normal',"; } $sql .= "DateEntered='$DateEnt',"; $sql .= "DateModified='$DateEnt',"; $sql .= "DateSold='' "; $sql .= "WHERE PropertyCode='" . $agent.$property . "'"; if (! mysql_query($sql,$link)) { errorPage("
  • An error has occured while reactivating this property. Please check if the Property realy exist
    - " . mysql_error() . "
  • "); exit(); } $sql = "DELETE FROM PropertiesArchive Where PropertyCode = '" . $agent.$property . "'"; if (! mysql_query($sql,$link)) { errorPage("
  • An error has occured while reactivating this property. Please check if the Property realy exist
    - " . mysql_error() . "
  • "); exit(); } } else { if (substr($agent,0,2) != 'pr') { $sql = "UPDATE Properties SET "; $sql .= "Status='Normal'"; $sql .= "WHERE PropertyCode='" . $agent.$property . "'"; if (! mysql_query($sql,$link)) { errorPage("
  • An error has occured while reactivating this property. Please check if the Property realy exist
    - " . mysql_error() . "
  • "); exit(); } } } $msg = "Agent: $agent \n"; $msg .= "Property: $property \n"; $msg .= "Date: $DateEnt \n"; $msg .= "$sql \n"; mail('property@global-online.com.au', "RealEstate-ReactivateRentalProperty", $msg, "From: $agent$property-Rental@$agent.com.au"); header ("refresh: 2; url=RealEstateMenu.php?action=Enter&whatToDo=rental&ag=$agent"); processingPage("
  • The Property $agent$property has been Reactivated"); mysql_close($link); exit(); } #----------------------------------------------------------------------------------------------------------------- # # List all agent properties # #----------------------------------------------------------------------------------------------------------------- elseif ($action == "List_Properties") { $top = "$agent properties list"; $bottom = ""; $sql = "select * from Properties where Agent = '" . $agent . "' AND RIGHT(Property,2) = '-r' ORDER BY PropertyCode"; $result = mysql_query($sql,$link); $rows = mysql_num_rows($result); if( $rows > 0 ) { $first = 1; echo "$top"; echo "

    " . $rows . " rental properties live:

    "; for ($n = 0; $n < $rows; $n++) { $data = mysql_fetch_assoc($result); if( $first ) { $first = 0; echo ""; $keys = array_keys( $data ); reset( $keys ); while( list(,$key) = each( $keys ) ) echo ""; echo "\n"; } if( $n % 2 == 0 ) echo ""; else echo ""; reset( $data ); while( list(,$value) = each( $data ) ) echo ""; echo "\n"; } echo "
    " . $key . "
    " . $value . "

    \n"; echo "

    End of results

    $bottom"; } else { echo "$top

    You have no properties at this moment.

    $bottom"; } $sql = "select * from PropertiesArchive where Agent = '" . $agent . "' AND RIGHT(Property,2) = '-r' ORDER BY PropertyCode"; $result = mysql_query($sql,$link); $rows = mysql_num_rows($result); if( $rows > 0 ) { $first = 1; echo "$top
    "; echo "

    " . $rows . " rental properties in archive:

    "; for ($n = 0; $n < $rows; $n++) { $data = mysql_fetch_assoc($result); if( $first ) { $first = 0; echo ""; $keys = array_keys( $data ); reset( $keys ); while( list(,$key) = each( $keys ) ) echo ""; echo "\n"; } if( $n % 2 == 0 ) echo ""; else echo ""; reset( $data ); while( list(,$value) = each( $data ) ) echo ""; echo "\n"; } echo "
    " . $key . "
    " . $value . "

    \n"; echo "

    End of results

    $bottom"; } else { echo "$top

    You have no properties in Archive at this moment.

    $bottom"; } mysql_close($link); exit(); } ?>