APO-Epsilon/apo-website

View on GitHub
session.php

Summary

Maintainability
A
25 mins
Test Coverage
<?php
session_start();
error_reporting(E_ALL);
ini_set('display_errors', 'On');
// Yeah, these are kind of important.  A lot of random pages use them.
// So don't mess with them.  Make sure as you update the semesters you keep them
// the same,  that is don't switch previous_semester to "Fall10" if it was "Fall 2010"

include('mysql_access.php');

    $query = "SELECT * FROM session_vars WHERE current = 1";
    $results=$db->query($query);
    $final=mysqli_fetch_array($results);
    $results->free();
    
$previous_semester = $final['previous_semester'];
$current_semester = $final['current_semester'];
$next_semester = $final['next_semester'];

$previous_year =  $final['previous_year'];
$current_year =  $final['current_year'];

//query that must be adjusted each semester
$total_query = "FROM Spring12Hours UNION SELECT * FROM Fall12Hours UNION SELECT * FROM Spring13Hours UNION SELECT * FROM Fall13Hours UNION SELECT * FROM Spring14Hours UNION SELECT * FROM Fall14Hours UNION SELECT * FROM Spring15Hours UNION SELECT * FROM Fall15Hours UNION SELECT * FROM Spring16Hours UNION SELECT * FROM Fall16Hours UNION SELECT * FROM recorded_hours";

function page_header() {
    // Evil code to force memembers to update their information each new semester.
    // Seriously, evil.  You cannot do anything until you update.
    // -- Stephen Quinn
 global $current_semester;
  if (isset($_SESSION['active_sem'])) {
    if ($_SESSION['active_sem'] != $current_semester) {
      if (($_SERVER["REQUEST_URI"] != "/updateinfo.php?forced=true") AND ($_SERVER["REQUEST_URI"] != "/updateinfo.php")) {
          header( 'Location: ./updateinfo.php' ) ;
      }
    }
  }
}
function exec_links(){
 echo "<div class='entry'><a href='quizdate.php'>Risk Management Quiz Completion date.</a><br/><a href='pledgesummary.php'>Pledge Service Summary.</a><br/><a href='summary.php'>Chapter Service Summary.</a><br/><a href='execmail.php'>Exec e-mail list</a><br/><a href='exec_file_uploader.php'>Exec website file uploader</a><br/><a href='verifyhoursspring07.php'>Check Spring 2007 Service Hours</a><br/><a href='verifyhoursspring08.php'>Check Spring 2008 Service Hours</a><br/><a href='verifyhoursfall08.php'>Check Fall 2008 Service Hours</a></div>";
}
?>

<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-28249243-1']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>