|
| 1 | +<?php |
| 2 | +$query = misc\mysql\query("SELECT * FROM `accounts` WHERE `username` = ?", [$_SESSION['username']]); |
| 3 | + |
| 4 | +if ($query->num_rows > 0) { |
| 5 | + while ($row_ = mysqli_fetch_array($query->result)) { |
| 6 | + $acclogs = $row_['acclogs']; |
| 7 | + $expiry = $row_["expires"]; |
| 8 | + $emailVerify = $row_["emailVerify"]; |
| 9 | + } |
| 10 | +} |
| 11 | + |
| 12 | +if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
| 13 | + if (isset($_POST['logout'])) { |
| 14 | + session_destroy(); |
| 15 | + header('Location: /login'); |
| 16 | + exit; |
| 17 | + } |
| 18 | +} |
| 19 | + |
| 20 | +?> |
| 21 | + |
| 22 | +<div class="w-full max-w-sm border border-gray-700 rounded-lg shadow"> |
| 23 | + <div class="flex justify-end px-4 pt-2"> |
| 24 | + <button id="dropdownButton" data-dropdown-toggle="dropdown" class="inline-block text-gray-500 hover:opacity-60 focus:ring-0 p-1.5" type="button"> |
| 25 | + <span class="sr-only">Open dropdown</span> |
| 26 | + <svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 3"> |
| 27 | + <path d="M2 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm6.041 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM14 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Z" /> |
| 28 | + </svg> |
| 29 | + </button> |
| 30 | + <!-- Dropdown menu --> |
| 31 | + <form method="post"> |
| 32 | + <div id="dropdown" class="z-10 hidden text-base list-none bg-[#09090d] rounded-lg shadow w-44"> |
| 33 | + <ul class="py-2" aria-labelledby="dropdownButton"> |
| 34 | + <li> |
| 35 | + <a href="?page=account-settings" class="block px-4 py-2 text-sm text-white hover:bg-blue-700">Account Settings</a> |
| 36 | + </li> |
| 37 | + <li> |
| 38 | + <a href="?page=account-logs" class="block px-4 py-2 text-sm text-white hover:bg-blue-700">Account |
| 39 | + Logs</a> |
| 40 | + </li> |
| 41 | + <li> |
| 42 | + <a href="?page=logout" class="block px-4 py-2 text-sm text-white hover:bg-blue-700">Log Out</a> |
| 43 | + </li> |
| 44 | + </ul> |
| 45 | + </div> |
| 46 | + </form> |
| 47 | + </div> |
| 48 | + <div class="flex flex-col items-center pb-4"> |
| 49 | + <img class="w-20 h-20 rounded-full" src="<?= $_SESSION["img"]; ?>" alt="profile image" /> |
| 50 | + <?php if ($role == "seller") { ?> |
| 51 | + <h5 class="mb-1 text-xl font-medium bg-blue-700 stars"><?= $_SESSION["username"]; ?></h5> |
| 52 | + <?php } else { ?> |
| 53 | + <h5 class="mb-1 text-xl font-medium text-blue-700"><?= $_SESSION["username"]; ?></h5> |
| 54 | + <?php } ?> |
| 55 | + |
| 56 | + <?php |
| 57 | + $cssClasses = "text-transparent bg-clip-text bg-gradient-to-r to-blue-600 from-sky-400 text-xs font-black mr-2 px-1.5 py-0.5 rounded border mb-2 mt-2"; |
| 58 | + |
| 59 | + if ($role == "seller") { |
| 60 | + // If the role is "seller", add these classes |
| 61 | + $cssClasses .= " border-blue-400"; |
| 62 | + } elseif ($role == "developer") { |
| 63 | + // If the role is "developer", add these classes |
| 64 | + $cssClasses .= " border-white-400"; |
| 65 | + } else { |
| 66 | + // For any other role, you can define a default behavior here |
| 67 | + } |
| 68 | + |
| 69 | + // Finally, output the HTML with the calculated classes |
| 70 | + echo "<p class=\"$cssClasses\">" . strtoupper($role) . " PLAN</p>"; |
| 71 | + ?> |
| 72 | + |
| 73 | + <?php |
| 74 | + $display = match ($role) { |
| 75 | + 'tester' => '<label class="text-sm text-gray-400"><b>Expires:</b> Free Forever </label>', |
| 76 | + 'developer' => '<label class="text-sm text-gray-400"><b>Expires:</b> <span id="expiryLabel"></span></label>', |
| 77 | + 'seller' => '<label class="text-sm text-gray-400" id="expirationLbl"><b>Expires:</b> <span id="expiryLabel"></span></label>', |
| 78 | + 'Reseller' => '<label class="text-sm text-gray-400"><b>Expires:</b> Owner Decides </label>', |
| 79 | + 'Manager' => '<label class="text-sm text-gray-400"><b>Expires:</b> Owner Decides </label>', |
| 80 | + 'default' => '<label class="text-sm text-gray-400"><b>Expires:</b> Never </label>' |
| 81 | + }; |
| 82 | + echo $display; |
| 83 | + |
| 84 | + if ($role === 'developer' || $role === 'seller') { |
| 85 | + echo '<script>'; |
| 86 | + echo 'document.getElementById("expiryLabel").textContent = convertTimestamp(' . $expiry . ');'; |
| 87 | + echo '</script>'; |
| 88 | + } |
| 89 | + ?> |
| 90 | + </div> |
| 91 | +</div> |
| 92 | +<br> |
0 commit comments