Phpmicro
Phpmicro
1.Login Page :
<html>
<head>
<title>Login</title>
<style>
body {
margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 80px;
background-color: azure;
color: palevioletred;
font-family: verdana;
font-size: 100%;
h1 {
color: indigo;
font-family: verdana;
font-size: 100%;
h3 {
color: indigo;
font-family: verdana;
font-size: 100%;
}
</style>
</head>
<body>
<center><h3>Login Form</h3></center>
<legend>
<fieldset>
<center>
</center>
</fieldset>
</legend>
</form>
<?php
if (isset($_POST["submit"])) {
$user = $_POST['user'];
$pass = $_POST['pass'];
if ($numrows != 0) {
$dbusername = $row['name'];
$dbpassword = $row['password'];
session_start();
$_SESSION['sess_user'] = $user;
header("Location: cart.php");
} else {
} else {
?>
</body>
</html>
2.Registration Page :
<html>
<head>
<title>Register</title>
<style>
body {
margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 80px;
background-color: azure;
color: palevioletred;
font-family: verdana;
font-size: 100%;
h1 {
color: indigo;
font-family: verdana;
font-size: 100%;
h2 {
color: indigo;
font-family: verdana;
font-size: 100%;
</style>
</head>
<body>
<center><h2>Registration Form</h2></center>
<fieldset>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td>NAME:</td>
<td>CONTACT:</td>
<td>E-MAIL:</td>
<td>CITY:</td>
<td>PASSWORD:</td>
</tr>
</table>
</fieldset>
</legend>
</form>
<?php
if (isset($_POST["submit"])) {
$user = $_POST['user'];
$num = $_POST['contact'];
$email = $_POST['email'];
$city = $_POST['city'];
$pass = $_POST['pass'];
$numrows = mysqli_num_rows($query);
if ($numrows == 0) {
if ($result) {
} else {
echo "Failure!";
} else {
echo "That username already exists! Please try again with another.";
} else {
?>
</body>
</html>
3.Cart Page :
<?php
session_start();
$tot = 0;
if (isset($_POST["add_to_cart"])) {
if (isset($_SESSION["shopping_cart"])) {
if (!in_array($_GET["id"], $item_array_id)) {
$count = count($_SESSION["shopping_cart"]);
$item_array = array(
);
$_SESSION["shopping_cart"][$count] = $item_array;
} else {
} else {
$item_array = array(
);
$_SESSION["shopping_cart"][0] = $item_array;
if (isset($_GET["action"])) {
if ($_GET["action"] == "delete") {
if ($values["item_id"] == $_GET["id"]) {
unset($_SESSION["shopping_cart"][$keys]);
// echo '<script>window.location="cart.php"</script>';
if (isset($_POST["submit"])) {
header("Location:bill.php");
?>
<html>
<head></head>
<body>
<br/><br/><br/><br/>
<?php
if (mysqli_num_rows($result) > 0) {
?>
<div class="col-md-4">
</div>
</form>
</div>
<?php
?>
<h3>Order Details</h3>
<div class="table-responsive">
<tr>
<th>Item Name</th>
<th>Quantity</th>
<th>Price</th>
<th>Total</th>
<th>Action</th>
</tr>
<?php
if (!empty($_SESSION["shopping_cart"])) {
$total = 0;
?>
<tr>
</tr>
<?php
$_SESSION["tot"] = $total;
?>
<tr>
<td></td>
</tr>
<?php
?>
</table>
<form method="post">
</form>
</div>
</div>
</body>
</html>
4.Billing Page :
<?php
session_start();
$numrows = mysqli_num_rows($query);
if ($numrows != 0) {
$name = $row['name'];
$num = $row['contact'];
$em = $row['email'];
$city = $row['city'];
$total = $_SESSION['tot'];
?>
<html>
<head>
<title>Bill</title>
<style>
body {
margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 80px;
background-color: azure;
color: palevioletred;
font-family: verdana;
font-size: 100%
h1 {
color: indigo;
font-family: verdana;
font-size: 100%;
h2 {
color: indigo;
font-family: verdana;
font-size: 100%;
</style>
</head>
<body>
<tr>
<td>NAME:</td>
</tr>
<tr>
<td>CONTACT:</td>
</tr>
<tr>
<td>E-MAIL:</td>
</tr>
<tr>
<td>CITY:</td>
</tr>
<tr>
<td>Total Amount:</td>
</tr>
<tr>
</tr>
</table>
</form>
</body>
</html>
<?php
if (isset($_POST["submit"])) {
$n = $_POST["user"];
$c = $_POST["contact"];
$e = $_POST["email"];
$ci = $_POST["city"];
require_once('C:\xampp\lib\class.phpmailer.php');
require_once('C:\xampp\lib\class.smtp.php');
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = "smtp.gmail.com";
$mail->Port = 25;
$mail->Username = "[email protected]";
$mail->setFrom('[email protected]');
$mail->addAddress($e);
$mail->IsHTML(true);
$mail->Body = "
<html>
<body>
<table style='width:600px;'>
<tbody>
<tr>
<td style='width:400px'>$n</td>
</tr>
<tr>
</tr>
<tr>
<td style='width:400px'>$c</td>
</tr>
<tr>
<td style='width:400px'>$ci</td>
</tr>
<tr>
<td style='width:400px'>$total</td>
</tr>
<tr>
</tr>
</tbody>
</table>
</body>
</html>";
if (!$mail->send()) {
} else {
$connect = mysqli_connect("localhost", "root", "", "product2");
$sql = "INSERT INTO order_place(name, contact, email, city, total) VALUES('$n', '$c', '$e',
'$ci', '$total')";
if ($retval) {
} else {
?>