if (!empty($camName) && !empty($streamUrl) && ($isLoggedIn || (!empty($subEmail) && !empty($password)))) {
// NOU: VERIFICARE DUPLICAT LA SUBMIT!
$stmtCheckUrl = $pdo->prepare("SELECT status FROM camera_submissions WHERE stream_url = ?");
$stmtCheckUrl->execute([$streamUrl]);
$existingStat = $stmtCheckUrl->fetchColumn();
if ($existingStat) {
$statMsg = $existingStat === 'pending' ? 'este în așteptare pentru aprobare' : ($existingStat === 'approved' ? 'este deja activ pe site' : 'a fost respins anterior');
$data['error_message'] = "Acest Stream URL există deja în baza de date ($statMsg). Nu se pot trimite duplicate.";
} else {
$pdo->beginTransaction();
try {
if (!$isLoggedIn) {
$stmtUser = $pdo->prepare("SELECT id FROM users WHERE email = ?");
$stmtUser->execute([$subEmail]);
$userId = $stmtUser->fetchColumn();
if ($userId) {
throw new \Exception("Un cont cu acest email există deja. Te rugăm să te loghezi mai întâi.");
}
$hash = password_hash($password, PASSWORD_DEFAULT);
$stmtCreate = $pdo->prepare("INSERT INTO users (name, email, password_hash) VALUES (?, ?, ?)");
$stmtCreate->execute([$subName, $subEmail, $hash]);
$userId = $pdo->lastInsertId();
$_SESSION['user_id'] = $userId;
$_SESSION['user_name'] = $subName;
$data['session'] = $_SESSION;
}
$stmtCam = $pdo->prepare("INSERT INTO camera_submissions (user_id, submitter_name, submitter_email, camera_name, stream_url, website_url, location, category_id, description) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmtCam->execute([$userId, $subName, $subEmail, $camName, $streamUrl, $websiteUrl, $location, $categoryId, $description]);
$pdo->commit();
$data['success_message'] = "Camera a fost trimisă cu succes! Va fi revizuită de echipa noastră.";
} catch (\Exception $e) {
$pdo->rollBack();
$data['error_message'] = $e->getMessage();
}
}
} else {
$data['error_message'] = "Vă rugăm să completați toate câmpurile obligatorii.";
}
Pool Webcams in Güney Sudan | Webcam.beer
Best Pool in Güney Sudan
Watch live streaming cameras covering pool locations across Güney Sudan.
No webcams found for this specific selection.
Discover Pool in Güney Sudan
Whether you're checking conditions for a weekend getaway or just enjoying the view, our collection of pool webcams in Güney Sudan offers the best real-time experience available online. Stay updated with live weather changes and crowd activity.