From 29af0008a8e3abf4054c7c5e45d64c15ffedf593 Mon Sep 17 00:00:00 2001
From: ayamberkakienam <zackhardyz@gmail.com>
Date: Thu, 5 Oct 2017 16:11:50 +0700
Subject: [PATCH] Initial work on order pages

---
 css/default_style.css      |   1 -
 css/order.css              |  24 +---------
 order/order.php            |  26 ++++++++++
 profile/.DS_Store          | Bin 0 -> 6148 bytes
 profile/edit_location.html |   0
 profile/edit_profile.php   |  96 +++++++++++++++++++++++++++++++++++++
 profile/getProfilePict.php |  11 +++++
 profile/profile.php        |  59 +++++++++++++++++++++++
 profile/update_profile.php |  54 +++++++++++++++++++++
 9 files changed, 248 insertions(+), 23 deletions(-)
 create mode 100644 profile/.DS_Store
 create mode 100644 profile/edit_location.html
 create mode 100644 profile/edit_profile.php
 create mode 100644 profile/getProfilePict.php
 create mode 100644 profile/profile.php
 create mode 100644 profile/update_profile.php

diff --git a/css/default_style.css b/css/default_style.css
index 199d588d..9d69257c 100755
--- a/css/default_style.css
+++ b/css/default_style.css
@@ -12,7 +12,6 @@
 }
 
 .frame h1,h2 {
-	text-align: center;
     font-family: franklin gothic;
 }
 
diff --git a/css/order.css b/css/order.css
index c29f6a28..36db29d3 100755
--- a/css/order.css
+++ b/css/order.css
@@ -1,23 +1,3 @@
-#container {
-	margin: auto;
-	width: 400px;
-}
-
-.button {
-	height: 70px;
-}
-
-#first {
-	background-color: red;
-	float: left;
-}
-
-#second {
-	background-color: blue;
-	float: left;
-}
-
-#third {
-	background-color: green;
-	float: left;
+#order_link {
+    background-color: #465d43;
 }
\ No newline at end of file
diff --git a/order/order.php b/order/order.php
index 363a9498..bad9b616 100644
--- a/order/order.php
+++ b/order/order.php
@@ -24,6 +24,32 @@
                 mysqli_close($con);
             ?>
 		</div>
+		<div class="menu_container">
+			<?php include'../template/menu.php';?>
+		</div>
+			
+		<div>
+			<h1>MAKE AN ORDER</h1>
+			<div style="background-color: white; max-width: 600px; margin-left: auto; margin-right: auto">
+				<a href="order/select_location.html">
+					<div style="width:150px; float: left; margin-left: 5%; border: 5px solid black">
+						Select Destination
+					</div>
+				</a>
+				
+				<a href="order/select_driver.html">
+					<div style="width:150px; float: left; margin-left: 5px; margin-right: 5px; border: 5px solid black">
+						Select Driver
+					</div>
+				</a>
+
+				<a href="order/complete_order.html">
+					<div style="width:150px; float: left; margin-right: 5%; border: 5px solid black">
+						Complete Order
+					</div>
+				</a>
+			</div>
+		</div>
 	</div>
 </body>
 </html>
diff --git a/profile/.DS_Store b/profile/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6
GIT binary patch
literal 6148
zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3
zem<@ulZcFPQ@L2!n>{z**<q8>++&mCkOWA81W14cNZ<zv;LbK1Poaz?KmsK2CSc!(
z0ynLxE!0092;Krf2c+FF_Fe*7ECH>lEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ
zLs35+`xjp>T0<F0fCPF1$Cyrb|F7^5{eNG?83~ZUUlGt@xh*qZDeu<Z%US-OSsOPv
j)R!Z4KLME7ReXlK;d!wEw5GODWMKRea10D2@KpjYNUI8I

literal 0
HcmV?d00001

diff --git a/profile/edit_location.html b/profile/edit_location.html
new file mode 100644
index 00000000..e69de29b
diff --git a/profile/edit_profile.php b/profile/edit_profile.php
new file mode 100644
index 00000000..69e1236e
--- /dev/null
+++ b/profile/edit_profile.php
@@ -0,0 +1,96 @@
+<html>
+<head>
+    <title>U Wanna Call Me Beibh?</title>
+    <link rel="stylesheet" type="text/css" href="../css/default_style.css">
+    <link rel="stylesheet" type="text/css" href="../css/profile.css">
+    <link rel="stylesheet" type="text/css" href="../css/header.css">
+    <link rel="stylesheet" type="text/css" href="../css/switch.css">
+</head>
+<body>
+    <div class="frame" id="edit_profile_page">
+        <div class="header">
+            <?php
+                $user_id = $_GET['id'];
+                include '../database/dbconnect.php';
+                
+                $query=mysqli_query($con,"SELECT * FROM user WHERE user_id='".$user_id."'") or die(mysqli_error());
+    
+                if(mysqli_num_rows($query)!=0)
+                {
+                    $row=mysqli_fetch_assoc($query);
+                    $username = $row['username'];
+                    include("../template/header.php");
+                }
+                mysqli_close($con);
+            ?>
+        </div>
+        <div class="menu">
+            <?php include '../template/menu.php';?>
+        </div>
+        <h1>Edit Profile</h1>
+        <div class="edit_profile_frame">
+            <form name="edit_identity" method="POST" action="update_profile.php" enctype="multipart/form-data">
+                <div>
+                    <div style="display: inline-block; position: relative; margin-left: 20px; height: 100px; width: 300px;">
+                        <div class="edit_image_frame">
+                            <img id="edit_profile_pict" src="../img/default_profile.jpeg">
+                        </div>
+                        <div class="select_pict">
+                            <input id="file_name" type="text" readonly="readonly">
+                        </div>
+                        <div class="browse_file">
+                            <input type="file" name="profile_pictfile" class="upload_file" onchange="showFileName(this);">
+                        </div>
+                    </div>
+                    <div style="display: inline; position: relative; margin-left: 20px; top: 20px;">
+                        <div style="display: inline-block; position: relative; height: 100px; width: 100px;">
+                            <div style="height: 30px;">
+                                Your Name
+                            </div>
+                            <div style="height: 30px;">
+                                Phone
+                            </div>
+                            <div style="height: 30px;">
+                                Status Driver
+                            </div>
+                        </div>
+                        <div style="display: inline-block; position: absolute; height: 100px; width: 250px;">
+                            <div style="height: 30px; margin-left: 10px;">
+                                <input id="current_name" name="edit_name" type="text" style="height: 20px; width: 260px;">
+                            </div>
+                            <div style="height: 30px; margin-left: 10px;">
+                                <input id="current_phone" name="edit_phone" type="text" style="height: 20px; width: 260px;">
+                            </div>
+                            <div style="height: 30px; margin-left: 10px;">
+                                <label class="switch" style="float: right;">
+                                    <input type="checkbox" name="is_driver" value="true">
+                                    <span class="slider round"></span>
+                                </label>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div>
+                    <input id="hidden_userid" name="hidden_userid" type="text" style="display:none;">
+                    <button class="button" style="float: left;"><a href="profile.php">BACK</a></button>
+                    <input type="submit" value="SAVE" style="float: right;" class="button">
+                </div>
+            </form>
+        </div>
+    </div>
+    <?php
+        echo "<script>document.getElementById('current_name').value = '".$row['name']."'</script>";
+        echo "<script>document.getElementById('current_phone').value = '".$row['phone']."'</script>";
+        if (isset($row['pict'])) {
+            echo "<script>document.getElementById('edit_profile_pict').src ='getProfilePict.php?id=".$user_id."'</script>";
+        }
+        echo "<script>document.getElementById('hidden_userid').value =".$user_id."</script>";
+    ?>
+    <script>
+        function showFileName(inputFile) {
+            var arrTemp = inputFile.value.split('\\');
+            document.getElementById("file_name").value = arrTemp[arrTemp.length - 1];
+        }
+    </script>
+</body>
+</html>
diff --git a/profile/getProfilePict.php b/profile/getProfilePict.php
new file mode 100644
index 00000000..1a448af3
--- /dev/null
+++ b/profile/getProfilePict.php
@@ -0,0 +1,11 @@
+<?php
+    $user_id = $_GET['id'];
+    include '../database/dbconnect.php';
+    $query=mysqli_query($con,"SELECT pict FROM user WHERE user_id='".$user_id."'") or die(mysqli_error());
+    $row=mysqli_fetch_assoc($query);
+    mysqli_close($con);
+    if (isset($row['pict'])) {
+        header("Content-type: image/jpeg");
+        echo $row['pict'];        
+    }
+?>
diff --git a/profile/profile.php b/profile/profile.php
new file mode 100644
index 00000000..6e1a1b5d
--- /dev/null
+++ b/profile/profile.php
@@ -0,0 +1,59 @@
+<?php
+    
+?>
+<html>
+<head>
+    <title>U Wanna Call Me Beibh?</title>
+    <link rel="stylesheet" type="text/css" href="../css/default_style.css">
+    <link rel="stylesheet" type="text/css" href="../css/profile.css">
+    <link rel="stylesheet" type="text/css" href="../css/header.css">
+</head>
+<body>
+    <div class="frame">
+        <div class="header">
+            <?php
+                $user_id = $_GET['id'];
+                include '../database/dbconnect.php';
+                
+                $query=mysqli_query($con,"SELECT * FROM user WHERE user_id='".$user_id."'") or die(mysqli_error());
+                
+                if(mysqli_num_rows($query)!=0)
+                {
+                    $row=mysqli_fetch_assoc($query);
+                    $username = $row['username'];
+                    include("../template/header.php");
+                }
+                mysqli_close($con);
+            ?>
+        </div>
+        <div class="menu_container">
+            <?php include'../template/menu.php';?>
+        </div>
+        <div class="profile_container">
+            <div class="profile_header">
+                <div class="profile_title"><h1>My Profile</h1></div>
+                <div class="edit_profile_button"><a href=<?php echo 'edit_profile.php?id='.$user_id; ?>>✎</a></div>
+            </div>
+            <div class="myprofile">
+                <div class="profilepict_frame">
+                    <img id="profile_pict" src="../img/default_profile.jpeg">
+                </div>
+                <div class="profile_info">
+                    <?php
+                        echo "</br><strong>".$row['username']."</strong></br>";
+                        echo $row['name']."</br>";
+                        if ($row['status'] == "driver") {
+                            echo "driver | Rating (xxx Votes)</br>";
+                        }
+                        echo $row['email']."</br>";
+                        echo $row['phone']."</br>";
+                        if (isset($row['pict'])) {
+                            echo "<script>document.getElementById('profile_pict').src ='getProfilePict.php?id=".$user_id."'</script>";
+                        }
+                    ?>
+                </div>
+            </div>
+        </div>
+    </div>
+</body>
+</html>
diff --git a/profile/update_profile.php b/profile/update_profile.php
new file mode 100644
index 00000000..95059593
--- /dev/null
+++ b/profile/update_profile.php
@@ -0,0 +1,54 @@
+<?php
+    session_start();
+    if ($_SERVER["REQUEST_METHOD"] == "POST") {
+        include '../database/dbconnect.php';
+        if (isset($_FILES) && ($_FILES['profile_pictfile']['size'] > 0) && !empty($_POST['edit_name']) && !empty($_POST['edit_phone']) && !empty($_POST['hidden_userid'])) {
+            $user_id = $_POST['hidden_userid'];
+            $new_name = $_POST['edit_name'];
+            $new_phone = $_POST['edit_phone'];
+            if(isset($_POST['is_driver']))
+            {
+                $status = 'driver';
+            }
+            else
+            {
+                $status = 'customer';
+            }
+
+            $checkImg = true;
+            $filePath = $_FILES['profile_pictfile']['tmp_name'];
+            $fileName = $_FILES['profile_pictfile']['name'];
+            $fileSize = $_FILES['profile_pictfile']['size'];
+            $fileType = $_FILES['profile_pictfile']['type'];
+            if ($_FILES['profile_pictgile']['error'] || !is_uploaded_file($filePath)) {
+                $checkImg = false;
+                echo "Error: Error in uploading file. Please try again.";
+            }
+            if ($checkImg && !in_array($fileType, array('image/png', 'image/x-png', 'image/jpeg', 'image/pjpeg', 'image/gif'))) {
+                $checkImg = false;
+                echo "Error: Unsupported file extension. Supported extensions are JPG / PNG.";
+            }
+            if ($checkImg && $fileSize > 16000000) {
+                $checkImg = false;
+                echo "Error: File size must be less than 16 MB.";
+            }
+            if ($checkImg) {
+                $fp      = fopen($filePath, 'r');
+                $content = fread($fp, filesize($filePath));
+                $content = addslashes($content);
+                fclose($fp);
+                
+                if(!get_magic_quotes_gpc())
+                {
+                    $fileName = addslashes($fileName);
+                }
+                $query=mysqli_query($con,"UPDATE user set name='".$new_name."',phone='".$new_phone."',status='".$status."',pict='".$content."'WHERE user_id='".$user_id."'") or die(mysqli_error());
+            }
+            if($query)
+            {
+                header("Location: profile.php?id=$user_id");
+            }
+            mysqli_close($con);
+        }
+    }
+?>
-- 
GitLab