function homepage($title) { if (!check_login()) { header('location:login.php'); } else { echo "<!DOCTYPE html>\n<html>\n\t<SCRIPT LANGUAGE=\"Javascript\" SRC=\"assets/charts/FusionCharts.js\"></SCRIPT>"; display_headers($title); echo "\n<body>"; menu(); echo <<<a \t<div class='container'> \t\t<div id='error'></div> \t\t<div class='row'> a; echo '<div class="span9"><div class="well well-large" style="background:#FFF;">'; /* Pattern Matching */ $reg1 = "/^N[0-9]{6}\$/"; $reg2 = "/^p|(sub)\$/"; $qs = $_SERVER["QUERY_STRING"]; $va = explode("/", $qs); $qs1 = $va[0]; $qs2 = $va[1]; if (preg_match($reg1, $qs1) and preg_match($reg2, $qs2)) { /* Fetching Details */ include 'config/db.php'; include 'config/settings.php'; $dbname = $branchyear . '_Users'; $table = $branchyear . '_Students'; //if(!mysql_select_db($dbname)) die(mysql_error()); $userid = $_SERVER["QUERY_STRING"]; $resultant = explode("/", $userid); $id = $resultant[0]; $mode = $resultant[1]; $q = "select Name,Gender,Position, Branch, Class ,RNo from {$table} where Id = '{$id}'"; $res = mysql_query($q) or die(mysql_error()); if (mysql_num_rows($res) == 0) { echo "<script>document.location.href='404.php';</script>"; } $row = mysql_fetch_array($res); $username = ucwords(strtolower($row['Name'])); $gender = $row['Gender']; $RNo = $row["RNo"]; $type = $row['Position']; $class = $row['Class']; $branch = $row['Branch']; $colors = array('F6BD0F', '8BBA00', 'FF8E46', '8E468E', '588526', '008ED6', '9D080D', 'D64646', 'B3AA00', 'A186BE', 'AFD8F8'); shuffle($colors); /* Deatils Fetched */ echo <<<a \t\t<div id="step1" class="span6"> \t\t<a ><h5>Student Attendance Report for {$id} </h5></a> \t\t<h6>     -   Lising Attendance details submitted from CR @ {$branch} {$class}</h6><br> \t\t</div> \t\t<table class="table table-hover table-bordered"> \t\t<tbody> \t\t<tr><th>Name </th> <td>{$username}</td> <th>Gender </th> <td>{$gender}</td> </tr> \t\t<tr><th>RNo </th> <td>{$RNo}</td> <th>Class </th> <td>{$branch} {$class} </td></tr> \t\t</tbody> \t\t</table> \t<div id="step1" class="span4"> \t\t<h5>Chart Based Representaiton </h5> \t</div> \t<div id="side1" class="span4" > \t\t<h6 class='text-right'><a href='?{$id}/sub' ><i class='icon-book'></i> Subjects</a>   <a href='?{$id}/p'><i class='icon-qrcode'></i> Periods</a></h6> \t</div> a; if (strtolower($mode) == "p") { //mysql_select_db($branchyear."_Dates") or die(mysql_error()); $query = mysql_query("Select Date from " . $branch . $class . "_Dates where P1_Con = 'ok' or P2_Con = 'ok' or P3_Con = 'ok' or P4_Con = 'ok' ;") or die(mysql_error()); $nofd = mysql_num_rows($query); if ($nofd != 0) { $p = array("P1_A" => 0, "P1_P" => 0, "P2_A" => 0, "P2_P" => 0, "P3_A" => 0, "P3_P" => 0, "P4_A" => 0, "P4_P" => 0); $stats = array("Total" => 0, "Presents" => 0, "Absents" => 0); $strXML = "<graph caption='Period Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Periods' yAxisName='Performance'>"; $datasetp = ''; while ($dates = mysql_fetch_array($query)) { //mysql_select_db($branchyear."_Attendance") or die(mysql_error()); $q = mysql_query("select `" . $dates[0] . "` from " . $branch . $class . "_Attendance where RNo='" . $RNo . "';"); while ($res = mysql_fetch_array($q)) { $values = explode(",", $res[0]); for ($i = 0; $i < count($values) - 1; $i++) { if (substr($values[$i], -1) == "P") { $stats["Presents"] += 1; $stats["Total"] += 1; } if (substr($values[$i], -1) == "A") { $stats["Absents"] += 1; $stats["Total"] += 1; } $p[$values[$i]] += 1; } } } $tr = ''; for ($i = 1; $i <= 4; $i++) { $st = round($p["P" . $i . "_P"] / $nofd, 1) * 100 <= 50 ? "error" : "success"; $tr .= '<tr> <td style="text-align:center;">' . $i . '</td> <td style="text-align:center;"> P' . $i . ' </td> <td style="text-align:center;"><b> ' . $nofd . '</b> </td> <td style="text-align:center;" class="text-success"><b> ' . $p["P" . $i . "_P"] . ' </b></td> <td style="text-align:center;" class="text-success"><b> ' . round($p["P" . $i . "_P"] / $nofd, 1) . ' </b></td> <td style="text-align:center;" class="text-error"><b> ' . $p["P" . $i . "_A"] . ' </b></td> <td style="text-align:center;" class="text-error"><b> ' . round($p["P" . $i . "_A"] / $nofd, 1) . ' </b></td> <td style="text-align:center;" class="text-' . $st . '"><b> ' . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . ' % </b></td> </tr>'; $datasetp .= "<set name='P" . $i . "' value='" . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . "' color='" . $colors[$i] . "'/>"; } $strXML .= $datasetp . "</graph>"; echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380); echo <<<table_head \t\t<h5> Period Wise Attendance Representation </h5><br> \t\t<table class="table table-hover table-bordered " style="padding:0px;"> \t\t\t<thead> \t\t\t\t<tr> \t\t\t\t<th style="text-align:center;" valign="top"> SNo </th> <th style="text-align:center;" valign="top"> Period </th> <th style="text-align:center;" > Days </th> <th style="text-align:center;" > Presents </th> <th style="text-align:center;" > P/Day </th> <th style="text-align:center;" > Absents </th> <th style="text-align:center;" > A/Day </th><th style="text-align:center;" > Performance </th> \t\t\t\t</tr> \t\t\t</thead> \t\t\t<tbody> table_head; echo $tr; echo <<<tableend \t\t\t</tbody> \t\t</table> \t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>×</a><strong>CNYS </strong>: Classes Not Yet Started </div> \t<br> tableend; } else { echo "<br><br><h6 class='text-error text-center'> No Submissions Found<br></h6>"; } } /* End of Period Wise Attendance*/ /* SUbjects Wise Attendance */ if (strtolower($mode) == "sub") { //mysql_select_db($branchyear."_Subjects") or die(mysql_error()); $query = mysql_query("Select * from " . $branch . $class . "_Subjects where RNo='{$RNo}';") or die(mysql_error()); $subjectwise = mysql_fetch_array($query) or die(mysql_error()); $tr = ''; $strXML = "<graph caption='Subject Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Subjects' yAxisName='Performance'>"; $datasetp = ''; $nc_cls = 0; for ($i = 0; $i < count($allowed_subjects); $i++) { $tnoc = $subjectwise[$allowed_subjects[$i] . "_P"] + $subjectwise[$allowed_subjects[$i] . "_A"]; if ($tnoc == 0) { $nc_cls++; $performance = "N/A "; $st = "error"; $remarks = "CNYS"; } else { $performance = $subjectwise[$allowed_subjects[$i] . "_P"] / $tnoc * 100; $performance = round($performance, 1) . " %"; $st = $performance <= 50 ? "error" : "success"; if (round($performance, 1) >= 95) { $remarks = "Excellent"; } if (round($performance, 1) >= 90 && round($performance, 1) < 95) { $remarks = "Very Good"; } if (round($performance, 1) >= 80 && round($performance, 1) < 90) { $remarks = "Good"; } if (round($performance, 1) >= 70 && round($performance, 1) < 80) { $remarks = "Normal"; } if (round($performance, 1) >= 60 && round($performance, 1) < 70) { $remarks = "Average"; } if (round($performance, 1) >= 50 && round($performance, 1) < 60) { $remarks = "Bad"; } if (round($performance, 1) < 50) { $remarks = "Go Out"; } } $tr .= '<tr> <td style="text-align:center;">' . ($i + 1) . '</td> <td style="text-align:center;"> <b>' . $allowed_subjects[$i] . '</b> </td> <td style="text-align:center;"> <b>' . $tnoc . '</b> </td> <td style="text-align:center;" class="text-success"><b> ' . $subjectwise[$allowed_subjects[$i] . "_P"] . '</b> </td> <td style="text-align:center;" class="text-error"><b> ' . $subjectwise[$allowed_subjects[$i] . "_A"] . ' </b></td> <td style="text-align:center;" class="text-' . $st . '"><b>' . $performance . '</b></td> <td style="text-align:center;" class="text-' . $st . '"><b>' . $remarks . '</b></td> </tr>'; $datasetp .= "<set name='" . $allowed_subjects[$i] . "' value='" . round($performance, 1) . "' color='" . $colors[$i] . "'/>"; } $strXML .= $datasetp . "</graph>"; if ($nc_cls != count($allowed_subjects)) { echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380); echo <<<table_head \t\t<h5> Subject Wise Attendance Representation </h5><br> \t\t<table class="table table-hover table-bordered " style="padding:0px;"> \t\t\t<thead> \t\t\t\t<tr> \t\t\t\t<th style="text-align:center;" rowspan="2" valign="top"> SNo </th> <th style="text-align:center;" valign="top"> Subject </th> <th style="text-align:center;" > Classes </th> <th style="text-align:center;" > Presents </th> <th style="text-align:center;" > Absents </th> <th style="text-align:center;" > Performance </th> <th style="text-align:center;" > Remarks </th> \t\t\t\t</tr> \t\t\t</thead> \t\t\t<tbody> table_head; echo $tr; echo <<<tableend \t\t\t</tbody> \t\t</table> \t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>×</a><strong>CNYS </strong>: Classes Not Yet Started </div> \t<br> tableend; } else { echo "<br><br><h6 class='text-error text-center'> No Submissions Found<br></h6>"; } } /* Subject WIse */ } else { echo "<script type='text/javascript'>show_error('Error: Invalid Syntax given..');</script>"; } echo <<<b \t</div> \t</div> \t<div class='span3'> b; go_home(); sidepanel(); echo "</div></div></div>"; display_footer(); echo "\n</body>\n</html>"; } }
function homepage($title) { if (!check_login()) { header('location:login.php'); } else { echo "<!DOCTYPE html>\n<html>\n\t<SCRIPT LANGUAGE=\"Javascript\" SRC=\"assets/charts/FusionCharts.js\"></SCRIPT>"; display_headers($title); echo "\n<body>"; menu(); echo <<<a \t\t\t\t<div class='container'> \t\t\t\t\t<div id='error'></div> \t\t\t\t\t<div class='row'> \t\t\t\t\t<div class='span9'> \t\t\t\t\t\t<div class="well well-large" style="background:#FFF"> \t\t\t\t\t\t a; splash(); echo <<<a \t<div id="step1" class="span4"> \t\t \t</div> \t<div id="side1" class="span4" > \t\t<h6 class='text-right'><a href='?sub'><i class='icon-book'></i> Subjects</a>   <a href='?p'><i class='icon-qrcode'></i> Periods</a></h6> \t</div> a; /* Fetching Details */ include 'config/db.php'; include 'config/settings.php'; $dbname = $branchyear . '_Users'; $table = $branchyear . '_Students'; //if(!mysql_select_db($dbname)) die(mysql_error()); $userid = $_SESSION['UserId']; $q = "select Position, Branch, Class ,RNo from {$table} where Id = '{$userid}'"; $res = mysql_query($q) or die(mysql_error()); $row = mysql_fetch_array($res); $RNo = $row["RNo"]; $type = $row['Position']; if ($row['Position'] == "BA") { $branch = $globalbranch; $p1 = substr($_SERVER["QUERY_STRING"], 0, $branchlen); if ($p1 == $globalbranch) { $p = explode("/", $_SERVER["QUERY_STRING"]); $class = substr($p[0], -1); } else { $class = 1; } } else { $branch = $row['Branch']; $class = $row['Class']; } $colors = array('F6BD0F', '8BBA00', 'FF8E46', '8E468E', '588526', '008ED6', '9D080D', 'D64646', 'B3AA00', 'A186BE', 'AFD8F8'); shuffle($colors); $colorz = array('F6BD0F,8BBA00', 'FF8E46,8E468E', '8E468E,588526', '008ED6,9D080D'); $reqcolorz = explode(",", $colorz[rand(0, 3)]); /* Deatils Fetched */ /* Start Checking wheter he is a student or any other */ if ($type == "S") { /* Starting Period Wise Attendance */ if (strtolower($_SERVER["QUERY_STRING"]) == "p") { //mysql_select_db($branchyear."_Dates") or die(mysql_error()); $query = mysql_query("Select Date from " . $branch . $class . "_Dates where P1_Con = 'ok' or P2_Con = 'ok' or P3_Con = 'ok' or P4_Con = 'ok';") or die(mysql_error()); $nofd = mysql_num_rows($query); if ($nofd != 0) { $p = array("P1_A" => 0, "P1_P" => 0, "P2_A" => 0, "P2_P" => 0, "P3_A" => 0, "P3_P" => 0, "P4_A" => 0, "P4_P" => 0); $stats = array("Total" => 0, "Presents" => 0, "Absents" => 0); $strXML = "<graph caption='Period Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Periods' yAxisName='Performance'>"; $datasetp = ''; while ($dates = mysql_fetch_array($query)) { //mysql_select_db($branchyear."_Attendance") or die(mysql_error()); $q = mysql_query("select `" . $dates[0] . "` from " . $branch . $class . "_Attendance where RNo='" . $RNo . "';"); while ($res = mysql_fetch_array($q)) { $values = explode(",", $res[0]); for ($i = 0; $i < count($values) - 1; $i++) { if (substr($values[$i], -1) == "P") { $stats["Presents"] += 1; $stats["Total"] += 1; } if (substr($values[$i], -1) == "A") { $stats["Absents"] += 1; $stats["Total"] += 1; } $p[$values[$i]] += 1; } } } $tr = ''; for ($i = 1; $i <= 4; $i++) { @($st = round($p["P" . $i . "_P"] / $nofd, 1) * 100 <= 50 ? "error" : "success"); @($tr .= '<tr> <td style="text-align:center;">' . $i . '</td> <td style="text-align:center;"> P' . $i . ' </td> <td style="text-align:center;"><b> ' . $nofd . '</b> </td> <td style="text-align:center;" class="text-success"><b> ' . $p["P" . $i . "_P"] . ' </b></td> <td style="text-align:center;" class="text-success"><b> ' . round($p["P" . $i . "_P"] / $nofd, 1) . ' </b></td> <td style="text-align:center;" class="text-error"><b> ' . $p["P" . $i . "_A"] . ' </b></td> <td style="text-align:center;" class="text-error"><b> ' . round($p["P" . $i . "_A"] / $nofd, 1) . ' </b></td> <td style="text-align:center;" class="text-' . $st . '"><b> <small>' . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . ' % </small></b></td> </tr>'); @($datasetp .= "<set name='P" . $i . "' value='" . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . "' color='" . $colors[$i] . "'/>"); } $strXML .= $datasetp . "</graph>"; echo '<br><h5 class="text-info">Chart Based Attendance Representaiton for Student - ' . $userid . '</h5><br>'; echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380); echo <<<table_head \t\t<h5 class="text-info"> Period Wise Attendance Representation for Student - {$userid}</h5><br> \t\t<table class="table table-hover table-bordered " style="padding:0px;"> \t\t\t<thead> \t\t\t\t<tr> \t\t\t\t<th style="text-align:center;" valign="top"> SNo </th> <th style="text-align:center;" valign="top"> Period </th> <th style="text-align:center;" > Days </th> <th style="text-align:center;" > Presents </th> <th style="text-align:center;" > P/Day </th> <th style="text-align:center;" > Absents </th> <th style="text-align:center;" > A/Day </th><th style="text-align:center;" > Performance </th> \t\t\t\t</tr> \t\t\t</thead> \t\t\t<tbody> table_head; echo $tr; echo <<<tableend \t\t\t</tbody> \t\t</table> \t\t<table class='table table-hover table-bordered ' > \t\t<tr> \t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th> \t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th> \t\t</tr> \t\t<tr> \t\t\t<th><center>P/Day</center></th><td> No. of Presents for Day</td>\t \t\t\t<th><center>A/Day</center></th><td> No. of Absents for Day</td> \t\t</tr> \t\t \t\t </table> \t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>×</a><strong>CNYS </strong>: Classes Not Yet Started </div> \t<br> \t\t tableend; } else { echo "<br><br><h6 class='text-error text-center'> No Submissions Found<br></h6>"; } } /* End of Period Wise Attendance*/ /* SUbjects Wise Attendance */ if (strtolower($_SERVER["QUERY_STRING"]) == "sub") { //mysql_select_db($branchyear."_Subjects") or die(mysql_error()); $query = mysql_query("Select * from " . $branch . $class . "_Subjects where RNo='{$RNo}';") or die(mysql_error()); $subjectwise = mysql_fetch_array($query) or die(mysql_error()); $tr = ''; $strXML = "<graph caption='Subject Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Subjects' yAxisName='Performance'>"; $datasetp = ''; $nc_cls = 0; $poor = array(); for ($i = 0; $i < count($allowed_subjects); $i++) { $tnoc = $subjectwise[$allowed_subjects[$i] . "_P"] + $subjectwise[$allowed_subjects[$i] . "_A"]; if ($tnoc == 0) { $nc_cls++; $performance = "N/A "; $st = "error"; $remarks = "CNYS"; } else { $performance = $subjectwise[$allowed_subjects[$i] . "_P"] / $tnoc * 100; $performance = round($performance, 1) . " %"; $st = $performance <= 50 ? "error" : "success"; if (round($performance, 1) >= 95) { $remarks = "Excellent"; } if (round($performance, 1) >= 90 && round($performance, 1) < 95) { $remarks = "Very Good"; } if (round($performance, 1) >= 80 && round($performance, 1) < 90) { $remarks = "Good"; } if (round($performance, 1) >= 70 && round($performance, 1) < 80) { $remarks = "Normal"; } if (round($performance, 1) >= 60 && round($performance, 1) < 70) { $remarks = "Average"; } if (round($performance, 1) >= 50 && round($performance, 1) < 60) { $remarks = "Bad"; $poor[$allowed_subjects[$i]] = $performance; } if (round($performance, 1) < 50) { $remarks = "Go Out"; $poor[$allowed_subjects[$i]] = $performance; } } $tr .= '<tr> <td style="text-align:center;">' . ($i + 1) . '</td> <td style="text-align:center;"> <b><small>' . $allowed_subjects[$i] . '</small></b> </td> <td style="text-align:center;"> <b>' . $tnoc . '</b> </td> <td style="text-align:center;" class="text-success"><b> ' . $subjectwise[$allowed_subjects[$i] . "_P"] . '</b> </td> <td style="text-align:center;" class="text-error"><b> ' . $subjectwise[$allowed_subjects[$i] . "_A"] . ' </b></td> <td style="text-align:center;" class="text-' . $st . '"><b>' . $performance . '</b></td> <td style="text-align:center;" class="text-' . $st . '"><b><small>' . $remarks . '</small></b></td> </tr>'; $datasetp .= "<set name='" . $allowed_subjects[$i] . "' value='" . round($performance, 1) . "' color='" . $colors[$i] . "'/>"; } $strXML .= $datasetp . "</graph>"; if ($nc_cls != count($allowed_subjects)) { echo '<br><h5 class="text-info">Chart Based Attendance Representaiton for Student - ' . $userid . '</h5><br>'; echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380); echo <<<table_head \t\t<h5 class="text-info"> Subject Wise Attendance Representation for Student - {$userid}</h5><br> \t\t<table class="table table-hover table-bordered " style="padding:0px;"> \t\t\t<thead> \t\t\t\t<tr> \t\t\t\t<th style="text-align:center;" rowspan="2" valign="top"> SNo </th> <th style="text-align:center;" valign="top"> Subject </th> <th style="text-align:center;" > Classes </th> <th style="text-align:center;" > Presents </th> <th style="text-align:center;" > Absents </th> <th style="text-align:center;" > Performance </th> <th style="text-align:center;" > Remarks </th> \t\t\t\t</tr> \t\t\t</thead> \t\t\t<tbody> table_head; echo $tr; echo <<<tableend \t\t\t</tbody> \t\t</table> \t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>×</a><strong>CNYS </strong>: Classes Not Yet Started </div> \t<br> tableend; $st2 = ""; //print_r($poor); foreach ($poor as $key => $value) { $st2 .= $key . " "; } if (count($poor) != 0) { echo "<script type='text/javascript'>show_error('Your Attendance is Poor in {$st2} ');</script>"; } } else { echo "<br><br><h6 class='text-error text-center'> No Submissions Found<br></h6>"; } } /* End of SUbjects Wise Attendance*/ /* Checking for Wrong Keyword */ if (strtolower($_SERVER["QUERY_STRING"]) != "sub" and strtolower($_SERVER["QUERY_STRING"]) != "p") { echo "<script type='text/javascript'>document.location.href='./?sub';</script>"; } /* End of Checking for Wrong Keyword */ } /* End of Checking wheter he is a student or any other */ /////////////////////*********************/////////////// /* Start Checking wheter he is a CR or any other */ if ($type == "CR" or $type == "SA") { $branch2 = $branch . $class; /* Starting Period Wise Attendance */ if (strtolower($_SERVER["QUERY_STRING"]) == "p") { ////mysql_select_db($branchyear."_Dates") or die(mysql_error()); $query = mysql_query("Select Date from " . $branch . $class . "_Dates where P1_Con = 'ok' or P2_Con = 'ok' or P3_Con = 'ok' or P4_Con = 'ok';"); $nofd = mysql_num_rows($query); if ($nofd != 0) { $p = array("P1_A" => 0, "P1_P" => 0, "P2_A" => 0, "P2_P" => 0, "P3_A" => 0, "P3_P" => 0, "P4_A" => 0, "P4_P" => 0); $stats = array("Total" => 0, "Presents" => 0, "Absents" => 0); $strXML = "<graph caption='Period Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Periods' yAxisName='Performance'>"; $datasetp = ''; while ($dates = mysql_fetch_array($query)) { //mysql_select_db($branchyear."_Attendance") or die(mysql_error()); $q = mysql_query("select `" . $dates[0] . "` from " . $branch . $class . "_Attendance where RNo='" . $RNo . "';"); while ($res = mysql_fetch_array($q)) { $values = explode(",", $res[0]); for ($i = 0; $i < count($values) - 1; $i++) { if (substr($values[$i], -1) == "P") { $stats["Presents"] += 1; $stats["Total"] += 1; } if (substr($values[$i], -1) == "A") { $stats["Absents"] += 1; $stats["Total"] += 1; } $p[$values[$i]] += 1; } } } $tr = ''; for ($i = 1; $i <= 4; $i++) { @($st = round($p["P" . $i . "_P"] / $nofd, 1) * 100 <= 50 ? "error" : "success"); @($tr .= '<tr> <td style="text-align:center;">' . $i . '</td> <td style="text-align:center;"> P' . $i . ' </td> <td style="text-align:center;"><b> ' . $nofd . '</b> </td> <td style="text-align:center;" class="text-success"><b> ' . $p["P" . $i . "_P"] . ' </b></td> <td style="text-align:center;" class="text-success"><b> ' . round($p["P" . $i . "_P"] / $nofd, 1) . ' </b></td> <td style="text-align:center;" class="text-error"><b> ' . $p["P" . $i . "_A"] . ' </b></td> <td style="text-align:center;" class="text-error"><b> ' . round($p["P" . $i . "_A"] / $nofd, 1) . ' </b></td> <td style="text-align:center;" class="text-' . $st . '"><b><small> ' . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . ' % </small></b></td> </tr>'); @($datasetp .= "<set name='P" . $i . "' value='" . round($p["P" . $i . "_P"] / $nofd, 1) * 100 . "' color='" . $colors[$i] . "'/>"); } $strXML .= $datasetp . "</graph>"; echo '<br><h5 class="text-info">Chart Based Attendance Representaiton for CR ' . $branch2 . ' - ' . $userid . '</h5><br>'; echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380); echo <<<table_head \t\t<h5 class="text-info"> Period Wise Attendance Representation for CR - {$userid} </h5><br> \t\t<table class="table table-hover table-bordered " style="padding:0px;"> \t\t\t<thead> \t\t\t\t<tr> \t\t\t\t<th style="text-align:center;" valign="top"> SNo </th> <th style="text-align:center;" valign="top"> Period </th> <th style="text-align:center;" > Days </th> <th style="text-align:center;" > Presents </th> <th style="text-align:center;" > P/Day </th> <th style="text-align:center;" > Absents </th> <th style="text-align:center;" > A/Day </th><th style="text-align:center;" > Performance </th> \t\t\t\t</tr> \t\t\t</thead> \t\t\t<tbody> table_head; echo $tr; echo <<<tableend \t\t\t</tbody> \t\t</table> \t\t</table> \t\t<br> \t\t<table class='table table-hover table-bordered ' > \t\t<tr> \t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th> \t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th> \t\t</tr> \t\t<tr> \t\t\t<th><center>P/Day</center></th><td> No. of Presents for Day</td>\t \t\t\t<th><center>A/Day</center></th><td> No. of Absents for Day</td> \t\t</tr> \t\t \t\t </table> \t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>×</a><strong>CNYS </strong>: Classes Not Yet Started </div> \t<br> tableend; } else { echo "<br><br><h6 class='text-error text-center'> No Submissions Found<br></h6>"; } } /* End of Period Wise Attendance*/ /* SUbjects Wise Attendance */ if (strtolower($_SERVER["QUERY_STRING"]) == "sub") { $branch2 = $branch . $class; //mysql_select_db($branchyear."_Subjects") or die(mysql_error()); $query = mysql_query("Select * from " . $branch . $class . "_Subjects where RNo='{$RNo}';") or die(mysql_error()); $subjectwise = mysql_fetch_array($query); $tr = ''; $strXML = "<graph caption='Subject Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Subjects' yAxisName='Performance'>"; $datasetp = ""; $nc_cls = 0; $poor = array(); for ($i = 0; $i < count($allowed_subjects); $i++) { $tnoc = $subjectwise[$allowed_subjects[$i] . "_P"] + $subjectwise[$allowed_subjects[$i] . "_A"]; if ($tnoc == 0) { $nc_cls++; $performance = "N/A "; $st = "error"; $remarks = "CNYS"; } else { $performance = $subjectwise[$allowed_subjects[$i] . "_P"] / $tnoc * 100; $performance = round($performance, 1) . " %"; $st = $performance <= 50 ? "error" : "success"; if (round($performance, 1) >= 95) { $remarks = "Excellent"; } if (round($performance, 1) >= 90 && round($performance, 1) < 95) { $remarks = "Very Good"; } if (round($performance, 1) >= 80 && round($performance, 1) < 90) { $remarks = "Good"; } if (round($performance, 1) >= 70 && round($performance, 1) < 80) { $remarks = "Normal"; } if (round($performance, 1) >= 60 && round($performance, 1) < 70) { $remarks = "Average"; } if (round($performance, 1) >= 50 && round($performance, 1) < 60) { $remarks = "Bad"; $poor[$allowed_subjects[$i]] = $performance; } if (round($performance, 1) < 50) { $remarks = "Go Out"; $poor[$allowed_subjects[$i]] = $performance; } } $tr .= '<tr> <td style="text-align:center;">' . ($i + 1) . '</td> <td style="text-align:center;"> <b><small>' . $allowed_subjects[$i] . '</small></b> </td> <td style="text-align:center;"> <b>' . $tnoc . '</b> </td> <td style="text-align:center;" class="text-success"><b> ' . $subjectwise[$allowed_subjects[$i] . "_P"] . '</b> </td> <td style="text-align:center;" class="text-error"><b> ' . $subjectwise[$allowed_subjects[$i] . "_A"] . ' </b></td> <td style="text-align:center;" class="text-' . $st . '"><b>' . $performance . '</b></td> <td style="text-align:center;" class="text-' . $st . '"><b><small>' . $remarks . '</small></b></td> </tr>'; $datasetp .= "<set name='" . $allowed_subjects[$i] . "' value='" . round($performance, 1) . "' color='" . $colors[$i] . "'/>"; } $strXML .= $datasetp . "</graph>"; if ($nc_cls != count($allowed_subjects)) { echo '<br><h5 class="text-info">Chart Based Attendance Representaiton for CR ' . $branch2 . ' - ' . $userid . '</h5><br>'; echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380); echo <<<table_head \t\t<h5 class="text-info"> Subject Wise Attendance Representation for CR - {$userid}</h5><br> \t\t<table class="table table-hover table-bordered " style="padding:0px;"> \t\t\t<thead> \t\t\t\t<tr> \t\t\t\t<th style="text-align:center;" rowspan="2" valign="top"> SNo </th> <th style="text-align:center;" valign="top"> Subject </th> <th style="text-align:center;" > Classes </th> <th style="text-align:center;" > Presents </th> <th style="text-align:center;" > Absents </th> <th style="text-align:center;" > Performance </th> <th style="text-align:center;" > Remarks </th> \t\t\t\t</tr> \t\t\t</thead> \t\t\t<tbody> table_head; echo $tr; echo <<<tableend \t\t\t</tbody> \t\t</table> \t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>×</a><strong>CNYS </strong>: Classes Not Yet Started </div> \t<br> tableend; $st2 = ""; //print_r($poor); foreach ($poor as $key => $value) { $st2 .= $key . " "; } if (count($poor) != 0) { echo "<script type='text/javascript'>show_error('Your Attendance is Poor in {$st2} ');</script>"; } } else { echo "<br><br><h6 class='text-error text-center'> No Submissions Found<br></h6>"; } } /* End of SUbjects Wise Attendance*/ /* Checking for Wrong Keyword */ if (strtolower($_SERVER["QUERY_STRING"]) != "sub" and strtolower($_SERVER["QUERY_STRING"]) != "p" and strtolower($_SERVER["QUERY_STRING"]) != strtolower($branch . $class . "/p") and strtolower($_SERVER["QUERY_STRING"]) != strtolower($branch . $class . "/sub")) { echo "<script type='text/javascript'>document.location.href='./?sub';</script>"; } /* End of Checking for Wrong Keyword */ } /* End of Checking wheter he is a CR or any other */ ////////////////////////////////****************//////////////// if ($type == "BA" or $type == "CR") { /* Start of Class Period Wise Attendance */ if (strtolower($_SERVER["QUERY_STRING"]) == strtolower($branch . $class . "/p")) { $branch2 = $branch . $class; //mysql_select_db($branchyear."_Dates") or die(mysql_error()); $query = mysql_query("Select Date from " . $branch . $class . "_Dates where P1_Con = 'ok' or P2_Con = 'ok' or P3_Con = 'ok' or P4_Con = 'ok';"); $nofd = mysql_num_rows($query); if ($nofd != 0) { $p = array("P1_A" => 0, "P1_P" => 0, "P2_A" => 0, "P2_P" => 0, "P3_A" => 0, "P3_P" => 0, "P4_A" => 0, "P4_P" => 0); $stats = array("Total" => 0, "Presents" => 0, "Absents" => 0); $strXML = "<graph caption='Period Wise Attendance Report of {$branch} {$class}' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Periods' yAxisName='Performance'>"; $datasetp = ''; while ($dates = mysql_fetch_array($query)) { //mysql_select_db($branchyear."_Attendance") or die(mysql_error()); $count_q = mysql_query("select count(`RNo`) from " . $branch . $class . "_Attendance;"); $countclass = mysql_fetch_array($count_q); $classcount = $countclass[0]; for ($init = 1; $init <= $classcount; $init++) { //mysql_select_db($branchyear."_Attendance") or die(mysql_error()); $q = mysql_query("select `" . $dates[0] . "` from " . $branch . $class . "_Attendance where RNo='" . $init . "';"); while ($res = mysql_fetch_array($q)) { $values = explode(",", $res[0]); for ($i = 0; $i < count($values) - 1; $i++) { if (substr($values[$i], -1) == "P") { $stats["Presents"] += 1; $stats["Total"] += 1; } if (substr($values[$i], -1) == "A") { $stats["Absents"] += 1; $stats["Total"] += 1; } $p[$values[$i]] += 1; } } } } $tr = ''; for ($i = 1; $i <= 4; $i++) { @($st = round($p["P" . $i . "_P"] / $nofd, 1) * 100 <= 50 ? "error" : "success"); @($tr .= '<tr> <td style="text-align:center;">' . $i . '</td> <td style="text-align:center;"> P' . $i . ' </td> <td style="text-align:center;"><b> ' . $nofd . '</b> </td> <td style="text-align:center;" class="text-success"><b> ' . $p["P" . $i . "_P"] . ' </b></td> <td style="text-align:center;" class="text-success"><b> ' . round($p["P" . $i . "_P"] / $nofd, 1) . ' </b></td> <td style="text-align:center;" class="text-error"><b> ' . $p["P" . $i . "_A"] . ' </b></td> <td style="text-align:center;" class="text-error"><b> ' . round($p["P" . $i . "_A"] / $nofd, 1) . ' </b></td> <td style="text-align:center;" class="text-' . $st . '"><b> <small>' . round($p["P" . $i . "_P"] / $nofd / $classcount * 100, 1) . ' %</small> </b></td> </tr>'); @($datasetp .= "<set name='P" . $i . "' value='" . round($p["P" . $i . "_P"] / $nofd / $classcount * 100, 1) . "' color='" . $colors[$i] . "'/>"); } $strXML .= $datasetp . "</graph>"; echo '<br><h5 class="text-info">Chart Based Periods Attendance Representaiton for Class ' . $branch2 . '</h5><br>'; echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380); echo <<<table_header \t \t<table class="table table-hover table-bordered " style="padding:0px;"> \t <thead> \t\t<tr> \t\t<th style="text-align:center;" valign="top"> SNo </th> \t\t<th style="text-align:center;" valign="top"> Periods </th> \t\t<th style="text-align:center;" > Classes </th> \t\t<th style="text-align:center;" > Presents </th> \t\t<th style="text-align:center;" > P/C </th> \t\t<th style="text-align:center;" > Absents </th> \t\t<th style="text-align:center;" > A/C </th> \t\t<th style="text-align:center;" > Performance </th> \t\t</tr> \t </thead> \t <tbody> table_header; echo $tr; echo <<<tableend \t\t\t</tbody> \t\t</table> \t\t<br> \t\t<table class='table table-hover table-bordered ' > \t\t<tr> \t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th> \t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th> \t\t</tr> \t\t<tr> \t\t\t<th><center>P/C</center></th><td> No. of Presents for Class</td>\t \t\t\t<th><center>A/C</center></th><td> No. of Absents for Class</td> \t\t</tr> \t\t \t\t </table> \t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>×</a><strong>CNYS </strong>: Classes Not Yet Started </div> \t<br> tableend; } else { echo "<br><br><h6 class='text-error text-center'> No Submissions Found<br></h6>"; } } /* End of Class Period Wise Attendance */ /* Start of Class Subject Wise Attendance */ if (strtolower($_SERVER["QUERY_STRING"]) == strtolower($branch . $class . "/sub")) { $branch2 = $branch . $class; $tr = ''; $strXML = "<graph caption='Subject Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Subjects' yAxisName='Performance'>"; $datasetp = ""; $nc_cls = 0; for ($i = 0; $i < count($allowed_subjects); $i++) { //mysql_select_db($branchyear."_Subjects") or die(mysql_error()); $queryp = mysql_query("Select sum(`" . $allowed_subjects[$i] . "_P`) as " . $allowed_subjects[$i] . "_P from " . $branch . $class . "_Subjects;"); $querya = mysql_query("Select sum(`" . $allowed_subjects[$i] . "_A`) as " . $allowed_subjects[$i] . "_A from " . $branch . $class . "_Subjects;"); $resultp1 = mysql_fetch_array($queryp); $resulta1 = mysql_fetch_array($querya); $resultp = $resultp1[0]; $resulta = $resulta1[0]; //mysql_select_db($branch."09_Subjects"); $tn = mysql_fetch_array(mysql_query("select `" . $allowed_subjects[$i] . "_P`,`" . $allowed_subjects[$i] . "_A` from " . $branch . $class . "_Subjects;")) or die(mysql_error()); $tnoc = $tn[0] + $tn[1]; if ($tnoc == 0) { $nc_cls++; $performance = 0; $performance1 = "N/A "; $st = "error"; $remarks = "CNYS"; } else { $performance = $resultp / ($resultp + $resulta) * 100; $performance1 = round($performance, 1) . " %"; $st = $performance <= 50 ? "error" : "success"; if (round($performance, 1) >= 95) { $remarks = "Excellent"; } if (round($performance, 1) >= 90 && round($performance, 1) < 95) { $remarks = "Very Good"; } if (round($performance, 1) >= 80 && round($performance, 1) < 90) { $remarks = "Good"; } if (round($performance, 1) >= 70 && round($performance, 1) < 80) { $remarks = "Normal"; } if (round($performance, 1) >= 60 && round($performance, 1) < 70) { $remarks = "Average"; } if (round($performance, 1) >= 50 && round($performance, 1) < 60) { $remarks = "Bad"; } if (round($performance, 1) < 50) { $remarks = "Go Out"; } } $tr .= '<tr> <td style="text-align:center;"> <small>' . ($i + 1) . '</small> </td> <td style="text-align:center;"> <small>' . $allowed_subjects[$i] . '</small> </td> <td style="text-align:center;"><b> <small>' . $tnoc . '</small></b> </td> <td style="text-align:center; class="text-success""><b><small> ' . $resultp . ' </small></b></td> <td style="text-align:center;" class="text-success"><b> <small>' . ($resultp != 0 ? round($resultp / $tnoc, 1) : 0) . '</small> </b></td> <td style="text-align:center;" class="text-error"><b> <small>' . $resulta . ' </small></b></td> <td style="text-align:center;" class="text-error"><b><small> ' . ($resulta != 0 ? round($resulta / $tnoc, 1) : 0) . '</small> </b></td> <td style="text-align:center;" class="text-' . $st . '"><b> <small>' . $performance1 . '</small> </b></td> <td style="text-align:center;" class="text-' . $st . '"><b> <small>' . $remarks . '</small> </b></td> </tr>'; $datasetp .= "<set name='" . $allowed_subjects[$i] . "' value='" . $performance . "' color='" . $colors[$i] . "'/>"; } $strXML .= $datasetp . "</graph>"; if ($nc_cls != count($allowed_subjects)) { echo '<br><h5 class="text-info">Chart Based Subjects Attendance Representaiton for Class ' . $branch2 . '</h5><br>'; echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380); echo <<<table_header \t<table class="table table-hover table-bordered " style="padding:0px;"> \t<thead> \t<tr> \t<th style="text-align:center;" valign="top"> SNo </th> \t<th style="text-align:center;" valign="top"> Subject </th> \t<th style="text-align:center;" > Classes </th> \t<th style="text-align:center;" > Presents </th> \t<th style="text-align:center;" > P/C </th> \t<th style="text-align:center;" > Absents </th> \t<th style="text-align:center;" > A/C </th> \t<th style="text-align:center;" > Performance </th> \t<th style="text-align:center;" > Remarks </th> \t</tr> \t</thead> \t<tbody> table_header; echo $tr; echo <<<tableend \t\t\t</tbody> \t\t</table> \t\t<table class='table table-hover table-bordered ' > \t\t<tr> \t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th> \t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th> \t\t</tr> \t\t<tr> \t\t\t<th><center>P/C</center></th><td> No. of Presents for Class</td>\t \t\t\t<th><center>A/C</center></th><td> No. of Absents for Class</td> \t\t</tr> \t\t \t\t </table> \t\t \t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>×</a><strong>CNYS </strong>: Classes Not Yet Started </div> \t<br> tableend; } else { echo "<br><br><h6 class='text-error text-center'> No Submissions Found<br></h6>"; } } /* End of Class Subject Wise Attendance */ } /* Start Checking wheter he is a Branch Admin or any other */ if ($type == "BA") { /* Starting Period Wise Attendance */ if ($_SERVER["QUERY_STRING"] == "p") { $p = array(); $nofday = array(); $stats = array("Total" => 0, "Presents" => 0, "Absents" => 0); $strXML = "<graph caption='Class Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='0' numberSuffix='%' xAxisName='Classes' yAxisName='Performance'>"; $class_period = array(); $noofperiods = array(); $cn = 0; for ($cln = 1; $cln < $classno + 1; $cln++) { //mysql_select_db($branchyear."_Dates") or die(mysql_error()); $query = mysql_query("Select Date from " . $branch . $cln . "_Dates where P1_Con = 'ok' or P2_Con = 'ok' or P3_Con = 'ok' or P4_Con = 'ok';") or die("Here"); $nofday[$branch . $cln] = mysql_num_rows($query); if ($nofday[$branch . $cln] == 0) { $cn++; } $class_period[$branch . $cln] = array("P1_A" => 0, "P1_P" => 0, "P2_A" => 0, "P2_P" => 0, "P3_A" => 0, "P3_P" => 0, "P4_A" => 0, "P4_P" => 0); $p[$branch . $cln] = array("A" => 0, "P" => 0); $noofperiods[$branch . $cln] = 0; while ($dates = mysql_fetch_array($query)) { //mysql_select_db($branchyear."_Attendance") or die(mysql_error()); $q = mysql_query("select `" . $dates[0] . "` from " . $branch . $cln . "_Attendance;"); $cou = 0; while ($res = mysql_fetch_array($q)) { $values = explode(",", $res[0]); if ($cou == 0) { $noofperiods[$branch . $cln] = $noofperiods[$branch . $cln] + (count($values) - 1); } $cou++; for ($i = 0; $i < count($values) - 1; $i++) { if (substr($values[$i], -1) == "P") { $stats["Presents"] += 1; $stats["Total"] += 1; $p[$branch . $cln]["P"] += 1; $class_period[$branch . $cln][$values[$i]]++; } if (substr($values[$i], -1) == "A") { $stats["Absents"] += 1; $stats["Total"] += 1; $p[$branch . $cln]["A"] += 1; $class_period[$branch . $cln][$values[$i]]++; } } } } } $tr = ''; $datasetp = ''; for ($i = 1; $i <= $classno; $i++) { @($ab_per = round($p[$branch . $i]["A"] / $noofperiods[$branch . $i], 1) <= 0 ? 'NA' : round($p[$branch . $i]["A"] / $noofperiods[$branch . $i], 1)); @($ab_day = round($p[$branch . $i]["A"] / $nofday[$branch . $i], 1) <= 0 ? 'NA' : round($p[$branch . $i]["A"] / $nofday[$branch . $i], 1)); @($pre_per = round($p[$branch . $i]["P"] / $noofperiods[$branch . $i], 1) <= 0 ? 'NA' : round($p[$branch . $i]["P"] / $noofperiods[$branch . $i], 1)); @($pre_day = round($p[$branch . $i]["P"] / $nofday[$branch . $i], 1) <= 0 ? 'NA' : round($p[$branch . $i]["P"] / $nofday[$branch . $i], 1)); @($perform = round($p[$branch . $i]["P"] / ($p[$branch . $i]["P"] + $p[$branch . $i]["A"]) * 100, 1)); if ($nofday[$branch . $i] == 0 || $noofperiods[$branch . $i] == 0) { $st = "error"; $remarks = "CNYS"; } else { $st = $p[$branch . $i]["P"] / ($p[$branch . $i]["P"] + $p[$branch . $i]["A"]) * 100 <= 50 ? 'error' : 'success'; if ((int) $perform >= 95) { $remarks = "Excellent"; } if ((int) $perform >= 90 && (int) $perform < 95) { $remarks = "VGood"; } if ((int) $perform >= 80 && (int) $perform < 90) { $remarks = "Good"; } if ((int) $perform >= 70 && (int) $perform < 80) { $remarks = "Normal"; } if ((int) $perform >= 60 && (int) $perform < 70) { $remarks = "Average"; } if ((int) $perform >= 50 && (int) $perform < 60) { $remarks = "Bad"; } if ((int) $perform < 50) { $remarks = "Go Out"; } } $tr .= '<tr> <td style="text-align:center;">' . $i . '</td> <td style="text-align:center;"><small>' . $branch . " " . $i . '</small></td> <td style="text-align:center;"><small>' . $nofday[$branch . $i] . '</small></td> <td style="text-align:center;"><small>' . $noofperiods[$branch . $i] . '</small></td> <td style="text-align:center;">4</td> <td style="text-align:center;" class="text-error"><b> <small>' . $p[$branch . $i]["A"] . '</small></b> </td> <td style="text-align:center;" class="text-error"><b> <small>' . $ab_per . '</small> </b></td> <td style="text-align:center;" class="text-error"><b> <small>' . $ab_day . '</small> </b></td> <td style="text-align:center;" class="text-success"><b><small> ' . $p[$branch . $i]["P"] . '</small></b> </td> <td style="text-align:center;" class="text-success"><b> <small>' . $pre_per . ' </small></b></td> <td style="text-align:center;" class="text-success"><b> <small>' . $pre_day . ' </small></b></td> <td style="text-align:center;" class="text-' . $st . '"><b> <small>' . round($perform, 0) . '%</small></b></td> <td style="text-align:center;" class="text-' . $st . '"><b> <small>' . $remarks . ' </small></b></td> </tr>'; $datasetp .= "<set name='" . $branch . $i . "' value='" . round($perform, 0) . "' color='" . $colors[$i] . "'/>"; } $strXML .= $datasetp . "</graph>"; if ($cn != $classno) { echo '<br><h5 class="text-info">Graph based Period Attendance representation for ' . $globalbranch . '</h5>'; echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380); echo <<<tabhead \t\t<h5 class="text-info">Table based data representation </h5><br> \t <table class="table table-hover table-bordered " style="padding:0px;"> \t <thead> \t\t<tr> \t\t<th style="text-align:center;" valign="top"> SNo </th> \t\t<th style="text-align:center;" valign="top"> Class </th> \t\t<th style="text-align:center;" valign="top"> Days </th> \t\t<th style="text-align:center;" valign="top"> Periods </th> \t\t<th style="text-align:center;" valign="top"> P/Day </th> \t\t<th style="text-align:center;" > A </th> \t\t<th style="text-align:center;" > A/P </th> \t\t<th style="text-align:center;" > A/D </th> \t\t<th style="text-align:center;" > P </th> \t\t<th style="text-align:center;" > P/P </th> \t\t<th style="text-align:center;" > P/D </th> \t\t<th style="text-align:center;" > % </th> \t\t<th style="text-align:center;" > Remarks </th> \t\t</tr> \t\t \t </thead> \t <tbody> tabhead; echo $tr; echo <<<tableend \t\t\t\t</tbody> \t\t\t</table> \t\t\t<br> \t\t\t<table class='table table-hover table-bordered ' > \t\t<tr> \t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th> \t\t\t<th\t><center>Short Name</center></th><th> <center>Long Name</center></th> \t\t</tr> \t\t<tr> \t\t\t<th><center>P</center></th><td> No. of Presents</td>\t \t\t\t<th><center>P/D</center></th><td> No. of Presents for Day</td> \t\t</tr> \t\t<tr>\t \t\t\t<th><center>A</center></th><td> No. of Absents</td> \t\t\t<th><center>A/D</center></th><td> No of Absents for Day</td> \t\t</tr> \t\t<tr>\t \t\t\t<th><center>P/P</center></th><td> No. of Absents for Periods</td> \t\t\t<th><center>A/P</center></th><td> No of Absents for Periods</td> \t\t</tr> \t\t<tr>\t \t\t\t<th><center>P/Day</center></th><td> No. of Periods for Day</td> \t\t\t<th><center>%</center></th><td> Performace in %</td> \t\t</tr> \t\t </table> \t\t\t<br><div class='alert alert-info'><a class='close' data-dismiss='alert'>×</a><strong>CNYS </strong>: Classes Not Yet Started </div> \t<br> tableend; } else { echo "<br><br><h6 class='text-error text-center'> No Submissions Found<br></h6>"; } } /* End of Period Wise Attendance*/ /* Start of Subject Wise Attendance */ if ($_SERVER["QUERY_STRING"] == "sub") { $tr = ''; $strXML = "<graph caption='Subject Wise Attendance Report' formatNumberScale='1' rotateValues='1' decimalPrecision='1' numberSuffix='%' xAxisName='Subjects' yAxisName='Performance'>"; $datasetp = ""; $sub_per = array(); $cnt = 0; for ($j = 1; $j <= $classno; $j++) { $sub_per[$branch . $j] = array(); for ($i = 0; $i < count($allowed_subjects); $i++) { //mysql_select_db($branchyear."_Subjects") or die(mysql_error()); $queryp = mysql_query("Select sum(`" . $allowed_subjects[$i] . "_P`) as " . $allowed_subjects[$i] . "_P from " . $branch . $j . "_Subjects;"); //die $querya = mysql_query("Select sum(`" . $allowed_subjects[$i] . "_A`) as " . $allowed_subjects[$i] . "_A from " . $branch . $j . "_Subjects;"); //die @($resultp1 = mysql_fetch_array($queryp)); //die @($resulta1 = mysql_fetch_array($querya)); //die $resultp = $resultp1[0]; $resulta = $resulta1[0]; if ($resultp + $resulta == 0) { $cnt++; } @($sub_per[$branch . $j][$allowed_subjects[$i]] = $resultp / ($resultp + $resulta) * 100); } } if ($cnt != $classno * count($allowed_subjects)) { for ($k = 1; $k <= $classno; $k++) { $tr .= '<tr> <td style="text-align:center;"> ' . $k . ' </td> <td style="text-align:center;"><small> ' . $branch . $k . '</small> </td>'; $sub_count = 0; for ($l = 0; $l < count($allowed_subjects); $l++) { if (round($sub_per[$branch . $k][$allowed_subjects[$l]], 1) == 0) { $sub_count++; } @($tr .= '<td style="text-align:center;"><b> ' . round($sub_per[$branch . $k][$allowed_subjects[$l]], 1) . '</b> </td>'); } @($tr .= '<td style="text-align:center; class="text-success""><b> ' . round(array_sum($sub_per[$branch . $k]) / abs(count($allowed_subjects) - $sub_count), 1) . ' </b></td> '); @($performance = round(array_sum($sub_per[$branch . $k]) / abs(count($allowed_subjects) - $sub_count), 1)); $st = $performance <= 50 ? "error" : "success"; if (round($performance, 1) >= 95) { $remarks = "Excellent"; } if (round($performance, 1) >= 90 && round($performance, 1) < 95) { $remarks = "Very Good"; } if (round($performance, 1) >= 80 && round($performance, 1) < 90) { $remarks = "Good"; } if (round($performance, 1) >= 70 && round($performance, 1) < 80) { $remarks = "Normal"; } if (round($performance, 1) >= 60 && round($performance, 1) < 70) { $remarks = "Average"; } if (round($performance, 1) >= 50 && round($performance, 1) < 60) { $remarks = "Bad"; } if (round($performance, 1) < 50) { $remarks = "Go Out"; } //echo $sub_count; @($tr .= '<td style="text-align:center;" class="text-' . $st . '"><b><small> ' . $remarks . ' </small></b></td> </tr>'); @($datasetp .= "<set name='" . $branch . $k . "' value='" . array_sum($sub_per[$branch . $k]) / abs(count($allowed_subjects) - $sub_count) . "' color='" . $colors[$k] . "'/>"); } $strXML .= $datasetp . "</graph>"; $branch2 = $branch . $class; echo '<br><h5 class="text-info">Graph based Subjects Attendance representation for ' . $globalbranch . ' </h5>'; echo renderChart("assets/charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 380); echo <<<table_header \t<h5 class="text-info">Table based data representation </h5><br> \t<table class="table table-hover table-bordered " style="padding:0px;"> \t<thead> \t<tr> \t<th style="text-align:center;" valign="top"> SNo </th> \t<th style="text-align:center;" valign="top"> Class </th> table_header; for ($i = 0; $i < count($allowed_subjects); $i++) { echo '<th style="text-align:center;" valign="top">' . $allowed_subjects[$i] . '</th>'; } echo <<<table_1 \t<th style="text-align:center;" > % </th> \t<th style="text-align:center;" > Remarks </th> \t</tr> \t</thead> \t<tbody> table_1; echo $tr; echo <<<tableend \t\t\t</tbody> \t\t</table> \t\t<br> tableend; } else { echo "<br><br><h6 class='text-error text-center'> No Submissions Found<br></h6>"; } } /* End of Subject Wise Attendance */ if (strtolower($_SERVER["QUERY_STRING"]) == "") { echo "<script type='text/javascript'>document.location.href='./?sub';</script>"; } } /* End of Checking wheter he is Branch Admin or any other */ echo <<<b \t \t</div> \t</div> \t<div class='span3'> b; sidepanel(); /* Creating a Sidepanel for CR */ /* END Creating a Sidepanel for CR */ echo "</div></div></div>"; display_footer(); echo "\n</body>\n</html>"; } }
function feedback($title) { if (!check_login()) { header("location:login.php"); } else { include 'config/globals.php'; include 'config/db.php'; include 'config/settings.php'; $dbname = $branchyear . '_Logs'; $table = $branchyear . '_Feedback'; //if(!mysql_select_db($dbname)) die(mysql_error()); echo "<!DOCTYPE html>\n<html>\n"; display_headers($title); echo <<<js \t\t\t\t<script type='text/javascript'> \t\t\t\t\tfunction Preview(id,val){ \t\t\t\t\t\tdocument.getElementById(id).innerHTML=val; \t\t\t\t\t} \t\t\t\t</script> js; echo "<body>\n"; menu(); echo <<<feedback \t\t\t<div class="container" style="margin-top:-15px;"> \t\t\t\t\t<br> \t\t\t\t\t<div id="error"></div> \t\t\t\t\t<div class="row"> \t\t\t\t\t\t<div class="span9"> \t\t\t\t\t\t\t<div class="well well-large" style="background:#FFF;"> \t\t\t\t\t\t\t\t<div id="stpe2_P1"> \t\t\t\t\t\t\t\t\t<h5>Give Feedback </h5> \t\t\t\t\t\t\t\t\t<h6>     -   Fill out below details </h6> \t\t\t\t\t\t\t\t\t<!--<h5>Period 1 : </h5>--> \t\t\t\t\t\t\t\t\t<form method="POST" action="" onSubmit="return give_feedback();" > \t\t\t\t\t\t\t\t\t\t<h6 > Feedback Type :</h6> \t\t\t\t\t\t\t\t\t\t<label class="radio inline"> \t\t\t\t\t\t\t\t\t\t<input type="radio" id='complaint' value="Complaint" name="ftype" onclick="Preview(this.name,this.value);"> Complaint \t\t\t\t\t\t\t\t\t</label> \t\t\t\t\t\t\t\t\t<label class="radio inline"> \t\t\t\t\t\t\t\t\t\t<input type="radio" id='suggestion' value="Suggestion" name="ftype" onclick="Preview(this.name,this.value);"> Suggestion \t\t\t\t\t\t\t\t\t</label><br><br> \t\t\t\t\t\t\t\t<h6> Subject :</h6> \t\t\t\t\t\t\t\t<input type="text" class="span8" placeholder="Subject" id='subject' name='sub' onkeyup="Preview(this.name,this.value);"><br> \t\t\t\t\t\t\t\t<h6> Message :</h6> \t\t\t\t\t\t\t\t<textarea class="span8" id='feedback' name='fb' style="resize:vertical;height:90px;" onkeyup="Preview(this.name,this.value);" placeholder="Type your complaint/suggestion here"></textarea> \t\t\t\t<br> \t\t\t</div> \t\t\t<div id="stpe3"> \t\t\t\t<a ><h5>Preview </h5></a> \t\t\t\t<!--<h6>     -   Confirm Your Notice </h6>--> \t\t\t\t<div class="row"> \t\t\t\t\t<div class="span8"> \t\t\t\t\t\t<table class="table table-hover table-bordered" > \t\t\t\t\t\t\t<tbody> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<th class="span2" > Feedback Type </th> \t\t\t\t\t\t\t\t\t<td class='span6' id='ftype'> Complaint/Suggestion </td> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t<th class="span2" > Suject </th> \t\t\t\t\t\t\t\t<td class="span6" id='sub'> Feedback subject </td> \t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t<th class="span2" > Feedback </th> \t\t\t\t\t\t\t\t<td class="span6" id='fb'> Complaint/Suggestion </td> \t\t\t\t\t\t\t</tr> \t\t\t\t\t\t</tbody> \t\t\t\t\t</table> \t\t\t\t</div> \t\t\t</div><br> \t\t\t<input type="submit" class="btn btn-primary" value="Confirm & Send →" name="post" /> \t\t\t</form> \t\t</div> \t\t<br> \t</div> </div> feedback; echo "<div class='span3'>"; go_home(); sidepanel(); echo "</div></div>"; display_footer(); echo "\n</body>\n</html>"; } }
function changecr($title) { if (!check('CR')) { header('location:login.php'); } else { include 'config/globals.php'; $p = $_SERVER['QUERY_STRING']; $reg = "/^" . $globalbranch . "[1-" . $classno . "]{1}\$/"; if (preg_match($reg, $p)) { include 'config/db.php'; include 'config/settings.php'; $dbname = $branchyear . '_Users'; $table = $branchyear . '_Students'; //if(!mysql_select_db($dbname)) die(mysql_error()); $userid = $_SESSION['UserId']; $q = "select Branch,Class from {$table} where Id = '{$userid}'"; $res = mysql_query($q) or die(mysql_error()); $row = mysql_fetch_array($res); $branch = $row['Branch']; $class1 = $row['Class']; $class = substr($p, -1); if ($class != $class1) { echo "Your not from {$branch} {$class}"; } else { echo "<!DOCTYPE html>\n<html>\n"; display_headers($title); echo "\n<body>"; menu(); $array = array_merge(range(0, 9)); shuffle($array); $crkey = ""; for ($i = 0; $i < 6; $i++) { $crkey .= $array[$i]; } echo <<<a \t\t\t\t\t<div class='container'> \t\t\t\t\t\t<div id="error" style="display:none;"></div> \t\t\t\t\t\t<div class='row'> \t\t\t\t\t\t\t<div class='span9'> \t\t\t\t\t\t\t\t<div class="well well-large" style="background:#FFF;height:450px;"> a; if (isset($_POST["Generate"])) { $id = addslashes($_POST['IdNo']); $key = addslashes($_POST['Key']); $Skey = addslashes($_POST['Skey']); $dbname = $branchyear . '_Users'; $table = $branchyear . '_Students'; //if(!mysql_select_db($dbname)) die(mysql_error()); $userid1 = $_SESSION['UserId']; $userid = $id; $q = "select Name,Branch,Class,Gender from {$table} where Id = '{$userid}'"; $res = mysql_query($q) or die(mysql_error()); $row = mysql_fetch_array($res); $name = ucwords(strtolower($row['Name'])); $branch = $row['Branch']; $class2 = $row['Class']; $dbname = $branchyear . '_Users'; $table = $branchyear . '_CRs'; //if(!mysql_select_db($dbname)) die(mysql_error()); $q = "select Id,`Key` from {$table} where Id = '{$userid1}'"; $res = mysql_query($q) or die(mysql_error()); $row = mysql_fetch_array($res); $key1 = $row['Key']; if ($key1 != $Skey) { echo "<script>show_error('<b>Error </b> : CR Security Key does not matched. Please try again.. ');</script>"; } else { if ($class2 == $class) { $dbname = $branchyear . '_Logs'; $table = $branchyear . '_Passwords'; //if(!mysql_select_db($dbname)) die(mysql_error()); $q = "select `EndTime`, `Code` from `{$table}` where `To` = '{$userid}';"; $res = mysql_query($q) or die(mysql_error()); $n = mysql_num_rows($res); $StartTime = date('d-m-Y H:i:s'); $end = ""; $dif = 0; $code = ""; while ($row = mysql_fetch_array($res)) { $end = $row['EndTime']; $dif = strtotime($end) - strtotime($StartTime); $code = $row['Code']; } if ($dif <= 7200 && $dif > 0 && $n) { echo "<script>show_error('<b>Error </b> : <b>{$userid}</b> is already assigned <b class=\\'text-success\\'>{$code}</b> till <b class=\\'text-success\\'>{$end}</b> ');</script>"; } else { $EndTime = date('d-m-Y H:i:s', mktime(date('H') + 2)); $ip = $_SERVER['REMOTE_ADDR']; $q1 = mysql_query("insert into {$table} ( `To`, `Code`, `CreatedBy`, `StartTime`,`EndTime`, `Status`,`IP` ) values ( '{$id}', '{$key}' , '{$userid1}', '{$StartTime}', '{$EndTime}', 'valid','{$ip}');") or die(mysql_error()); insert_log($_SESSION['UserId'] . "created security key for {$id} "); echo "<script>show_success('To change password of {$id} use the security pin <u class=\\'text-error\\'>{$key}</u> valid up to <u class=\\'text-error\\'>{$EndTime}</u> ');</script>"; } } else { echo "<script>show_error('<b>Error </b> : <b>{$userid}</b> is not from the <b>{$branch} {$class} </b> Please try again.. ');</script>"; } } } echo <<<a \t\t\t\t\t\t<div id="step1"> \t\t\t\t\t\t\t<h4>Security Codes @ {$branch} {$class} </h4> \t\t\t\t\t\t\t<h6>      Provide requesting Student Id </h6> \t\t\t\t\t\t \t\t\t\t\t\t\t<form action="?{$p}" method="POST" onsubmit="return check_id();" id="password"> \t\t\t\t\t\t\t<br> \t\t\t\t\t\t\t<h5>Student ID No : </h5> \t\t\t\t\t\t\t<input type="text" class="input-large" placeholder="N090001" id="Idno" name="IdNo" maxlength="7" /><br> \t\t\t\t\t\t\t<h5>Your Security Key : </h5> \t\t\t\t\t\t\t<input type="text" class="input-large" placeholder="Security Key" id="Skey" name="Skey" maxlength="9" /><br> \t\t\t\t\t\t\t<!--<h5>Security Key : </h5>--> \t\t\t\t\t\t\t<input type="hidden" class="input-large" readonly=readonly name="Key" value="{$crkey}" > \t\t\t\t\t\t\t<br><input type="submit" class="btn btn-primary" name="Generate" value = "Continue →" /> \t\t\t\t\t\t\t</form>\t \t\t\t\t\t\t\t \t\t\t\t\t\t</div> \t\t\t\t\t</div> \t\t\t\t</div> \t\t\t\t<div class='span3'> a; go_home(); sidepanel(); echo <<<a \t\t\t</div> \t\t\t</div> \t\t\t \t\t\t</div> \t\t\t</div> \t\t\t a; echo "</div></div>"; display_footer(); echo "\n</body>\n</html>"; } } else { echo "<script type='text/javascript'>document.location.href='404.php';</script>"; } } }
\t\t\t<option value=''>Gender</option> \t\t\t<option value="M">Boys</option> \t\t\t<option value="F">Girsl</option> \t\t\t</select> \t\t</div> \t</div><br> \t<input type="submit" class="btn btn-primary " name='view' value='Browse →' /><br><br><br> \t</form> a; } else { echo '<br><br>'; //print_r($_POST); $branch1 = $globalbranch; $class1 = addslashes($_POST['cls']); $gender1 = addslashes($_POST['Gender']); if (strlen(trim($class1)) == 0) { echo "<script>show_error('Error : Class should not be null');</script>"; exit; } if (strlen(trim($gender1)) == 0) { echo "<script>show_error('Error : CR Gender should not be null');</script>"; exit; } viewcr($branch1, $class1, $gender1); } echo "</div></div><div class='span3'>"; sidepanel(); echo "</div></div>"; display_footer(); echo "\n</body>\n</html>"; }
function display_feedback($title) { if (!check('SA') and !check('BA')) { header("location:./?sub"); } else { include 'config/globals.php'; $pg = $_SERVER['QUERY_STRING']; $page = '/^[\\d]+$/'; if (preg_match($page, $pg)) { include 'config/db.php'; include 'config/settings.php'; $dbname = $branchyear . '_Logs'; $table = $branchyear . '_Feedback'; //if(!mysql_select_db($dbname)) die(mysql_error()); echo "<!DOCTYPE html>\n<html>\n"; display_headers($title); echo "<body>\n"; menu(); echo <<<display \t\t\t\t <br><div class="container" style="margin-top:-15px;"> \t\t\t\t\t <div class="row"> \t\t\t\t\t\t<div class="span9"> \t\t\t\t\t\t\t<div class="well well-large" style="background:#FFF;"> \t\t\t\t\t\t\t\t<div class="row"> \t\t\t\t\t\t\t\t\t<div id="step1" class="span4"> \t\t\t\t\t\t\t\t\t\t<h5>Feedback</h5> \t\t\t\t\t\t\t\t\t\t<h6>     -   Listing all complaints and suggestions </h6> \t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t<div id="page1" class="span4"> \t\t\t\t\t\t\t\t\t\t<a class="pull-right"><h6>Page {$pg}</h6></a> \t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t</div> display; //if(!mysql_select_db($dbname)) die(mysql_error()); $query = "SELECT * From " . $table . " ORDER BY SNo DESC;"; $exe = mysql_query($query) or die(mysql_error()); $page = $pg; $prev = $page - 1; $next = $page + 1; $per_page = 10; $slimit = ($page - 1) * 10; $total = mysql_num_rows($exe); $lastpage = ceil($total / $per_page); $query1 = "SELECT * FROM " . $table . " ORDER BY SNo DESC LIMIT {$slimit},{$per_page};"; $exe1 = mysql_query($query1) or die(mysql_error()); if ($total > 0) { echo <<<table \t\t\t\t\t<div id='{$globalbranch}' > \t\t\t\t\t\t<table class="table table-hover table-bordered " style="padding:0px;"> \t\t\t\t\t\t\t<thead> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span1">Date</th> \t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span4">Subject</th> \t\t\t\t\t\t\t\t\t<th style="text-align:center;" class="span1">Sender</th> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t</thead> \t\t\t\t\t\t\t<tbody> \t\t\t\t\t\t\t table; for ($i = 0; $i < mysql_num_rows($exe1); $i++) { $record = mysql_fetch_array($exe1); $datetime = explode(' ', $record['DateTime']); $date = $datetime[0]; echo <<<feedback \t\t\t<tr data-toggle='modal' href="#Note{$record['0']}" style="cursor:pointer;" > \t\t\t\t<td style="text-align:center;">{$date}</td> \t\t\t\t<td >{$record['2']}</td> \t\t\t\t<td style="text-align:center;"> {$record['4']} </td> \t\t\t </tr>\t \t\t\t\t\t feedback; } echo <<<feedback \t\t\t\t</tbody> \t\t\t\t</table> \t\t\t\t</div> \t\t\t\t feedback; $query2 = "SELECT * FROM " . $table . " ORDER BY SNo DESC LIMIT {$slimit},{$per_page};"; $exe2 = mysql_query($query2) or die(mysql_error()); for ($i = 0; $i < mysql_num_rows($exe1); $i++) { $record = mysql_fetch_array($exe2); $datetime = explode(' ', $record['DateTime']); $date = $datetime[0]; if (preg_match("/<br>/", $record[3])) { $record[3] = str_replace("<br>", "<br>", $record[3]); } echo <<<feedback \t\t\t\t<div id="Note{$record['0']}" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="useridlabel" aria-hidden="true"> \t\t\t\t\t<div class="modal-header"> \t\t\t\t\t\t<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> \t\t\t\t\t\t<h5>{$record['2']}</h5> \t\t\t\t\t</div> \t\t\t\t\t<div class="modal-body"> \t\t\t\t\t\t<p>{$record['3']}</p> \t\t\t\t\t</div> \t\t\t\t\t<div class="modal-footer"> \t\t\t\t\t\t<h6 class="pull-left">{$record['1']} sent by<i> {$record['4']} </i> @ {$record['5']} </h6> \t\t\t\t\t</div> \t\t\t\t</div>\t\t feedback; } echo <<<page \t\t\t<div class="pagination pagination-centered"> \t\t\t\t<ul> page; if ($page < $total / 10 + 1) { if ($page != 1) { echo "<li><a href='?{$prev}'>← Prev</a></li>"; } else { echo "<li class='disabled'><a>← Prevt</a></li>"; } if ($lastpage <= 10) { for ($i = 1; $i <= $lastpage; $i++) { if ($page == $i) { echo "<li class='active'><a href='?{$i}'><b class='text-error'> {$i}</b></a></li>"; } else { echo "<li><a href='?{$i}'>{$i}</a></li>"; } } } else { $init1 = $page % 10 == 0 ? (floor($page / 10) - 1) * 10 + 1 : floor($page / 10) * 10 + 1; // total no of records total pages pages range //echo $page/10; echo $lastpage/10; $end1 = floor(($page - 1) / 10) == floor($lastpage / 10) ? $lastpage : ceil($page / 10) * 10; for ($i = $init1; $i <= $end1; $i++) { if ($page == $i) { echo "<li class='active'><a href='?{$i}'><b class='text-error'> {$i}</b></a></li>"; } else { echo "<li><a href='?{$i}'>{$i}</a></li>"; } } } if ($page != $lastpage) { echo "<li><a href='?{$next}'>Next →</a></li>"; } else { echo "<li class='disabled'><a>Next →</a></li>"; } } else { echo "<script>show_error('No notifications found');</script>"; } echo <<<next \t\t\t\t\t\t</ul> \t\t\t\t\t\t</div> \t\t\t\t\t\t \t\t\t\t\t\t\t next; } else { echo "<center><p>No complaints/suggestions found.</p></center>"; } echo "</div></div><div class='span3'>"; go_home(); sidepanel(); echo "</div></div>"; display_footer(); echo "\n</body>\n</html>"; } else { echo "<script type='text/javascript'>document.location.href='404.php';</script>"; } } }