Example #1
0
    </head>
    <body>
        <h4><?php 
if ($_SESSION['err']) {
    echo "An error has occured!";
} else {
    echo "Welcome to WebCite!";
}
?>
</h4>
        <div id="container">
            <?php 
if ($_SESSION['err']) {
    echo $_SESSION['err'];
} else {
    foreach (mla_types() as $type => $visualname) {
        ?>
            <a href='./index.php?type=<?php 
        echo $type;
        ?>
'><?php 
        echo $visualname;
        ?>
</a><br />
            <?php 
    }
}
?>
        </div>
    </body>
</html>
Example #2
0
<?php

// Plug CSRF Security Hole
session_start();
require_once './helper_funcs.php';
require_once './form_funcs.php';
$_SESSION['csrf_token'] = sha1(uniqid(rand()));
$type = $_GET['type'];
$possible_types = mla_types();
if (!array_key_exists($type, $possible_types)) {
    header("Location: ./global.php");
}
?>
<!doctype html>
<html lang="en">
    <head>
        <title>WebCite: An online MLA formatter</title>
        <link href="./media/style.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="./media/main_funcs.js"></script>
    </head>
    <body>
        <h4>Fill in relevant pieces of information</h4>
        <div id="container">
            <form action='mla.php' method='post'>
                <input type="hidden" name="csrf_token" value="<?php 
echo $_SESSION['csrf_token'];
?>
" />
                <input type="hidden" name="type" value="<?php 
echo $type;
?>