<%@ page import="java.util.*" %> <%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <% String oauth_Token = request.getParameter("oauth_token"); if(oauth_Token!=null && session.getAttribute("uid")==null){ response.sendRedirect("php/confirm.php?oauth_token="+oauth_Token); } %> TwiHotels <%@ include file="connectionDB.jsp" %>
<%@ include file="header.jsp" %> <% ResultSet rs = null,rs1 = null; Statement st = null,st1 = null; String sql = ""; String country_name = "", city_name = ""; try { %>
Hotel Specifications
Select Country :
Select City :
Hotel Category :
Check In Date :
Check Out Date :
Room(s) :
Adult(s) (12+) :
Children (0-12) :
Twihotels on Twitter  |  Hotel Directory  |  Followers
<% st = con.createStatement(); sql = "select * from tweets a, country b, city c, login d" + " where a.Country=b.countryid and a.City=c.cityid and a.UId = d.user_id order by a.TweetId desc limit 0,3"; //out.println(""); rs = st.executeQuery(sql); String tweet = "", source = ""; while(rs.next()){ String co_name = "", ci_name = "", syn_co_name ="", syn_ci_name = ""; co_name = rs.getString("countryname"); ci_name = rs.getString("cityname"); if(!co_name.equals("")) co_name = co_name.replaceAll(" ",""); if(!ci_name.equals("")) ci_name = ci_name.replaceAll(" ",""); st1 = con.createStatement(); sql = "select Synonym from synonym where SynId='"+rs.getInt("SynCountry")+"'"; rs1 = st1.executeQuery(sql); if(rs1.next()){ syn_co_name = rs1.getString("Synonym"); syn_co_name = syn_co_name.replaceAll(" ",""); } st1 = con.createStatement(); sql = "select Synonym from synonym where SynId='"+rs.getInt("SynCity")+"'"; rs1 = st1.executeQuery(sql); if(rs1.next()){ syn_ci_name = rs1.getString("Synonym"); syn_ci_name = syn_ci_name.replaceAll(" ",""); } if(!syn_co_name.equals("")){ co_name = syn_co_name+" (#"+co_name+")"; } if(!syn_ci_name.equals("")){ ci_name = syn_ci_name+" (#"+ci_name+")"; } st1 = con.createStatement(); sql = "select source from login where user_id='"+rs.getInt("UId")+"'"; rs1 = st1.executeQuery(sql); if(rs1.next()){ source = rs1.getString("source"); } if(source.equals("mobile")){ source = "images/mobile.png"; } else { source = "images/laptop.png"; } tweet = "(via @"+rs.getString("user_name")+")" + " I am looking for a "+rs.getString("HotelCat")+" " + " #hotel at #"+ci_name+"," + " #"+co_name+"" + " from "+rs.getString("CIDate")+" to "+rs.getString("CODate")+". Rooms required: "+rs.getInt("Rooms")+", " + "Total people: "+(rs.getInt("Adults")+rs.getInt("Children"))+" (Adults-"+rs.getInt("Adults")+", Children-"+rs.getInt("Children")+")."; out.println(""); } %>
Recent Tweets
"+sql+"
"+tweet+" 
Public Timeline »
Recently Added Hotels
<% st = con.createStatement(); sql = "select * from hoteldir a, country b, city c where a.CountryId = b.countryid and" + " a.CityId = c.cityid order by HotelId desc limit 0, 3"; //out.println(""); rs = st.executeQuery(sql); String hotelDetail = "", desc = ""; out.println(""); while(rs.next()){ desc = rs.getString("Description"); if(desc.length() > 100){ desc = desc.substring(0, 100)+" ..."; } hotelDetail = ""+rs.getString("HotelName")+"" + "
"+desc; out.println(""); } out.println(""); %>
"+sql+"
"+hotelDetail+"
More »
<% sql = "select * from hotelfollowers"; st = con.createStatement(); rs = st.executeQuery(sql); int total = 0; while(rs.next()){ total++; } int pages = total/15; //out.print("Pages "+pages); if(total%15 != 0) pages++; //out.print("Pages "+pages); %>
Hotels following us Total <%=total%>
<% } catch(Exception ex){ System.out.println("Exception in index "+ex.getMessage()); } finally { if(rs!=null) rs.close(); if(con!=null) con.close(); } %> <%@ include file="footer.jsp" %> <% if(session.getAttribute("message")!=null) { %> <% session.removeAttribute("message"); } %>