Home > CMS Tutorial > DEDECMS > body text

What should I do if the basic system parameters of Dedecms are blank?

藏色散人
Release: 2020-01-07 09:28:18
Original
3170 people have browsed it

What should I do if the basic system parameters of Dedecms are blank?

What should I do if the basic system parameters of dedecms are blank?

The basic system parameters of dedecms appear blank or display Call to undefined function make_hash()

Recommended learning: cms

The latest version of Dreamweaver (2018-01-09) modified common.func.php in the include folder and added two functions.

If the common.func.php file is provided in the downloaded template folder, it is very likely that these two functions are not available, which will cause an error.

You need to paste the code of these two functions into the /include/common.func.php file. The code is as follows:

function make_hash()
{
    $rand = dede_random_bytes(16);
    $_SESSION['token'] = ($rand === FALSE)
        ? md5(uniqid(mt_rand(), TRUE))
        : bin2hex($rand);
    return $_SESSION['token'];
}
function dede_random_bytes($length)
{
    if (empty($length) OR ! ctype_digit((string) $length))
    {
        return FALSE;
    }
    if (function_exists('random_bytes'))
    {
        try
        {
            return random_bytes((int) $length);
        }
        catch (Exception $e)
        {
            return FALSE;
        }
    }
    if (defined('MCRYPT_DEV_URANDOM') && ($output = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM)) !== FALSE)
    {
        return $output;
    }
    if (is_readable('/dev/urandom') && ($fp = fopen('/dev/urandom', 'rb')) !== FALSE)
    {
        is_php('5.4') && stream_set_chunk_size($fp, $length);
        $output = fread($fp, $length);
        fclose($fp);
        if ($output !== FALSE)
        {
            return $output;
        }
    }
    if (function_exists('openssl_random_pseudo_bytes'))
    {
        return openssl_random_pseudo_bytes($length);
    }
    return FALSE;
}
Copy after login

Paste the above code into

/* *

* Load the assistant. The system defaults to loading the assistant

just above this code.

The above is the detailed content of What should I do if the basic system parameters of Dedecms are blank?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!