Webbserverprogrammering 1

Show sourcecode

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

webbsrvprg/exercises/projekt/

changeowned.php
classes/
createcard.php
database.php
forgot.php
incl/
index.php
leaderboard.php
lineup.php
login.php
logout.php
newpass.php
otherlineup.php
playerinfo.php
projekt.zip
skapatabeller.php
verify.php

createcard.php

69 lines UTF-8 Windows (CRLF)
<?php
$title 
"Skapa Kort";
$pageId "createcard";
$pageStyle '
figure { 
 border-radius: 10px;
 border-color:#333;
 box-shadow: 10px 10px 5px #888;
}'
;
require_once(
"classes/card.php");
$newCard = new Card($dbconn);
include(
"incl/protected.php");
include(
"incl/header.php");
$userid $_SESSION['userid'];
if (isset(
$_POST['submit'])) {
    
$addtocollection false;
    
$name htmlspecialchars($_POST["name"], ENT_QUOTES,'UTF-8');
    
$age htmlspecialchars($_POST["age"], ENT_QUOTES,'UTF-8');
    
$nation htmlspecialchars($_POST["nation"], ENT_QUOTES,'UTF-8');
    
$position htmlspecialchars($_POST["position"], ENT_QUOTES,'UTF-8');
    
$rating htmlspecialchars($_POST["rating"], ENT_QUOTES,'UTF-8');
    
$pace htmlspecialchars($_POST["pace"], ENT_QUOTES,'UTF-8');
    
$shooting htmlspecialchars($_POST["shooting"], ENT_QUOTES,'UTF-8');
    
$passing htmlspecialchars($_POST["passing"], ENT_QUOTES,'UTF-8');
    
$dribbling htmlspecialchars($_POST["dribbling"], ENT_QUOTES,'UTF-8');
    
$defending htmlspecialchars($_POST["defending"], ENT_QUOTES,'UTF-8');
    
$physical htmlspecialchars($_POST["physical"], ENT_QUOTES,'UTF-8');
    if (isset(
$_POST['addTocollection'])){
        
$addtocollection true;
    }
    
$newCard->createcard($name$age$nation$position$rating$pace$shooting$passing$dribbling$defending$physical$addtocollection,  $userid);
    
header("Location: " $_SERVER['REQUEST_URI']); // Redirect to the same page
    
exit;
}
?>
<section>
    <form action="" method="post">
        <label for="name">Namn</label> <br>
        <input type="text" name="name" id="name" required><br>
        <label for="age">Ålder</label> <br>
        <input type="number" name="age" id="age" min="1" max="99" required><br>
        <label for="nation">Land</label> <br>
        <input type="text" name="nation" id="nation" required><br>
        <label for="position">Position</label> <br>
        <select name="position" id="position" required>
            <option value="ANF">Anfallare</option>
            <option value="MF">Mittfältare</option>
            <option value="FÖR">Försvarare</option>
            <option value="MV">Målvakt</option>
        </select> <br>
        <label for="rating">Rating</label> <br>
        <input type="number" name="rating" id="rating" min="1" max="99" required><br>
        <label for="pace">Snabb</label> <br>
        <input type="number" name="pace" id="pace" min="1" max="99" required><br>
        <label for="shooting">Skott</label> <br>
        <input type="number" name="shooting" id="shooting" min="1" max="99" required><br>
        <label for="passing">Passning</label> <br>
        <input type="number" name="passing" id="passing" min="1" max="99" required><br>
        <label for="dribbling">Dribbling</label> <br>
        <input type="number" name="dribbling" id="dribbling" min="1" max="99" required><br>
        <label for="defending">Försvar</label> <br>
        <input type="number" name="defending" id="defending" min="1" max="99" required><br>
        <label for="physical">Fysik</label> <br>
        <input type="number" name="physical" id="physical" min="1" max="99" required><br>
        <input type='checkbox' name='addTocollection'>Lägg till i samling? </option> <br>
        <button type="submit" name="submit">Skapa</button>
    </form>
</section>
<?php include("incl/footer.php"?>