-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
89 lines (81 loc) · 2.41 KB
/
index.php
1
<?phpsession_start();session_regenerate_id(true);if (isset($_GET['p'])) { if ($_GET['p'] == 'auth') { if (isset($_SESSION['user'])) { header('location: ./'); die(); } } $p = $_GET['p'] . '.php'; if (!file_exists($p) || in_array($_GET['p'], array('header', 'footer'))) $p = '404.php';} else { $p = 'home.php';}try { $conn = new PDO('mysql:host=127.0.0.1;dbname=fyp', 'root', '');} catch (PDOException $Exception) { // throw new MyDatabaseException( $Exception->getMessage( ) , $Exception->getCode( ) );}if (isset($_SESSION['user']) && !empty($_SESSION['user'])) { $query = $conn->prepare("SELECT `name` FROM `users` WHERE `id` = ? LIMIT 1;"); $query->execute(array($_SESSION['user'])); $user = $query->fetchAll(PDO::FETCH_ASSOC);}function grav( $email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array() ) { $url = 'http://www.gravatar.com/avatar/'; $url .= md5( strtolower( trim( $email ) ) ); $url .= "?s=$s&d=$d&r=$r"; if ( $img ) { $url = '<img src="' . $url . '"'; foreach ( $atts as $key => $val ) $url .= ' ' . $key . '="' . $val . '"'; $url .= ' />'; } return $url;}?><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>AGROMET | Weather and Soil Data Visualisation System</title> <link href="./css/bootstrap.united.min.css" rel="stylesheet" /> <link href="./css/jquery.tablesorter.pager.css" rel="stylesheet" /> <link href="./css/extras.css" rel="stylesheet" /> <link href="./favicon.ico" rel="icon" type="image/x-icon" /> <script src="./js/jquery-2.1.4.min.js"></script> <script src="./js/bootstrap.min.js"></script> <script src="./js/bootbox.min.js"></script> <script src="http://code.highcharts.com/highcharts.js"></script> <script src="http://code.highcharts.com/highcharts-more.js"></script> <script src="http://code.highcharts.com/modules/data.js"></script> <script src="http://code.highcharts.com/modules/exporting.js"></script></head><body> <div class="container-fluid"> <div class="row"> <?php require_once('header.php'); ?> </div> <div class="row"> <div class="container"> <div class="main"> <?php require_once($p); ?> </div> </div> </div> <div class="row"> <?php require_once('footer.php'); ?> </div> </div> <script src="./js/front.js"></script></body></html>