PDA

View Full Version : [php] Instant Faerie Quest Lookup Source



Zachafer
06-30-2012, 04:22 PM
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

<title>Zachafer's Quest Helper</title>
<center>
<form action="" method="POST">
[Only registered and activated users can see links]
<input type="submit" value="Search" /></form>
<?php

[Only registered and activated users can see links]
echo "<hr />\n";
[Only registered and activated users can see links]
$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!");
}
}
}

[Only registered and activated users can see links]
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="[Only registered and activated users can see links]">notify Zachafer</a>.');
}
}
[Only registered and activated users can see links]
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="[Only registered and activated users can see links]' . $items[1][$x] .
'">Buy Now</TD>';
echo "\n</TR>\n";
}
echo '</TABLE>';
} else {
[Only registered and activated users can see links]
}
}

function searchItem($cookie)
{
[Only registered and activated users can see links]
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '[Only registered and activated users can see links]');
curl_setopt($ch, CURLOPT_POSTFIELDS, "type=process_wizard&feedset=0&shopwizard=$item&table=shop&criteria=exact&min_price=0&max_price=99999");
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_REFERER,
'[Only registered and activated users can see links]');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}

function updateCookie()
{
$user = '';
$pass = '';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '[Only registered and activated users can see links]');
curl_setopt($ch, CURLOPT_POSTFIELDS, "destination=%252Findex.phtml&username=$user&password=$pass");
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$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="[Only registered and activated users can see links]">notify Zachafer</a>.');
}
[Only registered and activated users can see links]
return $newcookie[1];
}
?><title>Zachafer's Quest Helper</title>
<center>
<form action="" method="POST">
[Only registered and activated users can see links]
<input type="submit" value="Search" /></form>
<?php

[Only registered and activated users can see links]
echo "<hr />\n";
[Only registered and activated users can see links]
$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!");
}
}
}

[Only registered and activated users can see links]
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="[Only registered and activated users can see links]">notify Zachafer</a>.');
}
}
[Only registered and activated users can see links]
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="[Only registered and activated users can see links]' . $items[1][$x] .
'">Buy Now</TD>';
echo "\n</TR>\n";
}
echo '</TABLE>';
} else {
[Only registered and activated users can see links]
}
}

function searchItem($cookie)
{
[Only registered and activated users can see links]
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '[Only registered and activated users can see links]');
curl_setopt($ch, CURLOPT_POSTFIELDS, "type=process_wizard&feedset=0&shopwizard=$item&table=shop&criteria=exact&min_price=0&max_price=99999");
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_REFERER,
'[Only registered and activated users can see links]');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}

function updateCookie()
{
$user = '';
$pass = '';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '[Only registered and activated users can see links]');
curl_setopt($ch, CURLOPT_POSTFIELDS, "destination=%252Findex.phtml&username=$user&password=$pass");
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$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="[Only registered and activated users can see links]">notify Zachafer</a>.');
}
[Only registered and activated users can see links]
return $newcookie[1];
}
?>

DarkByte
06-30-2012, 07:40 PM
Nice job cant + rep u again yet lol.