<?php
require("config.php"); // PDO $pdo
session_start();

if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_POST['action'] === 'Track') {
    $tracking_code = trim($_POST['tracking_code']);

    $stmt = $pdo->prepare("SELECT * FROM packages WHERE tracking_code = :tracking_code");
    $stmt->execute(['tracking_code' => $tracking_code]);
    $loginrow = $stmt->fetch(PDO::FETCH_ASSOC);

    if ($loginrow) {
        if ((int)$loginrow['suspend'] < 1) {
            $_SESSION['SESS_LOGGEDIN'] = 1;
            $_SESSION['SESS_USERID'] = $loginrow['id'];

            // ✅ Show JS alert and redirect after OK
            echo "<script>
                alert('Tracking code found. Click OK to view parcel.');
                window.location.href = 'parcel/track_result.php';
            </script>";
            exit;
        } else {
            // ❌ Suspended account
            echo "<script>alert('Account suspended. Please contact admin.');</script>";
        }
    } else {
        // ❌ Invalid code
        echo "<script>alert('Incorrect Tracking Code.');</script>";
    }
}
?>




<!--==============END====TRACKING=============================-->




<!DOCTYPE html>
<html>
    
<!-- Mirrored from www.savannahtdelivery.com/ by HTTrack Website Copier/3.x [XR&CO'2014], Thu, 02 Jun 2019 06:21:06 GMT -->

<!-- Mirrored from savannahtdelivery.com/ by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 13 May 2019 10:56:48 GMT -->

<!-- Mirrored from ancoxlogservices.com/index.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 01 Feb 2023 05:53:05 GMT -->
<head>
        <title><?php echo $title ?>  </title>
   
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <!-- Stylesheets -->
        <link rel="stylesheet" href="css/bootstrap.css"/><!-- bootstrap grid -->
        <link rel="stylesheet" href="masterslider/style/masterslider.css" /><!-- Master slider css -->
        <link rel="stylesheet" href="masterslider/skins/default/style.css" /><!-- Master slider default skin -->
        <link rel="stylesheet" href="css/animate.css"/><!-- animations -->
        <link rel='stylesheet' href='owl-carousel/owl.carousel.css'/><!-- Client carousel -->
        <link rel="stylesheet" href="css/style.css"/><!-- template styles -->
        <link rel="stylesheet" href="css/color-default.css"/><!-- template main color -->
        <link rel="stylesheet" href="css/retina.css"/><!-- retina ready styles -->
        <link rel="stylesheet" href="css/responsive.css"/><!-- responsive styles -->

        <!-- Google Web fonts -->
        <link href='http://fonts.googleapis.com/css?family=Raleway:400,500,600,700,800' rel='stylesheet' type='text/css'>
        <link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,700italic,400,800,700,600' rel='stylesheet' type='text/css'>

        <!-- Font icons -->
        <link rel="stylesheet" href="icon-fonts/font-awesome-4.5.0/css/font-awesome.min.css"/><!-- Fontawesome icons css -->
        
        <link rel="stylesheet" href="style-switcher/styleSwitcher.css"/><!-- styleswitcher -->
    </head>
    
    <body>
      
    <div class="header-wrapper header-transparent">
            <!-- .header.header-style01 start -->
            <header id="header"  class="header-style01">
                <!-- .container start -->
                <div class="container">
                    <!-- .main-nav start -->
                    <div class="main-nav">
                        <!-- .row start -->
                        <div class="row">
                            <div class="col-md-12">
                                <nav class="navbar navbar-default nav-left" role="navigation">

                                    <!-- .navbar-header start -->
                                    <div class="navbar-header">
                                        <div class="logo">
                                            <a href="index.php">
                                                <img src="img/LOGO.png" alt="logo"/>
                                            </a>
                                        </div><!-- .logo end -->
                                    </div><!-- .navbar-header start -->

                                    <!-- MAIN NAVIGATION -->
                                    <div class="collapse navbar-collapse">
                                        <ul class="nav navbar-nav">
                                            <li class="current-menu-item" >
                                                <a href="index.php" >Home</a>
                                            </li><!-- .dropdown end -->

                                            <li>
                                                <a href="about.php" >About</a>
                                            </li><!-- .dropdown end -->

                                             <li class="dropdown" >
                                                <a href="#" data-toggle="dropdown" class="dropdown-toggle" >Services</a>
                                                 <ul class="dropdown-menu">
                                                            <li><a href="services_overview.php">Services Overview</a></li>
                                                            <li><a href="overland.php">Overland Transportation</a></li>
                                                            <li><a href="airfreight.php">Air freight</a></li>
                                                            <li><a href="oceanfreight.php">Ocean freight</a></li>
                                                            <li><a href="warehouse.php">Ware Housing</a></li>
                                                  </ul><!-- .dropdown-menu end -->
                                            </li><!-- .dropdown end -->

                                            <li >
                                                <a href="track.php" >Track Shipment</a>
                                            </li><!-- .dropdown end -->

                                            <li>
                                                <a href="media.php"  >Media</a>
                                            </li>
                                            
                                            <!--<li><a href="locations.php">Locations</a></li>-->

                                            <li >
                                                <a href="contact.php" >Contact</a>
                                            </li><!-- .dropdown end -->
                                        </ul><!-- .nav.navbar-nav end -->

                                        <!-- RESPONSIVE MENU -->
                                        <div id="dl-menu" class="dl-menuwrapper">
                                            <button class="dl-trigger">Open Menu</button>

                                            <ul class="dl-menu">
                                                <li >
                                                <a href="index.php" >Home</a>
                                            </li><!-- .dropdown end -->

                                            <li class="current-menu-item">
                                                <a href="about.php" >About</a>
                                            </li><!-- .dropdown end -->

                                            <li class="dropdown" >
                                                <a href="#" data-toggle="dropdown" class="dropdown-toggle" >Services</a>
                                                 <ul class="dropdown-menu">
                                                           
                                                  </ul><!-- .dropdown-menu end -->
                                            </li><!-- .dropdown end -->

                                            <li >
                                                <a href="track.php" >Track Shipment</a>
                                            </li><!-- .dropdown end -->

                                            <li>
                                                <a href="media.php"  >Media</a>
                                            </li>
                                            
                                            <!--<li><a href="locations.php">Locations</a></li>-->

                                            <li>
                                                <a href="contact.php" >Contact</a>
                                            </li><!-- .dropdown end -->                                            </ul><!-- .dl-menu end -->
                                        </div><!-- #dl-menu end -->

                                        <!-- #search start -->
                                        <div id="search">
                                            <form action="#" method="get">
                                                <input class="search-submit" type="submit" />
                                                <input id="m_search" name="s" type="text" placeholder="Type and hit enter..." />                        
                                            </form>
                                        </div><!-- #search end -->
                                    </div><!-- MAIN NAVIGATION END -->
                                </nav><!-- .navbar.navbar-default end -->
                            </div><!-- .col-md-12 end -->
                        </div><!-- .row end -->
                    </div><!-- .main-nav end -->
                </div><!-- .container end -->
            </header>
            
            
              <!-- .header.header-style01 -->
        </div><!-- .header-wrapper.header-transparent end -->
