-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSubmitFriend.php
32 lines (30 loc) · 1.04 KB
/
SubmitFriend.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
include "FriendsToDatabase.php";
//include "DBConnection-Function.php";
//include "Credential-Template.php";
include "time_change.php";
include "ModifyDarkModeState.php";
//session_start();
$username = "nothing";
if (isset($_SESSION['user_token']) && isset($_SESSION['user_username'])) {
$username = $_SESSION['user_username']; // Retrieve the username from the session
}
$dom = new DOMDocument();
$dom->loadHTMLFile("friends.html");
$conn = get_database_connection(HOST, H_USERNAME, H_PASSWORD, DATABASE);
$currstate = retrievedarkmodestate($username, $conn);
if($currstate==1){
$node0 = $dom->getElementById("stylesheets");
$node0->setAttribute("href", "friends-dark.css");
}
else {
$node0 = $dom->getElementById("stylesheets");
$node0->setAttribute("href", "friends.css");
}
$friendname = $_POST['full_name'];
$birthday = $_POST['date'];
$email = $_POST['email'];
StoreFriend($username, $friendname, $birthday, $email, $conn);
$conn = null;
echo $dom->saveHTML();
?>