echo 'info'; break; case 4: echo 'success'; break; } echo '">'; echo '<td class="text-center">' . $row['message'] . '</td>'; echo '<td class="text-center">'; switch ($row['mainpage']) { case 0: echo '<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>'; break; case 1: echo '<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>'; break; } echo '</td>'; echo '<td class="text-center"><a href="#" class="ajax-delete-item" data-table="alerts" data-department="' . $department . '" data-panel="' . $panel . '" id="' . $row['id'] . '"><span class="glyphicon glyphicon-trash" aria-hidden="true" style="color:black"></span></a></td>'; echo '</tr>'; } echo '</tbody> </table>'; } else { echo '<h1 class="text-center" style="margin-top:0px;"><small>There are no ' . $panel . '.</small></h1>'; } } catch (PDOException $ex) { AWESOME_error($ex->getMessage()); } echo '</div></div>'; //end of public stuff
//check the required variables have been posted and set variables to use them if (empty($_GET['panel'])) { $errors['message'] = 'No panel defined'; } if (isset($_GET['panel'])) { $panel = $_GET['panel']; } if (empty($_GET['department'])) { $errors['message'] = 'No department defined'; } if (isset($_GET['department'])) { $department = $_GET['department']; } //if there are errors display a message and stop if (!empty($errors)) { AWESOME_error($errors['message']); exit; } else { //start the main page bit //get the human name of the department from the db $query = $conn->prepare('SELECT humanName FROM departments WHERE name = :name'); $query->bindValue(':name', $department, PDO::PARAM_STR); $query->execute(); $row = $query->fetch(PDO::FETCH_ASSOC); $dephuman = $row['humanName']; //Put navigation breadcrumbs bar at the top echo '<row><div><ol class="breadcrumb"> <li><a class="ajax-link" href="#" data-href-url="admin/dashboard.php?department=' . $department . '">' . $dephuman . '</a></li> <li class="active">' . $panel . '</li> </ol></div></row><div id="message-div"></div> <h1 class="page-header"><small>' . $dephuman . ' ' . $panel . '</small></h1>';
<?php $dbuser = '******'; $dbpass = '******'; $dbhost = 'localhost'; $dbname = 'intranet'; $dbtype = 'mysql'; try { $conn = new PDO($dbtype . ':host=' . $dbhost . ';dbname=' . $dbname, $dbuser, $dbpass); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); } catch (PDOException $e) { AWESOME_error($e); die; }