PageRenderTime 25ms CodeModel.GetById 31ms RepoModel.GetById 1ms app.codeStats 0ms

/neticketing/index.php

https://bitbucket.org/mac_pasha/neticketing
PHP | 292 lines | 273 code | 18 blank | 1 comment | 27 complexity | 9b45270068ed823a3eab5017db876ab7 MD5 | raw file
  1. <?php require_once('Connections/neticketing.php'); ?>
  2. <?php
  3. if (!isset($_SESSION)) {
  4. session_start();
  5. }
  6. if (!function_exists("GetSQLValueString")) {
  7. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  8. {
  9. if (PHP_VERSION < 6) {
  10. $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  11. }
  12. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  13. switch ($theType) {
  14. case "text":
  15. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  16. break;
  17. case "long":
  18. case "int":
  19. $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  20. break;
  21. case "double":
  22. $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  23. break;
  24. case "date":
  25. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  26. break;
  27. case "defined":
  28. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  29. break;
  30. }
  31. return $theValue;
  32. }
  33. }
  34. mysql_select_db($database_neticketing, $neticketing);
  35. $query_routelist = "SELECT distinct source FROM launch_info";
  36. $routelist = mysql_query($query_routelist, $neticketing) or die(mysql_error());
  37. $row_routelist = mysql_fetch_assoc($routelist);
  38. $totalRows_routelist = mysql_num_rows($routelist);
  39. ?>
  40. <!-------------------Banner START---------------------->
  41. <?php include('include/banner.php');?>
  42. <!-------------------Banner END---------------------->
  43. <script>
  44. function get_stn_to(str)
  45. {
  46. if (str=="")
  47. {
  48. document.getElementById("stn_to_list").innerHTML="";
  49. return;
  50. }
  51. if (window.XMLHttpRequest)
  52. {// code for IE7+, Firefox, Chrome, Opera, Safari
  53. xmlhttp=new XMLHttpRequest();
  54. }
  55. else
  56. {// code for IE6, IE5
  57. xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  58. }
  59. xmlhttp.onreadystatechange=function()
  60. {
  61. if (xmlhttp.readyState==4 && xmlhttp.status==200)
  62. {
  63. document.getElementById("stn_to_list").innerHTML=xmlhttp.responseText;
  64. }
  65. }
  66. xmlhttp.open("GET","routelist/getStationTo1_index.php?q="+str,true);
  67. xmlhttp.send();
  68. }
  69. function get_launch()
  70. {
  71. if (window.XMLHttpRequest)
  72. {// code for IE7+, Firefox, Chrome, Opera, Safari
  73. xmlhttp=new XMLHttpRequest();
  74. }
  75. else
  76. {// code for IE6, IE5
  77. xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  78. }
  79. xmlhttp.onreadystatechange=function()
  80. {
  81. if (xmlhttp.readyState==4 && xmlhttp.status==200)
  82. {
  83. document.getElementById("train_list").innerHTML=xmlhttp.responseText;
  84. }
  85. }
  86. xmlhttp.open("GET","routelist/getStationTo_index.php?date="+document.getElementById("journey_date").value+
  87. "&source="+document.getElementById("station_from").value+
  88. "&destination="+document.getElementById("sta_destination").value,true);
  89. xmlhttp.send();
  90. }
  91. //Receiving Information for Seat Catagory
  92. function get_class()
  93. {
  94. if (window.XMLHttpRequest)
  95. {// code for IE7+, Firefox, Chrome, Opera, Safari
  96. xmlhttp=new XMLHttpRequest();
  97. }
  98. else
  99. {// code for IE6, IE5
  100. xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  101. }
  102. xmlhttp.onreadystatechange=function()
  103. {
  104. if (xmlhttp.readyState==4 && xmlhttp.status==200)
  105. {
  106. document.getElementById("class_list").innerHTML=xmlhttp.responseText;
  107. }
  108. }
  109. xmlhttp.open("GET","routelist/getClass.php?launch_name="+document.getElementById("la_name").value,true);
  110. xmlhttp.send();
  111. }
  112. function get_result()
  113. {
  114. if (window.XMLHttpRequest)
  115. {// code for IE7+, Firefox, Chrome, Opera, Safari
  116. xmlhttp=new XMLHttpRequest();
  117. }
  118. else
  119. {// code for IE6, IE5
  120. xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  121. }
  122. xmlhttp.onreadystatechange=function()
  123. {
  124. if (xmlhttp.readyState==4 && xmlhttp.status==200)
  125. {
  126. document.getElementById("fare_info").innerHTML=xmlhttp.responseText;
  127. }
  128. }
  129. xmlhttp.open("GET","routelist/result.php?date="+document.getElementById("journey_date").value+
  130. "&source="+document.getElementById("station_from").value+
  131. "&destination="+document.getElementById("sta_destination").value+
  132. "&launch_name="+document.getElementById("la_name").value+
  133. "&seat_catagory="+document.getElementById("class_name").value+
  134. "&cabin="+document.getElementById("no_amount").value,true);
  135. xmlhttp.send();
  136. }
  137. </script>
  138. </head>
  139. <body>
  140. <!-------------------HEADER START---------------------->
  141. <?php include('include/header.php');?>
  142. <!-------------------HEADER END---------------------->
  143. <!--BODY START-->
  144. <div id="signup_body" class="account_body" style="padding-top: 0px;">
  145. <div id="tabs">
  146. <!--main menu-->
  147. <?php include('include/navigation.php');?>
  148. <!--main menu-->
  149. <div id="fare_query">
  150. <div style="height: 360px;">
  151. <div id="fare_querydiv">
  152. <form id='form_fare_query' accept-charset='UTF-8'>
  153. <fieldset class="signup_fieldset">
  154. <legend id="legend">&nbsp;FARE QUERY &nbsp;</legend>
  155. <table width="100%" id="">
  156. <tr>
  157. <td colspan="2" id="label"><label for='journey_date'>Journey Date :</label></td>
  158. <td>
  159. <div id="select">
  160. <select class="input_train_info" name="journey_date" id="journey_date">
  161. <option value="0">===SELECT JOURNEY DATE===</option>
  162. <?php for($i=1;$i<=7;$i++){
  163. $bookingTime = mktime(0,0,0,date("m"),date("d")+$i,date("Y"));
  164. ?>
  165. <option value="<?php echo date("d", $bookingTime);?>">
  166. <?php echo date("d-m-Y", $bookingTime);?>
  167. </option>
  168. <?php }?>
  169. </select>
  170. </div>
  171. </td>
  172. </tr>
  173. <tr>
  174. <td colspan="2" id="label"><label for='station_from'>Station From :</label></td>
  175. <td>
  176. <div id="select">
  177. <select name="station_from" id="station_from" class="input_train_info"
  178. tabindex="2" required="required" onchange="get_stn_to(this.value)">
  179. <option value="0" label="===SELECT STATION==="> ===SELECT STATION===</option>
  180. <?php
  181. do { ?>
  182. <option value="<?php echo $row_routelist['source']?>"<?php if (!(strcmp($row_routelist['source'], $row_routelist['source'])))?>>
  183. <?php echo $row_routelist['source']?>
  184. </option>
  185. <?php } while ($row_routelist = mysql_fetch_assoc($routelist));
  186. $rows = mysql_num_rows($routelist);
  187. if($rows > 0) {
  188. mysql_data_seek($routelist, 0);
  189. $row_routelist = mysql_fetch_assoc($routelist);
  190. }
  191. ?>
  192. </select>
  193. </div></td>
  194. </tr>
  195. <tr>
  196. <td colspan="2" id="label"><label for='station_to'>Station To:</label></td>
  197. <td>
  198. <div id="select">
  199. <font id="stn_to_list">
  200. <select id="input_train_info" name="stn_to_list">
  201. <option value="0">===NONE===</option>
  202. </select>
  203. </font>
  204. </div>
  205. </td>
  206. </tr>
  207. <tr>
  208. <td colspan="2" id="label"><label for='train_name'>Launch Name:</label></td>
  209. <td>
  210. <div id="select">
  211. <font id="train_list">
  212. <select class="input_train_info" name="train_list">
  213. <option value="0">===NONE===</option>
  214. </select>
  215. </font>
  216. </div>
  217. </td>
  218. </tr>
  219. <tr>
  220. <td colspan="2" id="label"><label for='class'>Travel Class:</label></td>
  221. <td>
  222. <div id="select">
  223. <font id="class_list">
  224. <select id="no_cabin" class="input_train_info" name="class_list">
  225. <option value="0">===NONE===</option>
  226. </select>
  227. </font>
  228. </div>
  229. </td>
  230. </tr>
  231. <!-- Showing Number of cabin -->
  232. <tr>
  233. <td colspan="2" id="label"><label for='class'>Amount:</label></td>
  234. <td>
  235. <div id="select">
  236. <font id="amount_list">
  237. <select id="no_amount" class="input_train_info" name="amount_list">
  238. <option value="0">===NONE===</option>
  239. <option value="1">1</option>
  240. <option value="2">2</option>
  241. <option value="3">3</option>
  242. </select>
  243. </font>
  244. </div>
  245. </td>
  246. </tr>
  247. </table>
  248. <div align="center">
  249. <!--<input type="submit" name="show_fare" value="Show Fare" id="button1" tabindex="4" />-->
  250. <input type="button" name="show_fare" value="Show Fare"
  251. id="button1" tabindex="4" onclick="get_result()" />
  252. </div>
  253. </fieldset>
  254. </form>
  255. </div>
  256. <div id="fare_query_result">
  257. <fieldset class="signup_fieldset">
  258. <legend id="legend">FARE QUERY RESULT</legend>
  259. <div id="fare_info">
  260. Give All Information About Your Journey
  261. </div>
  262. </fieldset>
  263. </div>
  264. </div>
  265. </div>
  266. <!-- DIV end for Fare Query -->
  267. </div>
  268. </div>
  269. <!-------------------BODY End---------------------->
  270. <!-------------------FOOTER START---------------------->
  271. <?php include('include/footer.php');?>
  272. <!-------------------FOOTER END---------------------->
  273. </body>
  274. </html>