Results 1 to 2 of 2

Thread: [php] Instant Faerie Quest Lookup Source

  1. #1
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m

    [php] Instant Faerie Quest Lookup Source

    This code does the following:
    • Checks to make sure the IP address hasn't used 3 searches in the last hour
    • Checks if any cookies are stored
    • Tries to search for an item using the stored cookies
    • If the stored cookies aren't valid, it will login to the account and update the stored cookies accordingly
    • Searches for the item
    • Stores the cookies of the searching account for next time
    PHP Code:
    <title>Zachafer's Quest Helper</title>
    <center>
    <form action="" method="POST">
    Item to lookup: <input type="text" name="item" value="<?php echo @$_REQUEST['item']; ?>" /><br />
    <input type="submit" value="Search" /></form>
    <?php

    if (@$_REQUEST['item']) {
        echo 
    "<hr />\n";
        
    $log = @file_get_contents('log.txt');
        
    $ip $_SERVER['REMOTE_ADDR'];
        
    $limit 3;
        if (
    preg_match_all('/^(\d+):' preg_quote($ip) . '$/m'$log$logs)) {
            
    $uses 0;
            for (
    $x count($logs[0]) - 1$x >= 0$x--) {
                if (
    strtotime('+1 hour'$logs[1][$x]) > time()) {
                    if (++
    $uses >= 3)
                        die(
    "You have used your $limit searches per hour!");
                }
            }
        }

        
    $cookie = @file_get_contents('cookie.txt');
        if (!
    preg_match('/^neologin=([a-z\d_]{3,20}%2B[a-z\d].+?);/i'$cookie)) {
            
    $cookie updateCookie();
        }

        
    $result searchItem($cookie);
        if (
    preg_match('%^Location: /login%im'$result)) {
            
    $cookie updateCookie();
            
    $result searchItem($cookie);
            if (
    preg_match('%^Location: /login%im'$result)) {
                die(
    'Error logging into account! Account could possibly be iced. Please <a href="http://clraik.com/forum/private.php?do=newpm&u=128">notify Zachafer</a>.');
            }
        }
        @
    file_put_contents('log.txt'time() . ":$ip\n"FILE_APPEND LOCK_EX);
        if (
    preg_match_all('%(/browseshop\.phtml\?owner=([a-z\d_]{3,20})&buy_obj_info_id=\d+&buy_cost_neopoints=(\d+))%i',
            
    $result$items)) {
            
    preg_match('%<span style="font-size: 14pt;">(.+)</span>%i'$result$item);
            
    $item $item[1];
            echo 
    "<TABLE BORDER=1>\n<CAPTION ALIGN=TOP><B>$item:</B></CAPTION>";
            echo 
    "<TR>\n<TD>Shop Owner</TD>\n<TD>Item Cost</TD>\n<TD>Buy Link</TD>\n</TR>\n";
            for (
    $x 0$x count($items[0]); $x++) {
                echo 
    "<TR>\n<TD>" $items[2][$x] . "</TD>\n";
                echo 
    '<TD>' number_format($items[3][$x]) . " NP</TD>\n";
                echo 
    '<TD><a href="http://hidemyass.com/?http://www.neopets.com' $items[1][$x] .
                    
    '">Buy Now</TD>';
                echo 
    "\n</TR>\n";
            }
            echo 
    '</TABLE>';
        } else {
            die(
    "Error finding " . @$_REQUEST['item'] . ". I am probably shop wiz banned.");
        }
    }

    function 
    searchItem($cookie)
    {
        
    $item str_replace(' ''+', @$_REQUEST['item']);
        
    $ch curl_init();
        
    curl_setopt($chCURLOPT_URL'http://www.neopets.com/market.phtml');
        
    curl_setopt($chCURLOPT_POSTFIELDS"type=process_wizard&feedset=0&shopwizard=$item&table=shop&criteria=exact&min_price=0&max_price=99999");
        
    curl_setopt($chCURLOPT_HEADERtrue);
        
    curl_setopt($chCURLOPT_REFERER,
            
    'http://www.neopets.com/market.phtml?type=wizard');
        
    curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
        
    curl_setopt($chCURLOPT_COOKIE$cookie);
        
    $result curl_exec($ch);
        
    curl_close($ch);
        return 
    $result;
    }

    function 
    updateCookie()
    {
        
    $user '';
        
    $pass '';
        
    $ch curl_init();
        
    curl_setopt($chCURLOPT_URL'http://www.neopets.com/login.phtml');
        
    curl_setopt($chCURLOPT_POSTFIELDS"destination=%252Findex.phtml&username=$user&password=$pass");
        
    curl_setopt($chCURLOPT_HEADERtrue);
        
    curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
        
    $result curl_exec($ch);
        
    curl_close($ch);
        if (!
    preg_match('/(neologin=[a-z\d_]{3,20}%2B[a-z\d].+?);/i'$result$newcookie)) {
            die(
    'Error checking shop wiz - Please <a href="http://clraik.com/forum/private.php?do=newpm&u=128">notify Zachafer</a>.');
        }
        @
    file_put_contents('cookie.txt'$newcookie[1], LOCK_EX);
        return 
    $newcookie[1];
    }
    ?><title>Zachafer's Quest Helper</title>
    <center>
    <form action="" method="POST">
    Item to lookup: <input type="text" name="item" value="<?php echo @$_REQUEST['item']; ?>" /><br />
    <input type="submit" value="Search" /></form>
    <?php

    if (@$_REQUEST['item']) {
        echo 
    "<hr />\n";
        
    $log = @file_get_contents('log.txt');
        
    $ip $_SERVER['REMOTE_ADDR'];
        
    $limit 3;
        if (
    preg_match_all('/^(\d+):' preg_quote($ip) . '$/m'$log$logs)) {
            
    $uses 0;
            for (
    $x count($logs[0]) - 1$x >= 0$x--) {
                if (
    strtotime('+1 hour'$logs[1][$x]) > time()) {
                    if (++
    $uses >= 3)
                        die(
    "You have used your $limit searches per hour!");
                }
            }
        }

        
    $cookie = @file_get_contents('cookie.txt');
        if (!
    preg_match('/^neologin=([a-z\d_]{3,20}%2B[a-z\d].+?);/i'$cookie)) {
            
    $cookie updateCookie();
        }

        
    $result searchItem($cookie);
        if (
    preg_match('%^Location: /login%im'$result)) {
            
    $cookie updateCookie();
            
    $result searchItem($cookie);
            if (
    preg_match('%^Location: /login%im'$result)) {
                die(
    'Error logging into account! Account could possibly be iced. Please <a href="http://clraik.com/forum/private.php?do=newpm&u=128">notify Zachafer</a>.');
            }
        }
        @
    file_put_contents('log.txt'time() . ":$ip\n"FILE_APPEND LOCK_EX);
        if (
    preg_match_all('%(/browseshop\.phtml\?owner=([a-z\d_]{3,20})&buy_obj_info_id=\d+&buy_cost_neopoints=(\d+))%i',
            
    $result$items)) {
            
    preg_match('%<span style="font-size: 14pt;">(.+)</span>%i'$result$item);
            
    $item $item[1];
            echo 
    "<TABLE BORDER=1>\n<CAPTION ALIGN=TOP><B>$item:</B></CAPTION>";
            echo 
    "<TR>\n<TD>Shop Owner</TD>\n<TD>Item Cost</TD>\n<TD>Buy Link</TD>\n</TR>\n";
            
    $max count($items[0]);
            for (
    $x 0$x $max$x++) {
                echo 
    "<TR>\n<TD>" $items[2][$x] . "</TD>\n";
                echo 
    '<TD>' number_format($items[3][$x]) . " NP</TD>\n";
                echo 
    '<TD><a href="http://hidemyass.com/?http://www.neopets.com' $items[1][$x] .
                    
    '">Buy Now</TD>';
                echo 
    "\n</TR>\n";
            }
            echo 
    '</TABLE>';
        } else {
            die(
    "Error finding " . @$_REQUEST['item'] . ". I am probably shop wiz banned.");
        }
    }

    function 
    searchItem($cookie)
    {
        
    $item str_replace(' ''+', @$_REQUEST['item']);
        
    $ch curl_init();
        
    curl_setopt($chCURLOPT_URL'http://www.neopets.com/market.phtml');
        
    curl_setopt($chCURLOPT_POSTFIELDS"type=process_wizard&feedset=0&shopwizard=$item&table=shop&criteria=exact&min_price=0&max_price=99999");
        
    curl_setopt($chCURLOPT_HEADERtrue);
        
    curl_setopt($chCURLOPT_REFERER,
            
    'http://www.neopets.com/market.phtml?type=wizard');
        
    curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
        
    curl_setopt($chCURLOPT_COOKIE$cookie);
        
    $result curl_exec($ch);
        
    curl_close($ch);
        return 
    $result;
    }

    function 
    updateCookie()
    {
        
    $user '';
        
    $pass '';
        
    $ch curl_init();
        
    curl_setopt($chCURLOPT_URL'http://www.neopets.com/login.phtml');
        
    curl_setopt($chCURLOPT_POSTFIELDS"destination=%252Findex.phtml&username=$user&password=$pass");
        
    curl_setopt($chCURLOPT_HEADERtrue);
        
    curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
        
    $result curl_exec($ch);
        
    curl_close($ch);
        if (!
    preg_match('/(neologin=[a-z\d_]{3,20}%2B[a-z\d].+?);/i'$result$newcookie)) {
            die(
    'Error checking shop wiz - Please <a href="http://clraik.com/forum/private.php?do=newpm&u=128">notify Zachafer</a>.');
        }
        @
    file_put_contents('cookie.txt'$newcookie[1], LOCK_EX);
        return 
    $newcookie[1];
    }
    ?>

  2. The Following 2 Users Say Thank You to Zachafer For This Useful Post:

    DarkByte (06-30-2012),GetJinxed (05-08-2016)

  3. #2

    Joined
    Jun 2012
    Posts
    1,699
    Thanks
    876
    Thanked
    2,881/1,142
    DL/UL
    44/1
    Mentioned
    562 times
    Time Online
    118d 6h 45m
    Avg. Time Online
    40m
    Nice job cant + rep u again yet lol.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •