An extremely simple and easy to understand MVC skeleton application, reduced to the max.
- Anonymous user is allowed to enter data using the form field
- User data is shown in preview page before inserting into database
- Upon confirmation from preview page data is inserted into database
- unique token is generated for every form submit to prevent CSRF attack
- PDO is used to prevent sql injection
- application or database errors are captured into public/logs/logs.txt file
-
Run the SQL statements in the application/_install folder.
-
Change the .htaccess file from
RewriteBase /mvc/
to where you put this project, relative to the web root folder (usually /var/www). So when you put this project into the web root, like directly in /var/www, then the line should look like or can be commented out:
RewriteBase /
If you have put the project into a sub-folder, then put the name of the sub-folder here:
RewriteBase /sub-folder/
- Edit the application/config/config.php, change this line
define('URL', 'http://localhost/mvc/');
to where your project is. Real domain, IP or 127.0.0.1 when developing locally. Make sure you put the sub-folder in here (when installing in a sub-folder) too, also don't forget the trailing slash !
- Edit the application/config/config.php, change these lines
define('DB_TYPE', 'mysql');
define('DB_HOST', 'localhost');
define('DB_NAME', 'php-assignment');
define('DB_USER', 'root');
define('DB_PASS', '');
to your database credentials. If you don't have an empty database, create one. Only change the type mysql
if you
know what you are doing.