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

rpsgame.php

38 lines ASCII Windows (CRLF)
<?php require('rpsmaininclude.php');
//check if user is in a game or not and enables the user to make a move
if($_SESSION['isInGame']==false){
    
$_SESSION['hasMadeMove']=false;
    
$_SESSION['isInGame']=true;
}
$_SESSION['currentround'] = 1;
if(isset(
$_GET['matchid']) && matchActiveCheck($dbconn,$_GET['matchid'])==true){
    
joinGame($dbconn,$_GET['matchid']);
    
$currentround=1;
}
else{
    
header("Location:rpshub.php");
}

if(isset(
$_POST['rpsmove'])){
    
//EDIT TO SENDMOVE 2 WHEN FINISHED
    
sendMove($dbconn,$_GET['matchid'],$_POST['rpsmove']);
}
?>
<html>
    <form action="" method="POST">
        <button type="submit" name="rpsmove" value="rock">rock</button>
        <button type="submit" name="rpsmove" value="paper">paper</button>
        <button type="submit" name="rpsmove" value="scissors">scissors</button>
    </form>
    <div id="matchinfospace"></div>
</html>

<div id="matchinfospace"></div>
<script>
    async function getMoveStatusAjax(){
        let getmatchinfo = await fetch("rpsgame-ajax.php?matchkey=<?php echo $_GET['matchid'];?>&userid=<?php echo $_SESSION['userid'];?>&currentround=<?php $_SESSION['currentround'];?>");
        let matchinfo = await getmatchinfo.text();
        document.getElementById('matchinfospace').innerHTML = matchinfo;
    }
    setInterval(getMoveStatusAjax,1000)
</script>