connect_error) die("DB Error"); /* LOGIN */ if(isset($_POST['login'])){ $u=$_POST['user']; $p=md5($_POST['pass']); $q=$conn->query("SELECT * FROM users WHERE username='$u' AND password='$p'"); if($q->num_rows){ $_SESSION['user']=$q->fetch_assoc(); header("Location:index.php"); exit; } } /* LOGOUT */ if(isset($_GET['logout'])){ session_destroy(); header("Location:index.php"); exit; } /* ADD PRODUCT */ if(isset($_POST['add_product'])){ $conn->query("INSERT INTO products(name,barcode,category,price,gst,image) VALUES( '".$conn->real_escape_string($_POST['name'])."', '".$conn->real_escape_string($_POST['barcode'])."', '".$conn->real_escape_string($_POST['category'])."', '$_POST[price]','$_POST[gst]', '".$conn->real_escape_string($_POST['image'])."' )"); } /* SAVE ORDER */ if(isset($_POST['save'])){ $conn->query("INSERT INTO orders(total,gst) VALUES('$_POST[total]','$_POST[gst]')"); $oid=$conn->insert_id; $items=json_decode($_POST['items'],true); foreach($items as $i){ $conn->query("INSERT INTO order_items(order_id,product,qty,price) VALUES('$oid','".$conn->real_escape_string($i['name'])."','$i[qty]','$i[price]')"); } exit("OK"); } ?> POS

POS Login

🧾 POS Logout
query("SELECT * FROM products"); while($r=$p->fetch_assoc()){ ?>