db_host=$dbhost; $this->db_user=$dbuser; $this->db_pass=$dbpass; $this->db_name=$dbname; $this->ln = mysql_connect($this->db_host, $this->db_user, $this->db_pass) or die("cannot connect"); mysql_select_db($this->db_name,$this->ln); } function db_selectData($query) { $this->query=$query; $this->result= mysql_query($this->query,$this->ln); return $this->result; } function db_insertData($query) { $this->query=$query; $this->result= mysql_query($this->query,$this->ln); return $this->result; } function db_lastID() { $this->lastID = mysql_insert_id(); return $this->lastID; } function db_deleteData($query) { $this->query=$query; $this->result= mysql_query($this->query,$this->ln); return $this->result; } function db_updateData($query) { $this->query=$query; $result= mysql_query($this->query,$this->ln); return $this->result; } function db_countRows($res) { $this->numrows = mysql_num_rows($res); return $this->numrows; } function db_close() { if($this->ln!=NULL) mysql_close($this->ln); } function db_fetchrows($result) { $this->row = mysql_fetch_array($result); return $this->row; } function db_fetchrow($result) { $this->row = mysql_fetch_row($result); return $this->row; } function db_rowsAffected() { $this->affectedrow=mysql_affected_rows(); return $this->affectedrow; } function db_freeresult($result) { mysql_free_result($result); } } ?> dbobj = new db(); $this->db_host = $dbhost; $this->db_user = $dbuser; $this->db_pass = $dbpass; $this->db_name = $dbname; $dd=0; $mm=0; $yy=0; } function getdateformat($year,$month,$day) { $this->dd=$day; $this->mm=$month; $this->yy=$year; if(checkdate($this->mm,$this->dd,$this->yy)) { $formatdate = $this->yy."-".$this->mm."-".$this->dd; //yyyy-mm-dd format return $formatdate; } else { return FALSE; } } /* the function getdate_yyyy_mm_dd returns the current date in the year-month-day format*/ function getdate_yyyy_mm_dd() { $currentdate =date("Y-m-d"); return $currentdate; } /* the function getdate_yyyy_mm_dd returns the current date in the month-day-year format*/ function getdate_mm_dd_yyyy() { $currentdate =date("m-d-Y"); return $currentdate; } //function to get the date in the format mm/dd/yyyy when returning from database. function getdate_m_d_y($date) { list($year,$mon,$day)=split("-",$date); $formatteddate="$mon/$day/$year"; return $formatteddate; } //function to get the date in the format mm-dd-yyyy when splitted by "-" function getdate_mo_da_year($date) { list($year,$mon,$day)=split("-",$date); $formatteddate="$mon-$day-$year"; return $formatteddate; } function getdate_mo_da_year1($date) { list($year,$mon,$day)=split("-",$date); $formatteddate="$mon/$day/$year"; return $formatteddate; } //function to get the date in the format yyyy-mm-dd when inserting into database. function getdbdate_y_m_d($date) { list($mon,$day,$year)=split("/",$date); $formatteddate="$year-$mon-$day"; return $formatteddate; } function getunixtime() { return time(); } //the function getcurrent_M get the current month in figure function getcurrent_M() { $today = getdate(); $currentm = $today['mon']; return $currentm; } //the function getcurrent_Y get the current year function getcurrent_Y() { $today = getdate(); $currenty = $today['year']; return $currenty; } //the function getcurrent_MON get the current month in words function getcurrent_MON() { $today = getdate(); $currentm = $today['month']; return $currentm; } //the function getcurrent_MON get the current month in words function getcurrent_weekday_word() { $today = getdate(); $currentm = $today['weekday']; return $currentm; } function getcurrent_weekday_number() { $today = getdate(); $currentm = $today['wday']; return $currentm; } function getdate_day_mon_date_year($date) { list($year,$mon,$day)=split("-",$date); $currentTimeStamp = strtotime("$year-$mon-$day"); $monthName = date("F", $currentTimeStamp); $dayName = date("l", $currentTimeStamp); $fullDay=$dayName." ".$monthName." ".$day.", ".$year; echo $fullDay; } function getdate_day_mon_date_year1($date,$time) { /*list($year,$mon,$day)=split("-",$date); $currentTimeStamp = strtotime("$year-$mon-$day"); $monthName = date("F", $currentTimeStamp); $dayName = date("l", $currentTimeStamp); //$fullDay=$dayName." ".$monthName." ".$day.", ".$year; $fullDay=$monthName." ".$day." ".$year." ".$time.";".$dayName; echo $fullDay;*/ list($year,$mon,$day)=split("-",$date); $currentTimeStamp = strtotime("$year-$mon-$day"); $monthName = date("F", $currentTimeStamp); $dayName = date("D", $currentTimeStamp); //$fullDay=$monthName." ".$day." ".$year." ".$time.";".$dayName; $fullDay=$dayName." ".$monthName." ".$day." ".$year." ".$time; echo $fullDay; } //the function is used to return the date in the format Jan 01, 2005 function newsdate($date) { list($year,$mon,$day)=split("-",$date); switch ($mon) { case 01: $month="Jan"; break; case 02: $month="Feb"; break; case 03: $month="Mar"; break; case 04: $month="Apr"; break; case 05: $month="May"; break; case 06: $month="Jun"; break; case 07: $month="Jul"; break; case 08: $month="Aug"; break; case 09: $month="Sep"; break; case 10: $month="Oct"; break; case 11: $month="Nov"; break; case 12: $month="Dec"; break; } $returndate=$month." ".$day.", ".$year; return $returndate; } /* the function uses sql date function date_add to add a value to a date and return the result the imp available formats are DAY, WEEKS, MONTHS, QUARTERS,YEAR*/ function date_add($startdate,$value,$format) { $this->dbobj->db_connect($this->db_host, $this->db_user, $this->db_pass, $this->db_name); $sql="SELECT DATE_ADD('".$startdate."',INTERVAL ".$value." ".$format.")"; $this->result=$this->dbobj->db_selectData($sql); if($this->dbobj->db_countRows($this->result)>0) { $this->row = $this->dbobj->db_fetchrows($this->result); $finaldate=$this->row[0]; $this->dbobj->db_close(); return $finaldate; } else { $this->dbobj->db_close(); return FALSE; } } function date_sub($startdate,$value,$format) { $this->dbobj->db_connect($this->db_host, $this->db_user, $this->db_pass, $this->db_name); $sql="SELECT DATE_SUB('".$startdate."',INTERVAL ".$value." ".$format.")"; $this->result=$this->dbobj->db_selectData($sql); if($this->dbobj->db_countRows($this->result)>0) { $this->row = $this->dbobj->db_fetchrows($this->result); $finaldate=$this->row[0]; $this->dbobj->db_close(); return $finaldate; } else { $this->dbobj->db_close(); return FALSE; } } }dbobj = new db($dbhost, $dbuser, $dbpass, $dbname); $this->dateobj = new CDate($dbhost, $dbuser, $dbpass, $dbname); $this->db_host = $dbhost; $this->db_user = $dbuser; $this->db_pass = $dbpass; $this->db_name = $dbname; } //funcion to automatically genarate agentcode function agentcode() { $this->dbobj->db_connect($this->db_host, $this->db_user, $this->db_pass, $this->db_name); $queryaid = "SELECT MAX(REPLACE(agent_code, 'A','')+1)AS AID FROM gw_agent"; $dbResult =$this->dbobj->db_selectData($queryaid); while($row =$this->dbobj->db_fetchrows($dbResult)) { $maxid = $row["AID"]; $l_maxid=strlen($maxid); if ($maxid=="") { $maxid="A0001"; } if(1==$l_maxid) { $maxid="A000".$maxid; } else if(2==$l_maxid) { $maxid="A00".$maxid; } else if(3==$l_maxid) { $maxid="A0".$maxid; } } return $maxid; } function makeTimestamp($date,$time) { $date1= $date; $time1=$time; $dateex1=explode("/",$date1); $timeex1=explode("-",$time1); $timeex2=explode(" ",$timeex1[1]); $timeex3=explode(":",$timeex2[0]); if($timeex2[1]=="PM") { $timeex4=$timeex3[0]+12; } else { $timeex4=$timeex3[0]; } $timestamp1=mktime($timeex4,$timeex3[1],0,$dateex1[0],$dateex1[1],$dateex1[2]); return $timestamp1; } function getCurrenttimestamp() { $today = getdate(); $temp=mktime($today['hours'],$today['minutes'],$today['seconds'],$today['mon'],$today['mday'],$today['year']); return $temp; } function message($code) { switch($code) { case 1:echo "Email id already exists"; break; case 2:echo "Your request has been processed successfully"; break; case 3:echo "Your request has been processed successfully"; break; case 4:echo "Uploaded image is not existing, please try again"; break; case 5:echo "Confirm password is not matching"; break; case 6:echo "Your profile has been updated successfully"; break; case 7:echo "MLS Number already existing"; break; case 8:echo "Town already existing"; break; case 9:echo "Invalid Username/Password"; break; case 10:echo "You are successfully logged out"."
"."Please use the login section provided at the top right to login again"; break; case 11:echo "You will receive an email when a new listing is added that match your requirements"; break; case 12:echo "Email address does not exist"; break; case 13:echo "There are no items to display"; break; case 14:echo "Your mail has been sent to the agent.
Thank you for using this facility."; break; case 15:echo "Your request has been processed successfully.
Thank you for using this facility."; break; case 16:echo "This property is already saved in your account."; break; case 17:echo "Your mail has been sent to your friend.
Thank you for using this facility."; break; case 18:echo "Language already existing."; break; case 19:echo "Your password has been sent to your Email Address."; break; case 20:echo "The CSV file upload successfully."; break; case 21:echo "Please upload correct csv file."; break; case 22:echo "Property ID not found."; break; } } function redirect($url) { echo ""; //echo ""; } function storeQuerystring($qs) { //$qs1=explode("id=",$qs); //$qs2=$qs1[1]; //$qs3=substr($qs2,10); $len_sp=strlen($qs); $sp=strpos($qs,"pageurl="); $sp1=substr($qs,$sp,$len_sp); $sp1=str_replace("pageurl=","",$sp1); $sp1pos=strpos($sp1,"&"); $sp2=substr($sp1,0,$sp1pos); $sp3=substr($sp1,$sp1pos+1,strlen($sp1)); $sp=$sp2."?".$sp3; $_SESSION["qs"]=$sp; //echo $_SESSION["qs"]; //exit; } function countryDisplay($id) { echo ""; } function getCountryname($code) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select name from countries where code='".$code."'"; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); return $row["name"]; } function getTime() { $time=array('1:00','1:30','2:00','2:30','3:00','3:30','4:00','4:30','5:00','5:30','6:00','6:30','7:00','7:30','8:00','8:30','9:00','9:30','10:00','10:30','11:00','11:30','12:00','12:30'); return $time; } function getTimeappointment() { $time=array('6:00 - 6:30AM','6:30 - 7:00AM','7:00 - 7:30AM','7:30 - 8:00AM','8:00 - 8:30AM','8:30 - 9:00AM','9:00 - 9:30AM','9:30 - 10:00AM','10:00 - 10:30AM','10:30 - 11:00AM','11:00 - 11:30AM','11:30 - 12:00PM','12:00 - 12:30PM','12:30 - 1:00PM','1:00 - 1:30PM','1:30 - 2:00PM','2:00 - 2:30PM','2:30 - 3:00PM','3:00 - 3:30PM','3:30 - 4:00PM','4:00 - 4:30PM','4:30 - 5:00PM','5:00 - 5:30PM','5:30 - 6:00PM','6:00 - 6:30PM','6:30 - 7:00PM','7:00 - 7:30PM','7:30 - 8:00PM','8:00 - 8:30PM','8:30 - 9:00PM','9:30 - 10:00PM'); return $time; } function getPrice1() { //$this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $price=array('50000','100000','150000','200000','250000','300000','350000','400000','450000','500000','600000','700000','800000','900000','1000000','1250000','1500000','1750000','2000000','2500000','3000000','3500000','4000000','4500000','5000000','6000000','7000000','8000000','9000000','10000000'); return $price; } function getpricetext() { $price=array('50,000','100,000','150,000','200,000','250,000','300,000','350,000','400,000','450,000','500,000','600,000','700,000','800,000','900,000','1,000,000','1,250,000','1,500,000','1,750,000','2,000,000','2,500,000','3,000,000','3,500,000','4,000,000','4,500,000','5,000,000','6,000,000','7,000,000','8,000,000','9,000,000','10,000,000'); return $price; } function getPricerental() { $price=array(); for($j=250,$i=0;$j<=5000;$i++) { $price[$i]=$j; $j+=250; } return $price; } function getTownsbysearch($town) { $t=explode(",",$town); $c=count($t); $new_twn=""; for($i=0;$i<$c;$i++) $new_twn.="'".$t[$i]."',"; //$twn=substr_replace($town, ' ',strlen($town)-1); //echo $new_twn; $str = str_replace("\\", "", $new_twn); $twn=substr_replace($str, ' ',strlen($str)-4); return $twn; } function cutdesc($str) { if(strlen($str)>100) { $str=substr($str,0,100); } return $str; } function generatedealcode($plength) { $random_id_length = $plength; //generate a random id encrypt it and store it in $rnd_id $rnd_id = crypt(uniqid(rand(),1)); //to remove any slashes that might have come $rnd_id = strip_tags(stripslashes($rnd_id)); //Removing any . or / and reversing the string $rnd_id = str_replace(".","",$rnd_id); $rnd_id = strrev(str_replace("/","",$rnd_id)); //finally I take the first 'length' characters from the $rnd_id $rnd_id = substr($rnd_id,0,$random_id_length); return "G".$rnd_id; } } ?> window.location.replace('invalidsession.php')"; //header("Location: invalidsession.php"); }*/ //mandatory symbol that is to be shown in data addition forms. $url=$_SERVER['SCRIPT_NAME']; $pos=strrpos($url,"/"); $url=substr($url,$pos+1); //echo $url;exit; if($url!="agentsearch.php" && $url!="agentview.php" && $url!="action/agent.php" && $url!="agent.php") { session_unregister("ASsql"); } $browsertitle="Goldwin"; $pageby=5; ?> dbobj = new db(); //$this->$dateobj=new CDate($dbhost, $dbuser, $dbpass, $dbname); $this->db_host = $dbhost; $this->db_user = $dbuser; $this->db_pass = $dbpass; $this->db_name = $dbname; $image1=""; $image2=""; $image3=""; $image4=""; $image5=""; $image6=""; $image7=""; $image8=""; $image9=""; } function setIndex($index) { $this->index=$index; } function setPage($page) { $this->page=$page; } function setPageurl($pageurl) { $this->pageurl=$pageurl; } function setPropertyid($propertyid) { $this->propertyid=$propertyid; } function setCsvmlsid($csvmlsid) { $this->csvmlsid=$csvmlsid; } function setMlsid($mlsid) { $this->mlsid=$mlsid; } function setContract($contract) { $this->contract=$contract; } function setContractagentid($contract_agent_id) { $this->contract_agent_id=$contract_agent_id; } function setAgentid1($agentid1) { $this->agentid1=$agentid1; } function setAgentid2($agentid2) { $this->agentid2=$agentid2; } function setAddress($address) { $this->address=$address; } function setCity($city) { $this->city=$city; } function setTown($town) { $this->town=$town; } function setState($state) { $this->state=$state; } function setCountry($country) { $this->country=$country; } function setCounty($county) { $this->county=$county; } function setZip($zip) { $this->zip=$zip; } function setPrice($price) { $this->price=$price; } function setTax($tax) { $this->tax=$tax; } function setType($typeid) { $this->typeid=$typeid; } function setStyle($styleid) { $this->styleid=$styleid; } function setYear($year) { $this->year=$year; } function setLot($lotsize) { $this->lotsize=$lotsize; } function setBedroom($numbed) { $this->numbed=$numbed; } function setBathfull($numbathfull) { $this->numbathfull=$numbathfull; } function setBathhalf($numbathhalf) { $this->numbathhalf=$numbathhalf; } function setHeating($heating) { $this->heating=$heating; } function setBasement($basement) { $this->basement=$basement; } function setGarage($garage) { $this->garage=$garage; } function setPool($pool) { $this->pool=$pool; } function setPet($pet) { $this->pet=$pet; } function setSchool($school) { $this->school=$school; } function setSmoking($smoking) { $this->smoking=$smoking; } function setMaintenance($maintenance) { $this->maintenance=$maintenance; } function setDescription($desc) { $this->desc=$desc; } function setDateadded($dateadded) { $this->dateadded=$dateadded; } function setImage1($image1) { $this->image1=$image1; } function setImage2($image2) { $this->image2=$image2; } function setImage3($image3) { $this->image3=$image3; } function setImage4($image4) { $this->image4=$image4; } function setImage5($image5) { $this->image5=$image5; } function setImage6($image6) { $this->image6=$image6; } function setImage7($image7) { $this->image7=$image7; } function setImage8($image8) { $this->image8=$image8; } function setImage9($image9) { $this->image9=$image9; } function setYourname($yourname) { $this->yourname=$yourname; } function setYouremail($youremail) { $this->youremail=$youremail; } function setFriendname($friendname) { $this->friendname=$friendname; } function setFriendemail($friendemail) { $this->friendemail=$friendemail; } function setYourmsg($yourmsg) { $this->yourmsg=$yourmsg; } function setUrl($url) { $this->url=$url; } function setOpendateset($opendateset) { $this->opendateset=$opendateset; } function setOpenTimeset($opentimeset) { $this->opentimeset=$opentimeset; } function setOncontract($oncontract) { $this->oncontract=$oncontract; } function setOnclose($onclose) { $this->onclose=$onclose; } /////////////////////// function getPageurl() { return $this->pageurl; } function getIndex() { return $this->index; } function getPage() { return $this->page; } function getPropertyid() { return $this->propertyid; } function getCsvmlsid() { return $this->csvmlsid; } function getMlsid() { return $this->mlsid; } function getContractagentid() { return $this->contract_agent_id; } function getAgentid1() { return $this->agentid1; } function getAgentid2() { return $this->agentid2; } function getAddress() { return $this->address; } function getCity() { return $this->city; } function getContract() { return $this->contract; } function getTown() { return $this->town; } function getState() { return $this->state; } function getCountry() { return $this->country; } function getCounty() { return $this->county; } function getZip() { return $this->zip; } function getPrice() { return $this->price; } function getTax() { return $this->tax; } function getType() { return $this->typeid; } function getStyle() { return $this->styleid; } function getYear() { return $this->year; } function getLot() { return $this->lotsize; } function getBedroom() { return $this->numbed; } function getBathfull() { return $this->numbathfull; } function getBathhalf() { return $this->numbathhalf; } function getHeating() { return $this->heating; } function getBasement() { return $this->basement; } function getGarage() { return $this->garage; } function getPool() { return $this->pool; } function getPet() { return $this->pet; } function getSchool() { return $this->school; } function getSmoking() { return $this->smoking; } function getMaintenance() { return $this->maintenance; } function getDescription() { return $this->desc; } function getDateadded() { return $this->dateadded; } function getImage1() { return $this->image1; } function getImage2() { return $this->image2; } function getImage3() { return $this->image3; } function getImage4() { return $this->image4; } function getImage5() { return $this->image5; } function getImage6() { return $this->image6; } function getImage7() { return $this->image7; } function getImage8() { return $this->image8; } function getImage9() { return $this->image9; } function getYourname() { return $this->yourname; } function getYouremail() { return $this->youremail; } function getFriendname() { return $this->friendname; } function getFriendemail() { return $this->friendemail; } function getYourmsg() { return $this->yourmsg; } function getUrl() { return $this->url; } function getOpendateset() { return $this->opendateset; } function getOpenTimeset() { return $this->opentimeset; } function getOncontract() { return $this->oncontract; } function getOnclose() { return $this->onclose; } function checkImage($size) { if($size>0) return true; else return false; } function mailList() { $from = $this->youremail; $to=$this->friendemail; #-- form fields-- $smtpval = "localhost"; ini_set("SMTP",$smtpval); ini_set("sendmail_from",$from); #headers-------- $subject = "Property Details"; $headers = "From: $from \n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1\r\n"; $message="Property Details"; $message.=""; $message.=""; if($this->getYourmsg()!="") { $message.=""; } $message.=""; $message.="".""; $message.=""; $message.=""; $message.="
"; $message.="Sender "."".$this->getYourname(); $message.="
"; $message.="Message "."".$this->getYourmsg(); $message.="
"; $message.="Property Details"; $message.="
"; $message.="MLS code "."".$this->getMlsid(); $message.=""; $message.="Town "."".$this->getTown(); $message.="
"; $message.="State "."".$this->getState(); $message.=""; $message.="County "."".$this->getCounty(); $message.="
"; $message.="Price "."$".$this->getPrice(); $message.=""; $message.="Type "."".$this->getPropertytype($this->getType()); $message.="
"; $message.="Year "."".$this->getYear(); $message.=""; $message.="Lot Size "."".$this->getLot(); $message.="
"; $message.="Bedroom "."".$this->getBedroom(); $message.=""; $message.="Bathroom "."".$this->getBathfull(); $message.="
"; $message.="For more details about this property please click the link below"; $message.="
"; $message.="".$this->getUrl().""; $message.="
"; $message.=""; mail($to, $subject, $message,$headers); } //Function for returning all the values of a particular property from gw_property_location to view product page. function getPropertylocation() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_property_location where property_id='".$this->getPropertyid()."' "; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); $this->setPropertyid($row["property_id"]); $this->setAddress($row["address"]); //$this->setCity($row["city"]); $this->setTown($row["town"]); $this->setState($row["state"]); $this->setCounty($row["county"]); $this->setZip($row["zip"]); } //Function for returning all the values of a particular propertyin to view product page function getProperty() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_property where MLS_id='".$this->getMlsid()."' "; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); $this->setPropertyid($row["property_id"]); $this->setMlsid($row["MLS_id"]); $this->setAgentid1($row["agent_id"]); $this->setPrice($row["price"]); $this->setTax($row["taxes"]); $this->setType($row["type_id"]); $this->setStyle($row["style_id"]); $this->setYear($row["year_built"]); $this->setLot($row["lot_size"]); $this->setBedroom($row["num_bed"]); $this->setBathfull($row["num_bath_ful"]); $this->setBathhalf($row["num_bath_half"]); $this->setContract($row["contract"]); $this->setGarage($row["garage"]); $this->setHeating($row["heating"]); $this->setBasement($row["basement"]); $this->setPool($row["pool"]); $this->setPet($row["pet"]); $this->setSchool($row["school"]); $this->setSmoking($row["smoking"]); $this->setMaintenance($row["maintanence"]); $this->setDescription($row["description"]); $this->setDateadded($row["date_added"]); $this->setImage1($row["image1_url"]); $this->setImage2($row["image2_url"]); $this->setImage3($row["image3_url"]); $this->setImage4($row["image4_url"]); $this->setImage5($row["image5_url"]); $this->setImage6($row["image6_url"]); $this->setImage7($row["image7_url"]); $this->setImage8($row["image8_url"]); $this->setImage9($row["image9_url"]); $this->setOncontract($row["contract"]); $this->setOnclose($row["close"]); } //Function for finding a particular state name using it's id function getStatename($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select state_long from gw_states where state_id=".$id." "; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); $this->dbobj->db_close(); return $row["state_long"]; } function getStateshort($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select state_short from gw_states where state_id=".$id." "; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); $this->dbobj->db_close(); return $row["state_short"]; } //Function for finding a particular country name using it's code. function getCountryname($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select name from countries where code='".$id."' "; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); $this->dbobj->db_close(); return $row["name"]; } //Function returns property type name function getPropertytype($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select type_name from gw_property_type where type_id=".$id." "; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); $this->dbobj->db_close(); return $row["type_name"]; } function getMlsidFromid($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select MLS_id from gw_property where property_id=".$id." "; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); $this->dbobj->db_close(); return $row["MLS_id"]; } //Function returns property style name function getPropertystyle($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select style_name from gw_property_style where style_id=".$id." "; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); $this->dbobj->db_close(); return $row["style_name"]; } // Function returns Agent name function getAgentname($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select CONCAT(CONCAT(first_name,' '),last_name) AS Name from gw_agent where agent_id=".$id." "; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); $this->dbobj->db_close(); return $row["Name"]; } function getInsertid() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select max(property_id) from gw_property"; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); return $row[0]; $this->dbobj->db_close(); //return $this->dbobj->db_lastID(); } //Function for checking MLS id if exists or not function checkMLS() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); if(isset($this->propertyid)) { $sql="select * from gw_property where MLS_id='".$this->mlsid."' and property_id <>'".$this->propertyid."' "; } else { $sql="select * from gw_property where MLS_id=".$this->mlsid; } $res=$this->dbobj->db_selectData($sql); //$c=0; //while($row=$this->dbobj->db_countRows($res)) //{ //$c++; //} $cnt=$this->dbobj->db_countRows($res); $this->dbobj->db_close(); //echo $c;echo $sql;exit; return $cnt; } //Function for making a dummy form to return all the values of a product function mlsExists($action,$msgcode) { echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; //echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; return 1; } //Function add location details in to gw_property_location table. function addPropertylocation() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select property_id from gw_property where MLS_id='".$this->mlsid."' "; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); $sql1="insert into gw_property_location(property_id,address,town,state,county,zip) values('".$row["property_id"]."','".$this->address."','".$this->town."','".$this->state."','".$this->county."','".$this->zip."') "; $this->dbobj->db_insertData($sql1); $this->dbobj->db_close(); } //Function update location details in to gw_property_location table. function updatePropertylocation() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_property_location set address='".$this->address."',town='".$this->town."',state='".$this->state."',county='".$this->county."',zip='".$this->zip."' where property_id=".$this->propertyid; $this->dbobj->db_updateData($sql); $this->dbobj->db_close(); } //Function add property data in to database function addProperty() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); if($this->agentid2!="") { $agentid=$this->agentid1.":".$this->agentid2; } else { $agentid=$this->agentid1; } $sql="insert into gw_property(MLS_id,agent_id,price,taxes,type_id,style_id,year_built,lot_size,num_bed,num_bath_ful,num_bath_half,heating,basement,garage,pool,pet,school,smoking,maintanence,description,date_added,image1_url,image2_url,image3_url,image4_url,image5_url,image6_url,image7_url,image8_url,image9_url)"; $sql.=" values ('".$this->mlsid."','".$agentid."',".$this->price.",".$this->tax.",".$this->typeid.",".$this->styleid.",'".$this->year."','".$this->lotsize."',"; $sql.=$this->numbed.",".$this->numbathfull.",".$this->numbathhalf.",'".$this->heating."','".$this->basement."','".$this->garage."','"; $sql.=$this->pool."','".$this->pet."','".$this->school."','".$this->smoking."','".$this->maintenance."','".$this->desc."','"; $sql.=$this->dateadded."','".$this->image1."','".$this->image2."','".$this->image3."','".$this->image4."','".$this->image5."','"; $sql.=$this->image6."','".$this->image7."','".$this->image8."','".$this->image9."')"; $this->dbobj->db_insertData($sql); //echo $sql; $this->dbobj->db_close(); } //Function update property data in to database function updateProperty() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); if($this->agentid2!="") { $agentid=$this->agentid1.":".$this->agentid2; } else { $agentid=$this->agentid1; } $sql="update gw_property set MLS_id='".$this->mlsid."',agent_id='".$agentid."',price='".$this->price."',taxes='".$this->tax."',"; $sql.="type_id='".$this->typeid."',style_id='".$this->styleid."',year_built='".$this->year."',lot_size='".$this->lotsize."',"; $sql.="num_bed='".$this->numbed."',num_bath_ful='".$this->numbathfull."',num_bath_half='".$this->numbathhalf."',heating='".$this->heating."',"; $sql.="basement='".$this->basement."',garage='".$this->garage."',pool='".$this->pool."',pet='".$this->pet."',school='".$this->school."',"; $sql.="smoking='".$this->smoking."',maintanence='".$this->maintenance."',description='".$this->desc."',date_added='".$this->dateadded."',"; $sql.="image1_url='".$this->getImage1()."',image2_url='".$this->getImage2()."',image3_url='".$this->getImage3()."',image4_url='".$this->getImage4()."',image5_url='".$this->getImage5()."',image6_url='".$this->getImage6()."',image7_url='".$this->getImage7()."',image8_url='".$this->getImage8()."',image9_url='".$this->getImage9()."' where property_id=".$this->propertyid; $this->dbobj->db_updateData($sql); $this->dbobj->db_close(); } function getAgentimage($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_agent where agent_id='".$id."' "; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); return $row["image_url1"]; } function updateImage() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_property set image1_url='".$this->getImage1()."',image2_url='".$this->getImage2()."',image3_url='".$this->getImage3()."',image4_url='".$this->getImage4()."',image5_url='".$this->getImage5()."',image6_url='".$this->getImage6()."',image7_url='".$this->getImage7()."',image8_url='".$this->getImage8()."',image9_url='".$this->getImage9()."' where MLS_id=".$this->getMlsid(); //echo $sql; $this->dbobj->db_updateData($sql); $this->dbobj->db_close(); } //Function for making distinct image name using timestamp function getImagename($url,$id,$num) { //echo "
";echo $url;echo $id; echo $num; list($name,$extn)=explode(".",$url); $imageurl="property_".$id.$num.".".$extn; //$imageurl="$name".time().".".$extn; //$imageurl="fff"; return $imageurl; } //Function displaying state name function stateDisplay($id,$frm) { echo ""; } ///////////////////////////////////////////////////// //Function displaying country name function countryDisplay($id,$frm) { echo ""; } function agentDisplay($id,$name) { //echo $id; echo ""; } //Function deletes data from gw_property_location and gw_property. function deleteProperty($propertyid) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql3="select * from gw_property where property_id =".$propertyid; $result=$this->dbobj->db_selectData($sql3); $row=$this->dbobj->db_fetchrows($result); for($i=23;$i<=28;++$i) { //$imgurl="image".$i."_url"; //echo $imgurl; $path=$row[$i]; @unlink("../../property_image/".$path); } //echo $_SERVER['SCRIPT_NAME']; //exit; $sqldel="delete from gw_saved_listing where mls_id=".$row["MLS_id"].""; $this->dbobj->db_deleteData($sqldel); $sql1="delete from gw_property_location where property_id=".$propertyid." "; $this->dbobj->db_deleteData($sql1); $sql="delete from gw_property where property_id=".$propertyid." "; $this->dbobj->db_deleteData($sql); $this->dbobj->db_close(); } function contractProperty($propertyid) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql1="update gw_property set contract=1 where property_id=".$propertyid; $this->dbobj->db_updateData($sql1); $this->dbobj->db_close(); } function contractPropertyopen($propertyid) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_property set contract=0 where property_id =".$propertyid; $result=$this->dbobj->db_updateData($sql); $this->dbobj->db_close(); } function closeProperty($propertyid) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); //$date = $this->dateobj->getdate_yyyy_mm_dd(); $sql="update gw_property set close=1,date_close='".$this->dateadded."' where property_id =".$propertyid; $result=$this->dbobj->db_updateData($sql); $this->dbobj->db_close(); } function openProperty($propertyid) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); //$date = $this->dateobj->getdate_yyyy_mm_dd(); $sql="update gw_property set close=0,date_close='".$this->dateadded."' where property_id =".$propertyid; $result=$this->dbobj->db_updateData($sql); $this->dbobj->db_close(); } ///////////////////////////////////////////////////// function propertytypeDisplay($id,$frmname) { //echo $id; echo ""; } ////////////////////////////////////////////////////////////////// function propertystyleDisplay($id) { //echo $id; echo ""; } function saveListing() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sqlid="select user_id from gw_user where email_address='".$_SESSION["uname"]."' "; $result=$this->dbobj->db_selectData($sqlid); $row=$this->dbobj->db_fetchrows($result); $sql="insert into gw_saved_listing(mls_id,user_id,type) values(".$this->mlsid.",'".$row["user_id"]."','0')"; $this->dbobj->db_insertData($sql); $this->dbobj->db_close(); } function setUnfeatured() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_property set featured=0 where property_id=".$this->getPropertyid(); //echo $sql;exit; $this->dbobj->db_updateData($sql); $this->dbobj->db_close(); } function setUnfeaturedcsv() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_csv set featured=0 where MLS_id=".$this->getCsvmlsid(); $sql1="delete from gw_featured_property where mls_id=".$this->getCsvmlsid(); //echo $sql;exit; $this->dbobj->db_updateData($sql); $this->dbobj->db_updateData($sql1); $this->dbobj->db_close(); } function setFeaturedcsv() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_csv set featured=1 where MLS_id=".$this->getCsvmlsid(); $sql1="insert into gw_featured_property(mls_id) values(".$this->getCsvmlsid().")"; $this->dbobj->db_updateData($sql); $this->dbobj->db_insertData($sql1); $this->dbobj->db_close(); } function setClose() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_csv set closed=1 where MLS_id=".$this->getCsvmlsid(); $this->dbobj->db_updateData($sql); $sqlinsert="insert into gw_mlsclose (agent_id,mlsid) values(".$this->getAgentid1().",".$this->getCsvmlsid().")"; //echo $sqlinsert;exit; $this->dbobj->db_insertData($sqlinsert); $this->dbobj->db_close(); } function setOpen() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_csv set closed=0 where MLS_id=".$this->getCsvmlsid(); $this->dbobj->db_updateData($sql); $sqldel="delete from gw_mlsclose where mlsid=".$this->getCsvmlsid()." "; $this->dbobj->db_deleteData($sqldel); $this->dbobj->db_close(); } function countRow() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_property"; //echo $sql;exit; $result=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($result); $this->dbobj->db_close(); return $count; } function setFeatured() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); /*$size=sizeof($_SESSION["featured_property"]); for($i=0;$i<$size;++$i) { if(is_numeric($_SESSION["featured_property"][$i])) {*/ $sql="update gw_property set featured=1 where property_id=".$this->getPropertyid(); $this->dbobj->db_updateData($sql); //} //echo "
".$_SESSION["featured"][$i]; //} //exit; //echo $sql;exit; //session_unregister("featured_property"); $this->dbobj->db_close(); } function setSessionfeatured() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select property_id from gw_property where featured=1"; //echo $sql; $res=$this->dbobj->db_selectData($sql); if(isset($_SESSION["featured_property"])) { //unset("featured_property"); echo "gggggggg"; session_unregister("featured_property"); } //session_register("featured_property"); $i=0; while($row=$this->dbobj->db_fetchrows($res)) { $_SESSION["featured_property"][$i]=$row["property_id"]; ++$i; echo $row["property_id"]."
".$i; } echo(sizeof($_SESSION["featured_property"])); print_r($_SESSION["featured_property"]); } ///////////////////////////////////// CLIENT SIDE STARTS HERE //////////////////////////////// function getFeaturedpropertiesid() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select MLS_id from gw_property where featured=1"; $res=$this->dbobj->db_selectData($sql); $i=0; while($row=$this->dbobj->db_fetchrows($res)) { $this->feturedpro[$i]=$row["MLS_id"]; $i++; } $this->dbobj->db_close(); } function getPropertyTown($county) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); /*if($county=="0") { $sql="select distinct(town) from gw_csv "; } else $sql="select distinct(town) from gw_csv where county='".$county."'"; $res=$this->dbobj->db_selectData($sql); $i=0; $town1=array(); while($row1=$this->dbobj->db_fetchrows($res)) { $town1[$i]=$row1["town"]; $i++; } */ if($county=="All") { $sql1="select distinct(town) from gw_csv ORDER BY town"; $res1=$this->dbobj->db_selectData($sql1); $i=0; while($row2=$this->dbobj->db_fetchrows($res1)) { $town2[$i]=$row2["town"]; $i++; } //array_push($town2,"Other City"); } else if($county=="Other") { $town2=array(); array_push($town2,"Other City"); } else { $sql1="select distinct(town) from gw_csv where county='".$county."' ORDER BY town"; $res1=$this->dbobj->db_selectData($sql1); $town2=array(); $i=0; while($row2=$this->dbobj->db_fetchrows($res1)) { $town2[$i]=$row2["town"]; $i++; } array_push($town2,"Other City"); } //print_r($town1);echo "
"; //print_r($town2);echo "
"; //$town=array_merge($town1,$town2); //array_unique($town); return $town2; $this->dbobj->db_close(); } function getZipcodes($county) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); if($county===0) { $sql1="select distinct(zip) from gw_csv ORDER BY zip"; } else { $sql1="select distinct(zip) from gw_csv where county='".$county."' ORDER BY zip"; } $res1=$this->dbobj->db_selectData($sql1); $zip2=array(); $i=0; while($row2=$this->dbobj->db_fetchrows($res1)) { $zip2[$i]=$row2["zip"]; $i++; } array_push($zip2,"Other Zip"); return $zip2; $this->dbobj->db_close(); } function getpropertyTypes() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $type=array(); $sql="select type_id,type_name from gw_property_type"; $res=$this->dbobj->db_selectData($sql); while($row=$this->dbobj->db_fetchrows($res)) { $type[$row["type_name"]]=$row["type_id"]; } return $type; $this->dbobj->db_close(); } function getBathrooms() { $broom=array();$j=0; for($i=0;$i<21;++$i) { $broom[$i]=$j; $j+=0.5; } return $broom; } function getBedrooms() { $broom=array();$j=1; for($i=0;$i<10;++$i) { $broom[$i]=$j; $j+=1; } return $broom; } function getprices() { $broom=array(); $p=2000;$k=5; for($j=1,$i=$p;$j<=15;++$j) { $broom[$j-1]=$i; if($j%$k==0) { $p=$i; $i+=$p; //$k--; //$p=$i; } else { $i+=$p; } } return $broom; } function getCounties() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select distinct(county) from gw_csv ORDER BY county"; $county=array(); $i=0; $res=$this->dbobj->db_selectData($sql); while($row=$this->dbobj->db_fetchrows($res)) { $county[$i]=$row["county"]; $i++; } /* $sql1="select distinct(county) from gw_csv where gw_csv.county<>''"; $county=array(); $res1=$this->dbobj->db_selectData($sql1); while($row1=$this->dbobj->db_fetchrows($res1)) { if((in_array($row1["county"],$county))==false) { $county[$i]=$row1["county"]; $i++; } } */ if((in_array("brooklyn",$county))==false) { array_push($county,"Brooklyn"); } if((in_array("manhattan",$county))==false) { array_push($county,"Manhattan"); } if((in_array("bronx",$county))==false) { array_push($county,"Bronx"); } if((in_array("staten",$county))==false) { array_push($county,"Staten Island"); } //print_r($county); sort($county); return $county; $this->dbobj->db_close(); } function getAllmlsid($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select mlsid from gw_mlsclose where closed_agent_id=".$id." and close=1"; $res=$this->dbobj->db_selectData($sql); $csvid=array(); $i=0; while($row=$this->dbobj->db_fetchrows($res)) { $csvid[$i]=$row["mlsid"]; ++$i; } return $csvid; } function getPropertyids($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select property_id,agent_id from gw_property"; $res=$this->dbobj->db_selectData($sql); //$count=$this->dbobj->db_countRows($res); //if($count!=0) //{ $i=0; $propertyids=array(); $j=0; while($row=$this->dbobj->db_fetchrows($res)) { $agid=$row["agent_id"]; $agids=explode(":",$agid); if(in_array($id,$agids)) { $propertyids[$j]=$row["property_id"]; $j++; } $i++; } $pid=""; foreach($propertyids as $value) { $pid.=$value.","; } $len=strlen($pid);echo "
"; if($len>0) { $newpid=substr($pid,0,$len-1); $pid=$newpid; } else $pid=0; return $pid; $this->dbobj->db_close(); } function getPropertyidbysearch($county,$town,$bath,$bed,$price1,$price2,$type) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); if(isset($_POST["hidsts"])&&$_POST["hidsts"]=="advsearch") { $sql1="SELECT gw_property.property_id AS pid, gw_property.MLS_id AS mlsid, gw_property.price AS price, 'PROP' AS temp FROM gw_property INNER JOIN gw_property_location ON gw_property.property_id = "; $sql1.="gw_property_location.property_id INNER JOIN gw_property_type ON gw_property.type_id = gw_property_type.type_id "; $sql1.="WHERE gw_property_location.town IN ($town) AND (gw_property.price BETWEEN ".$price1." AND ".$price2.") AND gw_property.close=0 AND gw_property.contract=0 "; if($bath!="ANY") { $sql1.=" AND gw_property.num_bath_ful >= ".$bath." "; } if($bed!="ANY") { $sql1.=" AND gw_property.num_bed >= ".$bed." "; } if($type!="") { if($type!="Condo/CO-OP") { $sql1.=" AND gw_property_type.type_name LIKE '".$type."%' "; } else { $sql1.=" AND (gw_property_type.type_name='Condo' OR gw_property_type.type_name='CO-OP') "; } } $sql1.=" " ; } else if(isset($_POST["hidtown"])) { if($_POST["hidtype"]!="Comercial") { $sql1="SELECT gw_property.property_id AS pid, gw_property.MLS_id AS mlsid, gw_property.price AS price, 'PROP' AS temp FROM gw_property INNER JOIN gw_property_location ON gw_property.property_id = "; $sql1.="gw_property_location.property_id INNER JOIN gw_property_type ON gw_property.type_id = gw_property_type.type_id "; $sql1.="WHERE town IN ($town) AND gw_property_type.type_name LIKE '%".$_POST["hidtype"]."%' AND gw_property.num_bath_ful >= ".$bath." AND gw_property.num_bed >= ".$bed." AND (price BETWEEN ".$price1." AND ".$price2.") AND gw_property.close=0 AND gw_property.contract=0 " ; } else { $sql1="SELECT gw_property.property_id AS pid, gw_property.MLS_id AS mlsid, gw_property.price AS price, 'PROP' AS temp FROM gw_property INNER JOIN gw_property_location ON gw_property.property_id = "; $sql1.="gw_property_location.property_id INNER JOIN gw_property_type ON gw_property.type_id = gw_property_type.type_id "; $sql1.="WHERE town IN ($town) AND gw_property_type.type_name LIKE '%".$_POST["hidtype"]."%' AND (price BETWEEN ".$price1." AND ".$price2.") AND gw_property.close=0 AND gw_property.contract=0 " ; } } else if(isset($_POST["cmbprice1"])) { require_once("sessionremove.php"); $sql1="SELECT gw_property.property_id AS pid, gw_property.MLS_id AS mlsid, gw_property.price AS price, 'PROP' AS temp FROM gw_property INNER JOIN gw_property_location ON gw_property.property_id = "; $sql1.=" gw_property_location.property_id INNER JOIN gw_property_type ON gw_property.type_id = gw_property_type.type_id WHERE town like '%".$town."%' AND gw_property_type.type_name LIKE '%home%' AND price BETWEEN '".$price1."' AND '".$price2."' AND gw_property.close=0 AND gw_property.contract=0"." " ; } return $sql1; } function getcsvidbysearch($county,$town,$bath,$bed,$price1,$price2,$type,$sql) { $sql1=$sql." UNION ALL "; if(isset($_POST["hidsts"])&&$_POST["hidsts"]=="advsearch") { $sql1.="SELECT gw_csv.csv_id AS pid, gw_csv.MLS_id AS mlsid, gw_csv.price AS price, ' MLS' AS temp FROM gw_csv LEFT JOIN gw_mlsclose ON gw_csv.MLS_id = gw_mlsclose.mlsid WHERE gw_csv.town IN ($town) AND (gw_csv.price BETWEEN ".$price1." AND ".$price2.") AND gw_csv.closed=0 AND gw_csv.contract=0" ; if($bath!="ANY") { $sql1.=" AND gw_csv.num_bath_ful >= ".$bath." "; } if($type!="") { if(($type=="Single Family") || ($type=="Multi Family")) { $sql1.=" AND gw_csv.type ='Residential' "; } else if($type=="Condo/CO-OP") { $sql1.=" AND (gw_csv.type='Condo' OR gw_csv.type='CO-OP')"; } else if($type=="Commercial") { $sql1.=" AND gw_csv.type='Commercial' "; } else if($type=="Land") { $sql1.=" AND gw_csv.type='Land' "; } } if($bed!="ANY") { $sql1.=" AND gw_csv.num_bed >= ".$bed." "; } $sql1.=" ORDER BY price" ; //$_SESSION["csvlistsql"]=$sql1; } else if(isset($_POST["hidtype"])) { if($_POST["hidtype"]=="home") { $type="Residential"; } else if($_POST["hidtype"]=="Rentals") { $type="Rental"; } else $type="Commercial"; if($type!="Commercial") { $sql1.="SELECT gw_csv.csv_id AS pid, gw_csv.MLS_id AS mlsid, gw_csv.price AS price, ' MLS' AS temp FROM gw_csv LEFT JOIN gw_mlsclose ON gw_csv.MLS_id = gw_mlsclose.mlsid where gw_csv.type='".$type."' AND gw_csv.town IN ($town) AND gw_csv.num_bath_ful >= ".$bath." AND gw_csv.num_bed >= ".$bed." AND (gw_csv.price BETWEEN ".$price1." AND ".$price2.") AND gw_csv.closed=0 AND gw_csv.contract=0 ORDER BY price" ; } else $sql1.="SELECT gw_csv.csv_id AS pid, gw_csv.MLS_id AS mlsid, gw_csv.price AS price, ' MLS' AS temp FROM gw_csv LEFT JOIN gw_mlsclose ON gw_csv.MLS_id = gw_mlsclose.mlsid where gw_csv.type='".$type."' AND gw_csv.town IN ($town) AND (gw_csv.price BETWEEN ".$price1." AND ".$price2.") AND gw_csv.closed=0 AND gw_csv.contract=0 ORDER BY price" ; //$_SESSION["csvlistsql"]=$sql1; } else if(isset($_POST["cmbprice1"])) { $sql1.="SELECT gw_csv.csv_id AS pid, gw_csv.MLS_id AS mlsid, gw_csv.price AS price, ' MLS' AS temp FROM gw_csv LEFT JOIN gw_mlsclose ON gw_csv.MLS_id = gw_mlsclose.mlsid where gw_csv.town ='".$town."' AND gw_csv.type='Residential' AND (gw_csv.price BETWEEN '".$price1."' AND '".$price2."')"." AND gw_csv.closed=0 AND gw_csv.contract=0 ORDER BY price" ; //$_SESSION["csvlistsql"]=$sql1; } else if(isset($_SESSION["sqlcsv"])) { $sql1=$_SESSION["sqlcsv"]; } //echo $sql1; $_SESSION["sqlcsv"]=$sql1; return $sql1; } function getPropertyisfrommls() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql1="SELECT property_id FROM gw_property where MLS_id ='".$this->mlsid."'"; $res=$this->dbobj->db_selectData($sql1); $row=$this->dbobj->db_fetchrows($res); return $row["property_id"]; $this->dbobj->db_close(); } function checkSavedlisting($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sqlid="select user_id from gw_user where email_address='".$_SESSION["uname"]."' "; $result=$this->dbobj->db_selectData($sqlid); $row=$this->dbobj->db_fetchrows($result); $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_saved_listing where mls_id=".$id." and user_id=".$row["user_id"]." and type=0"; $res=$this->dbobj->db_selectData($sql); $cnt=$this->dbobj->db_countRows($res); $this->dbobj->db_close(); return $cnt; } function getResidential($pids) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="SELECT gw_property.property_id, gw_property_location.town,gw_property_style.style_name,gw_property.num_bath_ful,gw_property.lot_size,gw_property.contract FROM gw_property INNER JOIN gw_property_location ON gw_property.property_id = gw_property_location.property_id INNER JOIN gw_property_style ON gw_property.style_id = gw_property_style.style_id INNER JOIN gw_property_type ON gw_property.type_id = gw_property_type.type_id WHERE gw_property.property_id in($pids) and (gw_property_type.type_name='Single Family Home' OR gw_property_type.type_name='Multi Family Home' OR gw_property_type.type_name='Mobile Home' OR gw_property_type.type_name='CO-OP' OR gw_property_type.type_name='Condo') AND gw_property.close=0 ORDER BY gw_property_location.town"; $res=$this->dbobj->db_selectData($sql); $i=0; $resident=array(); while($row=$this->dbobj->db_fetchrows($res)) { $resident[$i]=$row["property_id"]; $i++; } return $resident; $this->dbobj->db_close(); } function getRentals($pids) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="SELECT gw_property.property_id, gw_property_location.town,gw_property_style.style_name,gw_property.num_bath_ful,gw_property.lot_size FROM gw_property INNER JOIN gw_property_location ON gw_property.property_id = gw_property_location.property_id INNER JOIN gw_property_style ON gw_property.style_id = gw_property_style.style_id INNER JOIN gw_property_type ON gw_property.type_id = gw_property_type.type_id WHERE gw_property.property_id in($pids) and (gw_property_type.type_name='Rentals') AND gw_property.close=0 ORDER BY gw_property_location.town"; $res=$this->dbobj->db_selectData($sql); $i=0; $rental=array(); while($row=$this->dbobj->db_fetchrows($res)) { $rental[$i]=$row["property_id"]; $i++; } return $rental; $this->dbobj->db_close(); } function getCommercial($pids) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="SELECT gw_property.property_id, gw_property_location.town,gw_property_style.style_name,gw_property.lot_size FROM gw_property INNER JOIN gw_property_location ON gw_property.property_id = gw_property_location.property_id INNER JOIN gw_property_style ON gw_property.style_id = gw_property_style.style_id INNER JOIN gw_property_type ON gw_property.type_id = gw_property_type.type_id WHERE gw_property.property_id in($pids) and (gw_property_type.type_name='Comercial') AND gw_property.close=0 ORDER BY gw_property_location.town"; $res=$this->dbobj->db_selectData($sql); $i=0; $commercial=array(); while($row=$this->dbobj->db_fetchrows($res)) { $commercial[$i]=$row["property_id"]; $i++; } return $commercial; $this->dbobj->db_close(); } function getOthers($pids) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="SELECT gw_property.property_id, gw_property_location.town,gw_property_style.style_name,gw_property.num_bath_ful,gw_property.lot_size FROM gw_property INNER JOIN gw_property_location ON gw_property.property_id = gw_property_location.property_id INNER JOIN gw_property_style ON gw_property.style_id = gw_property_style.style_id INNER JOIN gw_property_type ON gw_property.type_id = gw_property_type.type_id WHERE gw_property.property_id in($pids) and (gw_property_type.type_name='Land' OR gw_property_type.type_name='Farms' OR gw_property_type.type_name='Others') AND gw_property.close=0 ORDER BY gw_property_location.town"; $res=$this->dbobj->db_selectData($sql); $i=0; $others=array(); while($row=$this->dbobj->db_fetchrows($res)) { $others[$i]=$row["property_id"]; $i++; } return $others; $this->dbobj->db_close(); } function getRecentlysold($pids) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="SELECT gw_property.property_id, gw_property_location.town,gw_property_style.style_name,gw_property.num_bath_ful FROM gw_property INNER JOIN gw_property_location ON gw_property.property_id = gw_property_location.property_id INNER JOIN gw_property_style ON gw_property.style_id = gw_property_style.style_id WHERE gw_property.property_id in($pids) and gw_property.close=1"; $res=$this->dbobj->db_selectData($sql); $i=0; $recent=array(); while($row=$this->dbobj->db_fetchrows($res)) { $recent[$i]=$row["property_id"]; $i++; } return $recent; $this->dbobj->db_close(); } function getClosedMls($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="SELECT gw_mlsclose.mlsid from gw_mlsclose where closed_agent_id=".$id." AND close=1"; $res=$this->dbobj->db_selectData($sql); $i=0; $closed=array(); while($row=$this->dbobj->db_fetchrows($res)) { $closed[$i]=$row["mlsid"]; $i++; } return $closed; $this->dbobj->db_close(); } function getContractMls($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="SELECT gw_mlsclose.mlsid from gw_mlsclose where contract_agent_id=".$id." AND contract=1"; $res=$this->dbobj->db_selectData($sql); $i=0; $contract=array(); while($row=$this->dbobj->db_fetchrows($res)) { $contract[$i]=$row["mlsid"]; $i++; } return $contract; $this->dbobj->db_close(); } function checkPropertyidexists($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_property where MLS_id=".$id." "; $res=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($res); return $count; } function checkOpenhouse($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_open_houses where property_id=".$id." "; $res=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($res); $this->dbobj->db_close(); return $count; } function getOpendetails($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select date_format(date_set, '%m/%d/%Y' ) AS date_set,time_set from gw_open_houses where property_id=".$id." "; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); $this->setOpendateset($row["date_set"]); $this->setOpentimeset($row["time_set"]); $this->dbobj->db_close(); } function checkOpenhouse1($pid) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_open_houses where property_id=".$pid." "; $res=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($res); $this->dbobj->db_close(); return $count; } function getOpenhousedata($pid) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_open_houses where property_id=".$pid." "; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); //print_r ($row);exit; $this->dbobj->db_close(); return $row; } function getContractcsv($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select mlsid from gw_mlsclose where contract_agent_id=".$id." and contract=1 and close=0"; $res=$this->dbobj->db_selectData($sql); $csvid=array(); $i=0; while($row=$this->dbobj->db_fetchrows($res)) { $csvid[$i]=$row["mlsid"]; ++$i; } return $csvid; } function getContractid($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select MLS_id from gw_property where contract_agent_id=".$id." and contract=1 and close=0"; $res=$this->dbobj->db_selectData($sql); $csvid=array(); $i=0; while($row=$this->dbobj->db_fetchrows($res)) { $csvid[$i]=$row["MLS_id"]; ++$i; } return $csvid; } function getAllcity($id,$name) { echo ""; } function getUpdateTime() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select updatetime from gw_updatemls"; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); return $row["updatetime"]; $this->dbobj->db_close(); } function getTotalProp() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select count(*) from gw_csv"; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); return $row[0]; $this->dbobj->db_close(); } function getSchoolcsv() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $filesFolder="../../school"; if ($handle = opendir($filesFolder)) { while (false!== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (is_dir($filesFolder ."/" .$file)) { //echo $file."/
"; } else { $fp =fopen("../../school/".$file, "r") or die("Couldn’t open $file"); $sqldel="delete from gw_school_details"; //$this->dbobj->db_deleteData($sqldel); } } } closedir($handle); } $row=1; while (($data = fgetcsv($fp,1000000, ",")) !== FALSE) { $num = count($data); $row++; if($row>2) { $result=$this->checkSchool($data[0],$data[2]); //$result=0; if($result!=0) { $sql="update gw_school_details set school_code=".$data[1].",schoolname='".$data[2]."',address='".$data[3]."',city='".$data[4]."',state='".$data[5]."',zip='".$data[6]."',phone='".$data[7]."',"; $sql.="locale='".$data[8]."',white='".$data[9]."',black='".$data[10]."',asianpaclsl='".$data[11]."',nativeamer='".$data[12]."',hispanic='".$data[13]."',freelunch='".$data[14]."',administrators='".$data[15]."',"; $sql.="instraides='".$data[16]."',guidancecoun='".$data[17]."',librarians='".$data[18]."',studentsupp='".$data[19]."',grades='".$data[20]."',students='".$data[21]."',teachers='".$data[22]."',pupilteachratio='".$data[23]."',expperpup='".$data[24]."', "; $sql.="prek='".$data[25]."',kg='".$data[26]."',grade1='".$data[27]."',grade2='".$data[28]."',grade3='".$data[29]."',grade4='".$data[30]."',grade5='".$data[31]."',grade6='".$data[32]."',grade7='".$data[33]."',grade8='".$data[34]."',"; $sql.="grade9='".$data[35]."',grade10='".$data[36]."',grade11='".$data[37]."',grade12='".$data[38]."',ungraded='".$data[39]."',markerzip='".$data[40]."' where school_id=".$data[0]." "; $this->dbobj->db_updateData($sql); } else { $sql="insert into gw_school_details(school_id,school_code,schoolname,address,city,state,zip,phone,locale,white,black,asianpaclsl,nativeamer,hispanic,freelunch,administrators,"; $sql.="instraides,guidancecoun,librarians,studentsupp,grades,students,teachers,pupilteachratio,expperpup,prek,kg,grade1,grade2,grade3,grade4,grade5,grade6,grade7,grade8,grade9,"; $sql.="grade10,grade11,grade12,ungraded,markerzip) values('".$data[0]."',".$data[1].",'".$data[2]."','".$data[3]."','".$data[4]."','".$data[5]."','".$data[6]."','".$data[7]."','".$data[8]."' "; $sql.=",'".$data[9]."','".$data[10]."','".$data[11]."','".$data[12]."','".$data[13]."','".$data[14]."','".$data[15]."','".$data[16]."','".$data[17]."','".$data[18]."','".$data[19]."' "; $sql.=",'".$data[20]."','".$data[21]."','".$data[22]."','".$data[23]."','".$data[24]."','".$data[25]."','".$data[26]."','".$data[27]."','".$data[28]."','".$data[29]."','".$data[30]."' "; $sql.=",'".$data[31]."','".$data[32]."','".$data[33]."','".$data[34]."','".$data[35]."','".$data[36]."','".$data[37]."','".$data[38]."','".$data[39]."','".$data[40]."') "; $this->dbobj->db_insertData($sql); } } } $this->dbobj->db_close(); } function checkSchool($id,$name) { $sql="select * from gw_school_details where school_id='".$id."'";// and schoolname='".$name."' "; $res=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($res); //echo $sql."
".$count."
"; //$this->dbobj->db_close(); return $count; } function checkNeighborhood($id) { $sql="select * from gw_neighborhood where zipcode='".$id."' "; $res=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($res); //$this->dbobj->db_close(); return $count; } function getNeighborhoodcsv() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $filesFolder="../../neighborhood"; if ($handle = opendir($filesFolder)) { while (false!== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (is_dir($filesFolder ."/" .$file)) { //echo $file."/
"; } else { $fp =fopen("../../neighborhood/".$file, "r") or die("Couldn’t open $file"); } } } closedir($handle); } $row=1; while (($data = fgetcsv($fp,1000000, ",")) !== FALSE) { $num = count($data); $row++; if($row>2) { $result=$this->checkNeighborhood($data[0]); if($result!=0) { $sql="update gw_neighborhood set highschoolgra='".$data[1]."',college2='".$data[2]."',college4='".$data[3]."',gradeg='".$data[4]."',expperstud='".$data[5]."',stuperteacher='".$data[6]."',stuperlib='".$data[7]."',stupergc='".$data[8]."',unemprate='".$data[9]."',"; $sql.="recjobgrowth='".$data[10]."',futjobgrowth='".$data[11]."',salestax='".$data[12]."',incometax='".$data[13]."',costofliving='".$data[14]."',airquality='".$data[15]."',watershed='".$data[16]."',physicians='".$data[17]."',health='".$data[18]."',superfund='".$data[19]."',"; $sql.="uv='".$data[20]."',altitude='".$data[21]."',rainfall='".$data[22]."',snowfall='".$data[23]."',january='".$data[24]."',july='".$data[25]."',percipitation='".$data[26]."',sunny='".$data[27]."',comfort='".$data[28]."',neighbtype='".$data[29]."',population='".$data[30]."',popdensity='".$data[31]."',male='".$data[32]."',female='".$data[33]."',"; $sql.="medianage='".$data[34]."',household='".$data[35]."',married='".$data[36]."',single='".$data[37]."',householdincome='".$data[38]."',incomecapita='".$data[39]."',violentcrime='".$data[40]."',propertycrime='".$data[41]."',medianhome='".$data[42]."',medianagehome='".$data[43]."',"; $sql.="appreciation='".$data[44]."',owninghome='".$data[45]."',rentinghome='".$data[46]."',homesvacant='".$data[47]."',commbus='".$data[48]."',commcarpool='".$data[49]."',commauto='".$data[50]."',workinghome='".$data[51]."' where zipcode='".$data[0]."' "; $this->dbobj->db_updateData($sql); } else { $sql="insert into gw_neighborhood(zipcode,highschoolgra,college2,college4,gradeg,expperstud,stuperteacher,stuperlib,stupergc,unemprate,recjobgrowth,futjobgrowth,salestax,incometax,"; $sql.="costofliving,airquality,watershed,physicians,health,superfund,uv,altitude,rainfall,snowfall,january,july,percipitation,sunny,comfort,neighbtype,population,popdensity,male,female,"; $sql.="medianage,household,married,single,householdincome,incomecapita,violentcrime,propertycrime,medianhome,medianagehome,appreciation,owninghome,rentinghome,homesvacant,commbus,commcarpool,commauto,workinghome)"; $sql.=" values('".$data[0]."','".$data[1]."','".$data[2]."','".$data[3]."','".$data[4]."','".$data[5]."','".$data[6]."','".$data[7]."','".$data[8]."','".$data[9]."','".$data[10]."','".$data[11]."','".$data[12]."','".$data[13]."',"; $sql.="'".$data[14]."','".$data[15]."','".$data[16]."','".$data[17]."','".$data[18]."','".$data[19]."','".$data[20]."','".$data[21]."','".$data[22]."','".$data[23]."','".$data[24]."','".$data[25]."','".$data[26]."','".$data[27]."','".$data[28]."',"; $sql.="'".$data[29]."','".$data[30]."','".$data[31]."','".$data[32]."','".$data[33]."','".$data[34]."','".$data[35]."','".$data[36]."','".$data[37]."','".$data[38]."','".$data[39]."','".$data[40]."','".$data[41]."','".$data[42]."','".$data[43]."','".$data[44]."',"; $sql.="'".$data[45]."','".$data[46]."','".$data[47]."','".$data[48]."','".$data[49]."','".$data[50]."','".$data[51]."')"; $this->dbobj->db_insertData($sql); //echo $sql;exit; } } } $this->dbobj->db_close(); } function schooltypeDisplay($id,$name) { echo ""; } } ?> dbobj = new db(); //$this->$dateobj=new CDate($dbhost, $dbuser, $dbpass, $dbname); $this->db_host = $dbhost; $this->db_user = $dbuser; $this->db_pass = $dbpass; $this->db_name = $dbname; $image1=""; $image2=""; $image3=""; $image4=""; $image5=""; $image6=""; $image9=""; $image7=""; $image8=""; } function setClosed($close) { $this->close=$close; } function setIndex($index) { $this->index=$index; } function setPage($page) { $this->page=$page; } function setPageurl($pageurl) { $this->pageurl=$pageurl; } function setCsvid($csvid) { $this->csvid=$csvid; } function setMlsid($mlsid) { $this->mlsid=$mlsid; } function setAgentid($agent_id) { $this->agent_id=$agent_id; } function setAgent1($agentname) { $this->agentname1=$agentname; } function setAgent2($agentname) { $this->agentname2=$agentname; } function setAddress($address) { $this->address=$address; } function setCity($city) { $this->city=$city; } function setTown($town) { $this->town=$town; } function setState($state) { $this->state=$state; } /*function setCountry($country) { $this->country=$country; }*/ function setCounty($county) { $this->county=$county; } function setZip($zip) { $this->zip=$zip; } function setPrice($price) { $this->price=$price; } function setTax($tax) { $this->tax=$tax; } function setType($type) { $this->type=$type; } function setStyle($style) { $this->style=$style; } function setYear($year) { $this->year=$year; } function setLot($lotsize) { $this->lotsize=$lotsize; } function setBedroom($numbed) { $this->numbed=$numbed; } function setBathfull($numbathfull) { $this->numbathfull=$numbathfull; } function setBathhalf($numbathhalf) { $this->numbathhalf=$numbathhalf; } function setHeating($heating) { $this->heating=$heating; } function setBasement($basement) { $this->basement=$basement; } function setGarage($garage) { $this->garage=$garage; } function setPool($pool) { $this->pool=$pool; } function setPet($pet) { $this->pet=$pet; } function setSchool($school) { $this->school=$school; } /*function setSmoking($smoking) { $this->smoking=$smoking; }*/ function setMaintenance($maintenance) { $this->maintenance=$maintenance; } function setDescription($desc) { $this->desc=$desc; } function setRltr($rltr) { $this->rltr=$rltr; } function setDateadded($dateadded) { $this->dateadded=$dateadded; } function setImage1($image1) { $this->image1=$image1; } function setImage2($image2) { $this->image2=$image2; } function setImage3($image3) { $this->image3=$image3; } function setImage4($image4) { $this->image4=$image4; } function setImage5($image5) { $this->image5=$image5; } function setImage6($image6) { $this->image6=$image6; } function setImage7($image7) { $this->image7=$image7; } function setImage8($image8) { $this->image8=$image8; } function setImage9($image9) { $this->image9=$image9; } function setYourname($yourname) { $this->yourname=$yourname; } function setYouremail($youremail) { $this->youremail=$youremail; } function setFriendname($friendname) { $this->friendname=$friendname; } function setFriendemail($friendemail) { $this->friendemail=$friendemail; } function setYourmsg($yourmsg) { $this->yourmsg=$yourmsg; } function setUrl($url) { $this->url=$url; } function setContract($contract) { $this->contract=$contract; } function setOpendateset($opendateset) { $this->opendateset=$opendateset; } function setOpenTimeset($opentimeset) { $this->opentimeset=$opentimeset; } //////////////////////// function getClosed() { return $this->close; } function getContract() { return $this->contract; } function getPageurl() { return $this->pageurl; } function getIndex() { return $this->index; } function getPage() { return $this->page; } function getcsvid() { return $this->csvid; } function getMlsid() { return $this->mlsid; } function getAgentid() { return $this->agent_id; } function getAgent1() { return $this->agentname1; } function getAgent2() { return $this->agentname2; } function getAddress() { return $this->address; } function getCity() { return $this->city; } function getTown() { return $this->town; } function getState() { return $this->state; } /*function getCountry() { return $this->country; }*/ function getCounty() { return $this->county; } function getZip() { return $this->zip; } function getPrice() { return $this->price; } function getTax() { return $this->tax; } function getType() { return $this->type; } function getStyle() { return $this->style; } function getYear() { return $this->year; } function getLot() { return $this->lotsize; } function getBedroom() { return $this->numbed; } function getBathfull() { return $this->numbathfull; } function getBathhalf() { return $this->numbathhalf; } function getHeating() { return $this->heating; } function getBasement() { return $this->basement; } function getGarage() { return $this->garage; } function getPool() { return $this->pool; } function getPet() { return $this->pet; } function getSchool() { return $this->school; } function getMaintenance() { return $this->maintenance; } function getDescription() { return $this->desc; } function getRltr() { return $this->rltr; } function getDateadded() { return $this->dateadded; } function getImage1() { return $this->image1; } function getImage2() { return $this->image2; } function getImage3() { return $this->image3; } function getImage4() { return $this->image4; } function getImage5() { return $this->image5; } function getImage6() { return $this->image6; } function getImage7() { return $this->image7; } function getImage8() { return $this->image8; } function getImage9() { return $this->image9; } function getYourname() { return $this->yourname; } function getYouremail() { return $this->youremail; } function getFriendname() { return $this->friendname; } function getFriendemail() { return $this->friendemail; } function getYourmsg() { return $this->yourmsg; } function getUrl() { return $this->url; } function getOpendateset() { return $this->opendateset; } function getOpenTimeset() { return $this->opentimeset; } function getClosedcsv() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_mlsclose where mlsid='".$this->getMlsid()."' "; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); $this->setAgent1($row["closed_agent_id"]); $this->setAgent2($row["contract_agent_id"]); $this->setMlsid($row["mlsid"]); $this->setPrice($row["price"]); $this->setBedroom($row["num_bed"]); $this->setBathfull($row["num_bath_ful"]); $this->setBathhalf($row["num_bath_half"]); $this->setBasement($row["basement"]); $this->setHeating($row["heating"]); $this->setGarage($row["garage"]); $this->setLot($row["lot_size"]); $this->setMaintenance($row["maintenance"]); $this->setPool($row["pool"]); $this->setPet($row["pets"]); $this->setStyle($row["style_name"]); $this->setType($row["type"]); $this->setTax($row["taxes"]); $this->setYear($row["year_built"]); $this->setAddress($row["address"]); $this->setTown($row["town"]); $this->setState($row["state"]); $this->setCounty($row["county"]); $this->setZip($row["zip"]); $this->setRltr($row["rltr"]); $this->setSchool($row["school"]); //$this->setSmoking($row["smoking"]); $this->setDescription($row["description"]); $this->setDateadded($row["listing_date"]); $this->setImage1($row["image1_url"]); $this->setImage2($row["image2_url"]); $this->setImage3($row["image3_url"]); $this->setImage4($row["image4_url"]); $this->setImage5($row["image5_url"]); $this->setImage6($row["image6_url"]); $this->setImage7($row["image7_url"]); $this->setImage8($row["image8_url"]); $this->setImage9($row["image9_url"]); $this->setClosed($row["close"]); $this->setContract($row["contract"]); } function getCsv1() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_mlsclose where mlsid='".$this->getMlsid()."' and close=1"; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); //$this->setCsvid($row["csv_id"]); $this->setMlsid($row["mlsid"]); //$this->setAgent1($row["agent1"]); //$this->setAgent2($row["agent2"]); $this->setAgentid($row["closed_agent_id"]); $this->setPrice($row["price"]); $this->setBedroom($row["num_bed"]); $this->setBathfull($row["num_bath_ful"]); $this->setBathhalf($row["num_bath_half"]); $this->setBasement($row["basement"]); $this->setHeating($row["heating"]); $this->setGarage($row["garage"]); $this->setLot($row["lot_size"]); $this->setMaintenance($row["maintenance"]); $this->setPool($row["pool"]); $this->setPet($row["pets"]); $this->setStyle($row["style_name"]); $this->setType($row["type"]); $this->setTax($row["taxes"]); $this->setYear($row["year_built"]); $this->setAddress($row["address"]); $this->setTown($row["town"]); $this->setState($row["state"]); $this->setCounty($row["county"]); $this->setZip($row["zip"]); $this->setRltr($row["rltr"]); $this->setSchool($row["school"]); //$this->setSmoking($row["smoking"]); $this->setDescription($row["description"]); $this->setDateadded($row["listing_date"]); //$fol=substr($row["MLS_id"],-3); $this->setImage1($row["image1_url"]); $this->setImage2($row["image2_url"]); $this->setImage3($row["image3_url"]); $this->setImage4($row["image4_url"]); $this->setImage5($row["image5_url"]); $this->setImage6($row["image6_url"]); $this->setImage7($row["image7_url"]); $this->setImage8($row["image8_url"]); $this->setImage9($row["image9_url"]); $this->setClosed($row["close"]); $this->setContract($row["contract"]); } function getCsv2() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_mlsclose where mlsid='".$this->getMlsid()."' and contract=1"; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); //$this->setCsvid($row["csv_id"]); $this->setMlsid($row["mlsid"]); //$this->setAgent1($row["agent1"]); //$this->setAgent2($row["agent2"]); $this->setAgentid($row["closed_agent_id"]); $this->setPrice($row["price"]); $this->setBedroom($row["num_bed"]); $this->setBathfull($row["num_bath_ful"]); $this->setBathhalf($row["num_bath_half"]); $this->setBasement($row["basement"]); $this->setHeating($row["heating"]); $this->setGarage($row["garage"]); $this->setLot($row["lot_size"]); $this->setMaintenance($row["maintenance"]); $this->setPool($row["pool"]); $this->setPet($row["pets"]); $this->setStyle($row["style_name"]); $this->setType($row["type"]); $this->setTax($row["taxes"]); $this->setYear($row["year_built"]); $this->setAddress($row["address"]); $this->setTown($row["town"]); $this->setState($row["state"]); $this->setCounty($row["county"]); $this->setZip($row["zip"]); $this->setRltr($row["rltr"]); $this->setSchool($row["school"]); //$this->setSmoking($row["smoking"]); $this->setDescription($row["description"]); $this->setDateadded($row["listing_date"]); //$fol=substr($row["MLS_id"],-3); $this->setImage1($row["image1_url"]); $this->setImage2($row["image2_url"]); $this->setImage3($row["image3_url"]); $this->setImage4($row["image4_url"]); $this->setImage5($row["image5_url"]); $this->setImage6($row["image6_url"]); $this->setImage7($row["image7_url"]); $this->setImage8($row["image8_url"]); $this->setImage9($row["image9_url"]); $this->setClosed($row["close"]); $this->setContract($row["contract"]); } function getCsv() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_csv where MLS_id='".$this->getMlsid()."' "; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); $this->setCsvid($row["csv_id"]); $this->setMlsid($row["MLS_id"]); $this->setAgent1($row["agent1"]); $this->setAgent2($row["agent2"]); $this->setPrice($row["price"]); $this->setBedroom($row["num_bed"]); $this->setBathfull($row["num_bath_ful"]); $this->setBathhalf($row["num_bath_half"]); $this->setBasement($row["basement"]); $this->setHeating($row["heating"]); $this->setGarage($row["garage"]); $this->setLot($row["lot_size"]); $this->setMaintenance($row["maintenance"]); $this->setPool($row["pool"]); $this->setPet($row["pets"]); $this->setStyle($row["style_name"]); $this->setType($row["type"]); $this->setTax($row["taxes"]); $this->setYear($row["year_built"]); $this->setAddress($row["address"]); $this->setTown($row["town"]); $this->setState($row["state"]); $this->setCounty($row["county"]); $this->setZip($row["zip"]); $this->setRltr($row["rltr"]); $this->setSchool($row["school"]); //$this->setSmoking($row["smoking"]); $this->setDescription($row["description"]); $this->setDateadded($row["listing_date"]); $fol=substr($row["MLS_id"],-3); $this->setImage1($fol."/".$row["MLS_id"].".JPG"); $this->setImage2($fol."/".$row["MLS_id"]."_2.JPG"); $this->setImage3($fol."/".$row["MLS_id"]."_3.JPG"); $this->setImage4($fol."/".$row["MLS_id"]."_4.JPG"); $this->setImage5($fol."/".$row["MLS_id"]."_5.JPG"); $this->setImage6($fol."/".$row["MLS_id"]."_6.JPG"); $this->setImage7($fol."/".$row["MLS_id"]."_7.JPG"); $this->setImage8($fol."/".$row["MLS_id"]."_8.JPG"); $this->setImage9($fol."/".$row["MLS_id"]."_9.JPG"); $this->setClosed($row["closed"]); $this->setContract($row["contract"]); } function checkSavedlisting() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sqlid="select user_id from gw_user where email_address='".$_SESSION["uname"]."' "; $result=$this->dbobj->db_selectData($sqlid); $row=$this->dbobj->db_fetchrows($result); $sql="select * from gw_saved_listing where mls_id=".$this->getMlsid()." and user_id=".$row["user_id"]." and type=1"; $res=$this->dbobj->db_selectData($sql); $cnt=$this->dbobj->db_countRows($res); $this->dbobj->db_close(); return $cnt; } function saveListing() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sqlid="select user_id from gw_user where email_address='".$_SESSION["uname"]."' "; $result=$this->dbobj->db_selectData($sqlid); $row=$this->dbobj->db_fetchrows($result); $sql="insert into gw_saved_listing(mls_id,user_id,type) values(".$this->mlsid.",'".$row["user_id"]."','1')"; $this->dbobj->db_insertData($sql); $this->dbobj->db_close(); } function checkMls($mls) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sqlid="select * from gw_csv where MLS_id='".$mls."' and closed=0 and contract=0"; $result=$this->dbobj->db_selectData($sqlid); $count=$this->dbobj->db_countrows($result); return $count; $this->dbobj->db_close(); } function checkMlsclose($mls) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sqlid="select * from gw_mlsclose where mlsid='".$mls."' and close=1"; $result=$this->dbobj->db_selectData($sqlid); $count=$this->dbobj->db_countrows($result); return $count; $this->dbobj->db_close(); } function checkMlscontract($mls) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sqlid="select * from gw_mlsclose where mlsid='".$mls."' and contract=1 "; $result=$this->dbobj->db_selectData($sqlid); $count=$this->dbobj->db_countrows($result); return $count; $this->dbobj->db_close(); } function getMlsfromid($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sqlid="select MLS_id from gw_csv where csv_id='".$id."'"; $result=$this->dbobj->db_selectData($sqlid); $row=$this->dbobj->db_fetchrows($result); return $row["MLS_id"]; $this->dbobj->db_close(); } function appointmentmail() { $from = $_POST["txtemail"]; $to="info@goldwin-realty.com"; #-- form fields-- $smtpval = "localhost"; ini_set("SMTP",$smtpval); ini_set("sendmail_from",$from); #headers-------- $subject = "Goldwin:Agent Appointment"; $headers = "From: $from \n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1\r\n"; $message="Appointment"; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; $message.="
"; $message.="Name"."".$_POST["txtname"]; $message.="
"; $message.="Email"."".$_POST["txtemail"]; $message.="
"; $message.="Phone"."".$_POST["txtphone"]; $message.="
"; $message.="Date"."".$_POST["txtdate"]; $message.="
"; $message.="Time"."".$_POST["seltime1"]; $message.="
"; $message.="Message"."".$_POST["txtmsg"]; $message.="
"; $message.=""; //echo $message; mail($to, $subject, $message,$headers); } function getFeaturedpropertiesid() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select MLS_id from gw_csv where featured=1"; $res=$this->dbobj->db_selectData($sql); $i=0; while($row=$this->dbobj->db_fetchrows($res)) { $this->feturedpro[$i]=$row["MLS_id"]; $i++; } $this->dbobj->db_close(); } function setContractagent() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_csv set contract=1 where MLS_id=".$this->getmlsid(); $this->dbobj->db_updateData($sql); $sqlinsert="insert into gw_mlsclose (contract_agent_id,mlsid,rltr,price,num_bed,num_bath_ful,num_bath_half,basement,heating,garage,lot_size,maintenance,pets,pool,style_name,type,taxes,year_built,address,town,county,state,zip,description,school,listing_date,image1_url,image2_url,image3_url,image4_url,image5_url,image6_url,image7_url,image8_url,image9_url,contract)"; $sqlinsert.=" values(".$this->getAgentid().",".$this->getMlsid().",'".$this->getRltr()."','".$this->getPrice()."','".$this->getBedroom()."','".$this->getBathfull()."','".$this->getBathhalf()."','".$this->getBasement()."','".$this->getHeating()."','".$this->getGarage()."','".$this->getLot()."','".$this->getMaintenance()."','".$this->getPet()."','".$this->getpool()."','".$this->getStyle()."','".$this->getType()."','".$this->getTax()."','".$this->getYear()."','".$this->getAddress()."','".$this->getTown()."','".$this->getCounty()."','".$this->getState()."','".$this->getZip()."','".$this->getDescription()."','".$this->getSchool()."','".$this->getDateadded()."','".$this->getImage1()."','".$this->getImage2()."','".$this->getImage3()."','".$this->getImage4()."','".$this->getImage5()."','".$this->getImage6()."','".$this->getImage7()."','".$this->getImage8()."','".$this->getImage9()."',1)"; //echo $sqlinsert;exit; $this->dbobj->db_insertData($sqlinsert); $this->dbobj->db_close(); } function setClose() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_csv set closed=1 where MLS_id=".$this->getmlsid(); $this->dbobj->db_updateData($sql); $sqlinsert="insert into gw_mlsclose (closed_agent_id,mlsid,rltr,price,num_bed,num_bath_ful,num_bath_half,basement,heating,garage,lot_size,maintenance,pets,pool,style_name,type,taxes,year_built,address,town,county,state,zip,description,school,listing_date,image1_url,image2_url,image3_url,image4_url,image5_url,image6_url,image7_url,image8_url,image9_url,close)"; $sqlinsert.=" values(".$this->getAgentid().",".$this->getMlsid().",'".$this->getRltr()."','".$this->getPrice()."','".$this->getBedroom()."','".$this->getBathfull()."','".$this->getBathhalf()."','".$this->getBasement()."','".$this->getHeating()."','".$this->getGarage()."','".$this->getLot()."','".$this->getMaintenance()."','".$this->getPet()."','".$this->getpool()."','".$this->getStyle()."','".$this->getType()."','".$this->getTax()."','".$this->getYear()."','".$this->getAddress()."','".$this->getTown()."','".$this->getCounty()."','".$this->getState()."','".$this->getZip()."','".$this->getDescription()."','".$this->getSchool()."','".$this->getDateadded()."','".$this->getImage1()."','".$this->getImage2()."','".$this->getImage3()."','".$this->getImage4()."','".$this->getImage5()."','".$this->getImage6()."','".$this->getImage7()."','".$this->getImage8()."','".$this->getImage9()."',1)"; $this->dbobj->db_insertData($sqlinsert); $this->dbobj->db_close(); } function setCancelcontract() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_csv set contract=0 where MLS_id=".$this->getmlsid(); $this->dbobj->db_updateData($sql); $sqlsel="select * from gw_mlsclose where mlsid=".$this->getMlsid().""; $res=$this->dbobj->db_selectData($sqlsel); $row=$this->dbobj->db_fetchrows($res); for($i=1;$i<10;$i++) { $url="image".$i."_url"; @unlink("../../closed_image/".$row[$url]); } $sqldel="delete from gw_mlsclose where mlsid=".$this->getMlsid()." "; $this->dbobj->db_deleteData($sqldel); $this->dbobj->db_close(); } function setOpen() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_csv set closed=0 where MLS_id=".$this->getMlsid(); $this->dbobj->db_updateData($sql); $sqlsel="select * from gw_mlsclose where mlsid=".$this->getMlsid().""; $res=$this->dbobj->db_selectData($sqlsel); $row=$this->dbobj->db_fetchrows($res); for($i=1;$i<10;$i++) { $url="image".$i."_url"; @unlink("../../closed_image/".$row[$url]); } $sqldel="delete from gw_mlsclose where mlsid=".$this->getMlsid()." and contract=0"; //echo $sqldel;exit; $this->dbobj->db_deleteData($sqldel); $this->dbobj->db_close(); } function checkContract() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_mlsclose where mlsid=".$this->getMlsid()." and contract=1 "; $res=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($res); $this->dbobj->db_close(); return $count; } function setUpdateclose() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_csv set closed=1 where MLS_id=".$this->getMlsid(); $this->dbobj->db_updateData($sql); $sql1="update gw_mlsclose set closed_agent_id=".$this->getAgentid().",close=1 where mlsid=".$this->getMlsid().""; $this->dbobj->db_updateData($sql1); $this->dbobj->db_close(); } function setUpdateopen() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_csv set closed=0 where MLS_id=".$this->getMlsid(); $this->dbobj->db_updateData($sql); $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql1="update gw_mlsclose set close=0,closed_agent_id='' where mlsid=".$this->getMlsid()." "; $this->dbobj->db_updateData($sql1); $this->dbobj->db_close(); } function getAgenturl($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select image_url1 from gw_agent where agent_id=".$id." "; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); return $row["image_url1"]; $this->dbobj->db_close(); } function getResidentcontract($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select mlsid from gw_mlsclose where contract_agent_id=".$id." and (type='Residential' or type='Condo' or type='Land') and contract=1 and close=0"; $res=$this->dbobj->db_selectData($sql); $mlsid=array(); $i=0; while($row=$this->dbobj->db_fetchrows($res)) { $mlsid[$i]=$row["mlsid"]; ++$i; } return $mlsid; $this->dbobj->db_close(); } function getRentalcontract($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select mlsid from gw_mlsclose where contract_agent_id=".$id." and type='Rental' and contract=1 and close=0"; $res=$this->dbobj->db_selectData($sql); $mlsid=array(); $i=0; while($row=$this->dbobj->db_fetchrows($res)) { $mlsid[$i]=$row["mlsid"]; ++$i; } return $mlsid; $this->dbobj->db_close(); } function getCommercialcontract($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select mlsid from gw_mlsclose where contract_agent_id=".$id." and type='Commercial' and contract=1 and close=0"; $res=$this->dbobj->db_selectData($sql); $mlsid=array(); $i=0; while($row=$this->dbobj->db_fetchrows($res)) { $mlsid[$i]=$row["mlsid"]; ++$i; } return $mlsid; $this->dbobj->db_close(); } function getOtherscontract($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); //$sql="select mlsid from gw_mlsclose where contract_agent_id=".$id." and (type='Condo' or type='Land') and contract=1 and close=0"; $sql="select mlsid from gw_mlsclose where contract_agent_id=".$id." and type='CO-OP' and contract=1 and close=0"; $res=$this->dbobj->db_selectData($sql); $mlsid=array(); $i=0; while($row=$this->dbobj->db_fetchrows($res)) { $mlsid[$i]=$row["mlsid"]; ++$i; } return $mlsid; $this->dbobj->db_close(); } function mailList() { $from = $this->youremail; $to=$this->friendemail; #-- form fields-- $smtpval = "localhost"; ini_set("SMTP",$smtpval); ini_set("sendmail_from",$from); #headers-------- $subject = "Property Details"; $headers = "From: $from \n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1\r\n"; $message="Property Details"; $message.=""; $message.=""; if($this->getYourmsg()!="") { $message.=""; } $message.=""; $message.="".""; $message.=""; $message.=""; $message.="
"; $message.="Sender "."".$this->getYourname(); $message.="
"; $message.="Message "."".$this->getYourmsg(); $message.="
"; $message.="Property Details"; $message.="
"; $message.="MLS code "."".$this->getMlsid(); $message.=""; $message.="Town "."".$this->getTown(); $message.="
"; $message.="State "."".$this->getState(); $message.=""; $message.="County "."".$this->getCounty(); $message.="
"; $message.="Price "."$".$this->getPrice(); $message.=""; $message.="Type "."".$this->getType(); $message.="
"; $message.="Year "."".$this->getYear(); $message.=""; $message.="Lot Size "."".$this->getLot(); $message.="
"; $message.="Bedroom "."".$this->getBedroom(); $message.=""; $message.="Bathroom "."".$this->getBathfull(); $message.="
"; $message.="For more details about this property please click the link below"; $message.="
"; $message.="".$this->getUrl().""; $message.="
"; $message.=""; //echo $message;exit; mail($to, $subject, $message,$headers); } function getAllcsvmlsid() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select MLS_id from gw_csv"; $res=$this->dbobj->db_selectData($sql); $mlsid=array(); $i=0; while($row=$this->dbobj->db_fetchrows($res)) { $mlsid[$i]=$row["MLS_id"]; ++$i; } return $mlsid; $this->dbobj->db_close(); } function checkPreference($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql1="SELECT gw_account.account_id FROM gw_account,gw_csv "; $sql1.="INNER JOIN gw_account_location ON gw_account.account_id = gw_account_location.account_id "; $sql1.="WHERE gw_csv.MLS_id =$id AND gw_account_location.town = gw_csv.town "; $sql1.="AND gw_csv.num_bed BETWEEN gw_account.num_bed1 AND gw_account.num_bed2 AND gw_csv.num_bath_ful BETWEEN gw_account.num_bath1 AND gw_account.num_bath2 "; $sql1.="AND gw_csv.price BETWEEN gw_account.price_from AND gw_account.price_to "; echo $sql1; $res=$this->dbobj->db_selectData($sql1); $acid=array();$i=0; //$this->dbobj->db_close(); while($account=$this->dbobj->db_fetchrows($res)) { $acid[$i]=$account[0]; $i++; } //print_r($acid); $accountarray=array(); $count=count($acid); if($count!=0) { foreach($acid as $accountid) { //$this->sendmail($accountid,$id); $count=0; $sql="select type_id from gw_account where account_id=".$accountid.""; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); $sql2="select * from gw_csv where MLS_id=".$id.""; if($row[0]==1 || $row[0]==2 || $row[0]==3) { $sql2.=" AND gw_csv.type='Residential'"; } else if($row[0]==4) { $sql2.=" AND gw_csv.type='Land'"; } else if($row[0]==6) { $sql2.=" AND gw_csv.type='Rental'"; } else if($row[0]==8) { $sql2.=" AND gw_csv.type='Commercial'"; } else if($row[0]==10) { $sql2.=" AND gw_csv.type='Condo'"; } else if($row[0]==9) { $sql2.=" AND gw_csv.type='CO-OP'"; } //echo $sql2; $result2=$this->dbobj->db_selectData($sql2); $count=$this->dbobj->db_countRows($result2); //$row2=$this->dbobj->db_fetchrows($result2); if($count!=0) { array_push($accountarray,$accountid); } } } $count1=count($accountarray); if($count1!=0) { foreach($accountarray as $accid) { $this->checkPreference1($accid,$id); } } $this->dbobj->db_close(); return; } function checkPreference1($acid,$mlsid) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sqlcheck="select * from gw_sendmail where account_id=".$acid." AND mls_id=".$mlsid; //echo $sqlcheck; $rescheck=$this->dbobj->db_selectData($sqlcheck); $count=$this->dbobj->db_countRows($rescheck); if($count<1) { $sqlinsert="insert into gw_sendmail (account_id,mls_id,send) values(".$acid.",".$mlsid.",1)"; $this->dbobj->db_insertData($sqlinsert); } //$this->dbobj->db_close(); } function sendmail() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sqlcheck="select distinct(account_id) from gw_sendmail where send=1 order by account_id"; $rescheck=$this->dbobj->db_selectData($sqlcheck); $acc=array(); while($row=$this->dbobj->db_fetchrows($rescheck)) { $acc[]=$row["account_id"]; } foreach($acc as $acid) { $sql="select * from gw_user INNER JOIN gw_account on gw_user.user_id=gw_account.user_id where gw_account.account_id=".$acid; $res=$this->dbobj->db_selectData($sql); $user=$this->dbobj->db_fetchrows($res); $sqlsend="select * from gw_sendmail where send=1 AND account_id=$acid"; $rssend=$this->dbobj->db_selectData($sqlsend); $from ="listingmatch@goldwin-realty.com"; $to=$user["email_address"]; $smtpval = "localhost"; ini_set("SMTP",$smtpval); ini_set("sendmail_from",$from); $subject = "Property Details"; $headers = "From: $from\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1\r\n"; $message="Property Details"; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; while($row=$this->dbobj->db_fetchrows($rssend)) { $this->setMlsid($row["mls_id"]); $this->getCsv(); #-- form fields-- #headers-------- $message.=""; $message.=""; $message.=""; } //$message.="
"; //$nname=$user["first_name"]." ".$user["last_name"]; //$emailadd=$user["email_address"]; //$ghg="mailto:swaranjit.singh@gmail.com?subject=Prospect Match Unsubscribe To $nname&body=Please remove me from receiving Prospect Match $nname(email id:$emailadd)"; //echo $ghg; $message.="
"; $message.="
Prospect Matches for:".$user["first_name"]." ".$user["last_name"]; $message.="
 
ID#TOWNPriceStyleBedroomsBaths
 
".$this->getMlsid(); $message.="".$this->getTown(); $message.="".$this->getPrice(); $message.="".$this->getStyle(); $message.="".$this->getBedroom(); $message.="".$this->getBathfull(); $message.="
Click "; $message.="here "; $message.=" to view full prospects on-line
To reply to this email, please click here to email Swaranjit Rikhy
To Unsubscribe To This Service, please click here
"; $message.=""; //echo $message."


"; mail($to, $subject, $message,$headers); } $this->dbobj->db_close(); } function sendmailtest() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $acid=3; $sql="select * from gw_user INNER JOIN gw_account on gw_user.user_id=gw_account.user_id where gw_account.account_id=3 OR gw_account.account_id=11 OR gw_account.account_id=12"; $res=$this->dbobj->db_selectData($sql); $user=$this->dbobj->db_fetchrows($res); $sqlsend="select * from gw_sendmail where send=1 AND account_id=$acid"; $rssend=$this->dbobj->db_selectData($sqlsend); $from ="listingmatch@goldwin-realty.com"; $to=$user["email_address"]; $smtpval = "localhost"; ini_set("SMTP",$smtpval); ini_set("sendmail_from",$from); $subject = "Property Details"; $headers = "From: $from\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1\r\n"; $message="Property Details"; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; while($row=$this->dbobj->db_fetchrows($rssend)) { $this->setMlsid($row["mls_id"]); $this->getCsv(); #-- form fields-- #headers-------- $message.=""; $message.=""; $message.=""; } $message.="
"; $nname=$user["last_name"]." ".$user["first_name"]; $ghg="$nname& $nname"; $emailadd=$user["email_address"]; //echo $ghg; $message.=""; $message.="
Prospect Matches for:".$user["last_name"]." ".$user["first_name"]; $message.="
 
ML#TOWNPriceStyleBedroomsBaths
 
".$this->getMlsid(); $message.="".$this->getTown(); $message.="".$this->getPrice(); $message.="".$this->getStyle(); $message.="".$this->getBedroom(); $message.="".$this->getBathfull(); $message.="
Click "; $message.="here "; $message.=" to view full prospects on-line
To reply to this email, please click here to email Swaranjit Rikhy
To Unsubscribe To This Service, please click here to email Swaranjit Rikhy
"; $message.=""; //echo $message; mail($to, $subject, $message,$headers); $this->dbobj->db_close(); } function mailAdmin() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select email from gw_admin"; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); //echo $row["email"]; //$property1=new Property($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $from ="listingmatch@goldwin-realty.com"; $to="abhijitrikhy@aol.com"; //$to="anoopvarghese@gmail.com"; #-- form fields-- $smtpval = "localhost"; ini_set("SMTP",$smtpval); ini_set("sendmail_from",$from); #headers-------- $subject = "Cron Job Notification"; $headers = "From: $from\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1\r\n"; $message="Cron Job Notification"; $message.=""; $message.=""; $message.="
"; $message.="Crone job successfully completed on". date("F j, Y, g:i a"); $message.="
"; $message.=""; echo $message; //echo $sql;exit; mail($to, $subject, $message,$headers); $this->dbobj->db_close(); } function updateSendmail() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_sendmail set send=0"; $res=$this->dbobj->db_updateData($sql); $this->dbobj->db_close(); } function setFeture() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_featured_property"; $rs=$this->dbobj->db_selectData($sql); $mlsarray=array(); while($row=$this->dbobj->db_fetchrows($rs)) { $mlsarray[]=$row["mls_id"]; } foreach($mlsarray as $mlsid) { $sql1="update gw_csv set featured=1 where MLS_id=$mlsid"; //echo $sql1; $res=$this->dbobj->db_updateData($sql1); } $this->dbobj->db_close(); } function getSchoolinfo($zip) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select school_id from gw_school_details where zip='".$zip."' or markerzip='".$zip."'"; $rs=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($rs); $schoolid=array(); $i=0; if($count>0) { while($row=$this->dbobj->db_fetchrows($rs)) { $schoolid[$i]=$row[0]; } } $this->dbobj->db_close(); return $schoolid; } function getNeighborinfo($zip) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_neighborhood where zipcode='".$zip."' "; $rs=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($rs); $this->dbobj->db_close(); if($count>0) { return $count; } else { return $count; } } function getHighschoolno($zip) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_school_details where (zip='".$zip."' or markerzip='".$zip."') and school_code=1 "; $rs=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($rs); $this->dbobj->db_close(); if($count>0) { return $count; } else { return $count; } } function getMiddleschoolno($zip) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_school_details where (zip='".$zip."' or markerzip='".$zip."') and school_code=2 "; $rs=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($rs); $this->dbobj->db_close(); if($count>0) { return $count; } else { return $count; } } function getElementaryschoolno($zip) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_school_details where (zip='".$zip."' or markerzip='".$zip."') and school_code=3 "; $rs=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($rs); $this->dbobj->db_close(); if($count>0) { return $count; } else { return $count; } } function getPKschoolno($zip) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_school_details where (zip='".$zip."' or markerzip='".$zip."') and school_code=4 "; $rs=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($rs); $this->dbobj->db_close(); if($count>0) { return $count; } else { return $count; } } function getUngradedschoolno($zip) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_school_details where (zip='".$zip."' or markerzip='".$zip."') and school_code=5 "; $rs=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($rs); $this->dbobj->db_close(); if($count>0) { return $count; } else { return $count; } } function getNeighborfulldetails($zip) { $row=""; $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_neighborhood where zipcode='".$zip."' "; $rs=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($rs); $this->dbobj->db_close(); return $row; } function getSchoolfulldetails($id) { $row=""; $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select gw_school_details.*,gw_school.school_type from gw_school_details INNER JOIN gw_school ON gw_school_details.school_code=gw_school.school_code where school_id='".$id."' "; //echo $sql; //exit; $rs=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($rs); $this->dbobj->db_close(); return $row; } function getSchoolfulldetails1($id,$sname) { $row=""; $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select gw_school_details.*,gw_school.school_type from gw_school_details INNER JOIN gw_school ON gw_school_details.school_code=gw_school.school_code where school_id='".$id."' and schoolname='".$sname."' "; //exit; $rs=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($rs); $this->dbobj->db_close(); return $row; } function getHighschoolinfo($zipcode) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select gw_school_details.school_id,gw_school_details.schoolname,gw_school_details.grades,gw_school_details.students,gw_school_details.pupilteachratio from gw_school_details INNER JOIN gw_school ON gw_school_details.school_code = gw_school.school_code where (gw_school_details.zip='".$zipcode."' or gw_school_details.markerzip='".$zipcode."') and gw_school_details.school_code=1 "; $rs=$this->dbobj->db_selectData($sql); $this->dbobj->db_close(); return $rs; } function getMiddleschoolinfo($zipcode) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select gw_school_details.school_id,gw_school_details.schoolname,gw_school_details.grades,gw_school_details.students,gw_school_details.pupilteachratio from gw_school_details INNER JOIN gw_school ON gw_school_details.school_code = gw_school.school_code where (gw_school_details.zip='".$zipcode."' or gw_school_details.markerzip='".$zipcode."') and gw_school_details.school_code=2 "; $rs=$this->dbobj->db_selectData($sql); $this->dbobj->db_close(); return $rs; } function getElementaryschoolinfo($zipcode) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select gw_school_details.school_id,gw_school_details.schoolname,gw_school_details.grades,gw_school_details.students,gw_school_details.pupilteachratio from gw_school_details INNER JOIN gw_school ON gw_school_details.school_code = gw_school.school_code where (gw_school_details.zip='".$zipcode."' or gw_school_details.markerzip='".$zipcode."') and gw_school_details.school_code=3 "; $rs=$this->dbobj->db_selectData($sql); $this->dbobj->db_close(); return $rs; } function getPKschoolinfo($zipcode) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select gw_school_details.school_id,gw_school_details.schoolname,gw_school_details.grades,gw_school_details.students,gw_school_details.pupilteachratio from gw_school_details INNER JOIN gw_school ON gw_school_details.school_code = gw_school.school_code where (gw_school_details.zip='".$zipcode."' or gw_school_details.markerzip='".$zipcode."') and gw_school_details.school_code=4 "; $rs=$this->dbobj->db_selectData($sql); $this->dbobj->db_close(); return $rs; } function getUngradedschoolinfo($zipcode) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select gw_school_details.school_id,gw_school_details.schoolname,gw_school_details.grades,gw_school_details.students,gw_school_details.pupilteachratio from gw_school_details INNER JOIN gw_school ON gw_school_details.school_code = gw_school.school_code where (gw_school_details.zip='".$zipcode."' or gw_school_details.markerzip='".$zipcode."') and gw_school_details.school_code=5 "; $rs=$this->dbobj->db_selectData($sql); $this->dbobj->db_close(); return $rs; } function deleteContract($agentid) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="delete from gw_mlsclose where contract_agent_id=".$agentid." AND mlsid=".$this->getMlsid()." AND contract=1"; $this->dbobj->db_selectData($sql); $sql1="update gw_csv set contract=0 where MLS_id='".$this->getMlsid()."'"; $this->dbobj->db_selectData($sql1); $this->dbobj->db_close(); } function deleteClose($agentid) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="delete from gw_mlsclose where closed_agent_id=".$agentid." AND mlsid=".$this->getMlsid()." AND close=1"; $this->dbobj->db_selectData($sql); $sql1="update gw_csv set closed=0 where MLS_id='".$this->getMlsid()."'"; $this->dbobj->db_selectData($sql1); $this->dbobj->db_close(); } function deleteMlsclose() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="delete from gw_mlsclose where mlsid=".$this->getMlsid(); for($i=1;$i<=9;++$i) { @unlink("../closed_image/".$this->getMlsid()."_".$i.".JPG"); } $this->dbobj->db_selectData($sql); $sql="update gw_csv set closed=0,contract=0 where MLS_id=".$this->getMlsid(); $this->dbobj->db_selectData($sql); $this->dbobj->db_close(); } function setMlsclose() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_mlsclose set close=".$this->getClosed().",contract=".$this->getContract()." where mlsid=".$this->getMlsid(); $this->dbobj->db_selectData($sql); //echo $sql; $this->getClosedcsv(); $clagid=$this->getAgent1(); $cntagid=$this->getAgent2(); $sql="update gw_mlsclose set closed_agent_id=".$cntagid.",contract_agent_id=0 where mlsid=".$this->getMlsid(); $this->dbobj->db_selectData($sql); $this->dbobj->db_close(); } function setMlscontract() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_mlsclose set close=".$this->getClosed().",contract=".$this->getContract()." where mlsid=".$this->getMlsid(); //echo $sql; $this->dbobj->db_selectData($sql); $this->getClosedcsv(); $clagid=$this->getAgent1(); $cntagid=$this->getAgent2(); $sql="update gw_mlsclose set closed_agent_id=0,contract_agent_id=".$clagid." where mlsid=".$this->getMlsid(); //echo $sql; $this->dbobj->db_selectData($sql); $this->dbobj->db_close(); //exit; } }dbobj = new db(); $this->db_host = $dbhost; $this->db_user = $dbuser; $this->db_pass = $dbpass; $this->db_name = $dbname; } function setEmail($email) { $this->email=$email; } function setPassword($pwd) { $this->pwd=$pwd; } function setUserid($userid) { $this->userid=$userid; } function setFirstname($fname) { $this->firstname=$fname; } function setLastname($lname) { $this->lastname=$lname; } function setEmailid($emailid) { $this->emailid=$emailid; } function setPassword1($password) { $this->password=$password; } function setHomephone1($hphone1) { $this->homephone1=$hphone1; } function setHomephone2($hphone2) { $this->homephone2=$hphone2; } function setHomephone3($hphone3) { $this->homephone3=$hphone3; } function setAltphone1($altphone1) { $this->altphone1=$altphone1; } function setAltphone2($altphone2) { $this->altphone2=$altphone2; } function setAltphone3($altphone3) { $this->altphone3=$altphone3; } function setIsagent($isagent) { $this->isagent=$isagent; } function setIsmortgage($ismortgage) { $this->ismortgage=$ismortgage; } function setIsselling($isselling) { $this->isselling=$isselling; } function setDateadded($date) { $this->dateadded=$date; } ////// function getEmail() { return $this->email; } function getPassword() { return $this->pwd; } function getUserid() { return $this->userid; } function getFirstname() { return $this->firstname; } function getLastname() { return $this->lastname; } function getEmailid() { return $this->emailid; } function getPassword1() { return $this->password; } function getHomephone1() { return $this->homephone1; } function getHomephone2() { return $this->homephone2; } function getHomephone3() { return $this->homephone3; } function getAltphone1() { return $this->altphone1; } function getAltphone2() { return $this->altphone2; } function getAltphone3() { return $this->altphone3; } function getIsagent() { return $this->isagent; } function getIsmortgage() { return $this->ismortgage; } function getIsselling() { return $this->isselling; } function getDateadded() { return $this->dateadded; } function checkUser()//this function is used to check the client email and password are correct { $this->dbobj->db_connect($this->db_host, $this->db_user, $this->db_pass,$this->db_name); $sql="SELECT * FROM gw_user WHERE email_address='".$this->email."' and pwd='".$this->pwd."'"; $this->result =$this->dbobj->db_selectData($sql); $this->num_rows =$this->dbobj->db_countRows($this->result); $this->dbobj->db_close(); return $this->num_rows; } function getPassworddetails() { $this->dbobj->db_connect($this->db_host, $this->db_user, $this->db_pass,$this->db_name); $sql="SELECT * FROM gw_user WHERE email_address='".$this->email."' "; $this->result =$this->dbobj->db_selectData($sql); $this->num_rows =$this->dbobj->db_countRows($this->result); $this->dbobj->db_close(); return $this->num_rows; } function getUseridvalue() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select user_id from gw_user where email_address='".$_SESSION["uname"]."' "; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); return $row["user_id"]; } function emailpassword() { $this->dbobj->db_connect($this->db_host, $this->db_user, $this->db_pass,$this->db_name); $sql="SELECT * FROM gw_user WHERE email_address='".$this->email."' "; $this->result =$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($this->result); $from = "Goldwin"; $to=$this->email; #-- form fields-- $smtpval = "localhost"; ini_set("SMTP",$smtpval); ini_set("sendmail_from",$from); #headers-------- $subject = "Login details"; $headers = "From: $from \n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1\r\n"; $message="Login details"; $message.="
Userid ".$row["email_address"]; $message.="
Password ".$row["pwd"]; $message.="

"; $message.="

"; $message.=""; mail($to, $subject, $message,$headers); $this->dbobj->db_close(); } function getUsername() { $this->dbobj->db_connect($this->db_host, $this->db_user, $this->db_pass,$this->db_name); $sql="SELECT first_name FROM gw_user WHERE email_address='".$_SESSION["uname"]."' "; $this->result =$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($this->result); $this->dbobj->db_close(); return $row["first_name"]; } function checkEmail($from) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); if($from=="add") { $sql="select * from gw_user where email_address='".$this->emailid."'"; } else if($from=="edit") { $sql="select * from gw_user where email_address='".$this->emailid."' and user_id<>".$this->getUserid(); } $rs=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($rs); $this->dbobj->db_close(); return $count; } function userExists($action,$msgcode) { echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; } function countSavedlisting() { $userid=$this->getUseridvalue(); $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select mls_id,type from gw_saved_listing where user_id=".$userid." "; $rs=$this->dbobj->db_selectData($sql); $pid=array(); //$i=0; while($row=$this->dbobj->db_fetchrows($rs)) { //$pid[$i]=$row["property_id"]; //$i++; $pid[$row["mls_id"]]=$row["type"]; } $count=sizeof($pid); /*$sql1="select property_id from gw_saved_listing where user_id=".$userid." "; $rs=$this->dbobj->db_selectData($sql); $pid=array(); $i=0; while($row=$this->dbobj->db_fetchrows($rs)) { $pid[$i]=$row["property_id"]; $i++; } */ $this->dbobj->db_close(); return $count; } function deleteProperty($mlsid) { $userid=$this->getUseridvalue(); $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="delete from gw_saved_listing where user_id=".$userid." and mls_id=".$mlsid." "; $this->dbobj->db_deleteData($sql); $this->dbobj->db_close(); } function addUser() { //$this->dateobj=new CDate($this->db_host, $this->db_user, $this->db_pass,$this->db_name); //$this->dateadded=$this->dateobj->getdate_yyyy_mm_dd(); $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $homephoneno=$this->homephone1."-".$this->homephone2."-".$this->homephone3; $altphoneno=$this->altphone1."-".$this->altphone2."-".$this->altphone3; $sql="insert into gw_user(first_name,last_name,email_address,pwd,home_phone,alt_phone,agent,mortgage,selling,date_added) values("; $sql.="'".$this->firstname."','".$this->lastname."','".$this->emailid."','".$this->password."','".$homephoneno."'"; $sql.=",'".$altphoneno."','".$this->isagent."','".$this->ismortgage."','".$this->isselling."','".$this->dateadded."')"; $rs=$this->dbobj->db_insertData($sql); $_SESSION["uname"]=$this->emailid; //$count=$this->dbobj->db_countRows($rs); $this->dbobj->db_close(); } } ?>dbobj = new db(); $this->db_host = $dbhost; $this->db_user = $dbuser; $this->db_pass = $dbpass; $this->db_name = $dbname; } function setIndex($index) { $this->index=$index; } function setPage($page) { $this->page=$page; } function setPageurl($pageurl) { $this->pageurl=$pageurl; } function setAgentid($agentid) { $this->agentid=$agentid; } function setAgentcode($agentcode) { $this->agentcode=$agentcode; } function setTitle($title) { $this->title=$title; } function setExtension($extension) { $this->extension=$extension; } function setFirstname($fname) { $this->firstname=$fname; } function setLastname($lname) { $this->lastname=$lname; } function setTown($town) { $this->town=$town; } function setPhone1($phone1) { $this->phone1=$phone1; } function setPhone2($phone2) { $this->phone2=$phone2; } function setPhone3($phone3) { $this->phone3=$phone3; } function setEmail($email) { $this->email=$email; } function setLanguage($language) { $this->language=$language; } function setImageurl1($url1) { $this->imageurl1=$url1; } function setImageurl2($url2) { $this->imageurl2=$url2; } function setBio($bio) { $this->bio=$bio; } function setDateadded($date) { $this->dateadded=$date; } function setAddress($address) { $this->address=$address; } function setCity($city) { $this->city=$city; } function setState($state) { $this->state=$state; } function setTownname($townname) { $this->townname=$townname; } function setOfficephone($officephone) { $this->officephone=$officephone; } function setFax($fax) { $this->fax=$fax; } function setYourname($yourname) { $this->yourname=$yourname; } function setYouremail($youremail) { $this->youremail=$youremail; } function setFriendname($friendname) { $this->friendname=$friendname; } function setFriendemail($friendemail) { $this->friendemail=$friendemail; } function setYourmsg($yourmsg) { $this->yourmsg=$yourmsg; } function setLanguageadd($languageadd) { $this->languageadd=$languageadd; } function setTitleadd($titleadd) { $this->titleadd=$titleadd; } function setLanguageid($languageid) { $this->languageid=$languageid; } function setTitleid($titleid) { $this->titleid=$titleid; } ///// function getPageurl() { return $this->pageurl; } function getIndex() { return $this->index; } function getPage() { return $this->page; } function getAddress() { return $this->address; } function getCity() { return $this->city; } function getState() { return $this->state; } function getTownname() { return $this->townname; } function getOfficephone() { return $this->officephone; } function getFax() { return $this->fax; } function getAgentid() { return $this->agentid; } function getAgentcode() { return $this->agentcode; } function getTitle() { return $this->title; } function getExtension() { return $this->extension; } function getFirstname() { return $this->firstname; } function getLastname() { return $this->lastname; } function getTown() { return $this->town; } function getPhone1() { return $this->phone1; } function getPhone2() { return $this->phone2; } function getPhone3() { return $this->phone3; } function getEmail() { return $this->email; } function getLanguage() { return $this->language; } function getImageurl1() { return $this->imageurl1; } function getImageurl2() { return $this->imageurl2; } function getBio() { return $this->bio; } function getDateadded() { return $this->dateadded; } function getYourname() { return $this->yourname; } function getYouremail() { return $this->youremail; } function getFriendname() { return $this->friendname; } function getFriendemail() { return $this->friendemail; } function getYourmsg() { return $this->yourmsg; } function getLanguageadd() { return $this->languageadd; } function getTitleadd() { return $this->titleadd; } function getLanguageid() { return $this->languageid; } function getTitleid() { return $this->titleid; } ////This function is for retrieving the name of the town. function getNametown($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select city from gw_agent_office where office_id=".$id." "; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); return $row["city"]; } //Retrieving name of the state. function getStatename($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select state_long from gw_states where state_id=".$id." "; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); return $row["state_long"]; } //Function for retrieving all the office information corresponding to a office id. function getOffice($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_agent_office where office_id=".$id." "; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); $this->setAddress($row["address"]); $this->setCity($row["city"]); $this->setState($row["state"]); $this->setTownname($row["zip"]); $this->setOfficephone($row["phone"]); $this->setFax($row["fax"]); } //This is a mail function for sending biodata of an agent to somebody else. function mailBio() { $from = $this->youremail; $to=$this->friendemail; #-- form fields-- $smtpval = "localhost"; ini_set("SMTP",$smtpval); ini_set("sendmail_from",$from); #headers-------- $subject = "Goldwin:Agent Bio"; $headers = "From: $from \n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1\r\n"; $message="Agent Biodata"; $message.=""; $message.=""; if($this->getYourmsg()!="") { $message.=""; } if($this->getBio()!="") { $message.=""; } $message.="
"; $message.="Sender "."".$this->getYourname(); $message.="
"; $message.="Message "."".$this->getYourmsg(); $message.="
"; $message.="Bio "."".$this->getBio(); $message.="
"; $message.=""; mail($to, $subject, $message,$headers); } function appointmentmail() { $from = $_POST["txtemail"]; $to=$this->getEmail(); #-- form fields-- $smtpval = "localhost"; ini_set("SMTP",$smtpval); ini_set("sendmail_from",$from); #headers-------- $subject = "Goldwin:Agent Appointment"; $headers = "From: $from \n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1\r\n"; $message="Appointment"; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; $message.=""; $message.="
"; $message.="Name"."".$_POST["txtname"]; $message.="
"; $message.="Emai"."".$_POST["txtemail"]; $message.="
"; $message.="Phone"."".$_POST["txtphone"]; $message.="
"; $message.="Date"."".$_POST["hiddate"]; $message.="
"; $message.="Time"."".$_POST["seltime1"]; $message.="
"; $message.="Message"."".$_POST["txtmsg"]; $message.="
"; $message.=""; mail($to, $subject, $message,$headers); } //$property->getPropertyid(),$_POST["txtname"],$_POST["txtemail"],$_POST["txtphone"],$_POST["hiddate"],$_POST["seltime1"],$_POST["txtmsg"] //Retrieving language name corresponding to an id. function getLanguagename() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_languages where language_id='".$this->languageadd."' "; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); $this->setLanguageadd($row["language_name"]); } function getTitlename() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_agent_title where title_id='".$this->titleadd."' "; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); $this->setTitleadd($row["title_name"]); } //Retrieving all the agent details corresponding to an agent id. function getAgent() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_agent where agent_id='".$this->getagentid()."' "; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); $this->setAgentcode($row["agent_code"]); $this->setFirstname($row["first_name"]); $this->setLastname($row["last_name"]); $this->setTitle($row["title_id"]); $this->setTown($row["town"]); $this->setExtension($row["office_extn"]); $this->setPhone1($row["cell_phone"]); $this->setEmail($row["email_address"]); $this->setLanguage($row["language"]); //echo $row["language"];exit; $this->setImageurl1($row["image_url1"]); $this->setImageurl2($row["image_url2"]); $this->setBio($row["bio"]); //$this->set $this->setDateadded($row["date_added"]); } //Function for checking email address already exists or not. function checkAgent() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); if(isset($this->agentid)) { $sql="select * from gw_agent where email_address='".$this->email."' and agent_id <>'".$this->agentid."' "; } else { $sql="select * from gw_agent where email_address='".$this->email."' "; } $res=$this->dbobj->db_selectData($sql); $cnt=$this->dbobj->db_countRows($res); $this->dbobj->db_close(); return $cnt; } function checkAgentexists($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_agent where agent_id=".$id; $res=$this->dbobj->db_selectData($sql); $cnt=$this->dbobj->db_countRows($res); $this->dbobj->db_close(); return $cnt; } //Function for checking language exists or not. function checkLanguage() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); if(isset($this->languageid)) { $sql="select * from gw_languages where language_name='".$this->languageadd."' and language_id <>'".$this->languageid."' "; } else { $sql="select * from gw_languages where language_name='".$this->languageadd."' "; } $result=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($result); $this->dbobj->db_close(); return $count; } function checkTitlename() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); if(isset($this->titleid)) { $sql="select * from gw_agent_title where title_name='".$this->titleadd."' and title_id <>'".$this->titleid."' "; } else { $sql="select * from gw_agent_title where title_name='".$this->titleadd."' "; } $result=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($result); $this->dbobj->db_close(); return $count; } function countRow() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_agent"; //echo $sql;exit; $result=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($result); $this->dbobj->db_close(); return $count; } //Checking the image size. function checkImage($size) { if($size>0) return true; else return false; } //Function for adding all the agent details into gw_agent table. function addAgent() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $phoneno=$this->phone1."-".$this->phone2."-".$this->phone3; $sql="insert into gw_agent(agent_code,title_id,first_name,last_name,cell_phone,office_extn,town,email_address,language,image_url1,image_url2,bio,date_added) values('".$this->agentcode."',".$this->title.",'".$this->firstname."','".$this->lastname."','".$phoneno."','".$this->extension."',".$this->town.",'".$this->email."','".$this->language."','".$this->imageurl1."','".$this->imageurl2."','".$this->bio."','".$this->dateadded."')"; //echo $sql;exit; $this->dbobj->db_insertData($sql); $this->dbobj->db_close(); } //function for adding a new language into gw_language table. function addLanguage() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="insert into gw_languages(language_name) values('".$this->languageadd."')"; $this->dbobj->db_insertData($sql); $this->dbobj->db_close(); } function addTitle() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="insert into gw_agent_title(title_name) values('".$this->titleadd."')"; $this->dbobj->db_insertData($sql); $this->dbobj->db_close(); } //Function for getting name for an image to store into db. function getImagename($url) { list($name,$extn)=explode(".",$url); $imageurl="agent_".$this->agentcode.".".$extn; return $imageurl; } function getImagenamethumbnail($url,$common) { list($name,$extn)=explode(".",$url); $code = $common->generatedealcode(9); $imageurl="agentthumb_".$code.".".$extn; return $imageurl; } function getImagenamebigger($url,$common) { list($name,$extn)=explode(".",$url); $code = $common->generatedealcode(9); $imageurl="agentbig_".$code.".".$extn; return $imageurl; } //Deleting an agent from gw_agent table. function deleteAgent($agentid) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select image_url1,image_url2 from gw_agent where agent_id =".$agentid; $result=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($result); $url1=$row[0]; $url2=$row[1]; $sql1="delete from gw_agent where agent_id=".$agentid." "; $this->dbobj->db_deleteData($sql1); @unlink("../../agent_image/$url1"); @unlink("../../agent_image/$url2"); $this->dbobj->db_close(); } function editLanguage() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_languages set language_name='".$this->languageadd."' where language_id=".$this->languageid." "; $this->dbobj->db_updateData($sql); $this->dbobj->db_close(); } function editTitlename() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_agent_title set title_name='".$this->titleadd."' where title_id=".$this->titleid." "; $this->dbobj->db_updateData($sql); $this->dbobj->db_close(); } function deleteLanguage($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="delete from gw_languages where language_id=".$id." "; $this->dbobj->db_deleteData($sql); $this->dbobj->db_close(); } function deleteTitle($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="delete from gw_agent_title where title_id=".$id." "; $this->dbobj->db_deleteData($sql); $this->dbobj->db_close(); } function editAgent() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $phoneno=$this->phone1."-".$this->phone2."-".$this->phone3; if(($this->imageurl1=="") && ($this->imageurl2!="")) { $sql="update gw_agent set title_id='".$this->title."',first_name='".$this->firstname."',last_name='".$this->lastname."',cell_phone='".$phoneno."',office_extn='".$this->extension."',town=".$this->town.",email_address='".$this->email."',language='".$this->language."',image_url2='".$this->imageurl2."',bio='".$this->bio."' where agent_id=".$this->agentid." "; } else if(($this->imageurl1!="") && ($this->imageurl2=="")) { $sql="update gw_agent set title_id='".$this->title."',first_name='".$this->firstname."',last_name='".$this->lastname."',cell_phone='".$phoneno."',office_extn='".$this->extension."',town=".$this->town.",email_address='".$this->email."',language='".$this->language."',image_url1='".$this->imageurl1."',bio='".$this->bio."' where agent_id=".$this->agentid." "; } else if(($this->imageurl1!="") && ($this->imageurl2!="")) { $sql="update gw_agent set title_id='".$this->title."',first_name='".$this->firstname."',last_name='".$this->lastname."',cell_phone='".$phoneno."',office_extn='".$this->extension."',town=".$this->town.",email_address='".$this->email."',language='".$this->language."',image_url1='".$this->imageurl1."',image_url2='".$this->imageurl2."',bio='".$this->bio."' where agent_id=".$this->agentid." "; } else { $sql="update gw_agent set title_id='".$this->title."',first_name='".$this->firstname."',last_name='".$this->lastname."',cell_phone='".$phoneno."',office_extn='".$this->extension."',town=".$this->town.",email_address='".$this->email."',language='".$this->language."',bio='".$this->bio."' where agent_id=".$this->agentid." "; //$sql="update gw_agent set first_name='".$this->firstname."',last_name='".$this->lastname."',town='".$this->town."',state='".$this->state."',country='".$this->country."',zip='".$this->zip."',phone='".$this->phone."',email_address='".$this->email."',language='".$this->language."',image_url='".$this->imageurl."',bio='".$this->bio."' where agent_id=".$this->agentid." "; } //echo $sql;exit; $this->dbobj->db_updateData($sql); $this->dbobj->db_close(); } function setUnfeatured() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_agent set featured=0 where agent_id=".$this->getAgentid(); //echo $sql;exit; $this->dbobj->db_updateData($sql); $this->dbobj->db_close(); } function setFeatured() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); //$size=sizeof($_SESSION["featured"]); //for($i=0;$i<$size;++$i) //{ //if(is_numeric($_SESSION["featured"][$i])) //{ $sql="update gw_agent set featured=1 where agent_id=".$this->getAgentid(); $this->dbobj->db_updateData($sql); //} //echo "
".$_SESSION["featured"][$i]; //} //exit; //echo $sql;exit; $this->dbobj->db_close(); } function setSessionfeatured() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select agent_id from gw_agent where featured=1"; //echo $sql; $res=$this->dbobj->db_selectData($sql); session_register("featured"); $i=0; while($row=$this->dbobj->db_fetchrows($res)) { $_SESSION["featured"][$i]=$row["agent_id"]; ++$i; } } //Function for setting agent values back to the page its self function agentExists($action,$msgcode) { echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; //echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; } //function collecting all the languages. function languageDisplay($id,$name) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select language from gw_agent"; $res=$this->dbobj->db_selectData($sql); $arr=array(); $i=0; while($row2=mysql_fetch_array($res)) { $body=$row2['language']; $body1=explode(",", $body); $body1Count = count($body1)-1; $body1Start = 0; do { $key = array_search($body1[$body1Start], $arr); if(!(array_keys($arr,$body1[$body1Start]))) { array_push($arr,$body1[$body1Start]); } $i+=1; $body1Start = $body1Start + 1; }while ($body1Count >= $body1Start); } echo ""; } function getLanguages() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select language from gw_agent where agent_id=".$this->getAgentid(); $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); $lang1=explode(",",$row["language"]); $lang2=array(); for($i=0;$i"; echo ""; $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select office_id,city from gw_agent_office ORDER BY city"; $res=$this->dbobj->db_selectData($sql); while($row=$this->dbobj->db_fetchrows($res)) { if($id==$row["office_id"]) { echo ""; } else echo ""; } echo ""; } function stateDisplay($id) { echo ""; } function languageSelect() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select language_id,language_name from gw_languages ORDER BY language_name"; $res=$this->dbobj->db_selectData($sql); $i=0; $lan=array(); while($row=$this->dbobj->db_fetchrows($res)) { $lan[$row[1]]=$row[0]; } return $lan; } function countryDisplay($id) { echo ""; } //This is a mail function for contact an agent. function mailContactagent() { $from = $_POST["txtemail"]; $to=$this->getEmail(); #-- form fields-- $smtpval = "localhost"; ini_set("SMTP",$smtpval); ini_set("sendmail_from",$from); #headers-------- $subject = "User Mail"; $headers = "From: $from \n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=iso-8859-1\r\n"; $message="User Mail"; $message.="
Sender ".$_POST["txtname"]; $message.="
Message ".$_POST["txtmsg"]; $message.="

"; $message.="

"; $message.=""; mail($to, $subject, $message,$headers); } ///////////////////////////////////// CLIENT SIDE STARTS HERE //////////////////////////////// function getFeaturedagentid() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select agent_id from gw_agent where featured=1"; $res=$this->dbobj->db_selectData($sql); $i=0; while($row=$this->dbobj->db_fetchrows($res)) { $this->feturedagent[$i]=$row["agent_id"]; $i++; } $this->dbobj->db_close(); } function checkAgentid($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select * from gw_agent where agent_id=".$id." "; $res=$this->dbobj->db_selectData($sql); $count=$this->dbobj->db_countRows($res); $this->dbobj->db_close(); return $count; } function getAllagent() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select agent_id,CONCAT(CONCAT(first_name,' '),last_name) AS Name from gw_agent"; $res=$this->dbobj->db_selectData($sql); $agent=array(); while($row=$this->dbobj->db_fetchrows($res)) { $agent[$row["agent_id"]]=$row["Name"]; } return $agent; $this->dbobj->db_close(); } function getAgentTitles() { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select title_name,title_id from gw_agent_title ORDER BY title_name"; $res=$this->dbobj->db_selectData($sql); $agent=array(); while($row=$this->dbobj->db_fetchrows($res)) { $agent[$row["title_id"]]=$row["title_name"]; } return $agent; $this->dbobj->db_close(); } function checkTitle($t1,$t2) { if(strcmp($t1,$t2)!=0) { return true; } return false; } function editTitle($t1,$t2) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="update gw_agent_title set title_name='".$t2."' where title_name='".$t1."'"; $res=$this->dbobj->db_insertData($sql); $this->dbobj->db_close(); } function insertTitle($t1) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="insert into gw_agent_title (title_name) values('".$t1."')"; $res=$this->dbobj->db_insertData($sql); $this->dbobj->db_close(); } function getAgenttitlename($id) { $this->dbobj->db_connect($this->db_host,$this->db_user,$this->db_pass,$this->db_name); $sql="select title_name from gw_agent_title where title_id=".$id.""; $res=$this->dbobj->db_selectData($sql); $row=$this->dbobj->db_fetchrows($res); return $row["title_name"]; } } ?>