403Webshell
Server IP : 51.89.169.208  /  Your IP : 216.73.216.76
Web Server : Apache
System : Linux ns3209505.ip-198-244-202.eu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Tue Nov 5 04:50:16 EST 2024 x86_64
User : yellowleaf ( 1019)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/yellowleaf/www/all_scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/yellowleaf/www/all_scripts/BACKUP_get_cats_google_suggest.php
<?php

$path  = $_SERVER['DOCUMENT_ROOT'];
include_once $path.'/connect_db.php';

function curl_get($url){
    // create curl resource
    $ch = curl_init();

    // set url
    curl_setopt($ch, CURLOPT_URL, $url);

    //return the transfer as a string
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    // $output contains the output string
    $output = curl_exec($ch);

    // close curl resource to free up system resources
    curl_close($ch);

    return $output;
}

$res_cats = $connect->query("SELECT * from `cats` WHERE `junk` = 0 ORDER BY RAND() ASC LIMIT 1");

if ($res_cats->num_rows > 0) {
    $row = $res_cats->fetch_array(MYSQLI_ASSOC);
    $cat_id = $row["cat_id"];
    $cat_name = substr(trim($row["cat_name"]), 0, -2);
    $search_val = $cat_name." near me";
    echo "<p><b>Search Text:</b> $search_val</p>";
    $search_val = str_replace(" ", "+", $search_val);
    $search_url = "https://suggestqueries.google.com/complete/search?client=firefox&q=".$search_val;

    $val = file_get_contents($search_url);
    $json_decode = json_decode($val);
    $suggestions = $json_decode[1];
    echo "<pre>";

    echo "<p>Google result: </p>";

    print_r($suggestions);

    if (count($suggestions) < 1) {
        die("No google search result on cats id: $cat_id");
    }

    $result_suggestions = [];
    for ($i=0; $i < count($suggestions); $i++) { 
        $explode = explode(" ", $suggestions[$i]);
        $l1 = $explode[count($explode) - 2];
        $l2 = $explode[count($explode) - 1];

        if ($l1 == "near" && $l2 == "me") {
            array_push($result_suggestions, $suggestions[$i]);
        }
    }

    if (count($result_suggestions) < 1) {
        die("No 'near me'd text found in google search result on cats id: $cat_id");
    }

    for ($i=0; $i < count($result_suggestions); $i++) { 
        $kv = addslashes(trim($result_suggestions[$i]));
        
        $connect->query("INSERT INTO `google_suggest` SET `keyword` = '$kv', `pop` = 0 ON DUPLICATE KEY UPDATE `pop` = `pop`+1") || die("Google suggest insert error");
    }
    
    $connect->query("UPDATE `cats` SET `junk` = 1 WHERE `cat_id` = '$cat_id'") || die("Update status error: ".$connect->error);

    echo "<p><b>Final result after filter: </b></p>";
    print_r($result_suggestions);
    echo "<br>Success to insert into google_suggest. <b>cat_id:</b> $cat_id";
    echo '<meta http-equiv="refresh" content="3">';
}else{
    echo "All completed.";
}

?>

Youez - 2016 - github.com/yon3zu
LinuXploit