New!'; $malecut = array(11,11,11,11,11,999); //how many to show on each page $femalecut = array(37,37,37,37,37,999); $groupcut = array(3,3,3,3,3,999); //----- ADD NEW CELEBS AT TOP ------------------- include('celebarrays.inc'); //checks if new celebs have been added (checks first of each group) $allcelebs = array(); //store names of all celebs $tarr = array_keys($male); $newcelebs = $tarr[0]; $allcelebs = array_merge($allcelebs,$tarr); $tarr = array_keys($female); $newcelebs .= $tarr[0]; $allcelebs = array_merge($allcelebs,$tarr); $tarr = array_keys($group); $newcelebs .= $tarr[0]; $allcelebs = array_merge($allcelebs,$tarr); $newcelebs = sprintf('%08X',crc32($newcelebs)); if(!file_exists('newcelebscrc32') || file_get_contents('newcelebscrc32')!=$newcelebs ){ //new celebs have been added, so refresh pages, gen newpages.inc //stores new crc32 $npwrite = fopen('newcelebscrc32','w'); fwrite($npwrite,$newcelebs); fclose($npwrite); $malekeys = array_keys($male); $femalekeys = array_keys($female); $groupkeys = array_keys($group); $newpages = ''; $newpagesinc = 'New pages | '; //LOOP for($cutcount=1;$cutcount<=count($malecut)+1;$cutcount++){ if($cutcount==count($malecut)+1) //for search results page $fileptr = fopen('Search-Results.html','w'); else if($cutcount==1) $fileptr = fopen('page1.inc','w'); else $fileptr = fopen('Celebrities-Page-'.$cutcount.'.html','w'); //------------------- inner block ------------------ if($cutcount0;$i++){ $k = array_shift($malekeys); $v = array_shift($male); //foreach($male as $k=>$v){ $hy = str_replace('\'','',$k); $hy = str_replace('!','',$hy); $hy = str_replace(' ','-',$hy); $t = ''.$k.''; if($c<2){ $t .= $new; $newpages .= ''.$k.'
'.$k.' thumbnails


'; $newpagesinc .=''.$k.' | '; $c++; } $t .= '
   - '.$v.'
'; $male2 = array_merge($male2, array($k=>$t)); } ksort($male2); if($cutcount==1) $c = 0; else $c = 99; //no need to process new pages $female2 = array(); for($i=1;$i<=$femalecut[$cutcount-1]&&count($female)>0;$i++){ $k = array_shift($femalekeys); $v = array_shift($female); //foreach($female as $k=>$v){ $hy = str_replace('\'','',$k); $hy = str_replace('!','',$hy); $hy = str_replace(' ','-',$hy); $t = ''.$k.''; if($c<3){ $t .= $new; $newpages .= ''.$k.'
'.$k.' thumbnails


'; $newpagesinc .=''.$k.' | '; $c++; } $t .= '
   - '.$v.'
'; $female2 = array_merge($female2, array($k=>$t)); } ksort($female2); if($cutcount==1) $c = 0; else $c = 99; //no need to process "new" $group2 = array(); for($i=1;$i<=$groupcut[$cutcount-1]&&count($group)>0;$i++){ $k = array_shift($groupkeys); $v = array_shift($group); //foreach($group as $k=>$v){ $hy = str_replace('\'','',$k); $hy = str_replace('!','',$hy); $hy = str_replace(' ','-',$hy); $t = ''.$k.''; if($c<1){ $t .= $new; $newpages .= ''.$k.'
'.$k.' thumbnails


'; $newpagesinc .=''.$k.' | '; $c++; } $t .= '
   - '.$v.'
'; $group2 = array_merge($group2, array($k=>$t)); } ksort($group2); //stores new pages in newpages.inc, only need to gen once if($cutcount==1){ $npwrite = fopen('newpages.inc','w'); fwrite($npwrite,$newpagesinc); fwrite($npwrite,''); fclose($npwrite); } } //if($cutcount Celebrity Treat'.(($cutcount==count($malecut)+1)?" | Search Results":(($cutcount==1)?"":" | Page ".$cutcount)).'
'); //handle searches ----------------------------------------------------------------------------- if($cutcount0){'); fwrite($fileptr,'$q=$_SERVER["HTTP_REFERER"]; $p=strpos($q,"?"); $q=urldecode(strtolower(substr($q,$p)));'); fwrite($fileptr,' $q=str_replace("\\\\","",str_replace("!","",str_replace("\'","",$q))); $q=str_replace("-"," ",str_replace("."," ",str_replace("+"," ",$q)));'); fwrite($fileptr,' ?> '.\$k.'
\"'.\$k.'';"); fwrite($fileptr,'?>

- Recommended Celebrity



'); } fwrite($fileptr,'

All Your Favorite Celebrities - News, Pictures and More!

Welcome to www.CelebTreat.com. This is the place where you can get all the latest news and pictures of your favorite celebrities. Enjoy!!


'.(($cutcount
')); if($cutcountPage '.$i.' '; } } fwrite($fileptr,$pglist.'

'); fwrite($fileptr,'
Male Celebrities Female Celebrities Boy Bands, Girl Bands, Groups, Movies, Sports Teams
'); foreach($male2 as $k=>$v){ fwrite($fileptr,"$v\r\n"); } fwrite($fileptr,' '); foreach($female2 as $k=>$v){ fwrite($fileptr,"$v\r\n"); } fwrite($fileptr,' '); foreach($group2 as $k=>$v){ fwrite($fileptr,"$v\r\n"); } fwrite($fileptr,'
'); //pages fwrite($fileptr,'
'.$pglist.'
'); } //if($cutcount
Back to Celebrity Treat.
'); //------------------- end inner block ------------------ fclose($fileptr); }//for }//if include('page1.inc'); ?>