Ejemplo n.º 1
0
    {
        return $tokentype !== "" ? "{$tokentype} token expired, please try again " . self::getDescriptionImageHTML($dowhat) : "Token expired, please try again " . self::getDescriptionImageHTML($dowhat);
    }
    /**
     * Gets the HTML image (?) with short csrf description for users for the incorrect token error message
     * @param dowhat string What will be put in the string "Simply $dowhat again to...", default is try
     * @return string HTML image with description
     */
    public static function getDescriptionImageHTML($dowhat = "try")
    {
        $string = "<img src='site_assets/bootstrap/images/questionmark.png' ";
        $string .= "title='Tokens are used to help us mitigate attacks; Simply ";
        $string .= htmlentities(strip_tags($dowhat));
        $string .= " again to continue' width='20px' height='20px'>";
        return $string;
    }
    private function getHash($string)
    {
        return hash('sha256', $this->salty . $string . $this->salt);
    }
}
$csrftoken = new CSRFToken();
$csrftoken->setDebug($debug);
$csrftoken->setMysql($mysqli);
$csrftoken->setSalt($config['SALT']);
$csrftoken->setSalty($config['SALTY']);
$csrftoken->setMail($mail);
$csrftoken->setUser($user);
$csrftoken->setToken($oToken);
$csrftoken->setConfig($config);
$csrftoken->setErrorCodes($aErrorCodes);