My solution for 1DV610. It fulfills 100% of the automatic tests.
It is a todo app and you can find it here: 1dv610.antonstrand.se
All use cases are implemented.
All tests are successful.
This guide assumes that you know how to set up a php project and will only get into specifics to this project.
First, create a database and add a table for users
, cookies
and todos
. You can use the SQL snippets below to speed up this process.
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(128) NOT NULL,
`password` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cookies` (
`id` int(11) NOT NULL,
`username` varchar(128) NOT NULL UNIQUE,
`password` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `todos` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`username` varchar(128) NOT NULL,
`task` text NOT NULL,
`isComplete` tinyint(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Create a Settings.php
in the root folder. Use the template below and change the information to fit your setup.
<?php
class Settings
{
public static $HOST = 'localhost';
public static $USER = 'user';
public static $PASSWORD = 'password';
public static $DB = 'dbName';
}