<?php
require("./total.inc");

session_start();
require("./ninsyou.inc");
if(0 > ninsyou_check(2)){
   exit;
   }


$user_name = enco($_GET["USER"]);
$user_pass = enco($_GET["PASS"]);
$user_rev = enco($_GET["REV"]);


echo "<HTML>";
echo "<HEAD>";
	echo "<meta http-equiv='Content-Type' content='text/html; charset=EUC-JP'>";
	echo "<TITLE>Zither server Administration tool 'Apollon'</TITLE>";
echo "</HEAD>";

echo "<body alink='#ff0000' bgcolor='$my_bgcolor' link='#0000ff' text='#000000' vlink='#000080'>";
echo "<pre>";

echo "すでにあるアカウントの編集 \n";
echo " \n";

$conn = db_connect();
if(!$conn){
   echo "ninsyou_check(): not connection!<br>";
   return -1;
   }

$result = db_query($conn, "select * from ninsyou;");
if(!$result){
   print("ninsyou_check(): banem select , bud query\n");
   return -1;
   }
$num = db_num_rows($result);
if($num > 0){
   while($s < $num){ 
      $namae = enco_rtrim(db_fetch_Result($result, $s, namae));
      $pass = enco_rtrim(db_fetch_Result($result, $s, passw));
      $rev = enco_rtrim(db_fetch_Result($result, $s, rev));
      print("<a href='./user.php?USER=$namae&PASS=$pass&REV=$rev'>$namae</a> \n");
      $s++;
      }
   }
else{
   print("ninsyou_check(): $num malltipull data bud query\n");
   return -1;
   }

db_free_result($result);
db_Close($conn);

echo " \n";
echo " \n";
echo "編集又は新規アカウント作成 \n";
echo " \n";

echo "<form method=POST action='./user_new.php' target=''>";
echo "<table>";

echo "<tr>";
echo "<td>";
echo "user name";
echo "</td>";
echo "<td>";
echo "<input type=text name=USER size=20 value='$user_name'>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td>";
echo "password";
echo "</td>";
echo "<td>";
echo "<input type=password name=PASS size=20 value='$user_pass'>";
echo "</td>";
echo "</tr>";


switch($user_rev){
   case 1: $set1 = "selected"; break;
   case 2: $set2 = "selected"; break;
   case 3: $set3 = "selected"; break;
   case 4: $set4 = "selected"; break;
   case 5: $set5 = "selected"; break;
   case 6: $set6 = "selected"; break;
   default: break;
   }

echo "<tr>";
echo "<td>";
echo "revel";
echo "<select size=1 name=REV>";
echo "<option value=1 $set1>最高";
echo "<option value=2 $set2>最高のつぎ";
echo "<option value=3 $set3>標準で編集可能";
echo "<option value=4 $set4>見るだけのつぎ";
echo "<option value=5 $set5>みてるだけぇー";
echo "</select>";
echo "</td>";
echo "</tr>";


echo "<tr>";
echo "<td>";
echo "<input type=submit value='submit'>";
echo "</td>";
echo "</tr>";

echo "</form>";
echo "</table>";





echo "</pre>";
echo "</HTML>";

?>
