diff --git a/FVS-Social/.idea/.gitignore b/FVS-Social/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/FVS-Social/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/FVS-Social/.idea/FVS-Social.iml b/FVS-Social/.idea/FVS-Social.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/FVS-Social/.idea/FVS-Social.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/FVS-Social/.idea/dataSources.xml b/FVS-Social/.idea/dataSources.xml new file mode 100644 index 0000000..6423aa8 --- /dev/null +++ b/FVS-Social/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + mariadb + true + org.mariadb.jdbc.Driver + jdbc:mariadb://134.255.227.143:3306 + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/FVS-Social/.idea/inspectionProfiles/Project_Default.xml b/FVS-Social/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..9a8f22c --- /dev/null +++ b/FVS-Social/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/FVS-Social/.idea/modules.xml b/FVS-Social/.idea/modules.xml new file mode 100644 index 0000000..b289792 --- /dev/null +++ b/FVS-Social/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/FVS-Social/.idea/php.xml b/FVS-Social/.idea/php.xml new file mode 100644 index 0000000..f324872 --- /dev/null +++ b/FVS-Social/.idea/php.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/FVS-Social/.idea/sqldialects.xml b/FVS-Social/.idea/sqldialects.xml new file mode 100644 index 0000000..9115d7c --- /dev/null +++ b/FVS-Social/.idea/sqldialects.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/FVS-Social/change-username.php b/FVS-Social/change-username.php new file mode 100644 index 0000000..b820d4f --- /dev/null +++ b/FVS-Social/change-username.php @@ -0,0 +1,22 @@ +prepare("UPDATE users SET username = :username WHERE id = :user_id"); + $stmt->execute([':username'=> $username, + ':user_id' => $user_id]); + + header("Location: index.php"); + exit(); +} + + + +?> \ No newline at end of file diff --git a/FVS-Social/index.php b/FVS-Social/index.php index 0bfb5a0..0da0544 100644 --- a/FVS-Social/index.php +++ b/FVS-Social/index.php @@ -1,19 +1,18 @@ - - -Du musst dich zuerst Einloggen oder Regestrieren
Hier Einloggen
Hier Regestrieren"); + $user_page = isset($_GET['user']) ? $_GET['user'] : 'posts'; + +if(!isset($_SESSION['user_id'])) { + header("Location: login/login-page.html"); } include 'db_connect.php'; try { $userId = $_SESSION['user_id']; - + $stmt1 = $pdo->prepare("SELECT username, email, created_at FROM users WHERE id = :id"); $stmt1->execute([':id' => $userId]); $user = $stmt1->fetch(PDO::FETCH_ASSOC); @@ -37,18 +36,13 @@ session_start(); } else { $profile_image = 'profile-pics/default.jpeg'; } - - - if(!$user){ die("Benutzer nicht gefunden!"); } }catch (PDOException $e){ die("Fehler: " . $e->getMessage()); } - ?> - @@ -61,7 +55,7 @@ session_start();
- +
- Posts - - "; - }elseif($page == 'about'){ echo "

Über mich

"; }elseif($page == 'settings'){ @@ -124,47 +121,50 @@ session_start();

Profilbild löschen

-
- - "; + + +

Profilbild änderm

+
+ + +
+ +

Profilbild änderm

+
+ +
+ + "; echo $profile_image; } ?>
- -
"; - $stmt45 = $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 - WHERE posts.user_id = :user_id ORDER BY posts.created_at DESC "); - $stmt45->execute([':user_id' => $userId]); + $stmt45->execute(); $posts = $stmt45->fetchAll(PDO::FETCH_ASSOC); - - - } ?>
-

User # schrieb:

+

@@ -179,11 +179,6 @@ session_start();
- - - - -
diff --git a/FVS-Social/posts/10_url.jpeg b/FVS-Social/posts/10_url.jpeg new file mode 100644 index 0000000..9bd98f5 Binary files /dev/null and b/FVS-Social/posts/10_url.jpeg differ diff --git a/FVS-Social/posts/8_url.jpeg b/FVS-Social/posts/8_url.jpeg new file mode 100644 index 0000000..391430f Binary files /dev/null and b/FVS-Social/posts/8_url.jpeg differ diff --git a/FVS-Social/posts/9_Dolllar_Zeichen_Maxi_Simon_Projekt_weil_die_nichts_selber_machen_können_amk_wie_lange_geht_so_ein_name_eigentlich_hahahaaahh_oh_nochimmer_nicht_zuende_ok_aber_ich_glaube_es_reicht_jetzt.png b/FVS-Social/posts/9_Dolllar_Zeichen_Maxi_Simon_Projekt_weil_die_nichts_selber_machen_können_amk_wie_lange_geht_so_ein_name_eigentlich_hahahaaahh_oh_nochimmer_nicht_zuende_ok_aber_ich_glaube_es_reicht_jetzt.png new file mode 100644 index 0000000..bfa99dc Binary files /dev/null and b/FVS-Social/posts/9_Dolllar_Zeichen_Maxi_Simon_Projekt_weil_die_nichts_selber_machen_können_amk_wie_lange_geht_so_ein_name_eigentlich_hahahaaahh_oh_nochimmer_nicht_zuende_ok_aber_ich_glaube_es_reicht_jetzt.png differ diff --git a/FVS-Social/profile-pics/profile_8.jpeg b/FVS-Social/profile-pics/profile_8.jpeg new file mode 100644 index 0000000..9bd98f5 Binary files /dev/null and b/FVS-Social/profile-pics/profile_8.jpeg differ diff --git a/FVS-Social/profile-pics/profile_9.jpg b/FVS-Social/profile-pics/profile_9.jpg new file mode 100644 index 0000000..405a937 Binary files /dev/null and b/FVS-Social/profile-pics/profile_9.jpg differ diff --git a/FVS-Social/profile.php b/FVS-Social/profile.php new file mode 100644 index 0000000..3affb35 --- /dev/null +++ b/FVS-Social/profile.php @@ -0,0 +1,142 @@ +Du musst dich zuerst Einloggen oder Regestrieren
Hier Einloggen
Hier Regestrieren"); +} + +include "db_connect.php"; + +if (!isset($_GET['user'])) { + die("Kein Benutzer angegeben."); +} + +$username = $_GET['user']; +$userId = $_SESSION['user_id']; + +try { + // Benutzerdaten abrufen + $stmt = $pdo->prepare("SELECT id, username, email, created_at FROM users WHERE username = :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.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); + + if (!$selected_user) { + die("Benutzer nicht gefunden!"); + } + + $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'; + } + +} catch (PDOException $e) { + die("Fehler: " . $e->getMessage()); +} +?> + + + + + + + Profil von <?php echo htmlspecialchars($selected_user['username']); ?> + + + +
+
+ + + +
+
+
+

Profil von

+ Profilbild +

Email:

+

Registriert seit:

+ Zurück zur Startseite +
+ + 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 + WHERE users.username = :username + ORDER BY posts.created_at DESC + "); + $stmt45->execute([':username' => $username]); + $posts = $stmt45->fetchAll(PDO::FETCH_ASSOC); + ?> + +
+ +

+

+ + + Bild zum Post + + +

Erstellt am:

+ +
+ + +
+
+ + \ No newline at end of file diff --git a/FVS-Social/signup/signup-page-style.css b/FVS-Social/signup/signup-page-style.css index 4c002f6..b1e6a1c 100644 --- a/FVS-Social/signup/signup-page-style.css +++ b/FVS-Social/signup/signup-page-style.css @@ -46,11 +46,12 @@ body { text-align: center; background-color: #FFFFFF; border: solid 1px #ECF0F5; + box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.25); + padding: 12px; border-radius: 20px; display: flex; flex-direction: column; - box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.25); align-items: center; } diff --git a/FVS-Social/style.css b/FVS-Social/style.css index 8e00061..253b8f2 100644 --- a/FVS-Social/style.css +++ b/FVS-Social/style.css @@ -21,49 +21,20 @@ body { } -.navigation-body{ - background-color: #FFFFFF; - border: solid 1px #ECF0F5; - width: 100%; - border-radius: 20px; - -} - - -.profile-header{ - background-color: #FFFFFF; - border: solid 1px #ECF0F5; - width: 100%; - border-radius: 20px; - -} - .post-pics{ max-width: 500px; height: auto; } -.posts-body { +.post-formular-body, .post, .posts-body, .all-posts-body, .profile-header, .navigation-body{ background-color: #FFFFFF; border: solid 1px #ECF0F5; + box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.25); width: 100%; border-radius: 20px; } -.post-formular-body, .post{ - background-color: #FFFFFF; - border: solid 1px #ECF0F5; - width: 100%; - border-radius: 20px; -} - -.all-posts-body{ - background-color: #FFFFFF; - border: solid 1px #ECF0F5; - width: 100%; - border-radius: 20px; -} [class*="col-"] { padding: 15px; diff --git a/FVS-Social/upload-post/upload-post.php b/FVS-Social/upload-post/upload-post.php index 9bf6e84..3575d1c 100644 --- a/FVS-Social/upload-post/upload-post.php +++ b/FVS-Social/upload-post/upload-post.php @@ -32,7 +32,6 @@ if($_SERVER["REQUEST_METHOD"] == "POST") { ':image_path' => $image_path ]); - header("Location: ../index.php"); exit(); } diff --git a/FVS-Social/userused.html b/FVS-Social/userused.html index 8c9e015..fe74b75 100644 --- a/FVS-Social/userused.html +++ b/FVS-Social/userused.html @@ -1,5 +1,6 @@ +