116 lines
2.2 KiB
PHP
116 lines
2.2 KiB
PHP
<?php
|
||
session_start();
|
||
|
||
$conn = new mysqli("localhost", "root", "", "rs_lab");
|
||
if ($conn->connect_error) {
|
||
die("DB Connection failed");
|
||
}
|
||
|
||
if (!isset($_GET['id'])) {
|
||
die("Invalid request");
|
||
}
|
||
|
||
$id = intval($_GET['id']);
|
||
|
||
/* GET INSTITUTION */
|
||
$result = $conn->query("SELECT * FROM institutions WHERE id=$id");
|
||
$inst = $result->fetch_assoc();
|
||
|
||
$conn->close();
|
||
|
||
/* 🔥 FIX: TAKE FROM DB (NOT SESSION) */
|
||
$temp_password = $inst['temp_password'] ?? 'Already changed';
|
||
?>
|
||
|
||
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<title>Institution Details | RS Learning Lab</title>
|
||
|
||
<style>
|
||
body {
|
||
margin: 0;
|
||
font-family: Arial;
|
||
background: radial-gradient(circle at top, #020617, #0f172a);
|
||
color: #e5e7eb;
|
||
padding: 40px;
|
||
}
|
||
|
||
.card {
|
||
max-width: 700px;
|
||
margin: auto;
|
||
background: #020617;
|
||
padding: 35px;
|
||
border-radius: 20px;
|
||
}
|
||
|
||
textarea {
|
||
width: 100%;
|
||
margin-top: 10px;
|
||
background: #0f172a;
|
||
color: #e5e7eb;
|
||
border: none;
|
||
border-radius: 12px;
|
||
padding: 15px;
|
||
}
|
||
button {
|
||
margin-top: 15px;
|
||
padding: 10px 20px;
|
||
border-radius: 999px;
|
||
border: none;
|
||
font-weight: bold;
|
||
background: linear-gradient(135deg, #2563eb, #22c55e);
|
||
cursor: pointer;
|
||
}
|
||
</style>
|
||
|
||
</head>
|
||
<body>
|
||
|
||
<div class="card">
|
||
|
||
<h1><?= htmlspecialchars($inst['institution_name']) ?></h1>
|
||
|
||
<h2>Institution Login Credentials</h2>
|
||
|
||
<p><b>Username:</b> <?= htmlspecialchars($inst['username'] ?? 'Not generated') ?></p>
|
||
|
||
<!-- 🔥 FIXED -->
|
||
<p><b>Temporary Password:</b> <?= htmlspecialchars($temp_password) ?></p>
|
||
|
||
<h3>Copy & Share Message</h3>
|
||
|
||
<textarea id="msg" readonly>
|
||
Hello 👋
|
||
|
||
Your institution has been activated on RS Learning Lab.
|
||
|
||
Institution Login Details:
|
||
🔗 Login: http://localhost/rs_lab/institution/login.php
|
||
👤 Username: <?= htmlspecialchars($inst['username'] ?? '') ?>
|
||
🔑 Temporary Password: <?= htmlspecialchars($temp_password) ?>
|
||
|
||
Please log in and create teacher accounts.
|
||
|
||
– RS Learning Lab
|
||
</textarea>
|
||
|
||
<button onclick="copyMsg()">Copy Message</button>
|
||
|
||
<br><br>
|
||
<a href="admin_dashboard.php">← Back</a>
|
||
|
||
</div>
|
||
|
||
<script>
|
||
function copyMsg(){
|
||
const t = document.getElementById("msg");
|
||
t.select();
|
||
t.setSelectionRange(0, 99999);
|
||
document.execCommand("copy");
|
||
alert("Copied!");
|
||
}
|
||
</script>
|
||
|
||
</body>
|
||
</html>
|