/functions.php

https://bitbucket.org/kenzone/hairloss · PHP · 522 lines · 353 code · 169 blank · 0 comment · 17 complexity · ce14b12a57281f1326c388c2e7b42d8f MD5 · raw file

  1. <?php
  2. function select_all_doctor()
  3. {
  4. include "config/config.php";
  5. $sql = "SELECT * FROM doctor";
  6. $result = mysql_query($sql);
  7. $count =1;
  8. while($row = mysql_fetch_array($result))
  9. {
  10. echo "<tr>";
  11. echo "<td>" . $count . "</td>";
  12. echo "<td>";
  13. echo $row['strClinicName'];
  14. echo "</td>";
  15. echo "<td>";
  16. echo $row['strAddress1'];
  17. echo "</td>";
  18. echo "<td>";
  19. echo $row['strAddress2'];
  20. echo "</td>";
  21. echo "<td>";
  22. echo $row['strTownName'];
  23. echo "</td>";
  24. echo "<td>";
  25. echo $row['strStateName'];
  26. echo "</td>";
  27. echo "<td>";
  28. echo $row['strPostcode'];
  29. echo "</td>";
  30. echo "<td>";
  31. echo $row['strPhone'];
  32. echo "</td>";
  33. echo "</tr>";
  34. $count = $count + 1;
  35. if($count == 2)
  36. {
  37. }
  38. }
  39. include "config/con_close.php";
  40. }
  41. function search_doctor_by_state_and_town_admin($newVariablestate,$newVariabletown)
  42. {
  43. include "config/config.php";
  44. $sql = "SELECT * FROM doctor where strStateName= '". $newVariablestate ."' and strTownName= '". $newVariabletown ."'";
  45. $result = mysql_query($sql);
  46. $count =1;
  47. while($row = mysql_fetch_array($result))
  48. {
  49. echo "<tr>";
  50. echo "<td>" . $count . "</td>";
  51. echo "<script type='text/javascript'>","function popup2(){newwindow=window.open('updatedoctor.php?docid=" . $row['ID']."','name','height=400,width=500,left=400,top=200'); newwindow.focus();};","</script>";
  52. echo "<td>";
  53. echo "<a href='javascript:popup2();' >". $row['strClinicName'] ."</a>";
  54. echo "</td>";
  55. echo "<td>";
  56. echo $row['strAddress1'];
  57. echo "</td>";
  58. echo "<td>";
  59. echo $row['strAddress2'];
  60. echo "</td>";
  61. echo "<td>";
  62. echo $row['strTownName'];
  63. echo "</td>";
  64. echo "<td>";
  65. echo $row['strStateName'];
  66. echo "</td>";
  67. echo "<td>";
  68. echo $row['strPostcode'];
  69. echo "</td>";
  70. echo "<td>";
  71. echo $row['strPhone'];
  72. echo "</td>";
  73. echo "<script type='text/javascript'>","function popup(){newwindow=window.open('deletedoctor.php?docid=" . $row['ID']."','name','height=200,width=300,left=450,top=250'); newwindow.focus();};","</script>";
  74. echo "<td>";
  75. echo "<input type='button' value='Delete' onclick='popup()' />";
  76. echo "</td>";
  77. echo "</tr>";
  78. $count = $count + 1;
  79. if($count == 2)
  80. {
  81. }
  82. }
  83. include "config/con_close.php";
  84. }
  85. function search_doctor_by_state_and_town($newVariablestate,$newVariabletown)
  86. {
  87. include "config/config.php";
  88. $sql = "SELECT * FROM doctor where strStateName= '". $newVariablestate ."' and strTownName= '". $newVariabletown ."'";
  89. $result = mysql_query($sql);
  90. $count =1;
  91. while($row = mysql_fetch_array($result))
  92. {
  93. echo "<tr>";
  94. echo "<td>" . $count . "</td>";
  95. echo "<td>";
  96. echo $row['strClinicName'];
  97. echo "</td>";
  98. echo "<td>";
  99. echo $row['strAddress1'];
  100. echo "</td>";
  101. echo "<td>";
  102. echo $row['strAddress2'];
  103. echo "</td>";
  104. echo "<td>";
  105. echo $row['strTownName'];
  106. echo "</td>";
  107. echo "<td>";
  108. echo $row['strStateName'];
  109. echo "</td>";
  110. echo "<td>";
  111. echo $row['strPostcode'];
  112. echo "</td>";
  113. echo "<td>";
  114. echo $row['strPhone'];
  115. echo "</td>";
  116. echo "</tr>";
  117. $count = $count + 1;
  118. if($count == 2)
  119. {
  120. }
  121. }
  122. include "config/con_close.php";
  123. }
  124. function search_doctor_postcode_admin($postcode)
  125. {
  126. include "config/config.php";
  127. $sql = "SELECT * FROM doctor where strPostcode= '". $postcode ."'";
  128. $result = mysql_query($sql);
  129. $count =1;
  130. while($row = mysql_fetch_array($result))
  131. {
  132. echo "<tr>";
  133. echo "<td>" . $count . "</td>";
  134. echo "<script type='text/javascript'>","function popup2(){newwindow=window.open('updatedoctor.php?docid=" . $row['ID']."','name','height=400,width=500,left=400,top=200'); newwindow.focus();};","</script>";
  135. echo "<td>";
  136. echo "<a href='javascript:popup2();' >". $row['strClinicName'] ."</a>";
  137. echo "</td>";
  138. echo "<td>";
  139. echo $row['strAddress1'];
  140. echo "</td>";
  141. echo "<td>";
  142. echo $row['strAddress2'];
  143. echo "</td>";
  144. echo "<td>";
  145. echo $row['strTownName'];
  146. echo "</td>";
  147. echo "<td>";
  148. echo $row['strStateName'];
  149. echo "</td>";
  150. echo "<td>";
  151. echo $row['strPostcode'];
  152. echo "</td>";
  153. echo "<td>";
  154. echo $row['strPhone'];
  155. echo "</td>";
  156. echo "<script type='text/javascript'>","function popup(){newwindow=window.open('deletedoctor.php?docid=" . $row['ID']."','name','height=200,width=300,left=450,top=250'); newwindow.focus();};","</script>";
  157. echo "<td>";
  158. echo "<input type='button' value='Delete' onclick='popup()' />";
  159. echo "</td>";
  160. echo "</tr>";
  161. $count = $count + 1;
  162. if($count == 2)
  163. {
  164. }
  165. }
  166. include "config/con_close.php";
  167. }
  168. function search_doctor_postcode($postcode)
  169. {
  170. include "config/config.php";
  171. $sql = "SELECT * FROM doctor where strPostcode= '". $postcode ."'";
  172. $result = mysql_query($sql);
  173. $count =1;
  174. while($row = mysql_fetch_array($result))
  175. {
  176. echo "<tr>";
  177. echo "<td>" . $count . "</td>";
  178. echo "<td>";
  179. echo $row['strClinicName'];
  180. echo "</td>";
  181. echo "<td>";
  182. echo $row['strAddress1'];
  183. echo "</td>";
  184. echo "<td>";
  185. echo $row['strAddress2'];
  186. echo "</td>";
  187. echo "<td>";
  188. echo $row['strTownName'];
  189. echo "</td>";
  190. echo "<td>";
  191. echo $row['strStateName'];
  192. echo "</td>";
  193. echo "<td>";
  194. echo $row['strPostcode'];
  195. echo "</td>";
  196. echo "<td>";
  197. echo $row['strPhone'];
  198. echo "</td>";
  199. echo "</tr>";
  200. $count = $count + 1;
  201. if($count == 2)
  202. {
  203. }
  204. }
  205. include "config/con_close.php";
  206. }
  207. function insert_survey($surveytype,$date)
  208. {
  209. include "config/config.php";
  210. mysql_query("INSERT INTO survey (Type, CreateDate) VALUES ('" . $surveytype . "', '" . $date . "')");
  211. include "config/con_close.php";
  212. return;
  213. }
  214. function insert_registration($date,$cert,$cert1,$reg,$reg1,$clinic,$doctor,$address,$address2,$town,$postcode,$email,$telephone,$fax,$cert2,$reg2)
  215. {
  216. include "config/config.php";
  217. mysql_query("INSERT INTO registration (RegCreateDate,CertNo,CertNo1,RegNo,RegNo1,ClinicName,Doctor,Address1,Address2,Town,PostCode,Email,Tel,Fax,CertNo2,RegNo2) VALUES ('" . $date . "', '" . $cert . "','" . $cert1 . "','" . $reg . "','" . $reg1 . "','" . $clinic . "','" . $doctor . "','" . $address . "','" . $address2 . "','" . $town . "','" . $postcode . "','" . $email . "','" . $telephone . "','" . $fax . "','" . $cert2 . "','" . $reg2 . "')");
  218. include "config/con_close.php";
  219. return;
  220. }
  221. function login($username,$password)
  222. {
  223. include "config/config.php";
  224. $result = mysql_query("SELECT Username,Password FROM admin WHERE Username = '" . $username . "' AND Password = '" . $password . "'");
  225. if (mysql_num_rows($result) == 0 || mysql_num_rows($result) > 1)
  226. {
  227. $_SESSION['login'] = "";
  228. echo "<script>";
  229. echo "alert('Invalid username or password')";
  230. echo "</script>";
  231. }
  232. else
  233. {
  234. $_SESSION['login'] = "1";
  235. echo "<script>";
  236. echo "window.location='search.php';";
  237. echo "</script>";
  238. }
  239. include "config/con_close.php";
  240. return;
  241. }
  242. function delete_doctor($doctorID)
  243. {
  244. include "config/config.php";
  245. mysql_query("DELETE FROM doctor WHERE ID= '" . $doctorID . "'");
  246. include "config/con_close.php";
  247. return;
  248. }
  249. function update_doctor_table($clinicname,$address_1,$address_2,$town,$state,$postcode,$phone,$DocID)
  250. {
  251. include "config/config.php";
  252. mysql_query("UPDATE doctor Set strClinicName = '" . $clinicname . "', strAddress1 = '" . $address_1 . "',strAddress2 = '" . $address_2 . "',strTownName = '" . $town . "',strStateName = '" . $state . "',strPostcode = '" . $postcode . "',strPhone = '" . $phone . "' Where ID = '" . $DocID . "'");
  253. include "config/con_close.php";
  254. return;
  255. }
  256. function insert_doctor($clinicname,$address_1,$address_2,$town,$state,$postcode,$phone)
  257. {
  258. include "config/config.php";
  259. mysql_query("INSERT INTO doctor (strClinicName, strAddress1, strAddress2,strTownName,strStateName,strPostcode,strPhone) VALUES ('" . $clinicname . "', '" . $address_1 . "', '" . $address_2 . "', '" . $town . "', '" . $state . "', '" . $postcode . "', '" . $phone . "')");
  260. include "config/con_close.php";
  261. return;
  262. }
  263. function search_all_survey()
  264. {
  265. include "config/config.php";
  266. $sql = "SELECT * FROM survey";
  267. $result = mysql_query($sql);
  268. $count =1;
  269. while($row = mysql_fetch_array($result))
  270. {
  271. echo "<tr>";
  272. echo "<td>" . $count . "</td>";
  273. echo "<td>";
  274. echo $row['Type'];
  275. echo "</td>";
  276. echo "<td>";
  277. echo $row['CreateDate'];
  278. echo "</td>";
  279. echo "</tr>";
  280. $count = $count + 1;
  281. if($count == 2)
  282. {
  283. }
  284. }
  285. include "config/con_close.php";
  286. }
  287. function search_all_registration()
  288. {
  289. include "config/config.php";
  290. $sql = "SELECT * FROM registration";
  291. $result = mysql_query($sql);
  292. $count =1;
  293. while($row = mysql_fetch_array($result))
  294. {
  295. echo "<tr>";
  296. echo "<td>" . $count . "</td>";
  297. echo "<td>";
  298. echo $row['RegCreateDate'];
  299. echo "</td>";
  300. echo "<td>";
  301. echo $row['CertNo'];
  302. echo "</td>";
  303. echo "<td>";
  304. echo $row['CertNo1'];
  305. echo "</td>";
  306. echo "<td>";
  307. echo $row['CertNo2'];
  308. echo "</td>";
  309. echo "<td>";
  310. echo $row['RegNo'];
  311. echo "</td>";
  312. echo "<td>";
  313. echo $row['RegNo1'];
  314. echo "</td>";
  315. echo "<td>";
  316. echo $row['RegNo2'];
  317. echo "</td>";
  318. echo "<td>";
  319. echo $row['ClinicName'];
  320. echo "</td>";
  321. echo "<td>";
  322. echo $row['Doctor'];
  323. echo "</td>";
  324. echo "<td>";
  325. echo $row['Address1'];
  326. echo "</td>";
  327. echo "<td>";
  328. echo $row['Address2'];
  329. echo "</td>";
  330. echo "<td>";
  331. echo $row['Town'];
  332. echo "</td>";
  333. echo "<td>";
  334. echo $row['PostCode'];
  335. echo "</td>";
  336. echo "<td>";
  337. echo $row['Email'];
  338. echo "</td>";
  339. echo "<td>";
  340. echo $row['Tel'];
  341. echo "</td>";
  342. echo "<td>";
  343. echo $row['Fax'];
  344. echo "</td>";
  345. echo "</tr>";
  346. $count = $count + 1;
  347. if($count == 2)
  348. {
  349. }
  350. }
  351. include "config/con_close.php";
  352. }
  353. ?>