<?
$page = "admin_profile.php";
include "admin_header.php";

if(isset($_POST['task'])) { $task = $_POST['task']; } elseif(isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; }




if($task == "dosave") {
$search_username = $_POST['search_username'];
$search_email = $_POST['search_email'];
$field_fname = $_POST['field_fname'];
$search_fname = $_POST['search_fname'];
$field_lname = $_POST['field_lname'];
$search_lname = $_POST['search_lname'];
$field_display_name = $_POST['field_display_name'];
$search_display_name = $_POST['search_display_name'];
$field_website = $_POST['field_website'];
$search_website = $_POST['search_website'];
$field_screenname = $_POST['field_screenname'];
$search_screenname = $_POST['search_screenname'];
$field_gender = $_POST['field_gender'];
$search_gender = $_POST['search_gender'];
$field_birthday = $_POST['field_birthday'];
$search_birthday = $_POST['search_birthday'];
$field_city = $_POST['field_city'];
$search_city = $_POST['search_city'];
$field_state = $_POST['field_state'];
$search_state = $_POST['search_state'];
$field_country = $_POST['field_country'];
$search_country = $_POST['search_country'];
$field_interests = $_POST['field_interests'];
$search_interests = $_POST['search_interests'];
$allow_avatars = $_POST['allow_avatars'];
$avatar_filesize = $_POST['avatar_filesize'];
$avatar_width = $_POST['avatar_width'];
$avatar_height = $_POST['avatar_height'];
$show_friendlist = $_POST['show_friendlist'];
$show_userstats = $_POST['show_userstats'];
$show_teammembers = $_POST['show_teammembers'];
$show_whosonline = $_POST['show_whosonline'];

if(!is_numeric($avatar_filesize) | !is_numeric($avatar_width) | !is_numeric($avatar_height) | (int)$avatar_filesize != $avatar_filesize | (int)$avatar_width != $avatar_width | (int)$avatar_height != $avatar_height) {
echo $head;
echo "
$admin_profile90
";
echo $foot;
exit();
}

mysql_query("UPDATE bhost_admin SET search_username='$search_username', search_email='$search_email', field_fname='$field_fname', search_fname='$search_fname', field_lname='$field_lname', search_lname='$search_lname', field_display_name='$field_display_name', search_display_name='$search_display_name', field_website='$field_website', search_website='$search_website', field_screenname='$field_screenname', search_screenname='$search_screenname', field_gender='$field_gender', search_gender='$search_gender', field_birthday='$field_birthday', search_birthday='$search_birthday', field_city='$field_city', search_city='$search_city', field_state='$field_state', search_state='$search_state', field_country='$field_country', search_country='$search_country', field_interests='$field_interests', search_interests='$search_interests', allow_avatars='$allow_avatars', avatar_filesize='$avatar_filesize', avatar_width='$avatar_width', avatar_height='$avatar_height', show_friendlist='$show_friendlist', show_userstats='$show_userstats', show_teammembers='$show_teammembers', show_whosonline='$show_whosonline'");


$custom_fields = mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database`");
 while($custom = mysql_fetch_assoc($custom_fields)) {
  if($custom[Field] != "p_id" & $custom[Field] != "u_id") {
  $var = "field_".$custom[Field];
  $required = $_POST[$var];
  $var2 = "search_".$custom[Field];
  $search = $_POST[$var2];
   $new_column = substr($custom[Field], 0, -3)."_".$required.$search;
   mysql_query("ALTER TABLE bhost_profile CHANGE $custom[Field] $new_column $custom[Type]");
  }
 }


echo $head;
echo "
<h2>$admin_profile1</h2>
$admin_profile2
<br><br>
<form action='admin_profile.php' method='POST'>
<input type='submit' class='button' value='$admin_profile3'>
<input type='hidden' name='task' value='main'>
</form>
";
echo $foot;
exit();
}







if($task == "addcustom") {
echo $head;
echo "
<h2>$admin_profile4</h2>
<form action='admin_profile.php' method='POST'>
$admin_profile5<br><br>

$admin_profile6<br>
<input type='text' name='custom_field' maxlength='50'><br><br>
$admin_profile7<br>
<select name='type'>
<option value='varchar(255)'>$admin_profile8</option>
<option value='text'>$admin_profile9</option>
</select><br><br>
$admin_profile10<br>
<select name='required' style='width: 200px;'>
<option value='3'>$admin_profile11</option>
<option value='2'>$admin_profile12</option>
<option value='1'>$admin_profile13</option>
<option value='0'>$admin_profile14</option>
</select><br><br>
$admin_profile64<br>
<select name='search' style='width: 200px;'>
<option value='2'>$admin_profile62</option>
<option value='1'>$admin_profile61</option>
<option value='0'>$admin_profile60</option>
</select><br><br>
$admin_profile80<br>
<textarea name='tip' rows='7' cols='40'></textarea><br><br>
<input class='button' type='submit' value='$admin_profile15'>
<input type='hidden' name='task' value='doadd'>
</form>
";
echo $foot;
exit();
}



if($task == "doadd") {
$custom_field = $_POST['custom_field'];
$custom_name = $custom_field;
$type = $_POST['type'];
$required = $_POST['required'];
$search = $_POST['search'];
$tip = $_POST['tip'];
$error = "";

  if(str_replace(" ", "", $custom_field) == "") {
  $error = "$admin_profile17";
  }

  if(preg_match("/[^a-z,A-Z,0-9,\s]/", $custom_field)) {
  $error = "$admin_profile18";
  }

  if(str_replace(" ", "", $type) == "") {
  $error = "$admin_profile19";
  }

  if(strtolower($custom_field) == "category" | strtolower($custom_field) == "friend" | strtolower($custom_field) == "friendsof") {
  $error = "$admin_profile63";
  }

  $custom = str_replace(" ", "_", $custom_field);
  $custom32 = $custom."_32";
  $custom31 = $custom."_31";
  $custom30 = $custom."_30";
  $custom22 = $custom."_22";
  $custom21 = $custom."_21";
  $custom20 = $custom."_20";
  $custom12 = $custom."_12";
  $custom11 = $custom."_11";
  $custom10 = $custom."_10";
  $custom02 = $custom."_02";
  $custom01 = $custom."_01";
  $custom00 = $custom."_00";

  if(mysql_num_rows(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$custom32'")) != 0 | mysql_num_rows(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$custom31'")) != 0 | mysql_num_rows(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$custom30'")) != 0 | mysql_num_rows(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$custom22'")) != 0 | mysql_num_rows(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$custom21'")) != 0 | mysql_num_rows(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$custom20'")) != 0 | mysql_num_rows(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$custom12'")) != 0 | mysql_num_rows(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$custom11'")) != 0 | mysql_num_rows(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$custom10'")) != 0 | mysql_num_rows(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$custom02'")) != 0 | mysql_num_rows(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$custom01'")) != 0 | mysql_num_rows(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$custom00'")) != 0) {
  $error = "$admin_profile20";
  }

if($error != "") {
  echo $head;
  echo "
  <h2>$admin_profile16</h2>
  $error<br><br>
  <form action='admin_profile.php?task=addcustom' method='POST'>
  <input type='submit' class='button' value='$admin_profile65'>
  </form>
  ";
  echo $foot;
  exit;
}

if(str_replace(" ", "", $tip) == "") { $tip = ""; }
$tip = str_replace("\n", "<br>", $tip);
$custom_field = str_replace(" ", "_", $custom_field);
$custom_field = $custom_field."_".$required.$search;

if($error == "") {
mysql_query("ALTER TABLE bhost_profile ADD $custom_field $type NOT NULL");
mysql_query("INSERT INTO bhost_tips (title, tip) VALUES ('$custom_name', '$tip')");
}

$tip_info = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_tips WHERE title='$custom_name' AND tip='$tip' ORDER BY tip_id DESC LIMIT 1"));
mysql_query("UPDATE bhost_profile SET $custom_field='$tip_info[tip_id]' WHERE u_id='0'");
header("Location: admin_profile.php");
exit();
}





if($task == "editcustom") {
$cf = $_GET['cf'];
$custom = mysql_fetch_assoc(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$cf'"));
if($custom[Field] == "p_id" & $custom[Field] == "u_id") { exit(); }
$custom_field = $custom[Field];
$custom_name = str_replace("_", " ", substr($custom[Field], 0, -3));
$custom_required = substr($custom[Field], -3, 2);
$custom_search = substr($custom[Field], -1);
$custom_type = $custom[Type];
$tips = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_profile WHERE u_id='0'"));
$tip_info = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_tips WHERE tip_id='$tips[$custom_field]'"));

echo $head;
echo "
<h2>$admin_profile82</h2>
<form action='admin_profile.php' method='POST'>
<br>

$admin_profile6<br>
<input type='text' name='custom_field' maxlength='50' value='$custom_name' DISABLED><br><br>
$admin_profile7<br>
<select name='type' DISABLED>
<option value='varchar(255)'"; if($custom_type == "varchar(255)") { echo " SELECTED"; } echo ">$admin_profile8</option>
<option value='text'"; if($custom_type == "text") { echo " SELECTED"; } echo ">$admin_profile9</option>
</select><br><br>
$admin_profile10<br>
<select name='required' style='width: 200px;'>
<option value='3'"; if($custom_required == "_3") { echo " SELECTED"; } echo ">$admin_profile11</option>
<option value='2'"; if($custom_required == "_2") { echo " SELECTED"; } echo ">$admin_profile12</option>
<option value='1'"; if($custom_required == "_1") { echo " SELECTED"; } echo ">$admin_profile13</option>
<option value='0'"; if($custom_required == "_0") { echo " SELECTED"; } echo ">$admin_profile14</option>
</select><br><br>
$admin_profile33<br>
<select name='search' style='width: 200px;'>
<option value='2'"; if($custom_search == "2") { echo " SELECTED"; } echo ">$admin_profile62</option>
<option value='1'"; if($custom_search == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($custom_search == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select><br><br>
$admin_profile80<br>
<textarea name='tip' rows='7' cols='40'>".str_replace("<br>", "\n", $tip_info[tip])."</textarea><br><br>
<input class='button' type='submit' value='$admin_profile83'>
<input type='hidden' name='task' value='doeditcustom'>
<input type='hidden' name='cf' value='$cf'>
</form>
";
echo $foot;
exit();
}



if($task == "doeditcustom") {
$custom = mysql_fetch_assoc(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$cf'"));
if($custom[Field] == "p_id" & $custom[Field] == "u_id") { exit(); }
$required = $_POST['required'];
$search = $_POST['search'];
$tip = $_POST['tip'];
if(str_replace(" ", "", $tip) == "") { $tip = ""; }
$tip = str_replace("\n", "<br>", $tip);
$tips = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_profile WHERE u_id='0'"));
$custom_field = $custom[Field];

if($required == "3") {
 $new_column = substr($custom[Field], 0, -3)."_3".$search;
 mysql_query("ALTER TABLE bhost_profile CHANGE $custom[Field] $new_column $custom[Type]");
 mysql_query("UPDATE bhost_tips SET tip='$tip' WHERE tip_id='$tips[$custom_field]'") or die(mysql_error());
} elseif($required == "2") {
 $new_column = substr($custom[Field], 0, -3)."_2".$search;
 mysql_query("ALTER TABLE bhost_profile CHANGE $custom[Field] $new_column $custom[Type]");
 mysql_query("UPDATE bhost_tips SET tip='$tip' WHERE tip_id='$tips[$custom_field]'") or die(mysql_error());
} elseif($required == "1") {
 $new_column = substr($custom[Field], 0, -3)."_1".$search;
 mysql_query("ALTER TABLE bhost_profile CHANGE $custom[Field] $new_column $custom[Type]");
 mysql_query("UPDATE bhost_tips SET tip='$tip' WHERE tip_id='$tips[$custom_field]'") or die(mysql_error());
} elseif($required == "0") {
 $new_column = substr($custom[Field], 0, -3)."_0".$search;
 mysql_query("ALTER TABLE bhost_profile CHANGE $custom[Field] $new_column $custom[Type]");
 mysql_query("UPDATE bhost_tips SET tip='$tip' WHERE tip_id='$tips[$custom_field]'") or die(mysql_error());
}

header("Location: admin_profile.php");
exit();
}




if($task == "delete") {
$cf = $_GET['cf'];
if($cf == "p_id" | $cf == "u_id") { exit(); }
if(mysql_num_rows(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$cf'")) == 0) { exit(); }
$custom_name = str_replace("_", " ", substr($cf, 0, -3));

echo $head;
echo "
<h2>$admin_profile21</h2>
$admin_profile22 \"<b>$custom_name</b>\"?
$admin_profile23
<br><br>
<table cellpadding='0' cellspacing='0'>
<form action='admin_profile.php' method='POST'>
<tr>
<td>
<input class='button' type='submit' value='$admin_profile24'>&nbsp;
</td>
<input type='hidden' name='task' value='dodelete'>
<input type='hidden' name='cf' value='$cf'>
</form>
<form action='admin_profile.php' method='POST'>
<td>
<input class='button' type='submit' value='$admin_profile25'>
</td>
<input type='hidden' name='task' value='main'>
</form>
</tr></table>
";
echo $foot;
exit();
}



if($task == "dodelete") {
$cf = $_POST['cf'];
if($cf == "p_id" | $cf == "u_id") { exit(); }
if(mysql_num_rows(mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database` LIKE '$cf'")) == 0) { exit(); }
$tips = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_profile WHERE u_id='0'"));
mysql_query("DELETE FROM bhost_tips WHERE tip_id='$tips[$cf]'");
mysql_query("ALTER TABLE bhost_profile DROP COLUMN $cf");
header("Location: admin_profile.php");
exit();
}







echo $head;

echo "
<h2>$admin_profile26</h2>
$admin_profile27
<br><br>

<form action='admin_profile.php' method='POST'>

<table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 3px;'>
<tr><td class='header'>$admin_profile28</td></tr>
<tr>
<td class='box'>
$admin_profile29
<br><br>

<table cellpadding='5' cellspacing='0'>
<tr>
<td>&#149; <b>$admin_profile33</b> &nbsp;</td>
<td>
<select style='width: 200px;' DISABLED>
<option>$admin_profile11</option>
</select>
&nbsp;
<select name='search_username' style='width: 200px;'>
<option value='1'"; if($admin_info[search_username] == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($admin_info[search_username] == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select>
</td>
</tr>

<tr>
<td>&#149; <b>$admin_profile34</b> &nbsp;</td>
<td NOWRAP>
<select style='width: 200px;' DISABLED>
<option>$admin_profile11</option>
</select>
&nbsp;
<select name='search_email' style='width: 200px;'>
<option value='1'"; if($admin_info[search_email] == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($admin_info[search_email] == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select>
</td>
</tr>

<tr>
<td>&#149; <b>$admin_profile30</b> &nbsp;</td>
<td NOWRAP>
<select name='field_fname' style='width: 200px;'>
<option value='3'"; if($admin_info[field_fname] == "3") { echo " SELECTED"; } echo ">$admin_profile11</option>
<option value='2'"; if($admin_info[field_fname] == "2") { echo " SELECTED"; } echo ">$admin_profile12</option>
<option value='1'"; if($admin_info[field_fname] == "1") { echo " SELECTED"; } echo ">$admin_profile13</option>
<option value='0'"; if($admin_info[field_fname] == "0") { echo " SELECTED"; } echo ">$admin_profile14</option>
</select>
&nbsp;
<select name='search_fname' style='width: 200px;'>
<option value='2'"; if($admin_info[search_fname] == "2") { echo " SELECTED"; } echo ">$admin_profile62</option>
<option value='1'"; if($admin_info[search_fname] == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($admin_info[search_fname] == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select>
</td>
</tr>

<tr>
<td>&#149; <b>$admin_profile31</b> &nbsp;</td>
<td NOWRAP>
<select name='field_lname' style='width: 200px;'>
<option value='3'"; if($admin_info[field_lname] == "3") { echo " SELECTED"; } echo ">$admin_profile11</option>
<option value='2'"; if($admin_info[field_lname] == "2") { echo " SELECTED"; } echo ">$admin_profile12</option>
<option value='1'"; if($admin_info[field_lname] == "1") { echo " SELECTED"; } echo ">$admin_profile13</option>
<option value='0'"; if($admin_info[field_lname] == "0") { echo " SELECTED"; } echo ">$admin_profile14</option>
</select>
&nbsp;
<select name='search_lname' style='width: 200px;'>
<option value='2'"; if($admin_info[search_lname] == "2") { echo " SELECTED"; } echo ">$admin_profile62</option>
<option value='1'"; if($admin_info[search_lname] == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($admin_info[search_lname] == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select>
</td>
</tr>

<tr>
<td>&#149; <b>$admin_profile32</b> &nbsp;</td>
<td NOWRAP>
<select name='field_display_name' style='width: 200px;'>
<option value='3'"; if($admin_info[field_display_name] == "3") { echo " SELECTED"; } echo ">$admin_profile11</option>
<option value='2'"; if($admin_info[field_display_name] == "2") { echo " SELECTED"; } echo ">$admin_profile12</option>
<option value='1'"; if($admin_info[field_display_name] == "1") { echo " SELECTED"; } echo ">$admin_profile13</option>
<option value='0'"; if($admin_info[field_display_name] == "0") { echo " SELECTED"; } echo ">$admin_profile14</option>
</select>
&nbsp;
<select name='search_display_name' style='width: 200px;'>
<option value='2'"; if($admin_info[search_display_name] == "2") { echo " SELECTED"; } echo ">$admin_profile62</option>
<option value='1'"; if($admin_info[search_display_name] == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($admin_info[search_display_name] == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select>
</td>
</tr>

<tr>
<td>&#149; <b>$admin_profile35</b> &nbsp;</td>
<td NOWRAP>
<select name='field_website' style='width: 200px;'>
<option value='3'"; if($admin_info[field_website] == "3") { echo " SELECTED"; } echo ">$admin_profile11</option>
<option value='2'"; if($admin_info[field_website] == "2") { echo " SELECTED"; } echo ">$admin_profile12</option>
<option value='1'"; if($admin_info[field_website] == "1") { echo " SELECTED"; } echo ">$admin_profile13</option>
<option value='0'"; if($admin_info[field_website] == "0") { echo " SELECTED"; } echo ">$admin_profile14</option>
</select>
&nbsp;
<select name='search_website' style='width: 200px;'>
<option value='1'"; if($admin_info[search_website] == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($admin_info[search_website] == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select>
</td>
</tr>

<tr>
<td>&#149; <b>$admin_profile36</b> &nbsp;</td>
<td NOWRAP>
<select name='field_screenname' style='width: 200px;'>
<option value='3'"; if($admin_info[field_screenname] == "3") { echo " SELECTED"; } echo ">$admin_profile11</option>
<option value='2'"; if($admin_info[field_screenname] == "2") { echo " SELECTED"; } echo ">$admin_profile12</option>
<option value='1'"; if($admin_info[field_screenname] == "1") { echo " SELECTED"; } echo ">$admin_profile13</option>
<option value='0'"; if($admin_info[field_screenname] == "0") { echo " SELECTED"; } echo ">$admin_profile14</option>
</select>
&nbsp;
<select name='search_screenname' style='width: 200px;'>
<option value='1'"; if($admin_info[search_screenname] == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($admin_info[search_screenname] == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select>
</td>
</tr>

<tr>
<td>&#149; <b>$admin_profile37</b> &nbsp;</td>
<td NOWRAP>
<select name='field_gender' style='width: 200px;'>
<option value='3'"; if($admin_info[field_gender] == "3") { echo " SELECTED"; } echo ">$admin_profile11</option>
<option value='2'"; if($admin_info[field_gender] == "2") { echo " SELECTED"; } echo ">$admin_profile12</option>
<option value='1'"; if($admin_info[field_gender] == "1") { echo " SELECTED"; } echo ">$admin_profile13</option>
<option value='0'"; if($admin_info[field_gender] == "0") { echo " SELECTED"; } echo ">$admin_profile14</option>
</select>
&nbsp;
<select name='search_gender' style='width: 200px;'>
<option value='2'"; if($admin_info[search_gender] == "2") { echo " SELECTED"; } echo ">$admin_profile62</option>
<option value='1'"; if($admin_info[search_gender] == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($admin_info[search_gender] == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select>
</td>
</tr>

<tr>
<td>&#149; <b>$admin_profile38</b> &nbsp;</td>
<td NOWRAP>
<select name='field_birthday' style='width: 200px;'>
<option value='3'"; if($admin_info[field_birthday] == "3") { echo " SELECTED"; } echo ">$admin_profile11</option>
<option value='2'"; if($admin_info[field_birthday] == "2") { echo " SELECTED"; } echo ">$admin_profile12</option>
<option value='1'"; if($admin_info[field_birthday] == "1") { echo " SELECTED"; } echo ">$admin_profile13</option>
<option value='0'"; if($admin_info[field_birthday] == "0") { echo " SELECTED"; } echo ">$admin_profile14</option>
</select>
&nbsp;
<select name='search_birthday' style='width: 200px;'>
<option value='2'"; if($admin_info[search_birthday] == "2") { echo " SELECTED"; } echo ">$admin_profile62</option>
<option value='1'"; if($admin_info[search_birthday] == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($admin_info[search_birthday] == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select>
</td>
</tr>

<tr>
<td>&#149; <b>$admin_profile39</b> &nbsp;</td>
<td NOWRAP>
<select name='field_city' style='width: 200px;'>
<option value='3'"; if($admin_info[field_city] == "3") { echo " SELECTED"; } echo ">$admin_profile11</option>
<option value='2'"; if($admin_info[field_city] == "2") { echo " SELECTED"; } echo ">$admin_profile12</option>
<option value='1'"; if($admin_info[field_city] == "1") { echo " SELECTED"; } echo ">$admin_profile13</option>
<option value='0'"; if($admin_info[field_city] == "0") { echo " SELECTED"; } echo ">$admin_profile14</option>
</select>
&nbsp;
<select name='search_city' style='width: 200px;'>
<option value='2'"; if($admin_info[search_city] == "2") { echo " SELECTED"; } echo ">$admin_profile62</option>
<option value='1'"; if($admin_info[search_city] == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($admin_info[search_city] == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select>
</td>
</tr>

<tr>
<td>&#149; <b>$admin_profile40</b> &nbsp;</td>
<td NOWRAP>
<select name='field_state' style='width: 200px;'>
<option value='3'"; if($admin_info[field_state] == "3") { echo " SELECTED"; } echo ">$admin_profile11</option>
<option value='2'"; if($admin_info[field_state] == "2") { echo " SELECTED"; } echo ">$admin_profile12</option>
<option value='1'"; if($admin_info[field_state] == "1") { echo " SELECTED"; } echo ">$admin_profile13</option>
<option value='0'"; if($admin_info[field_state] == "0") { echo " SELECTED"; } echo ">$admin_profile14</option>
</select>
&nbsp;
<select name='search_state' style='width: 200px;'>
<option value='2'"; if($admin_info[search_state] == "2") { echo " SELECTED"; } echo ">$admin_profile62</option>
<option value='1'"; if($admin_info[search_state] == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($admin_info[search_state] == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select>
</td>
</tr>

<tr>
<td>&#149; <b>$admin_profile41</b> &nbsp;</td>
<td NOWRAP>
<select name='field_country' style='width: 200px;'>
<option value='3'"; if($admin_info[field_country] == "3") { echo " SELECTED"; } echo ">$admin_profile11</option>
<option value='2'"; if($admin_info[field_country] == "2") { echo " SELECTED"; } echo ">$admin_profile12</option>
<option value='1'"; if($admin_info[field_country] == "1") { echo " SELECTED"; } echo ">$admin_profile13</option>
<option value='0'"; if($admin_info[field_country] == "0") { echo " SELECTED"; } echo ">$admin_profile14</option>
</select>
&nbsp;
<select name='search_country' style='width: 200px;'>
<option value='2'"; if($admin_info[search_country] == "2") { echo " SELECTED"; } echo ">$admin_profile62</option>
<option value='1'"; if($admin_info[search_country] == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($admin_info[search_country] == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select>
</td>
</tr>

<tr>
<td>&#149; <b>$admin_profile84</b> &nbsp;</td>
<td NOWRAP>
<select name='field_interests' style='width: 200px;'>
<option value='3'"; if($admin_info[field_interests] == "3") { echo " SELECTED"; } echo ">$admin_profile11</option>
<option value='2'"; if($admin_info[field_interests] == "2") { echo " SELECTED"; } echo ">$admin_profile12</option>
<option value='1'"; if($admin_info[field_interests] == "1") { echo " SELECTED"; } echo ">$admin_profile13</option>
<option value='0'"; if($admin_info[field_interests] == "0") { echo " SELECTED"; } echo ">$admin_profile14</option>
</select>
&nbsp;
<select name='search_interests' style='width: 200px;'>
<option value='2'"; if($admin_info[search_interests] == "2") { echo " SELECTED"; } echo ">$admin_profile62</option>
<option value='1'"; if($admin_info[search_interests] == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($admin_info[search_interests] == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select>
</td>
</tr>
</table>

</td>
</tr>
</table>

<br>

<table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 3px;'>
<tr><td class='header'>$admin_profile42</td></tr>
<tr>
<td class='box'>
$admin_profile43
<br><br>

<table cellpadding='5' cellspacing='0'>
";
  $custom_fields = mysql_query("SHOW COLUMNS FROM bhost_profile FROM `$mysql_database`");
  while($custom = mysql_fetch_assoc($custom_fields)) {
   if($custom[Field] != "p_id" & $custom[Field] != "u_id") {
    $custom_name = str_replace("_", " ", substr($custom[Field], 0, -3));
    $custom_required = substr($custom[Field], -3, 2);
    $custom_search = substr($custom[Field], -1);

    echo "
<tr>
<td NOWRAP>&#149; <b>$custom_name</b> &nbsp;</td>
<td NOWRAP>
<select name='field_$custom[Field]' style='width: 200px;'>
<option value='3'"; if($custom_required == "_3") { echo " SELECTED"; } echo ">$admin_profile11</option>
<option value='2'"; if($custom_required == "_2") { echo " SELECTED"; } echo ">$admin_profile12</option>
<option value='1'"; if($custom_required == "_1") { echo " SELECTED"; } echo ">$admin_profile13</option>
<option value='0'"; if($custom_required == "_0") { echo " SELECTED"; } echo ">$admin_profile14</option>
</select>
&nbsp;
<select name='search_$custom[Field]' style='width: 200px;'>
<option value='2'"; if($custom_search == "2") { echo " SELECTED"; } echo ">$admin_profile62</option>
<option value='1'"; if($custom_search == "1") { echo " SELECTED"; } echo ">$admin_profile61</option>
<option value='0'"; if($custom_search == "0") { echo " SELECTED"; } echo ">$admin_profile60</option>
</select>
&nbsp;
<font class='gray'>[ <a href='admin_profile.php?task=editcustom&cf=$custom[Field]'>$admin_profile81</a> ] [ <a href='admin_profile.php?task=delete&cf=$custom[Field]'>$admin_profile44</a> ]</font>
</td>
</tr>
";
   }
  }
echo "
</table>

</td>
</tr>
</table>

<br>

<table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 3px;'>
<tr><td class='header'>$admin_profile45</td></tr>
<tr>
<td class='box'>
$admin_profile46
<br><br>

<table cellpadding='0' cellspacing='0'>
<tr><td><input type='radio' name='allow_avatars' id='allow_avatars1' value='1'"; if($admin_info[allow_avatars] == "1") { echo " CHECKED"; } echo "></td><td><label for='allow_avatars1'>$admin_profile47</label></td></tr>
<tr><td><input type='radio' name='allow_avatars' id='allow_avatars0' value='0'"; if($admin_info[allow_avatars] == "0") { echo " CHECKED"; } echo "></td><td><label for='allow_avatars0'>$admin_profile48</label></td></tr>
</table>

<br>

$admin_profile86

<br><br>

<table cellpadding='0' cellspacing='0' style='margin-left: 20px;'>
<tr>
<td align='right'>$admin_profile87 &nbsp;</td>
<td><input type='text' class='text' name='avatar_filesize' size='3' value='$admin_info[avatar_filesize]'></td>
</tr>
<tr>
<td align='right'>$admin_profile88 &nbsp;</td>
<td><input type='text' class='text' name='avatar_width' size='3' value='$admin_info[avatar_width]'></td>
</tr>
<tr>
<td align='right'>$admin_profile89 &nbsp;</td>
<td><input type='text' class='text' name='avatar_height' size='3' value='$admin_info[avatar_height]'></td>
</tr>
</table>

</td>
</tr>
</table>

<br>

<table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 3px;'>
<tr><td class='header'>$admin_profile49</td></tr>
<tr>
<td class='box'>
$admin_profile50

<br><br>

<table cellpadding='0' cellspacing='0'>
<tr><td><input type='radio' name='show_friendlist' id='show_friendlist2' value='2'"; if($admin_info[show_friendlist] == "2") { echo " CHECKED"; } echo "></td><td><label for='show_friendlist2'>$admin_profile51</label></td></tr>
<tr><td><input type='radio' name='show_friendlist' id='show_friendlist1' value='1'"; if($admin_info[show_friendlist] == "1") { echo " CHECKED"; } echo "></td><td><label for='show_friendlist1'>$admin_profile52</label></td></tr>
<tr><td><input type='radio' name='show_friendlist' id='show_friendlist0' value='0'"; if($admin_info[show_friendlist] == "0") { echo " CHECKED"; } echo "></td><td><label for='show_friendlist0'>$admin_profile53</label></td></tr>
</table>

</td>
</tr>
</table>

<br>

<table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 3px;'>
<tr><td class='header'>$admin_profile54</td></tr>
<tr>
<td class='box'>
$admin_profile55

<br><br>

<table cellpadding='0' cellspacing='0'>
<tr><td><input type='radio' name='show_userstats' id='show_userstats2' value='2'"; if($admin_info[show_userstats] == "2") { echo " CHECKED"; } echo "></td><td><label for='show_userstats2'>$admin_profile56</label></td></tr>
<tr><td><input type='radio' name='show_userstats' id='show_userstats1' value='1'"; if($admin_info[show_userstats] == "1") { echo " CHECKED"; } echo "></td><td><label for='show_userstats1'>$admin_profile57</label></td></tr>
<tr><td><input type='radio' name='show_userstats' id='show_userstats0' value='0'"; if($admin_info[show_userstats] == "0") { echo " CHECKED"; } echo "></td><td><label for='show_userstats0'>$admin_profile58</label></td></tr>
</table>

</td>
</tr>
</table>

<br>

<table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 3px;'>
<tr><td class='header'>$admin_profile91</td></tr>
<tr>
<td class='box'>
$admin_profile92

<br><br>

<table cellpadding='0' cellspacing='0'>
<tr><td><input type='radio' name='show_teammembers' id='show_teammembers2' value='2'"; if($admin_info[show_teammembers] == "2") { echo " CHECKED"; } echo "></td><td><label for='show_teammembers2'>$admin_profile93</label></td></tr>
<tr><td><input type='radio' name='show_teammembers' id='show_teammembers1' value='1'"; if($admin_info[show_teammembers] == "1") { echo " CHECKED"; } echo "></td><td><label for='show_teammembers1'>$admin_profile94</label></td></tr>
<tr><td><input type='radio' name='show_teammembers' id='show_teammembers0' value='0'"; if($admin_info[show_teammembers] == "0") { echo " CHECKED"; } echo "></td><td><label for='show_teammembers0'>$admin_profile95</label></td></tr>
</table>

</td>
</tr>
</table>


<br>

<table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 3px;'>
<tr><td class='header'>$admin_profile66</td></tr>
<tr>
<td class='box'>
$admin_profile67

<br><br>

<table cellpadding='0' cellspacing='0'>
<tr><td><input type='radio' name='show_whosonline' id='show_whosonline1' value='1'"; if($admin_info[show_whosonline] == "1") { echo " CHECKED"; } echo "></td><td><label for='show_whosonline1'>$admin_profile68</label></td></tr>
<tr><td><input type='radio' name='show_whosonline' id='show_whosonline0' value='0'"; if($admin_info[show_whosonline] == "0") { echo " CHECKED"; } echo "></td><td><label for='show_whosonline0'>$admin_profile69</label></td></tr>
</table>

</td>
</tr>
</table>


<br>

<input type='submit' class='button' value='$admin_profile59'>
<input type='hidden' name='task' value='dosave'>
</form>
";


echo $foot;
?>