Upload
sampetruda
View
4.879
Download
3
Embed Size (px)
DESCRIPTION
Citation preview
1
EAT OUT - WEB DEVELOPMENT
A Project Report
Presented to
The Faculty of the Department of General Engineering
San Jose State University
In Partial Fulfillment
Of the Requirements for the degree
Master of Science in Engineering
By
Cancheevaram Kuppuswamy, JaiSaravanan
May 2009
2
© 2009
Cancheevaram Kuppuswamy, JaiSaravanan
ALL RIGHTS RESERVED
3
APPROVED FOR THE DEPARTMENT OF GENERAL ENGINEERING
_________________________________________________________
Mr. Karthik Puthur
Industrial Sponsor,
Co-Founder, GPLpedia.com
_________________________________________________________ Professor Dr. Agustin Araya
Technical Advisor,
Dept. of Computer Science
_________________________________________________________ Dr. Leonard Wesley
Assistant Professor, Department of Computer Engineering,
San Jose State University
4
ACKNOWLEDGEMENT
I would like to express my gratitude to Mr. Karthik Puthur, Co-Founder of
GPLpedia.com for his continuous support, encouragement and direction.
I would like to express my sincere thanks to Professor Dr. Agustin Araya, Dept. of
Computer Science, San Jose State University for his generous guidance and feedback
throughout in completing this project.
I would like to thank Dr. Leonard Wesley, Associate Professor, Dept. of Computer
Engineering, San Jose State University for his support in accomplishing our goal.
I would like to thank to my family members who continuously gave me an
encouragement and support. I’m thankful to all my friends and classmates for their patience and
feedback.
- Cancheevaram Kuppuswamy, JaiSaravanan
5
ABSTRACT
The project is to provide a web platform for people from India to communicate and share
their view about restaurants and the food available in their locality. The aim of this project was to
design and develop a commercial website in Java-J2EE and Ajax technologies. Several libraries
and packages were used to make it more user friendly and attractive.
The literature review that was performed helped in deciding the technology and
architecture to be used, to come up with the best possible solution.
The extensive market research and feasibility studies revealed that there is a huge scope
for such a website with the targeted audience and this website could generate a heavy online
traffic and thereby making money.
6
Table of Contents
1.0 Objective …………………………………………...................................................10 2.0 Introduction …………………………………………………………………………...10 3.0 Hypothesis …………………………………………………………………………...10 4.0 Justification …………………………………………………………………………...11 5.0 Literature Survey …………………………………………………………………...11
5.1 AJAX Tutorial …………………………………………………………………...12 5.2 Asynchronous JavaScript Technology and XML (Ajax) …………………...12 5.3 Mastering Ajax, Part 8: Using XML in requests and responses …………………...12 5.4 Web Design in a Nutshell, Third Edition A Desktop Quick Reference …………...12 5.5 SQL Tutorial …………………………………………………………………...13 5.6 Ajax frameworks for interactive web apps …………………………………...13 5.7 Google Analytics …………………………………………………………...14 5.8 Ajax Roadmap: How to transform a website without starting from scratch …...14 5.9 Other Materials …………………………………………………………………...14
6.0 System Design and Development …………………………………………………...16 6.1 System Description …………………………………………………………...16 6.2 AJAX (Asynchronous JavaScript and XML) …………………………………...17
6.2.1 Brief History …………………………………………………………...17 6.2.2 AJAX in Short …………………………………………………………..17 6.2.3 Existing Applications …………………………………………………...18 6.2.4 AJAX in my project …………………………………………………...18
6.3 System Architecture …………………………………………………………...19 6.4 Design …………………………………………………………………………...21
6.4.1 Pencil Sketch (Low Fidelity Prototype) …………………………...21 6.4.2 Computer mockups (High Fidelity Prototype) …………………...22
6.5 Requirements …………………………………………………………………...27 6.5.1 Hardware Requirements …………………………………………...27 6.5.2 Software Requirements …………………………………………...27
6.6 Scope …………………………………………………………………………...27 6.6.1 In Scope …………………………………………………………...27 6.6.2 Out of Scope …………………………………………………………...28
6.7 Modules and Functionalities …………………………………………………...28 7.0 Economic Justification …………………………………………………………………...29
7.1 Executive Summary …………………………………………………………...30 7.2 Problem Statement ...........................................................................................30 7.3 Solution and Value Proposition …………………………………………………...31 7.4 Market Size …………………………………………………………………...32
7.4.1 Source of Information …………………………………………………...34 7.4.2 www.Alexa.com …………………………………………………...34 7.4.3 Google Analytics …………………………………………………...34 7.4.4 Comparison and statistics …………………………………………...35
7.4.4.1 Yelp.com …………………………………………………...35 7.4.4.2 Burrp.com …………………………………………………...35
7
7.4.4.3 Vahrehvah.com …………………………………………..36 7.4.4.4 Comparison chart …………………………………………..37
7.5 Competitors …………………………………………………………………..38 7.6 Customers …………………………………………………………………..38 7.7 Cost summary …………………………………………………………………..42
7.7.1 Cost of development …………………………………………………..43 7.7.2 Operating cost …………………………………………………………..43
7.8 Price Point …………………………………………………………………..44 7.9 SWOT Assessment …………………………………………………………..44 7.10 Investment Capital Requirements …………………………………………..45 7.11 Return on Investment …………………………………………………………..46 7.12 Personnel …………………………………………………………………………..47 7.13 Business and Revenue Model …………………………………………………..47 7.14 Strategic Alliance/Partners …………………………………………………..48 7.15 Profit & Loss …………………………………………………………………..48 7.16 Exit Strategy …………………………………………………………………..49
8.0 Project Schedule …………………………………………………………………………..49 8.1 Resource Allocation …………………………………………………………..50 8.2 Committee Responsibility …………………………………………………..50 8.3 Gantt chart …………………………………………………………………..50
8.3.1 Milestones …………………………………………………………..52 8.3.2 Deliverables …………………………………………………………..52
9.0 Conclusion …………………………………………………………………………..52 10.0 Future Work …………………………………………………………………………..54 Reference …………………………………………………………………………………..55 Appendix A …………………………………………………………………………………..58 Appendix B …………………………………………………………………………………157
8
List of Figures
1. J2EE Architecture …………………………………………………………………..16
2. AJAX model Comparison …………………………………………………………..19
3. Application Architecture …………………………………………………………..20
4. Project Folder Structure …………………………………………………………..20
5. Home Page of the Website ……………………………………………………………..22
6. Computer Mockup 1 …………………………………………………………………..23
7. Computer Mockup 2 …………………………………………………………………..24
8. Computer Mockup 3 …………………………………………………………………..25
9. Computer Mockup 4 …………………………………………………………………..26
10. Orkut Community Screenshot…………………………………………………………..33
11. Traffic Trend of Yelp.com …………………………………………………………..35
12. Traffic Trend of Burrp.com …………………………………………………………..36
13. Traffic Trend of vahrehvah.com …………………………………………………..37
14. Traffic Trend Comparison …………………………………………………………..37
15. Break even Analysis …………………………………………………………………..46
16. Profit & Loss …………………………………………………………………………..49
17. Gantt Chart …………………………………………………………………………..51
9
List of Tables
1. Architecture and Tools …………………………………………………………16
2. Modules and Functionalities …………………………………………………………29
3. Ad Provides and their features …………………………………………………42
4. Cost of Development …………………………………………………………………43
5. Operating Cost …………………………………………………………………44
6. SWAT Analysis …………………………………………………………………45
7. Cost, Income and Profit …………………………………………………………46
8. Return of Investment …………………………………………………………………46
9. Profit & Loss …………………………………………………………………………48
10. Milestones …………………………………………………………………………52
11. Deliverables …………………………………………………………………………52
10
1.0 Objective
The objective of this project is to deliver a commercial website utilizing the latest web
technologies, which can be used by people to read and write reviews about different restaurants
available at their geographical location.
2.0 Introduction
The mission of this project is to develop a commercial website utilizing the latest web
development technologies. The technologies utilized to develop this website shall be the latest to
have a competitive advantage over the competitors. In other words, the website is to be created
with Web 2.0 (New trend in Web design) user interface using Ajax and Java.
The main objective of the website is to act as a platform for people to know about the restaurants
in India and write reviews about these restaurants. The target audience of this website is general
public in India. The system is like www.yelp.com [2] or www.food.yahoo.com [3], targeted at
different audience. Though similar websites are already available in the web, none of these
address the audience mentioned above. Actually in countries like US or UK, lot of people read
about the restaurant in the internet before trying it out. But such a thing does not exist in India
and we believe that this website will help us achieve this.
3.0 Hypothesis
“To develop a fully functional commercial website (Web application) in Java-J2EE platform
using Ajax for the front-end, with all the features or functionalities mentioned in the scope
document”
11
The hypothesis of the project is not the concept of the website, but the way it is developed. The
functionalities present in the Website, programming concepts or techniques utilized, the level of
perfection achieved shall be the rating factors for the project.
4.0 Justification
The reason for this choosing this topic as my project is that it gives me an opportunity to
practically employ all learning I have acquired in my Masters program. As my emphasis is
Software programming, I have done courses on Java-j2ee programming, User interface and
design, Database design and Quality assurance. This project gives me an opportunity to combine
the concepts of all the above and create one single product. This website has scope for including
different techniques or features like reviews, blogs, video player, photo albums etc. As the entire
front end is planned to be developed in Ajax, the appearance of the website is given high
importance.
As no other similar website is currently present with the targeted audience, the scope of success
is very high. There are several communities and social networking websites to write reviews of
restaurants in India where lots of people are part of it, even though these websites offer very little
flexibility for this particular action. Below is a screenshot of a community on Indian Restaurants
in a Social Networking site, which has 5261 members. This clearly shows that the targeted
people are interested in the idea and will be a part of it if exists.
5.0 Literature Survey
Since my project involves Software development and the technologies used to develop, more
information is available in the form of articles, blogs or forums than in papers or journals. Below
are few articles which provide detailed information about the technology and the way it is to be
implemented.
12
5.1 AJAX Tutorial
This is a tutorial provided by w3Schools which contains a collection of efficient web building
Tutorials. This provides basic idea on AJAX and how it is to be implemented.
AJAX stands for Asynchronous JavaScript And XML.AJAX is a type of programming made
popular in 2005 by Google (with Google Suggest).AJAX is not a new programming language,
but a new way to use existing standards. [3]
5.2 Asynchronous JavaScript Technology and XML (Ajax) With the Java
Platform By Greg Murray, June 9, 2005; updated October 2006
Anyone who has used Flickr, GMail, Google Suggest, or Google Maps will realize that a new
breed of dynamic web applications is emerging. These applications look and act very similar to
traditional desktop applications without relying on plug-ins or browser-specific features. Web
applications have traditionally been a set of HTML pages that must be reloaded to change any
portion of the content. Technologies such as JavaScript programming language and cascading
style sheets (CSS) have matured to the point where they can be used effectively to create very
dynamic web applications that will work on all of the major browsers. This article will detail
several techniques that you can use today to enable your web applications to be more rich and
interactive like desktop applications. [4]
5.3 Mastering Ajax, Part 8: Using XML in requests and responses
In the last article of the series, you saw how your Ajax apps can format requests to a server in
XML. You also saw why, in most cases, that isn't a good idea. This article focuses on something
that often is a good idea: returning XML responses to a client. [5]
5.4 Web Design in a Nutshell, Third Edition A Desktop Quick Reference By
Jennifer Niederst Robbins on February 2006
13
Our popular reference, Web Design in a Nutshell, has been completely rewritten and expanded to
reflect the state of the art in web standards. In addition to being an authoritative reference for
(X)HTML and Cascading Style Sheets, this book also provides an overview of the unique
requirements of designing for the Web and gets to the nitty gritty of JavaScript and DOM
Scripting, web graphics optimization, and multimedia production. It is an indispensable tool for
web designers and developers of all levels. [7]
5.5 SQL Tutorial
This is a tutorial provided by w3Schools which contains a collection of efficient web building
Tutorials. This provides basic idea on SQL and how it is to be implemented. SQL stands for
Structured Query Language. SQL is a standard language for accessing and manipulating
databases. In this tutorial you will learn how to use SQL to access and manipulate data in MS
Access, SQL Server, MySQL, Oracle, Sybase, DB2, and other database systems. [6]
5.6 Title: Ajax frameworks for interactive web apps. (software technology)(web
applications)
Source: IEEE software [0740-7459] Serrano yr.2007 vol.24 iss.5 pg.12
Abstract:
So far, most Web applications have been rough, with ugly interfaces and limited user interaction.
Here's where Ajax comes in. Jesse James Garret introduced the term Ajax, shorthand for
Asynchronous Javascript plus XML in 2005. The longhand summarizes techniques that
developers had worked on for a while to make Web pages and applications more dynamic. The
scripting languages manage the DOM, allowing Web applications to dynamically access and
update HTML content, structure, and style. Since 2005, developers have used Ajax in Web
applications such as Google Maps, Netvibes, and Zimbra Collaboration Suite. Users can interact
14
with these applications much as they do with desktop applications - or even better. But the Ajax
features represented in these applications also demand detailed coding. Enter Ajax frameworks.
Ajax frameworks are utility sets that make it easier to develop and maintain applications that
incorporate the Ajax features that users are demanding. Ajax makes it possible to develop rich
Web application interfaces, but the work is demanding. If your project has a close deadline,
you'll probably have to reject many Ajax features. [8] [9]
5.7 Google Analytics
It is a tool provided by google to help the website’s performance. It contains the all you website
activities, provide information regarding traffic and also give suggestions relevant to the website.
The new Google Analytics makes it easy to improve your results online. Write better ads,
strengthen your marketing initiatives, and create higher-converting websites. Google Analytics is
free to all advertisers, publishers, and site owners. [10]
5.8 Ajax Roadmap: How to transform a website without starting from scratch
This article tell you ways to implement Ajax in a simpler and less time consuming way without
affecting the existing design.
5.9 Other Materials
Below is a collection of web pages, forums, blogs and journals are used for the development of
the project. They all help in developing different modules of the project utilizing web designing
technologies and Ajax. Some also provide solutions to develop certain features or functionalities
that are required in the project.
Ajax Frameworks in Interactive Web Apps Nicolás Serrano, Juan Pablo Aroztegi.
IEEE Software. Los Alamitos:Sep/Oct 2007. Vol. 24, Iss. 5; pg. 12
Google Analytics: http://www.google.com/analytics/
15
Ajax Tutorial (Asynchronous Javascript And XML): http://www.xul.fr/en-xml
ajax.html
A Simple AJAX Tutorial: http://www.codecoffee.com/articles/ajax.html
Rasmus' 30 second AJAX Tutorial : http://rajshekhar.net/blog/archives/85-Rasmus
30-second-AJAX-Tutorial.html
Simple AJAX Example: http://daniel.lorch.cc/docs/ajax_simple/
Getting Started with Ajax by Aaron Gustafson:
http://www.alistapart.com/articles/gettingstartedwithajax
AJAX Tutorial: http://www.w3schools.com/ajax/default.asp
J2EE and AJAX: AJAX with Servlets: http://www.devarticles.com/c/a/Java/J2EE-
and-AJAX-AJAX-with- Servlets/3/
Asynchronous JavaScript Technology and XML (Ajax) With the Java Platform:
http://java.sun.com/developer/technicalArticles/J2EE/AJAX/
Ajax client/server communication can be a tricky business
Brett McLaughlin ([email protected]), Author and Editor, O'Reilly Media Inc
on 07 Nov 2006
How To Handle AJAX Responses:
http://www.peachpit.com/articles/article.aspx?p=443580&seqNum=4
The AJAX response: XML, HTML, or JSON?:
http://www.quirksmode.org/blog/archives/2005/12/the_ajax_respon. html
Ajax: A New Approach to Web Applications:
http://www.adaptivepath.com/ideas/essays/archives/000385.php
AJAX: http://developer.mozilla.org/en/AJAX
16
6.0 System Design and Development
6.1 System Description
The project or the website is to be developed in Java platform. The website will be developed in
J2EE with mvc2 architecture. That is the JSP with AJAX (front end) will contact the servlets
(middle tier) which will in turn contact the database (Back end) through Business Objects (BO)
and Data Objects (DAO). The architecture is standard for E-applications and has been used to
develop several websites and enterprise solutions. The challenge here is the utilization of AJAX.
Figure 1: J2EE Architecture
Below is a table clearly defining the technology and tools that are to be used in developing the
project.
S.No Purpose Technology/Tool
1 Platform Java
2 Architecture J2EE (MVC)
3 Development IDE Eclipse 3.3
4 Front End JSP (with Ajax)
5 Database MySQL 5
6 Database IDE DreamCoder 4.1
7 Server Apache Tomcat 5.5
8 Xml Editor Edit Plus
JSP
Ajax Servlet
BO
DAO DB (Mysql)
17
9 Browsers IE 7, Firefox 3 and
Google Chrome 0.2
10 Image Editor Gimp 2.0
Table 1: Architecture and Tools
6.2 AJAX (Asynchronous JavaScript and XML)
6.2.1 Brief History
The following excerpt from Chapter 27 of Web Design in a Nutshell (O’Reilly Media,
Inc., third edition, February 21, 2006). —Ed.
The start of 2005 saw the rise of a relatively new technology, dubbed “Ajax” by Jesse James
Garrett of Adaptive Path. Ajax stands for Asynchronous JavaScript and XML. In a nutshell, it is
the use of the nonstandard XMLHttpRequest() object to communicate with server-side scripts. It
can send as well as receive information in a variety of formats, including XML, HTML, and
even text files. Ajax’s most appealing characteristic, however, is its “asynchronous” nature,
which means it can do all of this without having to refresh the page. This allows you to update
portions of a page based upon user events and provides one of the cornerstones of Rich Internet
Applications (RIA) referred to in discussions of “Web 2.0.” [4]
6.2.2 AJAX in Short
AJAX-Asynchronous JavaScript and XML. [5]
Better, faster, and more user-friendly web applications. [5]
Made popular in 2005 by Google (with Google Suggest). [5]
Allowing web pages to request small bits of information from the server instead of
whole pages.
18
AJAX is not a new programming language, but a new way to use existing standards.
[5]
With AJAX, JavaScript can directly communicate with the server, using the
JavaScript "XMLHttpRequest" object.
6.2.3 Existing Applications
Real-time form data validation
Auto completion
Sophisticated user interface controls and effects
Partial submit
Page as an application
6.2.4 AJAX in my project
“AJAX is a technique rather than a technology: It is a way of pulling data from server by
JavaScript using XML HTTP Request object and then insert this data into the website using
DOM.” [6] (from http://daniel.lorch.cc/docs/ajax_simple/)
The below figure shows the operation of AJAX in a web application. Any web application can
have AJAX in front end by just following few simple protocols. The mission in my project is to
use AJAX to the fullest to create a vibrant and efficient User Interface.
19
Figure 2: AJAX model Comparison
(http://www.adaptivepath.com/ideas/essays/archives/000385.php)
6.3 System Architecture
The system consists of different layers based on the MVC Architecture. Each layer is developed
exclusive to perform a dedicated functionality. Below is a figure showing the different blocks or
layers of the application.
20
Figure 3: Application Architecture
Figure 4: Project Folder Structure
The front-end, in other words view layer consists all the files
required for presenting the data. It includes several files like
Html, JSP, Java Scripts etc. This is the layer that is viewed
by the user.
The Controller layer consists of the Servlets which includes
MainServlet.java and FileServlet.java. These files take the
control from the front-end and pass it to the corresponding
programming layer. MainServlet is the Core controller and
FileServlet is used during transaction involving file system
like uploading a file etc.
The Model layer consists of the business logics of the
application. This includes Business Objects (BO), Value
APPLICATION
• JSP • JS • CSS • XML • Images
• Servlets • BO • VO • DAO
MySql
Front-End Business Layer Back - End
DB
21
Objects (VO) and Data Access Objects (DAO). They perform all the logic required for the
application. The controller layer and the model layer together constitute the Business Layer.
The Back-End constitutes the Database, in our case MySQL Database. It consists of tables,
views etc which contains all the information that are displayed in the application. The Business
layer retrieves the information from the back-end and passes it to the visual layer or front-end
which displays it to the user.
6.4 Design
6.4.1 Pencil Sketch (Low Fidelity Prototype)
Below is a sample mockup (hand drawn) design made during the design phase on how the home
page of the website would look and the core features that shall be incorporated in the website. As
you can see the design has several individual components. With the help of AJAX each of these
individual components connect to the server independently thus providing a better and efficient
user interface. This prototype is taken as the benchmark in designing the actual User Interface.
Keeping this in mind, the product UI was developed with several additions and improvements.
22
Figure 5: Home Page of the Website
6.4.2 Computer mockups (High Fidelity Prototype)
Below are screenshots of the website developed from the low fidelity prototype. The User
Interface is kept minimal and simple. This prototype was mainly used to show the flow of
actions and functionalities to be present in the website. This is also the mockups of the final UI.
23
Figure 6: Computer Mockup 1
24
Figure 7: Computer Mockup 2
25
Figure 8: Computer Mockup 3
26
Figure 9: Computer Mockup 4
27
6.5 Requirements
Since the product is a Web application that is deployed on the server, the user does not require
much hardware or software to access the application. All he/she requires is computer with
internet connection. To develop and host the product we required all the tools that were
mentioned above. Below are the items or configuration required by to user to access the product.
6.5.1 Hardware Requirements
Computer
Internet Connection
6.5.2 Software Requirements
Supporting browser (Internet Explorer, Morzilla Firefox or Safari)
Java run time environment (JRE 1.4 and above)
Flash support
JavaScript Enabled
6.6 Scope
As this is a commercial website, lot of features and functionalities was incorporated in the design
but everything was not implemented in the first version. Only the basic features required for the
website to function were developed in the first version, other additional features are added in the
coming versions.
My project is to develop the First version of the website. Below are a set of features that are
present in the first version or my project and also a list of features that are omitted.
6.6.1 In Scope
28
Research on functionalities and features
Design and Development of functionalities
Developing the website for one single city
Insertion of Sample data
Testing the developed modules
Resolving high and medium priority bugs
Deployment of the website
6.6.2 Out of Scope
Collection of actual data
Search engine Optimization
Replication of the website for other cities in India
Resolving low priority or cosmetic bugs
Marketing the website
Performance Issues
Few additional features like Email and mobile collaboration, Google maps etc\
6.7 Modules and Functionalities
Below table consists the list of modules and functionalities that are present in the website.
S.No Modules Functionalities (Screens)
1 Home Header
Content
Footer
2 Reviews Review List
Review Detail
Menu Album
Add Restaurant
29
Add Review Photo Album
3 Login Sign In
Forgot Password
Register
Account
Update Profile
Reviewers List
4 Blogs Blog List
Blog View
Add Blog
5 Events Event List
Event View
Add Event
6 Misc Search
Site Map
About Us
Contact Us
Advertise
Table 2: Modules and Functionalities
7.0 Economic Justification
The core purpose of economic justification is to identify the worth of the product and the factors
like customers, competitors etc that support or affect the existence of the product in the market.
Economic Justification is very essentials in terms of providing a forecast on the products future
and helps to view the product above the technical level.
30
7.1 Executive Summary
In India there are several restaurants and lots of people spend lot of money everyday eating in
those restaurants. In present time eating outside in a rich restaurant is equivalent to buying
electronics. In countries like USA and UK, several websites are available to know about the
restaurants and foods available in their geographical location which help you decide which is
good and which is not. Such a website is not present in India and my project is to develop a
website (EatOut.in) for that. EatOut.in will be a product of WebEn Technologies Inc. WebEn
Technologies will be co-owned by GPLpedia.com and me, a Graduate student at San Jose State
University. The present or near future objective of WebEn Technologies Inc. is to support and
enhance EatOut.in, based on the customer response.
The website will provide a platform for people to share and discuss their views on the food and
restaurants in their locality. The company requires just $26,884 of capital investment which shall
be provided by GPLpedia.com. The core advantage of this product is that the initial investment is
very less and all further work on the product can be made based on the response. The investment
is less but that doesn’t mean that the revenue is limited, in current world there are several website
that become successful startups. The website is targeted at Indian locals and they are responsible
for the traffic. The market size is huge, over 5000 users. As the product is new to the targeted
audience, there are no actual competitors. The ads present in the website and restaurant
marketing are the main source of revenue. The break even is attained in the fourth quarter of
2009 (i.e.) the second quarter of operation as the operating cost is very less. High ROI of around
6.17% can be achieved at the end of 5 years of operation. The initial capital is very less and the
operating cost is also very less which makes this product a safe bet for the investors. Total
income of over $168,000 is obtained after a period of 5 years.
31
7.2 Problem Statement
Though there are several social networking websites and community forums where people
discuss about the issues addressed above, a website solely for that purpose must be attractive
enough to generate traffic. There is no exclusive website for the targeted audience to share their
views and comments about the food and restaurants available in the locality. There is no easy
medium available for people to view and share this kind of information.
7.3 Solution and Value Proposition
Weben Technologies Inc. developed a social networking product (EatOut.in) for people in India
to communicate with each other and share their views and opinions on restaurants and food
available in their locality. Thought there are several communities and forums where people
perform similar actions, there is no exclusive website to do this for the targeted audience. The
target audience is the key factor here, as similar solutions have been popular with different
audience and what we do here is bring it to audience where is it absent.
There are several communities and social networking websites to write reviews of restaurants in
India where lots of people are part of it, even though these websites offer very little flexibility for
this particular action. The website addresses this particular issue and provides a place exclusive
for this action. It is a place for people to write reviews about the restaurants, share the favorite
recipes, related blogs, share events and activities in their locality and lot more. The
functionalities of the website will make it easier for the people to share information and
communicate with each other.
Our website provides ease of usability and simple functionalities for people of all ages to
access the website and get a fair knowledge about the restaurant before going.
32
7.4 Market Size
Below is a screenshot of a community on Indian Restaurants in a Social Networking site, which
has 5261 members. This clearly shows that the targeted people are interested in the idea and will
be a part of it if exists. When such a community where the functionalities are very limited can
acquire over 5000 users, a website exclusive for this with lot more functionalities can definitely
obtain more users and hence more traffic and revenue.
33
Figure 10: Orkut Community Screenshot
34
7.4.1 Source of Information
Below sources are used to collection information about some similar products existing in the
current market which is used as a reference for the projected market size, profit & loss, revenues
and business model of EatOut.in. They will also be track and obtain useful information about
Eatout.in. The internet has several resource which helps you find information like traffic, click
rate etc of your website. This information help you to analyze the performance your website.
Since most websites are private, there is now way to confirm the figures acquired from these
sources. Below are the two major sources which shall be used to analyze eatout.co.in.
7.4.2 www.Alexa.com
This is the most popular web information tool present. It will give you traffic rank, traffic range
for different intervals of time, page views, ranks perspective to different geographical locations
etc. It also compares websites, give comparison ranking and also provide the percentage
contribution by sub domains in the website.
7.4.3 Google Analytics
This is a tool provided by google to find information about the website. This gives information
similar to alexa.com and also provides additional information related to search and search
results.
7.4.4 Comparison and statistics
Below is information on few existing websites present in the market which provides similar
functionalities to different audience or different functionalities to the target audience. Since the
outcome of the project is a website, it is not possible to actually analyze the profit or the amount
that could be charged on advertisements until it is out in the market and people response to it is
known. Hence, I present below some statistics of current market players and the money they
35
make, just to give an idea of how much money can be made by such a website. The figures like
profit & loss, revenue etc of Eatout.in is based upon these values.
7.4.4.1 Yelp.com (source: Alexa.com and cubestat.com, more information is available)
This website provides similar functionalities to the proposed website, but targeted to different
audience.
Yelp.com has a traffic rank of: 596
Website Worth: $273,750,000.00 Daily Page views: 125,000,000
Figure 11: Traffic Trend of Yelp.com (from Alexa.com)
7.4.4.2 Burrp.com (source: Alexa.com and cubestat.com, more information is available)
This website provides lot more functionality compared to the proposed website to the same
targeted audience. The target is to acquire a small percentage (20%) of this websites revenue as
the investment and effort put is very less compared to burrp.com
Burrp.com has a traffic rank of: 31,148
36
Website Worth: $61,871.88 Daily Page views: 28,252
Figure 12: Traffic Trend of Burrp.com (from Alexa.com)
7.4.4.3 Vahrehvah.com (source: Alexa.com and cubestat.com, more information is
available)
This website contains only one functionality that is to be present in the proposed website. The
mission is to have all the contents present in this website be accessed from the proposed website
that way there is mutual growth among both the websites.
Vahrehvah.com has a traffic rank of: 51,918
Website Worth: $42,183.78 Daily Pageviews: 19,262
37
Figure 13: Traffic Trend of vahrehvah.com (from Alexa.com)
7.4.4.4 Comparison chart
Figure 14: Traffic Trend Comparison (from Alexa.com)
The above figures are of successful websites which is 100% grown and hence such figures will
be our final destination or target. But it is clear that a lot of money revolves around these
websites today and a potential market is available for us to acquire.
38
7.5 Competitors
As already mentioned, there are no actual competitors with the targeted audience. Though there
are few communities and forums for the same functionality they cannot be treated as a
competitor as they have limited flexibility and their core purpose is different. The product we
have come up with will be the first of the kind for the target audience.
7.6 Customers
The ad providers are the customers here as they bring in the revenue and not the users (They are
only indirectly responsible for the revenue by bringing in traffic). There are several ad providers
in the internet and one top and major player is Google Adsense. Google Adsense will be our
primary source of advertisements. Apart from that, there are few other providers mentioned
below.
Here is the explanation of the abbreviations used in this table: [14]
• Company - Link to the site • Ad Placement Models:
Sell Ad Space - you place the link on the site and the buyer buys the right to put ads on your site
Contextual - your page is parsed and the most relevant (in theory) ads are automatically displayed
Keywords - you choose the keywords and ads based on those keywords are displayed
• Revenue Models:
PPC (CPC) - pay per click (cost per click) PPM (CPM) - pay per impression, usually pay per 1000 views PPL - pay per lead (e.g. survey, form, download trial) PPA - pay per action or acquisitioni (e.g. sale)
• Investment: - whether you need to pay upfront
39
• Payout - How much $$$ you can make. Either you get paid % of the revenue generation by ad or the bid
• Notes - extra comments
Company Ad Placement Model
Revenue Model Invest ment
Payout Notes
Sell Ad
Space
Con tex tual
Keyword
PPC PPM PPL PPA
Adagency1 70%
AdBrite V V 75%
Advertising V V ???
AffiliateSensor V V 90-95% clickbank
AdSense V V V V ???
AllFeeds V 60%
AuctionAds V free 100% $10 min/month payout via paypal
AzoogleAds V V ???
BidClix V V V bid/???
Bidvertiser V V bid/??? US-only
Buds Media 60%
Burst! Media ??? 5,000+ monthly page views
BetterTextAds.com V V free 100% - MLM
clickbank, home-income-team, ListJoe.com, MLM
Casale Media V V 70% 10,000+
40
unique monthly visitors
CBprosense V V $89/y 100%? clickbank
Chitika eMiniMalls V V ???
Claxon 85% 100,000+ monthly page views English content
Clickcent V 65%
Clicksor V up to 85%
ContextCash V V $97+ $37/m
???
ContextClick V V 65%
contextWeb ContextAd
V V 50%
DynamiContext Kontera
V V 0 50% Compatible with AdSense!
Enhance Interactive
V ???
FairAdsNetwork V V V basic free
60%
Hurricane Digital Media
60-75%
ImgAds V V free to $16
up to 75% clickbank
Kanoodle BrightAds
V V 50%
Linkshare $1.50/ref
LookSmart V V ???
Mamma Media Solutions
V 50% based on search
41
MIVA AdRevenue Xpress
V ???
NeverblueAds V V V free client set through web, email, paid search and sw
Nixie V ???
Pay-Per-Play V V V 25% pay-per-play 5 secs audio, two levels of referrals
Quigo AdSonar V ???
RealCast Media V ???
RealTechNetwork V V V ??? 25,000 montly page views
Revenue Pilot V V 60%
Right Media ???
SearchFeed ???
ShoppingAds V V free ??? $50 min/month payout via paypal
TargetPoint V V 50%+
TextAdMarket V V 75% also CPD
Text Link Ads V V free 50% server side script
Traffic Marketplace
65%
Tribal Fusion V ???
ValueClick V V V V ???
Veoda V V V 60%-90%
42
Vibrant Media IntelliTXT & SmartAds
V V 45%
WidgetBucks V free undisclosed promise an equivalent of $3-6 CPM. $50 min/month payout
Yahoo Publisher Network
V V ??? US only
Table 3: Ad Provides and their features (http://stason.org/articles/money/passive_income/ads/ppc/adsense_alternatives.html)
7.7 Cost summary
EatOut.in is a website that is planned to be developed in a shoe string budget. The strategy is to
develop the first version, put it in market and depending on the feedback, take it to next level.
The reason to this is that, this is a novel idea to the targeted audience and the response that will
be obtained cannot be known unless it is out there. The cost is divided into two major areas, cost
of development (non-recurring cost) and operating cost (recurring cost).
Since the product is a social networking website which grows by itself with traffic, there is no
additional resource, infrastructure required after the development. The website is hosted in a 3rd
party environment and this is the only operating cost. So in our scenario, beyond development
there is no labor cost, overhead cost and infrastructure cost, instead there is a fee paid to
godaddy.com which takes care of the above issues.
7.7.1 Cost of development
This is the cost spent to develop the website and put it out in the web. The table below shows the
cost spent for performing each action or work involved in the development process and also the
number of resources used.
43
s.no Action / Work Description Resource Time Required
Cost / month
Total Cost
1 Design Design of the website 1 2 months $4500 2*4500 = $9,000
2 Development Actual Development of the website 1 3 months $4500 3*4500 =
$13,500
3 Softwares Used
Only open source or free softwares are used N/A N/A 0 0
4 Infrastructure
No additional infrastructure is required, personal computer is used for development.
N/A N/A 0 0
5 Information Collection
Collecting information present in the website 2 2 months $800 2*2*800
= $3,200 Total $25,700
Table 4: Cost of Development
7.7.2 Operating cost
This is the cost spent to run the website. The table below shows the cost spent for each action or
work involved in the keeping the website live for a period of five year.
S.no
Cost Type
Action / Work 2009 2010 2011 2012 2013
1 Fixed
Domain (EatOut.in) in godaddy.com
$9.99 $9.99 $9.99 $9.99 $9.99
2 Variable
Hosting costs (Dedicated Server) in godaddy.com
$874.56 ($145.76*6)
$1749.12 $1749.12 $4175.04
($347.92*12) $4175.04
4 Variable Marketing cost $2000 $1000 $1000 $500 $500
Total $2,884 $2,759 $2,759 $4,685 $4,685Table 5: Operating Cost
44
7.8 Price Point
The price of the product is determined by analyzing the information of similar products like
yelp.com, vahrehvah.com, obtained from sources like alexa.com and googleAnalytics.com. The
revenue obtained from ads is based on the traffic and the number of advertisement clicks. Google
Adsense provides 1c to 10c per view. So for a website generating around 20,000 page views
(based on the information obtained from sources like alexa.com and googleAnalytics.com,
20,000 page views is the average page views of the three similar products take into account.)
every day, anything between $1500 to $3000 can be generated every month. In addition, hosting
services for restaurants (Host their webpage on our website) shall be charged $20/month (Based
upon the survey conducted with different restaurant owners in the targeted locality, on how much
they will be willing to spend for such a service). Though this amount will be small for the
restaurants when compared to their traditional marketing costs, it will be a huge amount for us
based on the volume business model. Say, we charge $20/month to market every restaurant and
we got 40 such restaurant (From the survey, 40 restaurants agreed to go with the service, if
offered), we will be making around $800/ month but for every restaurant it is just $20 which is
nothing compared to the money they spend on marketing.
7.9 SWOT Assessment
For any business, it is quite important to evaluate its strengths, weaknesses, opportunities and
threats to identify corrective measures for future planning. The following Figure is the SWOT
assessment for this company. The main strength of the product is the less initial investment and
first of the kind value for the target audience.
45
Strengths Weaknesses
1. The concept is new to the target audience.
2. Initial investment is very less and if
popular, very fast ROI.
3. Since similar products have become
successful, the chances of success are very
high.
1. Only 10% of population is computer
savvy.
2. Only small percentage of the internet
users are interested in restaurants and
foods.
3. All visitors may not become users.
Opportunities Threats
1. According to the research, internet usage
with the target audience for such activities
is very high in the current times.
2. The website is very attractive and user
friendly to guarantee repeat audience.
1. Chances that the target audience may
not feel comfortable with the website
and stick to the existing forums and
communities.
Table 6: SWAT Analysis
7.10 Investment Capital Requirements
The company breaks even in the fourth quarter of 2009 and before that it requires $26,884 of
capital investment. Though $26,884 seems very low for US standards, it is equivalent to
1,344,200 Rs which is a huge amount in India. Similarly the marketing cost of 50,000 Rs –
100,000 Rs per year ($1000 - $2000) is quite sufficient for a country like India. The company
will require this money for initial development and operation for the first year. After the break
even, the profit keeps increasing but the cost is stationary and very low.
46
Total Income (in $) S.no Year
Total Cost (in $) Ads Restaurant
Hosting Total
Profit (in $)
1 2009 (3rd & 4th Quarter) 28,584 500 1200 1700 - 26,884
2 2010 2,759 6000 4800 10,800 8,041 3 2011 2,759 12,000 7200 19,200 16,441 4 2012 4,685 18,000 9600 27,600 22,915 5 2013 4,685 24,000 9600 33,600 28,915
Table 7: Cost, Income and Profit
The break even condition for the company is displayed by the following graph.
Figure 15: Break even Analysis
7.11 Return on Investment
It is good to invest in a business which provides high Return on Investment. From the above
calculation of development cost and forecasting figures, the ROI for the next five years can be
calculated using the following formula,
% ROI = [(Total Revenue – Total Expense)/Total Expense]
Year Total Income ($) Total Expense ($) % ROI
47
2009 1700 28,584 -0.94
2010 10,800 2,759 2.91
2011 19,200 2,759 5.95
2012 27,600 4,685 4.89
2013 33,600 4,685 6.17
Table 8: Return of Investment
The company expects to achieve an ROI of 6.17% at the end of five years. ROI of 2.91% is
expected from the second year onwards which is very good news for the investors. The projected
income of $33,600 at the end of 5 years will be from one locality. Depending on the response,
same product is to be offered to different localities. So say by the end of 5 years, 5 such replicas
are made, the income will be $168,000 and again this is a huge income when converted in
rupees.
7.12 Personnel
The product is hosted in a third party environment provided by godaddy.com. They take care of
all the services like hosting, support and maintenance. Marketing is done by online ads which are
also provided free by different websites, no personnel are required for this operation. The content
of the website is provided by the users itself as this is a social networking website. Hence no
personnel are required after the development phase, the website functions and grow by itself, all
that is required is a operating cost that is to be paid to godaddy.com for their services.
During development two resource are required, one for design and development and 2 for
collecting information. Since is the resources for collecting information are from India, the
amount paid is very less.
48
7.13 Business and Revenue Model
There is two source of revenue. The initial source of revenue will be from Google AdSense. The
money that can be obtained from Google Adsence varies from 1c to $1 per page view and 10c to
$20 per click of the Ad. If average of 20,000 views/month is achieved, $1500 - $3000 per
month revenue can be obtained from ads. But this amount cannot be obtained from day one. The
average views in the first month shall be around 100 which will generate only $30. This will
slowly and gradually increase with the popularity of the website. The advantage here is the
operating cost will remain the same whereas the revenue increases with time and popularity.
When the website becomes popular, small amount of money can be obtained from restaurants
itself to market them through are website. Though this amount will be small for the restaurants
when compared to their traditional marketing costs, it will be a huge amount for us based on the
volume business model. Say, we charge $20/month to market every restaurant and we got 40
such restaurant (The website will have a total of more than 300 restaurants), we will be making
around $800/ month but for every restaurant it is just $20 which is nothing compared to the
money they spend on marketing.
7.14 Strategic Alliance/Partners
At present or in the first 5 years, there are no plans of partnering with any other companies. For
this product there is no need to partner as it does not require any other service for operation and
also the operating cost is very less and can be handled by ourselves.
7.15 Profit & Loss
Once the development cost is identified, and revenue model is generated, the company requires
analyzing and forecasting the profit and loss to check the worth of its investments. The company
49
starts in the third quarter of year 2009. In the following charts the quarterly distribution of
expenses, revenues and profit/losses are depicted for the first two years.
S.no Quarter Total Cost (in $)
Total Income (in $)
Profit (in $)
1 2009 Q3 27,895 0 - 27,895 2 2009 Q4 689 1700 1,011 3 2010 Q1 689 2700 2,011 4 2010 Q2 689 2700 2,011 5 2010 Q3 689 2700 2,011 6 2010 Q4 689 2700 2,011 7 2011 Q1 689 4800 4,111 8 2011 Q2 689 4800 4,111
Table 9: Profit & Loss
Figure 16: Profit & Loss
7.16 Exit Strategy
The Exit Strategy of EatOut.in is to merge with an existing popular social networking website.
This was EatOut.in can operate as a section or module of the parent social networking site.
50
8.0 Project Schedule
All stages of the project which includes research, design, development and testing was spread
over two semesters that is around 30 weeks. The research, and design was completed in the first
semester and the actual implementation is completed in the second semester. Since this is a
commercial website, large amount of time and resource is allocated to testing.
8.1 Resource Allocation
Since this is a single member project, I will be working on all phases of the project with the
guidance of my Technical sponsor and Reader. In addition to this, there is one resource present
in India for information gathering.
8.2 Committee Responsibility
Team
I will be doing all the required research, preparation of design restaurants, implementation or
development of the project and testing.
Technical Sponsor
In addition to providing financial assistance and resources required for the project, he will guide
me in all stages of the project especially in the research and design phase as industrial experience
plays a vital role in these stages.
Reader
The reader will also guide me in also stages of the project and help me perform this project in a
way required by the University. Being a professor of User Interface Design, he will guide me
valuably in the UI design of the website.
8.3 Gantt chart
51
The Gantt chart and milestone & deliverable table present below was developed during the
planning phase (ENGR 281) and every work done on the project was based on this. Every
milestone and deliverable was accomplished as per the schedule except for the last deliverable
(Final product) which was delayed by two weeks due to some cosmetic enhancements that were
added after the creation of the product.
52
Figure 17: Gantt Chart
8.3.1 Milestones
53
S.No Milestone Date 1 Final Project Scope 11/14/2008 2 Completion of the complete UI Design 01/02/2009 3 Completion of Development Phase 1 (Reviews
module) 02/28/2009
4 Completion of Development Phase 2 (Remaining modules)
03/03/2009
5 Completion of the Final Product. 05/05/2009 Table 10: Milestones
8.3.2 Deliverables
S.No Deliverables Date 1 Scope Report 09/26/2008 2 Literature Review 10/10/2008 3 Economic Analysis 10/24/2008 4 Final Project Scope Report 11/14/2008 5 complete UI Design 01/02/2009 6 Development Phase 1 (Reviews module) 02/28/2009 7 Development Phase 2 (Remaining modules) 03/03/2009 8 Final Product. 04/21/2009 9 Cosmetic Enhancement 05/05/2009 (Added new)
Table 11: Deliverables
9.0 Conclusion
This website will provide its worthy to all the food buffs in India and it will act as a platform for
people to know and discuss about restaurants and food available in these places. It will help
people to have a better understanding about what is offered in a restaurant, before actually going
there and spending lot of money.
This website has the potential to become a great start up and can become a good source of
revenue if developed and marketed well. This idea if clicked could become really popular among
the targeted audience thus generating lot of traffic and effectively money. The initial investment
is very less and hence ROI (Return of investment) can be easily achieved.
Planning a Date, throw a party, treat your friends, take parents out.... don’t know the right
place, Go to www.eatout.co.in
54
55
10.0 Future Work
As mentioned in the introduction, the website developed is just the first version of it. Several
enhancements and upgrades have to be done after analyzing the user response. Activities like
Collection of actual data, Search engine optimization etc that are mentioned in the Out of Scope
section has to be completed. As this is in Beta phase, all bugs and defects found should be fixed.
As the content and traffic of the website increases automatically with increase in the number of
users, maintenance and support is very minimal after the live launch. Last, the project is to
develop the website for one city only, the same has to be replicated and appropriate data is to be
added for other cities in the country.
56
Reference
[1] Web 2.0. (2008, September 25). In Wikipedia, The Free Encyclopedia. Retrieved 20:42
September 26, 2008, from
http://en.wikipedia.org/w/index.php?title=Web_2.0&oldid=240813390
[2] http://www.yelp.com
[3] http://www.food.yahoo.com
[4] Chapter 27 of Web Design in a Nutshell (O’Reilly Media, Inc., third edition,
February 21, 2006). —Ed.
[5] AJAX Tutorial. Retrieved on October 4, 2008 from
http://www.w3schools.com/Ajax/default.asp
[6] A Simple AJAX Example. Retrieved on October 10, 2008 from
http://daniel.lorch.cc/docs/ajax_simple/.
[7] Asynchronous JavaScript Technology and XML (Ajax) With the Java Platform.
Retrieved on October 10, 2008 from
http://java.sun.com/developer/technicalArticles/J2EE/AJAX/
[8] Mastering Ajax, Part 8: Using XML in requests and responses from IBM
Technical Library. Retrieved on September 20, 2008 from
http://www.ibm.com/developerworks/web/library/waajaxintro8.html?S_TACT=105AGX
08&S_CMP=EDU
[9] SQL Tutorial. Retrieved on September 28, 2008 from
http://www.w3schools.com/sql/default.asp
[10] Description of Web Design in a Nutshell, Third Edition from
http://oreilly.com/catalog/9780596009878/
57
[11] Ajax Frameworks in Interactive Web Apps, Abstract from
http://proquest.umi.com.libaccess.sjlibrary.org/pqdweb?index=0&sid=1&srchmode=1&v
inst=PROD&fmt=2&startpage=1&vname=PQD&did=1326210891&scaling=FULL&pmid=162
83&vtype=PQD&fileinfoindex=%2Fshare4%2Fpqimage%2Fpqirs104%2F20081010170833843
%2F8186%2Fout.pdf&rqt=309&TS=1223672914&clientId=17867
[12] Ajax Frameworks in Interactive Web Apps
Nicolás Serrano, Juan Pablo Aroztegi. IEEE Software. Los Alamitos: Sep/Oct 2007. Vol.
24, Iss. 5; pg. 12
[13] Google Analytics. Retrieved on October 10, 2008 from
http://www.google.com/analytics/
www.alexa.com
www.burrp.com
www.orkut.com
www.vahrehvah.com
www.milliondollarhomepage.com
http://amma-cheppindi.blogspot.com/
[14] http://stason.org/articles/money/passive_income/ads/ppc/adsense_alternatives.html
Ajax Tutorial (Asynchronous Javascript And XML). Retrieved October 2, 2008 from
http://www.xul.fr/en-xml-ajax.html
A Simple AJAX Tutorial. Retrieved September 29, 2008 from
http://www.codecoffee.com/articles/ajax.html
Rasmus' 30 second AJAX Tutorial. Retrieved September 20, 2008 from
http://rajshekhar.net/blog/archives/85-Rasmus-30-second-AJAX-Tutorial.html
58
Simple AJAX Example. Retrieved October 1, 2008 from
http://daniel.lorch.cc/docs/ajax_simple/
Getting Started with Ajax by Aaron Gustafson. Retrieved October 5, 2008 from
http://www.alistapart.com/articles/gettingstartedwithajax
AJAX Tutorial. Retrieved September 6, 2008 from W3Schools
(http://www.w3schools.com/ajax/default.asp)
J2EE and AJAX: AJAX with Servlets. Retrieved September 20, 2008 from
http://www.devarticles.com/c/a/Java/J2EE-and-AJAX-AJAX-with-Servlets/3/
Asynchronous JavaScript Technology and XML (Ajax) With the Java Platform.
Retrieved October 4, 2008 from Sun developer network
(http://java.sun.com/developer/technicalArticles/J2EE/AJAX/)
Ajax client/server communication can be a tricky business
Brett McLaughlin ([email protected]), Author and Editor, O'Reilly Media Inc on
07 Nov 2006
How To Handle AJAX Responses By Kris Hadlock Feb 10, 2006. Retrieved September
29, 2008 from http://www.peachpit.com/articles/article.aspx?p=443580&seqNum=4
The AJAX response: XML, HTML, or JSON?. Retrieved October 8, 2008 from
http://www.quirksmode.org/blog/archives/2005/12/the_ajax_respon.html
Ajax: A New Approach to Web Applications by Jesse James Garrett on February 18,
2005. Retrieved October 9, 2008 from
http://www.adaptivepath.com/ideas/essays/archives/000385.php
AJAX. Retrieved September 2, 2008 from http://developer.mozilla.org/en/AJAX
59
Appendix A
Source Code:
MainServlet.java package servlet; import java.io.IOException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import javax.mail.MessagingException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import util.ConnectionManager; import util.LogMessage; import util.SendMail; import util.WriteFile; public class MainServlet extends HttpServlet { private ServletContext servletCtx = null; public void init() throws ServletException { super.init(); servletCtx = getServletContext(); } public void doGet(HttpServletRequest request, HttpServletResponse response) { processRequest(request, response); } public void doPost(HttpServletRequest request, HttpServletResponse response) { processRequest(request, response); } //Method to redirect or execute actions private void processRequest(HttpServletRequest request, HttpServletResponse response)
60
{ //For logging LogMessage logger = new LogMessage(); logger.log("Inside Main Servlet - processRequest"); String action = ""; if(request.getParameter("hdaction")!=null) action = request.getParameter("hdaction"); logger.log("hdaction: "+action); String query=""; String Output=""; String domid=""; String id=""; String chkuserid = ""; PreparedStatement preStatement = null; ResultSet rs = null; PreparedStatement preStatement2 = null; ResultSet rs2 = null; PreparedStatement preStatement3 = null; ResultSet rs3 = null; PreparedStatement preStatement4 = null; ResultSet rs4 = null; PreparedStatement preStatement5 = null; ResultSet rs5 = null; PreparedStatement preStatement6 = null; ResultSet rs6 = null; PreparedStatement preStatement7 = null; ResultSet rs7 = null; Connection connection = null; ConnectionManager ConnManager = null; WriteFile wf = new WriteFile(); try { ConnManager = new ConnectionManager(); connection = ConnManager.openConnection(); connection.setAutoCommit(false); if(!action.equalsIgnoreCase("userinfo") && !action.equalsIgnoreCase("profile") && !action.equalsIgnoreCase("restaurant") && !action.equalsIgnoreCase("blog") && !action.equalsIgnoreCase("loadhome")) { //To write the files if (action.equalsIgnoreCase("write")) { logger.log("In Write Section"); String home=""; String domain=""; String soft=""; String from=""; String to="";
61
int homeflag; int userflag; int submitflag; int domainflag; int softflag; String writemessage="Wrtiting Files: <br>"; if(request.getParameter("home")!=null && request.getParameter("home")!="") { home=request.getParameter("home"); logger.log("Home Value: "+home); if(home.equalsIgnoreCase("true")) { homeflag = fetchHome(); if(homeflag>0) writemessage+="Home Page written sucessfully <br>"; userflag = fetchUser(); if(userflag>0) writemessage+="User Page written sucessfully <br>"; submitflag = fetchSubmit(); if(submitflag>0) writemessage+="Submit Page written sucessfully <br>"; } } if(request.getParameter("domain")!=null && request.getParameter("domain")!="") { domain=request.getParameter("domain"); logger.log("Domain Value: "+domain); from=request.getParameter("from"); logger.log("From Value: "+from); to=request.getParameter("to"); logger.log("To Value: "+to); if(domain.equalsIgnoreCase("true")) { domainflag = fetchDomain(from, to, ""); if(domainflag>0) writemessage+="Domain Pages written sucessfully - "+domainflag+" files. <br>"; } else { domainflag = fetchDomain("", "", domain); if(domainflag>0) writemessage+="Domain Page <b>("+domain+")</b> written sucessfully <br>"; }
62
} if(request.getParameter("soft")!=null && request.getParameter("soft")!="") { soft=request.getParameter("soft"); logger.log("Soft Value: "+soft); from=request.getParameter("from"); logger.log("From Value: "+from); to=request.getParameter("to"); logger.log("To Value: "+to); if(soft.equalsIgnoreCase("true")) { softflag = fetchSoftware(from, to, ""); if(softflag>0) writemessage+="Software Pages written sucessfully - "+softflag+" files. <br>"; } else { softflag = fetchSoftware("", "", soft); if(softflag>0) writemessage+="Software Page <b>("+soft+")</b> written sucessfully <br>"; } } Output=writemessage+"Go To: <a href="+'"'+"/eatout/"+'"'+">Home Page</a>"; } //To Redirect from Old GPLpedia else if (action.equalsIgnoreCase("redirect")) { logger.log("In ReDirect Section"); String name=""; String iid=request.getParameter("id"); logger.log("Id Value: "+iid); String act=request.getParameter("act"); logger.log("Act Value: "+act); String did=request.getParameter("did"); logger.log("Did Value: "+did); if(iid.equalsIgnoreCase("")&&act.equalsIgnoreCase("domain")&&!did.equalsIgnoreCase("")) { query = "select catname from software_domain_categories where id="+did; preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); if (rs.next()) { name=wf.modifyname(rs.getString("catname"));
63
Output="http://www.gplpedia.com/eatout/Domains/"+name+".html"; } else { Output="http://www.gplpedia.com/gplpedia"; } } else if(!iid.equalsIgnoreCase("")) { query = "select prod_name from software_domains where id = "+iid; preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); if (rs.next()) { name=wf.modifyname(rs.getString("prod_name")); if(act.equalsIgnoreCase("demo")) Output="http://www.gplpedia.com/eatout/restaurants/"+name+".html"; else if(act.equalsIgnoreCase("documentation")) Output="http://www.gplpedia.com/eatout/restaurants/"+name+".html"; else if(act.equalsIgnoreCase("download")) Output="http://www.gplpedia.com/eatout/restaurants/"+name+".html"; else if(act.equalsIgnoreCase("forum")) Output="http://www.gplpedia.com/eatout/Softwares/forums/"+name+".html"; else if(act.equalsIgnoreCase("blog")) Output="http://www.gplpedia.com/eatout/Softwares/bookmarks/"+name+".html"; else if(act.equalsIgnoreCase("developers") || act.equalsIgnoreCase("service")) Output="http://www.gplpedia.com/eatout/restaurants/"+name+".html?act=users"; else if(act.equalsIgnoreCase("about")) Output="http://www.gplpedia.com/eatout/restaurants/"+name+".html?act=about"; else Output="http://www.gplpedia.com/eatout/restaurants/"+name+".html"; } else { Output="http://www.gplpedia.com/gplpedia"; } } else Output="http://www.gplpedia.com/gplpedia"; } //On Load of home,domain and software pages, to get session data else if (action.equalsIgnoreCase("loadSession")) { logger.log("In load Home Section"); HttpSession session = request.getSession();
64
if (session.isNew()) { session = request.getSession(true); session.setAttribute("loggeduser",""); session.setAttribute("loggeduserid",""); logger.log("Creating a New Session"); } else { session = request.getSession(false); logger.log("loggeduser: "+session.getAttribute("loggeduser")); logger.log("loggeduserid: "+session.getAttribute("loggeduserid")); } if(session.getAttribute("loggeduserid")!=null && session.getAttribute("loggeduserid")!="") Output=session.getAttribute("loggeduserid").toString(); } //On update of tab - Software else if(action.equalsIgnoreCase("restaurants")||action.equalsIgnoreCase("restaurants")||action.equalsIgnoreCase("forums")||action.equalsIgnoreCase("restaurants")||action.equalsIgnoreCase("bookmarks")) { logger.log("In update - Software section"); if(request.getParameter("txtid")!=null) id = request.getParameter("txtid"); logger.log("Softid: "+id); if(request.getParameter("Domid")!=null) domid = request.getParameter("Domid"); logger.log("Domid: "+domid); Output=fetchSoftwareLinks(action,id,domid,8,"page"); } //On update of tab - User else if(action.equalsIgnoreCase("urestaurants")||action.equalsIgnoreCase("urestaurants")||action.equalsIgnoreCase("uforums")||action.equalsIgnoreCase("urestaurants")||action.equalsIgnoreCase("ubookmarks")) { logger.log("In update - User section"); chkuserid = request.getParameter("chkuserid"); logger.log("chkuserid value: "+chkuserid); if(chkuserid.equalsIgnoreCase("profile")) { HttpSession session = request.getSession(false); String temp = session.getAttribute("loggeduserid").toString(); chkuserid = temp.substring(1, temp.length()); logger.log("Chkuserid Value: "+chkuserid); } Output=fetchLinks(action,"",chkuserid,8,"tab"); } //On update of tab - Home
65
else if(action.equalsIgnoreCase("hrestaurants")||action.equalsIgnoreCase("hrestaurants")||action.equalsIgnoreCase("hforums")||action.equalsIgnoreCase("hrestaurants")||action.equalsIgnoreCase("hbookmarks")) { logger.log("In update - Home section"); Output=fetchLinks(action,"","",11,"page"); } //On update of tab(latest) - Home else if(action.equalsIgnoreCase("hlatest")) { logger.log("In update (hlatest) - Home section"); Output=fetchLinks(action,"","",11,"page"); } //On update of tab - Domain pages else if(action.equalsIgnoreCase("drestaurants")||action.equalsIgnoreCase("drestaurants")||action.equalsIgnoreCase("dforums")||action.equalsIgnoreCase("drestaurants")||action.equalsIgnoreCase("dbookmarks")) { logger.log("In update - Domain section"); if(request.getParameter("Domid")!=null) domid = request.getParameter("Domid"); logger.log("Domid: "+domid); Output=fetchLinks(action,domid,"",11,"page"); } //On update of tab(latest) - Domain pages else if(action.equalsIgnoreCase("dlatest")) { logger.log("In update (dlatest) - Domain section"); if(request.getParameter("Domid")!=null) domid = request.getParameter("Domid"); logger.log("Domid: "+domid); Output=fetchLinks(action,domid,"",11,"page"); } //On update of tab (professionals & vendors) - Home else if(action.equalsIgnoreCase("hprofessionals") || action.equalsIgnoreCase("hvendors") ) { logger.log("In update (hprofessionals & hvendors) - Home section"); String type=""; String city=""; String state=""; String country=""; String userid=""; String name=""; String photo=""; String photo_path=""; ArrayList linklist = new ArrayList(); if(action.equalsIgnoreCase("hprofessionals")) query = "select id, user_type,username,company_name,city,state,country,photo_name,created_on from registered_users where user_type = 1 and activated =1 order by created_on desc limit 60"; else if(action.equalsIgnoreCase("hvendors"))
66
query = "select id, user_type,username,company_name,city,state,country,photo_name,created_on from registered_users where user_type = 2 and activated =1 order by created_on desc limit 60"; else logger.log("Wrong User action"); preStatement3 = connection.prepareStatement(query); rs3 = preStatement3.executeQuery(); int j=0; int k=2; int t=0; while (rs3.next()) { city = rs3.getString("city"); state = rs3.getString("state"); country = rs3.getString("country"); userid = rs3.getString("id"); photo = rs3.getString("photo_name"); if(rs3.getString("user_type")!=null) { type = rs3.getString("user_type"); if(rs3.getString("user_type").equalsIgnoreCase("1")) name = rs3.getString("username"); else if(rs3.getString("user_type").equalsIgnoreCase("2")) name = rs3.getString("company_name"); else name = ""; } else { name = ""; } if(!photo.equalsIgnoreCase("")) { if(type.equalsIgnoreCase("1")) photo_path="<img height=60px width=60px id="+'"'+"vendor_logo"+'"'+" src="+'"'+"http://www.gplpedia.com/profile_images/"+photo+'"'+" />"; else photo_path="<img height=60px width=60px id="+'"'+"prof_logo"+'"'+" src="+'"'+"http://www.gplpedia.com/profile_images/"+photo+'"'+" />"; } else { if(type.equalsIgnoreCase("1")) photo_path="<img src="+'"'+"/eatout/images/user.png"+'"'+" />"; else photo_path="<img src="+'"'+"/eatout/images/user2.png"+'"'+" />";
67
} if(j==20) { if(city.equalsIgnoreCase("")) linklist.add("</tr></table></div><div id='divlist"+k+"' style='display: none;'><table cellpadding="+'"'+"2"+'"'+" cellspacing="+'"'+"2"+'"'+" width="+'"'+"100%"+'"'+"><tr align="+'"'+"left"+'"'+"><td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+state+"<br>"+country+"</div></td>"); else linklist.add("</tr></table></div><div id='divlist"+k+"' style='display: none;'><table cellpadding="+'"'+"2"+'"'+" cellspacing="+'"'+"2"+'"'+" width="+'"'+"100%"+'"'+"><tr align="+'"'+"left"+'"'+"><td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+city+", "+state+"<br>"+country+"</div></td>"); j=0; k++; t=1; } else { if(t==4) { if(city.equalsIgnoreCase("")) linklist.add("</tr><tr><td> </td></tr><tr align="+'"'+"left"+'"'+"><td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+state+"<br>"+country+"</div></td>"); else linklist.add("</tr><tr><td> </td></tr><tr align="+'"'+"left"+'"'+"><td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+city+", "+state+"<br>"+country+"</div></td>"); t=1; } else { if(city.equalsIgnoreCase("")) linklist.add("<td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+state+"<br>"+country+"</div></td>"); else linklist.add("<td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+city+", "+state+"<br>"+country+"</div></td>"); t++; }
68
} j++; } Output+="<div id="+'"'+"TabLinks_height"+'"'+"><input type='hidden' id='hdpage' value='divlist1'/><div id='divlist1' style='display: inline'>"; Output+="<table cellpadding="+'"'+"2"+'"'+" cellspacing="+'"'+"2"+'"'+" width="+'"'+"100%"+'"'+"><tr align="+'"'+"left"+'"'+">"; for(int r=0;r<linklist.size();r++) { Output+=linklist.get(r); } Output+="</tr></table>"; Output+="</div></div>"; logger.log("K: "+k); if(k>2) { Output+="<h2 class="+'"'+"title2"+'"'+" id="+'"'+"TabLinks_goto"+'"'+"><span id="+'"'+"pag_goto"+'"'+">GoTo:"; for(int w=1;w<k;w++) { Output+=" [<a href="+'"'+"javascript:pagination('divlist"+w+"')"+'"'+">"+w+"</a>]"; } Output+="</span></h2><br>"; } } //On update of tab (professionals & vendors) - Domain pages else if(action.equalsIgnoreCase("dprofessionals") || action.equalsIgnoreCase("dvendors") ) { logger.log("In update (dprofessionals & dvendors) - Domain section"); String type=""; String city=""; String state=""; String country=""; String userid=""; String name=""; String photo=""; String photo_path=""; ArrayList linklist = new ArrayList(); if(request.getParameter("Domid")!=null) domid = request.getParameter("Domid"); logger.log("Domid: "+domid); if(action.equalsIgnoreCase("dprofessionals")) query = "select id, user_type,username,company_name,city,state,country,photo_name,created_on from registered_users where id in (select user_id from developers where domain_id = '"+domid+"') order by username"; else if(action.equalsIgnoreCase("dvendors")) query = "select id, user_type,username,company_name,city,state,country,photo_name,created_on from registered_users where id in (select user_id from service_providers where domain_id = '"+domid+"') order by username";
69
else logger.log("Wrong User action"); preStatement3 = connection.prepareStatement(query); rs3 = preStatement3.executeQuery(); int j=0; int k=2; int t=0; while (rs3.next()) { city = rs3.getString("city"); state = rs3.getString("state"); country = rs3.getString("country"); userid = rs3.getString("id"); photo = rs3.getString("photo_name"); if(rs3.getString("user_type")!=null) { type = rs3.getString("user_type"); if(rs3.getString("user_type").equalsIgnoreCase("1")) name = rs3.getString("username"); else if(rs3.getString("user_type").equalsIgnoreCase("2")) name = rs3.getString("company_name"); else name = ""; } else { name = ""; } if(!photo.equalsIgnoreCase("")) { if(type.equalsIgnoreCase("1")) photo_path="<img height=60px width=60px id="+'"'+"vendor_logo"+'"'+" src="+'"'+"http://www.gplpedia.com/profile_images/"+photo+'"'+" />"; else photo_path="<img height=60px width=60px id="+'"'+"prof_logo"+'"'+" src="+'"'+"http://www.gplpedia.com/profile_images/"+photo+'"'+" />"; } else { if(type.equalsIgnoreCase("1")) photo_path="<img src="+'"'+"/eatout/images/user.png"+'"'+" />"; else photo_path="<img src="+'"'+"/eatout/images/user2.png"+'"'+" />"; } if(j==20)
70
{ if(city.equalsIgnoreCase("")) linklist.add("</tr></table></div><div id='divlist"+k+"' style='display: none;'><table cellpadding="+'"'+"2"+'"'+" cellspacing="+'"'+"2"+'"'+" width="+'"'+"100%"+'"'+"><tr align="+'"'+"left"+'"'+"><td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+state+"<br>"+country+"</div></td>"); else linklist.add("</tr></table></div><div id='divlist"+k+"' style='display: none;'><table cellpadding="+'"'+"2"+'"'+" cellspacing="+'"'+"2"+'"'+" width="+'"'+"100%"+'"'+"><tr align="+'"'+"left"+'"'+"><td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+city+", "+state+"<br>"+country+"</div></td>"); j=0; k++; t=1; } else { if(t==4) { if(city.equalsIgnoreCase("")) linklist.add("</tr><tr><td> </td></tr><tr align="+'"'+"left"+'"'+"><td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+state+"<br>"+country+"</div></td>"); else linklist.add("</tr><tr><td> </td></tr><tr align="+'"'+"left"+'"'+"><td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+city+", "+state+"<br>"+country+"</div></td>"); t=1; } else { if(city.equalsIgnoreCase("")) linklist.add("<td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+state+"<br>"+country+"</div></td>"); else linklist.add("<td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+city+", "+state+"<br>"+country+"</div></td>"); t++; } } j++; }
71
Output+="<div id="+'"'+"TabLinks_height"+'"'+"><input type='hidden' id='hdpage' value='divlist1'/><div id='divlist1' style='display: inline'>"; Output+="<table cellpadding="+'"'+"2"+'"'+" cellspacing="+'"'+"2"+'"'+" width="+'"'+"100%"+'"'+"><tr align="+'"'+"left"+'"'+">"; for(int r=0;r<linklist.size();r++) { Output+=linklist.get(r); } Output+="</tr></table>"; Output+="</div></div>"; logger.log("K: "+k); if(k>2) { Output+="<h2 class="+'"'+"title2"+'"'+" id="+'"'+"TabLinks_goto"+'"'+"><span id="+'"'+"pag_goto"+'"'+">GoTo:"; for(int w=1;w<k;w++) { Output+=" [<a href="+'"'+"javascript:pagination('divlist"+w+"')"+'"'+">"+w+"</a>]"; } Output+="</span></h2><br>"; } } // On update of Associated users tab in Software page else if(action.equalsIgnoreCase("users")) { logger.log("In users section"); if(request.getParameter("txtid")!=null) id = request.getParameter("txtid"); logger.log("Softid: "+id); if(request.getParameter("Domid")!=null) domid = request.getParameter("Domid"); logger.log("Domid: "+domid); String type=""; String city=""; String state=""; String country=""; String userid=""; String name=""; String photo=""; String photo_path=""; ArrayList linklist = new ArrayList(); query = "select r.id, r.user_type,r.username,r.company_name,r.city,r.state,r.country,r.photo_name from developers d, registered_users r where domain_id = '"+id+"' and d.user_id = r.id union select r.id, r.user_type,r.username,r.company_name,r.city,r.state,r.country,r.photo_name from service_providers s, registered_users r where domain_id = '"+id+"' and s.user_id = r.id"; preStatement3 = connection.prepareStatement(query);
72
rs3 = preStatement3.executeQuery(); int j=1; int k=2; int t=0; while (rs3.next()) { city = rs3.getString("city"); state = rs3.getString("state"); country = rs3.getString("country"); userid = rs3.getString("id"); photo = rs3.getString("photo_name"); if(rs3.getString("user_type")!=null) { type = rs3.getString("user_type"); if(rs3.getString("user_type").equalsIgnoreCase("1")) name = rs3.getString("username"); else if(rs3.getString("user_type").equalsIgnoreCase("2")) name = rs3.getString("company_name"); else name = ""; } else { name = ""; } if(!photo.equalsIgnoreCase("")) { if(type.equalsIgnoreCase("1")) photo_path="<img height=60px width=60px id="+'"'+"prof_logo"+'"'+" src="+'"'+"http://www.gplpedia.com/profile_images/"+photo+'"'+" />"; else photo_path="<img height=60px width=60px id="+'"'+"vendor_logo"+'"'+" src="+'"'+"http://www.gplpedia.com/profile_images/"+photo+'"'+" />"; } else { if(type.equalsIgnoreCase("1")) photo_path="<img src="+'"'+"/eatout/images/user.png"+'"'+" />"; else photo_path="<img src="+'"'+"/eatout/images/user2.png"+'"'+" />"; } if(j==16) { if(city.equalsIgnoreCase("")) linklist.add("</tr></table></div><div id='divlist"+k+"' style='display: none;'><table cellpadding="+'"'+"2"+'"'+" cellspacing="+'"'+"2"+'"'+" width="+'"'+"100%"+'"'+"><tr align="+'"'+"left"+'"'+"><td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+"
73
align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+state+"<br>"+country+"</div></td>"); else linklist.add("</tr></table></div><div id='divlist"+k+"' style='display: none;'><table cellpadding="+'"'+"2"+'"'+" cellspacing="+'"'+"2"+'"'+" width="+'"'+"100%"+'"'+"><tr align="+'"'+"left"+'"'+"><td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+city+", "+state+"<br>"+country+"</div></td>"); j=1; k++; t=1; } else { if(t==4) { if(city.equalsIgnoreCase("")) linklist.add("</tr><tr><td> </td></tr><tr align="+'"'+"left"+'"'+"><td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+state+"<br>"+country+"</div></td>"); else linklist.add("</tr><tr><td> </td></tr><tr align="+'"'+"left"+'"'+"><td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+city+", "+state+"<br>"+country+"</div></td>"); t=1; } else { if(city.equalsIgnoreCase("")) linklist.add("<td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+state+"<br>"+country+"</div></td>"); else linklist.add("<td valign="+'"'+"top"+'"'+" width="+'"'+"25%"+'"'+" align="+'"'+"left"+'"'+">"+photo_path+"<br><h3 class="+'"'+"title2"+'"'+"><a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+">"+name+"</a></h3><div class="+'"'+"entry"+'"'+">"+city+", "+state+"<br>"+country+"</div></td>"); t++; } } j++; } Output+="<div id="+'"'+"TabLinks_height"+'"'+"><input type='hidden' id='hdpage' value='divlist1'/><div id='divlist1' style='display: inline'>"; Output+="<table cellpadding="+'"'+"2"+'"'+" cellspacing="+'"'+"2"+'"'+" width="+'"'+"100%"+'"'+"><tr align="+'"'+"left"+'"'+">";
74
for(int r=0;r<linklist.size();r++) { Output+=linklist.get(r); } Output+="</tr></table>"; if(linklist.size()==0) { Output+="<div id="+'"'+"TabLinks_height"+'"'+" class="+'"'+"entry"+'"'+">No User is associated with this software. Please <a href="+'"'+"javascript:jointSoft()"+'"'+"><u>click here</u></a> to associate yourself with this software.</div>"; } Output+="</div></div>"; if(linklist.size()!=0) Output+="<div class="+'"'+"entry"+'"'+">Professional: <img width="+'"'+"20px"+'"'+" src="+'"'+"/eatout/images/user.png"+'"'+"> Vendor: <img width="+'"'+"20px"+'"'+" src="+'"'+"/eatout/images/user2.png"+'"'+"></div><br>"; logger.log("K: "+k); if(k>2) { Output+="<h2 class="+'"'+"title2"+'"'+" id="+'"'+"TabLinks_goto"+'"'+"><span id="+'"'+"pag_goto"+'"'+">GoTo:"; for(int w=1;w<k;w++){ Output+=" [<a href="+'"'+"javascript:pagination('divlist"+w+"')"+'"'+">"+w+"</a>]"; } Output+="</span></h2><br>"; } } //On loading content for edit profile - part1 else if(action.equalsIgnoreCase("loadProfile")) { logger.log("In loadProfile section"); HttpSession session = request.getSession(false); String temp = session.getAttribute("loggeduserid").toString(); chkuserid = temp.substring(1, temp.length()); Output="<gplpedia>"; query = "select company_name, company_description, website, address_line1, address_line2, city, state, country, phone, second_years_business, zip, skills, designation from registered_users where id="+chkuserid; preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); if (rs.next()) { Output+="<homepage value="+'"'+rs.getString("website")+'"'+"> </homepage>"; Output+="<address1 value="+'"'+rs.getString("address_line1")+'"'+"> </address1>";
75
Output+="<address2 value="+'"'+rs.getString("address_line2")+'"'+"> </address2>"; Output+="<state value="+'"'+rs.getString("state")+'"'+"> </state>"; Output+="<city value="+'"'+rs.getString("city")+'"'+"> </city>"; Output+="<country value="+'"'+rs.getString("country")+'"'+"> </country>"; Output+="<zip value="+'"'+rs.getString("zip")+'"'+"> </zip>"; Output+="<phone value="+'"'+rs.getString("phone")+'"'+"> </phone>"; Output+="<company value="+'"'+rs.getString("company_name")+'"'+"> </company>"; Output+="<businessyears value="+'"'+rs.getString("second_years_business")+'"'+"> </businessyears>"; Output+="<skills value="+'"'+rs.getString("skills")+'"'+"> </skills>"; Output+="<designation value="+'"'+rs.getString("designation")+'"'+"> </designation>"; } Output+="</gplpedia>"; } //On loading content for edit profile - part2 else if(action.equalsIgnoreCase("loadProfile2")) { logger.log("In loadProfile 2 section"); HttpSession session = request.getSession(false); String temp = session.getAttribute("loggeduserid").toString(); chkuserid = temp.substring(1, temp.length()); query = "select company_description from registered_users where id="+chkuserid; preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); if (rs.next()) { Output=rs.getString("company_description"); } } //On click of Edit Profile in any page else if(action.equalsIgnoreCase("editProfile")) { logger.log("In edit Profile section"); String type = request.getParameter("type"); logger.log("type: "+type); HttpSession session = request.getSession(false); String temp = session.getAttribute("loggeduserid").toString(); chkuserid = temp.substring(1, temp.length()); if(type.equalsIgnoreCase("serv")) { query = "UPDATE registered_users SET company_name='"+request.getParameter("company")+"', company_description='"+request.getParameter("desc")+"', website='"+request.getParameter("homepage")+"', address_line1='"+request.getParameter("address1")+"',
76
address_line2='"+request.getParameter("address2")+"', city='"+request.getParameter("city")+"', state='"+request.getParameter("state")+"', country='"+request.getParameter("country")+"', phone='"+request.getParameter("phone")+"', second_years_business='"+request.getParameter("businessyears")+"', zip='"+request.getParameter("zip")+"' where id="+chkuserid; } else { query = "UPDATE registered_users SET designation='"+request.getParameter("designation")+"', company_description='"+request.getParameter("desc")+"', website='"+request.getParameter("homepage")+"', address_line1='"+request.getParameter("address1")+"', address_line2='"+request.getParameter("address2")+"', city='"+request.getParameter("city")+"', state='"+request.getParameter("state")+"', country='"+request.getParameter("country")+"', phone='"+request.getParameter("phone")+"', designation='"+request.getParameter("designation")+"', zip='"+request.getParameter("zip")+"' where id="+chkuserid; } logger.log(query); preStatement = connection.prepareStatement(query); int count = preStatement.executeUpdate(); if (count > 0) { Output = "Your profile has been updated"; logger.log(Output); } else { Output = "Profile updation failed, Please try again."; logger.log(Output); } } //On click of contact us in any page else if(action.equalsIgnoreCase("contactus")) { logger.log("In Contact us section"); String name = request.getParameter("name"); String email = request.getParameter("email"); String message = request.getParameter("message"); Output="Your Message has been recieved. Thank you for your support."; String Message = "From: "+name+" \n Email: "+email+" \n Message: "+message; logger.log(Message); //Sending Mail String subject = "Gpllite - Contact Us"; SendMail smtpMailSender = new SendMail(); try { smtpMailSender.postMail(subject, Message); logger.log("Sucessfully Sent mail to All Users"); } catch (MessagingException e1) {
77
logger.log("Email Sending Failed"); e1.printStackTrace(); } } //On click of contact user in user page else if(action.equalsIgnoreCase("contactuser")) { logger.log("In contact user section"); String name = request.getParameter("name"); String email = request.getParameter("email"); String subject = request.getParameter("subject"); String message = request.getParameter("message"); Output="Your Message has been sent."; String Message = "From: "+name+" \n Email: "+email+" \n Message: "+message; logger.log(Message); chkuserid = request.getParameter("chkuserid"); query = "select emailid from registered_users where id="+chkuserid; preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); if (rs.next()) { //Sending Mail SendMail smtpMailSender = new SendMail(); try { smtpMailSender.postMail(subject, Message, rs.getString("emailid")); logger.log("Sucessfully Sent mail to All Users"); } catch (MessagingException e1) { logger.log("Email Sending Failed"); e1.printStackTrace(); } } } //On click of Add Comment in Software page else if(action.equalsIgnoreCase("Comment")) { logger.log("In Comment section"); int count=0; if(request.getParameter("txtid")!=null) id = request.getParameter("txtid"); logger.log("Softid: "+id); String name = request.getParameter("Name"); String email = request.getParameter("Email"); String comments = request.getParameter("Comments");
78
query = "INSERT INTO `gpllite_comments` (`id`,`software_id`,`posted_by`,`comment`) VALUES (NULL,?,?,?)"; preStatement = connection.prepareStatement(query); preStatement.setString(1, id); preStatement.setString(2, name); preStatement.setString(3, comments); logger.log("Query: "+preStatement); count = preStatement.executeUpdate(); if (count > 0) { logger.log("Comment added to database"); Output = "Thank you for adding comment.\nIt will be displayed after Admin's approval."; logger.log(Output); } else { Output = "Error in adding comment, Please try again later."; logger.log(Output); } query = "Select a.id, b.prod_name from gpllite_comments a, software_domains b where b.id = "+id+" Order by id desc limit 1"; preStatement2 = connection.prepareStatement(query); rs2 = preStatement2.executeQuery(); if (rs2.next()) { String Message = "From: "+name+" \n Email: "+email+" \n Software: "+rs2.getString("b.prod_name")+" \n Message: "+comments+" \n Approve: http://gplpedia.com/eatout/html/approve.html?hdaction=approve&comid="+rs2.getString("a.id"); logger.log(Message); //Sending Mail String subject = "Gpllite - Comments"; SendMail smtpMailSender = new SendMail(); try { smtpMailSender.postMail(subject, Message); logger.log("Sucessfully Sent mail to All Users"); } catch (MessagingException e1) { logger.log("Email Sending Failed"); e1.printStackTrace(); } } else { logger.log("Error finding comment"); } } //On click of Add Note in User page else if(action.equalsIgnoreCase("Note"))
79
{ logger.log("In Note section"); int count=0; HttpSession session = request.getSession(false); String userid = session.getAttribute("chkuserid").toString(); String name = request.getParameter("Name"); String comments = request.getParameter("Comments"); query = "INSERT INTO `gpllite_notes` (`id`,`user_id`,`posted_by`,`note`) VALUES (NULL,?,?,?)"; preStatement = connection.prepareStatement(query); preStatement.setString(1, userid); preStatement.setString(2, name); preStatement.setString(3, comments); logger.log("Query: "+preStatement); count = preStatement.executeUpdate(); if (count > 0) { logger.log("Note added to database"); Output = "Thank you for your message."; logger.log(Output); } else { Output = "Error in adding note, Please try again later."; logger.log(Output); } } //On click of Report Spam on any page else if(action.equalsIgnoreCase("Report")) { logger.log("In Report section"); String title = request.getParameter("Title"); String url = request.getParameter("Url"); String type = request.getParameter("Type"); String name=""; if(request.getParameter("txtid")!=null) { id = request.getParameter("txtid"); logger.log("Softid: "+id); query = "Select prod_name from software_domains where id = "+id; preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); if (rs.next()) { name=rs.getString("prod_name"); } } //Sending Mail
80
String subject = "Gpllite - Report Spam"; String Message = "Software Name: "+name+" \n Link Type: "+type+" \n Title: "+title+" \n Url: "+url; logger.log(Message); SendMail smtpMailSender = new SendMail(); try { smtpMailSender.postMail(subject, Message); logger.log("Sucessfully Sent mail to All Users"); } catch (MessagingException e1) { logger.log("Email Sending Failed"); e1.printStackTrace(); } Output="Thanks for Reporting Spam / Broken Link"; } //On click of delete note in user page else if(action.equalsIgnoreCase("NoteDelete")) { logger.log("In Note Delete section"); String title = request.getParameter("Title"); String url = request.getParameter("Url"); query = "delete from gpllite_notes where posted_by = '"+title+"' and note = '"+url+"'"; preStatement = connection.prepareStatement(query); int count = preStatement.executeUpdate(); if (count > 0) { Output = "The note has been deleted"; logger.log(Output); } else { Output = "Error in deleting note, please try again later."; logger.log(Output); } } //On click of Join software in software page else if(action.equalsIgnoreCase("join")) { logger.log("In join section"); HttpSession session = request.getSession(false); String temp = session.getAttribute("loggeduserid").toString(); String userid = temp.substring(1, temp.length()); String usertype = temp.substring(0, 1); if(request.getParameter("txtid")!=null) id = request.getParameter("txtid"); logger.log("Softid: "+id); if(usertype.equalsIgnoreCase("d")) query = "Select id from developers where user_id = '"+userid+"' and domain_id = '"+id+"'"; else if(usertype.equalsIgnoreCase("s"))
81
query = "Select id from service_providers where user_id = '"+userid+"' and domain_id = '"+id+"'"; else logger.log("Wrong user type"); preStatement2 = connection.prepareStatement(query); rs2 = preStatement2.executeQuery(); if (rs2.next()) { Output = "You have already joined this software"; } else { if(usertype.equalsIgnoreCase("d")) query = "INSERT INTO `developers` (`id`,`domain_id`,`user_id`,`company_name`,`address_line1`,`address_line2`,`second_city`,`second_state`,`second_country`,`second_zip`,`second_phone`,`second_description`,`skills`) VALUES (NULL,?,?,'','','','','','','','','','')"; else if(usertype.equalsIgnoreCase("s")) query = "INSERT INTO `service_providers` (`id`,`domain_id`,`user_id`,`company_name`,`address_line1`,`address_line2`,`second_city`,`second_state`,`second_country`,`second_zip`,`second_phone`,`second_description`,`skills`) VALUES (NULL,?,?,'','','','','','','','','','')"; else logger.log("Wrong user type"); preStatement = connection.prepareStatement(query); preStatement.setString(1, id); preStatement.setString(2, userid); logger.log("Query: "+preStatement); int count = preStatement.executeUpdate(); if (count > 0) { Output = "Thank you for joining this software."; logger.log(Output); } else { Output = "Error in joining software, please try again later."; logger.log(Output); } } } //On click of change password in any page else if(action.equalsIgnoreCase("changePass")) { logger.log("In Change Password section"); String old_password=""; String new_password=""; int count=0; HttpSession session = request.getSession(false); String temp = session.getAttribute("loggeduserid").toString(); String userid = temp.substring(1, temp.length()); if(request.getParameter("pass")!=null) old_password = request.getParameter("pass");
82
if(request.getParameter("pass1")!=null) new_password = request.getParameter("pass1"); query = "Select id from registered_users where id = '"+userid+"' and password = '"+old_password+"'"; preStatement2 = connection.prepareStatement(query); rs2 = preStatement2.executeQuery(); if (rs2.next()) { query = "UPDATE registered_users SET password = '"+new_password+"' where id = "+userid; preStatement = connection.prepareStatement(query); count = preStatement.executeUpdate(); if (count > 0) { Output = "Pass"; logger.log(Output); } else { Output = "Fail"; logger.log(Output); } } else { Output = "Old"; } } //On Approving a comment using url in mail by admin else if(action.equalsIgnoreCase("approve")) { logger.log("In Approve Comment section"); String commentid = request.getParameter("comid"); logger.log("Comment Id: "+commentid); int count=0; query = "UPDATE gpllite_comments SET approved = '1' where id = "+commentid; preStatement = connection.prepareStatement(query); count = preStatement.executeUpdate(); if (count > 0) { Output = "Comment Successfully Approved"; logger.log(Output); } else { Output = "Comment Approval Failed, Please try again."; logger.log(Output); } }
83
//On click of read more in software page else if(action.equalsIgnoreCase("detail")) { logger.log("In detail section"); if(request.getParameter("txtid")!=null) id = request.getParameter("txtid"); logger.log("Softid: "+id); query = "select a.prod_name, b.description from software_domains a, features b where a.id = b.prod_id and a.id= "+id; preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); if (rs.next()) { String temp = rs.getString("b.description"); temp = temp.replace("<p>",""); temp = temp.replace("</p>",""); temp = temp.replace("<br />",""); temp = temp.replace("<br>"," "); temp = temp.replace("\n"," "); Output = "<div id="+'"'+"TabLinks_height"+'"'+"><p>"+temp+"</p></div><br>"; } } //On Type of any character on search box - Auto fetch results functionality else if(action.equalsIgnoreCase("search")) { logger.log("In search section"); String search = request.getParameter("s"); logger.log("Search String: "+search); int flag=0; String filnam=""; query = "select prod_name, id from software_domains where prod_name like '"+search+"%' union select prod_name, id from software_domains where prod_name like '%"+search+"%' limit 8"; preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); while (rs.next()) { filnam=wf.modifyname(rs.getString("prod_name")); Output +=" <a href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+rs.getString("prod_name")+"</a><br>"; flag=1; } if(flag==1) Output +="<div id="+'"'+"Search_auto"+'"'+"<i><u><a href="+'"'+"javascript:onclos()"+'"'+">close</a></u></i> </div>"; } //On click of Signin in any page else if(action.equalsIgnoreCase("signin"))
84
{ logger.log("In Signin section"); HttpSession session = request.getSession(false); String email = request.getParameter("txtemail"); logger.log("Search String: "+email); String password = request.getParameter("txtpass"); logger.log("Search String: "+password); query = "Select id, username, company_name, user_type from registered_users where activated = 1 and emailid = '"+email+"' and password = '"+password+"'"; String loggeduserid=""; preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); if (rs.next()) { if(rs.getString("user_type")=="2") { Output=rs.getString("company_name"); loggeduserid="s"+rs.getString("id"); } else { Output=rs.getString("username"); loggeduserid="d"+rs.getString("id"); } } session.setAttribute("loggeduser",Output); session.setAttribute("loggeduserid",loggeduserid); } //On click of signout in any page else if(action.equalsIgnoreCase("signout")) { logger.log("In Signout section"); HttpSession session = request.getSession(false); session.setAttribute("loggeduser",""); session.setAttribute("loggeduserid",""); Output="Success"; } //On click of Sponsor link in software page else if(action.equalsIgnoreCase("addlink")) { logger.log("In Add Link section"); int count=0; String query2=""; HttpSession session = request.getSession(false); String userid = session.getAttribute("loggeduserid").toString(); String username = session.getAttribute("loggeduser").toString(); if(request.getParameter("txtid")!=null) id = request.getParameter("txtid"); logger.log("Softid: "+id); String title = request.getParameter("txttitle");
85
String url = request.getParameter("txturl"); String desc = request.getParameter("txtdesc"); String act = request.getParameter("hdact"); desc = "<p>"+desc+"</p>"; logger.log("title: "+title); logger.log("url: "+url); logger.log("desc: "+desc); logger.log("userid: "+userid); logger.log("act: "+act); if(act.equalsIgnoreCase("restaurants")) { query = "INSERT INTO `demo_links` (`prod_id`,`link_title`,`link_url`,`link_description`,`link_provider`,`link_username`,`link_password`,`featured`,`hits`,`digg_url`) VALUES (?,?,?,?,?,'N/A','N/A','0','1','')"; query2 = "Select a.id, b.prod_name from demo_links a, software_domains b where b.id = "+id+" Order by id desc limit 1"; } else if(act.equalsIgnoreCase("restaurants")) { query = "INSERT INTO `documentation_links` (`prod_id`,`title`,`custom_link`,`description`,`uploaded_document`,`custom_link_text`,`file_format`,`file_size`,`sponsored_by`,`featured`,`hits`,`modified_on`) VALUES (?,?,?,?,'','','','',?,'0','1','')"; query2 = "Select a.id, b.prod_name from documentation_links a, software_domains b where b.id = "+id+" Order by id desc limit 1"; } else if(act.equalsIgnoreCase("restaurants")) { query = "INSERT INTO `download_links` (`prod_id`,`link_title`,`url_link`,`description`,`provider`,`version`,`file_size`,`file_format`,`featured`,`hits`) VALUES (?,?,?,?,?,'','','','0','1')"; query2 = "Select a.id, b.prod_name from download_links a, software_domains b where b.id = "+id+" Order by id desc limit 1"; } else if(act.equalsIgnoreCase("forums")) { query = "INSERT INTO `forum_links` (`prod_id`,`title`,`custom_link`,`description`,`custom_link_text`,`file_format`,`file_size`,`sponsored_by`,`modified_on`,`featured`,`hits`) VALUES (?,?,?,?,'','','',?,'','0','1')"; query2 = "Select a.id, b.prod_name from forum_links a, software_domains b where b.id = "+id+" Order by id desc limit 1"; } else if(act.equalsIgnoreCase("bookmarks")) { userid = userid.substring(1); query = "INSERT INTO `blog` (`prod_id`,`title`,`link_url`,`description`,`posted_by`,`hits`,`link_title`,`uploaded_document`,`posted_time`) VALUES (?,?,?,?,?,'1','','',CURRENT_TIMESTAMP)"; query2 = "Select a.id, b.prod_name from blog a, software_domains b where b.id = "+id+" Order by id desc limit 1"; } preStatement = connection.prepareStatement(query); preStatement.setString(1, id); preStatement.setString(2, title);
86
preStatement.setString(3, url); preStatement.setString(4, desc); preStatement.setString(5, userid); logger.log("Query: "+preStatement); count = preStatement.executeUpdate(); if (count > 0) { logger.log("link added to database"); Output = "Thank you for submitting. Your link will be displayed after approval."; logger.log(Output); } else { Output = "Error during submission, Please try again later."; logger.log(Output); } preStatement2 = connection.prepareStatement(query2); rs2 = preStatement2.executeQuery(); if (rs2.next()) { String Message = "From: "+username+" \n Software: "+rs2.getString("b.prod_name")+" \n Account: "+act+" \n\n Title: "+title+" \n URL: "+url+" \n Description: "+desc+" \n Approve: http://gplpedia.com/eatout/html/approve.html?hdaction=approveLink&linkid="+rs2.getString("a.id")+"&act="+act; logger.log(Message); //Sending Mail String subject = "Gpllite - Submit"; SendMail smtpMailSender = new SendMail(); try { smtpMailSender.postMail(subject, Message); logger.log("Sucessfully Sent mail to All Users"); } catch (MessagingException e1) { logger.log("Email Sending Failed"); e1.printStackTrace(); } } else { logger.log("Error finding link"); } } //On click of Add Question in software page else if(action.equalsIgnoreCase("addques")) { logger.log("In Add Question section"); String quest=""; String fname=""; HttpSession session = request.getSession(false);
87
String userid = session.getAttribute("loggeduserid").toString(); String username = session.getAttribute("loggeduser").toString(); userid = userid.substring(1); if(request.getParameter("txtques")!=null) quest = request.getParameter("txtques"); logger.log("Question : "+quest); if(request.getParameter("txtid")!=null) id = request.getParameter("txtid"); logger.log("Softid : "+id); if(request.getParameter("fname")!=null) fname = request.getParameter("fname"); logger.log("Software : "+fname); query = "INSERT INTO `gpllite_questions` (`id`,`prod_id`,`value`,`posted_by`,`posted_time`,`approved`) VALUES (NULL,?,?,?,CURRENT_TIMESTAMP,'1')"; preStatement = connection.prepareStatement(query); preStatement.setString(1, id); preStatement.setString(2, quest); preStatement.setString(3, userid); logger.log("Query: "+preStatement); int count = preStatement.executeUpdate(); if (count > 0) { logger.log("question added"); Output = "Thank you for submitting."; logger.log(Output); fetchSoftware("", "", id); } else { Output = "Error during submission, Please try again later."; logger.log(Output); } String Message = "New Question has been posted. \n From: "+username+" \n Software:"+fname+" \n Question: "+quest; logger.log(Message); //Sending Mail String subject = "Gpllite - Question"; SendMail smtpMailSender = new SendMail(); try { smtpMailSender.postMail(subject, Message); logger.log("Sucessfully Sent mail to All Users"); } catch (MessagingException e1) { logger.log("Email Sending Failed");
88
e1.printStackTrace(); } } //On click of Add Answer in software page else if(action.equalsIgnoreCase("addansw")) { logger.log("In Add Answer section"); String answer=""; String quest_id=""; HttpSession session = request.getSession(false); String userid = session.getAttribute("loggeduserid").toString(); userid = userid.substring(1); if(request.getParameter("txtansw")!=null) answer = request.getParameter("txtansw"); logger.log("Answer: "+answer); if(request.getParameter("quesid")!=null) quest_id = request.getParameter("quesid"); logger.log("Question Id: "+quest_id); if(request.getParameter("txtid")!=null) id = request.getParameter("txtid"); logger.log("Softid : "+id); query = "INSERT INTO `gpllite_answers` (`id`,`question_id`,`value`,`posted_by`,`posted_time`,`approved`) VALUES (NULL,?,?,?,CURRENT_TIMESTAMP,'1')"; preStatement = connection.prepareStatement(query); preStatement.setString(1, quest_id); preStatement.setString(2, answer); preStatement.setString(3, userid); logger.log("Query: "+preStatement); int count = preStatement.executeUpdate(); if (count > 0) { logger.log("answer added to database"); Output = "Thank you for answering."; logger.log(Output); fetchSoftware("", "", id); } else { Output = "Error during submission, Please try again later."; logger.log(Output); } } //On approving a link from url in mail by admin else if(action.equalsIgnoreCase("approveLink")) { logger.log("In Approve Link section"); String linkid = request.getParameter("linkid"); logger.log("Link Id: "+linkid);
89
String act = request.getParameter("act"); logger.log("Action: "+act); int count=0; if(act.equalsIgnoreCase("restaurants")) query = "UPDATE demo_links SET approved = '1' where id = "+linkid; else if(act.equalsIgnoreCase("restaurants")) query = "UPDATE documentation_links SET approved = '1' where id = "+linkid; else if(act.equalsIgnoreCase("restaurants")) query = "UPDATE download_links SET approved = '1' where id = "+linkid; else if(act.equalsIgnoreCase("forums")) query = "UPDATE forum_links SET approved = '1' where id = "+linkid; else if(act.equalsIgnoreCase("bookmarks")) query = "UPDATE blog SET approved = '1' where id = "+linkid; preStatement = connection.prepareStatement(query); count = preStatement.executeUpdate(); if (count > 0) { Output = "Link Successfully Approved"; logger.log(Output); } else { Output = "Link Approval Failed, Please try again."; logger.log(Output); } } //On click of forgot password in any page else if(action.equalsIgnoreCase("forgotpwd")) { logger.log("In Forgot password section"); String email = request.getParameter("email"); String Message = ""; query = "Select password from registered_users where emailid = '"+email+"'"; preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); if (rs.next()) { Output="Success"; logger.log("Forgot passord output: "+Output); Message = "Here is your Password : \n"+rs.getString("password"); //Sending Mail String subject = "Password from gplpedia Website for your account";
90
SendMail smtpMailSender = new SendMail(); try { smtpMailSender.postMail(subject, Message, email); logger.log("Sucessfully Sent mail to All Users"); } catch (MessagingException e1) { logger.log("Email Sending Failed"); e1.printStackTrace(); } } } //On click of register of new user else if(action.equalsIgnoreCase("register")) { logger.log("In Register section"); int count=0; String name = request.getParameter("name"); String password = request.getParameter("password"); String email = request.getParameter("email"); String city = request.getParameter("city"); String country = request.getParameter("country"); String zip = request.getParameter("zip"); String who = request.getParameter("who"); String proflist = request.getParameter("proflist"); query = "Select id from registered_users where emailid = '"+email+"'"; preStatement3 = connection.prepareStatement(query); rs3 = preStatement3.executeQuery(); if(rs3.next()) { Output = "Email id already used. Please click forgot password."; logger.log(Output); } else { if(who.equalsIgnoreCase("1")) { query = "INSERT INTO `registered_users` (`id`,`username`,`password`,`emailid`,`company_name`,`website`,`address_line1`,`address_line2`,`city`,`state`,`country`,`zip`,`phone`,`company_description`,`second_years_business`,`user_type`,`skills`,`designation`,`featured`,`comp_name_sp`,`resume_name`,`photo_name`,`hits`) VALUES (NULL,?,?,?,'','','','',?,'',?,?,'','','',?,'',?,0,'','','',0)"; } else if(who.equalsIgnoreCase("2")) { query = "INSERT INTO `registered_users` (`id`,`company_name`,`password`,`emailid`,`username`,`website`,`address_line1`,`address_line2`,`city`,`state`,`country`,`zip`,`phone`,`company_description`,`second_years_business`,`user_type`,`skills`,`designation`,`featured`,`comp_name_sp`,`resume_name`,`photo_name`,`hits`) VALUES (NULL,?,?,?,'','','','',?,'',?,?,'','','',?,'',?,0,'','','',0)"; proflist="0"; } else
91
{ logger.log("ERROR: Wrong professional value"); } logger.log(query); preStatement = connection.prepareStatement(query); preStatement.setString(1, name); preStatement.setString(2, password); preStatement.setString(3, email); preStatement.setString(4, city); preStatement.setString(5, country); preStatement.setString(6, zip); preStatement.setString(7, who); preStatement.setString(8, proflist); logger.log("Query: "+preStatement); count = preStatement.executeUpdate(); if (count > 0) { logger.log("User added to database"); query = "Select id from registered_users Order by id desc limit 1"; preStatement2 = connection.prepareStatement(query); rs2 = preStatement2.executeQuery(); if (rs2.next()) { //Sending Mail String Message = "Thank you for registering to gplpedia web site. \n Here is your activation link : \n http://gplpedia.com/eatout/html/approve.html?hdaction=approveUser&userid="+rs2.getString("id")+" \n \n To input more info Please go to 'MyGplpedia' "; String subject = "Activation Link from gplpedia Website"; SendMail smtpMailSender = new SendMail(); try { smtpMailSender.postMail(subject, Message, email); Output = "Thank you for registering to gplpedia web site. Check your inbox for activation link."; logger.log("Sucessfully Sent mail to All Users"); } catch (MessagingException e1) { Output = "Error in adding User, Please try again later."; logger.log("Email Sending Failed"); e1.printStackTrace(); }
92
} else { Output = "Error in adding User, Please try again later."; logger.log("Error finding User"); } } else { Output = "Error in adding User, Please try again later."; logger.log(Output); } } } //On approve of user from link in mail by user else if(action.equalsIgnoreCase("approveUser")) { logger.log("In Approve user section"); String userid = request.getParameter("userid"); logger.log("User Id: "+userid); int count=0; query = "UPDATE registered_users SET activated = '1' where id = "+userid; preStatement = connection.prepareStatement(query); count = preStatement.executeUpdate(); if (count > 0) { Output = "User Successfully Approved"; logger.log(Output); } else { Output = "User Approval Failed, Please try again."; logger.log(Output); } } else logger.log("Action not supported. Action: "+action); logger.log("Output: "+Output); response.setContentType("text/xml"); response.setHeader("Cache-Control", "no-cache"); try { response.getWriter().write(Output); } catch (IOException e) { e.printStackTrace(); } }
93
else { String jsp=""; if(action.equalsIgnoreCase("loadhome")) { jsp = "/jsp/home.jsp"; logger.log("In Load Homesection"); request.setAttribute("usercon1",""); request.setAttribute("usercon2",""); request.setAttribute("usercon3",""); } //On Load of user page else if(action.equalsIgnoreCase("userinfo")) { jsp = "/jsp/user.jsp"; logger.log("In User Info section"); if(request.getParameter("chkuserid")!=null && request.getParameter("chkuserid")!="") { chkuserid=request.getParameter("chkuserid"); logger.log("Chkuserid Value: "+chkuserid); } if(request.getParameter("domid")!=null && request.getParameter("domid")!="") { domid=request.getParameter("domid"); logger.log("Domid Value: "+domid); } String username = ""; String company_name = ""; String website = ""; String address_line1 = ""; String address_line2 = ""; String city = ""; String state = ""; String country = ""; String phone = ""; String second_years_business = ""; String user_type = ""; String skills = ""; String resume_name = ""; String photo_name = ""; String created_on = ""; String desc=""; String zip=""; String usercon1=""; String usercon2=""; String usercon3="";
94
query = "select username, emailid, company_name, company_description, website, address_line1, address_line2, city, state, country, phone, second_years_business, user_type, skills, resume_name, photo_name, zip, created_on from registered_users where id="+chkuserid; preStatement2 = connection.prepareStatement(query); rs2 = preStatement2.executeQuery(); if (rs2.next()) { username = rs2.getString("username"); company_name = rs2.getString("company_name"); website = rs2.getString("website"); desc = rs2.getString("company_description"); address_line1 = rs2.getString("address_line1"); address_line2 = rs2.getString("address_line2"); city = rs2.getString("city"); state = rs2.getString("state"); desc = desc.replace("<p>",""); desc = desc.replace("</p>",""); desc = desc.replace("<p class="+'"'+"MsoNormal"+'"'+">",""); desc = desc.replace("<p class=\"\\"MsoNormal\\"\">",""); desc = desc.replace("<o:p></o:p>",""); desc = desc.replace("<p class="+'\"'+"MsoNormal"+'\"'+">",""); desc = desc.replace("<span new="+'\"'+'\"'+" font-family:="+'\"'+'\"'+" style="+'\"'+'\"'+">",""); desc = desc.replace("</span>",""); desc = desc.replace("<br />",""); desc = desc.replace(" "," "); desc = desc.replace(";",","); desc = desc.replace("\n"," "); country = rs2.getString("country"); phone = rs2.getString("phone"); zip = rs2.getString("zip"); second_years_business = rs2.getString("second_years_business"); user_type = rs2.getString("user_type"); skills = rs2.getString("skills"); resume_name = rs2.getString("resume_name"); photo_name = rs2.getString("photo_name"); created_on = rs2.getString("created_on"); usercon1+="<table><tr><td valign="+'"'+"top"+'"'+">"; if(!photo_name.equalsIgnoreCase("")) usercon1+="<img height=150px width=150px src="+'"'+"http://www.gplpedia.com/profile_images/"+photo_name+'"'+" />"; else { if(user_type.equalsIgnoreCase("1")) usercon1+="<img src="+'"'+"/eatout/images/user.png"+'"'+" /><br>"; else usercon1+="<img src="+'"'+"/eatout/images/user2.png"+'"'+" /><br>";
95
} usercon1+="</td><td> </td><td> </td><td>"; if(user_type.equalsIgnoreCase("1")) usercon1+="<h3>"+username+"</h3>"; else usercon1+="<h3>"+company_name+"</h3>"; if(!resume_name.equalsIgnoreCase("")) usercon1+="<a href="+'"'+"http://www.gplpedia.com/resume/"+resume_name+'"'+">Download Resume</a><br>"; if(!address_line1.equalsIgnoreCase("")) usercon1+="<b>Address Line1:</b> "+address_line1+"<br>"; if(!address_line2.equalsIgnoreCase("")) usercon1+="<b>Address Line2:</b> "+address_line2+"<br>"; if(!city.equalsIgnoreCase("") && !state.equalsIgnoreCase("")) usercon1+="<b>Location:</b> "+city+", "+state+"<br>"; else if((city.equalsIgnoreCase("") && !state.equalsIgnoreCase("")) || (!city.equalsIgnoreCase("") && state.equalsIgnoreCase(""))) usercon1+="<b>Location:</b> "+city+state+"<br>"; if(!country.equalsIgnoreCase("")) usercon1+="<b>Country:</b> "+country+"<br>"; if(!zip.equalsIgnoreCase("")) usercon1+="<b>Zip:</b> "+zip+"<br>"; if(!phone.equalsIgnoreCase("")) usercon1+="<b>Phone:</b> "+phone+"<br>"; if(user_type.equalsIgnoreCase("1")) { if(!skills.equalsIgnoreCase("")) usercon1+="<b>Skills:</b> "+skills+"<br>"; } else { if(!second_years_business.equalsIgnoreCase("")) usercon1+="<b>Years of Business:</b> "+second_years_business+"<br>"; } if(!website.equalsIgnoreCase("")) usercon1+="<b>Website:</b> "+website+"<br>"; if(!desc.equalsIgnoreCase("")) usercon1+="<b>Description:</b><br> "+desc+"<br>";
96
if(!created_on.equalsIgnoreCase("")) usercon1+="<i>Member Since: "+created_on+"</i><br>"; usercon1+="<a href="+'"'+"/eatout/jsp/contact_user.jsp?placeValuesBeforeTB_=savedValues&TB_iframe=true&height=240;&width=280&modal=true"+'"'+" class="+'"'+"thickbox"+'"'+"><img id="+'"'+"contact"+'"'+" src="+'"'+"/eatout/images/contactbtn.png"+'"'+" onmouseover="+'"'+"javascript:imgChange('contact','hover')"+'"'+" onmouseout="+'"'+"javascript:imgChange('contact','back')"+'"'+"/></a>"; usercon1+="</td></tr></table>"; } else usercon1="ERROR: USER NOT FOUND"; int temp=0; int points=0; //For user rating query = "select (Select count(id)from demo_links where SUBSTR(link_provider,2)='"+chkuserid+"' and approved = 1) demo, (Select count(id)from documentation_links where SUBSTR(sponsored_by,2)='"+chkuserid+"' and approved = 1) document, (Select count(id)from download_links where SUBSTR(provider,2)='"+chkuserid+"' and approved = 1) download, (Select count(id)from forum_links where SUBSTR(sponsored_by,2)='"+chkuserid+"' and approved = 1) forum,(Select count(id)from blog where posted_by='"+chkuserid+"' and approved = 1) bookmark,(Select count(id)from gpllite_questions where posted_by='"+chkuserid+"' and approved = 1) questions,(Select count(id)from gpllite_answers where posted_by='"+chkuserid+"' and approved = 1) answers,(Select count(id)from gpllite_comments where posted_by='"+chkuserid+"' and approved = 1) comments from dual"; preStatement6 = connection.prepareStatement(query); rs6 = preStatement6.executeQuery(); if (rs6.next()) { temp=Integer.parseInt(rs6.getString("demo")); temp+=Integer.parseInt(rs6.getString("document")); temp+=Integer.parseInt(rs6.getString("download")); temp+=Integer.parseInt(rs6.getString("forum")); temp+=Integer.parseInt(rs6.getString("bookmark")); points = 100; //Registering to GPLpedia.com -- 100 Points points+=temp*400; //Submitting Demo, Doc, etc -- 400 Points temp=Integer.parseInt(rs6.getString("questions")); points+=temp*200; //Posting a Question -- 200 Points temp=Integer.parseInt(rs6.getString("answers")); points+=temp*300; //Replying to a Question -- 300 Points temp=Integer.parseInt(rs6.getString("comments")); points+=temp*200; //Adding Comments -- 200 Point } logger.log("Points: "+points); String rim=""; String desig="";
97
if(points>0 && points<2001) { rim="1"; desig="Enthusiast"; } else if(points>2000 && points<5001) { rim="2"; desig="Hotshot"; } else if(points>5000 && points<10001) { rim="3"; desig="Expert"; } else if(points>10000 && points<20001) { rim="4"; desig="Master"; } else if(points>20000 && points<35001) { rim="5"; desig="Grand Master"; } else if(points>35000) { rim="6"; desig="Emeritus"; } else { rim="1"; desig="Enthusiast"; } usercon1+="</td><td valign="+'"'+"top"+'"'+"><table><tr><td><table width="+'"'+"83px"+'"'+" height="+'"'+"83px"+'"'+" style="+'"'+"background:url(/eatout/images/r"+rim+".png) no-repeat; color:#FFFFFF;font-weight:bold;"+'"'+"><tr align="+'"'+"center"+'"'+"><td valign="+'"'+"middle"+'"'+">"+points+"<br>points</td></tr></table></td></tr><tr align="+'"'+"center"+'"'+"><td><b>Gplpedia</b></td></tr><tr align="+'"'+"center"+'"'+"><td><b>"+desig+"</b></td></tr></table>"; logger.log("usercon1: "+usercon1); int s=1; String filnam=""; if(user_type.equalsIgnoreCase("1")) query = "select id, prod_name from software_domains where id in (select domain_id from developers where user_id = '"+chkuserid+"')"; else query = "select id, prod_name from software_domains where id in (select domain_id from service_providers where user_id = '"+chkuserid+"')";
98
preStatement3 = connection.prepareStatement(query); rs3 = preStatement3.executeQuery(); while (rs3.next()) { filnam=wf.modifyname(rs3.getString("prod_name")); if(s==1) usercon2+="<a id="+'"'+"tagcloud_color1"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+rs3.getString("prod_name")+"</a> "; else if(s==2) usercon2+="<a id="+'"'+"tagcloud_color2"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+rs3.getString("prod_name")+"</a> "; else if(s==3) usercon2+="<a id="+'"'+"tagcloud_color3"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+rs3.getString("prod_name")+"</a> "; else if(s==4) usercon2+="<a id="+'"'+"tagcloud_color1"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+rs3.getString("prod_name")+"</a> "; else if(s==5) usercon2+="<a id="+'"'+"tagcloud_color2"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+rs3.getString("prod_name")+"</a> "; else if(s==6) usercon2+="<a id="+'"'+"tagcloud_color1"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+rs3.getString("prod_name")+"</a> "; else { usercon2+="<a id="+'"'+"tagcloud_color3"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+rs3.getString("prod_name")+"</a> "; s=0; } s++; } logger.log("usercon2: "+usercon2); query = "Select note, posted_by from gpllite_notes where approved = 1 and user_id = "+chkuserid; preStatement5 = connection.prepareStatement(query); rs5 = preStatement5.executeQuery(); while (rs5.next()) { usercon3+="<h3 class="+'"'+"title2"+'"'+"><b>"+rs5.getString("note")+"</b></h3>"; usercon3+="\n "+rs5.getString("posted_by")+" \n <p> </p>"; } if(usercon3=="") usercon3="No notes Available.<p> </p>"; usercon3+="<div style="+'"'+"padding-left:100px;"+'"'+">";
99
usercon3+=" <table>"; usercon3+=" <tr>"; usercon3+=" <td>Name:</td>"; usercon3+=" <td><input name="+'"'+"Name"+'"'+" id="+'"'+"Name"+'"'+" type="+'"'+"text"+'"'+" class="+'"'+"textfield3"+'"'+" /></td>"; usercon3+=" </tr>"; usercon3+=" <tr>"; usercon3+=" <td>Email:</td>"; usercon3+=" <td><input name="+'"'+"CEmail"+'"'+" id="+'"'+"CEmail"+'"'+" type="+'"'+"text"+'"'+" class="+'"'+"textfield3"+'"'+" /></td>"; usercon3+=" </tr>"; usercon3+=" <tr valign="+'"'+"top"+'"'+">"; usercon3+=" <td>Message:</td>"; usercon3+=" <td><textarea name="+'"'+"Comments"+'"'+" id="+'"'+"Comments"+'"'+" class="+'"'+"textfield3"+'"'+" rows="+'"'+"4"+'"'+" wrap="+'"'+"virtual"+'"'+"></textarea></td>"; usercon3+=" </tr>"; usercon3+=" <tr>"; usercon3+=" <td colspan="+'"'+"2"+'"'+"> </td></tr>"; usercon3+=" <tr align="+'"'+"center"+'"'+">"; usercon3+=" <td> </td>"; usercon3+=" <td>"; usercon3+=" <input name="+'"'+"Add Notes"+'"'+" type="+'"'+"button"+'"'+" class="+'"'+"button"+'"'+" value="+'"'+"Add Notes"+'"'+" id="+'"'+"ButtonCancel"+'"'+" onclick="+'"'+"javascript:onComment('Note')"+'"'+" />"; usercon3+=" </td>"; usercon3+=" </tr>"; usercon3+=" </table>"; usercon3+="</div>"; logger.log("usercon3: "+usercon3); request.setAttribute("usercon1",usercon1); request.setAttribute("usercon2",usercon2); request.setAttribute("usercon3",usercon3); request.setAttribute("chkuserid",chkuserid); request.setAttribute("domid",domid); } //On Load of profile page else if(action.equalsIgnoreCase("profile")) { jsp = "/jsp/user.jsp"; logger.log("In Profile section"); HttpSession session = request.getSession(false); String temp = session.getAttribute("loggeduserid").toString(); chkuserid = temp.substring(1, temp.length()); logger.log("Chkuserid Value: "+chkuserid); String username = ""; String company_name = ""; String website = ""; String address_line1 = ""; String address_line2 = ""; String city = "";
100
String state = ""; String country = ""; String phone = ""; String emailid = ""; String second_years_business = ""; String user_type = ""; String skills = ""; String resume_name = ""; String photo_name = ""; String created_on = ""; String zip = ""; String desc = ""; String usercon1=""; String usercon2=""; String usercon3=""; query = "select username, emailid, company_name, company_description, website, address_line1, address_line2, city, state, country, phone, second_years_business, user_type, skills, resume_name, photo_name, zip, created_on from registered_users where id="+chkuserid; preStatement2 = connection.prepareStatement(query); rs2 = preStatement2.executeQuery(); if (rs2.next()) { username = rs2.getString("username"); company_name = rs2.getString("company_name"); emailid = rs2.getString("emailid"); website = rs2.getString("website"); desc = rs2.getString("company_description"); address_line1 = rs2.getString("address_line1"); address_line2 = rs2.getString("address_line2"); city = rs2.getString("city"); state = rs2.getString("state"); country = rs2.getString("country"); zip = rs2.getString("zip"); phone = rs2.getString("phone"); second_years_business = rs2.getString("second_years_business"); user_type = rs2.getString("user_type"); skills = rs2.getString("skills"); resume_name = rs2.getString("resume_name"); photo_name = rs2.getString("photo_name"); created_on = rs2.getString("created_on"); usercon1+="<table><tr><td valign="+'"'+"top"+'"'+">"; if(!photo_name.equalsIgnoreCase("")) usercon1+="<img height=100px width=100px src="+'"'+"http://www.gplpedia.com/profile_images/"+photo_name+'"'+" />"; else { if(user_type.equalsIgnoreCase("1")) usercon1+="<img src="+'"'+"/eatout/images/user.png"+'"'+" /><br>"; else usercon1+="<img src="+'"'+"/eatout/images/user2.png"+'"'+" /><br>";
101
} usercon1+="</td><td> </td><td> </td><td>"; if(user_type.equalsIgnoreCase("1")) { usercon1+="<h3> Welcome "+username+"</h3>"; usercon1+="(<a href="+'"'+"/eatout/jsp/profile_dev.jsp?placeValuesBeforeTB_=savedValues&TB_iframe=true&height=500;&width=360&modal=true"+'"'+" class="+'"'+"thickbox"+'"'+">Edit Profile</a>) - <a href="+'"'+"/eatout/jsp/pass.jsp?placeValuesBeforeTB_=savedValues&TB_iframe=true&height=140;&width=240&modal=true"+'"'+" class="+'"'+"thickbox"+'"'+">Change Password</a> - <a href="+'"'+"/eatout/jsp/image_upload.jsp?placeValuesBeforeTB_=savedValues&TB_iframe=true&height=110;&width=320&modal=true"+'"'+" class="+'"'+"thickbox"+'"'+">Update Avatar</a><br>"; } else { usercon1+="<h3> Welcome "+company_name+"</h3>"; usercon1+="(<a href="+'"'+"/eatout/jsp/profile_serv.jsp?placeValuesBeforeTB_=savedValues&TB_iframe=true&height=470;&width=370&modal=true"+'"'+" class="+'"'+"thickbox"+'"'+">Edit Profile</a>) - <a href="+'"'+"/eatout/jsp/pass.jsp?placeValuesBeforeTB_=savedValues&TB_iframe=true&height=140;&width=240&modal=true"+'"'+" class="+'"'+"thickbox"+'"'+">Change Password</a> - <a href="+'"'+"/eatout/jsp/image_upload.jsp?placeValuesBeforeTB_=savedValues&TB_iframe=true&height=110;&width=320&modal=true"+'"'+" class="+'"'+"thickbox"+'"'+">Update Avatar</a><br>"; } if(!resume_name.equalsIgnoreCase("")) usercon1+="<a href="+'"'+"http://www.gplpedia.com/resume/"+resume_name+'"'+">View Resume</a> <<a href="+'"'+"/eatout/jsp/resume_upload.jsp?placeValuesBeforeTB_=savedValues&TB_iframe=true&height=110;&width=290&modal=true"+'"'+" class="+'"'+"thickbox"+'"'+">Upload New Resume</a>><br>"; else usercon1+="No Resume Uploaded <<a href="+'"'+"/eatout/jsp/resume_upload.jsp?placeValuesBeforeTB_=savedValues&TB_iframe=true&height=110;&width=290&modal=true"+'"'+" class="+'"'+"thickbox"+'"'+">Upload New Resume</a>><br>"; if(!address_line1.equalsIgnoreCase("")) usercon1+="<b>Address Line1:</b> "+address_line1+"<br>"; if(!address_line2.equalsIgnoreCase("")) usercon1+="<b>Address Line2:</b> "+address_line2+"<br>"; if(!city.equalsIgnoreCase("") && !state.equalsIgnoreCase("")) usercon1+="<b>Location:</b> "+city+", "+state+"<br>"; else if((city.equalsIgnoreCase("") && !state.equalsIgnoreCase("")) || (!city.equalsIgnoreCase("") && state.equalsIgnoreCase(""))) usercon1+="<b>Location:</b> "+city+state+"<br>"; if(!country.equalsIgnoreCase("")) usercon1+="<b>Country:</b> "+country+"<br>"; if(!zip.equalsIgnoreCase(""))
102
usercon1+="<b>Zip:</b> "+zip+"<br>"; if(!phone.equalsIgnoreCase("")) usercon1+="<b>Phone:</b> "+phone+"<br>"; if(!emailid.equalsIgnoreCase("")) usercon1+="<b>Email:</b> "+emailid+"<br>"; if(user_type.equalsIgnoreCase("1")) { if(!skills.equalsIgnoreCase("")) usercon1+="<b>Skills:</b> "+skills+"<br>"; } else { if(!second_years_business.equalsIgnoreCase("")) usercon1+="<b>Years of Business:</b> "+second_years_business+"<br>"; } if(!website.equalsIgnoreCase("")) usercon1+="<b>Website:</b> "+website+"<br>"; if(!desc.equalsIgnoreCase("")) usercon1+="<b>Description:</b> "+desc+"<br>"; if(!created_on.equalsIgnoreCase("")) usercon1+="<i>Member Since: "+created_on+"</i><br>"; usercon1+="</td></tr></table>"; } else usercon1="ERROR: USER NOT FOUND"; logger.log("usercon1: "+usercon1); int s=1; String filnam=""; if(user_type.equalsIgnoreCase("1")) query = "select id, prod_name from software_domains where id in (select domain_id from developers where user_id = '"+chkuserid+"')"; else query = "select id, prod_name from software_domains where id in (select domain_id from service_providers where user_id = '"+chkuserid+"')"; preStatement3 = connection.prepareStatement(query); rs3 = preStatement3.executeQuery(); while (rs3.next()) { filnam=wf.modifyname(rs3.getString("prod_name")); if(s==1)
103
usercon2+="<a id="+'"'+"tagcloud_color1"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+rs3.getString("prod_name")+"</a> "; else if(s==2) usercon2+="<a id="+'"'+"tagcloud_color2"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+rs3.getString("prod_name")+"</a> "; else if(s==3) usercon2+="<a id="+'"'+"tagcloud_color3"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+rs3.getString("prod_name")+"</a> "; else if(s==4) usercon2+="<a id="+'"'+"tagcloud_color1"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+rs3.getString("prod_name")+"</a> "; else if(s==5) usercon2+="<a id="+'"'+"tagcloud_color2"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+rs3.getString("prod_name")+"</a> "; else if(s==6) usercon2+="<a id="+'"'+"tagcloud_color1"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+rs3.getString("prod_name")+"</a> "; else { usercon2+="<a id="+'"'+"tagcloud_color3"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+rs3.getString("prod_name")+"</a> "; s=0; } s++; } logger.log("usercon2: "+usercon2); query = "Select note, posted_by from gpllite_notes where approved = 1 and user_id = "+chkuserid; preStatement5 = connection.prepareStatement(query); rs5 = preStatement5.executeQuery(); while (rs5.next()) { usercon3+="<h3 class="+'"'+"title2"+'"'+"><b>"+rs5.getString("note")+"</b>"; usercon3+="\n <img title="+'"'+"Delete"+'"'+" onclick="+'"'+"javascript:onDelete('"+rs5.getString("note")+"','"+rs5.getString("posted_by")+"')"+'"'+" src="+'"'+"/eatout/images/broken.gif"+'"'+"></img></h3>"; usercon3+="\n "+rs5.getString("posted_by")+" \n <p> </p>"; } if(usercon3=="") usercon3="No notes Available.<p> </p>"; logger.log("usercon3: "+usercon3); request.setAttribute("usercon1",usercon1); request.setAttribute("usercon2",usercon2); request.setAttribute("usercon3",usercon3); request.setAttribute("chkuserid",chkuserid);
104
request.setAttribute("domid",""); } RequestDispatcher dispatcher = servletCtx.getRequestDispatcher(jsp); if (dispatcher != null) try { response.setContentType("text/html"); dispatcher.include(request, response); } catch (ServletException e) { System.out.println("Exception occured : "+e); e.printStackTrace(); } catch (IOException e) { System.out.println("Exception occured : "+e); e.printStackTrace(); } } } catch (SQLException e) { e.printStackTrace(); } catch (Exception f) { f.printStackTrace(); } finally { ConnManager.closeResultSet(rs); ConnManager.closeStatement(preStatement); ConnManager.closeResultSet(rs2); ConnManager.closeStatement(preStatement2); ConnManager.closeResultSet(rs3); ConnManager.closeStatement(preStatement3); ConnManager.closeResultSet(rs4); ConnManager.closeStatement(preStatement4); ConnManager.closeResultSet(rs5); ConnManager.closeStatement(preStatement5); ConnManager.closeResultSet(rs6); ConnManager.closeStatement(preStatement6); ConnManager.closeResultSet(rs7); ConnManager.closeStatement(preStatement7); ConnManager.closeConnection(connection); } } //Method to fetch home page details private int fetchHome() { //For logging LogMessage logger = new LogMessage(); logger.log("Inside fetch Home method"); int flag=0; ArrayList nameList = new ArrayList(); ArrayList idList = new ArrayList(); ArrayList typeList = new ArrayList(); ArrayList statList = new ArrayList();
105
ArrayList featitleList = new ArrayList(); ArrayList feaidList = new ArrayList(); String user=""; String query=""; String softwarelist=""; PreparedStatement preStatement = null; ResultSet rs = null; PreparedStatement preStatement2 = null; ResultSet rs2 = null; PreparedStatement preStatement3 = null; ResultSet rs3 = null; PreparedStatement preStatement4 = null; ResultSet rs4 = null; PreparedStatement preStatement5 = null; ResultSet rs5 = null; Connection connection = null; ConnectionManager ConnManager = null; try { ConnManager = new ConnectionManager(); connection = ConnManager.openConnection(); softwarelist="<div class='post'><div id='title3'>"; query = "select id, catname from software_domain_categories where delflag = 0 Order by catname"; preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); while (rs.next()) { nameList.add(rs.getString("catname")); idList.add(rs.getString("id")); typeList.add("0"); query = "select id, prod_name from software_domains where catid = "+rs.getString("id")+" Order by prod_name"; preStatement2 = connection.prepareStatement(query); rs2 = preStatement2.executeQuery(); while (rs2.next()) { nameList.add(rs2.getString("prod_name")); idList.add(rs2.getString("id")); typeList.add("1"); } } query = "select count(*) stats from software_domains union select count(*) stats from software_domain_categories where delflag=0 union select count(*) stats from registered_users where user_type=1 union select count(*) stats from registered_users where user_type=2 union select count(*) stats from demo_links union select count(*) stats from documentation_links union select count(*) stats from download_links union select count(*) stats from forum_links union select count(*) stats from blog";
106
preStatement3 = connection.prepareStatement(query); rs3 = preStatement3.executeQuery(); while (rs3.next()) { statList.add(rs3.getString("stats")); } int s=1; int t=1; int u=1; int v=1; String filnam=""; WriteFile wf = new WriteFile(); query = "Select prod_name from software_domains limit 34"; preStatement5 = connection.prepareStatement(query); rs5 = preStatement5.executeQuery(); while (rs5.next()) { String softname=rs5.getString("prod_name"); filnam=wf.modifyname(softname); if(s==1) { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color1"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+softname+"</a> "; } else if(s==2) { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color2"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+softname+"</a> "; } else if(s==3) { if(t==4) { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color3"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+"><b>"+softname+"</b></a> "; t=1; } else { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color3"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+softname+"</a> "; t++; } } else if(s==4) { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color1"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+softname+"</a> "; } else if(s==5) { if(u==3)
107
{ softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color2"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+"><b>"+softname+"</b></a> "; u=1; } else { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color2"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+softname+"</a> "; u++; } } else if(s==6) { if(v==2) { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color1"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+"><b>"+softname+"</b></a> "; v=1; } else { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color1"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+softname+"</a> "; v++; } } else { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color3"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+softname+"</a> "; s=0; } s++; } softwarelist=softwarelist+"</div></div>"; query = "select id, link, title from gpllite_featured Order by id desc"; preStatement4 = connection.prepareStatement(query); rs4 = preStatement4.executeQuery(); while (rs4.next()) { feaidList.add(rs4.getString("link")); featitleList.add(rs4.getString("title")); } String links=fetchLinks("hlatest", "", "", 11,"page"); WriteFile write = new WriteFile(); write.writeHome(nameList,idList,typeList,softwarelist,statList,links,featitleList,feaidList); flag++; } catch (SQLException e) { e.printStackTrace();
108
} finally { ConnManager.closeResultSet(rs); ConnManager.closeStatement(preStatement); ConnManager.closeResultSet(rs2); ConnManager.closeStatement(preStatement2); ConnManager.closeResultSet(rs3); ConnManager.closeStatement(preStatement3); ConnManager.closeResultSet(rs4); ConnManager.closeStatement(preStatement4); ConnManager.closeResultSet(rs5); ConnManager.closeStatement(preStatement5); ConnManager.closeConnection(connection); } return flag; } //Method to fetch user page details private int fetchUser() { //For logging LogMessage logger = new LogMessage(); logger.log("Inside fetch User method"); int flag=0; ArrayList nameList = new ArrayList(); ArrayList idList = new ArrayList(); ArrayList typeList = new ArrayList(); ArrayList featitleList = new ArrayList(); ArrayList feaidList = new ArrayList(); String query=""; PreparedStatement preStatement = null; ResultSet rs = null; PreparedStatement preStatement2 = null; ResultSet rs2 = null; PreparedStatement preStatement3 = null; ResultSet rs3 = null; Connection connection = null; ConnectionManager ConnManager = null; try { ConnManager = new ConnectionManager(); connection = ConnManager.openConnection(); query = "select id, catname from software_domain_categories where delflag = 0 Order by catname"; preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); while (rs.next()) {
109
nameList.add(rs.getString("catname")); idList.add(rs.getString("id")); typeList.add("0"); query = "select id, prod_name from software_domains where catid = "+rs.getString("id")+" Order by prod_name"; preStatement2 = connection.prepareStatement(query); rs2 = preStatement2.executeQuery(); while (rs2.next()) { nameList.add(rs2.getString("prod_name")); idList.add(rs2.getString("id")); typeList.add("1"); } } query = "select id, link, title from gpllite_featured Order by id desc"; preStatement3 = connection.prepareStatement(query); rs3 = preStatement3.executeQuery(); while (rs3.next()) { feaidList.add(rs3.getString("link")); featitleList.add(rs3.getString("title")); } WriteFile write = new WriteFile(); write.writeUser(nameList,idList,typeList,featitleList,feaidList); flag++; } catch (SQLException e) { e.printStackTrace(); } finally { ConnManager.closeResultSet(rs); ConnManager.closeStatement(preStatement); ConnManager.closeResultSet(rs2); ConnManager.closeStatement(preStatement2); ConnManager.closeResultSet(rs3); ConnManager.closeStatement(preStatement3); ConnManager.closeConnection(connection); } return flag; } //Method to fetch share page details private int fetchSubmit() { //For logging LogMessage logger = new LogMessage(); logger.log("Inside fetch Share method"); int flag=0; ArrayList nameList = new ArrayList(); ArrayList idList = new ArrayList();
110
ArrayList featitleList = new ArrayList(); ArrayList feaidList = new ArrayList(); String query=""; PreparedStatement preStatement = null; ResultSet rs = null; Connection connection = null; ConnectionManager ConnManager = null; try { ConnManager = new ConnectionManager(); connection = ConnManager.openConnection(); query = "select id, prod_name from software_domains Order by prod_name"; preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); while (rs.next()) { nameList.add(rs.getString("prod_name")); idList.add(rs.getString("id")); } WriteFile write = new WriteFile(); write.writeSubmit(nameList,idList); flag++; } catch (SQLException e) { e.printStackTrace(); } finally { ConnManager.closeResultSet(rs); ConnManager.closeStatement(preStatement); ConnManager.closeConnection(connection); } return flag; } //Method to fetch all domain page details private int fetchDomain(String from, String to, String dom_id) { //For logging LogMessage logger = new LogMessage(); logger.log("Inside fetch Domain method"); int flag=0; PreparedStatement preStatement4 = null; ResultSet rs4 = null; PreparedStatement preStatement5 = null; ResultSet rs5 = null; PreparedStatement preStatement6 = null; ResultSet rs6 = null;
111
PreparedStatement preStatement7 = null; ResultSet rs7 = null; PreparedStatement preStatement8 = null; ResultSet rs8 = null; PreparedStatement preStatement9 = null; ResultSet rs9 = null; PreparedStatement preStatement10 = null; ResultSet rs10 = null; ArrayList nameList = new ArrayList(); ArrayList idList = new ArrayList(); ArrayList typeList = new ArrayList(); String query=""; Connection connection = null; ConnectionManager ConnManager = null; try { ConnManager = new ConnectionManager(); connection = ConnManager.openConnection(); query = "select id, catname from software_domain_categories where delflag = 0 Order by catname"; preStatement8 = connection.prepareStatement(query); rs8 = preStatement8.executeQuery(); while (rs8.next()) { nameList.add(rs8.getString("catname")); idList.add(rs8.getString("id")); typeList.add("0"); query = "select id, prod_name from software_domains where catid = "+rs8.getString("id")+" Order by prod_name"; preStatement9 = connection.prepareStatement(query); rs9 = preStatement9.executeQuery(); while (rs9.next()) { nameList.add(rs9.getString("prod_name")); idList.add(rs9.getString("id")); typeList.add("1"); } } String end=""; query = "select count(id) stats from software_domain_categories where delflag = 0 Order by catname"; preStatement10 = connection.prepareStatement(query); rs10 = preStatement10.executeQuery(); while (rs10.next()) { end = rs10.getString("stats"); } if(from.equalsIgnoreCase(""))
112
from="0"; if(to.equalsIgnoreCase("")) to=end; to=String.valueOf(Integer.parseInt(to)-Integer.parseInt(from)); if(dom_id=="") query = "Select id from software_domain_categories where delflag = 0 Order by catname limit "+from+","+to; else query = "Select id from software_domain_categories where delflag = 0 and id ="+dom_id; logger.log(query); preStatement7 = connection.prepareStatement(query); rs7 = preStatement7.executeQuery(); while (rs7.next()) { String domid = rs7.getString("id"); ArrayList statList = new ArrayList(); String softwarelist=""; String name=""; String about=""; String domainid=""; query = "Select id, description,catname from software_domain_categories where id="+domid; preStatement6 = connection.prepareStatement(query); rs6 = preStatement6.executeQuery(); if (rs6.next()) { name = rs6.getString("catname"); about = rs6.getString("description"); domainid = rs6.getString("id"); about = about.replace("<p>",""); about = about.replace("</p>",""); about = about.replace(""","'"); about = about.replace(" "," "); about = about.replace("&","and"); about = about.replace("<br />",""); if(about=="") about=name; } softwarelist="<div class='post'><div id='title3'>"; for(int i=0;i<9;i++) { statList.add("0"); } int s=1;
113
int t=1; int u=1; int v=1; String filnam=""; WriteFile wf = new WriteFile(); query = "Select prod_name from software_domains where catid="+domid+" Order by prod_name"; preStatement5 = connection.prepareStatement(query); rs5 = preStatement5.executeQuery(); while (rs5.next()) { String softname=rs5.getString("prod_name"); filnam=wf.modifyname(softname); if(s==1) { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color1"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+softname+"</a> "; } else if(s==2) { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color2"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+softname+"</a> "; } else if(s==3) { if(t==4) { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color3"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+"><b>"+softname+"</b></a> "; t=1; } else { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color3"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+softname+"</a> "; t++; } } else if(s==4) { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color1"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+softname+"</a> "; } else if(s==5) { if(u==3) {
114
softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color2"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+"><b>"+softname+"</b></a> "; u=1; } else { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color2"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+softname+"</a> "; u++; } } else if(s==6) { if(v==2) { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color1"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+"><b>"+softname+"</b></a> "; v=1; } else { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color1"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+softname+"</a> "; v++; } } else { softwarelist=softwarelist+"<a id="+'"'+"tagcloud_color3"+'"'+" href="+'"'+"/eatout/restaurants/"+filnam+".html"+'"'+">"+softname+"</a> "; s=0; } s++; } softwarelist=softwarelist+"</div></div>"; ArrayList featitleList = new ArrayList(); ArrayList feaidList = new ArrayList(); query = "select id, link, title from gpllite_featured Order by id desc"; preStatement4 = connection.prepareStatement(query); rs4 = preStatement4.executeQuery(); while (rs4.next()) { feaidList.add(rs4.getString("link")); featitleList.add(rs4.getString("title")); } String links=fetchLinks("dlatest", domid, "", 11,"page"); WriteFile write = new WriteFile();
115
write.writeDomain(nameList,idList,typeList,softwarelist,statList,name,domainid,about,links,featitleList,feaidList); flag++; } } catch (SQLException e) { e.printStackTrace(); } finally { ConnManager.closeResultSet(rs4); ConnManager.closeStatement(preStatement4); ConnManager.closeResultSet(rs5); ConnManager.closeStatement(preStatement5); ConnManager.closeResultSet(rs6); ConnManager.closeStatement(preStatement6); ConnManager.closeResultSet(rs7); ConnManager.closeStatement(preStatement7); ConnManager.closeResultSet(rs8); ConnManager.closeStatement(preStatement8); ConnManager.closeResultSet(rs9); ConnManager.closeStatement(preStatement9); ConnManager.closeResultSet(rs10); ConnManager.closeStatement(preStatement10); ConnManager.closeConnection(connection); } return flag; } //Method to fetch all software page details private int fetchSoftware(String from, String to, String soft_id) { //For logging LogMessage logger = new LogMessage(); logger.log("Inside fetch Software method"); int flag=0; PreparedStatement preStatement = null; ResultSet rs = null; PreparedStatement preStatement2 = null; ResultSet rs2 = null; PreparedStatement preStatement3 = null; ResultSet rs3 = null; PreparedStatement preStatement4 = null; ResultSet rs4 = null; PreparedStatement preStatement7 = null; ResultSet rs7 = null; PreparedStatement preStatement8 = null; ResultSet rs8 = null; PreparedStatement preStatement9 = null; ResultSet rs9 = null; PreparedStatement preStatement10 = null; ResultSet rs10 = null; PreparedStatement preStatement11 = null;
116
ResultSet rs11 = null; PreparedStatement preStatement12 = null; ResultSet rs12 = null; PreparedStatement preStatement13 = null; ResultSet rs13 = null; ArrayList nameList = new ArrayList(); ArrayList idList = new ArrayList(); ArrayList typeList = new ArrayList(); ArrayList featitleList = new ArrayList(); ArrayList feaidList = new ArrayList(); ArrayList foldList = new ArrayList(); foldList.add("restaurants"); foldList.add("restaurants"); foldList.add("restaurants"); foldList.add("forums"); foldList.add("bookmarks"); foldList.add("qa"); String foldValue=""; String query=""; String links=""; Connection connection = null; ConnectionManager ConnManager = null; try { ConnManager = new ConnectionManager(); connection = ConnManager.openConnection(); query = "select id, catname from software_domain_categories where delflag = 0 Order by catname"; preStatement8 = connection.prepareStatement(query); rs8 = preStatement8.executeQuery(); while (rs8.next()) { nameList.add(rs8.getString("catname")); idList.add(rs8.getString("id")); typeList.add("0"); query = "select id, prod_name from software_domains where catid = "+rs8.getString("id")+" Order by prod_name"; preStatement9 = connection.prepareStatement(query); rs9 = preStatement9.executeQuery(); while (rs9.next()) { nameList.add(rs9.getString("prod_name")); idList.add(rs9.getString("id")); typeList.add("1"); } } String end=""; query = "select count(id) stats from software_domains Order by prod_name";
117
preStatement10 = connection.prepareStatement(query); rs10 = preStatement10.executeQuery(); while (rs10.next()) { end = rs10.getString("stats"); } if(from.equalsIgnoreCase("")) from="0"; if(to.equalsIgnoreCase("")) to=end; to=String.valueOf(Integer.parseInt(to)-Integer.parseInt(from)); if(soft_id=="") query = "Select id from software_domains Order by prod_name limit "+from+","+to; else query = "Select id from software_domains where id ="+soft_id; logger.log(query); preStatement7 = connection.prepareStatement(query); rs7 = preStatement7.executeQuery(); while (rs7.next()) { String id = rs7.getString("id"); for(int l=0;l<foldList.size();l++) { foldValue=foldList.get(l).toString(); ArrayList commenttitleList = new ArrayList(); ArrayList commentList = new ArrayList(); ArrayList hitList = new ArrayList(); String about = ""; String name = ""; String logo = ""; String user = ""; String domid = ""; String screenref=""; String screendiv=""; query = "select a.catid, a.prod_name, b.description from software_domains a, features b where a.id = b.prod_id and a.id= "+id; preStatement2 = connection.prepareStatement(query); rs2 = preStatement2.executeQuery(); if (rs2.next()) { String temp = rs2.getString("b.description"); name = rs2.getString("a.prod_name"); domid = rs2.getString("a.catid"); temp = temp.replace("<p>",""); temp = temp.replace("</p>",""); temp = temp.replace("<br />",""); temp = temp.replace("<br>"," ");
118
temp = temp.replace("\n"," "); about = temp; } query = "Select comment, posted_by from gpllite_comments where approved = 1 and software_id = "+id; preStatement3 = connection.prepareStatement(query); rs3 = preStatement3.executeQuery(); while (rs3.next()) { commentList.add(rs3.getString("comment")); commenttitleList.add(rs3.getString("posted_by")); } int sflag=0; query = "Select title, image_path from screenshots where prod_id = "+id; preStatement4 = connection.prepareStatement(query); rs4 = preStatement4.executeQuery(); while (rs4.next()) { if(sflag==0) { screenref="href="+'"'+"http://www.gplpedia.com/uploads/"+rs4.getString("image_path")+'"'+" title="+'"'+rs4.getString("title")+'"'; sflag=1; } else { screendiv+="<a href="+'"'+"http://www.gplpedia.com/uploads/"+rs4.getString("image_path")+'"'+" title="+'"'+rs4.getString("title")+'"'+" class="+'"'+"thickbox"+'"'+" rel="+'"'+"screenshots"+'"'+"></a>"; } } logo="http://www.gplpedia.com/Select/logos/"+name+".png"; ArrayList userList = new ArrayList(); ArrayList useridList = new ArrayList(); ArrayList qaList = new ArrayList(); ArrayList qaTypeList = new ArrayList(); ArrayList qaIdList = new ArrayList(); ArrayList datList = new ArrayList(); if(foldValue.equalsIgnoreCase("qa")) { query = "select value, id,(select user_type from registered_users where id = posted_by) user_type, (select username from registered_users where id = posted_by) developer,(select company_name from registered_users where id = posted_by) company, posted_by userid, DATE_FORMAT(posted_time,'%d %b, %Y (%r)') dat from gpllite_questions where prod_id = "+id+" Order by id desc"; preStatement11 = connection.prepareStatement(query); rs11 = preStatement11.executeQuery();
119
while (rs11.next()) { datList.add(rs11.getString("dat")); qaList.add(rs11.getString("value")); qaTypeList.add("0"); qaIdList.add(rs11.getString("id")); if(rs11.getString("user_type")!=null) { if(rs11.getString("user_type").equalsIgnoreCase("1")) user = rs11.getString("developer"); else if(rs11.getString("user_type").equalsIgnoreCase("2")) user = rs11.getString("company"); else user = ""; } else { user = ""; } useridList.add(rs11.getString("userid")); userList.add(user); query = "select value,id,(select user_type from registered_users where id = posted_by) user_type, (select username from registered_users where id = posted_by) developer,(select company_name from registered_users where id = posted_by) company, posted_by userid, DATE_FORMAT(posted_time,'%d %b, %Y (%r)') dat from gpllite_answers where question_id = "+rs11.getString("id")+" Order by id desc"; preStatement12 = connection.prepareStatement(query); rs12 = preStatement12.executeQuery(); while (rs12.next()) { datList.add(rs12.getString("dat")); qaList.add(rs12.getString("value")); qaTypeList.add("1"); qaIdList.add(rs12.getString("id")); if(rs12.getString("user_type")!=null) { if(rs12.getString("user_type").equalsIgnoreCase("1")) user = rs12.getString("developer"); else if(rs12.getString("user_type").equalsIgnoreCase("2")) user = rs12.getString("company"); else user = ""; } else {
120
user = ""; } useridList.add(rs12.getString("userid")); userList.add(user); } } } else { links=fetchSoftwareLinks(foldValue,id,domid,100,"page"); } query = "select id, link, title from gpllite_featured Order by id desc"; preStatement13 = connection.prepareStatement(query); rs13 = preStatement13.executeQuery(); while (rs13.next()) { feaidList.add(rs13.getString("link")); featitleList.add(rs13.getString("title")); } WriteFile write = new WriteFile(); write.writeSoftware(nameList,idList,typeList,userList,useridList,datList,commenttitleList,commentList,about,name,domid,id,logo,screenref,screendiv,foldValue,qaList,qaTypeList,qaIdList,links,featitleList,feaidList); flag++; } } } catch (SQLException e) { e.printStackTrace(); } finally { ConnManager.closeResultSet(rs); ConnManager.closeStatement(preStatement); ConnManager.closeResultSet(rs2); ConnManager.closeStatement(preStatement2); ConnManager.closeResultSet(rs3); ConnManager.closeStatement(preStatement3); ConnManager.closeResultSet(rs4); ConnManager.closeStatement(preStatement4); ConnManager.closeResultSet(rs7); ConnManager.closeStatement(preStatement7); ConnManager.closeResultSet(rs8); ConnManager.closeStatement(preStatement8); ConnManager.closeResultSet(rs9); ConnManager.closeStatement(preStatement9); ConnManager.closeResultSet(rs10); ConnManager.closeStatement(preStatement10); ConnManager.closeResultSet(rs11); ConnManager.closeStatement(preStatement11); ConnManager.closeResultSet(rs12); ConnManager.closeStatement(preStatement12);
121
ConnManager.closeResultSet(rs13); ConnManager.closeStatement(preStatement13); ConnManager.closeConnection(connection); } return flag; } //Method to fetch Links private String fetchLinks(String action, String domid, String chkuserid, int pagesize, String btntype) { //For logging LogMessage logger = new LogMessage(); logger.log("Inside fetch Links method"); String desc=""; String title=""; String link=""; String user=""; String userid=""; String hits =""; String linkid =""; String linktype =""; String referlink=""; String dat=""; ArrayList linklist = new ArrayList(); String space_hits=" "; String Output=""; String query=""; PreparedStatement preStatement = null; ResultSet rs = null; Connection connection = null; ConnectionManager ConnManager = null; WriteFile wf = new WriteFile(); try { ConnManager = new ConnectionManager(); connection = ConnManager.openConnection(); connection.setAutoCommit(false); if(action.equalsIgnoreCase("hrestaurants")) query = "Select a.created_on credate, a.link_title title, a.link_url url, a.link_description description,(select user_type from registered_users where id = SUBSTR(a.link_provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.link_provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.link_provider,2)) company, SUBSTR(a.link_provider,2) userid, a.hits hits, a.id id, 'demo' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from demo_links a where a.approved = 1 order by credate desc limit 30"; else if(action.equalsIgnoreCase("hrestaurants")) query = "Select a.created_on credate, a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits,
122
a.id id, 'documentation' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from documentation_links a where a.approved = 1 order by credate desc limit 30"; else if(action.equalsIgnoreCase("hrestaurants")) query = "Select a.created_on credate, a.link_title title, a.url_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.provider,2)) company, SUBSTR(a.provider,2) userid, a.hits hits, a.id id, 'download' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from download_links a where a.approved = 1 order by credate desc limit 30"; else if(action.equalsIgnoreCase("hforums")) query = "Select a.created_on credate, a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'forum' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from forum_links a where a.approved = 1 order by credate desc limit 30"; else if(action.equalsIgnoreCase("hbookmarks")) query = "Select a.posted_time credate, a.title title, a.link_url url, a.description description,(select user_type from registered_users where id = a.posted_by) user_type, (select username from registered_users where id = a.posted_by) developer,(select company_name from registered_users where id = a.posted_by) company, a.posted_by userid, a.hits hits, a.id id, 'blog' type, DATE_FORMAT(posted_time,'%d %b, %Y (%r)') dat from blog a where a.approved = 1 order by credate desc limit 30"; else if(action.equalsIgnoreCase("hlatest")) query = "Select a.created_on credate, a.link_title title, a.link_url url, a.link_description description,(select user_type from registered_users where id = SUBSTR(a.link_provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.link_provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.link_provider,2)) company, SUBSTR(a.link_provider,2) userid, a.hits hits, a.id id, 'demo' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from demo_links a where a.approved = 1 union Select a.created_on credate, a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'documentation' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from documentation_links a where a.approved = 1 union Select a.created_on credate, a.link_title title, a.url_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.provider,2)) company, SUBSTR(a.provider,2) userid, a.hits hits, a.id id, 'download' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from download_links a where a.approved = 1 union Select a.created_on credate, a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'forum' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from forum_links a where a.approved = 1 union Select a.posted_time credate, a.title title, a.link_url url, a.description description,(select user_type from registered_users where id = a.posted_by) user_type, (select username from registered_users where id = a.posted_by) developer,(select company_name from registered_users where id = a.posted_by) company, a.posted_by userid, a.hits hits, a.id id, 'blog' type, DATE_FORMAT(posted_time,'%d %b, %Y (%r)') dat from blog a where a.approved = 1 order by credate desc limit 30"; else if(action.equalsIgnoreCase("urestaurants")) query = "Select a.link_title title, a.link_url url, a.link_description description,(select user_type from registered_users where id = SUBSTR(a.link_provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.link_provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.link_provider,2)) company, SUBSTR(a.link_provider,2) userid, a.hits hits, a.id id, 'demo' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from demo_links a where SUBSTR(a.link_provider,2)='"+chkuserid+"' and a.approved = 1 Order by link_title"; else if(action.equalsIgnoreCase("urestaurants"))
123
query = "Select a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'documentation' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from documentation_links a where SUBSTR(a.sponsored_by,2)='"+chkuserid+"' and a.approved = 1 Order by title"; else if(action.equalsIgnoreCase("urestaurants")) query = "Select a.link_title title, a.url_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.provider,2)) company, SUBSTR(a.provider,2) userid, a.hits hits, a.id id, 'download' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from download_links a where SUBSTR(a.provider,2)='"+chkuserid+"' and a.approved = 1 Order by link_title"; else if(action.equalsIgnoreCase("uforums")) query = "Select a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'forum' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from forum_links a where SUBSTR(a.sponsored_by,2)='"+chkuserid+"'and a.approved = 1 Order by title"; else if(action.equalsIgnoreCase("ubookmarks")) query = "Select a.title title, a.link_url url, a.description description,(select user_type from registered_users where id = a.posted_by) user_type, (select username from registered_users where id = a.posted_by) developer,(select company_name from registered_users where id = a.posted_by) company, a.posted_by userid, a.hits hits, a.id id, 'blog' type, DATE_FORMAT(posted_time,'%d %b, %Y (%r)') dat from blog a where a.posted_by='"+chkuserid+"' and a.approved = 1 Order by title"; else if(action.equalsIgnoreCase("drestaurants")) query = "Select a.created_on credate, a.link_title title, a.link_url url, a.link_description description,(select user_type from registered_users where id = SUBSTR(a.link_provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.link_provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.link_provider,2)) company, SUBSTR(a.link_provider,2) userid, a.hits hits, a.id id, 'demo' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from demo_links a where a.approved = 1 and prod_id in (select id from software_domains where catid = '"+domid+"') order by credate desc limit 30"; else if(action.equalsIgnoreCase("drestaurants")) query = "Select a.created_on credate, a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'documentation' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from documentation_links a where a.approved = 1 and prod_id in (select id from software_domains where catid = '"+domid+"') order by credate desc limit 30"; else if(action.equalsIgnoreCase("drestaurants")) query = "Select a.created_on credate, a.link_title title, a.url_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.provider,2)) company, SUBSTR(a.provider,2) userid, a.hits hits, a.id id, 'download' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from download_links a where a.approved = 1 and prod_id in (select id from software_domains where catid = '"+domid+"') order by credate desc limit 30"; else if(action.equalsIgnoreCase("dforums")) query = "Select a.created_on credate, a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'forum' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from forum_links a where a.approved = 1 and prod_id in (select id from software_domains where catid = '"+domid+"') order by credate desc limit 30";
124
else if(action.equalsIgnoreCase("dbookmarks")) query = "Select a.posted_time credate, a.title title, a.link_url url, a.description description,(select user_type from registered_users where id = a.posted_by) user_type, (select username from registered_users where id = a.posted_by) developer,(select company_name from registered_users where id = a.posted_by) company, a.posted_by userid, a.hits hits, a.id id, 'blog' type, DATE_FORMAT(posted_time,'%d %b, %Y (%r)') dat from blog a where a.approved = 1 and prod_id in (select id from software_domains where catid = '"+domid+"') order by credate desc limit 30"; else if(action.equalsIgnoreCase("dlatest")) query = "Select a.created_on credate, a.link_title title, a.link_url url, a.link_description description,(select user_type from registered_users where id = SUBSTR(a.link_provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.link_provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.link_provider,2)) company, SUBSTR(a.link_provider,2) userid, a.hits hits, a.id id, 'demo' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from demo_links a where a.approved = 1 and prod_id in (select id from software_domains where catid = '"+domid+"') union Select a.created_on credate, a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'documentation' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from documentation_links a where a.approved = 1 and prod_id in (select id from software_domains where catid = '"+domid+"') union Select a.created_on credate, a.link_title title, a.url_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.provider,2)) company, SUBSTR(a.provider,2) userid, a.hits hits, a.id id, 'download' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from download_links a where a.approved = 1 and prod_id in (select id from software_domains where catid = '"+domid+"') union Select a.created_on credate, a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'forum' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from forum_links a where a.approved = 1 and prod_id in (select id from software_domains where catid = '"+domid+"') union Select a.posted_time credate, a.title title, a.link_url url, a.description description,(select user_type from registered_users where id = a.posted_by) user_type, (select username from registered_users where id = a.posted_by) developer,(select company_name from registered_users where id = a.posted_by) company, a.posted_by userid, a.hits hits, a.id id, 'blog' type, DATE_FORMAT(posted_time,'%d %b, %Y (%r)') dat from blog a where a.approved = 1 and prod_id in (select id from software_domains where catid = '"+domid+"') order by credate desc limit 30"; else logger.log("ERROR: WRONG ACTION IN DEMO,DOC... "); preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); int j=1; int k=2; while (rs.next()) { title = rs.getString("title"); link = rs.getString("url"); desc = rs.getString("description"); userid = rs.getString("userid"); hits = rs.getString("hits"); linkid = rs.getString("id"); linktype = rs.getString("type"); dat = rs.getString("dat");
125
if(hits.length()<3) hits=" "+hits+" "; if(rs.getString("user_type")!=null) { if(rs.getString("user_type").equalsIgnoreCase("1")) user = rs.getString("developer"); else if(rs.getString("user_type").equalsIgnoreCase("2")) user = rs.getString("company"); else user = ""; } else { user = ""; } desc = desc.replace("<p>",""); desc = desc.replace("</p>",""); desc = desc.replace("<p class="+'"'+"MsoNormal"+'"'+">",""); desc = desc.replace("<p class=\"\\"MsoNormal\\"\">",""); desc = desc.replace("<o:p></o:p>",""); desc = desc.replace("<p class="+'\"'+"MsoNormal"+'\"'+">",""); desc = desc.replace("<span new="+'\"'+'\"'+" font-family:="+'\"'+'\"'+" style="+'\"'+'\"'+">",""); desc = desc.replace("</span>",""); desc = desc.replace("<br />",""); desc = desc.replace(" "," "); desc = desc.replace(";",","); desc = desc.replace("\n"," "); referlink="http://www.gplpedia.com/referlink.php?referlink="+link; link="http://www.gplpedia.com/referlink.php?id="+linkid+"&act="+linktype+"&referlink="+link; if(j==pagesize) { if(user=="") { if(title.equalsIgnoreCase("")) linklist.add("</div><div id='divlist"+k+"' style='display: none;'><h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<p></p></div>"); else linklist.add("</div><div id='divlist"+k+"' style='display: none;'><h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a>"+wf.shareBtn(referlink,title,btntype)+"<a href="+'"'+"javascript:onReport('"+title+"','"+link+"','"+action+"')"+'"'+"><img title="+'"'+"Report Spam / Broken Link"+'"'+" src="+'"'+"/eatout/images/spam.png"+'"'+"></img></a></h3><p></p></div>"); } else { if(title.equalsIgnoreCase("")) linklist.add("</div><div id='divlist"+k+"' style='display: none;'><h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<br><b>Sponsored by: <a
126
href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+"><u>"+user+"</u></a> on </b>"+dat+"<p></p></div>"); else linklist.add("</div><div id='divlist"+k+"' style='display: none;'><h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a>"+wf.shareBtn(referlink,title,btntype)+"<a href="+'"'+"javascript:onReport('"+title+"','"+link+"','"+action+"')"+'"'+"><img title="+'"'+"Report Spam / Broken Link"+'"'+" src="+'"'+"/eatout/images/spam.png"+'"'+"></img></a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<br><b>Sponsored by: <a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+"><u>"+user+"</u></a> on </b>"+dat+"<p></p></div>"); } j=1; k++; } else { if(user=="") { if(title.equalsIgnoreCase("")) linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<p></p></div>"); else linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a>"+wf.shareBtn(referlink,title,btntype)+"<a href="+'"'+"javascript:onReport('"+title+"','"+link+"','"+action+"')"+'"'+"><img title="+'"'+"Report Spam / Broken Link"+'"'+" src="+'"'+"/eatout/images/spam.png"+'"'+"></img></a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<p></p></div>"); } else { if(title.equalsIgnoreCase("")) linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<br><b>Sponsored by: <a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+"><u>"+user+"</u></a> on </b>"+dat+"<p></p></div>"); else linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a>"+wf.shareBtn(referlink,title,btntype)+"<a href="+'"'+"javascript:onReport('"+title+"','"+link+"','"+action+"')"+'"'+"><img title="+'"'+"Report Spam / Broken Link"+'"'+" src="+'"'+"/eatout/images/spam.png"+'"'+"></img></a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<br><b>Sponsored by: <a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+"><u>"+user+"</u></a> on </b>"+dat+"<p></p></div>"); } } j++; } Output+="<div id="+'"'+"TabLinks_height"+'"'+"><input type='hidden' id='hdpage' value='divlist1'/><div id='divlist1' style='display: inline'>"; for(int r=0;r<linklist.size();r++) { Output+=linklist.get(r); }
127
if(linklist.size()==0) { if(action.equalsIgnoreCase("urestaurants")||action.equalsIgnoreCase("urestaurants")||action.equalsIgnoreCase("uforums")||action.equalsIgnoreCase("urestaurants")||action.equalsIgnoreCase("ubookmarks")) Output+="<div id="+'"'+"TabLinks_height"+'"'+" class="+'"'+"entry"+'"'+">No "+action.substring(1, action.length()-1)+" has been sponsored by this user.</div>"; else if(action.equalsIgnoreCase("drestaurants")||action.equalsIgnoreCase("drestaurants")||action.equalsIgnoreCase("dforums")||action.equalsIgnoreCase("drestaurants")||action.equalsIgnoreCase("dbookmarks")) Output+="<div id="+'"'+"TabLinks_height"+'"'+" class="+'"'+"entry"+'"'+">No "+action.substring(1, action.length()-1)+" available in this domain.</div>"; else Output+="<div id="+'"'+"TabLinks_height"+'"'+" class="+'"'+"entry"+'"'+">No Link available</div>"; } Output+="</div></div>"; if(k>2) { Output+="<h2 class="+'"'+"title2"+'"'+" id="+'"'+"TabLinks_goto"+'"'+"> <span id="+'"'+"pag_goto"+'"'+">GoTo:"; int y=1; for(int w=1;w<k;w++) { if(y==16) { Output+="<br>[<a href="+'"'+"javascript:pagination('divlist"+w+"')"+'"'+">"+w+"</a>]"; y=1; } else { Output+=" [<a href="+'"'+"javascript:pagination('divlist"+w+"')"+'"'+">"+w+"</a>]"; y++; } } Output+="</span></h2><br>"; } } catch (SQLException e) { e.printStackTrace(); } finally { ConnManager.closeResultSet(rs); ConnManager.closeStatement(preStatement); ConnManager.closeConnection(connection); } return Output; } //Method to fetch Software Links
128
private String fetchSoftwareLinks(String action, String id, String domid, int pagesize, String btntype) { //For logging LogMessage logger = new LogMessage(); logger.log("Inside fetch Software Links method"); String desc=""; String title=""; String link=""; String user=""; String userid=""; String hits =""; String linkid =""; String linktype =""; String referlink=""; String dat=""; ArrayList linklist = new ArrayList(); String space_hits=" "; String Output=""; String query=""; String gad=""; gad+="<div style="+'"'+"text-align:center;"+'"'+">"; gad+="<br>"; gad+="<script type="+'"'+"text/javascript"+'"'+"><!--"; gad+="google_ad_client = "+'"'+"pub-6397928953053441"+'"'+";"; gad+="/* NEW GPLpediaLITE Text Ad */"; gad+="google_ad_slot = "+'"'+"2296107691"+'"'+";"; gad+="google_ad_width = 468;"; gad+="google_ad_height = 60;"; gad+="//-->"; gad+="</script>"; gad+="<script type="+'"'+"text/javascript"+'"'+""; gad+="src="+'"'+"http://pagead2.googlesyndication.com/pagead/show_ads.js"+'"'+">"; gad+="</script>"; gad+="<br>"; gad+="</div>"; PreparedStatement preStatement = null; ResultSet rs = null; PreparedStatement preStatement2 = null; ResultSet rs2 = null; PreparedStatement preStatement3 = null; ResultSet rs3 = null; Connection connection = null; ConnectionManager ConnManager = null; WriteFile wf = new WriteFile(); try { ConnManager = new ConnectionManager(); connection = ConnManager.openConnection(); connection.setAutoCommit(false);
129
if(action.equalsIgnoreCase("restaurants")) query = "Select a.link_title title, a.link_url url, a.link_description description,(select user_type from registered_users where id = SUBSTR(a.link_provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.link_provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.link_provider,2)) company, SUBSTR(a.link_provider,2) userid, a.hits hits, a.id id, 'demo' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from demo_links a where a.prod_id="+id+" and a.approved = 1 Order by link_title"; else if(action.equalsIgnoreCase("restaurants")) query = "Select a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'documentation' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from documentation_links a where a.prod_id="+id+" and a.approved = 1 Order by title"; else if(action.equalsIgnoreCase("restaurants")) query = "Select a.link_title title, a.url_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.provider,2)) company, SUBSTR(a.provider,2) userid, a.hits hits, a.id id, 'download' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from download_links a where a.prod_id="+id+" and a.approved = 1 Order by link_title"; else if(action.equalsIgnoreCase("forums")) query = "Select a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'forum' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from forum_links a where a.prod_id="+id+" and a.approved = 1 Order by title"; else if(action.equalsIgnoreCase("bookmarks")) query = "Select a.title title, a.link_url url, a.description description,(select user_type from registered_users where id = a.posted_by) user_type, (select username from registered_users where id = a.posted_by) developer,(select company_name from registered_users where id = a.posted_by) company, a.posted_by userid, a.hits hits, a.id id, 'blog' type, DATE_FORMAT(posted_time,'%d %b, %Y (%r)') dat from blog a where a.prod_id="+id+" and a.approved = 1 Order by title"; else logger.log("ERROR: WRONG ACTION IN DEMO,DOC..."); preStatement = connection.prepareStatement(query); rs = preStatement.executeQuery(); int j=1; int k=2; int l=1; while (rs.next()) { title = rs.getString("title"); link = rs.getString("url"); desc = rs.getString("description"); userid = rs.getString("userid"); hits = rs.getString("hits"); linkid = rs.getString("id"); linktype = rs.getString("type"); dat = rs.getString("dat");
130
if(hits.length()<3) hits=" "+hits+" "; if(rs.getString("user_type")!=null) { if(rs.getString("user_type").equalsIgnoreCase("1")) user = rs.getString("developer"); else if(rs.getString("user_type").equalsIgnoreCase("2")) user = rs.getString("company"); else user = ""; } else { user = ""; } desc = desc.replace("<p>",""); desc = desc.replace("</p>",""); desc = desc.replace("<p class="+'"'+"MsoNormal"+'"'+">",""); desc = desc.replace("<p class=\"\\"MsoNormal\\"\">",""); desc = desc.replace("<o:p></o:p>",""); desc = desc.replace("<p class="+'\"'+"MsoNormal"+'\"'+">",""); desc = desc.replace("<span new="+'\"'+'\"'+" font-family:="+'\"'+'\"'+" style="+'\"'+'\"'+">",""); desc = desc.replace("</span>",""); desc = desc.replace("<br />",""); desc = desc.replace(" "," "); desc = desc.replace(";",","); desc = desc.replace("\n"," "); referlink="http://www.gplpedia.com/referlink.php?referlink="+link; link="http://www.gplpedia.com/referlink.php?id="+linkid+"&act="+linktype+"&referlink="+link; if(j==pagesize) { if(user=="") { if(title.equalsIgnoreCase("")) linklist.add("</div><div id='divlist"+k+"' style='display: none;'><h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<p></p></div>"); else linklist.add("</div><div id='divlist"+k+"' style='display: none;'><h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a>"+wf.shareBtn(referlink,title,btntype)+"<a href="+'"'+"javascript:onReport('"+title+"','"+link+"','"+action+"')"+'"'+"><img title="+'"'+"Report Spam / Broken Link"+'"'+" src="+'"'+"/eatout/images/spam.png"+'"'+"></img></a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<p></p></div>"); } else { if(title.equalsIgnoreCase("")) linklist.add("</div><div id='divlist"+k+"' style='display: none;'><h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a></h3><div
131
class="+'"'+"entry"+'"'+">"+desc+"<br><b>Sponsored by: <a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+"><u>"+user+"</u></a> on </b>"+dat+"<p></p></div>"); else linklist.add("</div><div id='divlist"+k+"' style='display: none;'><h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a>"+wf.shareBtn(referlink,title,btntype)+"<a href="+'"'+"javascript:onReport('"+title+"','"+link+"','"+action+"')"+'"'+"><img title="+'"'+"Report Spam / Broken Link"+'"'+" src="+'"'+"/eatout/images/spam.png"+'"'+"></img></a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<br><b>Sponsored by: <a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+"><u>"+user+"</u></a> on </b>"+dat+"<p></p></div>"); } j=1; k++; } else { /*if(j==5 && l==1) { linklist.add(gad); l=0; }*/ if(user=="") { if(title.equalsIgnoreCase("")) linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<p></p></div>"); else linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a>"+wf.shareBtn(referlink,title,btntype)+"<a href="+'"'+"javascript:onReport('"+title+"','"+link+"','"+action+"')"+'"'+"><img title="+'"'+"Report Spam / Broken Link"+'"'+" src="+'"'+"/eatout/images/spam.png"+'"'+"></img></a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<p></p></div>"); } else { if(title.equalsIgnoreCase("")) linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<br><b>Sponsored by: <a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+"><u>"+user+"</u></a> on </b>"+dat+"<p></p></div>"); else linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a>"+wf.shareBtn(referlink,title,btntype)+"<a href="+'"'+"javascript:onReport('"+title+"','"+link+"','"+action+"')"+'"'+"><img title="+'"'+"Report Spam / Broken Link"+'"'+" src="+'"'+"/eatout/images/spam.png"+'"'+"></img></a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<br><b>Sponsored by: <a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+"><u>"+user+"</u></a> on </b>"+dat+"<p></p></div>"); } } j++; }
132
if(linklist.size()<6) { //j=1; if(linklist.size()==0) { linklist.add("<h3 class="+'"'+"title2"+'"'+"><a href='' target='_blank'></a></h3><div class="+'"'+"entry"+'"'+">No links available. Please <a href="+'"'+"javascript:loadLink()"+'"'+"><u>click here</u></a> to add.<p></p></div>"); } linklist.add("<h3 class="+'"'+"title2"+'"'+"><a href='' target='_blank'></a></h3><div class="+'"'+"entry"+'"'+"><h3 id="+'"'+"fontcolor1"+'"'+"><b>People who viewed this, also viewed the following.</b></h3><p></p></div>"); if(action.equalsIgnoreCase("restaurants")) query = "Select a.link_title title, a.link_url url, a.link_description description,(select user_type from registered_users where id = SUBSTR(a.link_provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.link_provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.link_provider,2)) company, SUBSTR(a.link_provider,2) userid, a.hits hits, a.id id, 'demo' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from demo_links a where a.prod_id in (select id from software_domains where catid = "+domid+") and a.approved = 1 and a.prod_id!= "+id+" Order by url limit "+(7-linklist.size()); else if(action.equalsIgnoreCase("restaurants")) query = "Select a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'documentation' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from documentation_links a where a.prod_id in (select id from software_domains where catid = "+domid+") and a.approved = 1 and a.prod_id!= "+id+" Order by url limit "+(7-linklist.size()); else if(action.equalsIgnoreCase("restaurants")) query = "Select a.link_title title, a.url_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.provider,2)) company, SUBSTR(a.provider,2) userid, a.hits hits, a.id id, 'download' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from download_links a where a.prod_id in (select id from software_domains where catid = "+domid+") and a.approved = 1 and a.prod_id!= "+id+" Order by url limit "+(7-linklist.size()); else if(action.equalsIgnoreCase("forums")) query = "Select a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'forum' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from forum_links a where a.prod_id in (select id from software_domains where catid = "+domid+") and a.approved = 1 and a.prod_id!= "+id+" Order by url limit "+(7-linklist.size()); else if(action.equalsIgnoreCase("bookmarks")) query = "Select a.title title, a.link_url url, a.description description,(select user_type from registered_users where id = a.posted_by) user_type, (select username from registered_users where id = a.posted_by) developer,(select company_name from registered_users where id = a.posted_by) company, a.posted_by userid, a.hits hits, a.id id, 'blog' type, DATE_FORMAT(posted_time,'%d %b, %Y (%r)') dat from blog a where a.prod_id in (select id from software_domains where catid = "+domid+") and a.approved = 1 and a.prod_id!= "+id+" Order by url limit "+(7-linklist.size()); else logger.log("ERROR: WRONG ACTION IN DEMO,DOC... "); preStatement2 = connection.prepareStatement(query);
133
rs2 = preStatement2.executeQuery(); while (rs2.next()) { title = rs2.getString("title"); link = rs2.getString("url"); desc = rs2.getString("description"); userid = rs2.getString("userid"); hits = rs2.getString("hits"); linkid = rs2.getString("id"); linktype = rs2.getString("type"); dat = rs2.getString("dat"); if(hits.length()<3) hits=" "+hits+" "; if(rs2.getString("user_type")!=null) { if(rs2.getString("user_type").equalsIgnoreCase("1")) user = rs2.getString("developer"); else if(rs2.getString("user_type").equalsIgnoreCase("2")) user = rs2.getString("company"); else user = ""; } else { user = ""; } desc = desc.replace("<p>",""); desc = desc.replace("</p>",""); desc = desc.replace("<p class="+'"'+"MsoNormal"+'"'+">",""); desc = desc.replace("<p class=\"\\"MsoNormal\\"\">",""); desc = desc.replace("<o:p></o:p>",""); desc = desc.replace("<p class="+'\"'+"MsoNormal"+'\"'+">",""); desc = desc.replace("<span new="+'\"'+'\"'+" font-family:="+'\"'+'\"'+" style="+'\"'+'\"'+">",""); desc = desc.replace("</span>",""); desc = desc.replace("<br />",""); desc = desc.replace(" "," "); desc = desc.replace(";",","); desc = desc.replace("\n"," "); referlink="http://www.gplpedia.com/referlink.php?referlink="+link; link="http://www.gplpedia.com/referlink.php?id="+linkid+"&act="+linktype+"&referlink="+link; if(user=="") { if(title.equalsIgnoreCase("")) linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<p></p></div>"); else linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a>"+wf.shareBtn(referlink,title,btntype)+"<a href="+'"'+"javascript:onReport('"+title+"','"+link+"','"+action+"')"+'"'+"><img title="+'"'+"Report Spam / Broken
134
Link"+'"'+" src="+'"'+"/eatout/images/spam.png"+'"'+"></img></a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<p></p></div>"); } else { if(title.equalsIgnoreCase("")) linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<br><b>Sponsored by: <a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+"><u>"+user+"</u></a> on </b>"+dat+"<p></p></div>"); else linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a>"+wf.shareBtn(referlink,title,btntype)+"<a href="+'"'+"javascript:onReport('"+title+"','"+link+"','"+action+"')"+'"'+"><img title="+'"'+"Report Spam / Broken Link"+'"'+" src="+'"'+"/eatout/images/spam.png"+'"'+"></img></a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<br><b>Sponsored by: <a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+"><u>"+user+"</u></a> on </b>"+dat+"<p></p></div>"); } /*if(j==4 && l==1) { linklist.add(gad); l=0; } j++;*/ } if(linklist.size()<7) { //j=1; if(action.equalsIgnoreCase("restaurants")) query = "Select a.link_title title, a.link_url url, a.link_description description,(select user_type from registered_users where id = SUBSTR(a.link_provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.link_provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.link_provider,2)) company, SUBSTR(a.link_provider,2) userid, a.hits hits, a.id id, 'demo' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from demo_links a where a.approved = 1 and a.prod_id!= "+id+" Order by url limit "+(7-linklist.size()); else if(action.equalsIgnoreCase("restaurants")) query = "Select a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'documentation' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from documentation_links a where a.approved = 1 and a.prod_id!= "+id+" Order by url limit "+(7-linklist.size()); else if(action.equalsIgnoreCase("restaurants")) query = "Select a.link_title title, a.url_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.provider,2)) user_type, (select username from registered_users where id = SUBSTR(a.provider,2)) developer,(select company_name from registered_users where id = SUBSTR(a.provider,2)) company, SUBSTR(a.provider,2) userid, a.hits hits, a.id id, 'download' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from download_links a where a.approved = 1 and a.prod_id!= "+id+" Order by url limit "+(7-linklist.size()); else if(action.equalsIgnoreCase("forums")) query = "Select a.title title, a.custom_link url, a.description description,(select user_type from registered_users where id = SUBSTR(a.sponsored_by,2)) user_type, (select username from registered_users where id = SUBSTR(a.sponsored_by,2)) developer,(select company_name from
135
registered_users where id = SUBSTR(a.sponsored_by,2)) company, SUBSTR(a.sponsored_by,2) userid, a.hits hits, a.id id, 'forum' type, DATE_FORMAT(created_on,'%d %b, %Y (%r)') dat from forum_links a where a.approved = 1 and a.prod_id!= "+id+" Order by url limit "+(7-linklist.size()); else if(action.equalsIgnoreCase("bookmarks")) query = "Select a.title title, a.link_url url, a.description description,(select user_type from registered_users where id = a.posted_by) user_type, (select username from registered_users where id = a.posted_by) developer,(select company_name from registered_users where id = a.posted_by) company, a.posted_by userid, a.hits hits, a.id id, 'blog' type, DATE_FORMAT(posted_time,'%d %b, %Y (%r)') dat from blog a where a.approved = 1 and a.prod_id!= "+id+" Order by url limit "+(7-linklist.size()); else logger.log("ERROR: WRONG ACTION IN DEMO,DOC..."); preStatement3 = connection.prepareStatement(query); rs3 = preStatement3.executeQuery(); while (rs3.next()) { title = rs3.getString("title"); link = rs3.getString("url"); desc = rs3.getString("description"); userid = rs3.getString("userid"); hits = rs3.getString("hits"); linkid = rs3.getString("id"); linktype = rs3.getString("type"); dat = rs3.getString("dat"); if(hits.length()<3) hits=" "+hits+" "; if(rs3.getString("user_type")!=null) { if(rs3.getString("user_type").equalsIgnoreCase("1")) user = rs3.getString("developer"); else if(rs3.getString("user_type").equalsIgnoreCase("2")) user = rs3.getString("company"); else user = ""; } else { user = ""; } desc = desc.replace("<p>",""); desc = desc.replace("</p>",""); desc = desc.replace("<p class="+'"'+"MsoNormal"+'"'+">",""); desc = desc.replace("<p class=\"\\"MsoNormal\\"\">",""); desc = desc.replace("<o:p></o:p>",""); desc = desc.replace("<p class="+'\"'+"MsoNormal"+'\"'+">",""); desc = desc.replace("<span new="+'\"'+'\"'+" font-family:="+'\"'+'\"'+" style="+'\"'+'\"'+">",""); desc = desc.replace("</span>",""); desc = desc.replace("<br />","");
136
desc = desc.replace(" "," "); desc = desc.replace(";",","); desc = desc.replace("\n"," "); referlink="http://www.gplpedia.com/referlink.php?referlink="+link; link="http://www.gplpedia.com/referlink.php?id="+linkid+"&act="+linktype+"&referlink="+link; if(user=="") { if(title.equalsIgnoreCase("")) linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<p></p></div>"); else linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a>"+wf.shareBtn(referlink,title,btntype)+"<a href="+'"'+"javascript:onReport('"+title+"','"+link+"','"+action+"')"+'"'+"><img title="+'"'+"Report Spam / Broken Link"+'"'+" src="+'"'+"/eatout/images/spam.png"+'"'+"></img></a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<p></p></div>"); } else { if(title.equalsIgnoreCase("")) linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<br><b>Sponsored by: <a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+"><u>"+user+"</u></a> on </b>"+dat+"<p></p></div>"); else linklist.add("<h3 class='title2'><a href='"+link+"' target='_blank'>"+title+"</a>"+wf.shareBtn(referlink,title,btntype)+"<a href="+'"'+"javascript:onReport('"+title+"','"+link+"','"+action+"')"+'"'+"><img title="+'"'+"Report Spam / Broken Link"+'"'+" src="+'"'+"/eatout/images/spam.png"+'"'+"></img></a></h3><div class="+'"'+"entry"+'"'+">"+desc+"<br><b>Sponsored by: <a href="+'"'+"/eatout/html/user.html?userid="+userid+"&domid="+domid+'"'+"><u>"+user+"</u></a> on </b>"+dat+"<p></p></div>"); } /*if(j==4 && l==1) { linklist.add(gad); l=0; } j++;*/ } } } Output+="<div id="+'"'+"TabLinks_height"+'"'+"><input type='hidden' id='hdpage' value='divlist1'/><div id='divlist1' style='display: inline'>"; for(int r=0;r<linklist.size();r++) { Output+=linklist.get(r); } Output+="</div></div>";
137
if(k>2) { Output+="<h2 class="+'"'+"title2"+'"'+" id="+'"'+"TabLinks_goto"+'"'+"><span id="+'"'+"pag_goto"+'"'+">GoTo:"; int y=1; for(int w=1;w<k;w++) { if(y==16) { Output+="<br>[<a href="+'"'+"javascript:pagination('divlist"+w+"')"+'"'+">"+w+"</a>]"; y=1; } else { Output+=" [<a href="+'"'+"javascript:pagination('divlist"+w+"')"+'"'+">"+w+"</a>]"; y++; } } Output+="</span></h2><br>"; } } catch (SQLException e) { e.printStackTrace(); } finally { ConnManager.closeResultSet(rs); ConnManager.closeStatement(preStatement); ConnManager.closeResultSet(rs2); ConnManager.closeStatement(preStatement2); ConnManager.closeResultSet(rs3); ConnManager.closeStatement(preStatement3); ConnManager.closeConnection(connection); } return Output; } } Home.Jsp <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>EatOut </title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <link href="/eatout/css/default.css" rel="stylesheet" type="text/css" />
138
<script type="text/javascript" src="/eatout/js/common.js"></script> <script type="text/javascript" src="/eatout/js/user.js"></script> <script type="text/javascript" src="/eatout/js/jquery.js"></script> <script type="text/javascript" src="/eatout/js/thickbox.js"></script> <link rel="stylesheet" href="/eatout/css/thickbox.css" type="text/css" /> </head> <body> <FORM method="get" name="frmuser" action="/eatout/MainServlet"> <INPUT type="hidden" name="hdaction" value=""> <INPUT type="hidden" name="hduserid" value=""> <!-- start header --> <div id="loadisp"> <table width="100%"><tr align="center"><td valign="middle"><span id="ush_loadingTd"> Loading... </span></td></tr></table> </div> <div id="header"> <span id="logo">EatOut.in</span> <span id="menu"> <a href="/eatout/">Home</a> | <a href="/eatout/html/about.html?keepThis=true&TB_iframe=true&height=400;&width=600" class="thickbox">About us</a> | <a href="/eatout/html/contact.html?placeValuesBeforeTB_=savedValues&TB_iframe=true&height=240;&width=280&modal=true" class="thickbox">Contact us</a> | <span id="signdisp"><a href="javascript:appearSignIn()">Sign In</a></span> <span id="signdisp2"></span> |<a href="http://gplpedia.com/rss.xml" target="_blank"><img src="/eatout/images/rss.png" id="rss_st" alt="rss"/></a> <br> <div id="signinbox" style="display: none;"> <div id="logdisp" style="display: inline;"> <table width="100%"> <tr align="center"> <td colspan="2"><span id="signinfo"> </span></td> </tr> <tr> <td>Email:</td> <td><input class="textfield" name="txtemail" id="txtemail" type="text" /></td> </tr> <tr> <td>Password:</td> <td><input class="textfield" name="txtpass" id="txtpass" type="password" /></td> </tr> <tr> <td colspan=2 align="center"> <a style="text-decoration: none;" href="javascript:onFrgt()">Forgot Password</a> | <a style="text-decoration: none;" href="/eatout/html/register.html?placeValuesBeforeTB_=savedValues&TB_iframe=true&height=350;&width=350&modal=true" class="thickbox">Register</a> </td>
139
</tr> <tr><td> </td><td> </td></tr> <tr align="center"> <td colspan=2 align="center"> <input name="Submit" type="button" class="button" value="Submit" id="ButtonOk" onclick="javascript:onSignin()"/> <input name="Cancel" type="button" class="button" value="Cancel" id="ButtonCancel" onclick="javascript:appearSignIn()"/> </td> </tr> <tr><td colspan=2> </td></tr> </table> </div> <div id="fordisp" style="display: none;"> <table> <tr><td colspan="2"><span id="signinfo2"></span> </td><td> <tr> <td> Email:</td> <td><input class="textfield" name="txtemail2" id="txtemail2" type="text" /></td> </tr> <tr><td> </td><td> </td></tr> <tr> <td> </td> <td> <input name="Submit" type="button" class="button" value="Submit" id="ButtonOk" onclick="javascript:onForgotPwd()"/> <input name="Cancel" type="button" class="button" value="Cancel" id="ButtonCancel" onclick="javascript:appearSignIn()"/> </td> </tr> </table> </div> </div> </span> </div> <!-- end header --> <table id="ush_headertabUP" cellpadding="0" cellspacing="0" width="95%"> <tr> <td align="left" id="ush_headertabUPbl"> </td> <td align="right" id="ush_headertabUPbr"> </td> </tr> </table> <table id="headheader" cellpadding="0" cellspacing="0" width="95%"> <tr> <td align="left" id="headheaderleft"> </td> <td align="center" id="headheadercenter"> <table width="100%"> <tr align="center"> <td><a href="">Reviewa></td> <td><a href="">Blogs</a></td> <td><a href="">Recipes</a></td>
140
<td><a href="">News & Events <a></td> </tr> </table> </td> <td align="right" id="headheaderright"> </td> </tr> </table> <table id="ush_headertabDN" cellpadding="0" cellspacing="0" width="95%"> <tr> <td align="left" id="ush_headertabDNtl"> </td> <td align="right" id="ush_headertabDNtr"> <span id="submit_gplpedia"><a href="/eatout/html/submit.html?height=360;&width=400&modal=true" class="thickbox"><img src="/eatout/images/submit_gpl.png"></a></span></td> </tr> </table> <table cellpadding="0" cellspacing="0" width="95%" id="pageEnclosureTab"><tr><td> <!-- start page --> <div id="page"> <!-- start sidebar --> <div id="sidebar"> <ul> <li id="search"> <fieldset> <table width="100%" cellpadding="0" cellspacing="0"><tr align="center"><td valign="top"><input type="text" id="s" autocomplete="off" name="s" value="Search" onkeyup="javascript:onSearch();" onfocus="javascript:onfck();" onblur="javascript:onblr();"></input></td><td><a id="myLink" href="http://www.gplpedia.com/sphider/search.php?&keepThis=true&TB_iframe=true&height=500;&width=800" class="thickbox"><input name="Go" type="button" class="button" value="GO" id="ButtonGo" /></a></td></tr><tr><td><span id="SearchBox"></span></td><td></td></tr></table> </fieldset> </li> </ul> <br> <!-- Google Ads --><table><tr><td> </td></table> <table width="100%"><tr align="center"><td> <div id="ush_statboxdiv"> <table id="ush_statboxtab"> <tr id="ush_statboxhead"> <td> Featured LINKS</td> </tr> </table> <table cellspacing="3" id="ush_statboxbody">
141
<tr><td><a href="http://localhost:8080/eatout/restaurants/Joomla.html" id="flink" target="_blank">Joomla</a></td></tr> <tr><td><a href="http://sourceforge.net/" id="flink" target="_blank">SourceForge.net</a></td></tr> <tr><td><a href="http://www.eatout.com/blog/" id="flink" target="_blank">Gplpedia Blog</a></td></tr> <tr><td><a href="http://www.google.com/url?sa=t&source=web&ct=res&cd=1&url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FContent_management_system&ei=tj37SePzD6a4tgPioZzTAQ&usg=AFQjCNFFTGhTTqNLqPFoiJRo4Ua7lzhqbw" id="flink" target="_blank">content management system (CMS)</a></td></tr> <tr><td><a href="http://www.google.com/url?sa=t&source=web&ct=res&cd=1&url=http%3A%2F%2Fwww.alfresco.com%2F&ei=kT37ScDpOZySswPFg4XfAQ&usg=AFQjCNEP0UkiH5yLA6__Be6FLa116KPqjA" id="flink" target="_blank">Alfreco Home page</a></td></tr> <tr><td><a href="http://www.gplpedia.com/referlink.php?id=6732&act=documentation&referlink=http://lucene.apache.org/nutch/version_control.html" id="flink" target="_blank">Nutch Version Control</a></td></tr> </table> </div><br> <script type="text/javascript"><!-- google_ad_client = "pub-6397928953053441"; /* GPLpediaLITE-Folder-Text */ google_ad_slot = "5507016318"; google_ad_width = 160; google_ad_height = 600; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script><br> </td></tr></table> </div> <!-- end sidebar --> <!-- start content --> <%String usercon1=(String)request.getAttribute("usercon1"); String usercon2=(String)request.getAttribute("usercon2"); String usercon3=(String)request.getAttribute("usercon3");%> <div id="content"> <div class="post"> <h2 class="title"><b>Profile Page</b></h2> <div class="entry"> <table width="100%"> <tr> <td> <div class="tx" id="usercon1">
142
<%=usercon1%> </div> </td> </tr> </table> </div> <div style="text-align:center;"> <br> <script type="text/javascript"><!-- google_ad_client = "pub-6397928953053441"; /* NEW GPLpediaLITE Text Ad */ google_ad_slot = "2296107691"; google_ad_width = 468; google_ad_height = 60; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> <br> <div id="ush_statboxdiv"> <table id="ush_statboxtab"> <tr id="ush_statboxhead"> <td> Associated Softwares</td> </tr> </table> <table cellspacing="3" id="ush_statboxbody"> <tr><td> <div id="usercon2"> <%=usercon2%> </div> </td></td></table> </div> <br> <div class="meta"> <span id="divtabs"> <table align="left" cellpadding="0" cellspacing="0"> <tr valign="middle"> <td id="tabSelected"> <a id="tabtext" href="javascript:onUpdate('restaurants')">Restaurants</a> </td> <td> </td> <td id="tabUnSelected"> <a id="tabtext" href="javascript:onUpdate('restaurants')">Restaurants</a> </td> <td> </td> <td id="tabUnSelected"> <a id="tabtext" href="javascript:onUpdate('restaurants')">Restaurants</a> </td> <td> </td>
143
<td id="tabUnSelected"> <a id="tabtext" href="javascript:onUpdate('forums')">Forums</a> </td> <td> </td> <td id="tabUnSelected"> <a id="tabtext" href="javascript:onUpdate('bookmarks')">Bookmarks</a> </td> <td> </td> </tr> </table> </span> <div id="tabline"></div> </div> </div> <div class="post"> <div id="Linkcontents"> <div id="TabLinks_height"><h3>Loading...</h3></div> </div> <br><br> <div style="text-align:left;"> <script type="text/javascript"><!-- google_ad_client = "pub-6397928953053441"; /* GPLpediaLite Link Unit */ google_ad_slot = "8864960949"; google_ad_width = 468; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> /* Google Ads */ </script> <br><br> </div> </div> <div class="post"> <h2 class="title">Leave a Note</h2> <div class="entry"> <div id="usercon3"> <%=usercon3%> <br><br></div> </div> </div> </div> <!-- end content --> </div> <div style="text-align:center;">
144
<script type="text/javascript"><!-- google_ad_client = "pub-6397928953053441"; /* GPLpediaLite Image Banner Ad */ google_ad_slot = "8488273663"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> <!-- end page --> </td></tr></table> <table id="ush_footertabUP" cellpadding="0" cellspacing="0" width="95%"> <tr> <td align="left" id="ush_footertabUPbl"> </td> <td align="right" id="ush_footertabUPbr"> </td> </tr> </table> <table id="ush_footertabDN" cellpadding="0" cellspacing="0" width="95%"> <tr> <td align="left" id="ush_footertabDNtl"> </td> <td align="right" id="ush_footertabDNtr"> </td> </tr> </table> <!-- start footer --> <div id="footer"> <b>Copyright © www.GPLpedia.com</b> <br> <a target='_blank' href='http://www.gplpedia.com' style="text-decoration: none">GPLpedia.com</a> | <a target='_blank' href='http://www.gplpedia.com/gplpedialite' style="text-decoration: none">GPLpediaLite.com</a> | <a target='_blank' href='http://www.gplpediaslim.com' style="text-decoration: none">GPLpediaSlim.com</a> | <a target='_blank' href='http://gplpedia.com/Gold/Content Management System (CMS).html' style="text-decoration: none">GPLpediaGOLD.com</a> <br> <a target='_blank' href='http://www.gplpedia.com/wiki' style="text-decoration: none">GPLpediaWiki</a> | <a target='_blank' href='http://www.gplpedia.com/blog' style="text-decoration: none">GPLpediaBlog</a> | <a target='_blank' href='http://www.gplpedia.com/Community/Community.html' style="text-decoration: none">GPLpedia Community</a> | <a target='_blank' href='http://www.gplpedia.com/Select/Softwares.html' style="text-decoration: none">GPLpedia Software List</a> | <a target='_blank' href='http://www.gplpedia.com/rss.xml' style="text-decoration: none">GPLpedia RSS</a> </div> <!-- end footer --> <SCRIPT language="javascript">javascript:changeSignout()</SCRIPT> </form> </body> </html> Connection.DAO
145
package util; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; /** This class holds the implementation for managing the database connections. * */ public class ConnectionManager { private static ConnectionManager dbConnObj = null; private static final String DRIVER = "com.mysql.jdbc.Driver"; //private static final String SOURCE = "jdbc:mySQL://208.109.21.159/gplpedianew"; private static final String SOURCE = "jdbc:mySQL://localhost/eatout"; /** * */ public static synchronized ConnectionManager getInstance() { if (dbConnObj == null) { dbConnObj = new ConnectionManager(); } return dbConnObj; } /** * @return conn * */ public Connection openConnection() { //System.out.println("Entering openConnection"); Connection conn = null; try { Class.forName(DRIVER); //conn = DriverManager.getConnection(SOURCE,"gplpediacom","Triberry123"); conn = DriverManager.getConnection(SOURCE,"root",""); } catch (SQLException e) { System.out.println("Exception in openConnection"+e); } catch (Exception e) { System.out.println("Exception in openConnection"+e); } //System.out.println("Exiting openConnection"); return conn; } /** * @return * @param connection the Connection object * */
146
public void closeConnection(Connection connection) { //System.out.println("Entering closeConenction"); try { if (connection != null && !connection.isClosed()) { connection.close(); } } catch (SQLException e) { System.out.println("Exception in closeConnection"+e); connection = null; } catch (Exception e) { System.out.println("Exception in closeConnection"+e); connection = null; } //System.out.println("Exiting closeConenction"); } /** * @return * @param statement the Statement object * */ public void closeStatement(Statement statement) { //System.out.println("Entering closeStatement"); try { if (statement != null) { statement.close(); } } catch (SQLException e) { System.out.println("Exception in closeStatement"+e); statement = null; } catch (Exception e) { System.out.println("Exception in closeStatement"+e); statement = null; } //System.out.println("Exiting closeStatement"); } /** * @return * @param resultset the Resultset object * */ public void closeResultSet(ResultSet resultset) { //System.out.println("Entering closeResultSet"); try { if (resultset != null) { resultset.close(); } } catch (SQLException e) { System.out.println("Exception in closeResultSet"+e); resultset = null; } catch (Exception e) { System.out.println("Exception in closeResultSet"+e); resultset = null; } //System.out.println("Exiting closeResultSet");
147
} /** * @return * @param connection the Connection Object * */ public void commit(Connection connection) { //System.out.println("Entering commit"); try { if (connection != null) { connection.commit(); } } catch (SQLException e) { System.out.println("Exception in commit"+e); } catch (Exception e) { System.out.println("Exception in commit"+e); } //System.out.println("Exiting commit"); } /** * @return * @param connection the Connection Object * */ public void rollback(Connection connection) { //System.out.println("Entering rollback"); try { if (connection != null) { connection.rollback(); } } catch (SQLException e) { System.out.println("Exception in rollback"+e); } catch (Exception e) { System.out.println("Exception in rollback"+e); } //System.out.println("Exiting rollback"); } } Default.Js var xmlHttp; function createXmlHttpRequest() { try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try
148
{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } } function onUpdate(action) { window.location.href=window.location.search+"#hTabLinks" action="h"+action; document.frmhome.hdaction.value=action; document.frmhome.hdact.value=action; if(action=='hlatest') { document.getElementById('htabbtns').innerHTML= "<li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('latest')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_1.gif')"+'"'+" id="+'"'+"htab_1"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex1_1.gif"+'"'+" name="+'"'+"ebbcbindex_1"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Latest"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_0.gif')"+'"'+" id="+'"'+"htab_2"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex2_0.gif"+'"'+" name="+'"'+"ebbcbindex_2"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_0.gif')"+'"'+" id="+'"'+"htab_3"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex3_0.gif"+'"'+" name="+'"'+"ebbcbindex_3"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_0.gif')"+'"'+" id="+'"'+"htab_4"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex4_0.gif"+'"'+" name="+'"'+"ebbcbindex_4"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li>"; document.getElementById('htabtext').innerHTML= "Latest"; } else if(action=='hrestaurants') {
149
document.getElementById('htabbtns').innerHTML= "<li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('latest')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_0.gif')"+'"'+" id="+'"'+"htab_1"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex1_0.gif"+'"'+" name="+'"'+"ebbcbindex_1"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Latest"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_1.gif')"+'"'+" id="+'"'+"htab_2"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex2_1.gif"+'"'+" name="+'"'+"ebbcbindex_2"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_0.gif')"+'"'+" id="+'"'+"htab_3"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex3_0.gif"+'"'+" name="+'"'+"ebbcbindex_3"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_0.gif')"+'"'+" id="+'"'+"htab_4"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex4_0.gif"+'"'+" name="+'"'+"ebbcbindex_4"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li>"; document.getElementById('htabtext').innerHTML= "Restaurants"; } else if(action=='hrestaurants') { document.getElementById('htabbtns').innerHTML= "<li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('latest')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_0.gif')"+'"'+" id="+'"'+"htab_1"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex1_0.gif"+'"'+" name="+'"'+"ebbcbindex_1"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Latest"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_0.gif')"+'"'+" id="+'"'+"htab_2"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex2_0.gif"+'"'+" name="+'"'+"ebbcbindex_2"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_1.gif')"+'"'+" id="+'"'+"htab_3"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex3_1.gif"+'"'+" name="+'"'+"ebbcbindex_3"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_0.gif')"+'"'+" id="+'"'+"htab_4"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex4_0.gif"+'"'+" name="+'"'+"ebbcbindex_4"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li>"; document.getElementById('htabtext').innerHTML= "Restaurants"; }
150
else if(action=='hrestaurants') { document.getElementById('htabbtns').innerHTML= "<li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('latest')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_0.gif')"+'"'+" id="+'"'+"htab_1"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex1_0.gif"+'"'+" name="+'"'+"ebbcbindex_1"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Latest"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_0.gif')"+'"'+" id="+'"'+"htab_2"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex2_0.gif"+'"'+" name="+'"'+"ebbcbindex_2"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_0.gif')"+'"'+" id="+'"'+"htab_3"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex3_0.gif"+'"'+" name="+'"'+"ebbcbindex_3"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_1.gif')"+'"'+" id="+'"'+"htab_4"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex4_1.gif"+'"'+" name="+'"'+"ebbcbindex_4"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li>"; document.getElementById('htabtext').innerHTML= "Restaurants"; } else if(action=='hforums') { document.getElementById('htabbtns').innerHTML= "<li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('latest')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_0.gif')"+'"'+" id="+'"'+"htab_1"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex1_0.gif"+'"'+" name="+'"'+"ebbcbindex_1"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Latest"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_0.gif')"+'"'+" id="+'"'+"htab_2"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex2_0.gif"+'"'+" name="+'"'+"ebbcbindex_2"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_0.gif')"+'"'+" id="+'"'+"htab_3"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex3_0.gif"+'"'+" name="+'"'+"ebbcbindex_3"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_0.gif')"+'"'+" id="+'"'+"htab_4"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex4_0.gif"+'"'+" name="+'"'+"ebbcbindex_4"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li>";
151
document.getElementById('htabtext').innerHTML= "Forums"; } else if(action=='hbookmarks') { document.getElementById('htabbtns').innerHTML= "<li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('latest')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_0.gif')"+'"'+" id="+'"'+"htab_1"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex1_0.gif"+'"'+" name="+'"'+"ebbcbindex_1"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Latest"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_0.gif')"+'"'+" id="+'"'+"htab_2"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex2_0.gif"+'"'+" name="+'"'+"ebbcbindex_2"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_0.gif')"+'"'+" id="+'"'+"htab_3"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex3_0.gif"+'"'+" name="+'"'+"ebbcbindex_3"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_0.gif')"+'"'+" id="+'"'+"htab_4"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex4_0.gif"+'"'+" name="+'"'+"ebbcbindex_4"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li>"; document.getElementById('htabtext').innerHTML= "Bookmarks"; } else if(action=='hprofessionals') { document.getElementById('htabbtns').innerHTML= "<li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('latest')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_0.gif')"+'"'+" id="+'"'+"htab_1"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex1_0.gif"+'"'+" name="+'"'+"ebbcbindex_1"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Latest"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_0.gif')"+'"'+" id="+'"'+"htab_2"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex2_0.gif"+'"'+" name="+'"'+"ebbcbindex_2"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_0.gif')"+'"'+" id="+'"'+"htab_3"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex3_0.gif"+'"'+" name="+'"'+"ebbcbindex_3"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_0.gif')"+'"'+" id="+'"'+"htab_4"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex4_0.gif"+'"'+" name="+'"'+"ebbcbindex_4"+'"'+"
152
width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li>"; document.getElementById('htabtext').innerHTML= "Professionals"; } else if(action=='hvendors') { document.getElementById('htabbtns').innerHTML= "<li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('latest')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_0.gif')"+'"'+" id="+'"'+"htab_1"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex1_0.gif"+'"'+" name="+'"'+"ebbcbindex_1"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Latest"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_0.gif')"+'"'+" id="+'"'+"htab_2"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex2_0.gif"+'"'+" name="+'"'+"ebbcbindex_2"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_0.gif')"+'"'+" id="+'"'+"htab_3"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex3_0.gif"+'"'+" name="+'"'+"ebbcbindex_3"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_0.gif')"+'"'+" id="+'"'+"htab_4"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex4_0.gif"+'"'+" name="+'"'+"ebbcbindex_4"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li>"; document.getElementById('htabtext').innerHTML= "Vendors"; } document.getElementById('Linkcontents').innerHTML= "<div id="+'"'+"TabLinks_height"+'"'+"><h3>Loading...</h3><br></div>"; createXmlHttpRequest(); xmlHttp.open("get","/eatout/MainServlet?hdaction="+action,true) xmlHttp.onreadystatechange=callback; xmlHttp.send(null); } function callback() { var content=""; if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { content = xmlHttp.responseText; if(content=="") { document.getElementById('Linkcontents').innerHTML= "<div class='entry' id="+'"'+"TabLinks_height"+'"'+">No link available.</div><br>"; } else
153
{ document.getElementById('Linkcontents').innerHTML= content; } } } } function changeSignout() { document.getElementById('htabbtns').innerHTML= "<li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('latest')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_1','/eatout/images/ebbtcbindex1_1.gif')"+'"'+" id="+'"'+"htab_1"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex1_1.gif"+'"'+" name="+'"'+"ebbcbindex_1"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Latest"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_2','/eatout/images/ebbtcbindex2_0.gif')"+'"'+" id="+'"'+"htab_2"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex2_0.gif"+'"'+" name="+'"'+"ebbcbindex_2"+'"'+" width="+'"'+"62"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_3','/eatout/images/ebbtcbindex3_0.gif')"+'"'+" id="+'"'+"htab_3"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex3_0.gif"+'"'+" name="+'"'+"ebbcbindex_3"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li><li class="+'"'+"spaced_li"+'"'+"><a href="+'"'+"javascript:onUpdate('restaurants')"+'"'+"><img onmouseover="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_1.gif')"+'"'+" onmouseout="+'"'+"javascript:homeImgChange('htab_4','/eatout/images/ebbtcbindex4_0.gif')"+'"'+" id="+'"'+"htab_4"+'"'+" src="+'"'+"/eatout/images/ebbtcbindex4_0.gif"+'"'+" name="+'"'+"ebbcbindex_4"+'"'+" width="+'"'+"85"+'"'+" height="+'"'+"23"+'"'+" style="+'"'+"vertical-align: bottom;"+'"'+" border="+'"'+"0"+'"'+" alt="+'"'+"Restaurants"+'"'+" title="+'"'+""+'"'+" /></a></li>"; document.frmhome.hdaction.value="loadSession"; createXmlHttpRequest(); xmlHttp.open("get","/eatout/MainServlet?hdaction=loadSession",true) xmlHttp.onreadystatechange=showSession; xmlHttp.send(null); } function showSession() { var content=""; if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { content = xmlHttp.responseText; if(content!="") { document.getElementById('signdisp').innerHTML= "<a href="+'"'+"javascript:onSignout()"+'"'+">Sign Out</a>"; document.getElementById('signdisp2').innerHTML= "| <a href="+'"'+"/eatout/html/user.html?userid=profile"+'"'+"><b>My eatout</b></a>"; document.frmhome.hduserid.value=content;
154
} document.getElementById('loadisp').style.display = 'none'; } } } function pagination(arg) { document.getElementById(document.frmhome.hdpage.value).style.display = 'none'; document.getElementById(arg).style.display = 'inline'; document.frmhome.hdpage.value=arg; } function onSearch() { if(document.frmhome.s.value=="" || document.frmhome.s.value=="Search") { document.getElementById("SearchBox").style.display = 'none'; } else { document.getElementById('myLink').href="http://www.eatout.in/sphider/search.php?query="+document.frmhome.s.value+"&search=1&keepThis=true&TB_iframe=true&height=500;&width=800"; document.frmhome.hdaction.value="search"; createXmlHttpRequest(); xmlHttp.open("get","/eatout/MainServlet?hdaction=search&s="+document.frmhome.s.value,true) xmlHttp.onreadystatechange=generateSearch; xmlHttp.send(null); } } function generateSearch() { var content=""; if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { content = xmlHttp.responseText; if(content!="") { document.getElementById('SearchBox').innerHTML= content; document.getElementById("SearchBox").style.display = 'inline'; } else { document.getElementById("SearchBox").style.display = 'none'; } } } } function onfck() { document.getElementById('myLink').href="http://www.eatout.in/sphider/search.php?keepThis=true&TB_iframe=true&height=500;&width=800"; document.frmhome.s.value=""; }
155
function onblr() { document.frmhome.s.value="Search"; } function onclos() { document.getElementById("SearchBox").style.display = 'none'; document.getElementById('myLink').href="http://www.eatout.in/sphider/search.php?keepThis=true&TB_iframe=true&height=500;&width=800"; } function appearSignIn() { if(document.getElementById("signinbox").style.display == 'none') { document.getElementById("signinbox").style.display = 'block'; } else { document.getElementById("signinbox").style.display = 'none'; document.getElementById('logdisp').style.display = 'inline'; document.getElementById('fordisp').style.display = 'none'; document.getElementById('signinfo').innerHTML= " "; document.frmhome.txtpass.value=""; document.frmhome.txtemail.value=""; } } function onSignin() { if(document.frmhome.txtpass.value=="" || document.frmhome.txtemail.value=="") { alert("Please enter your email and password"); } else { document.getElementById('signinfo').innerHTML= "<font id="+'"'+"fontcolor1"+'"'+"><b>Signing In...</b></font>"; document.frmhome.hdaction.value="signin"; createXmlHttpRequest(); xmlHttp.open("get","/eatout/MainServlet?hdaction=signin&txtemail="+document.frmhome.txtemail.value+"&txtpass="+document.frmhome.txtpass.value,true) xmlHttp.onreadystatechange=displayAlert; xmlHttp.send(null); } } function displayAlert() { var content=""; if (xmlHttp.readyState == 4) {
156
if (xmlHttp.status == 200) { content = xmlHttp.responseText; if(content!="") { document.getElementById('signdisp').innerHTML= "<a href="+'"'+"javascript:onSignout()"+'"'+">Sign Out</a>"; document.getElementById('signdisp2').innerHTML= " | <a href="+'"'+"/eatout/html/user.html?userid=profile"+'"'+"><b>My eatout</b></a>"; document.frmhome.hduserid.value=content; appearSignIn(); } else { document.getElementById('signinfo').innerHTML= "<font color="+'"'+"red"+'"'+">Authentication Failed. Please Try again.</font>"; } } } } function onSignout() { document.frmhome.hdaction.value="signout"; createXmlHttpRequest(); xmlHttp.open("get","/eatout/MainServlet?hdaction=signout",true) xmlHttp.onreadystatechange=rechange; xmlHttp.send(null); } function rechange() { var content=""; if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { content = xmlHttp.responseText; if(content!="") { document.getElementById('signdisp').innerHTML= "<a href="+'"'+"javascript:appearSignIn()"+'"'+">Sign In</a>"; document.getElementById('signdisp2').innerHTML= ""; document.frmhome.hduserid.value=""; } } } } function onFrgt() { document.getElementById('logdisp').style.display = 'none'; document.getElementById('fordisp').style.display = 'inline'; } function onForgotPwd()
157
{ if(document.frmhome.txtemail2.value=="") { alert("Please enter your email address"); } else { document.getElementById('signinfo2').innerHTML= "<font style="+'"'+"padding-left:65px;"+'"'+" id="+'"'+"fontcolor1"+'"'+"><b>Please wait...</b></font>"; document.frmhome.hdaction.value="forgotpwd"; createXmlHttpRequest(); xmlHttp.open("get","/eatout/MainServlet?hdaction=forgotpwd&email="+document.frmhome.txtemail2.value,true) xmlHttp.onreadystatechange=dispAlert; xmlHttp.send(null); } } function dispAlert() { var content=""; if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { content = xmlHttp.responseText; if(content!="") { document.getElementById('signinfo2').innerHTML= ""; alert("Password has been sent to your email"); document.frmhome.txtemail2.value=""; appearSignIn(); } else { document.getElementById('signinfo2').innerHTML= ""; document.frmhome.txtemail2.value=""; alert("Invalid email address. Please enter a valid email address"); } } } } function onReport(title,url,type) { document.frmhome.hdaction.value="Report"; createXmlHttpRequest(); xmlHttp.open("get","/eatout/MainServlet?hdaction=Report&Title="+title+"&Url="+url+"&Type="+type,true); xmlHttp.onreadystatechange=dispback; xmlHttp.send(null); } function dispback()
158
{ var content=""; if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { content = xmlHttp.responseText; alert(content); } } } function homeImgChange(arg1,arg2) { document.getElementById(arg1).src=arg2; }
APPENDIX B