-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdateItem.php
38 lines (32 loc) · 1.09 KB
/
updateItem.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/*
Student ID : 1784765
Name: Vivek S Patil
Functonality : This page Updates the status of the item when buy now button in the bidding page is clicked.
*/
session_start();
$vCustId = $_SESSION["CustomerID"];
$itemNumber = $_POST['itemNumber'];
$xmlFile = "../../data/auction.xml";
$doc = DOMDocument::load($xmlFile);
$items = $doc->getElementsByTagName("item");
foreach($items as $item)
{
$ItemNumber = $item->getElementsByTagName("Number");
$ItemNumber = $ItemNumber->item(0)->nodeValue;
if ($itemNumber == $ItemNumber)
{
$BINPrice = $item->getElementsByTagName("BuyItNowPrice");
$BINPrice = $BINPrice->item(0)->nodeValue;
$CurrentBidPrice = $item->getElementsByTagName("CurrentBidPrice");
$CurrentBidPrice->item(0)->nodeValue = $BINPrice;
$Status = $item->getElementsByTagName("Status");
$Status->item(0)->nodeValue = "sold";
$Bidder = $item->getElementsByTagName("Bidder");
$Bidder->item(0)->nodeValue = $vCustId;
$doc->saveXML();
$doc->save($xmlFile);
echo "Thank you for purchasing this item";
}
}
?>