Commit fcb3a68b by Mei Romauli Sagala

perubahan database

parent 16cb3164
......@@ -2,10 +2,9 @@
require_once(dirname(__FILE__).'/common/header.php');
require_once(dirname(__FILE__).'/cek_login.php');
require_once(dirname(__FILE__).'/fungsi/session.php');
global $con;
$con = mysqli_connect("localhost", "p1d3ti04", "p1d3ti04", "MeiHong05");
$con = mysqli_connect("localhost", "p1d3ti04_pondokedo","MeiHong05");
if (!$con) {
die("database connect problem");
}
......
<?php
require '/koneksi.php';
function get_session($_key){
$value = (isset($_SESSION[$_key]))? $_SESSION[$_key]: null;
return($value);
}
function set_session($_key, $_value){
$_SESSION[$_key] = $_value;
}
function destroy_session($_key){
unset($_SESSION[$_key]);
}
?>
\ No newline at end of file
-- phpMyAdmin SQL Dump
-- version 4.3.11
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: May 19, 2017 at 05:30 PM
-- Server version: 5.6.24
-- PHP Version: 5.6.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `p1d3ti04_pondokedo`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE IF NOT EXISTS `admin` (
`id_admin` int(11) NOT NULL,
`nama` varchar(45) NOT NULL,
`email` varchar(45) NOT NULL,
`username` varchar(45) NOT NULL,
`password` varchar(45) NOT NULL,
`role` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`id_admin`, `nama`, `email`, `username`, `password`, `role`) VALUES
(1, 'meno', 'meno@gmail.com', 'meno', 'meno', 0),
(2, 'Roy Junedi', 'royjunedi123@gmail.com', 'admin', 'admin', 0);
-- --------------------------------------------------------
--
-- Table structure for table `kategori`
--
CREATE TABLE IF NOT EXISTS `kategori` (
`id_kategori` int(11) NOT NULL,
`nama` varchar(45) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
--
-- Dumping data for table `kategori`
--
INSERT INTO `kategori` (`id_kategori`, `nama`) VALUES
(1, 'makanan'),
(2, 'minuman');
-- --------------------------------------------------------
--
-- Table structure for table `komentar`
--
CREATE TABLE IF NOT EXISTS `komentar` (
`id_komentar` int(11) NOT NULL,
`nama` varchar(45) NOT NULL,
`isi` varchar(200) NOT NULL,
`email` varchar(25) NOT NULL,
`hp` varchar(12) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
--
-- Dumping data for table `komentar`
--
INSERT INTO `komentar` (`id_komentar`, `nama`, `isi`, `email`, `hp`) VALUES
(8, 'marthina', 'semangat mei', 'grace@gmail.com', '2147483647'),
(11, 'franciskus', 'terimaksih atas kemudahannya', 'frans@yahoo.co.id', '081230988746'),
(13, 'maret', 'terimakasih telah hadir di bulbul', 'maret@yahoo.co.id', '09864839874'),
(15, 'nomi', 'thank', 'mdnlknd@gmail.com', '0998765978'),
(19, 'Roy Junedi', 'Makanannya Lumayan !! tapi kurang . Kurangnya ga bisa di antar langsung ke tempat.', 'royjunedi123@gmail.com', ' 08127799012'),
(20, 'roy', 'mantapss', 'roy@del.ac.id', '08129990901');
-- --------------------------------------------------------
--
-- Table structure for table `member`
--
CREATE TABLE IF NOT EXISTS `member` (
`id_member` int(11) NOT NULL,
`nama` varchar(45) NOT NULL,
`alamat` varchar(45) NOT NULL,
`hp` varchar(15) NOT NULL,
`username` varchar(45) NOT NULL,
`password` varchar(45) NOT NULL,
`email` varchar(25) NOT NULL,
`role` int(11) NOT NULL DEFAULT '1'
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
--
-- Dumping data for table `member`
--
INSERT INTO `member` (`id_member`, `nama`, `alamat`, `hp`, `username`, `password`, `email`, `role`) VALUES
(1, 'marthin', 'Medan', '81375495350', 'Marthin', 'marthin', '', 1),
(2, 'mei', 'Medan', '81375495350', 'Mei', 'mei', '', 1),
(3, 'Pratiwi', 'Sidikalang', '82267533244', 'tiwi', 'tiwi', '', 1),
(4, 'Roy Junedi Simamora', 'Dolok Sanggul', '81234215675', 'roy', 'roy', '', 1),
(5, 'Bellina', 'Medan', '987564893783', 'belina', 'belina', '', 1),
(6, 'Renta Damanik', 'Siantar', '98767545678', 'renta', 'renta', '', 1),
(7, 'meyhong', 'Medan', '98765432345', 'mei', 'mei', '', 1),
(8, 'maria', 'silaen', '81240277876', 'maria', 'maria', '', 1),
(9, 'Krisnomi Nainggolan', 'Samosir', '81236453647', 'nomi', 'nomi', '', 1),
(10, 'desi', 'siborongborong', '98765432134', 'desi', 'desi', 'desi@itdel', 1),
(11, 'nathan_ngl', 'Medan', '081375495350', 'nathan', 'nathan', 'nathan@gmail.com', 1),
(12, 'josua', 'medan', '081374839283', 'josua', 'josua', 'nathan@gmail.com', 1),
(13, 'violin', 'medan', '08126811874', 'violin', 'violin', 'violin@yahoo.co.id', 1);
-- --------------------------------------------------------
--
-- Table structure for table `menu`
--
CREATE TABLE IF NOT EXISTS `menu` (
`id_menu` int(11) NOT NULL,
`nama` varchar(45) NOT NULL,
`harga` double NOT NULL,
`gambar` varchar(45) NOT NULL,
`kategori_id` int(11) DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
--
-- Dumping data for table `menu`
--
INSERT INTO `menu` (`id_menu`, `nama`, `harga`, `gambar`, `kategori_id`) VALUES
(3, 'Ikan Bakar', 25000, 'ikan bakar.jpg', 1),
(4, 'ayam bakar', 12000, 'ayam bakar.jpg', 1),
(5, 'Bihun Kuah', 13000, 'bihun kuah.Jpeg', 1),
(6, 'Ikan Goreng', 20000, 'ikan goreng.jpg', 1),
(7, 'Bihun Goreng', 13000, 'bihun goreng.JPG', 1),
(8, 'Ayam Gulai', 15000, 'gulai ayam.jpg', 1),
(9, 'Indomie Goreng', 10000, 'indomie goreng.jpg', 1),
(10, 'Indomie Kuah', 10000, 'indomie kuah.jpg', 1),
(11, 'Mie Kuning Goreng', 15000, 'mi kuning goreng.jpg', 1),
(12, 'Tumis Kangkung', 8000, 'tumis kangkung.jpg', 1),
(13, 'Jus Alpukat', 8000, 'jus-alpukat.jpg', 2),
(14, 'Jus Jeruk', 8000, 'jeruk.jpeg', 2),
(15, 'jus apel', 10000, 'jus-apel.jpg', 2),
(16, 'Bandrek', 8000, 'bandrek.jpg', 2),
(17, 'Jus buah naga', 8000, 'jus naga.jpg', 2),
(18, 'Jus tomat', 8000, 'jus tomat.jpg', 2),
(19, 'Jus sirsak', 8000, 'jus-sirsak.jpg', 2),
(20, 'jus semangka', 8000, 'Jus-Semangka.png', 2),
(21, 'Jus terong belanda', 8000, 'terong belanda.jpg', 2);
-- --------------------------------------------------------
--
-- Table structure for table `pemesanan`
--
CREATE TABLE IF NOT EXISTS `pemesanan` (
`member_id` int(11) DEFAULT NULL,
`menu_id` int(11) DEFAULT NULL,
`tanggal` date NOT NULL,
`jumlah` varchar(45) NOT NULL,
`total_harga` double DEFAULT NULL,
`id_pemesanan` int(11) NOT NULL,
`bukti` varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `role`
--
CREATE TABLE IF NOT EXISTS `role` (
`role_id` int(11) NOT NULL,
`nama` varchar(255) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `role`
--
INSERT INTO `role` (`role_id`, `nama`) VALUES
(0, 'Admin'),
(1, 'Member');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`id_admin`,`role`), ADD KEY `role_id_FK` (`role`);
--
-- Indexes for table `kategori`
--
ALTER TABLE `kategori`
ADD PRIMARY KEY (`id_kategori`);
--
-- Indexes for table `komentar`
--
ALTER TABLE `komentar`
ADD PRIMARY KEY (`id_komentar`);
--
-- Indexes for table `member`
--
ALTER TABLE `member`
ADD PRIMARY KEY (`id_member`,`role`), ADD KEY `id_member` (`id_member`,`role`), ADD KEY `member_role_id_FK` (`role`);
--
-- Indexes for table `menu`
--
ALTER TABLE `menu`
ADD PRIMARY KEY (`id_menu`), ADD KEY `kategori_id` (`kategori_id`);
--
-- Indexes for table `pemesanan`
--
ALTER TABLE `pemesanan`
ADD PRIMARY KEY (`id_pemesanan`), ADD KEY `member_id` (`member_id`), ADD KEY `menu_id` (`menu_id`);
--
-- Indexes for table `role`
--
ALTER TABLE `role`
ADD PRIMARY KEY (`role_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admin`
--
ALTER TABLE `admin`
MODIFY `id_admin` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `kategori`
--
ALTER TABLE `kategori`
MODIFY `id_kategori` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `komentar`
--
ALTER TABLE `komentar`
MODIFY `id_komentar` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=21;
--
-- AUTO_INCREMENT for table `member`
--
ALTER TABLE `member`
MODIFY `id_member` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT for table `menu`
--
ALTER TABLE `menu`
MODIFY `id_menu` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT for table `pemesanan`
--
ALTER TABLE `pemesanan`
MODIFY `id_pemesanan` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `role`
--
ALTER TABLE `role`
MODIFY `role_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `admin`
--
ALTER TABLE `admin`
ADD CONSTRAINT `role_id_FK` FOREIGN KEY (`role`) REFERENCES `role` (`role_id`);
--
-- Constraints for table `member`
--
ALTER TABLE `member`
ADD CONSTRAINT `member_role_id_FK` FOREIGN KEY (`role`) REFERENCES `role` (`role_id`);
--
-- Constraints for table `menu`
--
ALTER TABLE `menu`
ADD CONSTRAINT `menu_ibfk_1` FOREIGN KEY (`kategori_id`) REFERENCES `kategori` (`id_kategori`);
--
-- Constraints for table `pemesanan`
--
ALTER TABLE `pemesanan`
ADD CONSTRAINT `pemesanan_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `member` (`id_member`),
ADD CONSTRAINT `pemesanan_ibfk_2` FOREIGN KEY (`menu_id`) REFERENCES `menu` (`id_menu`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment