Skip to content

davide-murro/mom-cambi-turni

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

MomCambiTurni

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

File structure

  • 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

Libraries

  • 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

Database

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

Configuration

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 address

    var 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();
    }

Screenshots

momcambiturni altervista org_ momcambiturni altervista org_home html momcambiturni altervista org_inserimento html momcambiturni altervista org_inserimento_riposo html momcambiturni altervista org_visualizza html