Webbserv1: Källkod
Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbsrvprg/projects/slutprojekt/

blala.php
chat.php
createtable.php
delete.php
deletetable.php
deletetables.php
fetch_messages.php
filhantering/
footer.php
header.php
home.php
login.php
new_password.php
password_reset.php
profile.php
send_message.php
signup.php
verify.php

profile.php

95 lines ASCII Windows (CRLF)
<?php
session_start
();
?>
<!doctype html>
<html>
<head>
  <style>
    .profile-container {
      background: white;
      border-radius: 10px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
      padding-bottom: 20px;
      text-align: center;
      max-width: 400px;
      width: 100%;
      margin: auto;
    }
    .profile-img {
      width: 400px;
      height: 400px;
      border-top-left-radius: 10px;
      border-top-right-radius: 10px;
      object-fit: cover;
      margin-bottom: 15px;
    }
    .profile-name {
      font-size: 24px;
      font-weight: bold;
      margin-bottom: 10px;
    }
    .profile-text {
      font-size: 14px;
      color: #555;
      margin-bottom: 10px;
    }
    .profile-city {
      font-size: 16px;
      font-weight: bold;
      color: #333;
    }
    .button {
      background-color: #007bff;
      color: white;
      border: none;
      padding: 10px 20px;
      border-radius: 5px;
      cursor: pointer;
      font-size: 16px;
      width: 48%;
    }
    .button:hover {
      background-color: #0056b3;
    }
    </style>
</head>
<body>
<?php
include ('header.php');
include (
'../../dbconnection.php');
$message null;
    
    try {
      if (isset(
$_GET['id'])) {
        
$id $_GET['id'];
      }
      else {
        
$id $_SESSION['id'];
      }
       
        
$sql "SELECT webusers.fName, webusers.lName, webusers.bio, webusers.city, interests.interest, pictures.picture
        FROM webusers
        INNER JOIN pictures ON webusers.id = pictures.userId
        INNER JOIN interests ON webusers.id = interests.userId
        WHERE webusers.id = ?"
;
        
$stmt $dbconn->prepare($sql);
        
$stmt->execute([$id]);
        
$user $stmt->fetch(PDO::FETCH_ASSOC);  
    }
    catch(
PDOException $e)  {
        echo 
$sql "<br>" $e->getMessage();
    }
?>
  <div class="profile-container">
    <img src="<?php echo htmlspecialchars($user['picture']); ?>" alt="Profilbild" class="profile-img">
    <div class="profile-name"><?php echo htmlspecialchars($user['fName'])." ".htmlspecialchars($user['lName']); ?></div>
    <div class="profile-text"><?php echo htmlspecialchars($user['bio']); ?></div>
    <div class="profile-text"><strong>Intressen:</strong> <?php echo htmlspecialchars($user['interest']); ?></div>
    <div class="profile-city"><?php echo htmlspecialchars($user['city']); ?></div>
  </div>
<?php
  
include ('footer.php');
  
$dbconn null;
?>
</body>
</html>