diff --git a/FVS-Social/change-username.php b/FVS-Social/change-username.php index b820d4f..79083d8 100644 --- a/FVS-Social/change-username.php +++ b/FVS-Social/change-username.php @@ -6,7 +6,6 @@ $user_id = $_SESSION['user_id']; if ($_SERVER['REQUEST_METHOD'] == "POST"){ - echo "Server Method funktioniert"; $username = $_POST['username']; $stmt = $pdo->prepare("UPDATE users SET username = :username WHERE id = :user_id"); diff --git a/FVS-Social/erfolg.html b/FVS-Social/erfolg.html deleted file mode 100644 index 822b4b2..0000000 --- a/FVS-Social/erfolg.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - Document - - -

Erfolg

- - \ No newline at end of file diff --git a/FVS-Social/follow/follow.php b/FVS-Social/follow/follow.php new file mode 100644 index 0000000..a9a15ca --- /dev/null +++ b/FVS-Social/follow/follow.php @@ -0,0 +1,25 @@ +prepare("INSERT INTO followers (follower_id, following_id) VALUES (:follower_id, :following_id)"); + $stmt->execute(['follower_id' => $follower_id, 'following_id' => $following_id]); + header("location: ../profile.php?user=".$username); +} +catch(PDOException $e){ + echo $e->getMessage(); +} + diff --git a/FVS-Social/follow/unfollow.php b/FVS-Social/follow/unfollow.php new file mode 100644 index 0000000..96a4535 --- /dev/null +++ b/FVS-Social/follow/unfollow.php @@ -0,0 +1,24 @@ +prepare("DELETE FROM followers WHERE following_id = :following_id AND follower_id = :follower_id"); + $stmt->execute(['follower_id' => $follower_id, 'following_id' => $following_id]); + header("location: ../profile.php?user=" . $username); +} catch (PDOException $e) { + echo $e->getMessage(); +} \ No newline at end of file diff --git a/FVS-Social/profile-pics/profile_8.jpg b/FVS-Social/profile-pics/profile_8.jpg deleted file mode 100644 index 405a937..0000000 Binary files a/FVS-Social/profile-pics/profile_8.jpg and /dev/null differ diff --git a/FVS-Social/profile.php b/FVS-Social/profile.php index dfde62b..cdbf869 100644 --- a/FVS-Social/profile.php +++ b/FVS-Social/profile.php @@ -57,6 +57,10 @@ try { $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']; + } catch (PDOException $e) { die("Fehler: " . $e->getMessage()); } @@ -106,6 +110,28 @@ try { Profilbild

Email:

Registriert seit:

+

Follower:

+ prepare("SELECT follower_id, following_id FROM followers WHERE follower_id = :user_id AND following_id = :id"); + $stmt7->execute([':user_id' => $follower_id, ':id' => $selected_user['id']]); + $isfollower = $stmt7->fetch(PDO::FETCH_ASSOC); + + ?> + +
+ + + +
+ +
+ + + +
+ Zurück zur Startseite @@ -131,6 +157,7 @@ try { Bild zum Post +

Erstellt am: