<?php
include('header.php');
echo $h;

$action = $_GET['action'];
if(!isset($action)) $action = "adduser";

IF ($action=="adduser"){

echo "<form method='post' action='user.php?action=insertuser'>

<table class='xtable' width='100%' id='AutoNumber15'>
<tr>
<td width='100%' colspan='2' class='xtx' align='center'>".$LANGAUGE_CP[701]."</td>
</tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[197]."</td>
      <td width='40%' class='xtd'><input size='50' name='name' /></td>
    </tr>
    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[198]."</td>
      <td width='40%' class='xtd'><input dir='ltr' size='50' name='email' /></td>
    </tr>
     <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[605]."</td>
      <td width='40%' class='xtd'><input size='50' name='phone' /></td>
    </tr>
    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[10]."</td>
      <td width='40%' class='xtd'><input size='50' name='username' /></td>
    </tr>
    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[11]."</td>
      <td width='40%' class='xtd'><input size='50' name='password' /></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[606]."</td>
      <td width='40%' class='xtd'><select size='1' name='g1'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[702]."</td>
      <td width='40%' class='xtd'><select size='1' name='g21'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[607]."</td>
      <td width='40%' class='xtd'><select size='1' name='g2'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[608]."</td>
      <td width='40%' class='xtd'><select size='1' name='g3'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[609]."</td>
      <td width='40%' class='xtd'><select size='1' name='g4'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[610]."</td>
      <td width='40%' class='xtd'><select size='1' name='g5'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[611]."</td>
      <td width='40%' class='xtd'><select size='1' name='g6'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[612]."</td>
      <td width='40%' class='xtd'><select size='1' name='g7'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[613]."</td>
      <td width='40%' class='xtd'><select size='1' name='g8'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[614]."</td>
      <td width='40%' class='xtd'><select size='1' name='g9'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[615]."</td>
      <td width='40%' class='xtd'><select size='1' name='g10'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[616]."</td>
      <td width='40%' class='xtd'><select size='1' name='g11'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[617]."</td>
      <td width='40%' class='xtd'><select size='1' name='g12'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[618]."</td>
      <td width='40%' class='xtd'><select size='1' name='g13'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[619]."</td>
      <td width='40%' class='xtd'><select size='1' name='g14'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[620]."</td>
      <td width='40%' class='xtd'><select size='1' name='g15'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[621]."</td>
      <td width='40%' class='xtd'><select size='1' name='g16'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[622]."</td>
      <td width='40%' class='xtd'><select size='1' name='g17'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[623]."</td>
      <td width='40%' class='xtd'><select size='1' name='g18'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[624]."</td>
      <td width='40%' class='xtd'><select size='1' name='g19'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[625]."</td>
      <td width='40%' class='xtd'><select size='1' name='g20'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select></td>
    </tr>

     <tr>
      <td width='100%' colspan='2' class='xtr' align='center'>
      <input type='submit' value=' ".$LANGAUGE_CP[18]." ' name='xxxx' /></td>
    </tr>
  </table>
</form>";


$queryx = mysql_query("SELECT * FROM user order by id desc");
$xx = mysql_num_rows($queryx);
if($xx == 0){
echo "";
}else{

echo "<table class='xtable' width='100%' id='AutoNumber15'>
<tr>
<td width='100%' colspan='6' class='xtt' align='center'>".$LANGAUGE_CP[23]."</td>
</tr>
<tr>
      <td width='30%' align='center' class='xtr'>".$LANGAUGE_CP[189]."</td>
      <td width='30%' align='center' class='xtr'>".$LANGAUGE_CP[24]."</td>
      <td width='19%' align='center' class='xtr'>".$LANGAUGE_CP[25]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[28]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[26]."</td>
      <td width='7%' align='center' class='xtr'>".$LANGAUGE_CP[27]."</td>
</tr>";
while($p = mysql_fetch_array($queryx))
{
$p['name'] = stripslashes($p['name']);
$p['name'] = htmlspecialchars($p['name']);

$p['username'] = stripslashes($p['username']);
$p['username'] = htmlspecialchars($p['username']);

if($p['g1'] == 1){$g1 = "<option value='1'>".$LANGAUGE_CP[606]."</option>"; }else{ $g1 = ""; }
if($p['g2'] == 1){$g2 = "<option value='2'>".$LANGAUGE_CP[607]."</option>"; }else{ $g2 = ""; }
if($p['g3'] == 1){$g3 = "<option value='3'>".$LANGAUGE_CP[608]."</option>"; }else{ $g3 = ""; }
if($p['g4'] == 1){$g4 = "<option value='4'>".$LANGAUGE_CP[609]."</option>"; }else{ $g4 = ""; }
if($p['g5'] == 1){$g5 = "<option value='5'>".$LANGAUGE_CP[610]."</option>"; }else{ $g5 = ""; }
if($p['g6'] == 1){$g6 = "<option value='6'>".$LANGAUGE_CP[611]."</option>"; }else{ $g6 = ""; }
if($p['g7'] == 1){$g7 = "<option value='7'>".$LANGAUGE_CP[612]."</option>"; }else{ $g7 = ""; }
if($p['g8'] == 1){$g8 = "<option value='8'>".$LANGAUGE_CP[613]."</option>"; }else{ $g8 = ""; }
if($p['g9'] == 1){$g9 = "<option value='9'>".$LANGAUGE_CP[614]."</option>"; }else{ $g9 = ""; }
if($p['g10'] == 1){$g10 = "<option value='10'>".$LANGAUGE_CP[615]."</option>"; }else{ $g10 = ""; }
if($p['g11'] == 1){$g11 = "<option value='11'>".$LANGAUGE_CP[616]."</option>"; }else{ $g11 = ""; }
if($p['g12'] == 1){$g12 = "<option value='12'>".$LANGAUGE_CP[617]."</option>"; }else{ $g12 = ""; }
if($p['g13'] == 1){$g13 = "<option value='13'>".$LANGAUGE_CP[618]."</option>"; }else{ $g13 = ""; }
if($p['g14'] == 1){$g14 = "<option value='14'>".$LANGAUGE_CP[619]."</option>"; }else{ $g14 = ""; }
if($p['g15'] == 1){$g15 = "<option value='15'>".$LANGAUGE_CP[620]."</option>"; }else{ $g15 = ""; }
if($p['g16'] == 1){$g16 = "<option value='16'>".$LANGAUGE_CP[621]."</option>"; }else{ $g16 = ""; }
if($p['g17'] == 1){$g17 = "<option value='17'>".$LANGAUGE_CP[622]."</option>"; }else{ $g17 = ""; }
if($p['g18'] == 1){$g18 = "<option value='18'>".$LANGAUGE_CP[623]."</option>"; }else{ $g18 = ""; }
if($p['g19'] == 1){$g19 = "<option value='19'>".$LANGAUGE_CP[624]."</option>"; }else{ $g19 = ""; }
if($p['g20'] == 1){$g20 = "<option value='20'>".$LANGAUGE_CP[625]."</option>"; }else{ $g20 = ""; }
if($p['g21'] == 1){$g21 = "<option value='21'>".$LANGAUGE_CP[702]."</option>"; }else{ $g21 = ""; }

if($p['active'] == 1){
$im = "images/on.gif";
$li = "user.php?action=actx&id=$p[id]&act=0";
$te = $LANGAUGE_CP[72];
}else{
$im = "images/off.gif";
$li = "user.php?action=actx&id=$p[id]&act=1";
$te = $LANGAUGE_CP[73];
}

echo "<tr>
      <td width='30%' class='xtd'>".$p['name']."</td>
      <td width='30%' class='xtd' align='center'>".$p['username']."</td>
      <td width='19%' class='xtd' align='center'><select size='1' name='g15g'>".$g1.$g2.$g3.$g4.$g5.$g6.$g7.$g8.$g9.$g10.$g11.$g12.$g13.$g14.$g15.$g16.$g17.$g18.$g19.$g20.$g21."</select></td>
      <td width='7%' align='center' class='xtd'><a href='$li'><img border='0' src='$im' alt='$te ".$p['name']."' /></a></td>
      <td width='7%' align='center' class='xtd'><a href='user.php?action=edituser&id=$p[id]'><img border='0' src='images/edit.gif' alt='".$p['username']."' /></a></td>
      <td width='7%' align='center' class='xtd'><a href='user.php?action=deleteuser&id=$p[id]'><img border='0' src='images/delete.gif' alt='".$p['username']."' /></a></td>
    </tr>";
}
echo "</table>";
}
}ELSEIF ($action=="insertuser"){
$name = addslashes($_POST['name']);
$name = trim($name);

$email = addslashes($_POST['email']);
$email = trim($email);

$phone = addslashes($_POST['phone']);
$phone = trim($phone);

$username = addslashes($_POST['username']);
$username = trim($username);

$password = addslashes($_POST['password']);
$password = trim($password);
$passwordm = md5($password);

$g1 = intval($_POST['g1']);
$g2 = intval($_POST['g2']);
$g3 = intval($_POST['g3']);
$g4 = intval($_POST['g4']);
$g5 = intval($_POST['g5']);
$g6 = intval($_POST['g6']);
$g7 = intval($_POST['g7']);
$g8 = intval($_POST['g8']);
$g9 = intval($_POST['g9']);
$g10 = intval($_POST['g10']);
$g11 = intval($_POST['g11']);
$g12 = intval($_POST['g12']);
$g13 = intval($_POST['g13']);
$g14 = intval($_POST['g14']);
$g15 = intval($_POST['g15']);
$g16 = intval($_POST['g16']);
$g17 = intval($_POST['g17']);
$g18 = intval($_POST['g18']);
$g19 = intval($_POST['g19']);
$g20 = intval($_POST['g20']);
$g21 = intval($_POST['g21']);

if (empty($username)){
echo $LANGAUGE_CP[19];
}elseif (empty($password)){
echo $LANGAUGE_CP[20];
}else{
$query =  mysql_query ("INSERT INTO user (name,email,phone,username,password,active,g1,g2,g3,g4,g5,g6,g7,g8,g9,g10,g11,g12,g13,g14,g15,g16,g17,g18,g19,g20,g21) VALUES ('$name','$email','$phone','$username','$passwordm','1','$g1','$g2','$g3','$g4','$g5','$g6','$g7','$g8','$g9','$g10','$g11','$g12','$g13','$g14','$g15','$g16','$g17','$g18','$g19','$g20','$g21')") or die ("error");
echo $LANGAUGE_CP[21];
echo "<META HTTP-EQUIV='refresh' CONTENT='1; URL=user.php?action=adduser' />";
}

}ELSEIF ($action=="actx"){
$id = intval($_GET['id']);
$act = intval($_GET['act']);
if ($act == 0){
$query =  mysql_query("UPDATE user SET active='$act' where id='$id'");
echo $LANGAUGE_CP[61];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=user.php' />";
}elseif ($act == 1){
$query =  mysql_query("UPDATE user SET active='$act' where id='$id'");
echo $LANGAUGE_CP[62];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=user.php' />";
}else{
echo $LANGAUGE_CP[63];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=user.php' />";
}

}ELSEIF ($action=="edituser"){
$id = intval($_GET['id']);

$query = mysql_query("SELECT * FROM user where id='$id'");
$p = mysql_fetch_array($query);
$p['name'] = stripslashes($p['name']);
$p['name'] = htmlspecialchars($p['name']);

$p['email'] = stripslashes($p['email']);
$p['email'] = htmlspecialchars($p['email']);

$p['phone'] = stripslashes($p['phone']);
$p['phone'] = htmlspecialchars($p['phone']);

$p['username'] = stripslashes($p['username']);
$p['username'] = htmlspecialchars($p['username']);

$p['password'] = stripslashes($p['password']);
$p['password'] = htmlspecialchars($p['password']);

if($p['g1']==1){
$g1 = "<select size='1' name='g1'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g1 = "<select size='1' name='g1'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g2']==1){
$g2 = "<select size='1' name='g2'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g2 = "<select size='1' name='g2'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g3']==1){
$g3 = "<select size='1' name='g3'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g3 = "<select size='1' name='g3'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g4']==1){
$g4 = "<select size='1' name='g4'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g4 = "<select size='1' name='g4'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g5']==1){
$g5 = "<select size='1' name='g5'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g5 = "<select size='1' name='g5'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g6']==1){
$g6 = "<select size='1' name='g6'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g6 = "<select size='1' name='g6'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g7']==1){
$g7 = "<select size='1' name='g7'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g7 = "<select size='1' name='g7'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g8']==1){
$g8 = "<select size='1' name='g8'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g8 = "<select size='1' name='g8'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g9']==1){
$g9 = "<select size='1' name='g9'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g9 = "<select size='1' name='g9'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g10']==1){
$g10 = "<select size='1' name='g10'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g10 = "<select size='1' name='g10'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g11']==1){
$g11 = "<select size='1' name='g11'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g11 = "<select size='1' name='g11'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g12']==1){
$g12 = "<select size='1' name='g12'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g12 = "<select size='1' name='g12'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g13']==1){
$g13 = "<select size='1' name='g13'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g13 = "<select size='1' name='g13'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g14']==1){
$g14 = "<select size='1' name='g14'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g14 = "<select size='1' name='g14'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g15']==1){
$g15 = "<select size='1' name='g15'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g15 = "<select size='1' name='g15'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g16']==1){
$g16 = "<select size='1' name='g16'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g16 = "<select size='1' name='g16'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g17']==1){
$g17 = "<select size='1' name='g17'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g17 = "<select size='1' name='g17'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g18']==1){
$g18 = "<select size='1' name='g18'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g18 = "<select size='1' name='g18'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g19']==1){
$g19 = "<select size='1' name='g19'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g19 = "<select size='1' name='g19'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g20']==1){
$g20 = "<select size='1' name='g20'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g20 = "<select size='1' name='g20'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

if($p['g21']==1){
$g21 = "<select size='1' name='g21'>
<option value='1' selected='selected'>".$LANGAUGE_CP[139]."</option>
<option value='0'>".$LANGAUGE_CP[140]."</option>
</select>";
}else{
$g21 = "<select size='1' name='g21'>
<option value='1'>".$LANGAUGE_CP[139]."</option>
<option value='0' selected='selected'>".$LANGAUGE_CP[140]."</option>
</select>";
}

echo "<form method='post' action='user.php?action=updateuser'>
<input name='ppp' type='hidden' value='".$p['password']."' />
<input name='id' type='hidden' value='".$id."' />

<table class='xtable' width='100%' id='AutoNumber15'>
    <tr>
<td width='100%' colspan='2' class='xtt' align='center'>".$LANGAUGE_CP[32]."</td>
</tr>

<tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[197]."</td>
      <td width='40%' class='xtd'><input size='50' name='name' value='".$p['name']."' /></td>
    </tr>
    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[198]."</td>
      <td width='40%' class='xtd'><input dir='ltr' size='50' name='email' value='".$p['email']."' /></td>
    </tr>
     <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[605]."</td>
      <td width='40%' class='xtd'><input size='50' name='phone' value='".$p['phone']."' /></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[10]."</td>
      <td width='40%' class='xtd'><input size='50' name='username' value='".$p['username']."' /></td>
    </tr>
    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[11]."</td>
      <td width='40%' class='xtd'><input size='50' name='password' /></td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[606]."</td>
      <td width='40%' class='xtd'>".$g1."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[607]."</td>
      <td width='40%' class='xtd'>".$g2."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[608]."</td>
      <td width='40%' class='xtd'>".$g3."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[609]."</td>
      <td width='40%' class='xtd'>".$g4."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[610]."</td>
      <td width='40%' class='xtd'>".$g5."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[611]."</td>
      <td width='40%' class='xtd'>".$g6."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[612]."</td>
      <td width='40%' class='xtd'>".$g7."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[613]."</td>
      <td width='40%' class='xtd'>".$g8."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[614]."</td>
      <td width='40%' class='xtd'>".$g9."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[615]."</td>
      <td width='40%' class='xtd'>".$g10."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[616]."</td>
      <td width='40%' class='xtd'>".$g11."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[617]."</td>
      <td width='40%' class='xtd'>".$g12."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[618]."</td>
      <td width='40%' class='xtd'>".$g13."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[619]."</td>
      <td width='40%' class='xtd'>".$g14."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[620]."</td>
      <td width='40%' class='xtd'>".$g15."</td>
    </tr>


    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[621]."</td>
      <td width='40%' class='xtd'>".$g16."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[622]."</td>
      <td width='40%' class='xtd'>".$g17."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[623]."</td>
      <td width='40%' class='xtd'>".$g18."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[624]."</td>
      <td width='40%' class='xtd'>".$g19."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[625]."</td>
      <td width='40%' class='xtd'>".$g20."</td>
    </tr>

    <tr>
      <td width='60%' class='xtr'>".$LANGAUGE_CP[702]."</td>
      <td width='40%' class='xtd'>".$g21."</td>
    </tr>

     <tr>
      <td width='100%' colspan='2' class='xtr' align='center'>
      <input type='submit' value=' ".$LANGAUGE_CP[33]." ' name='xxxx' /></td>
    </tr>
  </table>
</form>";

}ELSEIF ($action=="updateuser"){
$id = intval($_POST['id']);
$name = addslashes($_POST['name']);
$name = trim($name);

$email = addslashes($_POST['email']);
$email = trim($email);

$phone = addslashes($_POST['phone']);
$phone = trim($phone);

$username = addslashes($_POST['username']);
$username = trim($username);

$g1 = intval($_POST['g1']);
$g2 = intval($_POST['g2']);
$g3 = intval($_POST['g3']);
$g4 = intval($_POST['g4']);
$g5 = intval($_POST['g5']);
$g6 = intval($_POST['g6']);
$g7 = intval($_POST['g7']);
$g8 = intval($_POST['g8']);
$g9 = intval($_POST['g9']);
$g10 = intval($_POST['g10']);
$g11 = intval($_POST['g11']);
$g12 = intval($_POST['g12']);
$g13 = intval($_POST['g13']);
$g14 = intval($_POST['g14']);
$g15 = intval($_POST['g15']);
$g16 = intval($_POST['g16']);
$g17 = intval($_POST['g17']);
$g18 = intval($_POST['g18']);
$g19 = intval($_POST['g19']);
$g20 = intval($_POST['g20']);
$g21 = intval($_POST['g21']);

$password = addslashes($_POST['password']);
$password = trim($password);

$ppp = addslashes($_POST['ppp']);
$ppp = trim($ppp);

if(empty($password)){
$xpass = $ppp;
}else{
$xpass = md5($password);
}

if(empty($username)){
echo $LANGAUGE_CP[19];
}else{
$query =  mysql_query("UPDATE user SET name='$name',email='$email',phone='$phone',username='$username',password='$xpass',g1='$g1',g2='$g2',g3='$g3',g4='$g4',g5='$g5',g6='$g6',g7='$g7',g8='$g8',g9='$g9',g10='$g10',g11='$g11',g12='$g12',g13='$g13',g14='$g14',g15='$g15',g16='$g16',g17='$g17',g18='$g18',g19='$g19',g20='$g20',g21='$g21' where id='$id'");
print $LANGAUGE_CP[34];
echo "<META HTTP-EQUIV='refresh' CONTENT='1; URL= user.php' />";
}

}ELSEIF ($action=="deleteuser"){
$id = intval($_GET['id']);
$query =  mysql_query("DELETE FROM user WHERE id='$id'");
echo $LANGAUGE_CP[35];
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=user.php' />";
}

echo $f;
?>