/** * http://stackoverflow.com/a/4128377/2790481 * * @param $needle * @param $courses * @param bool $strict * @return bool */ function getMajor($needle, $majors, $strict = false) { foreach ($majors as $major) { if (($strict ? $major === $needle : $major == $needle) || is_array($major) && getMajor($needle, $major, $strict)) { return $major; } } return false; }
$row = mysql_fetch_row($rs); $rsA = $COMMON->executeQuery($sql, $_SERVER["SCRIPT_NAME"]); if ($row) { while ($row = mysql_fetch_row($rsA)) { if ($row[2] == 0) { $advName = "Group"; } else { $advName = getAdvisorName($row); } $found = "<tr><td>" . date('l, F d, Y g:i A', strtotime($row[1])) . "</td>" . "<td>" . $advName . "</td>" . "<td>" . $row[3] . "</td></tr>" . array_push($results, $found); } } } } else { foreach ($times as $t) { $sql = "select * from Proj2Appointments where `Time` like '%{$date}%' and `Time` > '" . date('Y-m-d H:i:s') . "' and `Time` like '%{$t}%' and `AdvisorID` like '%{$advisor}%' and `EnrolledNum` = 0 and `Major` like '%" . getMajor() . "%' order by `Time` ASC Limit 30"; $rs = $COMMON->executeQuery($sql, $_SERVER["SCRIPT_NAME"]); $row = mysql_fetch_row($rs); if ($row) { while ($row = mysql_fetch_row($rs)) { if ($row[2] == 0) { $advName = "Group"; } else { $advName = getAdvisorName($row); } $found = "<tr><td>" . date('l, F d, Y g:i A', strtotime($row[1])) . "</td>" . "<td>" . $advName . "</td>" . "<td>" . $row[3] . "</td></tr>" . array_push($results, $found); } } } } }
?> >Theatre</option> <option <?php if (getMajor() == 'Visual Arts') { echo "selected"; } ?> >Visual Arts</option> <option <?php if (getMajor() == 'Undecided') { echo "selected"; } ?> >Undecided</option> <option <?php if (getMajor() == 'Other') { echo "selected"; } ?> >Other</option> --> </select> </div> <div class="nextButton"> <input type="submit" name="save" class="button large go" value="Save"> </div> </div> </form> </body> </html>
<?php session_start(); include 'GetStudentData.php'; $debug = false; $COMMON = new Common($debug); if (isset($_POST["advisor"])) { // Put student's advisor into Proj2Student table $tempAdvisor = $_POST["advisor"]; $sql = "update `Proj2Students` set `Advisor`= '{$tempAdvisor}' where `id` = 55"; $rs = $COMMON->executeQuery($sql, $_SERVER["SCRIPT_NAME"]); } $localAdvisor = getAdvisor(); $localMaj = getMajor(); $sql = "select * from Proj2Advisors where `id` = '{$localAdvisor}'"; $rs = $COMMON->executeQuery($sql, $_SERVER["SCRIPT_NAME"]); $row = mysql_fetch_row($rs); $advisorName = $row[1] . " " . $row[2]; ?> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Select Appointment</title> <link rel='stylesheet' type='text/css' href='css/standard.css'/> </head> <body> <div id="login"> <div id="form"> <div class="top">
} } } else { // for every result found, output to the user foreach ($times as $t) { $sql = "select * from Proj2Appointments where `Time` like '%{$date}%' and `Time` > '" . date('Y-m-d H:i:s') . "' and `Time` like '%{$t}%' and `AdvisorID` like '%{$advisor}%' and `EnrolledNum` = 0 and `Major` like '%" . $_SESSION['major'] . "%' order by `Time` ASC Limit 30"; $rs = $COMMON->executeQuery($sql, $_SERVER["SCRIPT_NAME"]); $row = mysql_fetch_row($rs); if ($row) { while ($row = mysql_fetch_row($rs)) { if ($row[2] == 0) { $advName = "Group"; } else { $advName = getAdvisorName($row); } $majors = getMajor($row[3]); $found = "<tr><td>" . date('l, F d, Y g:i A', strtotime($row[1])) . "</td>" . "<td>" . $advName . "</td>" . "<td>" . $majors . "</td>" . array_push($results, $found); } } } } } // if nothing found, print the instance of no results found for search filters set by user if (empty($results)) { echo "No results found.<br><br>"; } else { echo "<table border='1'><th colspan='3'>Appointments Available</th>\n"; echo "<tr><td width='60px'>Time:</td><td>Advisor</td><td>Major</td></tr>\n"; foreach ($results as $r) { echo $r . "\n"; }
$stmt->execute(); if($stmt->rowCount() == 0){die;} $student = $stmt->fetch(); $dateObj = DateTime::createFromFormat('!m', $student['grad_month']); $monthName = $dateObj->format('F'); // March ?> <div class="container"> <!-- Portfolio Item Heading --> <div class="row"> <div class="col-lg-12"> <h1 class="page-header"><?=$student['first_name']." ".$student['last_name']?> <small> <?=getMajor($student['major'])?> <h5>Anticipated Graduation Date: <?=$monthName?> <?=$student['grad_year']?></h5> </small> </h1> </div> </div> <!-- /.row --> <!-- Portfolio Item Row --> <div class="row"> <div class="col-md-4"> <img class="img-responsive" src="http://rufflifechicago.com/wp-content/uploads/cat-treats.jpg" alt=""> <div class="social-links"> <?php foreach(unserialize($student['social']) as $key => $value){ ?> <a href="<?=$value?>" target="_blank"><i class="fa fa-<?=$key?>"></i></a> <? } ?>
<link rel='stylesheet' type='text/css' href='css/standard.css'/> </head> <body> <div id="login"> <div id="form"> <div class="top"> <h1>Confirm Appointment</h1> <div class="field"> <form action = "StudProcessSch.php" method = "post" name = "SelectTime"> <?php $debug = false; include 'GetStudentData.php'; $COMMON = new Common($debug); $firstn = getFirstName(); $lastn = getLastName(); $studid = $_SESSION["studID"]; $major = getMajor(); $email = getEmail(); if ($_SESSION["resch"] == true) { $sql = "select * from Proj2Appointments where `EnrolledID` like '%{$studid}%'"; $rs = $COMMON->executeQuery($sql, $_SERVER["SCRIPT_NAME"]); $row = mysql_fetch_row($rs); $oldAdvisorID = $row[2]; $oldDatephp = strtotime($row[1]); if ($oldAdvisorID != 0) { $sql2 = "select * from Proj2Advisors where `id` = '{$oldAdvisorID}'"; $rs2 = $COMMON->executeQuery($sql2, $_SERVER["SCRIPT_NAME"]); $row2 = mysql_fetch_row($rs2); $oldAdvisorName = $row2[1] . " " . $row2[2]; } else { $oldAdvisorName = "Group"; }