Advertisement
Guest User

Untitled

a guest
Aug 9th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.47 KB | None | 0 0
  1. <?php
  2.  
  3. $sv_name = "";
  4. $username = "";
  5. $password = "";
  6. $db_name = "";
  7. $con = mysql_connect($sv_name, $username, $password) or die(mysql_error());
  8. mysql_select_db($db_name, $con) or die(mysql_error());
  9.  
  10.  
  11. $showsub1 = 1;
  12. $showsub2 = 1;
  13. $showsub3 = 1;
  14. $showsub4 = 1;
  15.  
  16. $foundsub1 = 0;
  17. $foundsub2 = 0;
  18. $foundsub3 = 0;
  19. $foundsub4 = 0;
  20.  
  21.  
  22. $pages_table_name = "uni_combinations";
  23. $query_subjects = "SELECT * FROM " . $pages_table_name;
  24. $result_subjects = mysql_query($query_subjects, $con) or die(mysql_error());
  25.  
  26.  
  27. while($row_subjects = mysql_fetch_array($result_subjects))
  28. {
  29. if($_GET['typeid'] == $row_subjects['typeid'])
  30. {
  31. //echo "<br/>combinationid: " . $row_subjects['id'];
  32.  
  33. if (
  34. $_GET['subid1'] == $row_subjects['subid1'] ||
  35. $_GET['subid1'] == $row_subjects['subid2'] ||
  36. $_GET['subid1'] == $row_subjects['subid3'] ||
  37. $_GET['subid1'] == $row_subjects['subid4']
  38. )
  39. {
  40. $foundsub1 = 1;
  41. }
  42. if (
  43. ($_GET['subid1'] == $row_subjects['subid1'] ||
  44. $_GET['subid1'] == $row_subjects['subid2'] ||
  45. $_GET['subid1'] == $row_subjects['subid3'] ||
  46. $_GET['subid1'] == $row_subjects['subid4'])
  47. &&
  48. ($_GET['subid2'] == $row_subjects['subid1'] ||
  49. $_GET['subid2'] == $row_subjects['subid2'] ||
  50. $_GET['subid2'] == $row_subjects['subid3'] ||
  51. $_GET['subid2'] == $row_subjects['subid4'])
  52. )
  53. {
  54. $foundsub2 = 1;
  55. }
  56. if (
  57. ($_GET['subid1'] == $row_subjects['subid1'] ||
  58. $_GET['subid1'] == $row_subjects['subid2'] ||
  59. $_GET['subid1'] == $row_subjects['subid3'] ||
  60. $_GET['subid1'] == $row_subjects['subid4'])
  61. &&
  62. ($_GET['subid2'] == $row_subjects['subid1'] ||
  63. $_GET['subid2'] == $row_subjects['subid2'] ||
  64. $_GET['subid2'] == $row_subjects['subid3'] ||
  65. $_GET['subid2'] == $row_subjects['subid4'])
  66. &&
  67. ($_GET['subid3'] == $row_subjects['subid1'] ||
  68. $_GET['subid3'] == $row_subjects['subid2'] ||
  69. $_GET['subid3'] == $row_subjects['subid3'] ||
  70. $_GET['subid3'] == $row_subjects['subid4'])
  71. )
  72. {
  73. $foundsub3 = 1;
  74. }
  75. if (
  76. ($_GET['subid1'] == $row_subjects['subid1'] ||
  77. $_GET['subid1'] == $row_subjects['subid2'] ||
  78. $_GET['subid1'] == $row_subjects['subid3'] ||
  79. $_GET['subid1'] == $row_subjects['subid4'])
  80. &&
  81. ($_GET['subid2'] == $row_subjects['subid1'] ||
  82. $_GET['subid2'] == $row_subjects['subid2'] ||
  83. $_GET['subid2'] == $row_subjects['subid3'] ||
  84. $_GET['subid2'] == $row_subjects['subid4'])
  85. &&
  86. ($_GET['subid3'] == $row_subjects['subid1'] ||
  87. $_GET['subid3'] == $row_subjects['subid2'] ||
  88. $_GET['subid3'] == $row_subjects['subid3'] ||
  89. $_GET['subid3'] == $row_subjects['subid4'])
  90. &&
  91. ($_GET['subid4'] == $row_subjects['subid1'] ||
  92. $_GET['subid4'] == $row_subjects['subid2'] ||
  93. $_GET['subid4'] == $row_subjects['subid3'] ||
  94. $_GET['subid4'] == $row_subjects['subid4'])
  95. )
  96. {
  97. $foundsub4 = 1;
  98. }
  99.  
  100. if (
  101. ($_GET['subid1'] == $row_subjects['subid1'] ||
  102. $_GET['subid1'] == $row_subjects['subid2'] ||
  103. $_GET['subid1'] == $row_subjects['subid3'] ||
  104. $_GET['subid1'] == $row_subjects['subid4'])
  105. &&
  106. ($_GET['subid2'] == $row_subjects['subid1'] ||
  107. $_GET['subid2'] == $row_subjects['subid2'] ||
  108. $_GET['subid2'] == $row_subjects['subid3'] ||
  109. $_GET['subid2'] == $row_subjects['subid4'])
  110. &&
  111. ($_GET['subid3'] == $row_subjects['subid1'] ||
  112. $_GET['subid3'] == $row_subjects['subid2'] ||
  113. $_GET['subid3'] == $row_subjects['subid3'] ||
  114. $_GET['subid3'] == $row_subjects['subid4'])
  115. &&
  116. ($_GET['subid4'] == $row_subjects['subid1'] ||
  117. $_GET['subid4'] == $row_subjects['subid2'] ||
  118. $_GET['subid4'] == $row_subjects['subid3'] ||
  119. $_GET['subid4'] == $row_subjects['subid4'])
  120. )
  121. {
  122. $combinationid = $row_subjects['id'];
  123. }
  124. }
  125. }
  126.  
  127. $pages_table_name = "uni_combinations";
  128. $query_subjects = "SELECT * FROM " . $pages_table_name . " WHERE id='" . $combinationid . "'";
  129. $result_subjects = mysql_query($query_subjects, $con) or die(mysql_error());
  130. while($row_subjects = mysql_fetch_array($result_subjects))
  131. {
  132. $type = $row_subjects['typeid'];
  133. $sub1 = $row_subjects['subid1'];
  134. $sub2 = $row_subjects['subid2'];
  135. $sub3 = $row_subjects['subid3'];
  136. $sub4 = $row_subjects['subid4'];
  137. }
  138. $pages_table_name = "uni_subjects";
  139.  
  140.  
  141. $query_subjects = "SELECT * FROM " . $pages_table_name;
  142.  
  143. $result_subjects = mysql_query($query_subjects, $con) or die(mysql_error());
  144. while($row_subjects = mysql_fetch_array($result_subjects))
  145. { //disable all subjects which are not $sub1, $sub2, $sub3 or $sub4
  146. if(
  147. $row_subjects['id'] != $sub1 &&
  148. $row_subjects['id'] != $sub2 &&
  149. $row_subjects['id'] != $sub3 &&
  150. $row_subjects['id'] != $sub4
  151. )
  152. {
  153. //echo "<input type=\"hidden\" name=\"disable" . $x . "\" value=\"1\"/>";
  154. }
  155. else
  156. {
  157. //echo "<input type=\"hidden\" name=\"disable" . $x . "\" value=\"0\"/>";
  158. }
  159. }
  160.  
  161.  
  162. //if ($foundsub1 == 1)
  163. //{
  164. $showsub1 = 1;
  165. //}
  166. //if ($foundsub2 == 1)
  167. //{
  168. $showsub2 = 1;
  169. //}
  170. //if ($foundsub3 == 1)
  171. //{
  172. $showsub3 = 1;
  173. //}
  174. //if ($foundsub4 == 1)
  175. //{
  176. $showsub4 = 1;
  177. //}
  178.  
  179. /*if ($foundsub1 == 0)
  180. {
  181. $showsub1 = 0;
  182. }
  183. if ($foundsub2 == 0)
  184. {
  185. $showsub2 = 0;
  186. }
  187. if ($foundsub3 == 0)
  188. {
  189. $showsub3 = 0;
  190. }
  191. if ($foundsub4 == 0)
  192. {
  193. $showsub4 = 0;
  194. }*/
  195.  
  196. $typeid = $_GET['typeid'];
  197. $subid1 = $_GET['subid1'];
  198. $subid2 = $_GET['subid2'];
  199. $subid3 = $_GET['subid3'];
  200. $subid4 = $_GET['subid4'];
  201.  
  202. if ($typeid == 1 || $typeid == 3)
  203. {
  204. $subs = 3;
  205. }
  206. if ($typeid == 2)
  207. {
  208. $subs = 2;
  209. }
  210. if ($typeid == 4)
  211. {
  212. $subs = 4;
  213. }
  214.  
  215.  
  216.  
  217.  
  218. echo "<table><tr><th>";
  219. if ($_GET['subid1'] != 0)
  220. {
  221. echo "<a onmouseover=\"this.style.cursor='pointer';\" onclick=\"if(document.getElementById('modules1').style.display=='none'){document.getElementById('modules1').style.display='';} else{document.getElementById('modules1').style.display='none'}\">Show Modules</a>";
  222. }
  223. echo "<span id=\"modules1\" style=\"display:none;\">";
  224. $pages_table_name = "uni_subjects";
  225. $query_combinations1 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($_GET['subid1']) . "'";
  226. $result_combinations1 = mysql_query($query_combinations1, $con) or die(mysql_error());
  227. while($row_combinations1 = mysql_fetch_array($result_combinations1))
  228. {
  229. if ($_GET['typeid'] == 1)
  230. {
  231. $ex = explode(',', $row_combinations1['modules1']);
  232. }
  233. if ($_GET['typeid'] == 2)
  234. {
  235. $ex = explode(',', $row_combinations1['modules2']);
  236. }
  237. if ($_GET['typeid'] == 3)
  238. {
  239. $ex = explode(',', $row_combinations1['modules3']);
  240. }
  241. if ($_GET['typeid'] == 4)
  242. {
  243. $ex = explode(',', $row_combinations1['modules4']);
  244. }
  245. $pages_table_name = "uni_modules";
  246. for($i=0; $i<count($ex); $i++)
  247. {
  248. $query_combinations1 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string(trim($ex[$i])) . "'";
  249. $result_modules1 = mysql_query($query_combinations1, $con) or die(mysql_error());
  250. while($row_modules1 = mysql_fetch_array($result_modules1))
  251. {
  252. if ($showsub1 == 1)
  253. {
  254. echo "<br/><a target=\"_blank\" href=\"" . $row_modules1['summaryid'] . "\">" . urlencode($row_modules1['name']) . "</a>";
  255. }
  256. }
  257. }
  258. }
  259. if ($_GET['subid1'] != 0)
  260. {
  261. echo "</span>";
  262. }
  263.  
  264. echo "</th><th>";
  265. echo "<br/>";
  266. if ($_GET['subid2'] != 0)
  267. {
  268. echo "<a onmouseover=\"this.style.cursor='pointer';\" onclick=\"if(document.getElementById('modules2').style.display=='none'){document.getElementById('modules2').style.display='';} else{document.getElementById('modules2').style.display='none'}\">Show Modules</a>";
  269. }
  270. echo "<span id=\"modules2\" style=\"display:none;\">";
  271.  
  272. $pages_table_name = "uni_subjects";
  273. $query_combinations2 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($_GET['subid2']) . "'";
  274. $result_combinations2 = mysql_query($query_combinations2, $con) or die(mysql_error());
  275. while($row_combinations2 = mysql_fetch_array($result_combinations2))
  276. {
  277. if ($_GET['typeid'] == 1)
  278. {
  279. $ex = explode(',', $row_combinations2['modules1']);
  280. }
  281. if ($_GET['typeid'] == 2)
  282. {
  283. $ex = explode(',', $row_combinations2['modules2']);
  284. }
  285. if ($_GET['typeid'] == 3)
  286. {
  287. $ex = explode(',', $row_combinations2['modules3']);
  288. }
  289. if ($_GET['typeid'] == 4)
  290. {
  291. $ex = explode(',', $row_combinations2['modules4']);
  292. }
  293. $pages_table_name = "uni_modules";
  294. for($i=0; $i<count($ex); $i++)
  295. {
  296. $query_combinations2 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string(trim($ex[$i])) . "'";
  297. $result_modules2 = mysql_query($query_combinations2, $con) or die(mysql_error());
  298. while($row_modules2 = mysql_fetch_array($result_modules2))
  299. {
  300. if ($showsub2 == 1)
  301. {
  302. echo "<br/><a target=\"_blank\" href=\"" . $row_modules2['summaryid'] . "\">" . urlencode($row_modules2['name']) . "</a>";
  303. }
  304. }
  305. }
  306. }
  307. if ($_GET['subid2'] != 0)
  308. {
  309. echo "</span>";
  310. }
  311.  
  312.  
  313. echo "</th> <th>";
  314. echo "<br/>";
  315. if ($_GET['subid3'] != 0)
  316. {
  317. echo "<a onmouseover=\"this.style.cursor='pointer';\" onclick=\"if(document.getElementById('modules3').style.display=='none'){document.getElementById('modules3').style.display='';} else{document.getElementById('modules3').style.display='none'}\">Show Modules</a>";
  318. }
  319. echo "<span id=\"modules3\" style=\"display:none;\">";
  320.  
  321. $pages_table_name = "uni_subjects";
  322. $query_combinations3 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($_GET['subid3']) . "'";
  323. $result_combinations3 = mysql_query($query_combinations3, $con) or die(mysql_error());
  324. while($row_combinations3 = mysql_fetch_array($result_combinations3))
  325. {
  326. if ($_GET['typeid'] == 1)
  327. {
  328. $ex = explode(',', $row_combinations3['modules1']);
  329. }
  330. if ($_GET['typeid'] == 2)
  331. {
  332. $ex = explode(',', $row_combinations3['modules2']);
  333. }
  334. if ($_GET['typeid'] == 3)
  335. {
  336. $ex = explode(',', $row_combinations3['modules3']);
  337. }
  338. if ($_GET['typeid'] == 4)
  339. {
  340. $ex = explode(',', $row_combinations3['modules4']);
  341. }
  342. $pages_table_name = "uni_modules";
  343. for($i=0; $i<count($ex); $i++)
  344. {
  345. $query_combinations3 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string(trim($ex[$i])) . "'";
  346. $result_modules3 = mysql_query($query_combinations3, $con) or die(mysql_error());
  347. while($row_modules3 = mysql_fetch_array($result_modules3))
  348. {
  349. if ($showsub3 == 1)
  350. {
  351. echo "<br/><a target=\"_blank\" href=\"" . $row_modules3['summaryid'] . "\">" . urlencode($row_modules3['name']) . "</a>";
  352. }
  353. }
  354. }
  355. }
  356. if ($_GET['subid3'] != 0)
  357. {
  358. echo "</span>";
  359. }
  360.  
  361.  
  362. echo "</th> <th>";
  363. echo "<br/>";
  364. if ($_GET['subid4'] != 0)
  365. {
  366. echo "<a onmouseover=\"this.style.cursor='pointer';\" onclick=\"if(document.getElementById('modules4').style.display=='none'){document.getElementById('modules4').style.display='';} else{document.getElementById('modules4').style.display='none'}\">Show Modules</a>";
  367. }
  368. echo "<span id=\"modules4\" style=\"display:none;\">";
  369.  
  370. $pages_table_name = "uni_subjects";
  371. $query_combinations4 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($_GET['subid4']) . "'";
  372. $result_combinations4 = mysql_query($query_combinations4, $con) or die(mysql_error());
  373. while($row_combinations4 = mysql_fetch_array($result_combinations4))
  374. {
  375. if ($_GET['typeid'] == 1)
  376. {
  377. $ex = explode(',', $row_combinations4['modules1']);
  378. }
  379. if ($_GET['typeid'] == 2)
  380. {
  381. $ex = explode(',', $row_combinations4['modules2']);
  382. }
  383. if ($_GET['typeid'] == 3)
  384. {
  385. $ex = explode(',', $row_combinations4['modules3']);
  386. }
  387. if ($_GET['typeid'] == 4)
  388. {
  389. $ex = explode(',', $row_combinations4['modules4']);
  390. }
  391. $pages_table_name = "uni_modules";
  392. for($i=0; $i<count($ex); $i++)
  393. {
  394. $query_combinations4 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string(trim($ex[$i])) . "'";
  395. $result_modules4 = mysql_query($query_combinations4, $con) or die(mysql_error());
  396. while($row_modules4 = mysql_fetch_array($result_modules4))
  397. {
  398. if ($showsub4 == 1)
  399. {
  400. echo "<br/><a target=\"_blank\" href=\"" . $row_modules4['summaryid'] . "\">" . urlencode($row_modules4['name']) . "</a>";
  401. }
  402. }
  403. }
  404. }
  405. if ($_GET['subid4'] != 0)
  406. {
  407. echo "</span>";
  408. }
  409.  
  410. echo "<br/>";
  411.  
  412.  
  413. echo "</th></tr><tr><td>";
  414.  
  415. $pages_table_name = "uni_subjects";
  416. $query_subjects1 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($subid1) . "'";
  417. $result_subjects1 = mysql_query($query_subjects1, $con) or die(mysql_error());
  418. while($row_subjects1 = mysql_fetch_array($result_subjects1))
  419. {
  420. if ($showsub1 == 1)
  421. {
  422. echo "<img src=\"" . $row_subjects1['id'] . "-" . $typeid . ".png\"/>";
  423. }
  424. else
  425. {
  426. echo "<img src=\"wrongcombo.png\"/>";
  427. }
  428. }
  429.  
  430. echo "</td><td>";
  431.  
  432. $pages_table_name = "uni_subjects";
  433. $query_subjects2 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($subid2) . "'";
  434. $result_subjects2 = mysql_query($query_subjects2, $con) or die(mysql_error());
  435. while($row_subjects2 = mysql_fetch_array($result_subjects2))
  436. {
  437. if ($showsub2 == 1)
  438. {
  439. echo "<img src=\"" . $row_subjects2['id'] . "-" . $typeid . ".png\"/>";
  440. }
  441. else
  442. {
  443. echo "<img src=\"wrongcombo.png\"/>";
  444. }
  445. }
  446.  
  447. echo "</td><td>";
  448.  
  449. $pages_table_name = "uni_subjects";
  450. if ($subs > 2)
  451. {
  452. $query_subjects3 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($subid3) . "'";
  453. $result_subjects3 = mysql_query($query_subjects3, $con) or die(mysql_error());
  454. while($row_subjects3 = mysql_fetch_array($result_subjects3))
  455. {
  456. if ($showsub3 == 1)
  457. {
  458. echo "<img src=\"" . $row_subjects3['id'] . "-" . $typeid . ".png\"/>";
  459. }
  460. else
  461. {
  462. echo "<img src=\"wrongcombo.png\"/>";
  463. }
  464. }
  465. }
  466.  
  467. echo "</td><td>";
  468.  
  469. $pages_table_name = "uni_subjects";
  470. if ($subs > 3)
  471. {
  472. $query_subjects4 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($subid4) . "'";
  473. $result_subjects4 = mysql_query($query_subjects4, $con) or die(mysql_error());
  474. while($row_subjects4 = mysql_fetch_array($result_subjects4))
  475. {
  476. if ($showsub4 == 1)
  477. {
  478. echo "<img src=\"" . $row_subjects4['id'] . "-" . $typeid . ".png\"/>";
  479. }
  480. else
  481. {
  482. echo "<img src=\"wrongcombo.png\"/>";
  483. }
  484. }
  485. }
  486. echo "</td></tr></table>";
  487.  
  488. // echo "<br /><img src=\"timetable.jpg\" width=\"100%\" alt=\"Timetable\"></img>";
  489. // echo "<span style=\"width: 50%;\"><br /><img src=\"" . $_GET['combinationid'] . ".png\" alt=\"Timetable\"></img></span>";
  490. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement