class ValidationHash (View source)

Methods

static string
generate(int $len = 64)

Generates a random string.

static 
removeExpired(int $type)

Removes old entries for the supplied type.

static string
add(int $uID, int $type, bool $singeHashAllowed = false, int $hashLength = 64)

Adds a hash to the lookup table for a user and type, removes any other existing hashes for the same user and type.

static int
getUserID(string $hash, int $type)

Gets the users id for a given hash and type.

static int
getType(string $hash)

Gets the hash type for a given hash.

static bool
isValid($hash)

Validate the given hash

Details

static protected string generate(int $len = 64)

Generates a random string.

Parameters

int $len

Return Value

string

static protected removeExpired(int $type)

Removes old entries for the supplied type.

Parameters

int $type

static string add(int $uID, int $type, bool $singeHashAllowed = false, int $hashLength = 64)

Adds a hash to the lookup table for a user and type, removes any other existing hashes for the same user and type.

Parameters

int $uID
int $type
bool $singeHashAllowed
int $hashLength

Return Value

string

static int getUserID(string $hash, int $type)

Gets the users id for a given hash and type.

Parameters

string $hash
int $type

Return Value

int

| false

static int getType(string $hash)

Gets the hash type for a given hash.

Parameters

string $hash

Return Value

int

| false

static bool isValid($hash)

Validate the given hash

Parameters

$hash

Return Value

bool