Webbserverprogrammering 1

Show sourcecode

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

webbsrvprg/projects/

bacon-egg-pizza.php
cquiz.php
create-account.php
create-account111.php
create-quiz.php
create-quiz2.php
createaccount.php
delete-quiz.php
drop-rps-tables.php
legacy-code-rps.php
legacy-index.php
login.php
logincheck.php
newpassword-verify.php
newpassword.php
potential-code.txt
quiz-db-init.php
quizhub.php
quizhub2.php
results.php
rpsaccount-ajax-user-search.php
rpsaccount.php
rpsbetting-ajax-match-finder.php
rpsbetting.php
rpsbettingleaderboard.php
rpschangepassword.php
rpschangepassword.txt
rpsgame-ajax.php
rpsgame.php
rpsgameresults.php
rpshostnewgame.php
rpshub.php
rpsleaderboard.php
rpslib.php
rpslogin.php
rpsmaininclude.php
rpsproject/
rpsusersearch.php
table-init.php
verification.php

verification.php

23 lines ASCII Windows (CRLF)
<?php
require("../incl/dbconnection.php");
$name =$_GET['username'];
$key $_GET['key'];

$sql="SELECT * FROM pendingusers WHERE username = ?";
$stmt $dbconn -> prepare($sql);
$stmt -> execute([$name]);

while(
$res $stmt->fetch(PDO::FETCH_ASSOC)){
    if (
$res['emailkey']==$key AND time() <= $res['regtime']+60*15){
        
$sql "INSERT INTO rpsusers (username, pass, email, bettingpoints, lastpasswordchangedtime) VALUES (?,?,?,?,?)";
        
$stmt $dbconn -> prepare($sql);
        
//$emailkey = rand(100000,1000000);
        
$data = [$res['username'], password_hash($res['pass'], PASSWORD_DEFAULT), $res['email'], 1000time()];
        
$stmt -> execute($data);
        echo 
'account verified<br><a href="https://labb.vgy.se/~leown/webbsrvprg/projects/rpslogin.php">login</a>';
        
header('Location:rpslogin.php');
    }
    else{
        echo 
"error, invalid key or time out. please try again";
    }
}