mash99
New Member
- Messages
- 10
- Reaction score
- 0
- Points
- 0
Warning: array_unshift() [function.array-unshift]: The first argument should be an array in /home/mash99/public_html/thebestoptions.co.cc/book-store/finstall.php on line 383
Warning: array_unshift() [function.array-unshift]: The first argument should be an array in /home/mash99/public_html/thebestoptions.co.cc/book-store/finstall.php on line 384
// get old's spec:
$stopat=$_SERVER['DOCUMENT_ROOT']; // e.g. /usr/www
$running=$mypath; // to start with, e.g. /usr/www/users/ewalker/seo-toys/bookadder
while ($running!==$stopat)
{
$lastslash=strrpos($running,$slash);
if ($lastslash==NULL) break; // emergency fail-safe...
$running=substr($running,0,$lastslash); // e.g. /usr/www/users/ewalker/seo-toys
$target=$running.'/robots.txt';
if (is_file($target)!==FALSE) break;
}
$oldrobots=bringme($running.'/robots.txt'); // may fail if no file found--that's ok
// process:
$robots=NULL;
if ($oldrobots!=NULL)
{
$target=$localslash.$localurl; // such as: /red-cats-books/
foreach($oldrobots as $line)
{if (strpos($line,$target)===FALSE && strpos($line,$localslash.'freebie'.$localslash)===FALSE) $robots[]=$line;} // don't take old package lines
$top=count($robots);
$top=$top-1; // convert to 0-based offset
if (trim($oldrobots[$top])!=NULL) $robots[]=$crlf; // tag on blank separator line (if extant file)
}
// Add local stuff:
array_unshift($robots,$crlf); // prepend a blank separator line...
array_unshift($robots,'Sitemap: '.$freeburl.'Bookshop_index.xml'.$crlf); // ...then prepend the sitemap directive
$robots[]='User-agent: *'.$crlf;
$robots[]='Disallow: '.$localslash.$localurl.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'allbooks/allbooks.'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.$myshop.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'abechange.php'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'abes.php'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'book-search.php'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'free.php'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'holder.php'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'search.php'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'used-books.php'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'Bookshop_index.xml'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.$freebdirname.'-sitemap'.$crlf;
Warning: array_unshift() [function.array-unshift]: The first argument should be an array in /home/mash99/public_html/thebestoptions.co.cc/book-store/finstall.php on line 384
// get old's spec:
$stopat=$_SERVER['DOCUMENT_ROOT']; // e.g. /usr/www
$running=$mypath; // to start with, e.g. /usr/www/users/ewalker/seo-toys/bookadder
while ($running!==$stopat)
{
$lastslash=strrpos($running,$slash);
if ($lastslash==NULL) break; // emergency fail-safe...
$running=substr($running,0,$lastslash); // e.g. /usr/www/users/ewalker/seo-toys
$target=$running.'/robots.txt';
if (is_file($target)!==FALSE) break;
}
$oldrobots=bringme($running.'/robots.txt'); // may fail if no file found--that's ok
// process:
$robots=NULL;
if ($oldrobots!=NULL)
{
$target=$localslash.$localurl; // such as: /red-cats-books/
foreach($oldrobots as $line)
{if (strpos($line,$target)===FALSE && strpos($line,$localslash.'freebie'.$localslash)===FALSE) $robots[]=$line;} // don't take old package lines
$top=count($robots);
$top=$top-1; // convert to 0-based offset
if (trim($oldrobots[$top])!=NULL) $robots[]=$crlf; // tag on blank separator line (if extant file)
}
// Add local stuff:
array_unshift($robots,$crlf); // prepend a blank separator line...
array_unshift($robots,'Sitemap: '.$freeburl.'Bookshop_index.xml'.$crlf); // ...then prepend the sitemap directive
$robots[]='User-agent: *'.$crlf;
$robots[]='Disallow: '.$localslash.$localurl.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'allbooks/allbooks.'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.$myshop.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'abechange.php'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'abes.php'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'book-search.php'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'free.php'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'holder.php'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'search.php'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'used-books.php'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.'Bookshop_index.xml'.$crlf;
$robots[]='Allow: '.$localslash.$localurl.$freebdirname.'-sitemap'.$crlf;
Last edited: