<?php require_once 'libcollection.php'; session_start(); canUserNavigateToPage(); db_connect(); $result = retrive_info('generatedbooks', $_SESSION['username'], '*'); db_close(); ?> <!DOCTYPE html> <?php generateHeader("Home", array("css/homeStyle.css"), array("js/circle.js")); generateNav(); ?> <div id="first"> <p class="intro">Welcome to storybook generator!</p> <p> Here you have the opportunity to create your own personal storybooks. You pick a template, characters, and setting and leave the rest to us.</p> </div> <div id="content"> <h4>Previous Works</h4> <p>Read previous works</p> <?php if (count($result) != 0) { while (count($result) != 0) { $book = array_pop($result); echo <<<ZZEOF <form action="userAction.php" method="POST"> <input type = "hidden" name="id" value="{$book['id']}"/> <label>{$book["title"]}</label>
function validate_login($username, $password) { db_connect(); $result = retrive_info('users', $username, '*'); db_close(); if (count($result) != 0) { $userInfo = array_pop($result); if (substr(sha1($password), 0, 20) == $userInfo['password']) { return TRUE; } } return FALSE; }