An open API service indexing awesome lists of open source software.

https://github.com/stdakov/php_flash_messages


https://github.com/stdakov/php_flash_messages

Last synced: 7 months ago
JSON representation

Awesome Lists containing this project

README

          

# PHP FLASH messages
This is supper simple implementation of php flash messages

## Installation
The preferred way to install this tool is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require stdakov/flash
```

or add

```
"stdakov/flash": "*"
```

## Usage

set message:
```php
require 'vendor/autoload.php';

session_start();

use Dakov\FM;

if (isset($_POST['username']) && isset($_POST['password'])) {

$user = getUser($_POST['username']);

if ($user != null && isset($user['id']) && password_verify($_POST['password'], $user['password'])) {
$_SESSION["USER"] = $user['id'];
$hour = time() + 3600 * 24 * 365;
setcookie('user_id', $user['id'], $hour);
} else {
FM::set("wrong_credentials", "Invalid credentials");
}

header("Location: /");
}
```
use the message:
```html




= FM::flash("wrong_credentials"); ?>



```

The MIT License (MIT)