Please enter your user name and password:

"; print "Login Name:

"; print "Password:

"; print "

Enter your Email address to get your password emailed to you:

"; include("./templates/user_bottom.html"); exit; } elseif ($agentname != "" OR $current_user != "") { $sql = "SELECT id FROM agents WHERE agent='$agentname' and agentpass='$agentpassword'"; $result = mysql_query($sql) or die("Couldn't execute query."); $num = mysql_numrows($result); if ($num == 1) { session_register("agentname"); session_register("agentpassword"); echo "\r\n"; print "\r\n"; session_register("current_user"); session_register("agent"); session_register("agenturl"); session_register("agentemail"); //COLLECT INFORMATION ABOUT THE CURRENT USER $result = mysql_query("SELECT * FROM agents WHERE agent='$agentname';",$link); while ($a_row =mysql_fetch_array ($result) ) { $current_user = $a_row[id]; $agent = $a_row[agent]; $agenturl = $a_row[agenturl]; $agentemail = $a_row[agentemail]; } print "\r\n\r\n"; } else if ($num == 0) { include("./templates/user_top.html"); echo 'That login/password combination is incorrect.

'; print "

Please enter your user name and password:

"; print "Login Name:

"; print "Password:

"; print "

Enter your address to get your password emailed to you:

"; include("./templates/user_bottom.html"); exit; } } //print the header print "\r\n"; include("./templates/agent_top.html"); //ERRORS AND STATUS DISPLAY IN THE BOX //DELETE A RECORD if ($delete != "") { $query = "DELETE FROM homes WHERE ((id = '$delete') AND (owner = $current_user))"; if (!mysql_query ($query, $link) ) { die (mysql_error()); } print "Listing #$delete has been removed..."; $query = "DELETE FROM tbl_Files WHERE ((prop_num = '$delete') AND (owner = '$current_user'))"; if (!mysql_query ($query, $link) ) { die (mysql_error()); } print "Images for property #$delete have also been removed..."; } //DELETE AN IMAGE if ($deleteimage != "") { $query = "DELETE FROM tbl_Files WHERE ((id_files = $deleteimage) AND (owner='$current_user'))"; if (!mysql_query ($query, $link) ) { die (mysql_error()); } print "$filename has been removed..."; } if ($action == "upload") { if (isset($binFile) && $binFile != "none") { $data = addslashes(fread(fopen($binFile, "r"), filesize($binFile))); $strDescription = addslashes(nl2br($txtDescription)); $sql = "INSERT INTO tbl_Files "; $sql .= "(description, bin_data, filename, filesize, filetype, owner, prop_num) "; $sql .= "VALUES ('$strDescription', '$data', "; $sql .= "'$binFile_name', '$binFile_size', '$binFile_type', '$current_user', '$propnum')"; if (!mysql_query ($sql, $link) ) { die (mysql_error()); } echo "Your image has been added ($binFile_name)."; } } //MODIFY A RECORD if ($modify != "") { print "editing field $modify..."; //add slashes to input so things don't get fucked up in mySQL $title = addslashes($title); $address = addslashes($address); $city = addslashes($city); $previewdesc = addslashes($previewdesc); $fulldesc = addslashes($fulldesc); $neighborhood = addslashes($neighborhood); $notes = addslashes($notes); //strip extra characters out of the price $price = ereg_replace("[^[:alnum:]]","",$price); $sqfeet = ereg_replace("[^[:alnum:]]","",$sqfeet); $proptax = ereg_replace("[^[:alnum:]]","",$proptax); //formats the description text, if necessary if ($linefeeds == "Y") { $previewdesc = ereg_replace("(\r\n|\n|\r)", "
", $previewdesc); $fulldesc = ereg_replace("(\r\n|\n|\r)", "
", $fulldesc); } $query = "UPDATE homes SET title = '$title', address = '$address', city = '$city', state = '$state', zip = '$zip', price = '$price', previewdesc = '$previewdesc', fulldesc = '$fulldesc', type = '$type', imageloc = '$imageloc', beds ='$beds', baths='$baths', status='$status', featured='$featured', mls='$mls', neighborhood='$neighborhood', agent='$agent', agenturl='$agenturl', agentemail='$agentemail', air = '$air', alrm = '$alrm', bcny = '$bcny', cbl = '$cbl', crp = '$crp', dw = '$dw', dsp = '$dsp', fire = '$fire', gas = '$gas', hdwd = '$hdwd', mw = '$mw', onw = '$onw', pto = '$pto', wadr = '$wadr', wc = '$wc', fee = '$fee', bp = '$bp', boat = '$boat', clb = '$clb', gtd = '$gtd', crt = '$crt', fit = '$fit', ong = '$ong', pw = '$pw', pool = '$pool', pt = '$pt', spa = '$spa', spo = '$spo', tns = '$tns', notes = '$notes', owner = '$current_user', yearbuilt= '$yearbuilt', sqfeet = '$sqfeet', lotsize= '$lotsize', numfloors = '$numfloors', garagesize = '$garagesize', proptax = '$proptax', country = '$country', virtualtour = '$virtualtour' WHERE ((id='$modify') AND (owner = $current_user))"; if (!mysql_query ($query, $link) ) { die (mysql_error()); } print "Listing #$modify has been updated..."; } //ADD A RECORD if ($action=="add") { // code here $listinfo = listinfo($agent, $link); $listcount = listcount($current_user, $link); if ($listinfo > $listcount) { $dberror = ""; //add slashes to input so things don't get fucked up in mySQL $title = addslashes($title); $address = addslashes($address); $city = addslashes($city); $previewdesc = addslashes($previewdesc); $fulldesc = addslashes($fulldesc); $neighborhood = addslashes($neighborhood); //strip extra characters out of the price $price = ereg_replace("[^[:alnum:]]","",$price); $sqfeet = ereg_replace("[^[:alnum:]]","",$sqfeet); $proptax = ereg_replace("[^[:alnum:]]","",$proptax); if ($linefeeds == "Y") { $previewdesc = ereg_replace("(\r\n|\n|\r)", "
", $previewdesc); $fulldesc = ereg_replace("(\r\n|\n|\r)", "
", $fulldesc); } $query = "INSERT INTO homes (title, address, city, state, zip, price, previewdesc, fulldesc, type, imageloc, beds, baths, status, featured, mls, neighborhood, agent, agenturl, agentemail, air, alrm, bcny, cbl, crp, dw, dsp, fire, gas, hdwd, mw, onw, pto, wadr, wc, fee, bp, boat, clb, gtd, crt, fit, ong, pw, pool, pt, spa, spo, tns, notes, owner, yearbuilt, sqfeet, lotsize, numfloors, garagesize, proptax, country, virtualtour) values ('$title', '$address', '$city', '$state', '$zip', '$price', '$previewdesc', '$fulldesc', '$type', '$imageloc', '$beds', '$baths', '$status', '$featured','$mls', '$neighborhood', '$agent', '$agenturl', '$agentemail', '$air', '$alrm', '$bcny', '$cbl', '$crp', '$dw', '$dsp', '$fire', '$gas', '$hdwd', '$mw', '$onw', '$pto', '$wadr', '$wc', '$fee', '$bp', '$boat', '$clb', '$gtd', '$crt', '$fit', '$ong', '$pw', '$pool', '$pt', '$spa', '$spo', '$tns', '$notes', '$current_user', '$yearbuilt', '$sqfeet', '$lotsize', '$numfloors', '$garagesize', '$proptax', '$country', '$virtualtour')"; if (!mysql_query ($query, $link) ) { die (mysql_error()); } print "Your listing has been added..."; //code here } else echo "Your listing was not added: your outta limit..."; } //THUS ENDS THE STATUS AREA... ?>

Preview Listing
"; $result = mysql_query("SELECT * FROM homes WHERE ((id='$edit') AND (owner = '$current_user'));",$link); while ($a_row =mysql_fetch_array ($result) ) { $propnum = $a_row[id]; //strip slashes so input appears correctly $a_row[title] = stripslashes ($a_row[title]); $a_row[address] = stripslashes($a_row[address]); $a_row[city] = stripslashes($a_row[city]); $a_row[previewdesc] = stripslashes($a_row[previewdesc]); $a_row[fulldesc] = stripslashes($a_row[fulldesc]); $a_row[neighborhood] = stripslashes($a_row[neighborhood]); $a_row[notes] = stripslashes($a_row[notes]); //format description fields appropriately if ($linefeeds == "Y") { $a_row[previewdesc] = ereg_replace("
", "\r\n", $a_row[previewdesc]); $a_row[fulldesc] = ereg_replace("
", "\r\n", $a_row[fulldesc]); } print "

"; print "
"; print "
"; //select images connected to a given listing $query = "SELECT * FROM tbl_Files WHERE prop_num = $propnum"; $result = mysql_query("$query",$link); $num_images = 0; while ($image_row =mysql_fetch_array ($result) ) { echo "

\n"; echo "$image_row[filename]
\n"; echo "$image_row[filetype] (Size $image_row[filesize])

\n"; echo "Click to Enlarge
"; echo stripslashes($image_row[description]) . "

\n"; echo "delete image


"; $num_images++; } print "
"; print ""; print ""; print ""; print ""; if ($use_country == "Y") { print ""; } print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; if ($agent_feature == "Y") { print ""; } else { print " "; } print ""; if ($show_tour == "Y") { print ""; } print ""; print ""; print ""; print ""; print "
title:
address:
city:
State: "; print ""; print "
country:
zip:
neighborhood: "; print "
price: .00
preview description:
full description:
Type: "; print " "; Print "
beds:
baths:
number of floors:
year built:
square feet:
lot size:
garage size:
annual prop tax:
Status:
featured:"; print "
other info:
virtual tour url:
Seller: $a_row[agent]
Notes:
(Not visible to users)
"; print "
Please mark whichever features apply:"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
"; print "HOME FEATURES"; print ""; print "COMMUNITY FEATURES"; print "
"; print "Balcony
"; print "Patio/Deck
"; print "Waterfront
"; print "
"; print "Dishwasher
"; print "Disposal
"; print "Range
"; print "Microwave
"; print "Washer/Dryer
"; print "
"; print "Carpeted Floors
"; print "Hardwood Floors
"; print "
"; print "Air Conditioning
"; print "Alarm
"; print " Cable/Satellite TV
"; print "Fireplace
"; print "Wheelchair Access
"; print "
"; print "Fitness Center
"; print "Golf Course
"; print "Pool
"; print "Spa/Jacuzzi
"; print "Sports Complex
"; print "Tennis Courts
"; print "
"; print "Bike Paths
"; print "Boating
"; print "Courtyard
"; print "Playground/Park
"; print "
"; print "Association Fee
"; print "Clubhouse
"; print "Controlled Access
"; print "Public Transportation
"; print "
"; print "
"; print "

"; print ""; if ($num_images < $max_images) { print "

Manage Images

"; print"

"; print""; print""; print""; print""; print""; print""; print""; print""; print""; print""; print""; print""; print""; print""; print""; print"
Title:
File:
"; print"
"; print "
"; } else { print "
Maximum number of images added
"; } } } elseif ($action == "addlisting") //add a listing to the directory { //retrieve some information about the user print "
"; print "Add Listing"; print "

"; print "

"; print ""; print ""; print ""; print ""; print ""; if ($use_country == "Y") { print ""; } print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; //can agents make a listing into a featured listing? if ($agent_feature == "Y") { print ""; } print ""; if ($show_tour == "Y") { print ""; } print ""; print ""; print ""; print ""; print "
title:
address:
city:
state: "; print ""; print "
country:
zip:
neighborhood: "; print "
price: .00
preview description:
full description:
Type: "; print " "; Print "
beds:
baths:
number of floors:
year built:
square feet:
lot size:
garage size:
annual prop tax:
Status:
featured:
other info:
virtual tour url:
Seller: $agent
Notes:
(Not visible to users)
"; //define features print "Please mark whichever features apply:"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
"; print "HOME FEATURES"; print ""; print "COMMUNITY FEATURES"; print "
"; print "Balcony
"; print "Patio/Deck
"; print "Waterfront
"; print "
"; print "Dishwasher
"; print "Disposal
"; print "Range
"; print "Microwave
"; print "Washer/Dryer
"; print "
"; print "Carpeted Floors
"; print "Hardwood Floors
"; print "
"; print "Air Conditioning
"; print "Alarm
"; print " Cable/Satellite TV
"; print "Fireplace
"; print "Wheelchair Access
"; print "
"; print "
"; print "Fitness Center
"; print "Golf Course
"; print "Pool
"; print "Spa/Jacuzzi
"; print "Sports Complex
"; print "Tennis Courts
"; print "
"; print "Bike Paths
"; print " Boating
"; print "Courtyard
"; print "Playground/Park
"; print "
"; print "Association Fee
"; print "Clubhouse
"; print "Controlled Access
"; print "Public Transportation
"; print "
"; print "
"; print "

"; print "

"; print "

Once you add a listing, you may attach images.

"; } else //show all listings { //code here $listinfo = listinfo($agent, $link); $listcount = listcount($current_user, $link); Print "
There are currently $listcount properties listed.
Your limit of available listings is $listinfo.
"; if ($cur_page == "") {$cur_page = 0;} $page_num = $cur_page + 1; $total_num_page = ceil($num_rows/$properties_per_page); print "
"; if ($total_num_page != 0) { Print "This is page $page_num of $total_num_page
"; $prevpage = $cur_page-1; $nextpage = $cur_page+1; if ($page_num != 1){print "Previous Page ";} if ($page_num != $total_num_page){print " Next Page ";} } print "
"; $limit_str = "LIMIT ". $cur_page * $properties_per_page .",$properties_per_page"; $result = mysql_query("SELECT * FROM homes WHERE owner = '$current_user' $limit_str",$link); while ($a_row =mysql_fetch_array ($result) ) { //strip slashes so input appears correctly $a_row[title] = stripslashes ($a_row[title]); $a_row[address] = stripslashes($a_row[address]); $a_row[city] = stripslashes($a_row[city]); $a_row[previewdesc] = stripslashes($a_row[previewdesc]); $a_row[fulldesc] = stripslashes($a_row[fulldesc]); $a_row[neighborhood] = stripslashes($a_row[neighborhood]); print "

"; print ""; print ""; print "
listing number: $a_row[id] modify listingdelete listing
"; //select images connected to a given listing $count = 0; $query = "SELECT * FROM tbl_Files WHERE prop_num = $a_row[id] LIMIT 1"; $output = mysql_query("$query",$link); while ($image_row =mysql_fetch_array ($output) ) { echo "
"; $count++; } print ""; if ($count == 0) { print ""; } print "
$a_row[title]

$a_row[previewdesc]

\r\n\r\n"; } } //print the footer print"\r\n\r\n"; include("./templates/user_bottom.html"); //gots to close the mysql connection mysql_close($link); function listinfo ($agent, $link) { $gauta = mysql_query("SELECT listings FROM agents WHERE agent = '$agent'", $link); $data = mysql_fetch_object($gauta); return $data->listings; } function listcount ($current_user, $link) { $result = mysql_query("SELECT * FROM homes WHERE owner = '$current_user'", $link); $rows = mysql_num_rows($result); return $rows; } ?>