Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbsrvprg/projects/slutprojekt/

drop.php
include/
login.php
signin.php
start.php
tabeller/
verify.php

verify.php

25 lines ASCII Windows (CRLF)
<?php
include('../../dbconnection.php');
ob_clean();

if (isset(
$_GET['code'])) {
    
$verification_code $_GET['code'];

    
$stmt $dbconn->prepare("SELECT * FROM users WHERE verification_code = :code");
    
$stmt->bindParam(':code'$verification_code);
    
$stmt->execute();

    if (
$stmt->rowCount() > 0) {
        
$stmt $dbconn->prepare("UPDATE users SET is_verified = 1 WHERE verification_code = :code");
        
$stmt->bindParam(':code'$verification_code);
        
$stmt->execute();

        echo 
"E-postadressen har verifierats! Du kan nu <a href='login.php'>logga in</a>.";
    } else {
        echo 
"Ogiltig verifieringskod.";
    }
} else {
    echo 
"Ingen verifieringskod angiven.";
}
?>