Ben Line

Generate a salt (PHP)

9/27/2019 • ☕️ 1 min read

function generateSalt($max = 15) {
        $characterList = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*?";
        $i = 0;
        $salt = "";
        while ($i < $max) {
            $salt .= $characterList{mt_rand(0, (strlen($characterList) - 1))};
            $i++;
        }
        return $salt;
}
{% if template contains 'customer' %}
      {{ "shopify_common.js" | shopify_asset_url | script_tag }}
      {{ "customer_area.js"  | shopify_asset_url | script_tag }}
{% endif %}