Commit 0018b03f authored by peeradon's avatar peeradon

project

parent 3a3b2257
Pipeline #709 failed with stages
# Netscape HTTP Cookie File
# https://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_wallet.truemoney.com FALSE / TRUE 1556096765 laravel_session eyJpdiI6IlZUWWd0YUJNQVArMmQxWlY1dlBGVEVwNGU0YXdaSVZ3UVN4eWdiZlwvZkVrPSIsInZhbHVlIjoiQWFMdkZGT2txTVQ0UktVTFN5djk3bE1GOE1PbnpmZEx4YVFIeVVmUEMxb25wem1POHZibWt4cWlZUW5qcjU2SXJDMG1BSkJialhcL0kzeHJQdHZpaVB3PT0iLCJtYWMiOiI2NDkyYzhkYzQyNDQ4ZDQyMjk1MThlZGFjNDU3OTY5NjQ1YWMzOWZlMTc1OThjZTg1OGRiODRiY2U3ODgxYWYzIn0%3D
html,body{
background-image:url('https://wallpaper.thaiware.com/upload/wallpaper/2014_01/20906_10577_140125165013_L1.jpg');
background-size: cover;
background-repeat: no-repeat;
height:100%;
font-family: 'Numans', sans-serif;
width: 100%;
}
.note
{
text-align: center;
height: 80px;
background: -webkit-linear-gradient(left, #47eca7, #29ac50);
color: rgb(7, 6, 6);
font-weight: bold;
line-height: 80px;
}
.form-content
{
padding: 5%;
border: 1px solid #ced4da;
margin-bottom: 2%;
}
.form-control{
border-radius:1.5rem;
}
.btnSubmit
{
border:none;
border-radius:1.5rem;
padding: 1%;
width: 20%;
cursor: pointer;
background: #0062cc;
color: #fff;
}
.row{
display: contents;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin-right: -15px;
margin-left: -15px;
}
p{
font-size: 300%;
}
.form-control{
text-align: center;
display: inline-block;
}
.from{
display: table;
}
<?php
include ("configtree.php");
?>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<link rel="stylesheet" href="admin_upload.css">
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
</head>
<body>
<br><br><br><br><br><br>
<div class="container register-form">
<div class="form">
<div class="note">
<p>เพิ่มรายการสินค้า</p>
</div>
<div class="form-content">
<div class="row">
<form action="admin_upload.php" method = "post" enctype="multipart/form-data">
<div class="col-md-6">
<div class="form-group">
<input type="text" name="money" id="" class="form-control" placeholder="ราคา*" value=""/>
</div>
<div class="form-group">
<input type="text"name="Description" id="" class="form-control" placeholder="รายละเอียด *" value=""/>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="text" name="category" class="form-control" placeholder="ประเภท *" value=""/>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="text" name="name" class="form-control" placeholder="ชื่อต้นไม้ *" value=""/>
</div>
</div>
&nbsp;&nbsp;&nbsp;&nbsp;<input type = "file" name = "uploadfile" value= "" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "submit" name = "upload" value = "upload"/>
</div>
<div>
<button type="button" class="btn btn-success"><a href="loginpage.php">ย้อนกลับ</button>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
$msg ="";
if(isset($_POST['upload']))
{
include ("configtree.php");
$image = $_FILES ['uploadfile']['name'];
$tempname = $_FILES["uploadfile"]["tmp_name"];
$target = "photo/".$image;
$d = $_POST['Description'];
$c = $_POST['category'];
$m = $_POST['money'];
$n = $_POST['name'];
$sql = "INSERT INTO images (image,Description,category,money,name) VALUE ('$image','$d','$c','$m','$n')";
mysqli_query($con,$sql);
if(move_uploaded_file($_FILES['uploadfile']['tmp_name'],$target)){
$msg = "image uploaded successfully";
}else{
$msg = "image uploaded problem";
}
}
?>
<?php
session_start();
include("configtree.php");
if(isset($_POST["add_to_cart"]))
{
if(isset($_SESSION["shopping_cart"]))
{
$item_array_id = array_column($_SESSION["shopping_cart"], "item_id");
if(!in_array($_GET["id"], $item_array_id))
{
$count = count($_SESSION["shopping_cart"]);
$item_array = array(
'item_id' => $_GET["id"],
'item_name' => $_POST["hidden_name"],
'item_price' => $_POST["hidden_price"],
'item_quantity' => $_POST["quantity"]
);
$_SESSION["shopping_cart"][$count] = $item_array;
}
else
{
echo '<script>alert("Item Already Added")</script>';
echo '<script>window.location="loginpage.php"</script>';
}
}
else
{
$item_array = array(
'item_id' => $_GET["id"],
'item_name' => $_POST["hidden_name"],
'item_price' => $_POST["hidden_price"],
'item_quantity' => $_POST["quantity"]
);
$_SESSION["shopping_cart"][0] = $item_array;
}
}
if(isset($_GET["action"]))
{
if($_GET["action"] == "delete")
{
foreach($_SESSION["shopping_cart"] as $keys => $values)
{
if($values["item_id"] == $_GET["id"])
{
unset($_SESSION["shopping_cart"][$keys]);
echo '<script>alert("Item Removed")</script>';
}
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Shopping Cart</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container" style="width:700px;">
<div style="clear:both"></div>
<br />
<h3>Order Details</h3>
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<th width="40%">Item Name</th>
<th width="10%">Quantity</th>
<th width="20%">Price</th>
<th width="15%">Total</th>
<th width="5%">Action</th>
</tr>
<?php
if(!empty($_SESSION["shopping_cart"]))
{
$total = 0;
foreach($_SESSION["shopping_cart"] as $keys => $values)
{
?>
<tr>
<td><?php echo $values["item_name"]; ?></td>
<td><?php echo $values["item_quantity"]; ?></td>
<td>$ <?php echo $values["item_price"]; ?></td>
<td>$ <?php echo number_format($values["item_quantity"] * $values["item_price"], 2); ?></td>
<td><a href="cartadmin.php?action=delete&id=<?php echo $values["item_id"]; ?>"><span class="text-danger">Remove</span></a></td>
</tr>
<?php
$total = $total + ($values["item_quantity"] * $values["item_price"]);
}
?>
<tr>
<td colspan="3" align="right">Total</td>
<td align="right">$ <?php echo number_format($total, 2); ?></td>
<td></td>
</tr>
<?php
}
?>
</table>
</div>
<button><a href="loginpage.php">Back</a></button>
</div>
<br />
</body>
</html>
\ No newline at end of file
<?php
session_start();
include("configtree.php");
if(isset($_POST["add_to_cart"]))
{
if(isset($_SESSION["shopping_cart"]))
{
$item_array_id = array_column($_SESSION["shopping_cart"], "item_id");
if(!in_array($_GET["id"], $item_array_id))
{
$count = count($_SESSION["shopping_cart"]);
$item_array = array(
'item_id' => $_GET["id"],
'item_name' => $_POST["hidden_name"],
'item_price' => $_POST["hidden_price"],
'item_quantity' => $_POST["quantity"]
);
$_SESSION["shopping_cart"][$count] = $item_array;
}
else
{
echo '<script>alert("Item Already Added")</script>';
echo '<script>window.location="user_page.php"</script>';
}
}
else
{
$item_array = array(
'item_id' => $_GET["id"],
'item_name' => $_POST["hidden_name"],
'item_price' => $_POST["hidden_price"],
'item_quantity' => $_POST["quantity"]
);
$_SESSION["shopping_cart"][0] = $item_array;
}
}
if(isset($_GET["action"]))
{
if($_GET["action"] == "delete")
{
foreach($_SESSION["shopping_cart"] as $keys => $values)
{
if($values["item_id"] == $_GET["id"])
{
unset($_SESSION["shopping_cart"][$keys]);
echo '<script>alert("Item Removed")</script>';
}
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Shopping Cart</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container" style="width:700px;">
<div style="clear:both"></div>
<br />
<h3>Order Details</h3>
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<th width="40%">Item Name</th>
<th width="10%">Quantity</th>
<th width="20%">Price</th>
<th width="15%">Total</th>
<th width="5%">Action</th>
</tr>
<?php
if(!empty($_SESSION["shopping_cart"]))
{
$total = 0;
foreach($_SESSION["shopping_cart"] as $keys => $values)
{
?>
<tr>
<td><?php echo $values["item_name"]; ?></td>
<td><?php echo $values["item_quantity"]; ?></td>
<td>$ <?php echo $values["item_price"]; ?></td>
<td>$ <?php echo number_format($values["item_quantity"] * $values["item_price"], 2); ?></td>
<td><a href="cartuser.php?action=delete&id=<?php echo $values["item_id"]; ?>"><span class="text-danger">Remove</span></a></td>
</tr>
<?php
$total = $total + ($values["item_quantity"] * $values["item_price"]);
}
?>
<tr>
<td colspan="3" align="right">Total</td>
<td align="right">$ <?php echo number_format($total, 2); ?></td>
<td></td>
</tr>
<?php
}
?>
</table>
</div>
<button><a href="user_page.php">Back</a></button>
</div>
<br />
</body>
</html>
\ No newline at end of file
<?php
session_start();
if(isset($_POST['Username'])){
//connection
include("config.php");
//รับค่า user & password
$Username = $_POST['Username'];
$Password = $_POST['Password'];
//query
$sql="SELECT * FROM member Where Username='".$Username."' and Password='".$Password."' ";
$result = mysqli_query($con,$sql);
if(mysqli_num_rows($result)==1){
$row = mysqli_fetch_array($result);
$_SESSION["user"] = $Username;
$_SESSION["Status"] = $row["Status"];
if($_SESSION["Status"]=="ADMIN"){ //ถ้าเป็น admin ให้กระโดดไปหน้า admin_page.php
Header("Location: loginpage.php");
}
if ($_SESSION["Status"]=="USER"){ //ถ้าเป็น member ให้กระโดดไปหน้า user_page.php
Header("Location: user_page.php");
}
}else{
echo "<script>";
echo "alert(\" user หรือ password ไม่ถูกต้อง\");";
echo "window.history.back()";
echo "</script>";
}
}else{
Header("Location: login.php"); //user & password incorrect back to login again
}
?>
<?php
$con= mysqli_connect("localhost","root","","user") or die("Error: " . mysqli_error($con));
mysqli_query($con, "SET NAMES 'utf8' ");
?>
\ No newline at end of file
<?php
$con= mysqli_connect("localhost","root","","tree") or die("Error: " . mysqli_error($con));
mysqli_query($con, "utf8");
?>
\ No newline at end of file
<?php
include("configtree.php");
$rollno = $_GET['rn'];
$query = "Delete from images where id ='$rollno'";
$data = mysqli_query($con,$query);
if($data){
echo "delete from table";
?>
<META http-equiv='Refresh' content="0;URL=http://localhost/project/main/loginpage.php">
<?php
}else{
echo"delete failed";
}
?>
\ No newline at end of file
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<link rel="stylesheet" href="main.css">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<div class='container'>
<center><h1>Welcome to FAN</h1></center>
<div class='navbar navbar-inverse'>
<div class='navbar-inner nav-collapse' style="height: auto;">
<ul class="nav">
<li class="active"><a href="index.php">หน้าแรก</a></li>
<li><a href="login.php"id='edit' style="display:show">เข้าสู่ระบบ</a></li>
<li><a href="register.php">สมัครสมาชิก</a></li>
<li><a href="test.php">cart</a></li>
</ul>
</div>
</div>
<?php
include ("configtree.php");
$sql = "SELECT * FROM images";
$result = mysqli_query($con,$sql);
$total = mysqli_num_rows($result);
?>
<div class="container" style="width:700px;">
<?php
$query = "SELECT * FROM images ORDER BY id ASC";
$result = mysqli_query($con, $query);
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_array($result))
{ $folder = "photo/".$row['image'];
?>
<div class="col-md-4">
<form method="post" action="test.php?action=add&id=<?php echo $row["id"]; ?>">
<div style="border:1px solid #333; background-color:#f1f1f1; border-radius:1px; padding:px;" align="center">
<img src="<?php echo $folder; ?>" class="img-responsive" /><br />
<h4 class="text-info"><?php echo $row["name"]; ?></h4>
<h4 class="text-danger">$ <?php echo $row["money"]; ?></h4>
<input type="text" name="quantity" class="form-control" value="1" />
<input type="hidden" name="hidden_name" value="<?php echo $row["category"]; ?>" />
<input type="hidden" name="hidden_name" value="<?php echo $row["name"]; ?>" />
<input type="hidden" name="hidden_price" value="<?php echo $row["money"]; ?>" />
<input type="submit" name="add_to_cart" style="margin-top:5px;" class="btn btn-success" value="Add to Cart" />
</div>
</form>
</div>
<?php
}
}
?>
</body>
</body>
\ No newline at end of file
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<!--Made with love by Mutiullah Samim -->
<!--Bootsrap 4 CDN-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<!--Fontawesome CDN-->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<!--Custom styles-->
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<div class="container">
<div class="d-flex justify-content-center h-100">
<div class="card">
<div class="card-header">
<h3>Sign In</h3>
</div>
<div class="card-body">
<form name="form1" method ="post" action="check_login.php" >
<div class="input-group form-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-user"></i></span>
</div>
<input name="Username" type="text" class="form-control" id="Username" placeholder="Username">
</div>
<div class="input-group form-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-key"></i></span>
</div>
<input name="Password" type="password" class="form-control" id="Password" placeholder="Password">
</div>
<div class="form-group">
<input type="submit" name="Submit" value="Login" class="btn float-right login_btn">
</div>
<div class="form-group">
<a href="index.php" class="btn btn-warning">Home</a>
</div>
</form>
</div>
<div class="d-flex justify-content-center links">
<h5>Don't have an account?</h5><a href="register.php">Sign Up</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<link rel="stylesheet" href="main.css">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<div class='container'>
<center><h1>Welcome to FAN</h1></center>
<right><h3><?php session_start();
echo "Username : ";
echo $_SESSION["user"]."<br>";
?></h3><right>
<h3><?php
echo "Status : ";
echo $_SESSION["Status"];
?></h3>
<div class='navbar navbar-inverse'>
<div class='navbar-inner nav-collapse' style="height: auto;">
<ul class="nav">
<li class="active"><a href="loginpage.php">หน้าแรก</a></li>
<li><a href="admin_upload.php">Upload order</a></li>
<li><a href="cartadmin.php">cart</a></li>
<li><a href='logout.php'>Logout</a></li>
</ul>
</div>
</div>
<?php
include ("configtree.php");
$sql = "SELECT * FROM images";
$result = mysqli_query($con,$sql);
$total = mysqli_num_rows($result);
?>
<div class="container" style="width:700px; ">
<?php
$query = "SELECT * FROM images ORDER BY id ASC";
$result = mysqli_query($con, $query);
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_array($result))
{ $folder = "photo/".$row['image'];
?>
<div class="col-md-4">
<form method="post" action="cartadmin.php?action=add&id=<?php echo $row["id"]; ?>">
<div style="border:1px solid #333; background-color:#f1f1f1; border-radius:5px; padding:16px;" align="center">
<img src="<?php echo $folder; ?>" class="img-responsive" /><br />
<h4 class="text-info"><?php echo $row["name"]; ?></h4>
<h4 class="text-danger">$ <?php echo $row["money"]; ?></h4>
<input type="text" name="quantity" class="form-control" value="1" />
<input type="hidden" name="hidden_name" value="<?php echo $row["category"]; ?>" />
<input type="hidden" name="hidden_name" value="<?php echo $row["name"]; ?>" />
<input type="hidden" name="hidden_price" value="<?php echo $row["money"]; ?>" />
<input type="submit" name="add_to_cart" style="margin-top:5px;" class="btn btn-success" value="Add to Cart" />
<button class="btn btn-success"style="margin-top:5px;" ><a href='delete.php?rn=<?php echo $row["id"]; ?>' onclick='return chkdelete()'>Delete</a></button>
</div>
</form>
</div>
<?php
}
}
?>
</body>
<script>
function chkdelete(){
return confirm("Are you sure to delete");
}
</script>
</body>
\ No newline at end of file
<?php
session_start();
session_destroy();
header("location:index.php");
?>
\ No newline at end of file
html,body{
background-image:linear-gradient(rgba(228, 222, 222, 0.425),rgba(80, 255, 255, 0.13)),url('https://simg.kapook.com/o/photo/458/kapook_world-456041.jpg');
background-size: cover;
background-repeat: no-repeat;
height: auto;
font-family: 'Numans', sans-serif;
width: auto;
}
h1{
color:aqua(244, 247, 247);
}
* {box-sizing: border-box}
body {font-family: "Lato", sans-serif;}
/* Style the tab */
.tab {
float: left;
background-color: #f1f1f1;
width: 20%;
height: auto;
}
/* Style the buttons inside the tab */
.tab button {
display: block;
background-color:rgba(95, 206, 188, 0.356);
color:black;
padding: 22px 16px;
width: 100%;
border: none;
outline: none;
text-align: left;
cursor: pointer;
font-size: 17px;
}
.tabcontent {
float: left;
padding: 0px 12px;
border: 1px solid #ccc;
border-left: none;
height: auto;
display: none;
}
.clearfix::after {
content: "";
clear: both;
display: table;
}
.thumbnail {
display: -webkit-inline-box;
padding: 4px;
line-height: 20px;
border: 1px solid #ddd;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.col-md-4{
width: 33%;
height: 20%;
}
.img{
height: 50%;
width: 50%;
}
This diff is collapsed.
body{
background-image: linear-gradient(rgba(93, 253, 30, 0.24),rgba(220, 253, 242, 0.25)),url(https://png.pngtree.com/thumb_back/fw800/back_pic/04/11/43/475819d50695c9e.jpg);
background-size: cover;
background-repeat: no-repeat;
height: 100%;
font-family: 'Numans', sans-serif;
}
.card-header{
background-color:rgba(93, 253, 30, 0.014);
}.card-body{
background-color:rgba(93, 253, 30, 0.11);
}
.login-register{
background-color: rgba(93, 253, 30, 0.082);
}
.btn-outline-warning {
color: #17a2b8;
background-color: transparent;
background-image: none;
border-color: #17a2b8;
}
.card{
position: relative;
display: -ms-flexbox;
display: flex;
-ms-flex-direction: column;
flex-direction: column;
min-width: 0;
word-wrap: break-word;
/* background-color: #fff; */
background-clip: border-box;
/* border: 1px solid rgba(0,0,0,.125); */
/* border-radius: .25rem; */
}
\ No newline at end of file
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<link rel="stylesheet" href="register.css">
<body>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8"><br><br>
<div class="card">
<div class="card-header">สมัครสมาชิก</div>
<div class="card-body">
<form name="form2" method="post" action="save_register.php">
<div class="form-group">
<label for="name" class="cols-sm-2 control-label">Name</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"></i></span>
<input type="text" class="form-control" name="name" id="name" placeholder="Enter your Name" />
</div>
</div>
</div>
<div class="form-group">
<label for="username" class="cols-sm-2 control-label">Username</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-users fa" aria-hidden="true"></i></span>
<input type="text" class="form-control" name="username" id="username" placeholder="Enter your Username" />
</div>
</div>
</div>
<div class="form-group">
<label for="password" class="cols-sm-2 control-label">Password</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-lock fa-lg" aria-hidden="true"></i></span>
<input type="password" class="form-control" name="password" id="password" placeholder="Enter your Password" />
</div>
</div>
</div>
<div class="form-group">
<label for="confirm" class="cols-sm-2 control-label">Confirm Password</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-lock fa-lg" aria-hidden="true"></i></span>
<input type="password" class="form-control" name="confirm" id="confirm" placeholder="Confirm your Password" />
</div>
</div>
</div>
<div class="form-group">
<input type="submit" name="save-register" value="Register" button type="button" class="btn btn-outline-info">
</div>
</div>
<div class="login-register">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="login.php" butt on type="button" class="btn btn-outline-info">Login</a>&nbsp;&nbsp;
<a href="index.php"button type="button" class="btn btn-outline-info">Home</a><br> &nbsp;&nbsp;
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</body>
\ No newline at end of file
<?php
include("config.php");
if(trim($_POST["name"]) == "")
{
echo "<script>";
echo "alert(\"Please input name \");";
echo "window.history.back()";
echo "</script>";
exit();
}
if(trim($_POST["username"]) == "")
{
echo "<script>";
echo "alert(\"Please input username!\");";
echo "window.history.back()";
echo "</script>";
exit();
}
if(trim($_POST["password"]) == "")
{
echo "<script>";
echo "alert(\" Please input Password!\");";
echo "window.history.back()";
echo "</script>";
exit();
}
if(trim($_POST["confirm"]) == "")
{
echo "<script>";
echo "alert(\" Please input ConfirmPassword!\");";
echo "window.history.back()";
echo "</script>";
exit();
}
if($_POST["password"] != $_POST["confirm"])
{
echo "<script>";
echo "alert(\"Password not Match!\");";
echo "window.history.back()";
echo "</script>";
exit();
}
$_POST["Status"]="USER";
$sql="SELECT * FROM member Where Username='".$_POST["username"]."' ";
$result = mysqli_query($con,$sql);
$record=mysqli_fetch_array($result,MYSQLI_ASSOC);
if($record['Username']==$_POST["username"]){
echo "<script>";
echo "alert(\"Username already exists!\");";
echo "window.history.back()";
echo "</script>";
}
else{
$sql = "INSERT INTO member (Username,password,name,Status) VALUES ('".$_POST["username"]."',
'".$_POST["password"]."','".$_POST["name"]."','".$_POST["Status"]."')";
$result = mysqli_query($con,$sql);
echo "<script>";
echo "alert(\"Register Completed!\");";
echo "window.location='login.php';";
echo "</script>";
}
mysqli_close($con);
?>
\ No newline at end of file
/* Made with love by Mutiullah Samim*/
@import url('https://fonts.googleapis.com/css?family=Numans');
html,body{
background-image:linear-gradient(white,rgba(80, 255, 255, 0.178)),url('http://4.bp.blogspot.com/-wpn-Ku1-jlE/VfoaU1IXByI/AAAAAAAAAFY/rUKNX9pclaQ/s1600/vyaz-vetv-listva-zelenyy-fon.jpg');
background-size: cover;
background-repeat: no-repeat;
height: 100%;
font-family: 'Numans', sans-serif;
}
.container{
height: 100%;
align-content: center;
}
.card{
height: 250px;
margin-top: auto;
margin-bottom: auto;
width: 400px;
background-color: rgba(0,0,0,0.5) !important;
}
.social_icon span{
font-size: 60px;
margin-left: 10px;
color: #FFC312;
}
.social_icon span:hover{
color: white;
cursor: pointer;
}
.card-header h3{
color: white;
}
.social_icon{
position: absolute;
right: 20px;
top: -45px;
}
.input-group-prepend span{
width: 50px;
background-color: #FFC312;
color: black;
border:0 !important;
}
input:focus{
outline: 0 0 0 0 !important;
box-shadow: 0 0 0 0 !important;
}
.remember{
color: white;
}
.remember input{
width: 20px;
height: 20px;
margin-left: 15px;
margin-right: 5px;
}
.login_btn{
color: black;
background-color: #FFC312;
width: 100px;
}
.login_btn:hover{
color: black;
background-color: white;
}
.links{
color: white;
}
.links a{
margin-left: 4px;
}
input[type=save-register] {
background-color: #4CAF50;
border: none;
color: white;
padding: 16px 32px;
text-decoration: none;
margin: 4px 2px;
cursor: pointer;
}
h5{
color:black;
}
\ No newline at end of file
<?php
session_start();
include("configtree.php");
if(isset($_POST["add_to_cart"]))
{
if(isset($_SESSION["shopping_cart"]))
{
$item_array_id = array_column($_SESSION["shopping_cart"], "item_id");
if(!in_array($_GET["id"], $item_array_id))
{
$count = count($_SESSION["shopping_cart"]);
$item_array = array(
'item_id' => $_GET["id"],
'item_name' => $_POST["hidden_name"],
'item_price' => $_POST["hidden_price"],
'item_quantity' => $_POST["quantity"]
);
$_SESSION["shopping_cart"][$count] = $item_array;
}
else
{
echo '<script>alert("Item Already Added")</script>';
echo '<script>window.location="index.php"</script>';
}
}
else
{
$item_array = array(
'item_id' => $_GET["id"],
'item_name' => $_POST["hidden_name"],
'item_price' => $_POST["hidden_price"],
'item_quantity' => $_POST["quantity"]
);
$_SESSION["shopping_cart"][0] = $item_array;
}
}
if(isset($_GET["action"]))
{
if($_GET["action"] == "delete")
{
foreach($_SESSION["shopping_cart"] as $keys => $values)
{
if($values["item_id"] == $_GET["id"])
{
unset($_SESSION["shopping_cart"][$keys]);
echo '<script>alert("Item Removed")</script>';
}
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Shopping Cart</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container" style="width:700px;">
<div style="clear:both"></div>
<br />
<h3>Order Details</h3>
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<th width="40%">Item Name</th>
<th width="10%">Quantity</th>
<th width="20%">Price</th>
<th width="15%">Total</th>
<th width="5%">Action</th>
</tr>
<?php
if(!empty($_SESSION["shopping_cart"]))
{
$total = 0;
foreach($_SESSION["shopping_cart"] as $keys => $values)
{
?>
<tr>
<td><?php echo $values["item_name"]; ?></td>
<td><?php echo $values["item_quantity"]; ?></td>
<td>$ <?php echo $values["item_price"]; ?></td>
<td>$ <?php echo number_format($values["item_quantity"] * $values["item_price"], 2); ?></td>
<td><a href="test.php?action=delete&id=<?php echo $values["item_id"]; ?>"><span class="text-danger">Remove</span></a></td>
</tr>
<?php
$total = $total + ($values["item_quantity"] * $values["item_price"]);
}
?>
<tr>
<td colspan="3" align="right">Total</td>
<td align="right">$ <?php echo number_format($total, 2); ?></td>
<td></td>
</tr>
<?php
}
?>
</table>
</div>
<button><a href="index.php">Back</a></button>
</div>
<br />
</body>
</html>
\ No newline at end of file
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<link rel="stylesheet" href="main.css">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<div class='container'>
<center><h1>Welcome to FAN</h1></center>
<right><h3><?php session_start();
echo "Username : ";
echo $_SESSION["user"]."<br>";
?></h3><right>
<h3><?php
echo "Status : ";
echo $_SESSION["Status"];
?></h3>
<div class='navbar navbar-inverse'>
<div class='navbar-inner nav-collapse' style="height: auto;">
<ul class="nav">
<li class="active"><a href="user_page.php">หน้าแรก</a></li>
<li><a href="cartuser.php">cart</a></li>
<li><a href='logout.php'>Logout</a></li>
</ul>
</div>
</div>
<?php
include ("configtree.php");
$sql = "SELECT * FROM images";
$result = mysqli_query($con,$sql);
$total = mysqli_num_rows($result);
?>
<div class="container" style="width:700px;">
<?php
$query = "SELECT * FROM images ORDER BY id ASC";
$result = mysqli_query($con, $query);
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_array($result))
{ $folder = "photo/".$row['image'];
?>
<div class="col-md-4">
<form method="post" action="cartuser.php?action=add&id=<?php echo $row["id"]; ?>">
<div style="border:1px solid #333; background-color:#f1f1f1; border-radius:5px; padding:16px;" align="center">
<img src="<?php echo $folder; ?>" class="img-responsive" /><br />
<h4 class="text-info"><?php echo $row["name"]; ?></h4>
<h4 class="text-danger">$ <?php echo $row["money"]; ?></h4>
<input type="text" name="quantity" class="form-control" value="1" />
<input type="hidden" name="hidden_name" value="<?php echo $row["category"]; ?>" />
<input type="hidden" name="hidden_name" value="<?php echo $row["name"]; ?>" />
<input type="hidden" name="hidden_price" value="<?php echo $row["money"]; ?>" />
<input type="submit" name="add_to_cart" style="margin-top:5px;" class="btn btn-success" value="Add to Cart" />
</div>
</form>
</div>
<?php
}
}
?>
</body>
</body>
\ No newline at end of file
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