diff --git a/PR-Ojek.sql b/PR-Ojek.sql new file mode 100644 index 0000000000000000000000000000000000000000..f1d90595f176ee52779b52abfc3ed98506dc1744 --- /dev/null +++ b/PR-Ojek.sql @@ -0,0 +1,51 @@ +-- Database PR-Ojek + +CREATE TABLE IF NOT EXISTS `user` ( + `user_id` INT NOT NULL, + `name` VARCHAR(50) NOT NULL, + `email` VARCHAR(50) NOT NULL, + `phone` VARCHAR(20) NOT NULL, + `username` VARCHAR(50) NOT NULL, + `password` VARCHAR(20) NOT NULL, + `status` VARCHAR(10) NOT NULL, + `pict` MEDIUMBLOB DEFAULT NULL, + + PRIMARY KEY (`user_id`) +); + +LOCK TABLES `user` WRITE; + +INSERT INTO `user` VALUES ('1','Donald Trump','donaldducktrump@gmail.com','08136','donaldduck','123456','Not_Driver',DEFAULT); +UNLOCK TABLES; + +CREATE TABLE IF NOT EXISTS `driver` ( + `driver_id` INT NOT NULL, + `total_score` DOUBLE(50,1) NOT NULL, + `votes` DOUBLE(50,1) NOT NULL, + + PRIMARY KEY (`driver_id`), + CONSTRAINT `driver_ibfk_1` FOREIGN KEY (`driver_id`) REFERENCES `user` (`user_id`) +); + +CREATE TABLE IF NOT EXISTS `driver_prefloc` ( + `driver_id` INT NOT NULL, + `pref_loc` VARCHAR(50) NOT NULL, + + PRIMARY KEY (`driver_id`), + CONSTRAINT `driver_prefloc_ibfk_1` FOREIGN KEY (`driver_id`) REFERENCES `driver` (`driver_id`) +); + +CREATE TABLE IF NOT EXISTS `order` ( + `order_id` INT NOT NULL, + `dest_city` VARCHAR(50) NOT NULL, + `pick_city` VARCHAR(50) NOT NULL, + `score` DOUBLE(50,1) NOT NULL, + `comment` VARCHAR(140) NOT NULL, + `driver_id` INT NOT NULL, + `cust_id` INT NOT NULL, + `date` DATE NOT NULL, + + PRIMARY KEY (`order_id`), + CONSTRAINT `order_ibfk_1` FOREIGN KEY (`cust_id`) REFERENCES `user` (`user_id`), + CONSTRAINT `order_ibfk_2` FOREIGN KEY (`driver_id`) REFERENCES `driver` (`driver_id`) +); diff --git a/css/.DS_Store b/css/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 Binary files /dev/null and b/css/.DS_Store differ diff --git a/css/default_style.css b/css/default_style.css new file mode 100644 index 0000000000000000000000000000000000000000..85ddefe17a49de1c96ca8db5249e071050b422ae --- /dev/null +++ b/css/default_style.css @@ -0,0 +1,34 @@ +body { + background-color: rgb(210,210,210); + color: rgb(250,250,250); +} + +.frame { + border: 7px solid rgb(65,62,119); + border-radius: 25px; + background-color: rgb(92,88,138); + margin: 50px auto; +} + +.frame h1,h2 { + text-align: center; +} + +input{ + width: 100%; + margin: 1px auto 15px; +} + +input[type="checkbox"]{ + width: 0; + margin-right: 10px; +} + +a:link, a:visited { + color: rgb(250,250,250); + text-decoration: none; +} + +a:hover { + color: rgb(167,180,4); +} diff --git a/css/history.css b/css/history.css new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/css/login.css b/css/login.css new file mode 100644 index 0000000000000000000000000000000000000000..94aa02419da9dedefc260e60307e4b732ca6db2b --- /dev/null +++ b/css/login.css @@ -0,0 +1,53 @@ +#login_frame { + height: 550px; + width: 400px; +} + +#login_frame > div { + left: 10%; + width: 80%; + height: auto; + position: relative; +} + +#login_frame input[type="submit"] { + border-radius: 40px; + background-color: rgb(191,216,255); + padding: 5px 3px; + display: block; + width: 30%; + border : none; + cursor : pointer; + margin: 0 auto 15px; +} + +#login_frame input[type="submit"]:hover { + opacity: 0.6; +} + +#sign_up_frame { + width: 400px; + height: 550px; +} + +#sign_up_frame input[type="submit"] { + border-radius: 40px; + background-color: rgb(191,216,255); + padding: 5px 3px; + display: block; + width: 30%; + border : none; + cursor : pointer; + margin: 0 auto 15px; +} + +#sign_up_frame input[type="submit"]:hover { + opacity : 0.6; +} + +#sign_up_frame > div { + left: 10%; + width: 80%; + height: auto; + position: relative; +} diff --git a/css/main.css b/css/main.css new file mode 100644 index 0000000000000000000000000000000000000000..cda46d4e4cb1b280f3685f4d19e1931570862ba2 --- /dev/null +++ b/css/main.css @@ -0,0 +1,87 @@ +body { + background-color: rgb(210,210,210); + color: rgb(250,250,250); +} + +.frame { + border: 7px solid rgb(65,62,119); + border-radius: 25px; + background-color: rgb(92,88,138); + margin: 50px auto; +} + +#login_frame { + height: 550px; + width: 400px; +} + +.frame > h1 { + text-align: center; +} + +#login_frame > div { + left: 10%; + width: 80%; + height: auto; + position: relative; +} + +input{ + width: 100%; + margin: 1px auto 15px; +} + +#login_frame input[type="submit"] { + border-radius: 40px; + background-color: rgb(191,216,255); + padding: 5px 3px; + display: block; + width: 30%; + border : none; + cursor : pointer; + margin: 0 auto 15px; +} + +#login_frame input[type="submit"]:hover { + opacity: 0.6; +} + +#sign_up_frame { + width: 400px; + height: 550px; +} + +input[type="checkbox"]{ + width: 0; + margin-right: 10px; +} + +#sign_up_frame input[type="submit"] { + border-radius: 40px; + background-color: rgb(191,216,255); + padding: 5px 3px; + display: block; + width: 30%; + border : none; + cursor : pointer; + margin: 0 auto 15px; +} + +#sign_up_frame input[type="submit"]:hover { + opacity : 0.6; +} + +#sign_up_frame > div { + left: 10%; + width: 80%; + height: auto; + position: relative; +} + +a:link, a:visited { + color: rgb(250,250,250); +} + +a:hover { + color: rgb(167,180,4); +} diff --git a/css/order.css b/css/order.css new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/css/profile.css b/css/profile.css new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/history/driver_history.html b/history/driver_history.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/history/order_history.html b/history/order_history.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/img/Logo.png b/img/Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..3849b27530de90b627ec0113d548082c84322b64 Binary files /dev/null and b/img/Logo.png differ diff --git a/index.php b/index.php new file mode 100644 index 0000000000000000000000000000000000000000..0fc24dd392a53698741daa1bd735e41b34b3a9bd --- /dev/null +++ b/index.php @@ -0,0 +1,5 @@ +<?php + + header( 'Location: login/login.html' ) ; + +?> diff --git a/login/login.html b/login/login.html new file mode 100644 index 0000000000000000000000000000000000000000..128184879ea2f8ea88ce9a66e5155321edb1135a --- /dev/null +++ b/login/login.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<html> + <head> + <title>Login to OneHundred</title> + <link rel="stylesheet" type="text/css" href="../css/default_style.css"> + <link rel="stylesheet" type="text/css" href="../css/login.css"> + </head> + <body> + <div id="login_frame" class="frame"> + <h1>Welcome to PR-Ojek<img src="../img/logo.png" style="width: 70px;height: 50px;float: right"></h1> + <p style="text-align: center">"An ojek for anything you need"</p> + <br/><br/> + <h2>--- Login ---</h2> + <p id="error_credential" style="text-align: center;"></p> + <div> + <form name="login" method="POST" action="login.php" onsubmit="return validate();"> + Username + <input type="text" name="user_name"><br/> + + Password + <input type="Password" name="user_password"><br/> + + <input type="submit" value="Login" > + </form> + + <a href="sign_up.html">Don't have an account?</a><br/> + </div> + </div> + <script> + function validate() + { + var username = document.login.user_name.value; + var password = document.login.user_password.value; + if (username==null || username=="") + { + window.alert("Username can't be blank"); + return false; + } + else if (password==null || password=="") + { + window.alert("Password can't be blank"); + return false; + } + } + </script> + + </body> +</html> diff --git a/login/login.php b/login/login.php new file mode 100644 index 0000000000000000000000000000000000000000..50c7e2a671a6a812aeced361b0d58e14a5582d8d --- /dev/null +++ b/login/login.php @@ -0,0 +1,44 @@ +<?php + if ($_SERVER["REQUEST_METHOD"] == "POST") { + if (!empty($_POST['user_name']) && !empty($_POST['user_password'])) { + $user = $_POST['user_name']; + $pass = $_POST['user_password']; + + $dbhost = '127.0.0.1:3306'; + $dbuser = 'root'; + $dbpass = ''; + $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error()); + mysql_select_db('PR_Ojek') or die('Could not select database '.mysql_error()); + $query=mysql_query("SELECT * FROM user WHERE username='".$user."' AND password='".$pass."'") or die(mysql_error()); + + $numrows=mysql_num_rows($query); + if($numrows!=0) + { + while($row=mysql_fetch_assoc($query)) + { + $dbusername=$row['username']; + $dbpassword=$row['password']; + } + + if($user == $dbusername && $pass == $dbpassword) + { + header("Location: ../profile_page/profile.html"); + } + } else { + include("login.html"); + echo "<script> + document.getElementById('error_credential').innerHTML = 'Invalid username or password!'; + </script>"; + header("Location: login.html"); + } + mysql_close($conn); + } + } + + function clean_input($data) { + $data = trim($data); + $data = stripslashes($data); + $data = htmlspecialchars($data); + return $data; + } +?> diff --git a/login/sign_up.html b/login/sign_up.html new file mode 100644 index 0000000000000000000000000000000000000000..b73e8172007ce916bba5845064d4c4848a3bac37 --- /dev/null +++ b/login/sign_up.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> +<head> + <title>Sign Up</title> + <link rel="stylesheet" type="text/css" href="../css/main.css"> +</head> +<body> + <div id="sign_up_frame" class="frame"> + <h1>-- Sign up --</h1> + + <div> + <form method="post"> + Your name + <input type="text" name="real_name"><br/> + Username + <input type="text" name="real_name"><br/> + Email + <input type="Email" name="real_name"><br/> + Password + <input type="Password" name="real_name"><br/> + Confirm password + <input type="Password" name="real_name"><br/> + Phone number + <input type="text" name="real_name"><br/> + + <input type="checkbox" name="is_driver" value="true">Also sign me up as a driver<br/> + + <input type="submit" value="REGISTER"> + </form> + </div> + </div> + +</body> +</html> \ No newline at end of file diff --git a/order/complete_order.html b/order/complete_order.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/order/select_driver.html b/order/select_driver.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/order/select_location.html b/order/select_location.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/profile_page/edit_identity.html b/profile_page/edit_identity.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/profile_page/edit_location.html b/profile_page/edit_location.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/profile_page/profile.html b/profile_page/profile.html new file mode 100644 index 0000000000000000000000000000000000000000..8c0cb78fcd7a822c65f11c7d324a28a6b97096bc --- /dev/null +++ b/profile_page/profile.html @@ -0,0 +1,5 @@ +<html> +<body> +<h1> Profile </h1> +</body> +</html> diff --git a/root/.DS_Store b/root/.DS_Store index 87611abf29f628dd34791f9a54a1fd1ff143196a..28d70032ffb8020ad55473821aa2576f5d095cee 100644 Binary files a/root/.DS_Store and b/root/.DS_Store differ diff --git a/root/css/.DS_Store b/root/css/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 Binary files /dev/null and b/root/css/.DS_Store differ diff --git a/root/css/color_scheme.txt b/root/css/color_scheme.txt index 2a381024bf9ec965087bfc9a7916e20da30e7535..531e3123275ab11c059caf9571f50fe827056c64 100644 --- a/root/css/color_scheme.txt +++ b/root/css/color_scheme.txt @@ -3,3 +3,10 @@ lighter plum: rgb(92,88,138) pale cobalt blue: rgb(191,216,255) lime green: rgb(167,180,4) winter white: rgb(250, 250, 250) +<?php + if (headers_sent()) { + echo "<script> + document.getElementById('error_msg').innerHTML = 'Invalid username or password!'; + </script>"; + } + ?> \ No newline at end of file diff --git a/root/css/login.css b/root/css/login.css index 22bc8dc85856bf76fc26ce32932cf02c049be4b8..94aa02419da9dedefc260e60307e4b732ca6db2b 100644 --- a/root/css/login.css +++ b/root/css/login.css @@ -1,9 +1,8 @@ #login_frame { - height: 300px; - width: 400px; + height: 550px; + width: 400px; } - #login_frame > div { left: 10%; width: 80%; @@ -12,9 +11,18 @@ } #login_frame input[type="submit"] { - display: block; - width: 40px; - margin: 0 auto 15px; + border-radius: 40px; + background-color: rgb(191,216,255); + padding: 5px 3px; + display: block; + width: 30%; + border : none; + cursor : pointer; + margin: 0 auto 15px; +} + +#login_frame input[type="submit"]:hover { + opacity: 0.6; } #sign_up_frame { @@ -22,10 +30,19 @@ height: 550px; } -#sign_up_frame input[type="submit"]{ - display: block; - width: 80px; - margin: 15px auto; +#sign_up_frame input[type="submit"] { + border-radius: 40px; + background-color: rgb(191,216,255); + padding: 5px 3px; + display: block; + width: 30%; + border : none; + cursor : pointer; + margin: 0 auto 15px; +} + +#sign_up_frame input[type="submit"]:hover { + opacity : 0.6; } #sign_up_frame > div { @@ -33,4 +50,4 @@ width: 80%; height: auto; position: relative; -} \ No newline at end of file +} diff --git a/root/login/login.html b/root/login/login.html index 0c9b00665617091b5102a021e549ea4f47fe4282..8098f7295a3c060aa42285601f303959ec91473f 100644 --- a/root/login/login.html +++ b/root/login/login.html @@ -25,4 +25,4 @@ </div> </div> </body> -</html> \ No newline at end of file +</html>