Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TMP-2023-24-048
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Maneesha Fernando
TMP-2023-24-048
Commits
346ad2f6
Commit
346ad2f6
authored
Oct 31, 2023
by
Maneesha Fernando
Committed by
GitHub
Oct 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete orders-update.php
parent
3cc5defd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
71 deletions
+0
-71
orders-update.php
orders-update.php
+0
-71
No files found.
orders-update.php
deleted
100644 → 0
View file @
3cc5defd
<?php
//if (session_status() !== PHP_SESSION_ACTIVE) {session_start();}
if
(
session_id
()
==
''
||
!
isset
(
$_SESSION
)){
session_start
();}
include
'config.php'
;
if
(
isset
(
$_SESSION
[
'cart'
]))
{
$total
=
0
;
foreach
(
$_SESSION
[
'cart'
]
as
$product_id
=>
$quantity
)
{
$result
=
$mysqli
->
query
(
"SELECT * FROM products WHERE id = "
.
$product_id
);
if
(
$result
){
if
(
$obj
=
$result
->
fetch_object
())
{
$cost
=
$obj
->
price
*
$quantity
;
$user
=
$_SESSION
[
"username"
];
$query
=
$mysqli
->
query
(
"INSERT INTO orders (product_code, product_name, product_desc, price, units, total, email) VALUES('
$obj->product_code
', '
$obj->product_name
', '
$obj->product_desc
',
$obj->price
,
$quantity
,
$cost
, '
$user
')"
);
if
(
$query
){
$newqty
=
$obj
->
qty
-
$quantity
;
if
(
$mysqli
->
query
(
"UPDATE products SET qty = "
.
$newqty
.
" WHERE id = "
.
$product_id
)){
}
}
//send mail script
/*$query = $mysqli->query("SELECT * from orders order by date desc");
if($query){
while ($obj = $query->fetch_object()){
$subject = "Your Order ID ".$obj->id;
$message = "<html><body>";
$message .= '<p><h4>Order ID ->'.$obj->id.'</h4></p>';
$message .= '<p><strong>Date of Purchase</strong>: '.$obj->date.'</p>';
$message .= '<p><strong>Product Code</strong>: '.$obj->product_code.'</p>';
$message .= '<p><strong>Product Name</strong>: '.$obj->product_name.'</p>';
$message .= '<p><strong>Price Per Unit</strong>: '.$obj->price.'</p>';
$message .= '<p><strong>Units Bought</strong>: '.$obj->units.'</p>';
$message .= '<p><strong>Total Cost</strong>: '.$obj->total.'</p>';
$message .= "</body></html>";
$headers = "From: support@techbarrack.com";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$sent = mail($user, $subject, $message, $headers) ;
if($sent){
$message = "";
}
else {
echo 'Failure';
}
}
}*/
}
}
}
}
unset
(
$_SESSION
[
'cart'
]);
header
(
"location:success.php"
);
?>
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