Enter Your Code

" exit to top else -- Email not found, redirect to signup page put header "Location: https://www.senkyou.info/signup" exit to top end if elseif $_POST["step"] is "2" then -- Step 2: Verify code put $_POST["email"] into tEmail put $_POST["code"] into tCodeGiven put $_SERVER["REMOTE_ADDR"] into tClientID -- Check the saved code if tCodeGiven is $_SESSION[tClientID] then -- Code matches, create cookie put "auth=" & urlEncode(tEmail) & "; Path=/; HttpOnly;" into tCookie put header "Set-Cookie: " & tCookie -- Redirect to the top page put header "Location: https://www.senkyou.info" else -- Code does not match put "The code you entered is incorrect. Please try again." exit to top end if end if -- Display the login form (Step 1) ?> Log In

Log In

Key Features Step 1: Email Verification Checks if the user's email exists in the database. Generates a 4-digit code and emails it to the user. Step 2: Code Verification Matches the user-entered code with the one stored temporarily. If valid, sets a secure cookie for authentication. Session Replacement: Uses the user's IP address to simulate session storage for simplicity. Cookie-Based Authentication: Cookies are created with HttpOnly to enhance security. Accessible by other pages on the website. Database Setup Ensure your users table is configured as described in the earlier example. Email Configuration Replace "no-reply@yourdomain.com" with a real email address. Configure your server to support sendmail or an equivalent mail-sending feature.