<?php include 'sets.php';?>
<?php
$superuser="1";
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Webadmin <?php echo $domain ?></title>
<?php include 'codes.php';?>
</head>
<body>

<?php include 'navbar.php';?>
    
<div class="container">
<div class="frame">
<div class="frametitles fadd"><?php echo $adminadd ?>
<div class="floatright"><a href="list-lang.php"><img src="img/list.png" alt="<?php echo $adminlangs ?>" title="<?php echo $adminlangs ?>"></a></div>
</div>
<div class="framein">

<?php
$result = $mysqli->query("SELECT priority FROM lang ORDER BY priority desc LIMIT 1");
$row = $result->fetch_array(); 
$pid=$row['priority'];
$priorityid=$pid + 1;
?>

<?php 
$language = $mysqli->real_escape_string(stripslashes($_REQUEST['language']));
$dir = $mysqli->real_escape_string(stripslashes($_REQUEST['dir']));

if  (isset($_POST['submit'])) {
$result1 = $mysqli->query("SELECT * FROM lang WHERE dir='$dir'");
$nrrows1 = mysqli_num_rows($result1);
?>
<?php if ($nrrows1==0) { ?>
<?php 
$mysqli->query("INSERT INTO lang (language, dir, priority) VALUES ('$language', '$dir', '$priorityid')");
?>
<meta http-equiv="refresh" content="0">
<?php } else {?>
<div align="center"> <?php echo $adminexist ?>  </div>
<?php } ?>
<?php } ?>
<form name="forma" method="post" enctype="multipart/form-data">
  <table>
    <tr>
      <td class="tabletd1">&nbsp;</td>
      <td><?php echo $adminlang ?> *</td>
      <td><input type="text" name="language" size="50" maxlength="50" class="inputauto" required></td> 
      </tr>
    <tr>
      <td>&nbsp;</td>
      <td>Directory *</td>
      <td><input type="text" name="dir" size="12" maxlength="20" class="inputauto" required> 
      &nbsp;
        <a href="http://www.w3schools.com/Tags/ref_language_codes.asp" target="_blank" class="color3">&raquo; ISO Language codes</a></td> 
      </tr>
    </table>

     <hr>
  <div class="divallbuttons">
<div class="divlist"><a href="list-lang.php" title="<?php echo $adminlist ?>" class="icstyle1 color1"><span class="icon fa-tasks"></span></a></div>
<div class="divbuttons">
  <button type="submit" name="submit" class="button"><span class="icon fa-check"></span> <?php echo $adminsubmit ?></button>
  <button type="reset" name="reset" class="button buttondelete"><span class="icon fa-refresh"></span> <?php echo $adminreset ?></button> 
</div>
   </div>
   
</form> 
</div>
</div>
</div>

<?php include 'menudown.php';?>

</body>
</html>