Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New verify_otp.php #8

Open
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

I-am-your-William
Copy link

`<?php
session_start();
error_reporting(0);

$response = array();
$response['status'] = '';
$response['message'] = '';

if (isset($_POST['otp']) && isset($_POST['email'])) {
$email = $_POST['email'];
$otp = $_POST['otp'];

// Retrieve OTP from session
$generatedOtp = isset($_SESSION['otp']) ? $_SESSION['otp'] : null;
$otpExpiration = isset($_SESSION['otp_expiration']) ? $_SESSION['otp_expiration'] : null;

// Check if OTP is set and not expired
if ($generatedOtp && $otpExpiration && time() <= $otpExpiration) {
    // Verify OTP
    if ($otp == $generatedOtp) {
        $response['status'] = 'success';
        $response['message'] = 'OTP verified successfully!';
        $response['redirect_url'] = 'student_panel/index.php'; // Replace with your target page
        unset($_SESSION['otp']); // Clear OTP from session after successful verification
        unset($_SESSION['otp_expiration']);
        

    } else {
        $response['status'] = 'ERROR';
        $response['message'] = 'Invalid OTP!';
    }
} else {
    $response['status'] = 'ERROR';
    $response['message'] = 'OTP expired or not found. Please request a new OTP.';
}

} else {
$response['status'] = 'ERROR';
$response['message'] = 'OTP and email are required.';
}

echo json_encode($response);
?>
`

kochiling and others added 27 commits November 13, 2024 23:38
Check data policy code is updated from line 55 until line 112
Quiz about cybersecurity
Place this two in the root directory
This /conf folder is supposed to be in xampp/apache/
Please DON'T put this folder into the school-management-system folder
This folder is supposed to be a subfolder of xampp/apache/ for setting up HTTPS connection.
Please DO NOT put this folder under htdocs/school-management-system
These 2 files should be outside of the conf folder, put them under xampp/apache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants