OpenRealty README
v. 2.6
by Jon Roig (


(Thus, you will avoid my wrath when you ask a question answered in this FAQ)


Please post all comments, questions, etc... to the message board and I will respond as quickly as possible. Also, you might try reading through the posts -- your question may be answered already.

1. Download OpenRealty. Unzip the file.
2. Create a new folder on your server.
3. Configure and set parameters (explained below).
4. Upload the contents of the zip file to your server.
5. Create and configure your mySQL tables (also explained below).
6. That's it!


1. MySQL
2. PHP 4.0 (If you're curious about what version you have, run the phpinfo.php script which comes with this release)
3. Apache Web Server for Linux (Others may be possible, but have not been tested)

* Mostly code cleanup -- should now be compatible with non-linux and non-apache based systems!
* No database upgrade is required if you're currently a user of version 2.5x

Changes History -- Version 2.5x
-->Major Revisions:
* Completely new, database-driven image management system
* Ability to handle several agents at once and an admin mode to
* Improved interface
* Template-driven HTML pages
* More feature fields -- including square footage and property size

-->Backend code fixes
* Closed mySQL connections at the end of every page. This seems important for scalablilty.
* Change of 'localhost' to a variable defined in the common.php file.(Way more flexible. Default will still be localhost.
* Addition of limits to how many pictures a property can have or an agent can post. Defined in the common.php shared file.
* Ability to recognize returns in the comment fields -- so, the agent won't have to worry about an HTML at all.
* New image management solves all the jpg/png/gif problems. I'm investigating the use of auto-thumbnailing capabilities in PHP, but am not sure if that'll go in the next version
* The code strips out decimal points when searching by price. Interface changes to help control user input.
* Select listing for Washington, DC in 'states' list
* Stashed admin tools in their own directory
* Lots of little bug fixes and corrections

logout.php -- this is ends your session, so you can log in as another user. Handy for troubleshooting problems.
emailpass.php -- if a user puts in the wrong password, they need their password sent to their email address
propview.php -- the main property viewing script. views both multiple listings and single listings
accountedit.php -- allows users to edit their own accounts
common.php -- shared file that hosts many of the global settings
addagent.php -- allow users to add agent listings
agentadmin.php -- allow users to administer their listings
agent_image.php -- pulls the image of an agent out of the database
browse.php -- sets up the various ways to search the database
agentdisplay.php -- displays information about a given agent
friendmail.php -- allows users to email information about a listing to a friend
image.php -- pulls an image of the house out of the database
index.php -- the main index page. includes a sample of how to integrate featured listings
openrealty_readme.html -- this file.

admin/admin.php -- the main administrator tool. allows a single user to edit all properties
admin/agenteditor.php -- allows the main administrator access to all agent data
admin/configurator.php -- the main setup tool. should automatically set up openrealty
admin/upgradasaurus.php -- upgrades an older version of openrealty up to the newest
admin/phpinfo.php -- when in doubt, run phpinfo.php to reveal details about your system and setup

images/equalhousing.gif -- the equal housing icon found in the bottom left corner of the sample
images/nophoto.gif -- the example "no photo available" image

templates/user_bottom.html -- bottom part of the sample template
templates/user_top.html -- top part of the sample template

(you're on your own if you want to change aesthetic elements)

File: What to change:
There is only one file that needs to be modified:
//common include file

//mysql database setup
$user = "db_user";
$password = "db_password";
$db = "realestate_db";
$server = "localhost";

$openadmin = "$user";
$openpassword = "$password";

//used mostly for the email a friend function...
//but may come in handy elsewhere.
$baseurl = "";
$yourname = "Your Name";
$youremail = "Your Name";

//number of properties to list at once:
$properties_per_page = 10;

//use linefeed in description fields 'Y' or 'N'
$linefeeds = "Y";

//maximum number of imges for a given agent
$max_agent_images =1;

//can agents decide to feature a property? 'Y' on 'N'
$agent_feature = "N";

//how large can an agent image be? (n bytes)
$max_agent_upload = 1000000;

//use yahoo maps? 'Y' or 'N'
$yahoomaps = "Y";

//use email-a-friend option? 'Y' or 'N'
$friendmail = "Y";

//maximum numer of images for one property
$max_images = 6;

//use virtual tour URL? 'Y' or 'N'
$show_tour = "Y";

//max size of property images (in bytes)
$max_prop_upload = 1000000;

//use country? 'Y' or 'N'
$use_country = "N";

(If you're looking for a true primer on mySQL, this probably isn't the place)

1. Create the database using this mySQL command from within the mySQL command line interface:
CREATE DATABASE realestate_db;
... this was impossible to automate, as some hosting services restrict the naming of databases.
2. Make sure your common.php file is configured correctly (as defined above)
3. Run the configurator by going to
It should take care of all the configuration for you, and create a sample listing.
if not, you can do this by hand by typing "mysql realestate_db < ./admin/configurator.sql" (without the quotes, of course). It is highly recommended that you remove configurator.php, configurator.sql, and upgradasaurus.php from your site when not in use.
Also, sometimes, if you're using a program like phpMyAdmin, you need to add the lines one at a time... sometimes with a ; after each line as well. Play around with it...

* I'm running an older version of OpenRealty. Can I upgrade?
Absolutely. Just run the upgradasaurus.php program in the admin folder. It should upgrade your database. You should not lose any data in the process, although you will have to re-upload images. Users of version 2.5x shouldn't have to do any database upgrade to use version 2.6

* Where can I go for help with this?
Drop by our discussion forums at for help with any issues. I also post new developments there. As I work quite a bit at a fulltime job, please DO NOT email me with questions -- I will not have time to answer them.

* Can you redesign this program to work as a general classifieds ads program?
I get this one a lot. It's possible that someone could, although I've optimized it to work specifically for real estate listings. The same general principals would certainly apply, though.

* Is this program really free?
It sure is. My landlord is a nice guy and a reasonably intelligent individual, but he's not a computer guy. Basically, he needed a convenient way to list properties on his website, so I built this program for him. I couldn't see any reason not to release it to the general public, so I've done just that. You are free to do whatever you like with it, but if you find it useful, drop me a line and let me know.

* Are you planning further revisions on this program?
I am currently planning to do one further revision on this to convert the code over to Object Oriented Programming standards. Users of the most current version won't notice any difference, I'm just going to make the code a bit prettier.

* Is it possible to add more than one picture to a listing?
Yes! You can put HTML into your preview description and full description. Just link to images from there like you'd link to any other images.

* There are a whole bunch of fields I don't care about -- i.e. MLS#, agent, neighborhood, etc... can I get rid of them?
If you leave those fields blank, no information will appear. As a user, you'd never know they were even there. Play around with it to see how it works.

* I want to customize OpenRealty -- what advice do you have?
Make a copy first. I've tried to make OpenRealty really easy to play with, if you're so inclined. 'Course, I am also available to do various types of custom coding as well, so if you need those kinds of services, send me email. That said, if you're familiar with HTML, take a shot at customizing it yourself. I've documented a big chunk of the code, so it shouldn't be too hard to figure out what various pieces do. Although several people have suggested that I integrate some kind of template system into OpenRealty, I decided against this. The user really only sees a handful of actual pages, so it seemed kind of silly. In browse.php and propview.php, I've marked the placement of the header and footer parts of the HTML. Happy hacking!

* No offense, but I don't like your browse.php page. How can I link to specific queries within the database?
None taken. Feel free to experiment with code you appropriate from that page -- it's there as an example. Here are some cut and paste examples of how to structure searches:

* I have multiple agents running on one computer. How do I logout?
Just add a link in your template to logout.php. That should close out the session...

* Is there a version that works with PHP3?
NO! UPGRADE TO THE NEW VERSION!!!! AGGGGGHHHHHGGHGH (sorry -- I get this question constantly.) It's not like PHP4 is new or anything, and it's not like it's not a stable program.

To list all properties, just go to propview.php without any variables:

To list all properties of a certain type (Residential/Condo/Rental/etc...):

To list all properties within a specific city:
(remember that all spaces should be replaced with %20, so San Francisco would be San%20Francisco)

To list all properties with a certain status (active/pending/sold):

To list all the properties within a given neighborhood:

To list all the properties listed by a particular agent:

...etc... feel free to mix and match those properties as needed.

use these if you have trouble with the configurator:
CREATE TABLE agents (id int NOT NULL AUTO_INCREMENT, PRIMARY KEY (id), agent VARCHAR (30), agentpass VARCHAR (10), agenturl VARCHAR (70), agentemail VARCHAR (70), notes TEXT, agentphone VARCHAR(30), agentcell VARCHAR(30), agentfax VARCHAR (30) )

CREATE TABLE agent_tbl_Files (id_files int not null auto_increment, PRIMARY KEY (id_files), bin_data longblob not null, description tinytext, filename VARCHAR (50), filesize VARCHAR (50), filetype VARCHAR (50), agentnum int, owner int )

CREATE TABLE tbl_Files (id_files int not null auto_increment, PRIMARY KEY (id_files), bin_data longblob not null, description tinytext, filename VARCHAR (50), filesize VARCHAR (50), filetype VARCHAR (50), prop_num int, owner int)

CREATE TABLE homes (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id), title VARCHAR (250), address VARCHAR (250), city VARCHAR (50), state VARCHAR (20), zip VARCHAR (20), price int, previewdesc TEXT, fulldesc TEXT, type VARCHAR (20), imageloc VARCHAR (50), beds int, baths FLOAT, status VARCHAR (10), featured VARCHAR (1), mls VARCHAR (20), dateposted DATE, neighborhood VARCHAR (50), agent VARCHAR (30), agenturl VARCHAR (30), air VARCHAR (1), alrm VARCHAR (1), bcny VARCHAR (1), cbl VARCHAR (1), crp VARCHAR (1), dw VARCHAR (1), dsp VARCHAR (1), fire VARCHAR (1), gas VARCHAR (1), hdwd VARCHAR (1), mw VARCHAR (1), onw VARCHAR (1), pto VARCHAR (1), wadr VARCHAR (1), wc VARCHAR (1), fee VARCHAR (1), bp VARCHAR (1), boat VARCHAR (1), clb VARCHAR (1), gtd VARCHAR (1), crt VARCHAR (1), fit VARCHAR (1), ong VARCHAR (1), pw VARCHAR (1), pool VARCHAR (1), pt VARCHAR (1), spa VARCHAR (1), spo VARCHAR (1), tns VARCHAR (1), notes TEXT, agentemail VARCHAR (30), owner int, numfloors VARCHAR (30), yearbuilt int, sqfeet int, lotsize VARCHAR (30), garagesize VARCHAR (30), proptax int, country VARCHAR (30), virtualtour VARCHAR (60) )

Version 2.6 update (3-18-01):

Version 2.5.1 update (2-28-01):


Version 2.5 update (2-20-01):

From: (Jon Roig)
Newsgroups: gated.mysql.misc
Subject: Size of database vs. performance?
Date: 15 Feb 2001 23:00:01 +0100
Lines: 24
Message-ID: <>
References: <004f01c09785$05ac5b00$>
Mime-Version: 1.0
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit
X-Trace: 982274401 28260 (15 Feb 2001 22:00:01 GMT)
Mailing-List: contact; run by ezmlm (
X-Received: (qmail 6388 invoked from network); 15 Feb 2001 22:59:18 +0100
X-Received: from (HELO (
  by with SMTP; 15 Feb 2001 22:59:18 +0100
X-Received: from ([]:3080 "HELO" ident:
	"TIMEDOUT2") by with SMTP id < S531832AbRBOV7I>;
	Thu, 15 Feb 2001 22:59:08 +0100
X-Received: (qmail 27419 invoked by uid 7797); 15 Feb 2001 20:36:22 -0000
X-List-ID: <>
X-Precedence: bulk
X-List-Help: <>
X-List-Unsubscribe: <>
X-List-Post: <>
X-List-Subscribe:	<>
X-Delivered-To: mailing list
X-Received: (qmail 27399 invoked from network); 15 Feb 2001 20:36:22 -0000
X-User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.02.2022
X-To:	Mysql <>
X-In-Reply-To: <004f01c09785$05ac5b00$>

Hey folks...

quick question -- are there any performance issues associated with databases
of extremely large size?

I'm not talking about hundreds of thousands of records to be searched -- I'm
talking about a few hundred images being stored in a database. It's not like
I'd be full text searching or sorting them, or anything like that...

Thanks a lot,
    -- jon

Before posting, please check:   (the manual)           (the list archive)

To request this thread, e-mail 
To unsubscribe, e-mail 
Trouble unsubscribing? Try:

Newsgroups: fm.announce
Subject: OpenRealty 1.1 - A real estate listing database implemented in PHP and mySQL.
Date: 15 Jan 2001 23:21:52 GMT
Lines: 22
Approved: (Patrick Lenz)
Message-ID: <9400mg$t3u$>
X-Trace: 979600912 29822 (15 Jan 2001 23:21:52 GMT)
NNTP-Posting-Date: 15 Jan 2001 23:21:52 GMT

 application: OpenRealty 1.1
      author: Jon Roig
     license: OpenSource
    category: Web/Database
     urgency: low


OpenRealty is a real-estate management system written in PHP. With it,
one can add, modify, and delete listings. It includes a built-in image
manager to allow photos to be uploaded via a web browser.

New ability to browse listings, new MLS numbers, ability to define
certain listings as 'featured listings that appear on the main page,
cleanups to the configuration file and admin interface, and an ability
to email listings to friends.


Copyright 2001