<?
$page = "admin_url.php";
include "admin_header.php";
if(isset($_POST['task'])) { $task = $_POST['task']; } elseif(isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; }




$server_array = explode("/", $_SERVER['PHP_SELF']);
$server_array_mod = array_pop($server_array);
$server_array_mod = array_pop($server_array);
$server_info = implode("/", $server_array);



$content1 = "RewriteEngine On
Options +Followsymlinks
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.* - [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*/images/(.*)$ /$server_info/images/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*/uploads/(.*)$ /$server_info/uploads/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/friends/page([0-9]+)/([^/]+)/?$ /$server_info/friends.php?w=$1&page=$2$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/friends/page([0-9]+)/?$ /$server_info/friends.php?w=$1&page=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/friends/([^/]+)/?$ /$server_info/friends.php?w=$1$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/friends/?$ /$server_info/friends.php?w=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/page([0-9]+)/([^/]+)/?$ /$server_info/index.php?w=$1&page=$2$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/page([0-9]+)/?$ /$server_info/index.php?w=$1&page=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^profiles/([^/]+)/([^/]+)/?$ /$server_info/profile.php?u=$1$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^profiles/([^/]+)/?$ /$server_info/profile.php?u=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^profiles/?$ /$server_info/profile.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^albums/([^/]+)/([^/]+)/?$ /$server_info/album.php?u=$1$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^albums/([^/]+)/?$ /$server_info/album.php?u=$1$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^albums/?$ /$server_info/album.php?u= [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/archive/([^/]+)/([^/]+)/([^/]+)/?$ /$server_info/archive.php?w=$1&y=$2&m=$3$4 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/archive/([^/]+)?/([^/]+)/?$ /$server_info/archive.php?w=$1&y=$2&m=$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/archive/([^/]+)/?$ /$server_info/archive.php?w=$1$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/archive/?$ /$server_info/archive.php?w=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([0-9]+)/([^/]+).html$ /$server_info/entry.php?w=$1&e_id=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([0-9]+)/([^/]+)/?$ /$server_info/entry.php?w=$1&e_id=$2$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([0-9]+)/?$ /$server_info/entry.php?w=$1&e_id=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/page([0-9]+)/([^/]+)/?$ /$server_info/index.php?w=$1&category=$2&page=$3$4 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/page([0-9]+)/?$ /$server_info/index.php?w=$1&category=$2&page=$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ /$server_info/index.php?w=$1&category=$2$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/?$ /$server_info/index.php?w=$1&category=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ /$server_info/index.php?w=$1 [L]";

$content1 = str_replace("//", "/", $content1);




$domain = $_SERVER['HTTP_HOST'];
$domain = str_replace(".", "\.", str_replace("www.", "", $domain));



$content2 = "RewriteEngine On
Options +Followsymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{REQUEST_FILENAME} !^.*/images/.*$
RewriteCond %{REQUEST_FILENAME} !^.*/uploads/.*$
RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^([^.]+)\.$domain(:80)?<>/([^/]*) [NC]
RewriteCond %1<>%3 !^(.*)<>\\1$ [NC]
RewriteRule   ^(.*)$ - [E=BLOGUSER:%1]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^$ /index.php?w=%1 [L]
RewriteRule ^page([0-9]+)/([^/]+)?$ /$server_info/index.php?w=%1&page=$1$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^profiles/([^/]+)/([^/]+)?$ /$server_info/profile.php?u=$1$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^profiles/?$ /$server_info/profile.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^albums/([^/]+)/([^/]+)?$ /$server_info/album.php?u=$1$2 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^archive/(.*)/(.*)/([^/]+)?$ /$server_info/archive.php?w=%1&y=$1&m=$2$3 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^archive/(.*)/([^/]+)?$ /$server_info/archive.php?w=%1$1 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^archive/([^/]+)?$ /$server_info/archive.php?w=%1$1 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^friends/([^/]+)?$ /$server_info/friends.php?w=%1$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/friends/page([0-9]+)/([^/]+)?$ /$server_info/friends.php?w=$1&page=$2$3 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^([0-9]+)/([^/]+)?$ /$server_info/entry.php?w=%1&e_id=$1$2 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ([^/]+)^$ /$server_info/index.php?w=%1$1 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^([^/]+)/([^/]+)?$ /$server_info/index.php?w=%1&category=$1$2 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^([^/]+)/page([0-9]+)/([^/]+)?$ /$server_info/index.php?w=%1&category=$1&page=$2$3 [L]";

$content2 = str_replace("//", "/", $content2);







if($task == "phpinfo") {
phpinfo();
exit();
}














if($task == "dosave") {
$url = $_POST['url'];

// UPDATE URL SETTING
mysql_query("UPDATE bhost_admin SET url='$url'");

$task = "help";
}
















if($task == "help") {

if(!isset($url)) { $url = $admin_info[url]; }

echo $head;
echo $admin_url15;

switch($url) {
case 0;
echo $admin_url11;
break;
case 1;
echo $admin_url12;
echo "
<br><br>
<textarea wrap='off' rows='25' cols='60' name='html_header' style='font-family: \"Courier New\", verdana, arial; width: 100%;'>
$content1
</textarea>
";
break;
case 2;
echo $admin_url13;
echo "
<br><br>
<textarea wrap='off' rows='25' cols='60' name='html_header' style='font-family: \"Courier New\", verdana, arial; width: 100%;'>
$content2
</textarea>
";
break;
}

echo "
<br>
<form action='admin_url.php' method='POST'>
<input type='submit' class='button' value='$admin_url14'>
</form>
";

echo $foot;

exit();
}




















if($task == "main") {

switch($admin_info[url]) {
case 0:
$help1 = $admin_url9;
break;
case 1:
$help2 = $admin_url9;
break;
case 2:
$help3 = $admin_url9;
break;
}

echo $head;
echo "
<h2>$admin_url1</h2>

$admin_url2

<br><br>
<table cellpadding='0' cellspacing='0' width='100%'>
<form action='admin_url.php' name='info' method='POST'>
<tr><td class='header'>$admin_url3</td></tr>
<tr>
<td class='box'>
<table cellpadding='0' cellspacing='0'>
<tr>
<td>
 <table cellpadding='0' cellspacing='0'>
 <tr><td><input type='radio' name='url' id='url0' value='0'"; if($admin_info[url] == "0") { echo " CHECKED"; } echo "></td><td NOWRAP><label for='url0'>$admin_url4</label> $help1 &nbsp;</td></tr>
 <tr><td><input type='radio' name='url' id='url1' value='1'"; if($admin_info[url] == "1") { echo " CHECKED"; } echo "></td><td NOWRAP><label for='url1'>$admin_url5</label> $help2 &nbsp;</td></tr>
 <tr><td><input type='radio' name='url' id='url2' value='2'"; if($admin_info[url] == "2") { echo " CHECKED"; } echo "></td><td NOWRAP><label for='url2'>$admin_url7</label> $help3 &nbsp;</td></tr>
 </table>
</td>
</tr>
</table>
</td>
</tr>
<input type='hidden' name='task' value='dosave'>
</table>
<br>
<input type='submit' class='button' value='$admin_url6'>
</form>

";




echo $foot;
exit();
}


?>