Commit ece08ff5 authored by wutthichai sritonwong's avatar wutthichai sritonwong

15/03/62

parent f170a90b
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
...@@ -10,12 +11,14 @@ ...@@ -10,12 +11,14 @@
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'> <link href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'>
<style> <style>
body, html{ body,
background-color:#34515E; html {
background-color: #34515E;
font-family: 'Open Sans Condensed', sans-serif; font-family: 'Open Sans Condensed', sans-serif;
font-size: 18px; font-size: 18px;
} }
.register-form{
.register-form {
font-size: 16px; font-size: 16px;
left: 50%; left: 50%;
top: 50%; top: 50%;
...@@ -24,47 +27,55 @@ ...@@ -24,47 +27,55 @@
-moz-transform: translate3d(-50%, -50%, 0); -moz-transform: translate3d(-50%, -50%, 0);
transform: translate3d(-50%, -50%, 0); transform: translate3d(-50%, -50%, 0);
} }
.regbutton{
.regbutton {
height: 50px; height: 50px;
width: 200px; width: 200px;
background-color:tomato; background-color: tomato;
border-radius: 0px; border-radius: 0px;
font-size: 18px; font-size: 18px;
color:white; color: white;
border: none !important; border: none !important;
margin-bottom: 5px; margin-bottom: 5px;
} }
.regbutton:hover{
.regbutton:hover {
color: white; color: white;
background-color:#aa422f; background-color: #aa422f;
} }
.regbutton:active{
.regbutton:active {
color: white; color: white;
background-color:#aa422f; background-color: #aa422f;
} }
.logbutton{
.logbutton {
height: 50px; height: 50px;
width: 200px; width: 200px;
background-color:yellowgreen; background-color: yellowgreen;
border-radius: 0px; border-radius: 0px;
font-size: 18px; font-size: 18px;
color:white; color: white;
border: none !important; border: none !important;
margin-bottom: 5px; margin-bottom: 5px;
} }
.logbutton:hover{
.logbutton:hover {
color: white; color: white;
background-color:darkolivegreen; background-color: darkolivegreen;
} }
.logbutton:active{
.logbutton:active {
color: white; color: white;
background-color:darkolivegreen; background-color: darkolivegreen;
} }
.register-form label{
.register-form label {
color: aliceblue; color: aliceblue;
} }
.register-form input{
.register-form input {
margin-bottom: 5px; margin-bottom: 5px;
width: 430px; width: 430px;
height: 40px; height: 40px;
...@@ -73,8 +84,9 @@ ...@@ -73,8 +84,9 @@
</style> </style>
</head> </head>
<body> <body>
<div class="container-fluid"> <div class="container-fluid">
<form action="#" method="get" class="register-form"> <form action="#" method="get" class="register-form">
<div class="row"> <div class="row">
<div class="col-md-4 col-sm-4 col-lg-4"> <div class="col-md-4 col-sm-4 col-lg-4">
...@@ -105,38 +117,41 @@ ...@@ -105,38 +117,41 @@
<button class="btn btn-default regbutton" type="submit" name="submit" onclick="login">สมัครใช้งาน</button> <button class="btn btn-default regbutton" type="submit" name="submit" onclick="login">สมัครใช้งาน</button>
</div> </div>
</div> </div>
<center><div class="col-md"> <center>
<div class="col-md">
<a class="btn btn-default regbutton" href="/LG">Login</a> <a class="btn btn-default regbutton" href="/LG">Login</a>
</div></center> </div>
</center>
</form> </form>
</div> </div>
<?php <?php
$servername = "localhost"; $servername = "localhost";
$username = "dbAdmin"; $username = "dbAdmin";
$password = "P@ss1234"; $password = "P@ss1234";
$dbname = "projectweb"; $dbname = "projectweb";
$conn = new mysqli($servername,$username,$password,$dbname); $conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) { if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error); die("Connection failed: " . $conn->connect_error);
}else{ } else {
if (isset($_GET['submit'])){ if (isset($_GET['submit'])) {
$U_USER = $_GET['Username']; $U_USER = $_GET['Username'];
$U_PASS = $_GET['password']; $U_PASS = $_GET['password'];
$U_NAME = $_GET['name']; $U_NAME = $_GET['name'];
$sql = "INSERT INTO `USERS` (`Name_U`, `Password_U`, `U_Name`) $sql = "INSERT INTO `USERS` (`Name_U`, `Password_U`, `U_Name`)
VALUES ('$U_USER','$U_PASS','$U_NAME')"; VALUES ('$U_USER','$U_PASS','$U_NAME')";
if ($conn->query($sql) === TRUE) { if ($conn->query($sql) === true) {
echo "New record created successfully"; echo "New record created successfully";
} else { } else {
echo "Error: " . $sql . "<br>" . $conn->error; echo "Error: " . $sql . "<br>" . $conn->error;
} }
$conn->close(); $conn->close();
}else{ } else {
// echo 'กรุณากรอกข้อมูล'; // echo 'กรุณากรอกข้อมูล';
} }
} }
?> ?>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -70,35 +70,34 @@ ...@@ -70,35 +70,34 @@
$dbname = "projectweb"; $dbname = "projectweb";
$conn = mysqli_connect($servername, $username, $password, $dbname); $conn = mysqli_connect($servername, $username, $password, $dbname);
if (isset($_GET['submit'])){ if (isset($_GET['submit'])) {
$users = $_GET['Username']; $users = $_GET['Username'];
$Passs = $_GET['password']; $Passs = $_GET['password'];
$sql = "SELECT * FROM `USERS`"; $sql = "SELECT * FROM `USERS`";
$result = mysqli_query($conn, $sql); $result = mysqli_query($conn, $sql);
$a=array(); $a = array();
if (mysqli_num_rows($result) > 0) { if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) {
$a[$row[1]]=$row[2]; $a[$row[1]] = $row[2];
} }
if (array_key_exists($users,$a)){ if (array_key_exists($users, $a)) {
if($Passs==$a[$users]){ if ($Passs == $a[$users]) {
// print("<script language='javascript'>alert(\"สวัสดี \ $users \\ยินดีต้อนรับสู่เว็บไซต์ ร้อยทิป\");</script>"); // print("<script language='javascript'>alert(\"สวัสดี \ $users \\ยินดีต้อนรับสู่เว็บไซต์ ร้อยทิป\");</script>");
print("<script language='javascript'>window.location = '/';</script>"); print("<script language='javascript'>window.location = '/';</script>");
}else{ } else {
print("<script language='javascript'>alert(\"พาสเวิร์ดของ \ $users \\ไม่ถูกต้อง\");</script>"); print("<script language='javascript'>alert(\"พาสเวิร์ดของ \ $users \\ไม่ถูกต้อง\");</script>");
} }
} } else {
else{
print("<script language='javascript'>alert(\"ไม่มีผู้ใช้ \ $users \\ในระบบนี้\");</script>"); print("<script language='javascript'>alert(\"ไม่มีผู้ใช้ \ $users \\ในระบบนี้\");</script>");
} }
} else { } else {
echo "0 results"; echo "0 results";
}} }
}
mysqli_close($conn); mysqli_close($conn);
?> ?>
<!----------------------------------------------------------------JS---------------------------------------------------------------------------- --> <!----------------------------------------------------------------JS---------------------------------------------------------------------------- -->
<script src="vendor/jquery/jquery-3.2.1.min.js" type="9965159fe884f58a103521bc-text/javascript"></script> <script src="vendor/jquery/jquery-3.2.1.min.js" type="9965159fe884f58a103521bc-text/javascript"></script>
<script src="vendor/bootstrap/js/popper.js" type="9965159fe884f58a103521bc-text/javascript"></script> <script src="vendor/bootstrap/js/popper.js" type="9965159fe884f58a103521bc-text/javascript"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js" type="9965159fe884f58a103521bc-text/javascript"></script> <script src="vendor/bootstrap/js/bootstrap.min.js" type="9965159fe884f58a103521bc-text/javascript"></script>
...@@ -124,4 +123,5 @@ ...@@ -124,4 +123,5 @@
<script src="https://ajax.cloudflare.com/cdn-cgi/scripts/a2bd7673/cloudflare-static/rocket-loader.min.js" data-cf-settings="9965159fe884f58a103521bc-|49" defer=""></script> <script src="https://ajax.cloudflare.com/cdn-cgi/scripts/a2bd7673/cloudflare-static/rocket-loader.min.js" data-cf-settings="9965159fe884f58a103521bc-|49" defer=""></script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -30,3 +30,4 @@ Route::get('/Category', function () { ...@@ -30,3 +30,4 @@ Route::get('/Category', function () {
Route::get('/Create', function () { Route::get('/Create', function () {
return view('Create'); return view('Create');
}); });
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