📄 Source: view.php
<?php
// view.php - Afișează datele trimise
$nume = $_POST['nume'] ?? '';
$prenume = $_POST['prenume'] ?? '';
$email = $_POST['email'] ?? '';
$imagine = $_FILES['imagine'] ?? null;
$error = '';
$imageData = '';
// Procesăm imaginea
if ($imagine && $imagine['error'] === UPLOAD_ERR_OK) {
$type = $imagine['type'];
if (strpos($type, 'image/') === 0) {
$imageData = base64_encode(file_get_contents($imagine['tmp_name']));
$imageSrc = 'data:' . $type . ';base64,' . $imageData;
} else {
$error = "Fișierul încărcat nu este o imagine validă!";
}
} else {
$error = "Te rog încarcă o imagine validă!";
}
// Validăm numele și emailul
if (empty($nume) || empty($prenume) || empty($email)) {
$error = "Toate câmpurile sunt obligatorii!";
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error = "Adresa de email nu este validă!";
}
?>
<!DOCTYPE html>
<html lang="ro">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Date Personale - Vizualizare</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;400;500;600;700;800&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', system-ui, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 2rem 1rem;
}
.container {
max-width: 600px;
margin: 0 auto;
}
.card {
background: white;
border-radius: 2rem;
padding: 2rem;
box-shadow: 0 25px 45px -12px rgba(0, 0, 0, 0.25);
text-align: center;
}
h1 {
font-size: 1.8rem;
font-weight: 700;
margin-bottom: 0.5rem;
background: linear-gradient(135deg, #667eea, #764ba2);
background-clip: text;
-webkit-background-clip: text;
color: transparent;
}
.subhead {
color: #64748b;
margin-bottom: 1.5rem;
font-size: 0.9rem;
}
.image-container {
margin-bottom: 1.5rem;
}
.image-container img {
max-width: 200px;
max-height: 200px;
border-radius: 1rem;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
object-fit: cover;
}
.info-card {
background: #f8fafc;
border-radius: 1rem;
padding: 1.2rem;
text-align: left;
margin-bottom: 1rem;
}
.info-row {
display: flex;
padding: 0.75rem 0;
border-bottom: 1px solid #e2e8f0;
}
.info-row:last-child {
border-bottom: none;
}
.info-label {
font-weight: 600;
width: 100px;
color: #64748b;
}
.info-value {
flex: 1;
color: #1e293b;
word-break: break-word;
}
.error-message {
background: #fee2e2;
color: #b91c1c;
padding: 1rem;
border-radius: 1rem;
margin-bottom: 1rem;
}
.back-btn {
display: inline-block;
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
text-decoration: none;
padding: 0.75rem 1.5rem;
border-radius: 2rem;
font-weight: 600;
margin-top: 1rem;
transition: transform 0.2s;
}
.back-btn:hover {
transform: translateY(-2px);
}
footer {
text-align: center;
margin-top: 1.5rem;
color: rgba(255, 255, 255, 0.7);
font-size: 0.75rem;
}
</style>
</head>
<body>
<div class="container">
<div class="card">
<h1>📋 Datele tale</h1>
<p class="subhead">Informațiile pe care le-ai trimis</p>
<?php if ($error): ?>
<div class="error-message">
⚠️ <?php echo htmlspecialchars($error); ?>
</div>
<a href="upload.html" class="back-btn">← Înapoi la formular</a>
<?php else: ?>
<div class="image-container">
<img src="<?php echo $imageSrc; ?>" alt="Imaginea utilizatorului">
</div>
<div class="info-card">
<div class="info-row">
<div class="info-label">👤 Nume</div>
<div class="info-value"><?php echo htmlspecialchars($nume); ?></div>
</div>
<div class="info-row">
<div class="info-label">📛 Prenume</div>
<div class="info-value"><?php echo htmlspecialchars($prenume); ?></div>
</div>
<div class="info-row">
<div class="info-label">📧 Email</div>
<div class="info-value"><?php echo htmlspecialchars($email); ?></div>
</div>
</div>
<a href="upload.html" class="back-btn">← Trimite alte date</a>
<?php endif; ?>
</div>
<footer>Datele sunt procesate conform cerințelor proiectului</footer>
</div>
</body>
</html>
← Back