LRR/recover_password.php

39 lines
1.3 KiB
PHP

<?php
include 'NoDirectPhpAcess.php';
?>
<?php
include 'Header.php';
?>
<br><br><br>
<div class="container">
<div class="row">
<div class="col-md-5"></div>
<div class="col-md-5">
<form method="post" action="Script.php">
<legend>Recover password</legend>
<input type="hidden" name="form_recover_password" value="true"/>
Student number
<input type="text" name="sno" placeholder="Enter your student number" class="form-control" required="required" value="<?php echo htmlspecialchars($_SESSION['student_number']); ?>"> <br/>
Email
<input type="text" name="email" placeholder="Enter your email address" class="form-control" required="required" value="<?php echo htmlspecialchars($_SESSION['user_email']); ?>"> <br/>
<button type="submit" class="btn btn-primary">Recover</button>
</form>
</div> </div>
<?php
if(isset($_SESSION['info_recover_password'])) {
// Check if it's a success message by looking for "Success" at the beginning
$is_success = (strpos($_SESSION['info_recover_password'], 'Success') === 0);
$alert_class = $is_success ? 'alert-success' : 'alert-danger';
echo '<hr><div class="alert ' . $alert_class . '" role="alert">' . htmlspecialchars($_SESSION['info_recover_password']) . '</div>';
$_SESSION['info_recover_password'] = null;
}
?>
</div>