Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. <?php
  2. $sv_name = "";
  3. $username = "";
  4. $password = "";
  5. $db_name = "";
  6. $con = mysql_connect($sv_name, $username, $password) or die(mysql_error());
  7. mysql_select_db($db_name, $con) or die(mysql_error());
  8.  
  9. $jsType = $_GET['typeid'];
  10. $jsSub1 = $_GET['subid1'];
  11. $jsSub2 = $_GET['subid2'];
  12. $jsSub3 = $_GET['subid3'];
  13. $jsSub4 = $_GET['subid4'];
  14. $sub1 = $_GET['si1'];
  15. $sub2 = $_GET['si2'];
  16. $sub3 = $_GET['si3'];
  17. $sub4 = $_GET['si4'];
  18.  
  19. $subs1 = array();
  20. $subs2 = array();
  21. $subs3 = array();
  22. $subs4 = array();
  23.  
  24. for ($i=0; $i<100; $i++) {
  25. $subs1[$i] = -1;
  26. $subs2[$i] = -1;
  27. $subs3[$i] = -1;
  28. $subs4[$i] = -1;
  29. }
  30.  
  31.  
  32. if ($jsType == 2 && $sub1 > 0) {
  33. $atlast = 1;
  34. }
  35.  
  36. else if (($jsType == 1 || $jsType == 3) && $sub2 > 0) {
  37. $atlast = 1;
  38. }
  39.  
  40. else if ($jsType == 4 && $sub1 > 0) {
  41. $atlast = 1;
  42. }
  43.  
  44. else {
  45. $atlast = 0;
  46. }
  47.  
  48. echo "
  49.  
  50. lvl = document.uniform.level.value;
  51.  
  52. si1 = document.uniform.subject1.selectedIndex;
  53. si2 = document.uniform.subject2.selectedIndex;
  54. si3 = document.uniform.subject3.selectedIndex;
  55. si4 = document.uniform.subject4.selectedIndex;
  56. ";
  57.  
  58. $pages_table_name = "uni_combinations";
  59. $query_subjects = "SELECT * FROM " . $pages_table_name;
  60. $result_subjects = mysql_query($query_subjects, $con) or die(mysql_error());
  61.  
  62.  
  63. while($row_subjects = mysql_fetch_array($result_subjects))
  64. {
  65.  
  66. if (
  67. $jsType == $row_subjects['typeid'] &&
  68. (
  69.  
  70. ($jsSub1 == $row_subjects['subid1'] || $jsSub1 == 0)
  71. &&
  72. ($jsSub2 == $row_subjects['subid2'] || $jsSub2 == 0)
  73. &&
  74. ($jsSub3 == $row_subjects['subid3'] || $jsSub3 == 0)
  75. &&
  76. ($jsSub4 == $row_subjects['subid4'] || $jsSub4 == 0)
  77.  
  78. )
  79. )
  80. {
  81. if ($atlast == 1) {
  82. if ($subs2[$row_subjects['subid2']] != $row_subjects['subid2']) {
  83. echo "
  84. document.uniform.subject2.options[".$row_subjects['subid2']."].disabled = true;
  85. document.uniform.subject2.options[".$row_subjects['subid2']."].style.display = 'none';
  86. ";
  87. $subs2[$row_subjects['subid2']] = $row_subjects['subid2'];
  88. }
  89. if ($subs3[$row_subjects['subid3']] != $row_subjects['subid3']) {
  90. echo "
  91. document.uniform.subject3.options[".$row_subjects['subid3']."].disabled = true;
  92. document.uniform.subject3.options[".$row_subjects['subid3']."].style.display = 'none';
  93. ";
  94. $subs3[$row_subjects['subid3']] = $row_subjects['subid3'];
  95. }
  96. if ($subs4[$row_subjects['subid4']] != $row_subjects['subid4']) {
  97. echo "
  98. document.uniform.subject4.options[".$row_subjects['subid4']."].disabled = true;
  99. document.uniform.subject4.options[".$row_subjects['subid4']."].style.display = 'none';
  100. ";
  101. $subs4[$row_subjects['subid4']] = $row_subjects['subid4'];
  102. }
  103. }
  104.  
  105. }
  106. }
  107.  
  108. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement