Giter Site home page Giter Site logo

proj_ltw_2021's Introduction

Forever Home

License: GPL v3

Link to website deployment

  • Project name: Forever Home
  • Short description: A website for posting and adopting pets
  • Environment: Apache2 and PHP built-in server (Unix)
  • Tools: HTML/CSS, Javascript, PHP, SQL
  • Institution: FEUP
  • Course: LTW (Web Languages and Technologies)

Installing

Cloning all dependencies

To clone all dependencies (namely PHP libraries), please run

git submodule update --init --recursive

Build database

To build the database, run

./deploy-server.sh

It may be necessary to change the script's permissions.

Routing

The REST API component of the server sends requests through index.php which are then routed to the correct functions/files. This is unlike what web servers typically do: route the request to the corresponding file in the file system.

Apache2

To correctly route the requests, the apache2 application must be able to read rest/.htaccess. To do that, you will probably have to change your apache2 configuration file (usually under /etc/apache2/apache2.conf), and replace AllowOverride None with AllowOverride All in the section where apache2 is configured for the directory where you put this repository; usually you put this repository somewhere under /var/www or any subfolder of it, so you must change section

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride None
	Require all granted
</Directory>

to

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride All
	Require all granted
</Directory>

You also need to enable some modules with the following commands:

sudo a2enmod rewrite
sudo a2enmod expires

After changing the apache2 configuration and enabling the modules, restart apache2 by running sudo service apache2 restart.

PHP built-in server

For the PHP built-in server, if you set index.php as request router then you're fine, since all requests will be properly routed by index.php (this script returns false to signal the PHP built-in server to serve the actual file in the file system instead of proceeding in running PHP code).

Email service

To enable email service, you have to provide valid credentials in file rest/email.cred, following the template:

<email address>
<password>

For instance:

The actual Gmail email we will use is [email protected]. The corresponding password is to be kept secret, and as such only available on request to our team.

Running with PHP built-in server

To run this project with the built-in PHP server, you have to run it with the proper arguments so that requests are routed to index.php:

php -S localhost:4000 index.php

Credentials

Username/password (role):

  • dmfr/dmfr (user)
  • BrenoAccioly/BrenoAccioly (user)
  • 2dukes/2dukes (user)
  • TiagooGomess/TiagooGomess (user)
  • Asdrubal007/Asdrubal007 (user)
  • balves/balves (user)
  • harold/harold (user)
  • Romanoff123/Romanoff123 (user)
  • AAOrg/AAOrg (shelter)

Libraries

Features:

  • Security

    • XSS: yes
      • Filtering and encoding inputs: yes
      • CSP: yes
    • CSRF: yes
    • SQL using prepare/execute: yes
    • Passwords:
      • bcrypt with salt algorithm: yes
      • at least 7 characters: yes
      • include at least 1 uppercase letter: yes
      • include at least 1 special character: yes
    • Data Validation: regex, php, html, javascript
    • Other:
      • Regenerate session: yes
      • Usernames are case insensitive: yes
      • Password reset with randomly-generated token
  • Technologies

    • Separated logic/database/presentation: yes
    • Semantic HTML tags: yes
    • Responsive CSS: yes
    • Javascript: yes
    • Ajax: yes
    • REST API: yes
    • Other:
  • Usability:

    • Error/success messages: yes
    • Forms don't lose data on error: no
  • Minimum requirements: yes

  • Extra requirements:

    • See adopted pets.
    • Add and view pet photos.
    • Pet comment section.
    • Private chat between users regarding pet adopted proposals.
    • Animal shelters are also able to register as users.
    • Shelters have a dedicated page with all pets available for adoption.
    • Users can be collaborators of a certain shelter and have permission to edit information about the shelter and any pets for adoption.
    • Users that adopt a pet are able to still post photos of that animal after the adoption.
    • Users should receive a notification anytime something important happens.
    • Develop a REST API (available at URL rest/rest/).
    • Reset password system using emails and random tokens (implemented after demo and before delivery)

Navigation

Navigation

Database

Database

Shelter(username→User, location, description)
User(username, password, name, registeredOn, shelter→Shelter)
ShelterInvite(user→User, shelter→Shelter, text, requestDate)
Notification(id, read, subject, text, user→User)
Pet(id, name, species, age, sex, size, color, location, description, status, postedBy→User)
FavoritePet(username→User, petId→Pet)
Comment(id, pet→Pet, user→User, postedOn, text, answerTo→Comment)
CommentPhoto(id, commentId→Comment, url)
AdoptionRequest(id, user→User, pet→Pet, text, outcome)
AdoptionRequestMessage(id, request→AdoptionRequest, text)

License

© 2020 Breno Pimentel, Diogo Rodrigues, Rui Pinto, Tiago Gomes

All files are licensed under GNU General Public License v3 by © 2020 Breno Pimentel, Diogo Rodrigues, Rui Pinto, Tiago Gomes.

The files not authored by us (if any) are presented as a fundamental complement to this project, and are made available under fair use for education.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.