R
R
rusbitor2016-08-10 19:23:33
In contact with
rusbitor, 2016-08-10 19:23:33

Vkontakte authorization how to fix an error?

Hello!
Swearing at line 19 gives an error Fatal error: Call to undefined function curl() in .

<?php
require "include/bittorrent.php";
if($CURUSER){
    header("Location: $DEFAULTBASEURL/");   
} else {
dbconn(false);
stdhead("Авторизация через ВКонтакте");
function bark($msg) {
    global $tracker_lang;
    stdhead();
    stdmsg($tracker_lang['error'], $msg, 'error');
    stdfoot();
    exit;
}
$mail = $_POST['user']; //E-mail  
$pass = $_POST['pass']; //пароль 
$url_auth='https://oauth.vk.com/token?grant_type=password&client_id=2274003&client_secret=hHbZxrka2uZ6jB1inYsH&username='.$mail.'&password='.$pass; 

$content=curl($url_auth,'','',''); 
#функция декодирования масива JSON 
$json=json_decode($content, true); 
if(isset($json[error_description])){ 
    bark("Авторизация невозможна!");
}else { 
if (!validemail($mail))
    bark("Это не похоже на реальный email адрес.");
// check if email addy is already in use
$a = (@mysql_fetch_row(@sql_query("SELECT COUNT(*) FROM users WHERE email=".sqlesc($mail)))) or die(mysql_error());
if ($a[0] != 0)
    bark("E-mail адрес ".htmlspecialchars($mail)." уже зарегистрирован в системе.");
    
    $url_p="https://api.vk.com/method/users.get?user_id=".$json[user_id]."&v=5.21&access_token=".$json[access_token]; 
    $res=curl($url_p,'','',''); 
        $json_auth=json_decode($res, true); 
        $users = get_row_count("users");
        $secret = mksecret();
        $wantpasshash = md5($secret . $pass . $secret);
        $wantusername = 'vk'.$json_auth[response][0][id].'_'.rus2translit(utf8_win($json_auth[response][0][first_name]));
        $status = 'confirmed';
# REG    
# MYSQL - ALTER TABLE `users` ADD `login` varchar(40) NOT NULL default '';        
    $ret = sql_query("INSERT INTO users (username, passhash, secret, avatar, email, status, added, login) VALUES (
    " .    implode(",", array_map("sqlesc", array($wantusername, $wantpasshash, $secret, $DEFAULTBASEURL.'/pic/avavk.png', $mail, $status))).", 
    '". get_date_time() ."', 'vk')") or sqlerr(__FILE__, __LINE__);
# LOGIN
    $id = mysql_insert_id();
    logincookie($id, $wantpasshash);
    header("Location: $DEFAULTBASEURL/");     
} 
stdfoot();
}
?>

CURL is installed on the hosting. Help me fix it please.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question