From 92d47df63edd64ae9dd579ddaea624a09b509d97 Mon Sep 17 00:00:00 2001 From: freedomfeather <fadlurohmanakmal@rocketmail.com> Date: Sat, 30 Sep 2017 15:08:49 +0700 Subject: [PATCH] memperbaiki prosedur oneksi ke database --- README.md | 0 css/.DS_Store | Bin css/default_style.css | 0 css/history.css | 0 css/login.css | 0 css/main.css | 0 css/order.css | 0 css/profile.css | 0 database/PR-Ojek.sql | 51 ++++++++++++++++++++++++++++++++ database/dbconnect.php | 8 +++++ history/driver_history.html | 0 history/order_history.html | 0 img/Logo.png | Bin index.php | 0 login/login.html | 0 login/login.php | 7 +---- login/sign_up.html | 0 mocks/.DS_Store | Bin order/complete_order.html | 0 order/select_driver.html | 0 order/select_location.html | 0 profile_page/edit_identity.html | 0 profile_page/edit_location.html | 0 profile_page/profile.html | 0 24 files changed, 60 insertions(+), 6 deletions(-) mode change 100644 => 100755 README.md mode change 100644 => 100755 css/.DS_Store mode change 100644 => 100755 css/default_style.css mode change 100644 => 100755 css/history.css mode change 100644 => 100755 css/login.css mode change 100644 => 100755 css/main.css mode change 100644 => 100755 css/order.css mode change 100644 => 100755 css/profile.css create mode 100755 database/PR-Ojek.sql create mode 100644 database/dbconnect.php mode change 100644 => 100755 history/driver_history.html mode change 100644 => 100755 history/order_history.html mode change 100644 => 100755 img/Logo.png mode change 100644 => 100755 index.php mode change 100644 => 100755 login/login.html mode change 100644 => 100755 login/login.php mode change 100644 => 100755 login/sign_up.html mode change 100644 => 100755 mocks/.DS_Store mode change 100644 => 100755 order/complete_order.html mode change 100644 => 100755 order/select_driver.html mode change 100644 => 100755 order/select_location.html mode change 100644 => 100755 profile_page/edit_identity.html mode change 100644 => 100755 profile_page/edit_location.html mode change 100644 => 100755 profile_page/profile.html diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/css/.DS_Store b/css/.DS_Store old mode 100644 new mode 100755 diff --git a/css/default_style.css b/css/default_style.css old mode 100644 new mode 100755 diff --git a/css/history.css b/css/history.css old mode 100644 new mode 100755 diff --git a/css/login.css b/css/login.css old mode 100644 new mode 100755 diff --git a/css/main.css b/css/main.css old mode 100644 new mode 100755 diff --git a/css/order.css b/css/order.css old mode 100644 new mode 100755 diff --git a/css/profile.css b/css/profile.css old mode 100644 new mode 100755 diff --git a/database/PR-Ojek.sql b/database/PR-Ojek.sql new file mode 100755 index 00000000..f1d90595 --- /dev/null +++ b/database/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/database/dbconnect.php b/database/dbconnect.php new file mode 100644 index 00000000..f0c1c235 --- /dev/null +++ b/database/dbconnect.php @@ -0,0 +1,8 @@ +<?php + define('dbserver', '127.0.0.1:3306'); + define('dbuser', 'root'); + define('dbpass', ''); + define('dbname', 'PR_Ojek'); + mysql_connect(dbserver, dbuser, dbpass) or die(mysql_error()); + mysql_select_db(dbname) or die('Could not select database '.mysql_error()); +?> diff --git a/history/driver_history.html b/history/driver_history.html old mode 100644 new mode 100755 diff --git a/history/order_history.html b/history/order_history.html old mode 100644 new mode 100755 diff --git a/img/Logo.png b/img/Logo.png old mode 100644 new mode 100755 diff --git a/index.php b/index.php old mode 100644 new mode 100755 diff --git a/login/login.html b/login/login.html old mode 100644 new mode 100755 diff --git a/login/login.php b/login/login.php old mode 100644 new mode 100755 index 50c7e2a6..a559a4bc --- a/login/login.php +++ b/login/login.php @@ -1,14 +1,9 @@ <?php if ($_SERVER["REQUEST_METHOD"] == "POST") { if (!empty($_POST['user_name']) && !empty($_POST['user_password'])) { + include '../db_pr-ojek.php'; $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); diff --git a/login/sign_up.html b/login/sign_up.html old mode 100644 new mode 100755 diff --git a/mocks/.DS_Store b/mocks/.DS_Store old mode 100644 new mode 100755 diff --git a/order/complete_order.html b/order/complete_order.html old mode 100644 new mode 100755 diff --git a/order/select_driver.html b/order/select_driver.html old mode 100644 new mode 100755 diff --git a/order/select_location.html b/order/select_location.html old mode 100644 new mode 100755 diff --git a/profile_page/edit_identity.html b/profile_page/edit_identity.html old mode 100644 new mode 100755 diff --git a/profile_page/edit_location.html b/profile_page/edit_location.html old mode 100644 new mode 100755 diff --git a/profile_page/profile.html b/profile_page/profile.html old mode 100644 new mode 100755 -- GitLab