<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Web management</title>
<link rel="stylesheet" href="styles.css" type="text/css">
<?php include 'codes.php';?>
</head>
<body text="#000000" style="margin:0">
      <?php 
$id = mysql_real_escape_string(stripslashes($_REQUEST['id']));
$category = mysql_real_escape_string(stripslashes($_REQUEST['category']));
$category_en = mysql_real_escape_string(stripslashes($_REQUEST['category_en']));
$category_de = mysql_real_escape_string(stripslashes($_REQUEST['category_de']));
$category_fr = mysql_real_escape_string(stripslashes($_REQUEST['category_fr']));
$category_it = mysql_real_escape_string(stripslashes($_REQUEST['category_it']));
$category_es = mysql_real_escape_string(stripslashes($_REQUEST['category_es']));
$category_ru = mysql_real_escape_string(stripslashes($_REQUEST['category_ru']));
$category_zh = mysql_real_escape_string(stripslashes($_REQUEST['category_zh']));
$category_fr = mysql_real_escape_string(stripslashes($_REQUEST['category_fr']));
$category_it = mysql_real_escape_string(stripslashes($_REQUEST['category_it']));
$category_es = mysql_real_escape_string(stripslashes($_REQUEST['category_es']));
$category_ru = mysql_real_escape_string(stripslashes($_REQUEST['category_ru']));
$category_zh = mysql_real_escape_string(stripslashes($_REQUEST['category_zh']));
$description = mysql_real_escape_string(stripslashes($_REQUEST['description']));
$description_en = mysql_real_escape_string(stripslashes($_REQUEST['description_en']));
$description_de = mysql_real_escape_string(stripslashes($_REQUEST['description_de']));
$description_fr = mysql_real_escape_string(stripslashes($_REQUEST['description_fr']));
$description_it = mysql_real_escape_string(stripslashes($_REQUEST['description_it']));
$description_es = mysql_real_escape_string(stripslashes($_REQUEST['description_es']));
$description_ru = mysql_real_escape_string(stripslashes($_REQUEST['description_ru']));
$description_zh = mysql_real_escape_string(stripslashes($_REQUEST['description_zh']));
$publish = mysql_real_escape_string(stripslashes($_REQUEST['publish']));	  
$priority = mysql_real_escape_string(stripslashes($_REQUEST['priority']));
$level = mysql_real_escape_string(stripslashes($_REQUEST['level']));	  
$parent = mysql_real_escape_string(stripslashes($_REQUEST['parent']));	  

if  (isset($_POST['submit'])) {
	$sql="UPDATE infocategories SET category='$category', category_en='$category_en', category_de='$category_de', category_fr='$category_fr', category_it='$category_it', category_es='$category_es', category_ru='$category_ru', category_zh='$category_zh', description='$description', description_en='$description_en', description_de='$description_de', description_fr='$description_fr',  description_it='$description_it',  description_es='$description_es',  description_ru='$description_ru', description_zh='$description_zh', publish='$publish', priority='$priority', level='$level', parent='$parent' WHERE id='$id'";
	$result = mysql_query($sql);	
?>

                    <?php 
		$newid = $id;
        $uploaddir = '../flash/info/'; 
		$uploadid = $newid; 
		$filetype = '.jpg'; 
		$uploadname = $newid . $filetype; 
		

        if (isset($_POST['submit'])){ 
        if( $_FILES['upload']['tmp_name'] != "" ){
		
        $dest = $uploaddir . $uploadname; 
       if (copy ( $_FILES['upload']['tmp_name'], $dest )){ 
                } }
?>
<?php } ?> 

<meta http-equiv="refresh" content="0;URL=edit-infocategory.php?id=<?php echo $id ?>">
<?php
} else {	
			$result = mysql_query("SELECT * FROM infocategories WHERE id='$id'",$dbh);
			$myrow=mysql_fetch_array($result); 
			$id=$myrow['id'];
			$category=$myrow['category'];
			$category_en=$myrow['category_en'];
			$category_de=$myrow['category_de'];
			$category_fr=$myrow['category_fr'];
            $category_it=$myrow['category_it'];
            $category_es=$myrow['category_es'];
            $category_ru=$myrow['category_ru'];
			$category_zh=$myrow['category_zh'];
			$category_fr=$myrow['category_fr'];
            $category_it=$myrow['category_it'];
            $category_es=$myrow['category_es'];
            $category_ru=$myrow['category_ru'];
			$category_zh=$myrow['category_zh'];
			$description=$myrow['description'];
			$description_en=$myrow['description_en'];
			$description_de=$myrow['description_de'];
            $description_fr=$myrow['description_fr'];
            $description_it=$myrow['description_it'];
            $description_es=$myrow['description_es'];
            $description_ru=$myrow['description_ru'];
			$description_zh=$myrow['description_zh'];
			$publish=$myrow['publish'];
			$priority=$myrow['priority'];
			$level=$myrow['level'];
			$parent=$myrow['parent'];
			
			$toplevel=$level-1;
?>

<table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div><img src="img/frame-edit.png" width="180" height="37" alt=""></div>
<div class="frame">

<form name="forma" method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" enctype="multipart/form-data">
  <input type="hidden" name="id" value="<?php echo $id ?>">
  <table width="100%" border="0" cellspacing="0" cellpadding="4" class="text">
    <tr>
      <td width="20">&nbsp;</td> 
      <td width="200">
	  <?php if ($level>'1') { ?>
      Υποκατηγορία της
       <?php } ?>
        
        <input type="hidden" name="level" value="<?php echo $level ?>">
        <input type="hidden" name="parent" value="<?php echo $parent ?>"></td>
      <td>
      
           <?php if ($level>'1') { ?>
      <select name="parent" class="forms">
        <?php
			$sql = "SELECT * FROM infocategories WHERE level='$toplevel' ORDER BY id";
			$result = mysql_query($sql);
			while ($myrow=mysql_fetch_array($result)) {
				$catid1=$myrow['id'];
				$category1=$myrow['category'];
?>
        <?php
			$sql2 = "SELECT * FROM info WHERE category_id='$catid1'";
			$result2 = mysql_query($sql2);
			$nu_row2 = mysql_num_rows($result2);
?>
        <?php
	if ($catid1 == $parent ) {
?>
        <option value="<?php echo $catid1 ?>" selected> <?php echo $category1 ?>
          <?php } else { ?>
          <option value="<?php echo $catid1 ?>"> <?php echo $category1 ?> </option>
        <?php } ?>
        
<?php } ?>
      </select>
       <?php } ?>
      </td>
      </tr>
       <?php if ($lang1==1) { ?>
    <tr>
      <td width="20"><img src="img/lang1.png" width="16" height="16" alt=""></td> 
      <td width="200">Τίτλος 
        </td>
      <td> 
        <input type="text" name="category" size="100" value="<?php echo $category ?>" class="forms">
        </td>
    </tr>
    <?php } ?>
    <?php if ($lang2==1) { ?>
    <tr>
      <td><img src="img/lang2.png" width="16" height="16" alt=""></td> 
      <td>Τίτλος </td>
      <td> 
        <input type="text" name="category_en" size="100" value="<?php echo $category_en ?>" class="forms">
        </td>
      </tr>
      <?php } ?>
    <?php if ($lang3==1) { ?>
    <tr>
      <td><img src="img/lang3.png" width="16" height="16" alt=""></td>
      <td>Τίτλος </td>
      <td><input type="text" name="category_de" size="100" value="<?php echo $category_de ?>" class="forms"></td>
    </tr>
      <?php } ?>
    <?php if ($lang4==1) { ?>
    <tr>
      <td><img src="img/lang4.png" width="16" height="16" alt=""></td>
      <td>Τίτλος </td>
      <td><input type="text" name="category_fr" size="100" value="<?php echo $category_fr ?>" class="forms"></td>
    </tr>
      <?php } ?>
    <?php if ($lang5==1) { ?>
    <tr>
      <td><img src="img/lang5.png" width="16" height="16" alt=""></td>
      <td>Τίτλος </td>
      <td><input type="text" name="category_it" size="100" value="<?php echo $category_it ?>" class="forms"></td>
    </tr>
      <?php } ?>
    <?php if ($lang6==1) { ?>
    <tr>
      <td><img src="img/lang6.png" width="16" height="16" alt=""></td>
      <td>Τίτλος </td>
      <td><input type="text" name="category_es" size="100" value="<?php echo $category_es ?>" class="forms"></td>
    </tr>
      <?php } ?>
    <?php if ($lang7==1) { ?>
    <tr>
      <td><img src="img/lang7.png" width="16" height="16" alt=""></td>
      <td>Τίτλος </td>
      <td><input type="text" name="category_ru" size="100" value="<?php echo $category_ru ?>" class="forms"></td>
    </tr>
      <?php } ?>
      <?php if ($lang8==1) { ?>
    <tr>
      <td><img src="img/lang8.png" width="16" height="16" alt=""></td>
      <td>Τίτλος </td>
      <td><input type="text" name="category_zh" size="100" value="<?php echo $category_zh ?>" class="forms"></td>
    </tr>
      <?php } ?>
    <?php if ($lang1==1) { ?>
    <tr>
      <td><img src="img/lang1.png" width="16" height="16" alt=""></td> 
      <td>Περιγραφή </td>
      <td> 
        <textarea name="description" cols="100" rows="10" class="forms"><?php echo $description ?></textarea>
        </td>
    </tr>
      <?php } ?>
    <?php if ($lang2==1) { ?>
    <tr>
      <td><img src="img/lang2.png" width="16" height="16" alt=""></td> 
      <td>Περιγραφή </td>
      <td> 
        <textarea name="description_en" cols="100" rows="10" class="forms"><?php echo $description_en ?></textarea>
        </td>
      </tr>
      <?php } ?>
    <?php if ($lang3==1) { ?>
    <tr>
      <td><img src="img/lang3.png" width="16" height="16" alt=""></td>
      <td>Περιγραφή </td>
      <td><textarea name="description_de" cols="100" rows="10" class="forms"><?php echo $description_de ?></textarea></td>
    </tr>
      <?php } ?>
    <?php if ($lang4==1) { ?>
    <tr>
      <td><img src="img/lang4.png" width="16" height="16" alt=""></td>
      <td>Περιγραφή </td>
      <td><textarea name="description_fr" cols="100" rows="10" class="forms"><?php echo $description_fr ?></textarea></td>
    </tr>
      <?php } ?>
    <?php if ($lang5==1) { ?>
    <tr>
      <td><img src="img/lang5.png" width="16" height="16" alt=""></td>
      <td>Περιγραφή </td>
      <td><textarea name="description_it" cols="100" rows="10" class="forms"><?php echo $description_it ?></textarea></td>
    </tr>
      <?php } ?>
    <?php if ($lang6==1) { ?>
    <tr>
      <td><img src="img/lang6.png" width="16" height="16" alt=""></td>
      <td>Περιγραφή </td>
      <td><textarea name="description_es" cols="100" rows="10" class="forms"><?php echo $description_es ?></textarea></td>
    </tr>
      <?php } ?>
    <?php if ($lang7==1) { ?>
    <tr>
      <td><img src="img/lang7.png" width="16" height="16" alt=""></td>
      <td>Περιγραφή </td>
      <td><textarea name="description_ru" cols="100" rows="10" class="forms"><?php echo $description_ru ?></textarea></td>
    </tr>
     <?php } ?>
      <?php if ($lang8==1) { ?>
    <tr>
      <td><img src="img/lang8.png" width="16" height="16" alt=""></td>
      <td>Περιγραφή </td>
      <td><textarea name="description_zh" cols="100" rows="10" class="forms"><?php echo $description_zh ?></textarea></td>
    </tr>
     <?php } ?>
    <tr>
      <td>&nbsp;</td>
      <td>Εικόνα</td>
      <td><input type="hidden" name="max_file_size" value="600000">
        <input name="upload" type="file" size="50" class="forms"></td>
    </tr>
    <tr>
      <td>&nbsp;</td> 
      <td>Δημοσίευση στο site?</td>
      <td> 
        <select name="publish" class="forms">
          <?php if ($publish==yes) { ?>
          <option value="yes" selected>yes</option>
          <option value="no">no</option>
          <?php }else{?> 
          <option value="no" selected>no</option>
          <option value="yes">yes</option>
          <?php } ?>
</select>
        </td>
    </tr>
    <tr>
      <td>&nbsp;</td> 
      <td>Αριθμός προτεραιότητας</td>
      <td> 
        <input type="text" name="priority" size="20" maxlength="11" value="<?php echo $priority ?>" class="forms">
        </td>
    </tr>
    </table>

  <div align="center" style="padding:5px">
   <input type="submit" name="submit" value="Καταχώρηση" class="button">
        <input type="reset" name="reset" value="Επαναφορά" class="button">  </div>
</form>  
</div>
<div align="right"><a href="all-infocategories.php" class="links">μεταφορά στην Λίστα</a></div>
<div align="center"><img src="../flash/info/<?php echo $id ?>.jpg" width="150"> </div>
</td>
  </tr>
</table><?php include 'menudown.php';?>
<?php } ?>
</body>
</html>
