NoID10ts
aka Noddy
Are any of you PHQ/MySQL wizards?
<?php require_once('Connections/jms_portal.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "1,2,3,4";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && false) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
// technocurve arc 3 php mv block1/3 start
$mocolor1 = "#E7CEFF";
$mocolor2 = "#F7F7F7";
$mocolor3 = "#C1BEDE";
$mocolor = $mocolor1;
// technocurve arc 3 php mv block1/3 end
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$currentPage = $_SERVER["PHP_SELF"];
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "am")) {
$user=($_SESSION['MM_Username']);
$id=($_POST['lab_id']);
$updateSQL = sprintf("UPDATE lab103 SET AMTutorial='$user' WHERE `lab_id`=$id",
GetSQLValueString(isset($_POST['amsubmit']), "text"),
GetSQLValueString($_POST['lab_id'], "int"));
mysql_select_db($database_jms_portal, $jms_portal);
$Result1 = mysql_query($updateSQL, $jms_portal) or die(mysql_error());
$updateGoTo = "lab103.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if((isset($_POST["MM_insert2"])) && ($_POST["MM_insert2"] == "one")) {
$user=($_SESSION['MM_Username']);
$id=($_POST['lab_id']);
$updateSQL = sprintf("UPDATE lab103 SET oneFive='$user' WHERE `lab_id`=$id",
GetSQLValueString(isset($_POST['onesubmit']), "text"),
GetSQLValueString($_POST['lab_id'], "int"));
mysql_select_db($database_jms_portal, $jms_portal);
$Result1 = mysql_query($updateSQL, $jms_portal) or die(mysql_error());
$updateGoTo = "lab103.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if((isset($_POST["MM_insert3"])) && ($_POST["MM_insert3"] == "spark")) {
$user=($_SESSION['MM_Username']);
$id=($_POST['lab_id']);
$updateSQL = sprintf("UPDATE lab103 SET SPARK='$user' WHERE `lab_id`=$id",
GetSQLValueString(isset($_POST['sparksubmit']), "text"),
GetSQLValueString($_POST['lab_id'], "int"));
mysql_select_db($database_jms_portal, $jms_portal);
$Result1 = mysql_query($updateSQL, $jms_portal) or die(mysql_error());
$updateGoTo = "lab103.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if((isset($_POST["MM_insert4"])) && ($_POST["MM_insert4"] == "two")) {
$user=($_SESSION['MM_Username']);
$id=($_POST['lab_id']);
$updateSQL = sprintf("UPDATE lab103 SET twoSix='$user' WHERE `lab_id`=$id",
GetSQLValueString(isset($_POST['twosubmit']), "text"),
GetSQLValueString($_POST['lab_id'], "int"));
mysql_select_db($database_jms_portal, $jms_portal);
$Result1 = mysql_query($updateSQL, $jms_portal) or die(mysql_error());
$updateGoTo = "lab103.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if((isset($_POST["MM_insert5"])) && ($_POST["MM_insert5"] == "three")) {
$user=($_SESSION['MM_Username']);
$id=($_POST['lab_id']);
$updateSQL = sprintf("UPDATE lab103 SET threeSeven='$user' WHERE `lab_id`=$id",
GetSQLValueString(isset($_POST['threesubmit']), "text"),
GetSQLValueString($_POST['lab_id'], "int"));
mysql_select_db($database_jms_portal, $jms_portal);
$Result1 = mysql_query($updateSQL, $jms_portal) or die(mysql_error());
$updateGoTo = "lab103.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if((isset($_POST["MM_insert6"])) && ($_POST["MM_insert6"] == "four")) {
$user=($_SESSION['MM_Username']);
$id=($_POST['lab_id']);
$updateSQL = sprintf("UPDATE lab103 SET fourEight='$user' WHERE `lab_id`=$id",
GetSQLValueString(isset($_POST['foursubmit']), "text"),
GetSQLValueString($_POST['lab_id'], "int"));
mysql_select_db($database_jms_portal, $jms_portal);
$Result1 = mysql_query($updateSQL, $jms_portal) or die(mysql_error());
$updateGoTo = "lab103.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if((isset($_POST["MM_insert7"])) && ($_POST["MM_insert7"] == "pm")) {
$user=($_SESSION['MM_Username']);
$id=($_POST['lab_id']);
$updateSQL = sprintf("UPDATE lab103 SET PMTutorial='$user' WHERE `lab_id`=$id",
GetSQLValueString(isset($_POST['pmsubmit']), "text"),
GetSQLValueString(isset($_POST['lab_id']), "int"));
mysql_select_db($database_jms_portal, $jms_portal);
$Result1 = mysql_query($updateSQL, $jms_portal) or die(mysql_error());
$updateGoTo = "lab103.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
?>
<?php
if($_SESSION['MM_UserGroup'] == '4'){
require_once('nav_tech.dwt.php');
}
elseif($_SESSION['MM_UserGroup'] == '3'){
require_once('nav_admin.dwt.php');
}
elseif($_SESSION['MM_UserGroup'] == '2'){
require_once('nav_faculty.dwt.php');
}
elseif($_SESSION['MM_UserGroup'] == '1'){
require_once('nav_teach.dwt.php');
}
?>
<?php
$maxRows_lab103 = 30;
$pageNum_lab103 = 0;
if (isset($_GET['pageNum_lab103'])) {
$pageNum_lab103 = $_GET['pageNum_lab103'];
}
$startingRow = date("Y-m-d");
$startRow_lab103 = $pageNum_lab103 * $maxRows_lab103;
mysql_select_db($database_jms_portal, $jms_portal);
$query_lab103 = "SELECT * FROM `lab103` WHERE `Date` >= '$startingRow'";
$query_limit_lab103 = sprintf("%s LIMIT %d, %d", $query_lab103, $startRow_lab103, $maxRows_lab103);
$lab103 = mysql_query($query_limit_lab103, $jms_portal) or die(mysql_error());
$row_lab103 = mysql_fetch_assoc($lab103);
if (isset($_GET['totalRows_lab103'])) {
$totalRows_lab103 = $_GET['totalRows_lab103'];
} else {
$all_lab103 = mysql_query($query_lab103);
$totalRows_lab103 = mysql_num_rows($all_lab103);
}
$totalPages_lab103 = ceil($totalRows_lab103/$maxRows_lab103)-1;
$queryString_lab103 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_lab103") == false &&
stristr($param, "totalRows_lab103") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_lab103 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_lab103 = sprintf("&totalRows_lab103=%d%s", $totalRows_lab103, $queryString_lab103);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>JMS Portal - Lab 103</title>
<style type="text/css">
<!--
.style1 {font-size: x-large}
.style2 {font-size: medium}
.style3 {font-size: large}
.style4 {color: #FF0000}
body {
background-color: #CCCCCC;
}
-->
</style></head>
<body>
<table width="941" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td colspan="2">
<p align="center"><span class="style1"><u>Lab 103</u></span></p>
<ul>
<li><strong align="center"> Computer Lab 103 has 30 student computers, 1 teacher computer, a ceiling mounted projector, and a SMARTboard</strong></li>
<li><strong><u><span class="style4">Clean Slate is installed on all computers in the 103 </span></u> so all saving must be done to the resource drive (johnston-rs02) or in the "My Documents" folder with the student profile. If you do not have a folder on the resource drive please contact <a href="<A href="mailto:csmith35@houstonisd.org">Ches">mailto:csmith35@houstonisd.org">Ches Smith </a></strong></li>
<li><strong>To reserve a lab just check the date and period you need and click reserve if it is available</strong></li>
<li><strong>If you decide you do not need the lab later, just click on your username to cancel it </strong></li>
</ul>
<table width="887" border="2" align="center">
<tr bgcolor=#EBF3FE>
<th width="121" scope="col"><span class="style2">Date</span></th>
<th width="100" scope="col"><span class="style2">AM Tutorial</span></th>
<th width="100" scope="col"><span class="style2">1st/5th</span></th>
<th width="100" scope="col"><span class="style2">SPARK</span></th>
<th width="100" scope="col"><span class="style2">2nd/6th</span></th>
<th width="100" scope="col"><span class="style2">3rd/7th</span></th>
<th width="100" scope="col"><span class="style2">4th/8th</span></th>
<th width="100" scope="col"><span class="style2">PM Tutorial </span></th>
</tr>
<?php do { ?>
<tr <?php
// technocurve arc 3 php mv block2/3 start
echo " style=\"background-color:$mocolor\" onMouseOver=\"this.style.backgroundColor='$mocolor3'\" onMouseOut=\"this.style.backgroundColor='$mocolor'\"";
// technocurve arc 3 php mv block2/3 end
?> >
<td><?php
if($row_lab103['Day']=="Purple Day") {
echo "<b>$row_lab103[Date]</b>";
}
elseif($row_lab103['Day']=="Purple Day (ED)") {
echo "<b>$row_lab103[Date] (ED)</b>";
}
elseif($row_lab103['Day']=="Gray Day"){
echo "<b>$row_lab103[Date]</b>";
}
elseif($row_lab103['Day']=="Gray Day (ED)") {
echo "<b>$row_lab103[Date] (ED)</b>";
}
?></td>
<form id="am" name="am" method="POST" action="<?php echo $editFormAction; ?>">
<td><div align="center">
<?php
if($row_lab103['AMTutorial'] == NULL){
echo "<input name='amsubmit' type='submit' id='amsubmit' value='Reserve'>";
echo "<input type='hidden' name='lab_id' value='$row_lab103[lab_id]'>";
echo "<input type='hidden' name='MM_insert' value='am'>";
}
elseif($row_lab103['AMTutorial']==$_SESSION['MM_Username']){
echo "<a href='delete103.php?lab_id1=$row_lab103[lab_id]'><b><i><font color=purple>$_SESSION[MM_Username]</i></b></a>";
}
elseif($_SESSION['MM_UserGroup']=='4'){
echo "<a href='delete103.php?lab_id1=$row_lab103[lab_id]'><b><i><font color=purple>$row_lab103[AMTutorial]</i></b></a>";
}
else {
echo "<b><i><font color=purple>$row_lab103[AMTutorial]</i></b>";
}
?>
</div></td>
</form>
<form id="one" name="one" method="POST" action="<?php echo $editFormAction; ?>">
<td><div align="center">
<?php
if($row_lab103['oneFive'] == NULL){
echo "<input name='onesubmit' type='submit' id='onesubmit' value='Reserve'>";
echo "<input type='hidden' name='lab_id' value='($row_lab103[lab_id])'>";
echo "<input type='hidden' name='MM_insert2' value='one'>";
}
elseif($row_lab103['oneFive']==$_SESSION['MM_Username']){
echo "<a href='delete103.php?lab_id2=$row_lab103[lab_id];'><b><i><font color=purple>$_SESSION[MM_Username]</i></b></a>";
}
elseif($_SESSION['MM_UserGroup']=='4'){
echo "<a href='delete103.php?lab_id2=$row_lab103[lab_id]'><b><i><font color=purple>$row_lab103[oneFive]</i></b></a>";
}
else {
echo "<b><i><font color=purple>$row_lab103[oneFive]</i></b>";
}
?>
</div></td>
</form>
<form id="spark" name="spark" method="POST" action="<?php echo $editFormAction; ?>">
<td><div align="center">
<?php
if($row_lab103['SPARK'] == NULL){
echo "<input name='sparksubmit' type='submit' id='sparksubmit' value='Reserve'>";
echo "<input type='hidden' name='lab_id' value='$row_lab103[lab_id]'>";
echo "<input type='hidden' name='MM_insert3' value='spark'>";
}
elseif($row_lab103['SPARK']==$_SESSION['MM_Username']){
echo "<a href='delete103.php?lab_id3=$row_lab103[lab_id];'><b><i><font color=purple>$_SESSION[MM_Username]</i></b></a>";
}
elseif($_SESSION['MM_UserGroup']=='4'){
echo "<a href='delete103.php?lab_id3=$row_lab103[lab_id]'><b><i><font color=purple>$row_lab103[SPARK]</i></b></a>";
}
else {
echo "<b><i><font color=purple>$row_lab103[SPARK]</i></b>";
}
?>
</div></td>
</form>
<form id="two" name="two" method="POST" action="<?php echo $editFormAction; ?>">
<td><div align="center">
<?php
if($row_lab103['twoSix'] == NULL){
echo "<input name='twosubmit' type='submit' id='twosubmit' value='Reserve'>";
echo "<input type='hidden' name='lab_id' value='$row_lab103[lab_id]'>";
echo "<input type='hidden' name='MM_insert4' value='two'>";
}
elseif($row_lab103['twoSix']==$_SESSION['MM_Username']){
echo "<a href='delete103.php?lab_id4=$row_lab103[lab_id];'><b><i><font color=purple>$_SESSION[MM_Username]</i></b></a>";
}
elseif($_SESSION['MM_UserGroup']=='4'){
echo "<a href='delete103.php?lab_id4=$row_lab103[lab_id]'><b><i><font color=purple>$row_lab103[twoSix]</i></b></a>";
}
else {
echo "<b><i><font color=purple>$row_lab103[twoSix]</i></b>";
}
?>
</div></td>
</form>
<form id="three" name="three" method="POST" action="<?php echo $editFormAction; ?>">
<td><div align="center">
<?php
if($row_lab103['threeSeven'] == NULL){
echo "<input name='threesubmit' type='submit' id='threesubmit' value='Reserve'>";
echo "<input type='hidden' name='lab_id' value='$row_lab103[lab_id]'>";
echo "<input type='hidden' name='MM_insert5' value='three'>";
}
elseif($row_lab103['threeSeven']==$_SESSION['MM_Username']){
echo "<a href='delete103.php?lab_id5=$row_lab103[lab_id];'><b><i><font color=purple>$_SESSION[MM_Username]</i></b></a>";
}
elseif($_SESSION['MM_UserGroup']=='4'){
echo "<a href='delete103.php?lab_id5=$row_lab103[lab_id]'><b><i><font color=purple>$row_lab103[threeSeven]</i></b></a>";
}
else {
echo "<b><i><font color=purple>$row_lab103[threeSeven]</i></b>";
}
?>
</div></td>
</form>
<form id="four" name="four" method="POST" action="<?php echo $editFormAction; ?>">
<td><div align="center">
<?php
if($row_lab103['fourEight'] == NULL){
echo "<input name='foursubmit' type='submit' id='foursubmit' value='Reserve'>";
echo "<input type='hidden' name='lab_id' value='$row_lab103[lab_id]'>";
echo "<input type='hidden' name='MM_insert6' value='four'>";
}
elseif($row_lab103['fourEight']==$_SESSION['MM_Username']){
echo "<a href='delete103.php?lab_id6=$row_lab103[lab_id];'><b><i><font color=purple>$_SESSION[MM_Username]</i></b></a>";
}
elseif($_SESSION['MM_UserGroup']=='4'){
echo "<a href='delete103.php?lab_id6=$row_lab103[lab_id]'><b><i><font color=purple>$row_lab103[fourEight]</i></b></a>";
}
else {
echo "<b><i><font color=purple>$row_lab103[fourEight]</i></b>";
}
?>
</div></td>
</form>
<form id="pm" name="pm" method="POST" action="<?php echo $editFormAction; ?>">
<td><div align="center">
<?php
if($row_lab103['PMTutorial'] == NULL){
echo "<input name='pmsubmit' type='submit' id='pmsubmit' value='Reserve'>";
echo "<input type='hidden' name='lab_id' value='$row_lab103[lab_id]'>";
echo "<input type='hidden' name='MM_insert7' value='pm'>";
}
elseif($row_lab103['PMTutorial']==$_SESSION['MM_Username']){
echo "<a href='delete103.php?lab_id7=$row_lab103[lab_id];'><b><i><font color=purple>$_SESSION[MM_Username]</i></b></a>";
}
elseif($_SESSION['MM_UserGroup']=='4'){
echo "<a href='delete103.php?lab_id7=$row_lab103[lab_id]'><b><i><font color=purple>$row_lab103[PMTutorial]</i></b></a>";
}
else {
echo "<b><i><font color=purple>$row_lab103[PMTutorial]</i></b>";
}
?>
</div></td>
</form>
</tr>
<?php
// technocurve arc 3 php mv block3/3 start
if ($mocolor == $mocolor1) {
$mocolor = $mocolor2;
} else {
$mocolor = $mocolor1;
}
// technocurve arc 3 php mv block3/3 end
?> <?php } while ($row_lab103 = mysql_fetch_assoc($lab103)); ?>
</table>
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center"><?php if ($pageNum_lab103 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_lab103=%d%s", $currentPage, 0, $queryString_lab103); ?>">First</a>
<?php } // Show if not first page ?>
</td>
<td width="31%" align="center"><?php if ($pageNum_lab103 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_lab103=%d%s", $currentPage, max(0, $pageNum_lab103 - 1), $queryString_lab103); ?>">Previous</a>
<?php } // Show if not first page ?>
</td>
<td width="23%" align="center"><?php if ($pageNum_lab103 < $totalPages_lab103) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_lab103=%d%s", $currentPage, min($totalPages_lab103, $pageNum_lab103 + 1), $queryString_lab103); ?>">Next</a>
<?php } // Show if not last page ?>
</td>
<td width="23%" align="center"><?php if ($pageNum_lab103 < $totalPages_lab103) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_lab103=%d%s", $currentPage, $totalPages_lab103, $queryString_lab103); ?>">Last</a>
<?php } // Show if not last page ?>
</td>
</tr>
</table>
</p>
<p></p>
</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($lab103);
?>
Just tell them to f**k off and stop bothering IT staff with HR issues.Now the only problem I have is that the teachers started complaining that some people were either reserving huge blocks of time, were only reserving so they could babysit (just let the kids play games), or they wouldn't show up for the reservation which left an open lab that could be used by someone else.
Aww that sucks all the fun out of being a bad employee, but at least you're trying to ego trip random people into doing your work for you.And Cog, I wish I could say something like that, but I actually am a school administrator, so there is an hr component to my job especially where computers and computer labs are concerned. I even have to do a bit of training at times.