Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $sv_name = "";
- $username = "";
- $password = "";
- $db_name = "";
- $con = mysql_connect($sv_name, $username, $password) or die(mysql_error());
- mysql_select_db($db_name, $con) or die(mysql_error());
- $showsub1 = 1;
- $showsub2 = 1;
- $showsub3 = 1;
- $showsub4 = 1;
- $foundsub1 = 0;
- $foundsub2 = 0;
- $foundsub3 = 0;
- $foundsub4 = 0;
- $pages_table_name = "uni_combinations";
- $query_subjects = "SELECT * FROM " . $pages_table_name;
- $result_subjects = mysql_query($query_subjects, $con) or die(mysql_error());
- while($row_subjects = mysql_fetch_array($result_subjects))
- {
- if($_GET['typeid'] == $row_subjects['typeid'])
- {
- //echo "<br/>combinationid: " . $row_subjects['id'];
- if (
- $_GET['subid1'] == $row_subjects['subid1'] ||
- $_GET['subid1'] == $row_subjects['subid2'] ||
- $_GET['subid1'] == $row_subjects['subid3'] ||
- $_GET['subid1'] == $row_subjects['subid4']
- )
- {
- $foundsub1 = 1;
- }
- if (
- ($_GET['subid1'] == $row_subjects['subid1'] ||
- $_GET['subid1'] == $row_subjects['subid2'] ||
- $_GET['subid1'] == $row_subjects['subid3'] ||
- $_GET['subid1'] == $row_subjects['subid4'])
- &&
- ($_GET['subid2'] == $row_subjects['subid1'] ||
- $_GET['subid2'] == $row_subjects['subid2'] ||
- $_GET['subid2'] == $row_subjects['subid3'] ||
- $_GET['subid2'] == $row_subjects['subid4'])
- )
- {
- $foundsub2 = 1;
- }
- if (
- ($_GET['subid1'] == $row_subjects['subid1'] ||
- $_GET['subid1'] == $row_subjects['subid2'] ||
- $_GET['subid1'] == $row_subjects['subid3'] ||
- $_GET['subid1'] == $row_subjects['subid4'])
- &&
- ($_GET['subid2'] == $row_subjects['subid1'] ||
- $_GET['subid2'] == $row_subjects['subid2'] ||
- $_GET['subid2'] == $row_subjects['subid3'] ||
- $_GET['subid2'] == $row_subjects['subid4'])
- &&
- ($_GET['subid3'] == $row_subjects['subid1'] ||
- $_GET['subid3'] == $row_subjects['subid2'] ||
- $_GET['subid3'] == $row_subjects['subid3'] ||
- $_GET['subid3'] == $row_subjects['subid4'])
- )
- {
- $foundsub3 = 1;
- }
- if (
- ($_GET['subid1'] == $row_subjects['subid1'] ||
- $_GET['subid1'] == $row_subjects['subid2'] ||
- $_GET['subid1'] == $row_subjects['subid3'] ||
- $_GET['subid1'] == $row_subjects['subid4'])
- &&
- ($_GET['subid2'] == $row_subjects['subid1'] ||
- $_GET['subid2'] == $row_subjects['subid2'] ||
- $_GET['subid2'] == $row_subjects['subid3'] ||
- $_GET['subid2'] == $row_subjects['subid4'])
- &&
- ($_GET['subid3'] == $row_subjects['subid1'] ||
- $_GET['subid3'] == $row_subjects['subid2'] ||
- $_GET['subid3'] == $row_subjects['subid3'] ||
- $_GET['subid3'] == $row_subjects['subid4'])
- &&
- ($_GET['subid4'] == $row_subjects['subid1'] ||
- $_GET['subid4'] == $row_subjects['subid2'] ||
- $_GET['subid4'] == $row_subjects['subid3'] ||
- $_GET['subid4'] == $row_subjects['subid4'])
- )
- {
- $foundsub4 = 1;
- }
- if (
- ($_GET['subid1'] == $row_subjects['subid1'] ||
- $_GET['subid1'] == $row_subjects['subid2'] ||
- $_GET['subid1'] == $row_subjects['subid3'] ||
- $_GET['subid1'] == $row_subjects['subid4'])
- &&
- ($_GET['subid2'] == $row_subjects['subid1'] ||
- $_GET['subid2'] == $row_subjects['subid2'] ||
- $_GET['subid2'] == $row_subjects['subid3'] ||
- $_GET['subid2'] == $row_subjects['subid4'])
- &&
- ($_GET['subid3'] == $row_subjects['subid1'] ||
- $_GET['subid3'] == $row_subjects['subid2'] ||
- $_GET['subid3'] == $row_subjects['subid3'] ||
- $_GET['subid3'] == $row_subjects['subid4'])
- &&
- ($_GET['subid4'] == $row_subjects['subid1'] ||
- $_GET['subid4'] == $row_subjects['subid2'] ||
- $_GET['subid4'] == $row_subjects['subid3'] ||
- $_GET['subid4'] == $row_subjects['subid4'])
- )
- {
- $combinationid = $row_subjects['id'];
- }
- }
- }
- $pages_table_name = "uni_combinations";
- $query_subjects = "SELECT * FROM " . $pages_table_name . " WHERE id='" . $combinationid . "'";
- $result_subjects = mysql_query($query_subjects, $con) or die(mysql_error());
- while($row_subjects = mysql_fetch_array($result_subjects))
- {
- $type = $row_subjects['typeid'];
- $sub1 = $row_subjects['subid1'];
- $sub2 = $row_subjects['subid2'];
- $sub3 = $row_subjects['subid3'];
- $sub4 = $row_subjects['subid4'];
- }
- $pages_table_name = "uni_subjects";
- $query_subjects = "SELECT * FROM " . $pages_table_name;
- $result_subjects = mysql_query($query_subjects, $con) or die(mysql_error());
- while($row_subjects = mysql_fetch_array($result_subjects))
- { //disable all subjects which are not $sub1, $sub2, $sub3 or $sub4
- if(
- $row_subjects['id'] != $sub1 &&
- $row_subjects['id'] != $sub2 &&
- $row_subjects['id'] != $sub3 &&
- $row_subjects['id'] != $sub4
- )
- {
- //echo "<input type=\"hidden\" name=\"disable" . $x . "\" value=\"1\"/>";
- }
- else
- {
- //echo "<input type=\"hidden\" name=\"disable" . $x . "\" value=\"0\"/>";
- }
- }
- //if ($foundsub1 == 1)
- //{
- $showsub1 = 1;
- //}
- //if ($foundsub2 == 1)
- //{
- $showsub2 = 1;
- //}
- //if ($foundsub3 == 1)
- //{
- $showsub3 = 1;
- //}
- //if ($foundsub4 == 1)
- //{
- $showsub4 = 1;
- //}
- /*if ($foundsub1 == 0)
- {
- $showsub1 = 0;
- }
- if ($foundsub2 == 0)
- {
- $showsub2 = 0;
- }
- if ($foundsub3 == 0)
- {
- $showsub3 = 0;
- }
- if ($foundsub4 == 0)
- {
- $showsub4 = 0;
- }*/
- $typeid = $_GET['typeid'];
- $subid1 = $_GET['subid1'];
- $subid2 = $_GET['subid2'];
- $subid3 = $_GET['subid3'];
- $subid4 = $_GET['subid4'];
- if ($typeid == 1 || $typeid == 3)
- {
- $subs = 3;
- }
- if ($typeid == 2)
- {
- $subs = 2;
- }
- if ($typeid == 4)
- {
- $subs = 4;
- }
- echo "<table><tr><th>";
- if ($_GET['subid1'] != 0)
- {
- 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>";
- }
- echo "<span id=\"modules1\" style=\"display:none;\">";
- $pages_table_name = "uni_subjects";
- $query_combinations1 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($_GET['subid1']) . "'";
- $result_combinations1 = mysql_query($query_combinations1, $con) or die(mysql_error());
- while($row_combinations1 = mysql_fetch_array($result_combinations1))
- {
- if ($_GET['typeid'] == 1)
- {
- $ex = explode(',', $row_combinations1['modules1']);
- }
- if ($_GET['typeid'] == 2)
- {
- $ex = explode(',', $row_combinations1['modules2']);
- }
- if ($_GET['typeid'] == 3)
- {
- $ex = explode(',', $row_combinations1['modules3']);
- }
- if ($_GET['typeid'] == 4)
- {
- $ex = explode(',', $row_combinations1['modules4']);
- }
- $pages_table_name = "uni_modules";
- for($i=0; $i<count($ex); $i++)
- {
- $query_combinations1 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string(trim($ex[$i])) . "'";
- $result_modules1 = mysql_query($query_combinations1, $con) or die(mysql_error());
- while($row_modules1 = mysql_fetch_array($result_modules1))
- {
- if ($showsub1 == 1)
- {
- echo "<br/><a target=\"_blank\" href=\"" . $row_modules1['summaryid'] . "\">" . urlencode($row_modules1['name']) . "</a>";
- }
- }
- }
- }
- if ($_GET['subid1'] != 0)
- {
- echo "</span>";
- }
- echo "</th><th>";
- echo "<br/>";
- if ($_GET['subid2'] != 0)
- {
- 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>";
- }
- echo "<span id=\"modules2\" style=\"display:none;\">";
- $pages_table_name = "uni_subjects";
- $query_combinations2 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($_GET['subid2']) . "'";
- $result_combinations2 = mysql_query($query_combinations2, $con) or die(mysql_error());
- while($row_combinations2 = mysql_fetch_array($result_combinations2))
- {
- if ($_GET['typeid'] == 1)
- {
- $ex = explode(',', $row_combinations2['modules1']);
- }
- if ($_GET['typeid'] == 2)
- {
- $ex = explode(',', $row_combinations2['modules2']);
- }
- if ($_GET['typeid'] == 3)
- {
- $ex = explode(',', $row_combinations2['modules3']);
- }
- if ($_GET['typeid'] == 4)
- {
- $ex = explode(',', $row_combinations2['modules4']);
- }
- $pages_table_name = "uni_modules";
- for($i=0; $i<count($ex); $i++)
- {
- $query_combinations2 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string(trim($ex[$i])) . "'";
- $result_modules2 = mysql_query($query_combinations2, $con) or die(mysql_error());
- while($row_modules2 = mysql_fetch_array($result_modules2))
- {
- if ($showsub2 == 1)
- {
- echo "<br/><a target=\"_blank\" href=\"" . $row_modules2['summaryid'] . "\">" . urlencode($row_modules2['name']) . "</a>";
- }
- }
- }
- }
- if ($_GET['subid2'] != 0)
- {
- echo "</span>";
- }
- echo "</th> <th>";
- echo "<br/>";
- if ($_GET['subid3'] != 0)
- {
- 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>";
- }
- echo "<span id=\"modules3\" style=\"display:none;\">";
- $pages_table_name = "uni_subjects";
- $query_combinations3 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($_GET['subid3']) . "'";
- $result_combinations3 = mysql_query($query_combinations3, $con) or die(mysql_error());
- while($row_combinations3 = mysql_fetch_array($result_combinations3))
- {
- if ($_GET['typeid'] == 1)
- {
- $ex = explode(',', $row_combinations3['modules1']);
- }
- if ($_GET['typeid'] == 2)
- {
- $ex = explode(',', $row_combinations3['modules2']);
- }
- if ($_GET['typeid'] == 3)
- {
- $ex = explode(',', $row_combinations3['modules3']);
- }
- if ($_GET['typeid'] == 4)
- {
- $ex = explode(',', $row_combinations3['modules4']);
- }
- $pages_table_name = "uni_modules";
- for($i=0; $i<count($ex); $i++)
- {
- $query_combinations3 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string(trim($ex[$i])) . "'";
- $result_modules3 = mysql_query($query_combinations3, $con) or die(mysql_error());
- while($row_modules3 = mysql_fetch_array($result_modules3))
- {
- if ($showsub3 == 1)
- {
- echo "<br/><a target=\"_blank\" href=\"" . $row_modules3['summaryid'] . "\">" . urlencode($row_modules3['name']) . "</a>";
- }
- }
- }
- }
- if ($_GET['subid3'] != 0)
- {
- echo "</span>";
- }
- echo "</th> <th>";
- echo "<br/>";
- if ($_GET['subid4'] != 0)
- {
- 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>";
- }
- echo "<span id=\"modules4\" style=\"display:none;\">";
- $pages_table_name = "uni_subjects";
- $query_combinations4 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($_GET['subid4']) . "'";
- $result_combinations4 = mysql_query($query_combinations4, $con) or die(mysql_error());
- while($row_combinations4 = mysql_fetch_array($result_combinations4))
- {
- if ($_GET['typeid'] == 1)
- {
- $ex = explode(',', $row_combinations4['modules1']);
- }
- if ($_GET['typeid'] == 2)
- {
- $ex = explode(',', $row_combinations4['modules2']);
- }
- if ($_GET['typeid'] == 3)
- {
- $ex = explode(',', $row_combinations4['modules3']);
- }
- if ($_GET['typeid'] == 4)
- {
- $ex = explode(',', $row_combinations4['modules4']);
- }
- $pages_table_name = "uni_modules";
- for($i=0; $i<count($ex); $i++)
- {
- $query_combinations4 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string(trim($ex[$i])) . "'";
- $result_modules4 = mysql_query($query_combinations4, $con) or die(mysql_error());
- while($row_modules4 = mysql_fetch_array($result_modules4))
- {
- if ($showsub4 == 1)
- {
- echo "<br/><a target=\"_blank\" href=\"" . $row_modules4['summaryid'] . "\">" . urlencode($row_modules4['name']) . "</a>";
- }
- }
- }
- }
- if ($_GET['subid4'] != 0)
- {
- echo "</span>";
- }
- echo "<br/>";
- echo "</th></tr><tr><td>";
- $pages_table_name = "uni_subjects";
- $query_subjects1 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($subid1) . "'";
- $result_subjects1 = mysql_query($query_subjects1, $con) or die(mysql_error());
- while($row_subjects1 = mysql_fetch_array($result_subjects1))
- {
- if ($showsub1 == 1)
- {
- echo "<img src=\"" . $row_subjects1['id'] . "-" . $typeid . ".png\"/>";
- }
- else
- {
- echo "<img src=\"wrongcombo.png\"/>";
- }
- }
- echo "</td><td>";
- $pages_table_name = "uni_subjects";
- $query_subjects2 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($subid2) . "'";
- $result_subjects2 = mysql_query($query_subjects2, $con) or die(mysql_error());
- while($row_subjects2 = mysql_fetch_array($result_subjects2))
- {
- if ($showsub2 == 1)
- {
- echo "<img src=\"" . $row_subjects2['id'] . "-" . $typeid . ".png\"/>";
- }
- else
- {
- echo "<img src=\"wrongcombo.png\"/>";
- }
- }
- echo "</td><td>";
- $pages_table_name = "uni_subjects";
- if ($subs > 2)
- {
- $query_subjects3 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($subid3) . "'";
- $result_subjects3 = mysql_query($query_subjects3, $con) or die(mysql_error());
- while($row_subjects3 = mysql_fetch_array($result_subjects3))
- {
- if ($showsub3 == 1)
- {
- echo "<img src=\"" . $row_subjects3['id'] . "-" . $typeid . ".png\"/>";
- }
- else
- {
- echo "<img src=\"wrongcombo.png\"/>";
- }
- }
- }
- echo "</td><td>";
- $pages_table_name = "uni_subjects";
- if ($subs > 3)
- {
- $query_subjects4 = "SELECT * FROM " . $pages_table_name . " WHERE id='" . mysql_real_escape_string($subid4) . "'";
- $result_subjects4 = mysql_query($query_subjects4, $con) or die(mysql_error());
- while($row_subjects4 = mysql_fetch_array($result_subjects4))
- {
- if ($showsub4 == 1)
- {
- echo "<img src=\"" . $row_subjects4['id'] . "-" . $typeid . ".png\"/>";
- }
- else
- {
- echo "<img src=\"wrongcombo.png\"/>";
- }
- }
- }
- echo "</td></tr></table>";
- // echo "<br /><img src=\"timetable.jpg\" width=\"100%\" alt=\"Timetable\"></img>";
- // echo "<span style=\"width: 50%;\"><br /><img src=\"" . $_GET['combinationid'] . ".png\" alt=\"Timetable\"></img></span>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement