error_reporting(E_ALL);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    include_once "class/Captain.class.php";
    include_once "class/DatabaseBook.class.php";
    $username = $_POST['inputUserName'];
    $pwd = $_POST['inputPassword'];
    $fname = $_POST['inputFirstName'];
    $lname = $_POST['inputLastName'];
    $street = $_POST['inputAddress'];
    $city = $_POST['inputCity'];
    $state = $_POST['inputState'];
    $zip = $_POST['inputZip'];
    $email = $_POST['inputEmail'];
    $phone = $_POST['inputPhone'];
    $mobile = $_POST['inputMobile'];
    $captain = new Captain();
    if ($captain->registerCaptain($username, $pwd, $fname, $lname, $zip, $street, $city, $state, $email, $phone, $mobile)) {
        echo "<div class='container'><div class='col-md-12'><div class='alert alert-success'> <strong> Registration Successful! </strong> </div></div></div>";
        $to = $email;
        $subject = 'Registration Successful';
        $message = "You have registered successfully. Your account is being verified by administrator. You will be notified when your account is verified and ready to be used.";
        $headers = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
        // Additional headers
        $headers .= 'From: Captains Hub <*****@*****.**>';
        mail($to, $subject, $message, $headers);
        echo "<div class='container'><div class='col-md-12'><div class='alert alert-info'> <strong> An email has been sent to your account. </strong> </div></div></div>";
    } else {
        echo "<div class='container'><div class='col-md-12'><div class='alert alert-danger'> <strong> Registration Failed! </strong> </div></div></div>";
    }
} else {
 public function retrieveCaptainFromBook($captain_id)
 {
     $db = DatabaseBook::getInstance();
     $mysqli = $db->getConnection();
     $query = "SELECT * FROM ea_users WHERE id = {$captain_id}";
     $result = $mysqli->query($query);
     $counter = 0;
     $captList = array();
     while ($news_row = $result->fetch_array()) {
         $captain = new Captain();
         $captain->setFirstName($news_row['first_name']);
         $captain->setLastName($news_row['last_name']);
         $captain->setEmail($news_row['email']);
         $captain->setStreet($news_row['address']);
         $captain->setCity($news_row['city']);
         $captain->setState($news_row['state']);
         $captain->setZip($news_row['zip_code']);
         $captain->setCaptainId($news_row['id']);
         $captList[$counter] = $captain;
         $counter++;
     }
     return $captList;
 }
Example #3
0
  <!-- header.php contains js,css, and favicon links and some fix meta for SEO. -->
  <?php 
require "header/header.php";
?>
  

 <body>

   <!-- navigation folder stores the dynamic navigation bar. If user logn, it will retrieve different nav bar (Capt / User nav). -->
   <?php 
include "navigation/guestNav.php";
if (isset($_GET['captainId']) || $_SESSION['userType'] == "Captain") {
    include_once "class/Captain.class.php";
    include_once "class/Rating.class.php";
    $captList = array();
    $captain = new Captain();
    if (isset($_GET['captainId']) && !empty($_GET['captainId'])) {
        $captainId = $_GET['captainId'];
    } elseif ($_SESSION['userType'] == "Captain") {
        $captainId = $_SESSION['userId'];
    }
    $captList = $captain->retrieveCaptainProfile($captainId);
    $captName = $captList[0]->getFirstName() . " " . $captList[0]->getLastName();
    $rating = 0;
    $street = $captList[0]->getStreet();
    $state = $captList[0]->getState();
    $city = $captList[0]->getCity();
    $zip = $captList[0]->getZip();
    $pic = $captList[0]->getCaptainPic();
    $address = $street . " " . $city . "," . $state . " " . $zip;
    $email = $captList[0]->getEmail();
Example #4
0
 <body>

   <!-- navigation folder stores the dynamic navigation bar. If user logn, it will retrieve different nav bar (Capt / User nav). -->
   <?php 
include "navigation/guestNav.php";
//if user login
if (isset($_SESSION['userType']) && isset($_SESSION['userId']) && !empty($_SESSION['userType']) && !empty($_SESSION['userId'])) {
    $userType = $_SESSION['userType'];
    $userId = $_SESSION['userId'];
    include_once "class/Appointment.class.php";
    include_once "class/Captain.class.php";
    include_once "class/User.class.php";
    include_once "class/Rating.class.php";
    $appointment = new Appointment();
    $captain = new Captain();
    $user = new User();
    $appList = array();
    $captList = array();
    $userList = array();
    //*************************** UPCOMING APPOINTMENTS ****************************************************
    echo "<div class='container'> ";
    echo "<h1>My Appointments</h1>";
    echo "<h2>Upcoming Appointments</h2>";
    echo "<ul class='list-group'>";
    $userList = $user->retrieveUserFromId($userId);
    $userEmail = $userList[0]->getEmail();
    $appList = $appointment->retrieveAppointments($userType, $userEmail, "upcoming");
    $aa = $appList[0]->getCaptainId();
    for ($i = 0; $i < count($appList); $i++) {
        $captain_id = $appList[$i]->getCaptainId();
Example #5
0
?>
  

 <body>
 
   <!-- navigation folder stores the dynamic navigation bar. If user logn, it will retrieve different nav bar (Capt / User nav). -->
   <?php 
include "navigation/guestNav.php";
echo "<div class='container'>  ";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    include_once "class/Captain.class.php";
    include_once "class/User.class.php";
    $username = $_POST['loginUsername'];
    $pwd = md5($_POST['loginPassword']);
    $captList = array();
    $captain = new Captain();
    $captList = $captain->captainAuthenticate($username, $pwd);
    if (count($captList) == 0) {
        $user = new User();
        $userList = array();
        $userList = $user->userAuthenticate($username, $pwd);
        if (count($userList) == 0) {
            echo "<div class='alert alert-danger'> <strong> Login Failed! </strong> </div>";
        } elseif (count($userList) == 1) {
            $_SESSION["userId"] = $userList[0]->getUserId();
            $_SESSION["userType"] = "Customer";
            $host = $_SERVER['HTTP_HOST'];
            $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
            $extra = 'index.php';
            $url = "http://" . $host . $uri . "/" . $extra;
            echo "<script>location.href='" . $url . "'</script>";
Example #6
0
        $wd->setWarpFactor($factor);
    }
}
class Captain
{
    public function newWarpOrder($factor)
    {
        $ce = new ChiefEngineer();
        try {
            $ce->doWarp($factor);
        } catch (InputException $e) {
            echo "<p>Captain's log: Warp factor " . $e->getInvalidWarpFactor() . "? I must be losing my mind...</p>";
        } catch (FuelException $e) {
            echo "<p>Captain's log: I'm getting a fuel problem from the warp engine. It says: '" . $e->getMessage();
            echo "'. We have " . $e->getRemainingFuel() . " dilithium left. I guess we're not going anywhere.</p>";
        } catch (Exception $e) {
            echo "<p>Captain's log: Something else happened, I don't know what. The message is '" . $e->getMessage() . "'.</p>";
        }
    }
}
$c = new Captain();
$c->newWarpOrder(5);
$c->newWarpOrder(-1);
$c->newWarpOrder(12);
$c->newWarpOrder(4);
$c->newWarpOrder(9);
?>

  </body>
</html>
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (isset($_POST['app_id']) && !empty($_POST['app_id'])) {
        include_once "class/Appointment.class.php";
        include_once "class/Database.class.php";
        $appointment = new Appointment();
        $app_id = $_POST['app_id'];
        $ss = $appointment->cancelAppointment($app_id);
        if ($ss) {
            include_once "class/User.class.php";
            include_once "class/Captain.class.php";
            $captain = new Captain();
            $user = new User();
            //Send email notification
            $app = $appointment->retrieveAppointmentFromAppId($app_id);
            $user_id = $app[0]->getUserId();
            $captain_id = $app[0]->getCaptainId();
            $captainList = $captain->retrieveCaptainFromId($captain_id);
            $userList = $user->retrieveUserFromId($user_id);
            $captainEmail = $captainList[0]->getEmail();
            $userEmail = $userList[0]->getEmail();
            $to = $captainEmail . ', ';
            $to .= $userEmail;
            $subject = 'Appointment Cancellation';
            $message = "Your appointment has been cancelled";
            $headers = 'MIME-Version: 1.0' . "\r\n";
            $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
            // Additional headers
            $headers .= 'From: Captains Hub <*****@*****.**>';
            mail($to, $subject, $message, $headers);
Example #8
0
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include_once "class/Captain.class.php";
include_once "class/Database.class.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (isset($_POST['searchZipCode']) && isset($_POST['searchWithinRange']) && !empty($_POST['searchZipCode']) && !empty($_POST['searchWithinRange'])) {
        $searchZip = $_POST['searchZipCode'];
        $searchWithinRange = $_POST['searchWithinRange'];
        $api = "yYe8PVJnEAjsXdEgpQT6B5Fu5ZeEBD3aBhiqd2OSD8kAlYQKOKRqQwUVw8z8MDin";
        $url = "https://www.zipcodeapi.com/rest/" . $api . "/radius.json/" . $searchZip . "/" . $searchWithinRange . "/mile";
        $json = file_get_contents($url);
        $json_data = json_decode($json, true);
        /*echo '<pre>' . print_r($json_data, true) . '</pre>';*/
        $searchResultCaptList = array();
        $captList = array();
        $captain = new Captain();
        $captListCounter = 0;
        //Get json data length
        $jsonSize = max(array_map('count', $json_data));
        for ($i = 0; $i < $jsonSize; $i++) {
            //Get zip code from 3 dimensional array
            $zip = $json_data['zip_codes'][$i]['zip_code'];
            //To captain.class.php to select captain with the zip codes.
            $searchResultCaptList = $captain->searchCaptain($zip);
            for ($o = 0; $o < sizeof($searchResultCaptList); $o++) {
                $captList[$captListCounter] = $searchResultCaptList[$o];
                $captListCounter++;
            }
        }
        echo json_encode($captList);
    } else {
Example #9
0
              <input type="text" name="loginUsername" id="loginUsername" placeholder="Username" class="form-control">
            </div>
            <div class="form-group">
              <input type="password" name="loginPassword" id="loginPassword" placeholder="Password" class="form-control">
            </div>
            <button type="submit" class="btn btn-success">Sign in</button>
			<button id="btn_signup" class="btn btn-info">Sign Up</button>
          </form>
		<?php 
} elseif (isset($_SESSION['userType']) && isset($_SESSION['userId']) && !empty($_SESSION['userType']) && !empty($_SESSION['userId'])) {
    $userType = $_SESSION['userType'];
    $userId = $_SESSION['userId'];
    //Navigation bar for Captain *******************************************
    if ($userType == "Captain") {
        include_once "class/Captain.class.php";
        $captain = new Captain();
        $captDetail = array();
        $captDetail = $captain->retrieveCaptainFromId($userId);
        $captName = $captDetail[0]->getFirstName() . " " . $captDetail[0]->getLastName();
        ?>
		   <form class="navbar-form navbar-right" action="logout.php" method="POST">
		   <!--<a href="captain-boat.php"> My Boats</a>-->
		    <!--<a href="appointment.php"> My Appointments</a>-->
			<label for="welcomeUserName" id="welcomeUserName">Welcome, <?php 
        echo $captName;
        ?>
</label>
			<a class="btn btn-info" href="bookme/backend"> My Appointments</a>
			<a class=" btn btn-info" href="captain.php"> My Profile</a>
		    
            <button type="submit" class="btn btn-success">Logout</button>
Example #10
0
<?php

include_once "class/Captain.class.php";
include_once "class/User.class.php";
include_once "class/Database.class.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (isset($_POST['inputUserName']) && !empty($_POST['inputUserName'])) {
        $inputUserName = $_POST['inputUserName'];
        $captain = new Captain();
        $user = new User();
        $exist = $captain->captCheckUsername($inputUserName);
        if ($exist) {
            echo "exist";
        } else {
            $exist = $user->userCheckUsername($inputUserName);
            if ($exist) {
                echo "exist";
            } else {
                echo "available";
            }
        }
    } else {
        echo "You are no authorized to view this page";
    }
}
Example #11
0
		
	   </div>
      </div>
   

    <div class="container">
      
      <div class="row" id="captRow">
	    
		
		<?php 
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
    include_once "class/Captain.class.php";
    include_once "class/Rating.class.php";
    $captList = array();
    $captain = new Captain();
    $captList = $captain->retrieveCaptain();
    for ($i = 0; $i < sizeof($captList); $i++) {
        $captName = $captList[$i]->getFirstName() . " " . $captList[$i]->getLastName();
        $captPic = $captList[$i]->getCaptainPic();
        $captId = $captList[$i]->getCaptainId();
        $captLocation = $captList[$i]->getCity() . ", " . $captList[$i]->getState() . " " . $captList[$i]->getZip();
        $rating = new Rating();
        $score = $rating->retrieveAvgScore($captId);
        ?>
		
		<div class="col-xs-6 col-sm-4 col-md-3 captClass">
            <div class="thumbnail tb">
             <img class="thumbnail-img img-thumbnail" src="<?php 
        echo $captPic;
        ?>
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (isset($_POST['profile-pic']) && !empty($_POST['profile-pic'])) {
        include_once "class/Captain.class.php";
        include_once "class/Database.class.php";
        $captain = new Captain();
        $pic_path = $_POST['profile-pic'];
        session_start();
        $userId = $_SESSION['userId'];
        unset($_SESSION['fileName']);
        $ss = $captain->captainUpdateProfilePic($userId, $pic_path);
        if ($ss) {
            //Redirect to appointment Page
            $host = $_SERVER['HTTP_HOST'];
            $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
            $extra = 'captain-upload-pic.php';
            $url = "http://" . $host . $uri . "/" . $extra;
            echo "<script>location.href='" . $url . "'</script>";
            exit;
        } else {
            echo "<div class='container'><div class='col-md-12'><div class='alert alert-danger'> <strong> Cancellation Failed! </strong> </div></div></div>";
        }
    } else {
        echo "<div class='container'><div class='col-md-12'><div class='alert alert-danger'> <strong> You are not authorized to view this page. </strong> </div></div></div>";
    }
} else {
    echo "<div class='container'><div class='col-md-12'><div class='alert alert-danger'> <strong> You are not authorized to view this page. </strong> </div></div></div>";
}