<%@ 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); } %> TwiFlights <%@ 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 { %>
Specify Flight Details
Trip type: : One Way trip : Round trip
Leaving from: Going to:
City from: City to:
Departure Date: (YYYY-MM-DD)
Arrival Date: (YYYY-MM-DD)

Select Time:

Select Time:
Adult(s) (12+) :   Children (0-12) :   Infant(s) (1-2) :
Class of Travel :   Airline Preference (if any) :  
Email :   Phone Number :  
Email and Phone number will not be displayed
<% int uid=0; st = con.createStatement(); sql = "select count(*) countye 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"; rs = st.executeQuery(sql); while(rs.next()) { //out.println(rs.getString("countye")); } st = con.createStatement(); sql="select a.TweetId, a.UID, a.Country , a.City, a.CountryArr, a.CityArr, a.SynCountry, a.SynCity, a.CIDate, a.departureTime, a.CODate," + "a.arrivalTime, (a.Adults+a.Children+a.infants) total, a.Adults, a.Children, a.Infants,b.countryid, b.countryname, c.cityid, " + "c.cityname, d.user_id, d.twitter_id, d.user_name, d.profile_image, d.oauth_token, d.oauth_secret, d.source " + " 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); //out.println("tweet"+ rs.next()); String tweet = "", source = "", userName="", depDate="", arrDate="", total="", adults="",children="", infants="" ; ///..................PRINT the tweets.................../// while(rs.next()){ String countryArr_code="", cityArr_code="", co_name = "", ci_name = "",countryArr_name = "", cityArr_name = "", syn_co_name ="", syn_ci_name = "", arrTime="", depTime="",airclass=""; co_name = rs.getString("countryname"); ci_name = rs.getString("cityname"); uid=rs.getInt("UId"); userName = rs.getString("user_name"); countryArr_code = rs.getString("CountryArr"); cityArr_code = rs.getString("CityArr"); depDate = rs.getString("CIDate"); arrDate = rs.getString("CODate"); total = rs.getString("total"); adults = rs.getString("Adults"); children = rs.getString("Children"); infants = rs.getString("infants"); arrTime = rs.getString("arrivalTime"); depTime = rs.getString("departureTime"); //...........................Fetch Arrival country details...........................// st = con.createStatement(); sql = "select countryname from country where countryid='"+countryArr_code+"'"; rs1 = st.executeQuery(sql); if(rs1.next()){ countryArr_name = rs1.getString("countryname"); countryArr_name = countryArr_name.replaceAll(" ",""); } st = con.createStatement(); sql = "select cityname from city where cityid='"+cityArr_code+"'"; rs1 = st.executeQuery(sql); if(rs1.next()){ cityArr_name = rs1.getString("cityname"); cityArr_name = cityArr_name.replaceAll(" ",""); } //........End arrival countr details................................................// 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='"+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 @"+ userName +") I want a #flight from #" + ci_name+", #"+co_name+" to #" + cityArr_name+", #"+countryArr_name + ". on: " + depDate; if(depTime.equals("AnyTime")) { tweet= tweet + "("+ depTime +")"; } else { tweet= tweet + "("+ depTime +"hrs)"; } if(arrDate=="" || arrDate==null || arrDate.equals("")) { } else { tweet=tweet+" and a return flight on "+ arrDate; if(arrTime.equals("AnyTime")) { tweet=tweet+ "(" +arrTime +")"; } else { tweet=tweet+"(between "+ arrTime +"hrs)"; } } tweet=tweet+". Total passangers: "+total+" (Adults-"+adults+", Children-"+children+", Infants-"+infants+")"; //" 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(""); }///..................Finish printing the tweets.................../// %>
Recent Tweets
"+sql+"
"+tweet+" 
Public Timeline »  
<% } 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"); } %>