if (eregi("header.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}

ob_start();

function replace_for_mod_rewrite(&$s) {
$urlin = array(
"'(?<!/)modules.php\?name=News&amp;file=article&amp;sid=([0-9]*)&amp;mode=([a-z]*)&amp;order=([0-9]*)&amp;thold=([0-9]*)'",
"'(?<!/)modules.php\?name=News&amp;file=article&amp;sid=([0-9]*)'",
"'(?<!/)modules.php\?name=News&file=article&sid=([0-9]*)'",
"'(?<!/)modules.php\?name=News&amp;new_topic=([0-9]*)'",
"'(?<!/)modules.php\?name=Stories_Archive&sa=show_month&year=([0-9]*)&month=([0-9]*)&month_l=([a-zA-Z]*)'",
"'(?<!/)modules.php\?name=Stories_Archive'",
"'(?<!/)modules.php\?name=Downloads&d_op=getit&amp;lid=([0-9]*)'",
"'(?<!/)modules.php\?name=Downloads&d_op=viewdownload&amp;cid=([0-9]*)&amp;min=([0-9]*)&amp;orderby=titleA&amp;show=([0-9]*)'",
"'(?<!/)modules.php\?name=Downloads&d_op=viewdownload&amp;cid=([0-9]*)'",
"'(?<!/)modules.php\?name=Downloads&d_op=viewdownloaddetails&amp;lid=([0-9]*)&amp;ttitle=([/:\-\'(){}.&=a-zA-Z0-9_ ]*)'",
"'(?<!/)modules.php\?name=(Downloads\")'",
"'(?<!/)modules.php\?name=Reviews&rop=showcontent&amp;id=([0-9]*)'",
"'(?<!/)modules.php\?name=Reviews&rop=write_review'",
"'(?<!/)modules.php\?name=Reviews&rop=postcomment&amp;id=([0-9]*)&amp;title=([a-zA-Z0-9+]*)'",
"'(?<!/)modules.php\?name=Reviews&rop=mod_review&amp;id=([0-9]*)'",
"'(?<!/)modules.php\?name=Reviews&rop=del_review&amp;id_del=([0-9]*)'",
"'(?<!/)modules.php\?name=Reviews&rop=([a-zA-Z0-9]*)'",
"'(?<!/)modules.php\?name=Reviews'",
"'(?<!/)modules.php\?name=Submit_News'",
"'(?<!/)modules.php\?name=Topics'",
"'(?<!/)modules.php\?name=Top&zx=([a-zA-Z0-9+]*)'",
"'(?<!/)modules.php\?name=Top'",
"'(?<!/)modules.php\?name=FAQ'",
"'(?<!/)modules.php\?name=FAQ&amp;myfaq=yes&amp;id_cat=([0-9]*)&amp;categories=([a-zA-Z0-9+]*)'",
"'(?<!/)modules.php\?name=Forums&file=viewtopic&t=([0-9]+)&amp;postdays=([0-9]+)&amp;postorder=asc&amp;start=([0-9]+)'",
"'(?<!/)modules.php\?name=Forums&file=viewforum&f=([0-9]+)&amp;topicdays=([0-9]+)&amp;start=([0-9]+)'",
"'(?<!/)modules.php\?name=Content&amp;pa=showpage&amp;pid=([0-9]*)'",
"'(?<!/)modules.php\?name=Content&amp;pa=list_pages_categories&amp;cid=([0-9]*)'",
"'(?<!/)modules.php\?name=Forums&file=viewforum&f=([0-9]*)&amp;mark=topics'",
"'(?<!/)modules.php\?name=Forums&file=viewforum&f=([0-9]*)'",
"'(?<!/)modules.php\?name=Forums&file=viewtopic&t=([0-9]*)&amp;view=newest'",
"'(?<!/)modules.php\?name=Forums&file=viewtopic&t=([0-9]*)&amp;start=([0-9]*)'",
"'(?<!/)modules.php\?name=Forums&file=viewtopic&t=([0-9]*)&amp;highlight=([/:\-\'(){}.&=_a-zA-Z0-9 ]*)'",
"'(?<!/)modules.php\?name=Forums&file=viewtopic&(p|t)=([0-9]*)'",
"'(?<!/)modules.php\?name=Forums&file=posting&t=([0-9]*)'",
"'(?<!/)modules.php\?name=Forums&file=index&c=([0-9]*)'",
"'(?<!/)modules.php\?name=Forums&file=index'",
"'(?<!/)modules.php\?name=Sections&op=(printpage|viewarticle)&artid=([0-9]*)'",
"'(?<!/)modules.php\?name=Sections&op=listarticles&secid=([0-9]*)'",
"'(?<!/)modules.php\?name=Sections'",
#"'(?<!/)modules.php\?name=Your_Account&op=userinfo&uname=([a-zA-Z0-9_-]*)'",
#"'(?<!/)modules.php\?name=Your_Account&amp;op=userinfo&amp;uname=([a-zA-Z0-9_-]*)'",
"'(?<!/)modules.php\?name=Your_Account&op=userinfo&username=([a-zA-Z0-9_-]*)'",
"'(?<!/)modules.php\?name=Your_Account&amp;op=userinfo&amp;username=([a-zA-Z0-9_-]*)'",
#"'(?<!/)modules.php\?op=modload&name=Web_Links&file=index&l_op=NewLinksDate&amp;selectdate=([0-9]+)'",
#"'(?<!/)modules.php\?op=modload&name=Web_Links&file=index&l_op=(AddLink|MostPopular|NewLinks|RandomLink|TopRated)'",
#"'(?<!/)modules.php\?op=modload&name=Web_Links&file=index&l_op=ratelink&amp;lid=([0-9]*)&amp;ttitle=([/:\-\'(){}.&=_a-zA-Z0-9 ]*)'",
#"'(?<!/)modules.php\?op=modload&name=Web_Links&file=index&l_op=visit&amp;lid=([0-9]*)'",
#"'(?<!/)modules.php\?op=modload&name=Web_Links&file=index&l_op=viewlink&amp;cid=([0-9]*)&amp;min=([0-9]*)&amp;orderby=titleA&amp;show=([0-9]*)'",
#"'(?<!/)modules.php\?op=modload&name=Web_Links&file=index&l_op=viewlink&amp;cid=([0-9]*)'",
"'(?<!/)modules.php\?name=Web_Links&l_op=NewLinksDate&amp;selectdate=([0-9]+)'",
"'(?<!/)modules.php\?name=Web_Links&l_op=(AddLink|MostPopular|NewLinks|RandomLink|TopRated)'",
"'(?<!/)modules.php\?name=Web_Links&l_op=ratelink&amp;lid=([0-9]*)&amp;ttitle=([/:\-\'(){}.&=_a-zA-Z0-9 ]*)'",
"'(?<!/)modules.php\?name=Web_Links&l_op=visit&amp;lid=([0-9]*)'",
"'(?<!/)modules.php\?name=Web_Links&l_op=viewlink&amp;cid=([0-9]*)&amp;min=([0-9]*)&amp;orderby=titleA&amp;show=([0-9]*)'",
"'(?<!/)modules.php\?name=Web_Links&l_op=viewlink&amp;cid=([0-9]*)'",
"'(?<!/)modules.php\?name=Web_Links'"
);

$urlout = array(
"article-\\1-\\2-\\3-\\4.html",
"article\\1.html",
"article\\1.html",
"article-topic-\\1.html",
"archive-\\1-\\2-\\3.html",
"archive.html",
"downloads-file-\\1.html",
"downloads-cats-\\1-\\2-\\3.html",
"downloads-cat-\\1.html",
"downloads-file-\\1-details-\\2.html",
"downloads.html\"",
"reviews-\\1.html",
"reviews-new.html",
"reviews-comment-\\1-\\2",
"reviews-\\1-edit.html",
"reviews-\\1-delete.html",
"reviews-sortby-\\1.html",
"reviews.html",
"submit.html",
"topics.html",
"top-\\1.html",
"top.html",
"faq.html",
"faq-\\1-\\2.html",
"postx\\1-\\2-\\3.html",
"forumx\\1-\\2-\\3.html",
"contentid-\\1.html",
"content-cat-\\1.html",
"markread\\1.html",
"forum\\1.html",
"newposts\\1.html",
"posts\\1-\\2.html",
"postlite\\1-\\2.html",
"post\\1\\2.html",
"fvote\\1.html",
"forum-cat\\1.html",
"forums.html",
"section-\\1-\\2.html",
"section-\\1.html",
"sections.html",
"userinfo-\\1.html",
"userinfo-\\1.html",
"linksnew-\\1.html",
"linkop-\\1.html",
"ratelink-\\1-\\2.html",
"viewlink-\\1.html",
"links-\\1-\\2-\\3.html",
"link-\\1.html",
"links.html"
);

$s = preg_replace($urlin, $urlout, $s);
return $s;
}


