Skip to content

Código usado no workshop Refatorando Seu Código com Boas Práticas.

License

Notifications You must be signed in to change notification settings

devdrops/workshop-refatoracao

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP: Session and Cookies

A simple login/logout demo.

Credits to @MohammedElagha for his original source code.

How to Execute?

You'll need:

  • Docker
  • Docker-Compose (version 3)

Just run the command on your terminal:

docker-compose up -d

The application will be available at http://0.0.0.0:80/.

How to Stop Execution?

Run this command at the project's source dir on your terminal:

docker-compose down

Database Requisites

You'll need the current environment up and running before prepare your database - see How to Execute instructions.

This project uses a MySQL database to manage user access. In order to do that, make sure to follow the next steps:

  1. From the source dir, open a bash communication with the current Docker service:
docker-compose exec mysql bash
  1. Now, import the SQL file into the target database:
root@06055479a3d9:/# mysql -u developer -p login < /tmp/tables/login.sql
Enter password:
  1. Now, check if the table is OK:
root@06055479a3d9:/# mysql -u developer -p login
Enter password:
mysql> show tables;

    +-----------------+
    | Tables_in_login |
    +-----------------+
    | user_logins     |
    +-----------------+
    1 row in set (0.00 sec)

    mysql> describe user_logins;
    +----------+-------------+------+-----+---------+----------------+
    | Field    | Type        | Null | Key | Default | Extra          |
    +----------+-------------+------+-----+---------+----------------+
    | id       | int(11)     | NO   | PRI | NULL    | auto_increment |
    | username | varchar(32) | NO   |     | NULL    |                |
    | password | varchar(16) | NO   |     | NULL    |                |
    +----------+-------------+------+-----+---------+----------------+
    3 rows in set (0.00 sec)

If you have the same output as above, you're good to go! 😉

About

Código usado no workshop Refatorando Seu Código com Boas Práticas.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published