LEPTON CMS 7.2.0
feel free to keep it strictly simple...
Loading...
Searching...
No Matches
function.random_string.php File Reference

Go to the source code of this file.

Functions

 random_string (int $iNumOfChars=8, string $aType="alphanum")
 

Variables

if(!defined("SEC_FILE")) if(defined('LEPTON_PATH')) else
 
 $root = $oneback
 
 $level = 1
 

Function Documentation

◆ random_string()

random_string ( int $iNumOfChars = 8,
string $aType = "alphanum" )

Function to generate a random-string. Random-Strings are often used inside LEPTON-CMS, e.g. Captcha, Modul-Form, User-Account, Forgot-Password, etc.

Parameters
int$iNumOfCharsNumber of chars to generate. Default is 8 (chars).
string$aTypeType, default is 'alphanum'. Possible values are: 'alphanum' = Generates an alphanumeric string with chars and numbers. 'alpha' = Generates only chars. 'chars' = Also generates only chars. 'hex' = Hexadecimal. 'hex-lower' = Hexadecimal in lower cases. 'lower' = Only lower cases are used. 'num' = Generates only numbers. 'pass' = Generates an alphanumeric string within some special chars e.g. '&', '$' or '|'. '<anyString>' = Generates a shuffled string with these chars.
Returns
string A shuffled string within the chars.

@examples random_string()

  • Will generate something like 'abC2puwm' (8 chars).

random_string(5)

  • The same, but only 5 chars, e.g. 'abc56' or '2wsd4'.

random_string(8, 'num')

  • Will result in a random number-string, e.g. '0898124'

random_string(8, 'Aldus')

  • Will generate a shuffled-string with theese chars, e.g: 'sAdludsA'.

random_string(8, 'hex-lower')

  • Will generate a shuffled-string with hex-decimalchars like 'afb2c22e7'.

Definition at line 76 of file function.random_string.php.

Variable Documentation

◆ $level

$level = 1

Definition at line 25 of file function.random_string.php.

◆ $root

$root = $oneback

Definition at line 24 of file function.random_string.php.

◆ else

while(($level< 10) &&(!file_exists($root.SEC_FILE))) if (file_exists( $root.SEC_FILE)) else
Initial value:
{
$oneback = "../"

This file is part of LEPTON Core, released under the GNU GPL Please see LICENSE and COPYING files in your package for details, specially for terms and warranties.

NOTICE:LEPTON CMS Package has several different licenses. Please see the individual license in the header of each single file or info.php of modules and templates.

Author
LEPTON Project

Definition at line 22 of file function.random_string.php.