function getPathRoute() { $base_url = getCurrentUri(); $rarr = explode('/', $base_url); $routes = array(); foreach ($rarr as $route) { if (trim($route) != '') { array_push($routes, $route); } } return $routes; }
<?php session_start(); // Starting Session require 'library/utilities/config.php'; require 'library/functions.inc.php'; require 'header.php'; require LIBRARY_PATH . 'utilities/session_timeout.php'; /* The following function will strip the script name from URL i.e. http://www.something.com/search/book/fitzgerald will become /search/book/fitzgerald */ $baseUrl = getCurrentUri(); $routes = array(); $routes = explode('/', $baseUrl); /* Now, $routes will contain all the routes. $routes[0] will correspond to first route. For e.g. in above example $routes[0] is search, $routes[1] is book and $routes[2] is fitzgerald if($routes[0] == "search") { if($routes[1] == "book") { searchBooksBy($routes[2]); } } else { require('templates/store-header.php'); } */ if ($routes[1] == "store") { require TEMPLATES_PATH . 'header-store.php'; switch ($routes[2]) { case "shop-products":
<?php /** * INDEX * All start here with a routing system * * =========================================================================== */ ?> <?php /** * REQUIRED * Includes functional required files */ require_once dirname(dirname(__FILE__)) . '/resource/library/core.php'; require_once dirname(dirname(__FILE__)) . '/resource/config.php'; /** * URI * Set the current uri */ defined('CURRENT_URI') or define('CURRENT_URI', getCurrentUri()); /** * REQUIRE BASE TEMPLATE */ require_once HTML . 'base.tpl.php';
<nav class="navbar navbar-default"> <div class="container-fluid"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <a class="navbar-brand" href="#">Corvallis Sustainability</a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li class="home"><a href="<?php getCurrentUri(); ?> /homePublic.php">Home</a></li> <li class="business"><a href="<?php getCurrentUri(); ?> /businessesPublic.php">Businesses</a></li> <li class="categories"><a href="<?php getCurrentUri(); ?> /categoriesPublic.php">Categories</a></li> <li class="map"><a href="<?php getCurrentUri(); ?> /mapPublic.php">Map</a></li> </ul> </div><!-- /.navbar-collapse --> </div><!-- /.container-fluid --> </nav>
<?php session_start(); include "configurations/configurations.php"; include "functions/functions.php"; function getCurrentUri() { $basepath = implode('/', array_slice(explode('/', $_SERVER['SCRIPT_NAME']), 0, -1)) . '/'; $uri = substr($_SERVER['REQUEST_URI'], strlen($basepath)); if (strstr($uri, '?')) { $uri = substr($uri, 0, strpos($uri, '?')); } $uri = '/' . trim($uri, '/'); return trim($uri, "/"); } $var = explode("/", getCurrentUri()); if ($var[0] == "") { if (!isset($_SESSION['temperate_uid'])) { include "pages/home/index.html"; } else { showHomePage($connect, $_SESSION['temperate_uid']); } } if ($var[0] == "scan") { include "pages/ScriptCam/index.html"; } if ($var[0] == "authuserthroughjson") { if (isset($_SESSION['auth_pin'])) { if (isset($_POST['pin'])) { $user = $_SESSION['auth_pin']; $query1 = mysqli_query($connect, "SELECT * FROM temperate_accounts WHERE uid = '" . $user . "'");
<?php function getCurrentUri() { $basepath = implode('/', array_slice(explode('/', $_SERVER['SCRIPT_NAME']), 0, -1)) . '/'; $uri = substr($_SERVER['REQUEST_URI'], strlen($basepath)); if (strstr($uri, '?')) { $uri = substr($uri, 0, strpos($uri, '?')); } $uri = '/' . trim($uri, '/'); return $uri; } $base_url = getCurrentUri(); $routes = array(); $routes = explode('/', $base_url); $categoryTMP = ""; /* foreach($routes as $route) { if(trim($route) != '') array_push($routes, $route); }*/ if ($routes[1] == "page") { if (is_numeric($routes[2]) == true) { // /page/int - /page/3 $_GET['pagination'] = (int) $routes[2]; include "index.php"; } else { // /page/int_text - /page/3_testowey%20news/ $id = (int) $routes[2]; $_GET['page'] = $id; include "index.php";
$e = "Select * FROM BillingAddress WHERE id = {$b}"; $f = "Select * FROM ShippingAddress WHERE id = {$c}"; $i = $conn->query($e); $y = mysqli_fetch_assoc($i); // $y Holds an associative array from the BillingAddress // table in the database. $k = $conn->query($f); $z = mysqli_fetch_assoc($k); // $z Holds an associative array from the ShippingAddress // table in the database. } else { $y = $_SESSION['visitor']['billing_address']; $z = $_SESSION['visitor']['shipping_address']; } // Used to return user to current page $returnUrl = getCurrentUri(); ?> <div> <!-- Billing Address Form --> <div class="small-6 columns address-container bill"> <h5 class="address-header">Billing Address</h5> <form data-abide action='<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?> ' method='post' id="billing_adddress" class="small-12 columns address-form"> <div class="row-collapse"> <div class='small-6 columns'> <label>First Name</label> <input id="bill_fname" type='text' name='billing_firstname' required pattern='alpha' placeholder= "Sue" value="<?php
<?php $xmlUrl = "/api/v1/kmsg/stub"; $path = getCurrentUri(); if ($path == $xmlUrl) { return doKmsg(); } else { return fault("10001", "Invalid Endpoint"); } function get_request_json_body() { $input = file_get_contents("php://input"); $input = json_decode($input, TRUE); return $input; } function get_request_xml_body() { $input = file_get_contents("php://input"); //$xml = simplexml_load_string($xmlstring, "SimpleXMLElement", LIBXML_NOCDATA); //$json = json_encode($xml); //$array = json_decode($json,TRUE); $xml = simplexml_load_string($input, null, LIBXML_NOCDATA); $json = json_encode($xml); $array = json_decode($json, TRUE); Header('Content-type: text/xml'); return $array; } function fault($code, $msg) { Header('Content-type: text/xml'); //header("HTTP/1.1 200 OK");
<?php require_once "php/globals.php"; require_once "php/controllers.php"; $requestUri = getCurrentUri(); $routes = getRoutes($requestUri); if (count($routes) < 1) { home_page_controller(); } else { if (isset($routes[0])) { if (strtolower($routes[0]) == "home") { if (!isset($routes[1])) { home_page_controller(); } else { if (isset($routes[1])) { if (strtolower($routes[1]) == "strategy") { strategy_page_controller(); } else { if (strtolower($routes[1]) == "visualization") { visualization_page_controller(); } else { if (strtolower($routes[1]) == "video") { video_page_controller(); } else { if (strtolower($routes[1]) == "training") { training_page_controller(); } else { if (strtolower($routes[1]) == "contact") { contact_page_controller(); } else { if (strtolower($routes[1]) == "spinn") {