upbuzz: local business search enginecs.nmu.edu/~seniorprojects/bayles+hanson/bales-and-ha…  ·...

39
Northern Michigan University, Fall 2007 Upbuzz: Local Business Search Engine David Bayles & Benjamin Cody Hanson http://www.upbuzz.com

Upload: others

Post on 12-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

Northern Michigan University, Fall 2007

Upbuzz: Local Business

Search EngineDavid Bayles & Benjamin Cody Hanson

http://www.upbuzz.com

Page 2: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

Table of Contents

Introduction (David Bayles)......................................................................................Page 3

Introduction (Cody Hanson).....................................................................................Page 4

Project Overview......................................................................................................Page 5

Project Elements: Database and Hosting.................................................................Page 6

Project Elements: Authentication, Privileges and Security.......................................Page 7

Project Elements: Site Structure...............................................................................Page 8

Project Elements: Coding.........................................................................................Page 9

Project Elements: CSS and Browser Compatibility...................................................Page 10

Project Elements: Design Elements and Navigation.................................................Page 11

Project Elements: Search Engine..............................................................................Page 13

Project Elements: User / Business Registration and Setup.......................................Page 16

Project Elements: Business Account.........................................................................Page 19

Project Elements: User Account...............................................................................Page 21

Project Elements: Administrator Account................................................................Page 20

Website Maintenance and Customer Service..........................................................Page 23

Major Problems, Solutions and New Features.........................................................Page 24

Conclusion................................................................................................................Page 25

Appendix..................................................................................................................Page 26

Page 3: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

Introduction (David Bayles)

Ever since I came to NMU in the Fall of 2003, I have probably had the same decisions

and experiences that many other students have had. I came in knowing that I liked computers

and that I would like to major in something that had to do with them. Computer Science was

my first pick but I quickly switched over to Network Computing because of the freedom it

seemed to give me with what type of classes I could take. I really took interest in the

networking and more web oriented classes that dealt with server administration, PHP and

database work. Near the end of my college career I really started to take interest in web design

too and now regret that I didn’t take more of the web design classes. I plan to continue my

interest and work in web design/development after I am finished with NMU.

This project was made possible by an NMU employee by the name of Lee Francisco.

About halfway through my first semester at NMU I was offered a job to work at Micro Repair.

Cody Hanson was already working there and told the manager that I’d be a good candidate to

work on the laptops. As I worked there for the next two years I learned a lot about computer

hardware and customer service. I also got to know Lee Francisco, who is the asset

manager/programmer for Micro Repair, a lot better. At the end of 2005 I was asked to be a

part of a company he was starting called 906 Technologies. I’ve worked there ever since on

web projects and hardware repairs. The project that we are presenting to you was one of his

ideas. Upbuzz.com has evolved and is still continually changing as we get new input and new

ideas on what will make the process of local business to customer interaction better. This

project has been by far the most valuable experience I have had so far involving web design and

development. The problems we encountered, criticism, setbacks and long hours that we

endured have made us more ready for our post college careers.

Page 4: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

Introduction (Benjamin Cody Hanson)

I am a senior here at Northern Michigan University, coming here in the Fall of 2003 to

play Football. I chose Network Computing because I liked the concept of the program, an

emphasis on computers, technology, etc. with little required Math. As weird as it is, I can

program all day in various languages, but I can’t do Math to save my life. Some say it’s the

same concept, but I beg to differ. I learned a lot here at NMU from taking courses such as

Windows Programming, Network Programming, Programming in Flash, Web Applications

Programming, Database Management, etc, with instructors who made my learning interesting

and unique. I chose these courses and Degree because I’m very interested in the Web and

where it can take me. The possibilities are limitless. Along the way, I learned many different

languages (PHP, MySQL, C++, C#, AJAX, Javascript, Java, Oracle, Visual Basic) of which my

favorite came to be PHP, due to the fact you can use it with almost any web language, its

secure and you can do practically anything with it.

During my tenure here at NMU, I have worked a few computer oriented jobs. I worked

at Micro Repair (Northern’s Computer Repair) as a Laptop and PC technician, until I was

promoted, where I then did most of the Work-orders around campus as well as some

programming for various NMU projects (Asset Management System for example). While at

Micro Repair, I was fortunate enough to earn several Certifications such as A+ and numerous

IBM certifications. After my third year at Micro, I was asked by Lee Francisco to help start a

company called 906 Technologies. In the beginning I was involved with the Computer Repair

aspect of the company, but was later moved to just Web Programming. Dave Bayles, Nathan

Lampi, and I are the team behind all of 906’s web projects. About a year ago, Lee Francisco

approached us with the idea of “a small business search engine” and the reward of a

partnership in it. Intrigued from the start, we began programming a fully dynamic website,

adding features and idea’s every step of the way. After thousands of hours of programming,

not to mention numerous redrafts of site functions, we have a beta site we can now offer to the

public. I am very proud to be part of this project, and can only hope that the idea and site are

designed well enough to take off.

Page 5: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

Project Overview

We decided on upbuzz as our Senior Project because we knew that it would benefit us

in two ways, one being we complete a Senior Project, and two being we could enhance the

features upbuzz has to offer and build on what we had. The general idea behind upbuzz was

developed in the winter of 2006 and since then we haven’t stopped working on it. A small

business search engine that will link the local community to its businesses, providing a web

presence for all businesses and an online community for every day users. We set out to offer

small businesses who couldn’t afford a website, a free template where they can establish a web

presence. Additionally, we would offer features customizable to each business such as an

Online Menu or Photo Gallery. We also knew that we had to create an environment that users

would want to come back to every day. With that in mind, we created the welcome page, and

with it a message center, friends and favorite networks.

Since both of our focuses during our tenure here at Northern has been in Web

Development, we knew that making this our Senior Project was the right choice. With it, we

could showcase and develop further our knowledge and talents, ranging from CSS design and

programming to database management. Upbuzz has undergone many different designs, both

graphic and structurally. The original upbuzz was an idea that wasn’t as good as the current

version we have now. Along the way we kept thinking of new ideas that would set upbuzz

apart from the rest, and then we would build on that.

Page 6: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

Project Elements

Database and Hosting

Hosting is a small but very important part of our site. We are involved with a private

company that supplies us with good bandwidth, a powerful server, and the freedom to

do whatever we want with the database and server. By far the most important part of

our site is the database. We use a database that is MySQL version 4.1.120 managed by

phpMyAdmin 2.7.0, a web-based application that allows us to do basically anything to

our database. To date, there are 55 tables that compose the upbuzz structure. Below is

a basic diagram of a few of the main tables.

It is very important for us to design our tables as precise as possible. Upbuzz makes at

least one database call, or query, per page load. Having a good table structure allows

our site to be very fast and efficient with data retrieval.

Upbuzz focuses on a few different main tables that are very important to the overall

function of our site. Perhaps the most important tables are buzz_zip_codes,

buzz_keyword, buzz_client and buzz_client_to_keyword, which power the search

Page 7: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

engine. When you type in an item in the search box, our queries access the keyword

table looking for a close, if not, exact match. When it finds that match, it grabs the

keywordID which is our way of identifying each unique keyword. We then look in the

client_to_keyword table where we grab all of the businesses (unique businessID’s) who

have that KeywordID associated with them, as well as the same zip code or one within a

certain distance. We do one more query that will take all of the businessID’s and display

the information associated with each. Our buzz_zip_codes table is one of the most

important tables since it houses all distance and location information. It holds the zip

code, city, state, longitude, latitude, county, area code, country, city abbreviation, city

alias, and time zone of virtually every location in North America. We can use this

information to provide localized search results according to the users input.

Authentication, Privileges and Security

When we first set out on this project, we decided that PHP would be the best language

for us since its reliable, safe and secure, fast, stable, and runs on the server side. With

PHP, we use sessions which allow us to keep data available for us to use throughout the

site, such as the user’s ID, name, zip code, and such. We keep no information in a

session that could be considered “private”. When the user logs in, the session is created

with some of the elements mentioned above, as well as a “privilege” session variable

that helps determine if the user is of the general public, a business, or an administrator,

as well as what pages we choose to display. Below is a section of the login script

(accesscontrol.php) that is called upon every login and each page load to determine if

the user is logged in, and if so, what are his/her privileges.

<?phpinclude_once 'db.php';session_start();$logged=false;if(($_GET['logout']=="true" || $_GET['action']=="logout") && isset($_SESSION['uid'])) {

$_SESSION = array();if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/');}session_destroy();$logged=true;

}

Page 8: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

$_SESSION['cur_table'] = "buzz_users";if(isset($_POST['uid'])) { $uid = $_POST['uid']; }if(isset($_POST['pwd'])) { $pwd = $_POST['pwd']; }

// Userid is set, continue verificationif(!isset($_SESSION['uid']) && isset($uid) && isset($pwd)) {

$uid = trim(strtolower($uid));$pwd = trim($pwd);dbConnect();$sql = "SELECT * FROM `".$_SESSION['cur_table']."` WHERE active='1' AND user_ID = '".mysql_real_escape_string($uid)."'

AND user_pass = PASSWORD('".mysql_real_escape_string($pwd)."')";$result = @mysql_query($sql);if (!$result) {

$_SESSION = array();$_SESSION['error']="Sorry, a database error has occured";header("Location: http://www.upbuzz.com/login.php");exit;

}if (@mysql_num_rows($result) == 0) {

$_SESSION = array();$_SESSION['error']="Incorrect username/password";header("Location: http://www.upbuzz.com/login.php");exit;

}// Set the variables to be used later$row = @mysql_fetch_array($result);$_SESSION['uid'] = $uid;$_SESSION['user_ID'] = $row['ID'];$_SESSION['first_name'] = stripslashes($row['first_name']);$_SESSION['last_name'] = stripslashes($row['last_name']);$_SESSION['city'] = $row['city'];$_SESSION['state'] = $row['state'];$_SESSION['zip'] = $row['zip'];$_SESSION['szip'] = $row['zip'];$_SESSION['email_addr'] = stripslashes($row['email']);$_SESSION['user_priv'] = $row['user_priv'];$_SESSION['account_type'] = $row['account_type'];header("Location: http://www.upbuzz.com/welcome.php");exit;

}?>

As you can see above, we safeguard our database from performing certain actions by

adding mysql_real_escape_string before the users input. This prevents a “hacker” from

trying a SQL injection attack, which can exploit security vulnerability in our database. As

stated before, we store no personal information besides their full name and zip code.

Future additions include an SSL certificate which will allow us to securely transfer

private data. This will allow upbuzz to offer many more services such as online ordering

and shopping with credit card processing.

Site Structure

Page 9: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

The site structure was created to facilitate the size of the website and allow for future

growth. All of the main site design style sheets are located in the /template folder. The

main style sheet that controls much of the design for the website is layout.css.

header.php and footer.php are also located in this folder. They are included in each

page through PHP so that whenever a change to the header or footer of the website

needs to be made, it can be as simple as editing one of these files. The /images folder in

the /template folder is the location where all of the backgrounds, icons and images that

are used through most of the website.

Another main section of site is located in the /buzzpage folder. This is where all the

images, style sheets, Javascript and PHP files are located that control how each

business’s profile looks and acts. There are the PHP files for each subpage that a

possible business could have (Home, Photo Gallery, Menu, Testimonials, etc). The files

are set up in such a way that if a business has it marked in the database that it should

have a certain page displayed, it will show up for that business.

The /businessgallery folder is filled with the images that companies upload into their

own personal gallery. The images are created with the naming structure:

companyID_categoryID_ItemID.ext. This makes it so that the files will never run into the

problem of writing over other files of the same name. It also makes the images easy to

identify because of the IDs that are used. Looking back, we should have created new

folders within this folder that were linked to their business. This would have organized

the files a little better. The same naming convention and structure was created for

the /menupictures folder, which is used for businesses that create a menu.

The /myaccount folder contains the PHP and Javascript files that have to do with the

“My Account” portion of the website. This is the place where users can edit their

business’s personal information, subpages, personal data, privacy settings and more.

Page 10: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

The /admin folder is a completely different and restricted section of the site. It has its

own limited style sheet and is restricted so that only site administrators can view it. This

is pretty much a web based backend for administrators to manipulate data that is stored

in the database.

Coding (PHP, AJAX, Javascript, XML, MySQL)

We chose to create upbuzz with PHP because it’s reliable, fast, and stable in all

browsers. We also chose it because it works great with our MySQL database. PHP

forms the base of all of our pages which are like templates, where all information is

filled in from the tables in our database. We use various Javascript on most pages for

error checking and such, while we use AJAX for instantaneous results of database

changes. For instance, to verify that the user has entered a valid email upon registering,

we ask them to type in a code that we emailed to them. After they type in this code,

they click a submit button, and the page displays instantly if validation was successful or

not. We use XML only in a few spots of the site, for RSS feeds and the weather on the

users welcome page (it displays the local weather according to their zip code on file).

The only MySQL code we use are PHP and are for database calls and manipulation.

CSS and Browser Compatibility

When we started upbuzz, CSS was something new to all of us. We knew that CSS was

required for all new legitimate websites, but like all new things, it takes some getting

used to. Browser compatibility had to be by far the hardest and most irritating obstacle

to overcome when designing the site. In the beginning, we would keep testing a design

in whatever browser we were currently using. After having a lot accomplished, we

would remember that CSS did not always work the same universally. When checked in

other browsers, it would fall apart 75% of the time. As we became more knowledgeable

about CSS and the hacks and tricks used, it wasn’t that bad. Internet Explorer 6 gave us

the most trouble, namely because it is an older browser that wasn’t made with CSS in

mind, but it still has a high percentage of users. Most of these bugs have been worked

Page 11: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

out and as the site stands now it should be compatible with Firefox, IE 6/7 and Safari.

As the development progressed, we also started to learn the importance of keeping our

CSS files neat and organized so that when we needed to find a certain section, it was

fast and effective. One trick that has saved a great amount of time is putting in

comment tags. If we ever needed to quickly find a section of the main style sheet,

opening the find function in a text editor would locate the keyword instantly. For

example, a keyword would be “=Friends”.

/* =Friends Page=============================================================================== */

#name_contain {width: 350px;

}

.friend_box {position: relative;margin: 10px 0;height: 50px;width: 500px;padding: 10px 5px;border: 1px #ccc solid;font-size: 12px;

}

The sites main CSS files are located in the /template folder for most of the site and

navigation, /buzzpage folder for the businesses profile elements and /admin for the

administration section.

Design Elements and Navigation

The main objective of the site design was to keep it clean, easy on the eyes and just

generally make the functionality as user friendly as possible. In the beginning we had

many different color combinations to build the site on, but we finally decided to go with

complimentary colors of blue and orange on a light background. The name of upbuzz

was thought up by Lee Francisco as a short word for the concept of finding what all the

buzz was about with all the Upper Peninsula businesses. As we were thinking of logos

Page 12: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

or an image for the site, we thought what most people

would think of when they hear the word “buzz”. This of

course would be a bumble bee. Dave created several

versions of this mascot and logo for the website, but we finally all agreed on the current

simple bee logo that appears on the site today. A little fun fact about the bee is that it

was created entirely of overlapping orange and white circles with the exception of one

ellipse.

The navigation for the site is pretty straightforward. The navigation bar in the header

only has two links so far. Business Search is a link to the main page. Here users can

search for a business by names or keyword, pick from a list of featured businesses or

click on a current top search keyword. Upcoming Events informs registered users if

there are any new things happening around their zip codes.

The upper right of the header always contains a mini search bar where users can search

for business or keyword in a given location no matter where they are within the site.

Above that is another list of items and links that have to do with a user’s personal

account. If someone is not registered, it was display a link for signing up. If they are

logged into an account, it will display a link to your Personal Home, My Account and a

link for signing out of their account.

The footer also contains a lot of links to other places in the site. It lists the same links

that are in the header, links for one’s personal account, customer service areas and

general information about upbuzz including contact information.

The vertical navigation system seen on the Personal Home is composed of “My

Messages”, “My Account”, “My Favorites”, “My Network” and customer services pages,

are all which are based off of the /template/nav.css style sheet. When we add a new

link to any menu, we just give that link the ID of the certain way we want it to look and it

Page 13: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

displays it with the proper icon.

.myfriends_nav a {

background-image: url(images/nav_icons/user-group.gif);

background-position: 8px .6em;

background-repeat: no-repeat;

}

.myfriends_nav a:hover {

background-image: url(images/nav_icons/user-group.gif);

background-position: 8px .6em;

background-repeat: no-repeat;

background-color: #eee;

text-decoration: none;

}

Search Engine

The search engine was designed with the number one priority being the ease of access

to information. We wanted to display as many businesses on screen as possible without

wasting too much space or time. This is why we came up with the “More Info” button.

The original search result gives enough information for the majority of what people

would be looking for, the address and the phone number. A great deal of information is

available readily under the “More Info” button. Since this data is already loaded and

contained on the same page, it only takes an instant to load. From this additional space

the user will be able to access information such as the business’s external website, email

address, fax number, list of services, description of the business and their featured

coupon ready to print. The right column of the search page contains a Google Map,

which is automatically filled in with pointers to all of the seven search results. We

reserved room on the right side of the search results for sponsored listings and ads.

The search engine is composed of many different queries with many different

circumstances. We have different types of criteria for the user to choose from: Random,

sort by Name and Date Added, or list only businesses with buzz bucks (coupons) or buzz

pages (internal personal sites). Our search default is random, and will sort results by

Page 14: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

registered companies with buzz pages first, followed by unregistered businesses from a

phone directory. We calculate radial distance by zip code, using our zip code table,

which can centralize search results to their default location. Below is a sample of the

search.php code which houses all of our queries.

dbConnect();$filter .= "bc.active = '1'";// GET zip code verify it's realif(trim($_GET['z'])!="") $zip1 = trim($_GET['z']);else if($_SESSION['szip']!="") $zip1 = $_SESSION['szip'];if($zip1!="") {

switch($_GET['dist']) {case '5':

$zipMilesHigh = 5;break;case '10':

$zipMilesHigh = 10;break;case '15':

$zipMilesHigh = 15;break;case '25':

$zipMilesHigh = 25;break;case '50':

$zipMilesHigh = 50;break;default:

$zipMilesHigh = 5;break;

}$zipMilesLow = 0;if (is_numeric($zip1) && strlen($zip1) == 5) {$zipquery = "SELECT Latitude, Longitude, ZipCode, City, State FROM buzz_zip_codes WHERE ZipCode = '".$zip1."'";

$zipresult = @mysql_query($zipquery);$zip_rows = mysql_num_rows($zipresult);

} else {$zip1exp = explode(",", $zip1);$city = strtoupper(trim($zip1exp[0]));$state = strtoupper(trim($zip1exp[1]));if(strlen($state)==2) {$zipquery = "SELECT Latitude, Longitude, ZipCode, City, State FROM buzz_zip_codes WHERE City LIKE

'".mysql_real_escape_string($city)."' AND State = '".mysql_real_escape_string($state)."'";} else {

unset($state);$zipquery = "SELECT Latitude, Longitude, ZipCode, City, State FROM buzz_zip_codes WHERE City LIKE

'".mysql_real_escape_string($city)."'";}$zipresult = @mysql_query($zipquery);$zip_rows = mysql_num_rows($zipresult);

}if($zip_rows > 0) {

$ziprow = mysql_fetch_array($zipresult);$zip1Latitude = $ziprow['Latitude'];$zip1Longitude = $ziprow['Longitude'];$zip1Code = $ziprow['ZipCode'];

$city = "";$ecity = explode(" ", strtolower($ziprow['City']));for($i=0; $i<count($ecity); $i++) {

Page 15: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

$city .= substr_replace($ecity[$i], strtoupper(substr($ecity[$i], 0, 1)), 0, 1)." ";}$city = trim($city);$state = $ziprow['State'];$zip1 = $ziprow['ZipCode'];$_SESSION['szip'] = $zip1;$dispZip = $city.", ".$state;

// Update filter for zip code$zfilter = " AND (zip_1 = '".$zip1Code."'";// Get all zip codes in approximate radius$zipquery = zipRadiusSQL($zip1Code, $zip1Latitude, $zip1Longitude, $zipMilesHigh);$zipresult = @mysql_query($zipquery);while($ziprow = mysql_fetch_array($zipresult)) {

// Set the data to variables$zipLatitude = $ziprow['Latitude'];$zipLongitude = $ziprow['Longitude'];$zipZipCode = $ziprow['ZipCode'];$zipDistance = zipDistCalc($zip1Latitude, $zip1Longitude, $zipLatitude, $zipLongitude, "M");// If the Zip Code is within the range specified, print itif($zipDistance > $zipMilesLow && $zipDistance < $zipMilesHigh) {

$zfilter .= " OR zip_1 = '".$zipZipCode."'";}

}$zfilter .= ")";

} else {$zip_error=$zip1;unset($zip1);

}}

if($zip_rows!=0) {// Log what was searched$log_query = "SELECT ID FROM buzz_log_search WHERE

keyword='".mysql_real_escape_string(trim(strtolower($search_query)))."'";$log_result = @mysql_query($log_query);if(mysql_num_rows($log_result)==0) {

$log_query = "INSERT INTO buzz_log_search (keyword, counter) VALUES ('".mysql_real_escape_string(trim(strtolower($search_query)))."',1)";

$log_result = @mysql_query($log_query);} else {

$log_ID = mysql_result($log_result, 0, 0);$log_query = "UPDATE buzz_log_search SET counter=counter+1 WHERE ID='".$log_ID."'";$log_result = @mysql_query($log_query);

}

switch($_GET['what']) {// Keywordcase '1':

$nfilter = " AND (bk.keyword LIKE '%".mysql_real_escape_string($search_query)."%' OR bc.name LIKE '%".mysql_real_escape_string($search_query)."%')";

$num_query = "SELECT /*! SQL_NO_CACHE */ COUNT(DISTINCT bc.ID) AS ct FROM ".$table1." bc LEFT JOIN buzz_client_to_keyword bctk ON bc.ID = bctk.ID LEFT JOIN buzz_directory bd ON bc.ID=bd.client_ID LEFT JOIN buzz_category_to_keyword ck ON (bd.cat_ID=ck.catID AND bd.tier=ck.tier) LEFT JOIN buzz_keyword bk ON (bctk.keyword_ID = bk.ID OR ck.keyword_ID=bk.ID) ".$filter.$zfilter.$nfilter;

$query = "SELECT /*! SQL_NO_CACHE */ DISTINCT bc.* FROM ".$table1." bc LEFT JOIN buzz_client_to_keyword bctk ON bc.ID = bctk.ID LEFT JOIN buzz_directory bd ON bc.ID=bd.client_ID LEFT JOIN buzz_category_to_keyword ck ON (bd.cat_ID=ck.catID AND bd.tier=ck.tier) LEFT JOIN buzz_keyword bk ON (bctk.keyword_ID = bk.ID OR ck.keyword_ID=bk.ID) ".$filter.$zfilter.$nfilter." ".$sort;

break;// Namecase '2':

$nfilter = " AND bc.name LIKE '%".mysql_real_escape_string($search_query)."%' ";$num_query = "SELECT /*! SQL_NO_CACHE */ COUNT(DISTINCT bc.ID) AS ct FROM ".$table1." bc ".

$filter.$zfilter.$nfilter."";

Page 16: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

$query = "SELECT /*! SQL_NO_CACHE */ DISTINCT bc.* FROM ".$table1." bc ".$filter.$zfilter.$nfilter." ".$sort;

break;default:

$nfilter = " AND (bk.keyword LIKE '%".mysql_real_escape_string($search_query)."%' OR bc.name LIKE '%".mysql_real_escape_string($search_query)."%')";

$num_query = "SELECT /*! SQL_NO_CACHE */ COUNT(DISTINCT bc.ID) AS ct FROM ".$table1." bc LEFT JOIN buzz_client_to_keyword bctk ON bc.ID = bctk.ID LEFT JOIN buzz_directory bd ON bc.ID=bd.client_ID LEFT JOIN buzz_category_to_keyword ck ON (bd.cat_ID=ck.catID AND bd.tier=ck.tier) LEFT JOIN buzz_keyword bk ON (bctk.keyword_ID = bk.ID OR ck.keyword_ID=bk.ID) ".$filter.$zfilter.$nfilter;

$query = "SELECT /*! SQL_NO_CACHE */ DISTINCT bc.* FROM ".$table1." bc LEFT JOIN buzz_client_to_keyword bctk ON bc.ID = bctk.ID LEFT JOIN buzz_directory bd ON bc.ID=bd.client_ID LEFT JOIN buzz_category_to_keyword ck ON (bd.cat_ID=ck.catID AND bd.tier=ck.tier) LEFT JOIN buzz_keyword bk ON (bctk.keyword_ID = bk.ID OR ck.keyword_ID=bk.ID) ".$filter.$zfilter.$nfilter." ".$sort;

break;}$result = @mysql_query($num_query);$num_rows = @mysql_result($result, 0, 'ct');$row_num = 0;//direct to buzzpage if only one resultif ($num_rows==1) {

$result=@mysql_query($query);$id=mysql_result($result, 0, 'id');$buzz=mysql_result($result, 0, 'buzz_page');if($buzz) {

header("Location: http://www.upbuzz.com/buzzpage/index.php?q=".$search_query."&c=".$id);exit();

}}$limit = 7; // Rows to return

}

When the query is executed, we search the buzz_keyword table for keyword matches

and the buzz_client table for business name matches within the zip code radius. For hits

in the buzz_keyword table, we collect the businessID from the hits and display the

business name from the buzz_client table. After collecting all hits in both tables, we

organize them to the criteria stated above. That is the search engine in a nutshell.

User / Business Registration and Setup

Registering as a user on the site consists of entering an email address, username,

password, name, zip code, security question, date of birth and referral. The zip code is

used for personalizing the business search and local events. When a user is logged in

the default location for all of their searches will be from their own zip code unless they

decide to search in a different location. The local events page will also display events

posted by businesses in their area.

Before someone registers a business, they must set up a personal account to link that

Page 17: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

business to. The business registration starts by requiring them to fill in details about

the business, including the business name, address, city, state, zip, phone and fax if

available. In the next step they have the option to select additional content pages to

add to their webpage. Available options as of now are buzz bucks (coupons), photo

gallery, restaurant menu pages and additional keywords. They all have varying monthly

fees. This is just extra content the business can add in addition to the free content that

comes with registration. These free features include a more info section, home,

testimonials, location and upcoming events tabs with up to 10 keywords that they can

have linked to their business via the search engine.

The final step gives the business a link to a printable invoice for their business detailing

the costs and monthly charges they will be agreeing to. A validation code will also be

displayed and emailed to the business. They will need this code when they call in to

validate their business with the upbuzz staff. The administrators from upbuzz can allow

the business to go on with setting up their webpage when they validate that the

business is legitimate. They can do this by activating the business from the

administrator menu. *Note that this process is currently in the phase of being revised.

Soon the business will be able to set up all the pages in their personal site before being

required to activate. The business, however, will still not show up in search listing until

administrators have verified and activated the business. For now, we will continue to go

through the process as it exists today.

Continuing, the business starts the step by step process of creating and personalizing

their webpage within the site. The first step includes uploading a business logo, email,

existing website link, list of services, hours of operation and a small description of the

business. These are of course all optional.

The next step is choosing the keywords that will be associated with their business. The

business owner is allowed to choose ten keywords, while additional keywords come at a

Page 18: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

small fee. If the business adds a keyword that has never been entered into the database

before, it will have to be approved by an administrator before it will actually work for

the business. If the business adds a keyword that has already been approved before, it

will automatically be approved and start to work the instant it’s added. This middle step

was created to make sure businesses didn’t abuse the keyword feature.

In the next step the business finally gets to start creating its main content. They will be

able to type what they want to be included in their home page as well as use valid html

to include images, slideshows, etc.

Setting up the location page is next. The business will see a Google map of their

business and also has the ability to change their address in case Google does not like the

way the address was originally typed in. They will also have an area to explain where

the business is located or give more detailed instructions on to get there.

If the business chose any of the optional pages to include in their package, they will start

setting them up now. The restaurant menu setup will allow them to choose five

different menu categories and descriptions. They will then be able to upload images,

prices and descriptions for items and include them in the categories that they created.

The photo gallery setup is basically the same thing except they can only create three

categories and then have the option to upload pictures with descriptions for those

categories.

Next they can begin to create buzz bucks (coupons) for their business if they chose this

option. There are fields available for a description, bold text, fine print and expiration

date. They can also decide if they want a certain coupon displayed in their “More Info”

section of the search results. All of the coupons that they create here will show up in

that businesses “Buzz Bucks” page.

Page 19: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

The last page they will be sent to in the “Upcoming Events” setup. Here they can create

bulletins about events that they want users to know about. Information includes start

time, end time, location, description and date of the event. These events will show up

in the businesses “Upcoming Events” page.

After they fill in their billing address for the business, they will be redirected to their

finished webpage. The owner of the business can change or add anything about their

business webpage when needed by going to their “My Account” page and selecting that

business.

Business Account

For upbuzz to be a success, we needed to offer services and an experience that can’t be

found anywhere else. With upbuzz, small businesses can have their own dynamically

personalized website for free. We offer domain name forwarding as well, so businesses

can buy a domain name, then forward it to their upbuzz address. Businesses receive all

of the benefits of being a user and then some. Each business receives tabs, which are

individual pages of their sub-site. Home, Location, Services, Menu, and Photo Gallery

are just some to name.

Home – The Home tab is the first page that is displayed when a user clicks on a business.

Here the business can put whatever information they choose, whether it be a short

introduction paragraph or a short history of their business. This area is fully

customizable, which means businesses can have text, pictures, and much more.

Location – The Location tab is fitted with a Google Map that is customized to their exact

location. Also on this page is an area where businesses can put navigational directions

as well as hours and such.

Page 20: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

Testimonials – The Testimonial tab is where the general public (registered users) can

post a testimonial about their favorite business. These testimonials are controlled

through the business administration menu. Though business cannot change a

testimonial, they can choose which ones display on their buzzpage.

Upcoming Events – The upcoming events tab is an easy way to let users know of

upcoming sales, specials, deals, open houses, etc. There is an upcoming events feed on

every users Welcome page, which displays the events according to location and time.

Businesses can add as many upcoming events as they like, all of which will be deleted

automatically after they expire.

Gallery – The Gallery page is a simple photo gallery where businesses can showcase

anything they want, from staff pictures to images of their business. All are dynamic with

a short description which can be edited / deleted at any time.

Menu – The menu is one of the best features of upbuzz. We offer a fully dynamic menu

with descriptions, images, and prices that the business controls. Recently new to

upbuzz is online ordering capability. Using AJAX programming, we have been able to

create an online ordering system that tracks which user is ordering, from where and

what they want, after which it faxes the order to the business who confirms over the

phone with the user.

Buzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz. Businesses

can create, edit, and delete coupons dynamically, with special options such as expiration

date, valid only circumstances, descriptions and so forth.

We offer customizable tabs to any business with an idea. For example, there is an

upcoming Auto Showcase tab, to which dealerships can display their vehicles up for sale.

The possibilities for this are endless, and with the helpful input from businesses we can

Page 21: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

create the best experience possible.

User Account

The user account, which is free, has many features that benefit a user by registering

with the site.

Personal Home - This is the page where the user is redirected to when they log into the

site. It displays the weather, local events and promotions all based on their zip code. It

also shows their latest messages, favorites and friends.

Friends - The user is able to search for and request other users to be added as their

friend. Once you have friends you will be able to see what their favorite businesses are.

You will also be able to send and receive messages from them through the message

center.

Favorites – Whenever a user visits a business’s webpage, they will be able to add that

business as one of their favorites if they choose to. When you are viewing businesses in

the search results, you will be able to see which ones you have marked as favorites and

which ones are a favorite of your friends.

My Account – Here you can update your information that you registered with, add a

profile picture, change privacy settings or edit the details and pages of a business you

are linked to.

Only registered users can access Buzz Bucks (coupons), online ordering, the messaging

system, upcoming events, and so forth. This is our way of attracting more and more of

the general public to the site.

Administrator Account

Page 22: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

The Administrator Account is a master account that includes the user and business

account features, and much more. This administrator account is used to maintain

upbuzz to the best of its abilities. There is a private Administrator menu that has menus

such as FAQ, Account Management, Billing, Directory Administration, Keywords,

Profanity, Error Checking, and much more. As mentioned before, Administrators have

infinite privileges and can access, edit, or delete any information on the site.

FAQ – The frequently asked questions area is where we can create/edit/delete

questions about topics that are popular on our site such as “Registration”, “Online

Ordering”, “Message Center”, etc. Users can submit questions or topics that haven’t

been addressed yet, to which we can post or respond the answers.

Account Management – This are of the administration site is where we can

create/edit/delete all accounts, business or user. We can validate accounts, change

their privileges, transfer businesses between users, and much more.

Billing – This section of our site is very important. Though we do not necessarily bill

from our site, we do keep track of all records and activity on upbuzz. Some features

offered on our site aren’t free such as the restaurant menu or photo gallery, however it

is a small monthly fee to possess these. Whenever we wish, we can run a report of

what businesses have certain options, what businesses have changed, etc.

Directory Administration – Directories or Categories are a big part of our site. We use

these categories to organize businesses, as well as trigger ads and results specific to a

keyword or category. We use a three tier category system, which means there are at

max 4 levels of specificity that a business can be in. For example:

Food and Dining -> Restaurants -> Cajun / South -> Lagniappe Cajun Eatery

From this menu, we can edit all tiers, including adding and deleting multiple levels.

Page 23: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

Keywords – Keywords are a vital part of our site. These power the search engine and

link businesses to searches. Each business can link themselves to specific keywords that

already exist. If a business wishes to create a new keyword, they must submit it to us

via an easy form that will allow us to review it and approve it. Maintaining our

keywords is a process that must be done every day to assure the best search results

from our search engine.

Profanity and Banned Words – We keep a table of words that are either banned or

considered profanity to try and keep our site as clean as possible for the general public.

Every time something is submitted for posting on our site, we run a function that scans

their post and our profanity table for a match. If there is a match, we display a message

saying why we do not allow the word. This table must be manually updated, which can

be a pain sometimes.

As you can see, the Administrator Section is advanced compared to the other accounts.

There are many more features of the Administrator account, however we chose to

discuss some of the more important ones.

Website Maintenance and Customer Service

When creating the site, we knew that it would be very important to stay up-to-date on

all of the features we had to offer. We also knew we had to have some type of

Customer Service section that could help users and businesses with their problems. We

created a dynamic Frequently Asked Questions (FAQ) section where we can create, edit,

and delete any questions and answers we choose. We have a few different problem

submission forms, where users can send us problems they encounter, to which we can

reply back within the same business day. For site maintenance, we created some

functions that only Site Administrators can access. One of which is the “Table Cleanup”

function, which browses the users table for users who have not completed validation

two weeks after signing up. We send the email on file a message saying that we have

Page 24: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

deleted their account due to inactivity, and then delete the entry. This helps keep our

database clean of all junk that “bots” on the web may fill up.

Major Problems, Solutions and New Features

The main problems that came up for us when developing the site mainly organizational

problems as the site continued to grow, CSS errors during designs, concept changes, and

little syntax errors when working with different SQL queries. Many revisions on certain

functions had to be done as new features of our site surfaced. For instance, our first

version of registration turned out to be faulty when we added the “Business setup”

feature which allowed the business to setup their information via “wizard” style. The

registration at the time did not collect or transfer certain information that we needed

for future use. A lot of time was spent on programming error checking code in the user

and business setup process. Many times we would just have to go and try to break

things and try to mimic what a user might do in a worst case scenario. This tactic

seemed to work out very well for us.

Other problems we encountered were based on faulty database and programming

designs that we had constructed. As stated above, a lot of our sites functionality came

from trial and error. As the site grew in size and we offered more features, we soon

began to realize what areas of our site needed a redesign, such as Registration and

Setup.

For future additions, we will be adding a SSL certificate to our site, to make certain

information that is transferred over the web secure. We have recently added an online

ordering feature with fax capabilities, but would soon like to have credit card processing

involved in that process. Our Administration menu still has a lot of work to be done.

We need to add a lot more functions that will make it easier for us to maintain a neat

and clean database. We are now in the process of adding “temp” tables, which will

force all users to validate certain information before it is entered into the “real”

Page 25: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

database. We have a lot more work to do on it, but the effort is paying off as different

chamber of commerce’s and cities are looking into upbuzz, such as the Las Vegas and

Chicago Chamber of Commerce.

Conclusion

With upbuzz as our Senior Project, we wanted to build on our original idea with good structure

and ease-of-use in mind. We wanted to learn as many new techniques, languages, skills, and

methods as possible. We both learned many new things and advanced our knowledge of PHP,

AJAX, Javascript, CSS, design concepts and database manipulation. The process of trial and

error has helped us in development so much. We know that our site will always be changing,

therefore we know some of our ideas and methods are not the best, but we are always open to

suggestions and will continue to grow intellectually. The internet is amazing place to work with

and there are so many ideas for websites that have yet to be created. This was the best choice

for our Senior Project because we can’t see ourselves doing anything but Web Development.

Page 26: Upbuzz: Local Business Search Enginecs.nmu.edu/~SeniorProjects/bayles+hanson/Bales-and-Ha…  · Web viewBuzz Bucks – Buzz Bucks are coupons which can only be found on upbuzz

Appendix

Introduction (David Bayles) written by David Bayles

Introduction (Benjamin Cody Hanson) written by Cody Hanson

Project Overview written by David Bayles & Cody Hanson

Database and Hosting written by Cody Hanson

Authentication, Privileges and Security written by Cody Hanson

Site Structure written by David Bayles

Coding written by Cody Hanson

CSS and Browser Compatibility written by David Bayles

Design Elements and Navigation written by David Bayles

Search Engine written by David Bayles & Cody Hanson

Registration and Setup written by David Bayles

Business Account written by Cody Hanson

User Account written by David Bayles

Administrator Account written by Cody Hanson

Website Maintenance & Customer Service written by David Bayles

Major Problems, Solutions & New Features written by David Bayles & Cody Hanson

Conclusion written by David Bayles & Cody Hanson

*Please Note: Sections designated to each person were proofread and, if needed, changed accordingly by the

other. Each section has input from both parties.