Location: PHPKode > scripts > Backstage Neopets Networks Neopets News Finder > backstage-neopets-networks-neopets-news-finder/look.php
<?php
/**********************************************************************
|o.oOOOo.  .oOOOo.  o.     O o.     O             o.     O                                  OOooOoO                o              
| o     o  o     o  Oo     o Oo     o             Oo     o                                  o       o             O               
| O     O  O.       O O    O O O    O             O O    O                                  O                     o               
| oOooOO.   `OOoo.  O  o   o O  o   o             O  o   o                                  oOooO                 o               
| o     `O       `O O   o  O O   o  O             O   o  O .oOo. 'o     O .oOo              O       O  'OoOo. .oOoO  .oOo. `OoOo. 
| O      o        o o    O O o    O O             o    O O OooO'  O  o  o `Ooo.             o       o   o   O o   O  OooO'  o     
| o     .O O.    .O o     Oo o     Oo             o     Oo O      o  O  O     O             o       O   O   o O   o  O      O     
| `OooOO'   `oooO'  O     `o O     `o             O     `o `OoO'  `Oo'oO' `OoO'             O'      o'  o   O `OoO'o `OoO'  o 
-BackStage Neopets Networks News Finder
___________________________________________
Copyright (c) <2007> <backstageneopets.com and Nathan Schloss>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
**********************************************************************/

/*********************************************
-Settings that need to be changed-
*********************************************/

// news finder settings
$pw="NewsFinderPW"; //system pw (this can be what ever you want)


/*********************************************
-THERE IS NO NEED TO EDIT BELOW HERE-
*********************************************/

//error reporting will be off
error_reporting(0);

//stat to show the page
?>
<!-- Created: 06/08/07 13:48:34 by BSNN newsfinder -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional/EN">
<html>
  <head>
    <title>GO AWAY!!!!</title>
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
    <meta name="generator" content="BSNN newsfinder">
  </head>
  <body>

<?php

//look for news
$area =$_GET['working'];
if ($area == "y")
{
// get post data
$post_pw = $_POST['pw'];
// good now lets make sure that the pw is good.....
  if ($post_pw != $pw)
  { die ('BAD PASSWORD:<br><form action="look.php?working=y" method="post"><input type="password" name="pw"><br><input type="Submit" value="Go, Go, Go!!"></form>'); }
  else
  {
  //start to look
echo ("starting to look......<br><b>Captions:</b><br>");
$newspost=" ";
// looking functions
$nwf=0;
//images
function look_image($istop,$name,$imgurl,$ext,$number,$fname,$nwe,$nwt)
{

$url=$imgurl.$number.".".$ext;
if( !fopen($url, "r") )
    {
      if ($istop==1)
       {$nwf=0;}
      echo ($name." searching ended on number:".$number."<br>");
    }
    else {
    if ($istop==1)
     { echo ("<b>New ".$name."(s) found!</b>");
     $post="\n\n[b]New ".$name."(s):[/b] \n";
      }
    echo("<br><img src='".$url."'><br>");
    if ($nwe!=$nwt)
    { $post=$post."[img]".$url."[/img]"; }
    else
    { $post=$post."[img]".$url."[/img] \n";
    $nwt=0; }
    //write
   $file = "data/".$fname.".txt";
    $fh = fopen($file, 'w');
    fwrite($fh, $number);
    fclose($fh);
     //some math
    $number++;
    $nwt++;
    //keep looking
    $nwf=$post.look_image(0,$name,$imgurl,$ext,$number,$fname,$nwe,$nwt);
    }
 return $nwf;
}
//premium collectable card
function look_pcc($istop,$month,$day,$nwe,$nwt)
{
   if ($day < 13)
    {  }
    else
    { $day=1;
      $month++;  }
if (($month < 10) && ($day < 10)){
$url="http://images.neopets.com/games/tradingcards/premium/0".$month."0".$day.".gif"; }
elseif ($day < 10){
$url="http://images.neopets.com/games/tradingcards/premium/".$month."0".$day.".gif"; }
elseif ($month < 10) {
$url="http://images.neopets.com/games/tradingcards/premium/0".$month.$day.".gif"; }
else {
$url="http://images.neopets.com/games/tradingcards/premium/".$month.$day.".gif"; }
if( !fopen($url, "r") )
    {
     if ($istop)
     {$nwf=0;}
      echo ("PCC searching ended on number:".$month.$day."<br>");
    }
    else {
    if ($istop==1)
     {
    $post="\n\n[b]New Premium Collectable Card(s):[/b]\n";
    echo ("<b>New Premium Collectable Card(s) found!</b>"); }
    echo("<br><img src='".$url."'><br>");
    if ($nwe!=$nwt)
    { $post=$post."[img]".$url."[/img]"; }
    else
    { $post=$post."[img]".$url."[/img] \n";
    $nwt=0; }
    //write day
   $file = "data/pcc_d.txt";
    $fh = fopen($file, 'w');
    fwrite($fh, $day);
    fclose($fh);
     //write month
   $file = "data/pcc_m.txt";
    $fh = fopen($file, 'w');
    fwrite($fh, $month);
    fclose($fh);
     //some math
   $day++;
   $nwt++;
    //keep looking
    $nwf=$post.look_pcc(0,$month,$day,$nwe,$nwt);
    }
 return $nwf;
}
//greetings
function look_greet($istop,$number,$nwe,$nwt)
{
$url="http://images.neopets.com/new_greetings/tm_".$number.".gif";
if( !fopen($url, "r") )
    {
      if ($istop)
      { $nwf=0; }
      echo ("greeting searching ended on number:".$number."<br>");
    }
    else {
    if ($istop==1)
     {
     $post="\n\n[b]New Greeting(s):[/b]\n";
     echo ("<b>New Greeting(s) found!</b>"); }
    echo("<br><a href='http://images.neopets.com/new_greetings/".$number.".swf' target=_blank><img src='".$url."'></a><br>");
     if ($nwe!=$nwt)
    { $post=$post."[url=http://images.neopets.com/new_greetings/".$number.".swf][img]".$url."[/img][/url]"; }
    else
    { $post=$post."[url=http://images.neopets.com/new_greetings/".$number.".swf][img]".$url."[/img][/url]\n";
    $nwt=0; }
    //write
   $file = "data/greet.txt";
    $fh = fopen($file, 'w');
    fwrite($fh, $number);
    fclose($fh);
     //some math
    $number++;
    $nwt++;
    //keep looking
    $nwf=$post.look_greet(0,$number,$nwe,$nwt);
    }
 return $nwf;
}

//start to look
// caption
$fun=0;
$capfile = "data/cap.txt";
$fh = fopen($capfile, 'r');
$lastnum = fread($fh, filesize($capfile));
fclose($fh);
$lastnum++;
$name="Caption";
$imgurl="http://images.neopets.com/caption/caption_";
$ext="gif";
$fname="cap";
$nwe=1;
$nwt=1;
//run the function
$fun=look_image(1,$name,$imgurl,$ext,$lastnum,$fname,$nwe,$nwt);
if ($fun!="0")
{ $nwf=1;
$post=$post.$fun;
}


    
//BTY search
$fun=0;
echo ("<br><br><br><br><b>BTY:</b><br>");
$btyfile = "data/bty.txt";
$fh = fopen($btyfile, 'r');
$lastnum = fread($fh, filesize($btyfile));
fclose($fh);
$lastnum++;
$name="Better Than You";
$imgurl="http://images.neopets.com/games/betterthanyou/contestant";
$ext="gif";
$fname="bty";
$nwe=3;
$nwt=1;
//run the function
$fun=look_image(1,$name,$imgurl,$ext,$lastnum,$fname,$nwe,$nwt);
if ($fun!="0")
{ $nwf=1;
$post=$post.$fun;
}

//shopkeepers
$fun=0;
echo ("<br><br><br><br><b>ShopKeeper:</b><br>");
$file = "data/shop.txt";
$fh = fopen($file, 'r');
$lastnum = fread($fh, filesize($file));
fclose($fh);
$lastnum++;
$name="Shopkeeper";
$imgurl="http://images.neopets.com/new_shopkeepers/";
$ext="gif";
$fname="shop";
$nwe=3;
$nwt=1;
//run the function
$fun=look_image(1,$name,$imgurl,$ext,$lastnum,$fname,$nwe,$nwt);
if ($fun!="0")
{ $nwf=1;
$post=$post.$fun;
}

//1pbd
$fun=0;
echo ("<br><br><br><br><b>1 player battledome:</b><br>");
$file = "data/1pbd.txt";
$fh = fopen($file, 'r');
$lastnum = fread($fh, filesize($file));
fclose($fh);
$lastnum++;
$name="1 player battledome";
$imgurl="http://images.neopets.com/battledome/opponent_pics/";
$ext="gif";
$fname="1pbd";
$nwe=3;
$nwt=1;
//run the function
$fun=look_image(1,$name,$imgurl,$ext,$lastnum,$fname,$nwe,$nwt);
if ($fun!="0")
{ $nwf=1;
$post=$post.$fun;
}

//petpetpet
$fun=0;
echo ("<br><br><br><br><b>petpetpet:</b><br>");
$file = "data/ppp.txt";
$fh = fopen($file, 'r');
$lastnum = fread($fh, filesize($file));
fclose($fh);
$lastnum++;
$name="petpetpet";
$imgurl="http://images.neopets.com/items/petpetpet_";
$ext="gif";
$fname="ppp";
$nwe=3;
$nwt=1;
//run the function
$fun=look_image(1,$name,$imgurl,$ext,$lastnum,$fname,$nwe,$nwt);
if ($fun!="0")
{ $nwf=1;
$post=$post.$fun;
}

//greetings
$fun=0;
echo ("<br><br><br><br><b>greetings:</b><br>");
$file = "data/greet.txt";
$fh = fopen($file, 'r');
$lastnum = fread($fh, filesize($file));
fclose($fh);
$lastnum++;
$nwe=4;
$nwt=1;
//run the function
$fun=look_greet(1,$lastnum,$nwe,$nwt);
if ($fun!="0")
{ $nwf=1;
$post=$post.$fun;
}

//seek
$fun=0;
echo ("<br><br><br><br><b>kacheek seek:</b><br>");
$file = "data/ks.txt";
$fh = fopen($file, 'r');
$lastnum = fread($fh, filesize($file));
fclose($fh);
$lastnum++;
$name="kacheek seek";
$imgurl="http://images.neopets.com/games/hideandseek/";
$ext="gif";
$fname="ks";
$nwe=1;
$nwt=1;
//run the function
$fun=look_image(1,$name,$imgurl,$ext,$lastnum,$fname,$nwe,$nwt);
if ($fun!="0")
{ $nwf=1;
$post=$post.$fun;
}

//premium collectable card
$fun=0;
echo ("<br><br><br><br><b>premium collectable card:</b><br>");
$file = "data/pcc_d.txt";
$fh = fopen($file, 'r');
$lastday = fread($fh, filesize($file));
fclose($fh);
$file = "data/pcc_m.txt";
$fh = fopen($file, 'r');
$lastmon = fread($fh, filesize($file));
fclose($fh);
$lastday++;
$nwe=2;
$nwd=1;
//run the function
$fun=look_pcc(1,$lastmon,$lastday,$nwe,$nwd);
if ($fun!="0")
{ $nwf=1;
$post=$post.$fun;
}

if ($nwf==1)
{
$post=$post."\n\n\n[url=http://backstageneopets.com]Found by the BSNN news finder.[/url]";
$today = date("m.d.y");
echo("<br><br><b>Warning: there was news found..... a post was genrated!!! <br>
</b><br><textarea COLS=40 ROWS=6>Title:News for $today \n\n\n\n $post</textarea>");
$dateline=time();
// WOW that was fast!

/*********************************************
-User, if you want you can have custom code here-
-It will run if there was news found-
|$today=todays date-
|$post=the post in bbc _formatted for mybb_-
*********************************************/
//custom code here
/*********************************************
-END CUSTOM USER BIT-
*********************************************/
//all done!
// tell the user the bad news
echo("<br><b><font color=green>All number files have been updated, if there was an error then you will need to fix it by hand!</font></b>");

}

  }
}
//not logged in? do it now!!!!!!
else {
  echo ('Please...you need to login:<br><form action="look.php?working=y" method="post"><input type="password" name="pw"><br><input type="Submit" value="Go, Go, Go!!"></form>');
}
?>

  </body>
</html>
Return current item: Backstage Neopets Networks Neopets News Finder