 ?: 'profile-pics/default.jpeg'; ?>)
+ + +
Likes:
Erstellt am:
- - - + +diff --git a/FVS-Social/chat.php b/FVS-Social/chat.php
new file mode 100644
index 0000000..c480b3a
--- /dev/null
+++ b/FVS-Social/chat.php
@@ -0,0 +1,196 @@
+Du musst dich zuerst Einloggen oder Regestrieren
Hier Einloggen
Hier Regestrieren");
+}
+
+include "db_connect.php";
+
+$username = $_GET['user'];
+$userId = $_SESSION['user_id'];
+
+try {
+ // Benutzerdaten abrufen
+ $stmt = $pdo->prepare("SELECT id, username, email, created_at FROM users WHERE id = :username");
+ $stmt->execute([':username' => $username]);
+ $selected_user = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ $stmt1 = $pdo->prepare("SELECT username, email, created_at FROM users WHERE id = :id");
+ $stmt1->execute([':id' => $userId]);
+ $user = $stmt1->fetch(PDO::FETCH_ASSOC);
+
+ $stmt2 = $pdo->prepare("SELECT file_path FROM profile_pictures WHERE user_id = :user_id");
+ $stmt2->execute([':user_id' => $userId]);
+ $profile_pic2 = $stmt2->fetch(PDO::FETCH_ASSOC);
+
+ $stmt3 = $pdo->prepare("
+ SELECT users.id, users.username, profile_pictures.file_path
+ FROM users
+ LEFT JOIN profile_pictures ON users.id = profile_pictures.user_id
+ ORDER BY profile_pictures.uploaded_at DESC
+ ");
+ $stmt3->execute();
+ $users = $stmt3->fetchAll(PDO::FETCH_ASSOC);
+
+ $stmt2 = $pdo->prepare("SELECT file_path FROM profile_pictures WHERE user_id = :user_id");
+ $stmt2->execute([':user_id' => $selected_user['id']]);
+ $profile_pic = $stmt2->fetch(PDO::FETCH_ASSOC);
+
+
+ if ($profile_pic) {
+ $selected_profile_image = $profile_pic['file_path'];
+ } else {
+ $selected_profile_image = 'profile-pics/default.jpeg';
+ }
+
+ if ($profile_pic2) {
+ $selected_profile_image1 = $profile_pic2['file_path'];
+ } else {
+ $selected_profile_image1 = 'profile-pics/default.jpeg';
+ }
+
+ $stmt3 = $pdo->prepare("SELECT COUNT(following_id) AS following_count FROM followers WHERE following_id = :user_id ");
+ $stmt3->execute([':user_id' => $selected_user['id']]);
+ $follower_count = $stmt3->fetch(PDO::FETCH_ASSOC)['following_count'];
+
+ $sender_id = $_SESSION['user_id'];
+ $receiver_id = $_GET['user'];
+} catch (PDOException $e) {
+ die("Fehler: " . $e->getMessage());
+}
+?>
+
+
+
+
= ($msg['sender_id'] == $sender_id) ? "Du" : htmlspecialchars($receiver['username']); ?>: = htmlspecialchars($msg['message']); ?> + = $msg['sent_at']; ?> +
+ += ($msg['sender_id'] == $sender_id) ? "Du" : htmlspecialchars($receiver['username']); ?>: = htmlspecialchars($msg['message']); ?> + = $msg['sent_at']; ?> +
+ diff --git a/FVS-Social/icons/arrow-right.svg b/FVS-Social/icons/arrow-right.svg new file mode 100644 index 0000000..fb155c7 --- /dev/null +++ b/FVS-Social/icons/arrow-right.svg @@ -0,0 +1,2 @@ + + diff --git a/FVS-Social/icons/delete.svg b/FVS-Social/icons/delete.svg new file mode 100644 index 0000000..44a7cb9 --- /dev/null +++ b/FVS-Social/icons/delete.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/FVS-Social/icons/edit.svg b/FVS-Social/icons/edit.svg new file mode 100644 index 0000000..6b71558 --- /dev/null +++ b/FVS-Social/icons/edit.svg @@ -0,0 +1,2 @@ + + diff --git a/FVS-Social/icons/envelope.svg b/FVS-Social/icons/envelope.svg new file mode 100644 index 0000000..b99529c --- /dev/null +++ b/FVS-Social/icons/envelope.svg @@ -0,0 +1,2 @@ + + diff --git a/FVS-Social/icons/exit.svg b/FVS-Social/icons/exit.svg new file mode 100644 index 0000000..3686915 --- /dev/null +++ b/FVS-Social/icons/exit.svg @@ -0,0 +1,2 @@ + + diff --git a/FVS-Social/icons/full_heart.svg b/FVS-Social/icons/full_heart.svg new file mode 100644 index 0000000..963ece5 --- /dev/null +++ b/FVS-Social/icons/full_heart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/FVS-Social/icons/home.svg b/FVS-Social/icons/home.svg new file mode 100644 index 0000000..5ab3d48 --- /dev/null +++ b/FVS-Social/icons/home.svg @@ -0,0 +1,2 @@ + + diff --git a/FVS-Social/icons/picture.svg b/FVS-Social/icons/picture.svg new file mode 100644 index 0000000..9a7e251 --- /dev/null +++ b/FVS-Social/icons/picture.svg @@ -0,0 +1,2 @@ + + diff --git a/FVS-Social/icons/unlike_heart.svg b/FVS-Social/icons/unlike_heart.svg new file mode 100644 index 0000000..980a9d5 --- /dev/null +++ b/FVS-Social/icons/unlike_heart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/FVS-Social/icons/user.svg b/FVS-Social/icons/user.svg new file mode 100644 index 0000000..885c92b --- /dev/null +++ b/FVS-Social/icons/user.svg @@ -0,0 +1,2 @@ + + diff --git a/FVS-Social/index.php b/FVS-Social/index.php index 2b4738a..0aa3b29 100644 --- a/FVS-Social/index.php +++ b/FVS-Social/index.php @@ -1,48 +1,70 @@ prepare("SELECT username, email, created_at FROM users WHERE id = :id"); - $stmt1->execute([':id' => $userId]); - $user = $stmt1->fetch(PDO::FETCH_ASSOC); - $stmt2 = $pdo->prepare("SELECT file_path FROM profile_pictures WHERE user_id = :user_id"); - $stmt2->execute([':user_id' => $userId]); - $profile_pic = $stmt2->fetch(PDO::FETCH_ASSOC); - $stmt3 = $pdo->prepare(" + //Daten von Angemeldeten benutzer werden ausgelesen + $stmt1 = $pdo->prepare("SELECT username, email, created_at FROM users WHERE id = :id"); + $stmt1->execute([':id' => $userId]); + $user = $stmt1->fetch(PDO::FETCH_ASSOC); + + + + //Profilbild wird vom angemeldeten benutzer ausgelesen + $stmt2 = $pdo->prepare("SELECT file_path FROM profile_pictures WHERE user_id = :user_id"); + $stmt2->execute([':user_id' => $userId]); + $profile_pic = $stmt2->fetch(PDO::FETCH_ASSOC); + + + //Benutzername und Profilbild werden von allen benutzer ausgelesen + $stmt3 = $pdo->prepare(" SELECT users.username, profile_pictures.file_path FROM users LEFT JOIN profile_pictures ON users.id = profile_pictures.user_id ORDER BY profile_pictures.uploaded_at DESC "); - $stmt3->execute(); - $users = $stmt3->fetchAll(PDO::FETCH_ASSOC); + $stmt3->execute(); + $users = $stmt3->fetchAll(PDO::FETCH_ASSOC); + + //Alle beiträge von allen benutzer werden ausgelesen + $stmt4 = $pdo->prepare(" + SELECT posts.*, profile_pictures.file_path AS profile_picture, users.username + FROM posts + LEFT JOIN profile_pictures ON posts.user_id = profile_pictures.user_id + LEFT JOIN users ON posts.user_id = users.id + ORDER BY posts.created_at DESC + "); + $stmt4->execute(); + $posts = $stmt4->fetchAll(PDO::FETCH_ASSOC); - if ($profile_pic) { - $profile_image = $profile_pic['file_path']; - } else { - $profile_image = 'profile-pics/default.jpeg'; - } - if(!$user){ - die("Benutzer nicht gefunden!"); - } - }catch (PDOException $e){ - die("Fehler: " . $e->getMessage()); + + + if ($profile_pic) { + $profile_image = $profile_pic['file_path']; + } else { + $profile_image = 'profile-pics/default.jpeg'; } + if(!$user){ + die("Benutzer nicht gefunden!"); + } +}catch (PDOException $e){ + die("Fehler: " . $e->getMessage()); +} ?> + @@ -50,22 +72,26 @@ if(!isset($_SESSION['user_id'])) { '; ?>Email: !
Regestriert seit:, !
- Abmelden - Posts - Über mich - Einstellungen + ++ + +
Erstellt am:
- - - + +Noch kein Account?Jetzt Regestrieren!
+