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

table-init.php

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

try{

    
$sql="CREATE TABLE forgotpasskeytable(
        forgotpasskeytableid int UNSIGNED AUTO_INCREMENT PRIMARY KEY,
        username varchar(10) NOT NULL,
        emailkey int NOT NULL)"
;
    
$dbconn->exec($sql);
    echo 
"forgortable created";


    
$sql "CREATE TABLE pendingusers (
        userid int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
        username varchar(40) NOT NULL,
        pass varchar(40) NOT NULL,
        email varchar(40) NOT NULL,
        emailkey int(8) NOT NULL,
        regtime varchar(40))"
;
    
    
$dbconn->exec($sql);
    echo 
"user table created";


$sql "CREATE TABLE rpsusers (
    userid int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    username varchar(40) NOT NULL,
    pass varchar(255) NOT NULL,
    email varchar(40) NOT NULL,
    wins int(10),
    losses int(10),
    ratio float(10),
    bettingpoints int(10),
    lastpasswordchangedtime int(10))"
;

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


$sql "CREATE TABLE matches (
    matchid int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    roundAmount int(3) NOT NULL,
    player1id int(10) NOT NULL,
    player2id int(10),
    p1points int(10) NOT NULL,
    p2points int(10) NOT NULL,
    isactive int(1) NOT NULL,
    datestarted varchar(30) NOT NULL)"
;

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


$sql "CREATE TABLE moves (
    id int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    matchkey int(10) NOT NULL,
    userid int(10) NOT NULL,
    round int(5) NOT NULL,
    rps varchar(10) NOT NULL
    )"
;

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

$sql "CREATE TABLE bets (
    id int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    matchid int(10) NOT NULL,
    userid int(10) NOT NULL,
    totalbet int(2) NOT NULL,
    beton int(2) NOT NULL)"
;

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

/*$sql = "CREATE TABLE sprites (
    id int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    userid int(10) NOT NULL,
    spritegroup int(10) NOT NULL,
    movetype int(2) NOT NULL),
    img int(2) NOT NULL)";

$stmt = $dbconn->prepare($sql);
$stmt->execute();
echo "bet table created";
*/


}

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



?>