> For the complete documentation index, see [llms.txt](https://docs.saturncms.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.saturncms.net/1.0.0/dev/libraries-and-functions/sessionmanager/validate-sessions.md).

# Validate Sessions

## Validate Sessions

You can check that users are genuine by validating sessions.

```php
use Saturn\SessionManager\Authenticate;

$Authenticate = new Authenticate();

if ($Authenticate->Validate()) {
    // Valid session
} else {
    // Invalid session
}
```

## Generate User Sessions

This function can be used to securely generate session tokens and store the user's username and UUID in session variables.

**This does not check their credentials against the database, you MUST use the database system to do this.**

```php
use Saturn\SessionManager\Authenticate;

$Authenticate = new Authenticate();
$Authenticate->Generate($Username, $UUID)
```

### Accessing session data

Sesssion data can be accessed like any usual session.

```php
$Username = $_SESSION['Username'];
$UUID = $_SESSION['UUID'];
$Token = $_SESSION['Token'];
```
