Just starting to learn PHP little by little and immediately got a question, how to secure the config.php file?
At the moment, the file itself looks like this:
<? session_start(); header('Content-Type: text/html; charset=utf-8'); $vk_config['client_id'] = ''; $vk_config['client_secret'] = ''; $vk_config['redirect_uri'] = ''; $vk_config['v'] = ''; ?> If I need to get data in some place, I connect via include and substitute a variable with the key I need:
vk_authorize($vk_config['client_id'], $vk_config['redirect_uri'], $vk_config['v']); Example in function:
function vk_authorize($client_id, $redirect_uri, $v) { $params = array ( 'client_id' => $client_id, 'redirect_uri' => $redirect_uri, 'display' => 'page', 'scope' => 'email', 'response_type' => 'code', 'v' => $v ); echo '<a class="vk-authorize" href="https://oauth.vk.com/authorize?' . urldecode(http_build_query($params)) . '">Аутентификация</a>'; } Actually, who can advise from a security point of view?