Web application to manage shifts in a transport company of treviso, it is possible to ask, search and exchange shifts each others. It is written mostly in italian, is completely responsive and it uses:
- Front end: AngularJS, HTML, CSS
- Back end: PHP
- Database: MySQL
- root HTML pages
- ajax PHP files, used as back end, these are the files called by JS to connect with the DB
- config Here are the files to configure the application
- css Only css files
- img All images, icons and logos of the site
- js Only javascript files
- lib All libraries used by the application
- AngularJS It is a JavaScript-based web framework for developing single-page applications.
- AngularJS Material It provides a set of reusable and accessible UI components for AngularJS
The database was designed for MySQL, it has these tables:
- cambi Table contains shifts users are asking or looking for
- utenti All users registered on the web application
In the config folder there are 2 files that are used to configure the application to connect correctly with the frontend, backend and DB
-
config.js It is used to connect Javascript with PHP throw ajax calls.
It consider if the current url starts with http or https protocol, and if contains www or not, then add the backend addressvar url_location = window.location; var http_https = "https://"; var www = ""; if (url_location.protocol) { http_https = url_location.protocol + "//"; } if (url_location.host.startsWith("www.")) { www = "www."; } var url = http_https + www + "momcambiturni.it/"; // edit this line: address url of the application
-
config.php This file is inluded at the start of each php file.
It is used to configure general PHP settings and the connection with DB:- variables to connect to DB
- connection to DB
- start session
// connection data $server = "localhost"; // edit this line: server address $username = "momcambiturni"; // edit this line: username $password = "momcambiturni"; // edit this line: password $db = "momcambiturni"; // edit this line: name of the databases // start connection to DB try { $dbh = new PDO("mysql:host=$server;dbname=$db", $username, $password); $dbh->exec("set names utf8"); } catch (PDOException $e) { echo "Connessione database fallita: " . $e->getMessage() . "\n"; exit; } $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // start session if (session_status() == PHP_SESSION_NONE) { session_start(); }