Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PSW_II_PARIWISATA_TRANSPORTASI
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Proyek_PSW_II_PARIWISATA
PSW_II_PARIWISATA_TRANSPORTASI
Commits
b18e4315
Commit
b18e4315
authored
Jun 06, 2020
by
11319009_Pratiwi Sibarani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
3c5c2ad2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
index.php
transportasi/index.php
+85
-0
No files found.
transportasi/index.php
0 → 100644
View file @
b18e4315
<!DOCTYPE html>
<html>
<head>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"public/css/login.css"
>
<link
rel=
"icon"
type=
"image/png"
href=
"public/img/logo2.png"
/>
<title>
Login Page
</title>
</head>
<body>
<?php
// fungsi inputan karakter
function
input
(
$data
)
{
$data
=
trim
(
$data
);
$data
=
stripslashes
(
$data
);
$data
=
htmlspecialchars
(
$data
);
return
$data
;
}
//cek apakah ada kiriman dari method post?
if
(
$_SERVER
[
"REQUEST_METHOD"
]
==
"POST"
)
{
session_start
();
// if (!isset($_SESSION["username"])){
// echo "<script>alert('Login terlebih dahulu');window.location='index.php';</script>";
// exit;
// // echo "Anda harus login dulu <br><a href='login.php'>Klik disini</a>";
// exit;
// }
include
(
'common/dbconfig.php'
);
$username
=
input
(
$_POST
[
"username"
]);
$password
=
input
(
$_POST
[
"password"
]);
$query
=
"SELECT * FROM log_akun WHERE username='"
.
$username
.
"' and password='"
.
$password
.
"' limit 1"
;
$hasil1
=
mysqli_query
(
$koneksi
,
$query
);
$jumlah
=
mysqli_num_rows
(
$hasil1
);
if
(
$jumlah
>
0
){
$row
=
mysqli_fetch_assoc
(
$hasil1
);
$_SESSION
[
"id_akun"
]
=
$row
[
"id_akun"
];
$_SESSION
[
"nama"
]
=
$row
[
"nama"
];
$_SESSION
[
"email"
]
=
$row
[
"email"
];
$_SESSION
[
"alamat"
]
=
$row
[
"alamat"
];
$_SESSION
[
"j_kelamin"
]
=
$row
[
"j_kelamin"
];
$_SESSION
[
"username"
]
=
$row
[
"username"
];
$_SESSION
[
"password"
]
=
$row
[
"password"
];
$_SESSION
[
"role"
]
=
$row
[
"role"
];
if
(
$_SESSION
[
"role"
]
=
$row
[
"role"
]
==
"admin"
){
header
(
"Location:admin/index.php"
);
$_SESSION
[
'is_login'
]
=
TRUE
;
}
else
if
(
$_SESSION
[
"role"
]
=
$row
[
"role"
]
==
"user"
){
header
(
"Location:user/index.php"
);
$_SESSION
[
'is_login'
]
=
TRUE
;
}
else
{
header
(
"Location:index.php"
);
}
}
else
{
echo
"<script>alert('Username dan password salah');window.location='index.php';</script>"
;
}
}
?>
<h1>
Selamat Datang di
<br/>
Travel OK
</h1>
<div
class=
"kotak_login"
>
<center>
<img
src=
"public/img/logo3.png"
width=
"100px;"
>
</center>
<form
action=
"
<?=
$_SERVER
[
"PHP_SELF"
];
?>
"
method=
"post"
>
<label>
Username
</label>
<input
type=
"text"
name=
"username"
class=
"form_login"
placeholder=
"Username .."
>
<label>
Password
</label>
<input
type=
"password"
name=
"password"
class=
"form_login"
placeholder=
"Password .."
>
<input
type=
"submit"
name=
"login"
class=
"tombol_login"
value=
"MASUK"
><br>
<a
href=
"register.php"
>
<input
type=
"button"
name=
"register"
class=
"tombol_register"
value=
"DAFTAR"
></button>
</a>
</center>
</form>
</div>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment