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

quiz-db-init.php

85 lines ASCII Windows (CRLF)
<?php
require("../incl/dbconnection.php");

try{

    
$sql "CREATE TABLE questionanswers (
        akey int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
        qqkey int(10),
        ans varchar(40) NOT NULL,
        correct int (10) NOT NULL)"
;
    
    
$dbconn->exec($sql);
    echo 
"ansV2 table created";

    
$sql "CREATE TABLE quserresults (
        qurkey int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
        quizkey int(10) NOT NULL,
        userkey int(10) NOT NULL,
        htmldata varchar (1000) NOT NULL,
        totscore int(10) NOT NULL)"
;
    
    
$dbconn->exec($sql);
    echo 
"queserresults table created";

$sql "CREATE TABLE qusers (
    userid int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    username varchar(40) NOT NULL,
    pass varchar (40) NOT NULL,
    isadmin int(1) NOT NULL)"
;

$dbconn->exec($sql);
echo 
"user table created";


$sql "CREATE TABLE qlist (
    listid int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    qlname varchar(40) NOT NULL)"
;

$dbconn->exec($sql);
echo 
"qlist table created";


$sql "CREATE TABLE qquestions (
    questionid int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    qlkey int(10),
    qqname varchar(40) NOT NULL)"
;

$stmt $dbconn->prepare($sql);
$stmt->execute();
echo 
"qquestions table created";


$sql "CREATE TABLE qanswers (
    id int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    qqkey int(10),
    ans1 varchar(40) NOT NULL,
    ans2 varchar(40) NOT NULL,
    ans3 varchar(40) NOT NULL,
    correct varchar(40) NOT NULL)"
;

$stmt $dbconn->prepare($sql);
$stmt->execute();
echo 
"qanswers table created";

$sql "CREATE TABLE qresults (
    id int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    qkey int(10),
    ukey int(10),
    result int(2) NOT NULL)"
;

$stmt $dbconn->prepare($sql);
$stmt->execute();
echo 
"qresults table created";



}

catch(
PDOException $e){
    echo 
$sql."<br>".$e->getMessage();
}



?>