-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleaderboard.php
32 lines (22 loc) · 881 Bytes
/
leaderboard.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
<?php
if (isset($_POST['username']) && isset($_POST['ipaddress']) && isset($_POST['highscore'])){
$xml = new DomDocument("1.0", "UTF-8");
$xml->load("users.xml");
$username = $_POST["username"];
$ipaddress = $_POST["ipaddress"];
$highscore = $_POST["highscore"];
// Create New Nodes
$userTag = $xml->createElement("USER");
$userTag = $xml->documentElement->appendChild($userTag);
$usernameTag = $xml->createElement("USERNAME", $username);
$usernameTag = $userTag->appendChild($usernameTag);
$ipAddressTag = $xml->createElement("IPADDRESS", $ipaddress);
$ipAddressTag = $userTag->appendChild($ipAddressTag);
$highScoreTag = $xml->createElement("HIGHSCORE", $highscore);
$highScoreTag = $userTag->appendChild($highScoreTag);
// Save XML
$xml->FormatOutput = true;
$string_value = $xml->saveXML();
$xml->save("users.xml");
}
?>