<?php if(isset($_SESSION['uid'])){
    if(isset($_SESSION['lid'])){

include(BASE);
$quc = $dbc->query("SELECT COUNT(*) AS cus FROM `users` WHERE `lid`='0'");
$ruc = $quc->fetch_assoc();
$cus = $ruc['cus'];

$qbk = $dbc->query("SELECT COUNT(*) AS cbk FROM `users` WHERE `book`='1'");
$rbk = $qbk->fetch_assoc();
$cbk = $rbk['cbk'];

$qcf = $dbc->query("SELECT COUNT(*) AS ccf FROM `classifieds`");
$rcf = $qcf->fetch_assoc();
$ccf = $rcf['ccf'];

$qlc = $dbc->query("SELECT COUNT(*) AS clc FROM `user_online` WHERE `online`='1'");
$rlc = $qlc->fetch_assoc();
$clc = $rlc['clc'];

$dbc->close();

if($page == 'admin-dashboard'){ // dashboard
   

echo '<div class="col-container">';

echo '<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">';

include THM.$set['theme'].'/admin_sidebar.php';

echo '</div>';

echo '<div class="w3-col w3-container w3-rest w3-border col" style="float:none;width:100%;margin-left:300px;">';

echo '<h2 class="w3-text-bluepm w3-border-bottom"><i class="fa fa-dashboard"></i> '.$lng['admin_sb_dashboard'].'</h2>';

echo '<div class="w3-row w3-margin-top w3-margin-bottom">';

echo '<a href="admin-books.html">';
echo '<div class="w3-col l3 m6 s12 w3-margin-bottom" style="padding:2px;">';
echo '<div class="w3-container w3-bluepm w3-hover-seagreen w3-padding-16">';
echo '<div class="w3-left"><i class="fa fa-address-book-o w3-xxxlarge"></i></div>';
echo '<div class="w3-right">';
echo '<h3>'.$cbk.'</h3>';
echo '</div>';
echo '<div class="w3-clear"></div>';
echo '<h4>'.$lng['admin_sb_book'].'</h4>';
echo '</div></div>';
echo '</a>';

echo '<a href="admin-users.html">';
echo '<div class="w3-col l3 m6 s12 w3-margin-bottom" style="padding:2px;">';
echo '<div class="w3-container w3-bluepm w3-hover-seagreen w3-padding-16">';
echo '<div class="w3-left"><i class="fa fa-bullhorn w3-xxxlarge"></i></div>';
echo '<div class="w3-right">';
echo '<h3>'.$ccf.'</h3>';
echo '</div>';
echo '<div class="w3-clear"></div>';
echo '<h4>'.$lng['admin_sb_classifieds'].'</h4>';
echo '</div></div>';
echo '</a>';

echo '<a href="admin-users.html">';
echo '<div class="w3-col l3 m6 s12 w3-margin-bottom" style="padding:2px;">';
echo '<div class="w3-container w3-bluepm w3-hover-seagreen w3-padding-16">';
echo '<div class="w3-left"><i class="fa fa-users w3-xxxlarge"></i></div>';
echo '<div class="w3-right">';
echo '<h3>'.$cus.'</h3>';
echo '</div>';
echo '<div class="w3-clear"></div>';
echo '<h4>'.$lng['admin_sb_users'].'</h4>';
echo '</div></div>';
echo '</a>';

echo '<a href="admin-users.html">';
echo '<div class="w3-col l3 m6 s12 w3-margin-bottom" style="padding:2px;">';
echo '<div class="w3-container w3-bluepm w3-hover-seagreen w3-padding-16">';
echo '<div class="w3-left"><i class="fa fa-user-circle-o w3-xxxlarge"></i></div>';
echo '<div class="w3-right">';
echo '<h3>'.$clc.'</h3>';
echo '</div>';
echo '<div class="w3-clear"></div>';
echo '<h4>Online</h4>';
echo '</div>';
echo '</div></div>';
echo '</a>';

echo '</div></div>';
   
 }elseif($page == 'admin-books'){ // admin books
         include(BASE);
         $getinfobook = $dbc->query("SELECT * FROM `users` 
                                             WHERE `book`='1'") or die($dbc->error);

echo '<div class="col-container">';

echo '<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">';

include THM.$set['theme'].'/admin_sidebar.php';

echo '</div>';

echo '<div class="w3-col w3-container w3-rest w3-border col w3-margin-bottom" style="float:none;width:100%;margin-left:300px;">';

echo '<h2 class="w3-text-bluepm w3-border-bottom"><i class="fa fa-address-book-o"></i> '.$lng['admin_sb_book'].'</h2>';
$refpag = explode('pagina=', $_SERVER["REQUEST_URI"]);
$showpag = $refpag[1];

$targetpage = "admin-books.html";
$limit = 15;
$query = "SELECT COUNT(uid) AS num FROM users WHERE book='1'";
$total_pages = mysqli_fetch_array($dbc->query($query)) or die($dbc->error);
$total_pages = $total_pages['num'];
$stages = 2;
$var = $showpag;
$pagina = $dbc->real_escape_string($var);
if ($pagina) {
    $start = ($pagina - 1) * $limit;
} else {
    $start = 0;
}
$query1 = "SELECT * FROM users WHERE book='1' AND lid='0' LIMIT $start, $limit";
$result = $dbc->query($query1) or die($dbc->error);
if ($pagina == 0) {
    $pagina = 1;
}

require_once($_SERVER["DOCUMENT_ROOT"].PATH.'themes/'.$set['theme'].'/paginations/paginate.php');

echo '<div class="w3-row w3-bluepm" style="margin-bottom:2px;">';
echo '<div class="w3-col l3 m3 s6 w3-container">Nume de familie</div>';
echo '<div class="w3-col l2 m3 s6">Prenume</div>';
echo '<div class="w3-col l4 m3 w3-hide-small">Status Pagină</div>';
echo '<div class="w3-col l2 m3 w3-hide-small w3-center">Scor</div>';
echo '<div class="w3-col l1 m3 w3-hide-small w3-right w3-center">Vezi</div>';
echo '</div>';


while($rwusr = $result->fetch_array()){

$cuchmp = $dbc->query("SELECT COUNT(*) 
                                AS cucbk 
                              FROM `champions` 
                             WHERE `uid`='".$rwusr['uid']."'");
$curch = $cuchmp->fetch_assoc();
$cucch = $curch['cucbk'];
$procent_chmp = '10';

$cupair = $dbc->query("SELECT COUNT(*) 
                                AS cuprc 
                              FROM `pairs` 
                             WHERE `uid`='".$rwusr['uid']."'");
$curpr = $cupair->fetch_assoc();
$cucpr = $curpr['cuprc'];
$procent_pair = '5';

$scor_champ = $cucch * $procent_chmp;
$scor_pairs = $cucpr * $procent_pair;
$scor_total = $scor_champ + $scor_pairs;

$resgetdetusr = $dbc->query("SELECT * 
                                 FROM `user_details` 
                                 WHERE `uid`={$rwusr['uid']} 
                                 LIMIT 1");
$rwudet = $resgetdetusr->fetch_assoc();
    
echo '<div class="w3-row w3-large w3-hover-light-gray w3-card" style="margin-bottom:5px;">';
if(!empty($rwusr['last_name'])){
echo '<div class="w3-col l3 m3 s5 w3-container"><h5>'.$rwusr['last_name'].'</h5></div>';
   }else{
    echo '<div class="w3-col l2 m3 s5 w3-container"><h5>-</h5></div>';
   }
if(!empty($rwusr['first_name'])){
echo '<div class="w3-col l2 m3 s6"><h5>'.$rwusr['first_name'].'</h5></div>';
   }else{
     echo '<div class="w3-col l2 m3 s6"><h5>-</h5></div>';
   }
echo '<div class="w3-col l4 m3 w3-hide-small">';

echo '<h5>Campioni('.$cucch.'/5), Perechi('.$cucpr.'/10)</h5>';


echo '</div>';

echo '<div class="w3-col l2 m3 w3-hide-small">';
echo '<div class="w3-section w3-pale-red w3-tiny"><div class="w3-container w3-padding-tiny w3-green w3-center" style="width:'.$scor_total.'%">'.$scor_total.'%</div></div>';
echo '</div>';

echo '<div class="w3-col l1 m3 w3-hide-small w3-center">';
echo '<a target="_blank" href="'.$rwudet['seo'].'.html" title="Pagina lui '.$rwusr['first_name'].' cu un scor de '.$scor_total.'%"><h5><i class="fa fa-eye w3-text-bluepm w3-hover-text-seagreen"></i></h5></a>';
echo '</div>';

      
echo '</div>';
 }
echo '<div class="w3-col l12 m12 s12 w3-center w3-margin-bottom">'.$paginate.'</div>';
$dbc->close();



echo '</div></div>';

   }elseif($page == 'admin-users'){ // admin users       

echo '<div class="col-container">';

echo '<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">';

include THM.$set['theme'].'/admin_sidebar.php';

echo '</div>';

echo '<div class="w3-col w3-container w3-rest w3-border col" style="float:none;width:100%;margin-left:300px;">';

echo '<h2 class="w3-text-bluepm w3-border-bottom"><i class="fa fa-users"></i> Utilizatori</h2>';

echo '<div class="w3-row w3-margin-top w3-margin-bottom">';
?>
<div class="w3-row">
<div class="w3-container w3-bluepm">
<div class="w3-left">
<a class="w3-button w3-hover-bluepm">
<i class="fa fa-user-plus w3-xlarge"></i> Adaugă utilizator</a>
</div>
<div class="w3-right">
<a class="toggler" data-form="1">
<i class="fa fa-plus w3-button w3-hover-seagreen w3-xlarge showhide"></i></a>
</div>
</div>

<?php
if(isset($afuadded)){    
    echo '<div class="w3-row w3-green">';
    echo '<div class="w3-col l12 m12 s12 w3-container w3-center">'.$afuadded.'</div>';
    echo '</div>';
 }elseif(isset($afuNotadded)){    
    echo '<div class="w3-row w3-red">';
    echo '<div class="w3-col l12 m12 s12 w3-container w3-center">'.$afuNotadded.'</div>';
    echo '</div>';
 }
 
 if(isset($afnot)){    
     echo '<div class="w3-row w3-red">';
     echo '<div class="w3-col l12 m12 s12 w3-container w3-center">'.$afnot.'</div>';
     echo '</div>';
 }

if(isset($err_fn)){    
    echo '<div class="w3-row w3-red">';
    echo '<div class="w3-col l12 m12 s12 w3-container w3-center">'.$err_fn.'</div>';
    echo '</div>';
 }
if(isset($err_ue)){    
     echo '<div class="w3-row w3-red">';
     echo '<div class="w3-col l12 m12 s12 w3-container w3-center">'.$err_ue.'</div>';
     echo '</div>';
 }
if(isset($userexist)){    
     echo '<div class="w3-row w3-red">';
     echo '<div class="w3-col l12 m12 s12 w3-container w3-center">'.$userexist.'</div>';
     echo '</div>';
 }
if(isset($err_role)){    
     echo '<div class="w3-row w3-red">';
     echo '<div class="w3-col l12 m12 s12 w3-container w3-center">'.$err_role.'</div>';
     echo '</div>';
 }
if(isset($respassdone)){    
    echo '<div class="w3-row w3-green">';
    echo '<div class="w3-col l12 m12 s12 w3-container w3-center">'.$respassdone.'</div>';
    echo '</div>';
 }elseif(isset($respassfail)){    
    echo '<div class="w3-row w3-red">';
    echo '<div class="w3-col l12 m12 s12 w3-container w3-center">'.$respassfail.'</div>';
    echo '</div>';
 }
?>
<div class="form1 w3-card w3-light-gray" style="display:none;">

<form action="" method="post" autocomplete="off">
  
  <div class="w3-row w3-margin-bottom">
  <div class="w3-col l4 m6 s12" style="padding:2px;">
  <label>Prenume <span class="w3-text-red">*</span></label>
  <input class="w3-input w3-border" name="first_name" type="text" placeholder="Introduceți Prenumele.." required="" value="<?php if(isset($_POST['first_name'])){echo $_POST['first_name'];}?>"/>
  </div>
  
  <div class="w3-col l4 m6 s12" style="padding:2px;">
  <label>Numele de familie</label>
  <input class="w3-input w3-border" name="last_name" type="text" placeholder="Introduceți Numele.." value="<?php if(isset($_POST['last_name'])){echo $_POST['last_name'];}?>"/>
  </div>
  
  <div class="w3-col l4 m6 s12" style="padding:2px;">
  <label>Adresa de e-mail <span class="w3-text-red">*</span></label>
  <input class="w3-input w3-border" name="user_email" type="email" placeholder="Introduceți adresa de e-mai.." required="" value="<?php if(isset($_POST['user_email'])){echo $_POST['user_email'];}?>"/>
  </div>
  </div>
  
  <div class="w3-row w3-margin-bottom">
  <div class="w3-col l6 m6 s12" style="padding:2px;">
  <label>Site Web</label>
  <input class="w3-input w3-border" name="user_website" type="url" placeholder="Introduceți Site Web în format URL.." value="<?php if(isset($_POST['user_website'])){echo $_POST['user_website'];}?>"/>
  </div>
  
  <div class="w3-col l2 m6 s12" style="padding:2px;">
  <label>Este</label>
  <select class="w3-select w3-border" name="gender">
<?php
if(isset($_POST['gender']) == 1){
    echo '<option value="" disabled="">Selectați genul</option>';
    echo '<option value="2">Femeie</option>';
    echo '<option value="1" selected="">Bărbat</option>';
}
elseif(isset($_POST['gender']) == 2){
    echo '<option value="" disabled="">Selectați genul</option>';
    echo '<option value="2" selected="">Femeie</option>';
    echo '<option value="1">Bărbat</option>';
}
if(empty($_POST['gender'])){
    echo '<option value="" selected="" disabled="">Selectați genul</option>';
    echo '<option value="2">Femeie</option>';
    echo '<option value="1">Bărbat</option>';
}
?>
    
  </select>  
  </div>
  
  <div class="w3-col l2 m6 s12" style="padding:2px;">
  <label>Data nașterii</label>
  <input class="w3-input w3-border" type="dateb" name="birthday" placeholder="Ex. 1950-02-10" value="<?php if(isset($_POST['birthday'])){echo $_POST['birthday'];}?>"/>  
  </div>
  
  <div class="w3-col l2 m6 s12" style="padding:2px;">
  <label>Rol pe site <span class="w3-text-red">*</span></label>
  <select class="w3-select w3-border" name="role">
<?php
if(isset($_POST['role']) == 1){
    echo '<option value="" disabled="">Selectați un rol</option>';
    echo '<option value="1" selected="">Utilizator</option>';
    echo '<option value="2">Admin</option>';
}
elseif(isset($_POST['role']) == 2){
    echo '<option value="" disabled="">Selectați un rol</option>';
    echo '<option value="1">Utilizator</option>';
    echo '<option value="2" selected="">Admin</option>';
}
if(empty($_POST['role'])){
    echo '<option value="" selected="" disabled="">Selectați un rol</option>';
    echo '<option value="1">Utilizator</option>';
    echo '<option value="2">Admin</option>';
}
?>    
  </select>  
  </div>
  </div>
  
  <div class="w3-row w3-margin-bottom">
  <div class="w3-col l4 m6 s12 w3-hide" style="padding:2px;">
  <label>Telefon</label>
  <input class="w3-input w3-border" type="tel" name="phone" placeholder="Introduceți numărul de telefon..." value="<?php if(isset($_POST['phone'])){echo $_POST['phone'];}?>"/>
  </div>
  
  <div class="w3-col l4 m6 s12 w3-hide" style="padding:2px;">
  <label>Fax</label>
  <input class="w3-input w3-border" type="tel" name="fax" placeholder="Introduceți numărul de fax..." value="<?php if(isset($_POST['fax'])){echo $_POST['fax'];}?>"/>
  </div>
  
  <div class="w3-col l4 m6 s12" style="padding:2px;">
  <label>Mobil</label>
  <input class="w3-input w3-border" type="tel" name="mobile" placeholder="Introduceți numărul de mobil..." value="<?php if(isset($_POST['mobile'])){echo $_POST['mobile'];}?>"/>
  </div>
  </div>
  
  <div class="w3-row">
  <div class="w3-col l12 m12 s12 w3-center w3-margin-bottom" style="padding:2px;"> 
  <button class="w3-button w3-bluepm w3-hover-seagreen">Adăugați în baza de date</button>
  </div>
  </div>

<?php
function randomPassword() {
    $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
    $pass = array(); //remember to declare $pass as an array
    $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
    for ($i = 0; $i < 8; $i++) {
        $n = rand(0, $alphaLength);
        $pass[] = $alphabet[$n];
    }
    return implode($pass); //turn the array into a string
}
$password = randomPassword();

$activate = md5(uniqid(rand(), true));
?>
<input type="hidden" name="pass" value="<?=$password?>"/>
<input type="hidden" name="activate" value="<?=$activate?>"/>
<input type="hidden" name="alid" value="<?=$_SESSION['lid']?>"/>
<input type="hidden" name="admadduser" value="true"/>
</form> 


</div>
</div>

<?php
include(BASE);
//$resgetusr = $dbc->query("SELECT * FROM `users`");

$refpag = explode('pagina=', $_SERVER["REQUEST_URI"]);
$showpag = $refpag[1];

$targetpage = "admin-users.html";
$limit = 15;
$query = "SELECT COUNT(uid) AS num FROM users WHERE lid='0'";
$total_pages = mysqli_fetch_array($dbc->query($query)) or die($dbc->error);
$total_pages = $total_pages['num'];
$stages = 2;
//$var = isset($_GET['pagina']) ? $_GET['pagina'] : '';
$var = $showpag;
$pagina = $dbc->real_escape_string($var);
if ($pagina) {
    $start = ($pagina - 1) * $limit;
} else {
    $start = 0;
}
$query1 = "SELECT * FROM users WHERE lid='0' LIMIT $start, $limit";
$result = $dbc->query($query1) or die($dbc->error);
if ($pagina == 0) {
    $pagina = 1;
}


require_once($_SERVER["DOCUMENT_ROOT"].PATH.'themes/'.$set['theme'].'/paginations/paginate.php');

echo '<div class="w3-border w3-margin-top w3-margin-bottom">';

if(isset($approvedafok)){
    echo '<div class="w3-col l12 m12 s12 w3-center w3-green">'.$approvedafok.'</div>';
   }

$ref = explode('status=', $_SERVER["REQUEST_URI"]);
$msgtousrsent = $ref[1];

if($msgtousrsent){
echo '<div class="w3-col l12 m12 s12 w3-center w3-green"> <i class="fa fa-check"></i> Mesaj trimis</div>';
   }elseif(isset($msgtousrnotsent)){
echo '<div class="w3-col l12 m12 s12 w3-center w3-red"> <i class="fa fa-remove"></i> Mesajul nu a fost trimis</div>';
   }
   
echo '<div class="w3-row w3-bluepm" style="margin-bottom:2px;">';
//echo '<div class="w3-col l1 w3-hide-small w3-hide-medium w3-container">ID</div>';
//echo '<div class="w3-col l2 m1 w3-hide-small w3-hide-medium w3-container">Rol</div>';
//echo '<div class="w3-col l1 m1 w3-hide-small w3-container">Gen</div>';
echo '<div class="w3-col l3 m3 s6 w3-container">Nume de familie</div>';
echo '<div class="w3-col l3 m3 s6">Prenume</div>';
echo '<div class="w3-col l4 m3 w3-hide-small">Utilizator</div>';
echo '<div class="w3-col l2 m3 w3-hide-small w3-right"></div>';
echo '</div>';

while($rwusr = $result->fetch_array()){
    $resgetdetusr = $dbc->query("SELECT * 
                                 FROM `user_details` 
                                 WHERE `uid`={$rwusr['uid']} 
                                 LIMIT 1");
    $rwudet = $resgetdetusr->fetch_assoc();
    
echo '<div class="w3-row w3-large w3-hover-light-gray w3-card" style="margin-bottom:5px;">';
//echo '<div class="w3-col l1 m1 w3-hide-small w3-hide-medium w3-container">'.$rwusr['uid'].'</div>';
if($rwusr['lid'] == 0){
//echo '<div class="w3-col l2 m1 w3-hide-small w3-hide-medium w3-container">Utilizator</div>';
 }elseif($rwusr['lid'] == 1){
    //echo '<div class="w3-col l2 m1 w3-hide-small w3-hide-medium w3-container">Admin</div>';
 }elseif($rwusr['lid'] == 2){
    //echo '<div class="w3-col l2 m1 w3-hide-small w3-hide-medium w3-container">Super-Admin</div>';
 }
//if($rwusr['sex'] == 1){
//echo '<div class="w3-col l1 m1 w3-hide-small w3-container">Masculin</div>';
// }elseif($rwusr['sex'] == 2){
//    echo '<div class="w3-col l1 m1 w3-hide-small w3-container">Feminin</div>';
// }else{
//    echo '<div class="w3-col l1 m1 w3-hide-small w3-container">nedefinit</div>';
// }

if(!empty($rwusr['last_name'])){
echo '<div class="w3-col l3 m3 s5 w3-container">'.$rwusr['last_name'].'</div>';
   }else{
    echo '<div class="w3-col l2 m3 s5 w3-container">-</div>';
   }
if(!empty($rwusr['first_name'])){
echo '<div class="w3-col l3 m3 s6">'.$rwusr['first_name'].'</div>';
   }else{
     echo '<div class="w3-col l3 m3 s6">-</div>';
   }
echo '<div class="w3-col l4 m3 w3-hide-small">';
echo '<a style="text-decoration:none;" href="'.BASE_URL.PATH.$rwusr['user_name'].'.html" target="_blank">';
echo $rwusr['user_name'];
echo '</a></div>';

echo '<div class="w3-col l2 m3 s1">';

if($rwusr['confirmed'] !== NULL){
    
    echo '<div class="w3-large w3-right">';
    
echo '<i class="fa fa-at w3-text-red w3-col l6 m6 s6" title="Acest utilizator nu a confirmat adresa de e-mail" style="margin-top:5px;margin-left:-25px;"></i>
<form action="" method="POST" style="" class="w3-col l6 m6 s6">
<button class="w3-button w3-padding-small w3-small w3-white w3-hover-seagreen" type="submit" title="Retrimitere link de activare" style="margin:0;padding:1px;"> <i class="fa fa-paper-plane-o"></i> </button>
<input type="hidden" name="confirm_code" value="'.$confirmationcode.'">
<input type="hidden" name="usrID" value="'.$rwusr['uid'].'">
<input type="hidden" name="adminusrcoderesend" value="true">
</form>

</div>';

 }elseif(($rwusr['confirmed'] == NULL) && 
        ($rwusr['approved'] == 0) && 
        ($rwusr['rejected'] == 0)){

echo '<form action="" method="POST">';
echo '<button class="w3-button w3-padding-small w3-green w3-hover-seagreen" type="submit" style="float:left;padding: 2px;">
      <i class="fa fa-check fa-fw"></i></button>';
echo '<input type="hidden" name="usrID" value="'.$rwusr['uid'].'"/>';
echo '<input type="hidden" name="aproveusrfa" value="true"/>';
echo '</form>';
      
echo '<button class="w3-button w3-padding-small w3-red w3-hover-seagreen" style="padding: 2px;">
      <i class="fa fa-remove fa-fw"></i></button>';
      
    }else{
      if($_SESSION['uid'] == $rwusr['uid']){
        echo '<a href="'.PATH.'myaccount.html" class="w3-button w3-padding-small w3-bluepm w3-hover-seagreen w3-right" title="Editez Profilul meu">
      <i class="fa fa-pencil-square-o"></i><span class="w3-hide">Contul meu</span></a>';
      }else{
        
echo '<a class="w3-button w3-padding-small toggler w3-right w3-hover-light-gray" data-form="'.$rwusr['uid'].'" style="padding: 2px;">';
echo '<i class="fa fa-plus fa-fw showhide"></i></a>';
        }
      }
      
echo '</div>';

echo '<div class="w3-col l12 m12 s12 w3-large form'.$rwusr['uid'].' w3-light-gray" style="display:none;">';

echo '<div class="w3-right w3-bar">';

if($rwusr['rejected'] == 1){
echo '<div class="w3-right" style="float:left;margin:0;padding:2px;">Refuzat</div>';

  }else{

if($rwusr['blocked'] == 1){   

echo '<form action="" method="POST">';
echo '<button class="w3-button w3-padding-small w3-white w3-hover-green w3-right" type="submit" title="Deblocare Utilizator" style="float:left;margin:0;padding:2px;margin-right:4px;"><i class="fa fa-fw fa-lock"></i></button>';
echo '<input type="hidden" name="usrID" value="'.$rwusr['uid'].'">';
echo '<input type="hidden" name="adminusrunblock" value="true">';
echo '</form>';

echo '<div class="w3-right" style="float:left;margin:0;padding:2px;">Blocat ('.$rwusr['b_reason'].')</div>';

  }else{


if($rwusr['lid'] == 0){

echo '<form action="" method="POST">';
echo '<button class="w3-button w3-padding-small w3-white w3-hover-black w3-right" type="submit" title="Ștergere Utilizator"><i class="fa fa-trash"></i></button>';
echo '<input type="hidden" name="usrID" value="'.$rwusr['uid'].'">';
echo '<input type="hidden" name="adminusrdelete" value="true">';
echo '</form>';
}


if($rwusr['lid'] == 0){
echo '<form action="" method="POST">';
echo '<button class="w3-button w3-padding-small w3-white w3-hover-black w3-right" type="submit" title="Blocare Utilizator"><i class="fa fa-ban"></i></button>';
echo '<input type="hidden" name="usrID" value="'.$rwusr['uid'].'">';
echo '<input type="hidden" name="adminusrblock" value="true">';
echo '</form>'; 
}

echo '<form action="" method="POST">';
echo '<button class="w3-button w3-padding-small w3-white w3-hover-seagreen w3-right" type="submit" title="Resetare Parolă" style="float:left;margin:0;padding:2px;"><i class="fa fa-key"></i></button>';
echo '<input type="hidden" name="pass" value="'.$password.'">';
echo '<input type="hidden" name="usrID" value="'.$rwusr['uid'].'">';
echo '<input type="hidden" name="adminusrpassreset" value="true">';
echo '</form>';

echo '<a class="w3-button w3-padding-small toggler w3-white w3-hover-seagreen w3-right" title="Trimite mesaj" data-form="msg'.$rwusr['uid'].'" style="float:left;padding: 2px;"><i class="fa fa-envelope-o"></i></a>';

if($rwusr['lid'] == 0){ // Eliminare editare admin
echo '<button class="w3-button w3-padding-small toggler w3-white w3-hover-seagreen w3-right" title="Editare Utilizator" data-form="edit'.$rwusr['uid'].'" style="float:left;padding: 2px;"><i class="fa fa-pencil-square-o"></i></button>';
   }

  }
  
  }
    
echo '</div>';


echo '<div class="w3-col l12 m12 s12 w3-large formedit'.$rwusr['uid'].' w3-white w3-card" style="display:none;">';

echo '<form action="" method="POST">'; ?>

<div class="w3-row w3-margin-bottom">
  <div class="w3-col l4 m6 s12" style="padding:2px;">
  <label>Prenume <span class="w3-text-red">*</span></label>
  <input class="w3-input w3-border" name="first_name" type="text" placeholder="Introduceți Prenumele.." required="" value="<?php if(isset($rwusr['first_name'])){echo $rwusr['first_name'];}?>"/>
  </div>
  
  <div class="w3-col l4 m6 s12" style="padding:2px;">
  <label>Numele de familie</label>
  <input class="w3-input w3-border" name="last_name" type="text" placeholder="Introduceți Numele de familie.." value="<?php if(isset($rwusr['last_name'])){echo $rwusr['last_name'];}?>"/>
  </div>
  
  <div class="w3-col l4 m6 s12" style="padding:2px;">
  <label>Adresa de e-mail <span class="w3-text-red">*</span></label>
  <input class="w3-input w3-border" name="user_email" type="email" placeholder="Introduceți adresa de e-mail.." required="" value="<?php if(isset($rwusr['email'])){echo $rwusr['email'];}?>"/>
  </div>
  </div>
  
  <div class="w3-row w3-margin-bottom">
  <div class="w3-col l6 m6 s12" style="padding:2px;">
  <label>Site Web</label>
  <input class="w3-input w3-border" name="user_website" type="url" placeholder="Introduceți adresa URL a site-ului web.." value="<?php if(isset($rwudet['url'])){echo $rwudet['url'];}?>"/>
  </div>
  
  <div class="w3-col l2 m6 s12" style="padding:2px;">
  <label>Gen</label>
  <select class="w3-select w3-border" name="gender">
<?php
if(isset($rwusr['sex']) == 1){
    echo '<option value="" disabled="">Selectați un gen</option>';
    echo '<option value="2">Feminin</option>';
    echo '<option value="1" selected="">Masculin</option>';
}
elseif(isset($rwusr['sex']) == 2){
    echo '<option value="" disabled="">Selectați un gen</option>';
    echo '<option value="2" selected="">Feminin</option>';
    echo '<option value="1">Masculin</option>';
}
if(empty($rwusr['sex'])){
    echo '<option value="" selected="" disabled="">Selectați un gen</option>';
    echo '<option value="2">Feminin</option>';
    echo '<option value="1">Masculin</option>';
}
?>
    
  </select>  
  </div>
  
  <div class="w3-col l2 m6 s12" style="padding:2px;">
  <label>Data nașterii</label>
  <input class="w3-input w3-border" type="dateb" name="birthday" placeholder="Ex. 1950-02-10" value="<?php if(isset($rwusr['birthday'])){echo $rwusr['birthday'];}?>"/>  
  </div>
  
  <div class="w3-col l2 m6 s12" style="padding:2px;">
  <label>Rol pe site <span class="w3-text-red">*</span></label>
  <select class="w3-select w3-border" name="role">
<?php

if(isset($rwusr['lid']) !== 1){
    echo '<option value="" disabled="">Selectați un rol</option>';
    echo '<option value="1" selected="">Utilizator</option>';
    echo '<option value="2">Admin</option>';
    //echo '<option value="3">Super-Admin</option>';
 }elseif(isset($rwusr['lid']) > 0){
    echo '<option value="" disabled="">Selectați un rol</option>';
    echo '<option value="1">Utilizator</option>';
    echo '<option value="2" selected="">Admin</option>';
    //echo '<option value="3">Super-Admin</option>';
 }

?>    
  </select>  
  </div>
  </div>
  
  <div class="w3-row w3-margin-bottom">
  <div class="w3-col l4 m6 s12" style="padding:2px;">
  <label>Telefon</label>
  <input class="w3-input w3-border" type="tel" name="phone" placeholder="Introduceți numărul de telefon..." value="<?php if(isset($rwusr['phone'])){echo $rwusr['phone'];}?>"/>
  </div>
  
  <div class="w3-col l4 m6 s12" style="padding:2px;">
  <label>Fax</label>
  <input class="w3-input w3-border" type="tel" name="fax" placeholder="Introduceți numărul de fax..." value="<?php if(isset($rwusr['fax'])){echo $rwusr['fax'];}?>"/>
  </div>
  
  <div class="w3-col l4 m6 s12" style="padding:2px;">
  <label>Mobil</label>
  <input class="w3-input w3-border" type="tel" name="mobile" placeholder="Introduceți numărul de mobil..." value="<?php if(isset($rwusr['mobile'])){echo $rwusr['mobile'];}?>"/>
  </div>
  </div>
  
  <div class="w3-row">
  <div class="w3-col l12 m12 s12 w3-center w3-margin-bottom" style="padding:2px;"> 
  <button class="w3-button w3-bluepm w3-hover-seagreen">Actualizare</button>
  </div>
  </div>

<?php 
echo '<input type="hidden" name="usrID" value="'.$rwusr['uid'].'">';
echo '<input type="hidden" name="adminupdateusraf" value="true">';
echo '</form>';

echo '</div>';


echo '<div class="w3-col l12 m12 s12 w3-large formmsg'.$rwusr['uid'].' w3-white w3-card" style="display:none;">';
echo '<form action="" method="POST">';
echo '<div class="w3-margin">';
echo '<textarea class="w3-input w3-border" name="msgtousr" rows="5" placeholder="Scrie mesajul ce va fi trimis..." style="white-space: pre-line;">';
if(isset($_POST['msgtousr'])){echo $_POST['msgtousr'];}
echo '</textarea>';
echo '<div class="w3-center w3-margin-top">';
echo '<button class="w3-button w3-blue w3-hover-green" type="submit"><i class="fa fa-envelope"></i> Trimite mesaj</button>';
echo '</div>';
echo '<input type="hidden" name="usrID" value="'.$rwusr['uid'].'">';
echo '<input type="hidden" name="adminmsgtousraform" value="true">';
echo '</div></form></div>';

echo '</div>';

echo '</div>';

   }
echo '<div class="w3-col l12 m12 s12 w3-center">'.$paginate.'</div>';
echo '</div>';
$dbc->close();
?>


</div>

</div>

</div>

<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script>
$(document).ready(function(){
    $(".toggler").click(function(e){
        e.preventDefault();
        $('.form'+$(this).attr('data-form')).toggle();                
    });
    
    $('.showhide').click(function() {
    $(this).toggleClass('fa-plus w3-hover-blue');
    $(this).toggleClass('fa-minus w3-red w3-hover-red');
    });

 });
</script>
<?php
   }elseif($page == 'admin-countries'){ // admin countries
          ?>

<style>
.col-container {
    display: table; /* Make the container element behave like a table */
    width: 100%; /* Set full-width to expand the whole page */
}

.col {
    display: table-cell; /* Make elements inside the container behave like table cells */
}
</style>

<div class="col-container">

<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">
<?php include THM.$set['theme'].'/admin_sidebar.php';?>
</div>

<div class="w3-col w3-container w3-rest w3-border col" style="float:none;width:100%;margin-left:300px;">

<h2 class="w3-text-bluepm w3-border-bottom"><i class="fa fa-flag"></i> Countries</h2>

<div class="w3-row w3-bluepm w3-margin-top w3-card">
<div class="w3-col w3-container l1 m2 s12"><h6>ID</h6></div>
<div class="w3-col w3-container l1 m2 s12"><h6>Cod</h6></div>
<div class="w3-col w3-container l8 m4 s12"><h6>Țara</h6></div>
<div class="w3-col w3-container l2 m4 s12"><h6>Acțiuni</h6></div>
</div>

<?php
include(BASE);
$getcountrylist = $dbc->query("SELECT * FROM `countries`") or die($dbc->error);
while($rctr = $getcountrylist->fetch_assoc()){
?>

<div class="w3-row w3-margin-bottom w3-card">
<div class="w3-col w3-container l1 m2 s12"><?=$rctr['country_id']?></div>
<div class="w3-col w3-container l1 m2 s12"><?=$rctr['country_code']?></div>
<div class="w3-col w3-container l8 m4 s12"><?=$rctr['country_name']?></div>
<div class="w3-col w3-container l2 m4 s12">
<i class="fa fa-eye"></i> <i class="fa fa-pencil-square-o"></i> <i class="fa fa-remove"></i>
</div>
</div>
<?php } ?>

</div>

</div>
         

<?php
   }elseif($page == 'admin-counties'){ // admin counties
          ?>

<style>
.col-container {
    display: table; /* Make the container element behave like a table */
    width: 100%; /* Set full-width to expand the whole page */
}

.col {
    display: table-cell; /* Make elements inside the container behave like table cells */
}
</style>

<div class="col-container">

<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">
<?php include THM.$set['theme'].'/admin_sidebar.php';?>
</div>

<div class="w3-col w3-container w3-rest w3-border col" style="float:none;width:100%;margin-left:300px;">

<h2 class="w3-text-bluepm w3-border-bottom"><i class="fa fa-map-marker"></i> Counties</h2>

<div class="w3-row w3-bluepm w3-margin-top w3-card">
<div class="w3-col w3-container l1 m1 s12"><h6>ID</h6></div>
<div class="w3-col w3-container l1 m1 s12"><h6>CID</h6></div>
<div class="w3-col w3-container l1 m2 s12"><h6>Cod</h6></div>
<div class="w3-col w3-container l7 m4 s12"><h6>Județ</h6></div>
<div class="w3-col w3-container l2 m4 s12"><h6>Acțiuni</h6></div>
</div>

<?php
include(BASE);
$getcountylist = $dbc->query("SELECT * FROM `counties`") or die($dbc->error);
while($rct = $getcountylist->fetch_assoc()){
?>

<div class="w3-row w3-margin-bottom w3-card">
<div class="w3-col w3-container l1 m1 s12"><?=$rct['cnty_id']?></div>
<div class="w3-col w3-container l1 m1 s12"><?=$rct['country_id']?></div>
<div class="w3-col w3-container l1 m2 s12"><?=$rct['code']?></div>
<div class="w3-col w3-container l7 m4 s12"><?=$rct['county_name']?></div>
<div class="w3-col w3-container l2 m4 s12">
<i class="fa fa-eye"></i> <i class="fa fa-pencil-square-o"></i> <i class="fa fa-remove"></i>
</div>
</div>
<?php } ?>

</div>

</div>
         

<?php
   }elseif($page == 'admin-categories'){ // admin categories
          ?>

<style>
.col-container {
    display: table; /* Make the container element behave like a table */
    width: 100%; /* Set full-width to expand the whole page */
}

.col {
    display: table-cell; /* Make elements inside the container behave like table cells */
}
</style>

<div class="col-container">

<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">
<?php include THM.$set['theme'].'/admin_sidebar.php';?>
</div>

<div class="w3-col w3-container w3-rest w3-border col" style="float:none;width:100%;margin-left:300px;">

<h2 class="w3-text-bluepm w3-border-bottom"><i class="fa fa-th-large"></i> Categories</h2>

<div class="w3-row w3-margin-top w3-margin-bottom">


<h2 class="w3-center w3-text-gray">You not have acces on this area!</h2>



</div>

</div>

</div>
         

<?php
   }elseif($page == 'admin-subcategories'){ // admin subcategories
          ?>

<style>
.col-container {
    display: table; /* Make the container element behave like a table */
    width: 100%; /* Set full-width to expand the whole page */
}

.col {
    display: table-cell; /* Make elements inside the container behave like table cells */
}
</style>

<div class="col-container">

<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">
<?php include THM.$set['theme'].'/admin_sidebar.php';?>
</div>

<div class="w3-col w3-container w3-rest w3-border col" style="float:none;width:100%;margin-left:300px;">

<h2 class="w3-text-bluepm w3-border-bottom"><i class="fa fa-th"></i> Subcategories</h2>

<div class="w3-row w3-margin-top w3-margin-bottom">



<h2 class="w3-center w3-text-gray">You not have acces on this area!</h2>


</div>

</div>

</div>
         

<?php
   }elseif($page == 'admin-languages'){ // admin languages
include(BASE);         
$getlangcode = $dbc->query("SELECT * FROM `languages` ORDER BY `lang_id` ASC") or die($dbc->error);
$dbc->close();
?>

<style>
.col-container {
    display: table; /* Make the container element behave like a table */
    width: 100%; /* Set full-width to expand the whole page */
}

.col {
    display: table-cell; /* Make elements inside the container behave like table cells */
}
</style>

<div class="col-container">

<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">
<?php include THM.$set['theme'].'/admin_sidebar.php';?>
</div>

<div class="w3-col w3-container w3-rest w3-border col" style="float:none;width:100%;margin-left:300px;">

<h2 class="w3-text-bluepm w3-border-bottom"><i class="fa fa-language"></i> Traduceri</h2>

<div class="w3-row-padding w3-margin-top w3-margin-bottom">

<?php 

// Error Response
if(isset($err_vC)){
echo '<div class="w3-panel w3-red"><p>'.$err_vC.'</p></div>';
  }
  if(isset($err_NA)){
echo '<div class="w3-panel w3-red"><p>'.$err_NA.'</p></div>';
  }
  
// Succes Response
if(isset($updatelangsucces)){
echo '<div class="w3-panel w3-green"><p>'.$updatelangsucces.'</p></div>';
  }
  
include(BASE);
$getisforen = $dbc->query("SELECT DISTINCT(`is_for`) FROM `lang_content` WHERE `lang_id`='1' ORDER BY `is_for` ASC") or die($db->error);

$getisforro = $dbc->query("SELECT DISTINCT(`is_for`) FROM `lang_content` WHERE `lang_id`='2' ORDER BY `is_for` ASC") or die($db->error);
  
$getlangcontens = $dbc->query("SELECT * FROM `lang_content` ORDER BY `langc_id` ASC") or die($dbc->error);
$rowlcs = array();
while($rowlc = $getlangcontens->fetch_assoc()){
    $rowlcs[] = $rowlc;
 }
$dbc->close();

echo '<div class="w3-bar w3-seagreen">';
echo '<button class="w3-bar-item w3-button tablink w3-bluepm w3-hover-bluepm" onclick="openSet(event,\'en\')">Engleză</button>';
echo '<button class="w3-bar-item w3-button tablink w3-hover-bluepm" onclick="openSet(event,\'ro\')">Română</button>';
echo '</div>';

echo '<div id="en" class="w3-container w3-border set">';
echo '<h2>Limba engleză</h2>';

 

foreach($getisforen as $gfor){
    echo '<h3 onclick="document.getElementById(\'editlc'.$gfor['is_for'].'\').style.display=\'block\'" style="cursor:pointer;" class="w3-bluepm w3-container">'.str_replace('_', ' ', ucfirst($gfor['is_for'])).'</h3>'; ?>
    
    
    <!-- Modal -->
<div id="editlc<?=$gfor['is_for']?>" class="w3-modal" style="z-index:1007;margin-top:0px;"> <!-- 1 -->

<div class="w3-modal-content w3-animate-top" style="width:1200px;max-width:100%;margin:auto;"> <!-- 2 -->

<span onclick="document.getElementById('editlc<?=$gfor['is_for']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row w3-bluepm">
<h4 class="w3-container "><?=$gfor['is_for']?></h4>
</div>

<div class="w3-row-padding w3-margin-top w3-center">
<?php 
foreach($rowlcs as $rowlc) {
if(($rowlc['is_for'] == $gfor['is_for']) && ($rowlc['lang_id'] == '1')){
    echo '<form action="" method="post">';
echo '<input class="w3-input w3-card w3-col l5 m5 s5" value="'.$rowlc['name'].'" disabled="">';                
echo '<input class="w3-input w3-card w3-col l5 m5 s5" name="valContent" value="'.$rowlc['value'].'">';
echo '<button class="w3-button w3-block w3-bluepm w3-hover-seagreen w3-col l2 m2 s2 w3-card">Salvare</button>';
echo '<input type="hidden" name="languageID" value="'.$rowlc['langc_id'].'">';
echo '<input type="hidden" name="LID" value="'.$_SESSION['lid'].'">';
echo '<input type="hidden" name="changelangcontent" value="true">';
echo '</form>';
  }         
 }  
?>
</div>

</div>
</div>
    
  <?php  
    
        
   }

echo '</div>';


echo '<div id="ro" class="w3-container w3-border set" style="display:none">';
echo '<h2>Limba română</h2>';


foreach($getisforro as $gfor){
    echo '<h3 onclick="document.getElementById(\'editlcro'.$gfor['is_for'].'\').style.display=\'block\'" style="cursor:pointer;" class="w3-bluepm w3-container">'.str_replace('_', ' ', ucfirst($gfor['is_for'])).'</h3>'; ?>
    
    
    <!-- Modal -->
<div id="editlcro<?=$gfor['is_for']?>" class="w3-modal" style="z-index:1007;margin-top:0px;"> <!-- 1 -->

<div class="w3-modal-content w3-animate-top" style="width:1200px;max-width:100%;margin:auto;"> <!-- 2 -->

<span onclick="document.getElementById('editlcro<?=$gfor['is_for']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row w3-bluepm">
<h4 class="w3-container "><?=$gfor['is_for']?></h4>
</div>

<div class="w3-row-padding w3-margin-top w3-center">
<?php 
foreach($rowlcs as $rowlc) {
if(($rowlc['is_for'] == $gfor['is_for']) && ($rowlc['lang_id'] == '2')){
    echo '<form action="" method="post">';
echo '<input class="w3-input w3-card w3-col l5 m5 s5" value="'.$rowlc['name'].'" disabled="">';                
echo '<input class="w3-input w3-card w3-col l5 m5 s5" name="valContent" value="'.$rowlc['value'].'">';
echo '<button class="w3-button w3-block w3-bluepm w3-hover-seagreen w3-col l2 m2 s2 w3-card">Salvare</button>';
echo '<input type="hidden" name="languageID" value="'.$rowlc['langc_id'].'">';
echo '<input type="hidden" name="LID" value="'.$_SESSION['lid'].'">';
echo '<input type="hidden" name="changelangcontent" value="true">';
echo '</form>';
  }         
 }  
?>
</div>

</div>
</div>
    
  <?php  
    
        
   }


//if($getlangcode->num_rows > 0){
//while($rwlangs = $getlangcode->fetch_assoc()){
 //   $langscode = $rwlangs['lang_code'];
 //   $langsgtID = $rwlangs['lang_id'];
 
 //   }
 //}
 ?>

</div>

</div>

</div>
         

<?php

echo '<script>';
echo 'function openSet(evt, setName) {';
echo 'var i, x, tablinks;';
echo 'x = document.getElementsByClassName("set");';
echo 'for (i = 0; i < x.length; i++) {';
echo 'x[i].style.display = "none";';
echo '}';
echo 'tablinks = document.getElementsByClassName("tablink");';
echo 'for (i = 0; i < x.length; i++) {';
echo 'tablinks[i].className = tablinks[i].className.replace(" w3-bluepm", "");';
echo '}';
echo 'document.getElementById(setName).style.display = "block";';
echo 'evt.currentTarget.className += " w3-bluepm";';
echo '}';
echo '</script>';

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

   }elseif($page == 'admin-newsletter'){ // admin newsletter
          ?>

<style>
.col-container {
    display: table; /* Make the container element behave like a table */
    width: 100%; /* Set full-width to expand the whole page */
}

.col {
    display: table-cell; /* Make elements inside the container behave like table cells */
}
</style>

<div class="col-container">

<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">
<?php include THM.$set['theme'].'/admin_sidebar.php';?>
</div>

<div class="w3-col w3-container w3-rest w3-border col" style="float:none;width:100%;margin-left:300px;">

<h2 class="w3-text-bluepm w3-border-bottom"><i class="fa fa-newspaper-o"></i> Buletin informativ</h2>

<div class="w3-row w3-margin-top w3-margin-bottom">

<?php if(isset($sentok)){?>
<div class="w3-row-padding">
<div class="w3-col l12 m12 s12 w3-panel w3-seagreen">
<h5 class="w3-container"><?=$sentok?></h5></div>
</div>
<?php } 
if(isset($sentNot)){?>
<div class="w3-row-padding">
<div class="w3-col l12 m12 s12 w3-panel w3-red">
<h5 class="w3-container"><?=$sentNot?></h5></div>
</div>
<?php } ?>

<form action="" method="POST">

<div class="w3-row-padding w3-margin-bottom">
<div class="w3-col l6 m6 s12">
<input class="w3-input w3-border" type="text" name="subjectnews" placeholder="Subiect"/>
</div>

<div class="w3-col l6 m6 s12">
<input class="w3-check" type="checkbox" name="check_subscriber"/>
<label>Trimite doar la abonați</label>
</div>
</div>

<div class="w3-row-padding w3-margin-bottom">
<div class="w3-col l12 m12 s12">
<textarea class="w3-input w3-border" name="bodynewscontent" rows="7" placeholder="Mesaj..." style="white-space:pre-line;">
</textarea>
</div>
</div>

<div class="w3-row w3-center">
<button class="w3-button w3-bluepm w3-hover-seagreen w3-center" type="submit">Trimite mesaje</button>
</div>

<input type="hidden" name="uid" value="<?=$_SESSION['uid']?>"/>
<input type="hidden" name="sendnewsformadmin" value="true"/>
</form>




</div>

</div>

</div>
         

<?php
   }elseif($page == 'settings'){ // admin settings

      

echo '<div class="col-container">';

echo '<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">';

include THM.$set['theme'].'/admin_sidebar.php';

echo '</div>';

echo '<div class="w3-col w3-container w3-rest w3-border col" style="float:none;width:100%;margin-left:300px;">';

echo '<h2 class="w3-text-blue w3-border-bottom"><i class="fa fa-cogs"></i> Setări</h2>';

echo '<div class="w3-row w3-margin-top w3-margin-bottom">';

if(isset($ok)){
    echo '<div class="w3-col l12 w3-center w3-green" style="margin-bottom:2px;">'.$ok.'</div>';
  }elseif(isset($not)){
    echo '<div class="w3-col l12 w3-center w3-red" style="margin-bottom:2px;">'.$not.'</div>';
    }


if(isset($fileisimage)){
    echo '<div class="w3-col l12 w3-center w3-green" style="margin-bottom:2px;">'.$fileisimage.'</div>';
  }
  
if(isset($fileisnotimage)){
    echo '<div class="w3-col l12 w3-center w3-red" style="margin-bottom:2px;">'.$fileisnotimage.'</div>';
  }

if(isset($filexist)){
    echo '<div class="w3-col l12 w3-center w3-red" style="margin-bottom:2px;">'.$filexist.'</div>';
  }
  
if(isset($filetolarge)){
    echo '<div class="w3-col l12 w3-center w3-red" style="margin-bottom:2px;">'.$filetolarge.'</div>';
  }

if(isset($notalowed)){
    echo '<div class="w3-col l12 w3-center w3-red" style="margin-bottom:2px;">'.$notalowed.'</div>';
  }
  
if(isset($notupload)){
    echo '<div class="w3-col l12 w3-center w3-red" style="margin-bottom:2px;">'.$notupload.'</div>';
  }
  
if(isset($fileuploaded)){
    echo '<div class="w3-col l12 w3-center w3-green" style="margin-bottom:2px;">'.$fileuploaded.'</div>';
  }
  
if(isset($errortouploading)){
    echo '<div class="w3-col l12 w3-center w3-red" style="margin-bottom:2px;">'.$errortouploading.'</div>';
  }


echo '<div class="w3-bar w3-seagreen">';

echo '<button class="w3-bar-item w3-button tablink w3-bluepm w3-hover-bluepm" onclick="openSet(event,\'gen\')">Generale</button>';

echo '<button class="w3-bar-item w3-button tablink w3-hover-bluepm" onclick="openSet(event,\'mail\')">E-mail</button>';

echo '<button class="w3-bar-item w3-button tablink w3-hover-bluepm" onclick="openSet(event,\'seo\')">Webmaster</button>';

echo '<button class="w3-bar-item w3-button tablink w3-hover-bluepm" onclick="openSet(event,\'head\')">Mansardă</button>';

echo '<button class="w3-bar-item w3-button tablink w3-hover-bluepm" onclick="openSet(event,\'foot\')">Subsol</button>';

echo '<button class="w3-bar-item w3-button tablink w3-hover-bluepm" onclick="openSet(event,\'social\')">Social</button>';

echo '<button class="w3-bar-item w3-button tablink w3-hover-bluepm" onclick="openSet(event,\'maps\')">Hărți</button>';

echo '<button class="w3-bar-item w3-button tablink w3-hover-bluepm" onclick="openSet(event,\'terms\')">Termeni</button>';

echo '</div>';

// General Settings
echo '<div id="gen" class="w3-container w3-border set">';
echo '<h2>Setări Generale</h2>';

echo '<form action="" method="POST">';

echo '<div class="w3-col l6" style="padding:4px;">';
echo '<label>Nume site</label>';
echo '<input class="w3-input w3-border" type="text" name="site_name" placeholder="Introduceți numele site-ului..." value="';
if(isset($set['sitename'])){echo $set['sitename'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l6" style="padding:4px;">';
echo '<label>Nume domeniu</label>';
echo '<input class="w3-input w3-border" type="text" name="domain_name" placeholder="Introduceți numele de domeniu al site-ului..." value="';
if(isset($set['domain'])){echo $set['domain'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l6" style="padding:4px;">';
echo '<label>Adresa de e-mail</label>';
echo '<input class="w3-input w3-border" type="email" name="admin_mail" placeholder="Introdu adresa de e-mail a administratorului..." value="';
if(isset($set['email'])){echo $set['email'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l6" style="padding:4px;">';
echo '<label>Număr de mobil</label>';
echo '<input class="w3-input w3-border" type="tel" name="admin_mobile" placeholder="Introduceți numărul de mobil al adminului..." value="';
if(isset($set['mobil'])){echo $set['mobil'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l2 m3 s6" style="padding:4px;">';
echo '<label>www</label><br/>';
echo '<label class="switch">';
if(!empty($set['prefix'])){
echo '<input type="checkbox" checked="" value="1" name="prefix"/>';
  }else{
echo '<input type="checkbox" value="0" name="prefix"/>';
  } 
echo '<span class="slider"></span>';
echo '</label>';
echo '</div>';

echo '<div class="w3-col l2 m3 s6" style="padding:4px;">';
echo '<label>SSL</label><br/>';
echo '<label class="switch">';
if(!empty($set['https'])){
echo '<input type="checkbox" checked="" value="1" name="ssl"/>';
 }else{
echo '<input type="checkbox" value="0" name="ssl"/>';
 }
echo '<span class="slider"></span>';
echo '</label>';
echo '</div>';

echo '<div class="w3-col l2 m3 s6" style="padding:4px;">';
echo '<label>Înregistrare</label><br/>';
echo '<label class="switch">';
if(!empty($set['reg'])){
echo '<input type="checkbox" checked="" value="1" name="regusr"/>';
 }else{
echo '<input type="checkbox" value="0" name="regusr"/>';
 }
echo '<span class="slider"></span>';
echo '</label>';
echo '</div>';

// Translate
echo '<div class="w3-col l2 m3 s6" style="padding:4px;">';
echo '<label>Traducere</label><br/>';
echo '<label class="switch">';
if(!empty($set['trs'])){
echo '<input type="checkbox" checked="" value="1" name="trs"/>';
 }else{
echo '<input type="checkbox" value="0" name="trs"/>';
 }
echo '<span class="slider"></span>';
echo '</label>';
echo '</div>';

// Google Translate
echo '<div class="w3-col l2 m3 s6" style="padding:4px;">';
echo '<label>G-Translate</label><br/>';
echo '<label class="switch">';
if(!empty($set['trs_g'])){
echo '<input type="checkbox" checked="" value="1" name="trs_g"/>';
 }else{
echo '<input type="checkbox" value="0" name="trs_g"/>';
 }
echo '<span class="slider"></span>';
echo '</label>';
echo '</div>';

echo '<div class="w3-col l2 m3 s6" style="padding:4px;">';
echo '<label>Cookie</label><br/>';
echo '<label class="switch">';
if(!empty($set['cook'])){
echo '<input type="checkbox" checked="" value="1" name="cookie"/>';
 }else{
echo '<input type="checkbox" value="0" name="cookie"/>';
 }
echo '<span class="slider"></span>';
echo '</label>';
echo '</div>';

// Themes
echo '<div class="w3-col l2 m3 s6" style="padding:4px;">';
echo '<label>Teme</label><br/>';
echo '<select class="w3-select w3-border" name="theme">';

$dirs = array_map('basename', glob(THM . '/*', GLOB_ONLYDIR));
//$dirs = array_filter(glob('*'), 'is_dir');
foreach($dirs as $dir){
    echo '<option value="'.$dir.'"';
    if($dir == $set['theme']){
        echo ' selected=""';}echo '>'.$dir.'</option>';
   }

echo '</select>';
echo '</div>';
// END Themes

// Language
echo '<div class="w3-col l2 m3 s6" style="padding:4px;">';
echo '<label>Limba implicită</label><br/>';
echo '<select class="w3-select w3-border" name="dlang">';
if($set['dlang'] == 'ro'){
    echo '<option value="ro" selected="">'.$lng['lang_romana'].'</option>';
    echo '<option value="en">'.$lng['lang_english'].'</option>';
}elseif($set['dlang'] == 'en'){
    echo '<option value="ro">'.$lng['lang_romana'].'</option>';
    echo '<option value="en" selected="">'.$lng['lang_english'].'</option>';
}else{
   echo '<option value="ro">'.$lng['lang_romana'].'</option>';
   echo '<option value="en">'.$lng['lang_english'].'</option>'; 
}
echo '</select>';
echo '</div>';
// END Default Language


// Logo
echo '<div class="w3-col l6" style="padding:4px;">';
echo '<label>Logo</label><br/>';
echo '<div class="w3-col l8 m8 s8">';
echo '<input class="w3-input w3-border" name="logo" type="text" value="'.$set['logo'].'"/>';
echo '</div>';
echo '<div class="w3-col l4 m4 s4">';
echo '<a onclick="document.getElementById(\'getlogo\').style.display=\'block\'" class="w3-button w3-block w3-blue w3-hover-black">';
echo '<i class="fa fa-fw fa-camera"></i></a>';
echo '</div>';

if(!empty($set['logo'])){
    echo '<img src="'.PATH.'themes/'.$set['theme'].'/img/'.$set['logo'].'" alt="'.BASE_NAME.'" title="'.BASE_NAME.'" style="width:269px;height:95px;padding:4px;" loading="lazy"/>';
 }else{
echo '<input type="file" name="logo" id="logo"/>';
 }
echo '</div>';

echo '</div>';

// Email Settings
echo '<div id="mail" class="w3-container w3-border set" style="display:none">';
echo '<h2>E-mail</h2>';

echo '<div class="w3-row">';
echo '<div class="w3-col l4" style="padding:4px;">';
echo '<label>Mail Type</label>';
echo '<select class="w3-select w3-border" name="mail_type">';

echo '<option value="1"';
if(!empty($set['mailtype'])){echo ' selected=""';}
echo '>SMTP Mail (PHPMailer - 5.2.4)</option>';
if(!empty($set['mailtype'])){echo ' selected=""';}
echo '</select>';
echo '</div></div>';

echo '<div class="w3-row">';
echo '<div class="w3-col l6" style="padding:4px;">';
echo '<label>Mail From</label>';
echo '<input class="w3-input w3-border" type="text" name="mail_from" placeholder="Enter name of sender..." value="';
if(isset($set['mailfrom'])){echo $set['mailfrom'];}
echo '"/>';
echo '</div></div>';

echo '<div class="w3-col l6" style="padding:4px;">';
echo '<label>Mail Server</label>';
echo '<input class="w3-input w3-border" type="text" name="mail_host" placeholder="Enter mail server address..." value="';
if(isset($set['mailhost'])){echo $set['mailhost'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l2" style="padding:4px;">';
echo '<label>Mail Port</label>';
echo '<input class="w3-input w3-border" type="text" name="mail_port" placeholder="Enter mail server address..." value="';
if(isset($set['mailport'])){echo $set['mailport'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l6" style="padding:4px;">';
echo '<label>Mail User</label>';
echo '<input class="w3-input w3-border" type="text" name="mail_user" placeholder="Enter mail server address..." value="';
if(isset($set['mailuser'])){echo $set['mailuser'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l6" style="padding:4px;">';
echo '<label>Mail Password</label>';
echo '<input class="w3-input w3-border" type="password" name="mail_pass" placeholder="Enter mail server address..." value="';
if(isset($set['mailpass'])){echo $set['mailpass'];}
echo '"/>';
echo '</div>';


echo '</div>';

// Webmaster Tools
echo '<div id="seo" class="w3-container w3-border set" style="display:none">';
echo '<h2>Instrumente Webmaster</h2>';

echo '<div class="w3-col l12" style="padding:4px;">';
echo '<label>Google Meta</label>';
echo '<input class="w3-input w3-border" type="text" name="w_google" placeholder="Introduceți cod Google..." value="';
if(isset($set['wgoogle'])){echo $set['wgoogle'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l12" style="padding:4px;">';
echo '<label>Bing Meta</label>';
echo '<input class="w3-input w3-border" type="text" name="w_bing" placeholder="Introduceți codul bing..." value="';
if(isset($set['wbing'])){echo $set['wbing'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l12" style="padding:4px;">';
echo '<label>Yandex Meta</label>';
echo '<input class="w3-input w3-border" type="text" name="w_yandex" placeholder="Introduceți codul yandex..." value="';
if(isset($set['wyandex'])){echo $set['wyandex'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l12" style="padding:4px;">';
echo '<label>WOT Meta</label>';
echo '<input class="w3-input w3-border" type="text" name="w_wot" placeholder="Introduceți codul wot..." value="';
if(isset($set['wwot'])){echo $set['wwot'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l12" style="padding:4px;">';
echo '<label>Norton Meta</label>';
echo '<input class="w3-input w3-border" type="text" name="w_norton" placeholder="Introduceți codul norton..." value="';
if(isset($set['wnorton'])){echo $set['wnorton'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l4" style="padding:4px;">';
echo '<label>Robots</label>';
echo '<input class="w3-input w3-border" type="text" name="robots" placeholder="Introduceți acțiune pentru seo..." value="';
if(isset($set['robots'])){echo $set['robots'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l4" style="padding:4px;">';
echo '<label>Revisit</label>';
echo '<input class="w3-input w3-border" type="text" name="revisit" placeholder="Setați când doriți să fie revizitat site-ul..." value="';
if(isset($set['revisit'])){echo $set['revisit'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l4" style="padding:4px;">';
echo '<label>Google Analytics</label>';
echo '<input class="w3-input w3-border" type="text" name="google_analytics" placeholder="Cod de analiză Google..." value="';
if(isset($set['g_analytics'])){echo $set['g_analytics'];}
echo '"/>';
echo '</div>';


echo '</div>';

// Head custom
echo '<div id="head" class="w3-container w3-border set" style="display:none">';
echo '<h2>Mansardă personalizată</h2>';
echo '<textarea class="w3-input w3-border w3-margin-bottom" rows="10" style="white-space: pre-line;" name="custom_head" placeholder="Puneți codul aici pentru mansardă...">';
if(!empty($set['c_head'])){echo $set['c_head'];}
echo '</textarea>';
echo '</div>';

// Footer custom
echo '<div id="foot" class="w3-container w3-border set" style="display:none">';
echo '<h2>Subsol personalizat</h2>';
echo '<textarea class="w3-input w3-border w3-margin-bottom" rows="10" style="white-space: pre-line;" name="custom_foot" placeholder="Puneți codul aici pentru subsol...">';
if(!empty($set['c_foot'])){echo $set['c_foot'];}
echo '</textarea>';
echo '</div>';

// Social Media
echo '<div id="social" class="w3-container w3-border set" style="display:none">';
echo '<h2>Rețele sociale</h2>';

echo '<div class="w3-col l12" style="padding:4px;">';
echo '<label>Facebook</label>';
echo '<input class="w3-input w3-border" type="text" name="s_facebook" placeholder="Adresă Facebook..." value="';
if(isset($set['s_facebook'])){echo $set['s_facebook'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l12" style="padding:4px;">';
echo '<label>Instagram</label>';
echo '<input class="w3-input w3-border" type="text" name="s_instagram" placeholder="Adresă Instagram..." value="';
if(isset($set['s_instagram'])){echo $set['s_instagram'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l12" style="padding:4px;">';
echo '<label>Twitter</label>';
echo '<input class="w3-input w3-border" type="text" name="s_twitter" placeholder="Adresă Twitter..." value="';
if(isset($set['s_twitter'])){echo $set['s_twitter'];}
echo '"/>';
echo '</div>';

echo '<div class="w3-col l12" style="padding:4px;">';
echo '<label>Linkedin</label>';
echo '<input class="w3-input w3-border" type="text" name="s_linkedin" placeholder="Adresă Linkedin..." value="';
if(isset($set['s_linkedin'])){echo $set['s_linkedin'];}
echo '"/>';
echo '</div>';
echo '</div>';

// Maps
echo '<div id="maps" class="w3-container w3-border set" style="display:none">';
echo '<h2>Hărți</h2>';
echo '<style>';
echo '[type=radio] {position: absolute;opacity: 0;width: 0;height: 0;}
      /* IMAGE STYLES */
      [type=radio] + img {cursor: pointer;}
      /* CHECKED STYLES */
      [type=radio]:checked + img {outline: 2px solid #107493;}';
echo '</style>';
echo '<div class="w3-row-padding">';

echo '<div class="w3-col l6 m6 s12">';
echo '<label>';
if($set['map'] == '1'){
echo '<input class="w3-check" type="radio" checked="" name="map" value="1"/>';
echo '<img src="themes/'.$set['theme'].'/maps/europe.png" style="width:100%;" alt="eumap.png">';
 }else{
echo '<input class="w3-check" type="radio" name="map" value="1"/>';
echo '<img src="themes/'.$set['theme'].'/maps/europe.png" style="width:100%;" alt="eumap.png">';
 }
echo '</label>';
echo '</div>';

echo '<div class="w3-col l6 m6 s12">';
echo '<label>';
if($set['map'] == '2'){
echo '<input class="w3-check" type="radio" checked="" name="map" value="2"/>';
echo '<img src="themes/'.$set['theme'].'/maps/ro/romap.png" style="width:100%;" alt="romap.png">';
 }else{
echo '<input class="w3-check" type="radio" name="map" value="2"/>';
echo '<img src="themes/'.$set['theme'].'/maps/ro/romap.png" style="width:100%;" alt="romap.png">';
 }
echo '</label>';
echo '</div>';

echo '</div>';

echo '</div>';

// Terms
echo '<div id="terms" class="w3-container w3-border set" style="display:none">';
echo '<h2>Termeni Legali</h2>';



echo '<div class="w3-row-padding w3-margin-bottom">';
echo '<div class="w3-col l12 m12 s12 w3-card">';
echo '<h3 class="w3-border-bottom">'.$lng['form_terms'].'</h3>';
if($set['terms'] == '1'){    
echo '<div class="w3-container w3-margin-bottom">';
echo '<input class="w3-check" type="checkbox" checked="" name="terms" value="1"/>';
echo '<label> Activează (Dacă nu este bifat, nu se va afișa)</label>';
echo '<div class="w3-container">';
echo '<div class="w3-col l2 m2 w3-hide-small w3-center">';
echo '<label><h5>Adresa URL</h5></label>';
echo '</div>';
echo '<div class="w3-col l6 m6 s12">';
echo '<input class="w3-input w3-border" type="text" name="terms_url" placeholder="Scrieți adresa URL (ex. https://www. )" value="';
if(isset($set['trm_url'])){echo $set['trm_url'];}
echo '">';
echo '</div>';
echo '<div class="w3-col l2 m2 s6 w3-center">';
echo '<h5>Se deschide</h5>';
echo '</div>';
echo '<div class="w3-col l2 m2 s6">';
echo '<select class="w3-select w3-border" name="open_url_trm_in">';
if($set['tc_o'] == '_blank'){
echo '<option value="_self">_self</option>';
echo '<option value="_blank" selected="">_blank</option>';
  }else{
    echo '<option value="_self" selected="">_self</option>';
    echo '<option value="_blank">_blank</option>';
  }
echo '</select>';
echo '</div>';
echo '</div>';
echo '</div>';    
  }else{
echo '<div class="w3-container w3-margin-bottom">';
echo '<input class="w3-check" type="checkbox" name="terms" value="0"/>';
echo '<label> Activează (Dacă nu este bifat, nu se va afișa)</label>';
echo '<div class="w3-container">';
echo '<div class="w3-col l2 m2 w3-hide-small w3-center">';
echo '<label><h5>Adresa URL</h5></label>';
echo '</div>';
echo '<div class="w3-col l6 m6 s12">';
echo '<input class="w3-input w3-border" type="text" name="terms_url" placeholder="Scrieți adresa URL (ex. https://www. )" value="';
if(isset($set['trm_url'])){echo $set['trm_url'];}
echo '">';
echo '</div>';
echo '<div class="w3-col l2 m2 s6 w3-center">';
echo '<h5>Se deschide</h5>';
echo '</div>';
echo '<div class="w3-col l2 m2 s6">';
echo '<select class="w3-select w3-border" name="open_url_trm_in">';
if($set['tc_o'] == '_blank'){
echo '<option value="_self">_self</option>';
echo '<option value="_blank" selected="">_blank</option>';
  }else{
    echo '<option value="_self" selected="">_self</option>';
    echo '<option value="_blank">_blank</option>';
  }
echo '</select>';
echo '</div>';
echo '</div>';
echo '</div>';
  }
echo '</div>';
echo '</div>';



echo '<div class="w3-row-padding w3-margin-bottom">';
echo '<div class="w3-col l12 m12 s12 w3-card">';
echo '<h3 class="w3-border-bottom">'.$lng['form_privacy'].'</h3>';
if($set['privacy'] == '1'){    
echo '<div class="w3-container w3-margin-bottom">';
echo '<input class="w3-check" type="checkbox" checked="" name="privacy" value="1"/>';
echo '<label> Activează (Dacă nu este bifat, nu se va afișa)</label>';
echo '<div class="w3-container">';
echo '<div class="w3-col l2 m2 w3-hide-small w3-center">';
echo '<label><h5>Adresa URL</h5></label>';
echo '</div>';
echo '<div class="w3-col l6 m6 s12">';
echo '<input class="w3-input w3-border" type="text" name="privacy_url" placeholder="Scrieți adresa URL (ex. https://www. )" value="';
if(isset($set['prv_url'])){echo $set['prv_url'];}
echo '">';
echo '</div>';
echo '<div class="w3-col l2 m2 s6 w3-center">';
echo '<h5>Se deschide</h5>';
echo '</div>';
echo '<div class="w3-col l2 m2 s6">';
echo '<select class="w3-select w3-border" name="open_url_prv_in">';
if($set['pp_o'] == '_blank'){
echo '<option value="_self">_self</option>';
echo '<option value="_blank" selected="">_blank</option>';
  }else{
    echo '<option value="_self" selected="">_self</option>';
    echo '<option value="_blank">_blank</option>';
  }
echo '</select>';
echo '</div>';
echo '</div>';
echo '</div>';    
  }else{
echo '<div class="w3-container w3-margin-bottom">';
echo '<input class="w3-check" type="checkbox" name="privacy" value="0"/>';
echo '<label> Activează (Dacă nu este bifat, nu se va afișa)</label>';
echo '<div class="w3-container">';
echo '<div class="w3-col l2 m2 w3-hide-small w3-center">';
echo '<label><h5>Adresa URL</h5></label>';
echo '</div>';
echo '<div class="w3-col l6 m6 s12">';
echo '<input class="w3-input w3-border" type="text" name="privacy_url" placeholder="Scrieți adresa URL (ex. https://www. )" value="';
if(isset($set['prv_url'])){echo $set['prv_url'];}
echo '">';
echo '</div>';
echo '<div class="w3-col l2 m2 s6 w3-center">';
echo '<h5>Se deschide</h5>';
echo '</div>';
echo '<div class="w3-col l2 m2 s6">';
echo '<select class="w3-select w3-border" name="open_url_prv_in">';
if($set['pp_o'] == '_blank'){
echo '<option value="_self">_self</option>';
echo '<option value="_blank" selected="">_blank</option>';
  }else{
    echo '<option value="_self" selected="">_self</option>';
    echo '<option value="_blank">_blank</option>';
  }
echo '</select>';
echo '</div>';
echo '</div>';
echo '</div>';
  }
echo '</div>';
echo '</div>';



echo '<div class="w3-row-padding w3-margin-bottom">';
echo '<div class="w3-col l12 m12 s12 w3-card">';
echo '<h3 class="w3-border-bottom">'.$lng['cookies_capital'].'</h3>';
if($set['cookies'] == '1'){    
echo '<div class="w3-container w3-margin-bottom">';
echo '<input class="w3-check" type="checkbox" checked="" name="cookies" value="1"/>';
echo '<label> Activează (Dacă nu este bifat, nu se va afișa)</label>';
echo '<div class="w3-container">';
echo '<div class="w3-col l2 m2 w3-hide-small w3-center">';
echo '<label><h5>Adresa URL</h5></label>';
echo '</div>';
echo '<div class="w3-col l6 m6 s12">';
echo '<input class="w3-input w3-border" type="text" name="cookies_url" placeholder="Scrieți adresa URL (ex. https://www. )" value="';
if(isset($set['cks_url'])){echo $set['cks_url'];}
echo '">';
echo '</div>';
echo '<div class="w3-col l2 m2 s6 w3-center">';
echo '<h5>Se deschide</h5>';
echo '</div>';
echo '<div class="w3-col l2 m2 s6">';
echo '<select class="w3-select w3-border" name="open_url_cks_in">';
if($set['cp_o'] == '_blank'){
echo '<option value="_self">_self</option>';
echo '<option value="_blank" selected="">_blank</option>';
  }else{
    echo '<option value="_self" selected="">_self</option>';
    echo '<option value="_blank">_blank</option>';
  }
echo '</select>';
echo '</div>';
echo '</div>';
echo '</div>';    
  }else{
echo '<div class="w3-container w3-margin-bottom">';
echo '<input class="w3-check" type="checkbox" name="cookies" value="0"/>';
echo '<label> Activează (Dacă nu este bifat, nu se va afișa)</label>';
echo '<div class="w3-container">';
echo '<div class="w3-col l2 m2 w3-hide-small w3-center">';
echo '<label><h5>Adresa URL</h5></label>';
echo '</div>';
echo '<div class="w3-col l6 m6 s12">';
echo '<input class="w3-input w3-border" type="text" name="cookies_url" placeholder="Scrieți adresa URL (ex. https://www. )" value="';
if(isset($set['cks_url'])){echo $set['cks_url'];}
echo '">';
echo '</div>';
echo '<div class="w3-col l2 m2 s6 w3-center">';
echo '<h5>Se deschide</h5>';
echo '</div>';
echo '<div class="w3-col l2 m2 s6">';
echo '<select class="w3-select w3-border" name="open_url_cks_in">';
if($set['cp_o'] == '_blank'){
echo '<option value="_self">_self</option>';
echo '<option value="_blank" selected="">_blank</option>';
  }else{
    echo '<option value="_self" selected="">_self</option>';
    echo '<option value="_blank">_blank</option>';
  }
echo '</select>';
echo '</div>';
echo '</div>';
echo '</div>';
  }
echo '</div>';
echo '</div>';


echo '</div>';







echo '<div class="w3-col l12 w3-center w3-margin-top">';
echo '<button class="w3-button w3-blue w3-hover-green" type="submit">Actualizare</button>';
echo '</div>';

echo '<input type="hidden" name="usrID" value="'.$_SESSION['uid'].'"/>';
echo '<input type="hidden" name="updsettfromadmin" value="true"/>';

echo '</form>';

echo '</div></div></div>';

// modal admin settings

echo '<div id="getlogo" class="w3-modal" style="z-index:1007;margin-top:-50px;">';
echo '<div class="w3-modal-content w3-animate-top" style="width:500px;max-width:100%;margin:auto;">';
echo '<div class="w3-container_">';
echo '<span onclick="document.getElementById(\'getlogo\').style.display=\'none\'" class="w3-button w3-display-topright w3-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>';

echo '<div class="w3-row">';
echo '<div class="w3-container w3-text-white w3-card" style="background-color:#117594;">';
echo '<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-fw fa-camera"></i> Schimbă Logo</h3>';
echo '</div>';
echo '<div class="w3-bar-block w3-white">';

echo '<div class="w3-col l12">';

echo '<img src="'.PATH.'themes/'.$set['theme'].'/img/'.$set['logo'].'" alt="'.BASE_NAME.'" title="'.BASE_NAME.'" style="width:269px;height:95px;padding:4px;" loading="lazy"/>';

echo '</div>';
echo '<div class="w3-col l12">';
echo '<form action="" method="POST" enctype="multipart/form-data">';
echo '<input class="w3-input w3-button" type="file" name="logo" id="logo" required="">';
echo '<button class="w3-button w3-block w3-red w3-hover-black" type="submit">';
echo 'Add New Logo</button>';
echo '<input type="hidden" name="usrID" value="'.$_SESSION['uid'].'">';
echo '<input type="hidden" name="change_logosite" value="true">';
echo '</form>';
echo '</div>';

echo '</div></div></div><div class="w3-hide">&nbsp;</div></div></div>';


// end modal admin settings
echo '<script>';
echo 'function openSet(evt, setName) {';
echo 'var i, x, tablinks;';
echo 'x = document.getElementsByClassName("set");';
echo 'for (i = 0; i < x.length; i++) {';
echo 'x[i].style.display = "none";';
echo '}';
echo 'tablinks = document.getElementsByClassName("tablink");';
echo 'for (i = 0; i < x.length; i++) {';
echo 'tablinks[i].className = tablinks[i].className.replace(" w3-bluepm", "");';
echo '}';
echo 'document.getElementById(setName).style.display = "block";';
echo 'evt.currentTarget.className += " w3-bluepm";';
echo '}';
echo '</script>';

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

   }elseif($page == 'admin-competitii'){ // admin competitii
          ?>

<style>
.col-container {
    display: table; /* Make the container element behave like a table */
    width: 100%; /* Set full-width to expand the whole page */
}

.col {
    display: table-cell; /* Make elements inside the container behave like table cells */
}
</style>

<div class="col-container">

<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">
<?php include THM.$set['theme'].'/admin_sidebar.php';?>
</div>

<div class="w3-col w3-container w3-rest w3-border col" style="float:none;width:100%;margin-left:300px;">

<div class="w3-row w3-border-bottom">

<?php if(isset($addedok)){?>
<div class="w3-col l12 m12 s12">
<div class="w3-panel w3-seagreen"><h5><i class="fa fa-check"></i> <?=$addedok?></h5></div>
</div>
<?php } ?>

<?php if(isset($lnkremovefromdb)){?>
<div class="w3-col l12 m12 s12">
<div class="w3-panel w3-seagreen"><h5><i class="fa fa-check"></i> <?=$lnkremovefromdb?></h5></div>
</div>
<?php } ?>

<?php if(isset($add_error)){?>
<div class="w3-col l12 m12 s12">
<div class="w3-panel w3-red"><h5><i class="fa fa-remove"></i> <?=$add_error?></h5></div>
</div>
<?php } ?>

<div class="w3-left">
<h2 class="w3-text-bluepm"><i class="fa fa-trophy"></i> Competiții</h2>
</div>

<div class="w3-right"><h3 class="w3-text-bluepm">
<a onclick="document.getElementById('dsf45gff3r4tygdf65').style.display='block'" class="w3-button w3-block_ w3-bluepm w3-hover-seagreen w3-padding-small">
<i class="fa fa-plus"></i> <span class="w3-hide-small">Adaugă</span></a></h3></div>



<div id="dsf45gff3r4tygdf65" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('dsf45gff3r4tygdf65').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-seagreen w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-plus"></i> Adaugă categorie</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="text" name="catext_name" placeholder="Numele categoriei" required=""/>
</div>

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="number" name="sort" placeholder="Sortare numerică" required=""/>
</div>

<div class="w3-col l12 m12 s12">
<textarea class="w3-input w3-border w3-margin-bottom" rows="3" name="catext_description" placeholder="O descriere a categoriei">
</textarea>
</div>

<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-bluepm w3-border w3-border-cadetblue w3-hover-seagreen w3-margin-bottom" >Adaugă</button>
</div>

<input type="hidden" name="usrID" value="<?=$_SESSION['uid']?>"/>
<input type="hidden" name="location" value="competitii"/>
<input type="hidden" name="addcateglinkscompetitii" value="true"/>

</div>
</form>

</div>

</div></div></div>


</div>

<div class="w3-row w3-margin-top w3-margin-bottom">

<?php include(BASE);
$getcatext = $dbc->query("SELECT * FROM `categlinks` WHERE `catext_loc`='competitii' ORDER BY `sort` ASC") or die($dbc->error);

if($getcatext->num_rows > 0){
        
        echo '<div class="w3-row w3-bluepm w3-hide-medium w3-hide-small w3-margin-bottom">';
        
        echo '<div class="w3-container w3-col l4 m6 s12">';
        echo '<h5>Categorie/Link</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-col l4 m6 s12">';
        echo '<h5>Adresă</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-center w3-col l2 m4 s4">';
        echo '<h5>Poziție</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-center w3-col l2 m8 s8">';
        echo '<h5>Acțiuni</h5>';
        echo '</div>';
        
        echo '</div>';
        
    while($rwcext = $getcatext->fetch_assoc()){        
        
        echo '<div class="w3-row w3-card w3-margin-bottom">';        
        
        echo '<div class="w3-container w3-col l4 m4 s8 w3-border-bottom">';
        echo '<h5>'.$rwcext['catext_name'].'</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-col l4 m4 w3-hide-small w3-border-bottom">';
        echo '<h5>/'.$rwcext['catext_loc'].'/</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-center w3-col l2 m2 w3-hide-small w3-border-bottom">';
        echo '<h5>'.$rwcext['sort'].'</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-center w3-col l2 m2 s4 w3-border-bottom"><h5>';
        echo '<a onclick="document.getElementById(\'editcatext'.$rwcext['catext_id'].'\').style.display=\'block\'" class="w3-link w3-bluepm" style="cursor:pointer;"><i class="fa fa-fw fa-pencil"></i></a> ';
        echo '<a onclick="document.getElementById(\'deletecatextl'.$rwcext['catext_id'].'\').style.display=\'block\'" class="w3-link w3-red" style="cursor:pointer;"><i class="fa fa-fw fa-remove"></i></a> ';
        echo '<a onclick="document.getElementById(\'addlinkcatext'.$rwcext['catext_id'].'\').style.display=\'block\'" class="w3-link w3-seagreen" style="cursor:pointer;"><i class="fa fa-fw fa-plus"></i></a>';
        echo '</h5></div>';
        
        $getlinksfromcatext = $dbc->query("SELECT * FROM `extlinks` WHERE `catext_id`='{$rwcext['catext_id']}'") or die($dbc->error);
        
        if($getlinksfromcatext->num_rows > 0){
            
             echo '<div class="w3-row w3-border-bottom">';
             
             echo '<div class="w3-container w3-col l1 m12 s12 w3-seagreen">';
             echo 'Sortare';
             echo '</div>';
             
             echo '<div class="w3-container w3-col l3 m12 s12 w3-seagreen">';
             echo 'Denumire';
             echo '</div>';
             
             echo '<div class="w3-container w3-col l6 m12 s12 w3-seagreen">';
             echo 'Adresă URL';
             echo '</div>';
             
             echo '<div class="w3-container w3-center w3-col l2 m12 s12 w3-seagreen">';
             echo 'Acțiuni';
             echo '</div>';
             
             echo '</div>';
            
            while($rwextl = $getlinksfromcatext->fetch_assoc()){
                
                echo '<div class="w3-row w3-border-bottom">';
                echo '<div class="w3-container w3-col l1 m12 s12">';
                
                if($rwextl['extl_default'] === '1'){
                 echo $rwextl['sort'].' <i class="fa fa-fw fa-check w3-text-seagreen"></i>';
                }else{
                 echo $rwextl['sort'];                
                 }              
                
                echo '</div>';
                
                echo '<div class="w3-container w3-col l3 m12 s12">';
                echo $rwextl['extl_name'];
                echo '</div>';
                
                echo '<div class="w3-container w3-col l6 m12 s12">';
                echo $rwextl['extl_url'];
                echo '</div>';
                
                echo '<div class="w3-container w3-center w3-col l2 m12 s12">';
                
                echo '<a onclick="document.getElementById(\'editLinks'.$rwextl['extl_id'].'\').style.display=\'block\'" style="cursor:pointer;">';
                echo '<i class="fa fa-fw fa-pencil w3-bluepm"></i> ';                
                echo '</a>';
                
                echo '<a onclick="document.getElementById(\'removeLinks'.$rwextl['extl_id'].'\').style.display=\'block\'" style="cursor:pointer;">';
                echo '<i class="fa fa-fw fa-remove w3-red"></i>';
                echo '</a>';
                
                echo '</div>';
                
                echo '</div>'; // Start Links Modal ?>
                

<div id="editLinks<?=$rwextl['extl_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('editLinks<?=$rwextl['extl_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-seagreen w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-pencil"></i> Editează Legătură</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="text" name="extl_name" placeholder="Numele adresei" value="<?=$rwextl['extl_name']?>" required=""/>
</div>

<div class="w3-col l12 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="url" name="extl_url" placeholder="https:// Adresa URL" value="<?=$rwextl['extl_url']?>" required=""/>
</div>

<div class="w3-col l4 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="number" name="sort" placeholder="Sortare numerică" value="<?=$rwextl['sort']?>" required=""/>
</div>

<div class="w3-col l4 m12 s12">
<select class="w3-select w3-margin-bottom" name="target" style="" required="">
 <option value="" disabled="">Se deschide către</option>
 <option <?php if($rwextl['extl_target'] === '_blank'){echo 'selected="" ';}?> value="_blank">Fereastră nouă</option>
 <option <?php if($rwextl['extl_target'] === 'mainFrame'){echo 'selected="" ';}?> value="mainFrame">În aceeași fereastră</option>
</select>
</div>

<div class="w3-col l4 m12 s12">
<input type="checkbox" class="w3-check" name="setopen" <?php if($rwextl['extl_default'] == 1){echo 'value="1" checked="checked"';}else{echo 'value="0"';}?>/> - Adresă implicită
</div>


<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-bluepm w3-border w3-border-cadetblue w3-hover-seagreen w3-margin-bottom" >Actualizează</button>
</div>

<input type="hidden" name="cteID" value="<?=$rwcext['catext_id']?>"/>
<input type="hidden" name="lnkID" value="<?=$rwextl['extl_id']?>"/>
<input type="hidden" name="usrID" value="<?=$_SESSION['uid']?>"/>
<input type="hidden" name="updatelinkstomainframes" value="true"/>

</div>
</form>

</div>

</div></div></div>


<div id="removeLinks<?=$rwextl['extl_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('removeLinks<?=$rwextl['extl_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-red w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-trash"></i> Șterge Legătură</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<h2 class="w3-center">Sunteți sigur(ă) de această acțiune?</h2>
<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-red w3-border w3-border-black w3-hover-black w3-margin-bottom" >DA! Șterg legătura</button>
</div>

<input type="hidden" name="lnkID" value="<?=$rwextl['extl_id']?>"/>
<input type="hidden" name="removeXtlink" value="true"/>

</div>
</form>

</div>

</div></div></div>
                
                
           <?php } // End Links Modal
            
            
        }else{
        
        echo '<div class="w3-container w3-center w3-col l12 m12 s12">';
        echo '<h5>Nu sunt legături adăugate.</h5>';
        echo '</div>';
        }
        // Modal Add links
        ?>

<div id="editcatext<?=$rwcext['catext_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('editcatext<?=$rwcext['catext_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-seagreen w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-pencil"></i> Editare categorie</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="text" name="catext_name" placeholder="Numele categoriei" value="<?=$rwcext['catext_name']?>" required=""/>
</div>

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="number" name="sort" placeholder="Sortare numerică" value="<?=$rwcext['sort']?>" required=""/>
</div>

<div class="w3-col l12 m12 s12">
<textarea class="w3-input w3-border w3-margin-bottom" rows="3" name="catext_description" placeholder="O descriere a categoriei"><?=$rwcext['catext_description']?></textarea>
</div>

<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-bluepm w3-border w3-border-cadetblue w3-hover-seagreen w3-margin-bottom" ><i class="fa fa-fw fa-refresh"></i> Actualizează</button>
</div>

<input type="hidden" name="usrID" value="<?=$_SESSION['uid']?>"/>
<input type="hidden" name="catID" value="<?=$rwcext['catext_id']?>"/>
<input type="hidden" name="location" value="competitii"/>
<input type="hidden" name="updatecateglinkscompetitii" value="true"/>

</div>
</form>

</div>

</div></div></div>

<div id="deletecatextl<?=$rwcext['catext_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('deletecatextl<?=$rwcext['catext_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-red w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-trash"></i> Șterge Categorie</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">
<?php
$checkifcathavelinks = $dbc->query("SELECT * FROM `extlinks` WHERE `catext_id`='{$rwcext['catext_id']}'") or die($dbc->error);
if($checkifcathavelinks->num_rows > 0){ ?>
<h2 class="w3-center">Nu puteți șterge această categorie.</h2>
<p class="w3-center">Există legături alocate ei. Mai întâi ștergeți legăturile, apoi încercați din nou.</p>
<?php }else{
?>
<h2 class="w3-center">Sunteți sigur(ă) de această acțiune?</h2>
<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-red w3-border w3-border-black w3-hover-black w3-margin-bottom" >DA! Șterg categoria</button>
</div>
<?php } ?>

<input type="hidden" name="cteID" value="<?=$rwcext['catext_id']?>"/>
<input type="hidden" name="removecatextlink" value="true"/>

</div>
</form>

</div>

</div></div></div>
        
<div id="addlinkcatext<?=$rwcext['catext_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('addlinkcatext<?=$rwcext['catext_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-seagreen w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-plus"></i> Adaugă legătură</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="text" name="extl_name" placeholder="Numele adresei" required=""/>
</div>

<div class="w3-col l12 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="url" name="extl_url" placeholder="https:// Adresa URL" required=""/>
</div>

<div class="w3-col l4 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="number" name="sort" placeholder="Sortare numerică" required=""/>
</div>

<div class="w3-col l4 m12 s12">
<select class="w3-select w3-margin-bottom" name="target" style="" required="">
<option value="" selected="" disabled="">Se deschide către</option>
 <option value="_blank">Fereastră nouă</option>
 <option value="mainFrame">În aceeași fereastră</option>
</select>
</div>

<div class="w3-col l4 m12 s12">
<input type="checkbox" class="w3-check" name="setopen" value="0"/> - Adresă implicită
</div>


<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-bluepm w3-border w3-border-cadetblue w3-hover-seagreen w3-margin-bottom" >Adaugă</button>
</div>

<input type="hidden" name="cteID" value="<?=$rwcext['catext_id']?>"/>
<input type="hidden" name="usrID" value="<?=$_SESSION['uid']?>"/>
<input type="hidden" name="addlinkstomainframes" value="true"/>

</div>
</form>

</div>

</div></div></div>
        
<?php
        // End Modal Add links
        
        //}
        
        echo '</div>';
        
        
    }
    
 }else{
    echo '<h2 class="w3-center w3-text-gray">Nu sunt categorii/țări adăugate!</h2>';
 }
$dbc->close();
?>



</div>

</div>

</div>
         

<?php
   }elseif($page == 'admin-licitatii'){ // admin licitatii
          ?>

<style>
.col-container {
    display: table; /* Make the container element behave like a table */
    width: 100%; /* Set full-width to expand the whole page */
}

.col {
    display: table-cell; /* Make elements inside the container behave like table cells */
}
</style>

<div class="col-container">

<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">
<?php include THM.$set['theme'].'/admin_sidebar.php';?>
</div>

<div class="w3-col w3-container w3-rest w3-border col" style="float:none;width:100%;margin-left:300px;">

<div class="w3-row w3-border-bottom">

<?php if(isset($addedok)){?>
<div class="w3-col l12 m12 s12">
<div class="w3-panel w3-seagreen"><h5><i class="fa fa-check"></i> <?=$addedok?></h5></div>
</div>
<?php } ?>

<?php if(isset($lnkremovefromdb)){?>
<div class="w3-col l12 m12 s12">
<div class="w3-panel w3-seagreen"><h5><i class="fa fa-check"></i> <?=$lnkremovefromdb?></h5></div>
</div>
<?php } ?>

<?php if(isset($add_error)){?>
<div class="w3-col l12 m12 s12">
<div class="w3-panel w3-red"><h5><i class="fa fa-remove"></i> <?=$add_error?></h5></div>
</div>
<?php } ?>

<div class="w3-left">
<h2 class="w3-text-bluepm"><i class="fa fa-diamond"></i> Licitații</h2>
</div>

<div class="w3-right"><h3 class="w3-text-bluepm">
<a onclick="document.getElementById('dsf45gff3r4tygdf65').style.display='block'" class="w3-button w3-block_ w3-bluepm w3-hover-seagreen w3-padding-small">
<i class="fa fa-plus"></i> <span class="w3-hide-small">Adaugă</span></a></h3></div>



<div id="dsf45gff3r4tygdf65" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('dsf45gff3r4tygdf65').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-seagreen w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-plus"></i> Adaugă categorie</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="text" name="catext_name" placeholder="Numele categoriei" required=""/>
</div>

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="number" name="sort" placeholder="Sortare numerică" required=""/>
</div>

<div class="w3-col l12 m12 s12">
<textarea class="w3-input w3-border w3-margin-bottom" rows="3" name="catext_description" placeholder="O descriere a categoriei">
</textarea>
</div>

<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-bluepm w3-border w3-border-cadetblue w3-hover-seagreen w3-margin-bottom" >Adaugă</button>
</div>

<input type="hidden" name="usrID" value="<?=$_SESSION['uid']?>"/>
<input type="hidden" name="location" value="licitatii"/>
<input type="hidden" name="addcateglinkscompetitii" value="true"/>

</div>
</form>

</div>

</div></div></div>


</div>

<div class="w3-row w3-margin-top w3-margin-bottom">

<?php include(BASE);
$getcatext = $dbc->query("SELECT * FROM `categlinks` WHERE `catext_loc`='licitatii' ORDER BY `sort` ASC") or die($dbc->error);

if($getcatext->num_rows > 0){
        
        echo '<div class="w3-row w3-bluepm w3-hide-medium w3-hide-small w3-margin-bottom">';
        
        echo '<div class="w3-container w3-col l4 m6 s12">';
        echo '<h5>Categorie/Link</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-col l4 m6 s12">';
        echo '<h5>Adresă</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-center w3-col l2 m4 s4">';
        echo '<h5>Poziție</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-center w3-col l2 m8 s8">';
        echo '<h5>Acțiuni</h5>';
        echo '</div>';
        
        echo '</div>';
        
    while($rwcext = $getcatext->fetch_assoc()){        
        
        echo '<div class="w3-row w3-card w3-margin-bottom">';        
        
        echo '<div class="w3-container w3-col l4 m4 s8 w3-border-bottom">';
        echo '<h5>'.$rwcext['catext_name'].'</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-col l4 m4 w3-hide-small w3-border-bottom">';
        echo '<h5>/'.$rwcext['catext_loc'].'/</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-center w3-col l2 m2 w3-hide-small w3-border-bottom">';
        echo '<h5>'.$rwcext['sort'].'</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-center w3-col l2 m2 s4 w3-border-bottom"><h5>';
        echo '<a onclick="document.getElementById(\'editcatext'.$rwcext['catext_id'].'\').style.display=\'block\'" class="w3-link w3-bluepm" style="cursor:pointer;"><i class="fa fa-fw fa-pencil"></i></a> ';
        echo '<a onclick="document.getElementById(\'deletecatextl'.$rwcext['catext_id'].'\').style.display=\'block\'" class="w3-link w3-red" style="cursor:pointer;"><i class="fa fa-fw fa-remove"></i></a> ';
        echo '<a onclick="document.getElementById(\'addlinkcatext'.$rwcext['catext_id'].'\').style.display=\'block\'" class="w3-link w3-seagreen" style="cursor:pointer;"><i class="fa fa-fw fa-plus"></i></a>';
        echo '</h5></div>';
        
        $getlinksfromcatext = $dbc->query("SELECT * FROM `extlinks` WHERE `catext_id`='{$rwcext['catext_id']}'") or die($dbc->error);
        
        if($getlinksfromcatext->num_rows > 0){
            
             echo '<div class="w3-row w3-border-bottom">';
             
             echo '<div class="w3-container w3-col l1 m12 s12 w3-seagreen">';
             echo 'Sortare';
             echo '</div>';
             
             echo '<div class="w3-container w3-col l3 m12 s12 w3-seagreen">';
             echo 'Denumire';
             echo '</div>';
             
             echo '<div class="w3-container w3-col l6 m12 s12 w3-seagreen">';
             echo 'Adresă URL';
             echo '</div>';
             
             echo '<div class="w3-container w3-center w3-col l2 m12 s12 w3-seagreen">';
             echo 'Acțiuni';
             echo '</div>';
             
             echo '</div>';
            
            while($rwextl = $getlinksfromcatext->fetch_assoc()){
                
                echo '<div class="w3-row w3-border-bottom">';
                echo '<div class="w3-container w3-col l1 m12 s12">';
                
                if($rwextl['extl_default'] === '1'){
                 echo $rwextl['sort'].' <i class="fa fa-fw fa-check w3-text-seagreen"></i>';
                }else{
                 echo $rwextl['sort'];                
                 }              
                
                echo '</div>';
                
                echo '<div class="w3-container w3-col l3 m12 s12">';
                echo $rwextl['extl_name'];
                echo '</div>';
                
                echo '<div class="w3-container w3-col l6 m12 s12">';
                echo $rwextl['extl_url'];
                echo '</div>';
                
                echo '<div class="w3-container w3-center w3-col l2 m12 s12">';
                
                echo '<a onclick="document.getElementById(\'editLinks'.$rwextl['extl_id'].'\').style.display=\'block\'" style="cursor:pointer;">';
                echo '<i class="fa fa-fw fa-pencil w3-bluepm"></i> ';                
                echo '</a>';
                
                echo '<a onclick="document.getElementById(\'removeLinks'.$rwextl['extl_id'].'\').style.display=\'block\'" style="cursor:pointer;">';
                echo '<i class="fa fa-fw fa-remove w3-red"></i>';
                echo '</a>';
                
                echo '</div>';
                
                echo '</div>'; // Start Links Modal ?>
                

<div id="editLinks<?=$rwextl['extl_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('editLinks<?=$rwextl['extl_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-seagreen w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-pencil"></i> Editează Legătură</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="text" name="extl_name" placeholder="Numele adresei" value="<?=$rwextl['extl_name']?>" required=""/>
</div>

<div class="w3-col l12 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="url" name="extl_url" placeholder="https:// Adresa URL" value="<?=$rwextl['extl_url']?>" required=""/>
</div>

<div class="w3-col l4 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="number" name="sort" placeholder="Sortare numerică" value="<?=$rwextl['sort']?>" required=""/>
</div>

<div class="w3-col l4 m12 s12">
<select class="w3-select w3-margin-bottom" name="target" style="" required="">
 <option value="" disabled="">Se deschide către</option>
 <option <?php if($rwextl['extl_target'] === '_blank'){echo 'selected="" ';}?> value="_blank">Fereastră nouă</option>
 <option <?php if($rwextl['extl_target'] === 'mainFrame'){echo 'selected="" ';}?> value="mainFrame">În aceeași fereastră</option>
</select>
</div>

<div class="w3-col l4 m12 s12">
<input type="checkbox" class="w3-check" name="setopen" <?php if($rwextl['extl_default'] == 1){echo 'value="1" checked="checked"';}else{echo 'value="0"';}?>/> - Adresă implicită
</div>


<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-bluepm w3-border w3-border-cadetblue w3-hover-seagreen w3-margin-bottom" >Actualizează</button>
</div>

<input type="hidden" name="cteID" value="<?=$rwcext['catext_id']?>"/>
<input type="hidden" name="lnkID" value="<?=$rwextl['extl_id']?>"/>
<input type="hidden" name="usrID" value="<?=$_SESSION['uid']?>"/>
<input type="hidden" name="updatelinkstomainframes" value="true"/>

</div>
</form>

</div>

</div></div></div>


<div id="removeLinks<?=$rwextl['extl_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('removeLinks<?=$rwextl['extl_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-red w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-trash"></i> Șterge Legătură</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<h2 class="w3-center">Sunteți sigur(ă) de această acțiune?</h2>
<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-red w3-border w3-border-black w3-hover-black w3-margin-bottom" >DA! Șterg legătura</button>
</div>

<input type="hidden" name="lnkID" value="<?=$rwextl['extl_id']?>"/>
<input type="hidden" name="removeXtlink" value="true"/>

</div>
</form>

</div>

</div></div></div>
                
                
           <?php } // End Links Modal
            
            
        }else{
        
        echo '<div class="w3-container w3-center w3-col l12 m12 s12">';
        echo '<h5>Nu sunt legături adăugate</h5>';
        echo '</div>';
        }
        // Modal Add links
        ?>

<div id="editcatext<?=$rwcext['catext_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('editcatext<?=$rwcext['catext_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-seagreen w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-pencil"></i> Editare categorie</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="text" name="catext_name" placeholder="Numele categoriei" value="<?=$rwcext['catext_name']?>" required=""/>
</div>

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="number" name="sort" placeholder="Sortare numerică" value="<?=$rwcext['sort']?>" required=""/>
</div>

<div class="w3-col l12 m12 s12">
<textarea class="w3-input w3-border w3-margin-bottom" rows="3" name="catext_description" placeholder="O descriere a categoriei"><?=$rwcext['catext_description']?></textarea>
</div>

<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-bluepm w3-border w3-border-cadetblue w3-hover-seagreen w3-margin-bottom" ><i class="fa fa-fw fa-refresh"></i> Actualizează</button>
</div>

<input type="hidden" name="usrID" value="<?=$_SESSION['uid']?>"/>
<input type="hidden" name="catID" value="<?=$rwcext['catext_id']?>"/>
<input type="hidden" name="location" value="competitii"/>
<input type="hidden" name="updatecateglinkscompetitii" value="true"/>

</div>
</form>

</div>

</div></div></div>

<div id="deletecatextl<?=$rwcext['catext_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('deletecatextl<?=$rwcext['catext_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-red w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-trash"></i> Șterge Categorie</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">
<?php
$checkifcathavelinks = $dbc->query("SELECT * FROM `extlinks` WHERE `catext_id`='{$rwcext['catext_id']}'") or die($dbc->error);
if($checkifcathavelinks->num_rows > 0){ ?>
<h2 class="w3-center">Nu puteți șterge această categorie.</h2>
<p class="w3-center">Există legături alocate ei. Mai întâi ștergeți legăturile, apoi încercați din nou.</p>
<?php }else{
?>
<h2 class="w3-center">Sunteți sigur(ă) de această acțiune?</h2>
<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-red w3-border w3-border-black w3-hover-black w3-margin-bottom" >DA! Șterg categoria</button>
</div>
<?php } ?>

<input type="hidden" name="cteID" value="<?=$rwcext['catext_id']?>"/>
<input type="hidden" name="removecatextlink" value="true"/>

</div>
</form>

</div>

</div></div></div>
        
<div id="addlinkcatext<?=$rwcext['catext_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('addlinkcatext<?=$rwcext['catext_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-seagreen w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-plus"></i> Adaugă legătură</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="text" name="extl_name" placeholder="Numele adresei" required=""/>
</div>

<div class="w3-col l12 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="url" name="extl_url" placeholder="https:// Adresa URL" required=""/>
</div>

<div class="w3-col l4 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="number" name="sort" placeholder="Sortare numerică" required=""/>
</div>

<div class="w3-col l4 m12 s12">
<select class="w3-select w3-margin-bottom" name="target" style="" required="">
<option value="" selected="" disabled="">Se deschide către</option>
 <option value="_blank">Fereastră nouă</option>
 <option value="mainFrame">În aceeași fereastră</option>
</select>
</div>

<div class="w3-col l4 m12 s12">
<input type="checkbox" class="w3-check" name="setopen" value="0"/> - Adresă implicită
</div>


<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-bluepm w3-border w3-border-cadetblue w3-hover-seagreen w3-margin-bottom" >Adaugă</button>
</div>

<input type="hidden" name="cteID" value="<?=$rwcext['catext_id']?>"/>
<input type="hidden" name="usrID" value="<?=$_SESSION['uid']?>"/>
<input type="hidden" name="addlinkstomainframes" value="true"/>

</div>
</form>

</div>

</div></div></div>
        
<?php
        // End Modal Add links
        
        //}
        
        echo '</div>';
        
        
    }
    
 }else{
    echo '<h2 class="w3-center w3-text-gray">Nu sunt categorii/țări adăugate!</h2>';
 }
$dbc->close();
?>



</div>

</div>

</div>
         

<?php
   }elseif($page == 'admin-links'){ // admin links
          ?>

<style>
.col-container {
    display: table; /* Make the container element behave like a table */
    width: 100%; /* Set full-width to expand the whole page */
}

.col {
    display: table-cell; /* Make elements inside the container behave like table cells */
}
</style>

<div class="col-container">

<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">
<?php include THM.$set['theme'].'/admin_sidebar.php';?>
</div>

<div class="w3-col w3-container w3-rest w3-border col" style="float:none;width:100%;margin-left:300px;">

<div class="w3-row w3-border-bottom">

<?php if(isset($addedok)){?>
<div class="w3-col l12 m12 s12">
<div class="w3-panel w3-seagreen"><h5><i class="fa fa-check"></i> <?=$addedok?></h5></div>
</div>
<?php } ?>

<?php if(isset($lnkremovefromdb)){?>
<div class="w3-col l12 m12 s12">
<div class="w3-panel w3-seagreen"><h5><i class="fa fa-check"></i> <?=$lnkremovefromdb?></h5></div>
</div>
<?php } ?>

<?php if(isset($add_error)){?>
<div class="w3-col l12 m12 s12">
<div class="w3-panel w3-red"><h5><i class="fa fa-remove"></i> <?=$add_error?></h5></div>
</div>
<?php } ?>

<div class="w3-left">
<h2 class="w3-text-bluepm"><i class="fa fa-sitemap"></i> Legături</h2>
</div>

<div class="w3-right"><h3 class="w3-text-bluepm">
<a onclick="document.getElementById('dsf45gff3r4tygdf65').style.display='block'" class="w3-button w3-block_ w3-bluepm w3-hover-seagreen w3-padding-small">
<i class="fa fa-plus"></i> <span class="w3-hide-small">Adaugă</span></a></h3></div>



<div id="dsf45gff3r4tygdf65" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('dsf45gff3r4tygdf65').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-seagreen w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-plus"></i> Adaugă categorie</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="text" name="catext_name" placeholder="Numele categoriei" required=""/>
</div>

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="number" name="sort" placeholder="Sortare numerică" required=""/>
</div>

<div class="w3-col l12 m12 s12">
<textarea class="w3-input w3-border w3-margin-bottom" rows="3" name="catext_description" placeholder="O descriere a categoriei">
</textarea>
</div>

<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-bluepm w3-border w3-border-cadetblue w3-hover-seagreen w3-margin-bottom" >Adaugă</button>
</div>

<input type="hidden" name="usrID" value="<?=$_SESSION['uid']?>"/>
<input type="hidden" name="location" value="links"/>
<input type="hidden" name="addcateglinkscompetitii" value="true"/>

</div>
</form>

</div>

</div></div></div>


</div>

<div class="w3-row w3-margin-top w3-margin-bottom">

<?php include(BASE);
$getcatext = $dbc->query("SELECT * FROM `categlinks` WHERE `catext_loc`='links' ORDER BY `sort` ASC") or die($dbc->error);

if($getcatext->num_rows > 0){
        
        echo '<div class="w3-row w3-bluepm w3-hide-medium w3-hide-small w3-margin-bottom">';
        
        echo '<div class="w3-container w3-col l4 m6 s12">';
        echo '<h5>Categorie/Link</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-col l4 m6 s12">';
        echo '<h5>Adresă</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-center w3-col l2 m4 s4">';
        echo '<h5>Poziție</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-center w3-col l2 m8 s8">';
        echo '<h5>Acțiuni</h5>';
        echo '</div>';
        
        echo '</div>';
        
    while($rwcext = $getcatext->fetch_assoc()){        
        
        echo '<div class="w3-row w3-card w3-margin-bottom">';        
        
        echo '<div class="w3-container w3-col l4 m4 s8 w3-border-bottom">';
        echo '<h5>'.$rwcext['catext_name'].'</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-col l4 m4 w3-hide-small w3-border-bottom">';
        echo '<h5>/'.$rwcext['catext_loc'].'/</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-center w3-col l2 m2 w3-hide-small w3-border-bottom">';
        echo '<h5>'.$rwcext['sort'].'</h5>';
        echo '</div>';
        
        echo '<div class="w3-container w3-center w3-col l2 m2 s4 w3-border-bottom"><h5>';
        echo '<a onclick="document.getElementById(\'editcatext'.$rwcext['catext_id'].'\').style.display=\'block\'" class="w3-link w3-bluepm" style="cursor:pointer;"><i class="fa fa-fw fa-pencil"></i></a> ';
        echo '<a onclick="document.getElementById(\'deletecatextl'.$rwcext['catext_id'].'\').style.display=\'block\'" class="w3-link w3-red" style="cursor:pointer;"><i class="fa fa-fw fa-remove"></i></a> ';
        echo '<a onclick="document.getElementById(\'addlinkcatext'.$rwcext['catext_id'].'\').style.display=\'block\'" class="w3-link w3-seagreen" style="cursor:pointer;"><i class="fa fa-fw fa-plus"></i></a>';
        echo '</h5></div>';
        
        $getlinksfromcatext = $dbc->query("SELECT * FROM `extlinks` WHERE `catext_id`='{$rwcext['catext_id']}'") or die($dbc->error);
        
        if($getlinksfromcatext->num_rows > 0){
            
             echo '<div class="w3-row w3-border-bottom">';
             
             echo '<div class="w3-container w3-col l1 m12 s12 w3-seagreen">';
             echo 'Sortare';
             echo '</div>';
             
             echo '<div class="w3-container w3-col l3 m12 s12 w3-seagreen">';
             echo 'Denumire';
             echo '</div>';
             
             echo '<div class="w3-container w3-col l6 m12 s12 w3-seagreen">';
             echo 'Adresă URL';
             echo '</div>';
             
             echo '<div class="w3-container w3-center w3-col l2 m12 s12 w3-seagreen">';
             echo 'Acțiuni';
             echo '</div>';
             
             echo '</div>';
            
            while($rwextl = $getlinksfromcatext->fetch_assoc()){
                
                echo '<div class="w3-row w3-border-bottom">';
                echo '<div class="w3-container w3-col l1 m12 s12">';
                
                if($rwextl['extl_default'] === '1'){
                 echo $rwextl['sort'].' <i class="fa fa-fw fa-check w3-text-seagreen"></i>';
                }else{
                 echo $rwextl['sort'];                
                 }              
                
                echo '</div>';
                
                echo '<div class="w3-container w3-col l3 m12 s12">';
                echo $rwextl['extl_name'];
                echo '</div>';
                
                echo '<div class="w3-container w3-col l6 m12 s12">';
                echo $rwextl['extl_url'];
                echo '</div>';
                
                echo '<div class="w3-container w3-center w3-col l2 m12 s12">';
                
                echo '<a onclick="document.getElementById(\'editLinks'.$rwextl['extl_id'].'\').style.display=\'block\'" style="cursor:pointer;">';
                echo '<i class="fa fa-fw fa-pencil w3-bluepm"></i> ';                
                echo '</a>';
                
                echo '<a onclick="document.getElementById(\'removeLinks'.$rwextl['extl_id'].'\').style.display=\'block\'" style="cursor:pointer;">';
                echo '<i class="fa fa-fw fa-remove w3-red"></i>';
                echo '</a>';
                
                echo '</div>';
                
                echo '</div>'; // Start Links Modal ?>
                

<div id="editLinks<?=$rwextl['extl_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('editLinks<?=$rwextl['extl_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-seagreen w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-pencil"></i> Editează Legătură</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="text" name="extl_name" placeholder="Numele adresei" value="<?=$rwextl['extl_name']?>" required=""/>
</div>

<div class="w3-col l12 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="url" name="extl_url" placeholder="https:// Adresa URL" value="<?=$rwextl['extl_url']?>" required=""/>
</div>

<div class="w3-col l4 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="number" name="sort" placeholder="Sortare numerică" value="<?=$rwextl['sort']?>" required=""/>
</div>

<div class="w3-col l4 m12 s12">
<select class="w3-select w3-margin-bottom" name="target" style="" required="">
 <option value="" disabled="">Se deschide către</option>
 <option <?php if($rwextl['extl_target'] === '_blank'){echo 'selected="" ';}?> value="_blank">Fereastră nouă</option>
 <option <?php if($rwextl['extl_target'] === 'mainFrame'){echo 'selected="" ';}?> value="mainFrame">În aceeași fereastră</option>
</select>
</div>

<div class="w3-col l4 m12 s12">
<input type="checkbox" class="w3-check" name="setopen" <?php if($rwextl['extl_default'] == 1){echo 'value="1" checked="checked"';}else{echo 'value="0"';}?>/> - Adresă implicită
</div>


<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-bluepm w3-border w3-border-cadetblue w3-hover-seagreen w3-margin-bottom" >Actualizează</button>
</div>

<input type="hidden" name="cteID" value="<?=$rwcext['catext_id']?>"/>
<input type="hidden" name="lnkID" value="<?=$rwextl['extl_id']?>"/>
<input type="hidden" name="usrID" value="<?=$_SESSION['uid']?>"/>
<input type="hidden" name="updatelinkstomainframes" value="true"/>

</div>
</form>

</div>

</div></div></div>


<div id="removeLinks<?=$rwextl['extl_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('removeLinks<?=$rwextl['extl_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-red w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-trash"></i> Șterge Legătură</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<h2 class="w3-center">Sunteți sigur(ă) de această acțiune?</h2>
<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-red w3-border w3-border-black w3-hover-black w3-margin-bottom" >DA! Șterg legătura</button>
</div>

<input type="hidden" name="lnkID" value="<?=$rwextl['extl_id']?>"/>
<input type="hidden" name="removeXtlink" value="true"/>

</div>
</form>

</div>

</div></div></div>
                
                
           <?php } // End Links Modal
            
            
        }else{
        
        echo '<div class="w3-container w3-center w3-col l12 m12 s12">';
        echo '<h5>Nu sunt legături adăugate</h5>';
        echo '</div>';
        }
        // Modal Add links
        ?>

<div id="editcatext<?=$rwcext['catext_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('editcatext<?=$rwcext['catext_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-seagreen w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-pencil"></i> Editare categorie</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="text" name="catext_name" placeholder="Numele categoriei" value="<?=$rwcext['catext_name']?>" required=""/>
</div>

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="number" name="sort" placeholder="Sortare numerică" value="<?=$rwcext['sort']?>" required=""/>
</div>

<div class="w3-col l12 m12 s12">
<textarea class="w3-input w3-border w3-margin-bottom" rows="3" name="catext_description" placeholder="O descriere a categoriei"><?=$rwcext['catext_description']?></textarea>
</div>

<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-bluepm w3-border w3-border-cadetblue w3-hover-seagreen w3-margin-bottom" ><i class="fa fa-fw fa-refresh"></i> Actualizează</button>
</div>

<input type="hidden" name="usrID" value="<?=$_SESSION['uid']?>"/>
<input type="hidden" name="catID" value="<?=$rwcext['catext_id']?>"/>
<input type="hidden" name="location" value="competitii"/>
<input type="hidden" name="updatecateglinkscompetitii" value="true"/>

</div>
</form>

</div>

</div></div></div>

<div id="deletecatextl<?=$rwcext['catext_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('deletecatextl<?=$rwcext['catext_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-red w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-trash"></i> Șterge Categorie</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">
<?php
$checkifcathavelinks = $dbc->query("SELECT * FROM `extlinks` WHERE `catext_id`='{$rwcext['catext_id']}'") or die($dbc->error);
if($checkifcathavelinks->num_rows > 0){ ?>
<h2 class="w3-center">Nu puteți șterge această categorie.</h2>
<p class="w3-center">Există legături alocate ei. Mai întâi ștergeți legăturile, apoi încercați din nou.</p>
<?php }else{
?>
<h2 class="w3-center">Sunteți sigur(ă) de această acțiune?</h2>
<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-red w3-border w3-border-black w3-hover-black w3-margin-bottom" >DA! Șterg categoria</button>
</div>
<?php } ?>

<input type="hidden" name="cteID" value="<?=$rwcext['catext_id']?>"/>
<input type="hidden" name="removecatextlink" value="true"/>

</div>
</form>

</div>

</div></div></div>
        
<div id="addlinkcatext<?=$rwcext['catext_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;">
<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">

<span onclick="document.getElementById('addlinkcatext<?=$rwcext['catext_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row">

<div class="w3-container w3-seagreen w3-card">
<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-plus"></i> Adaugă legătură</h3>
</div>

<div class="w3-container w3-bluepm">
<form action="" method="POST">

<div class="w3-row-padding w3-margin-top">

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="text" name="extl_name" placeholder="Numele adresei" required=""/>
</div>

<div class="w3-col l12 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="url" name="extl_url" placeholder="https:// Adresa URL" required=""/>
</div>

<div class="w3-col l4 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="number" name="sort" placeholder="Sortare numerică" required=""/>
</div>

<div class="w3-col l4 m12 s12">
<select class="w3-select w3-margin-bottom" name="target" style="" required="">
<option value="" selected="" disabled="">Se deschide către</option>
 <option value="_blank">Fereastră nouă</option>
 <option value="mainFrame">În aceeași fereastră</option>
</select>
</div>

<div class="w3-col l4 m12 s12">
<input type="checkbox" class="w3-check" name="setopen" value="0"/> - Adresă implicită
</div>


<div class="w3-col l12 m12 s12 w3-center">
<button type="submit" class="w3-button w3-bluepm w3-border w3-border-cadetblue w3-hover-seagreen w3-margin-bottom" >Adaugă</button>
</div>

<input type="hidden" name="cteID" value="<?=$rwcext['catext_id']?>"/>
<input type="hidden" name="usrID" value="<?=$_SESSION['uid']?>"/>
<input type="hidden" name="addlinkstomainframes" value="true"/>

</div>
</form>

</div>

</div></div></div>
        
<?php
        // End Modal Add links
        
        //}
        
        echo '</div>';
        
        
    }
    
 }else{
    echo '<h2 class="w3-center w3-text-gray">Nu sunt categorii/țări adăugate!</h2>';
 }
$dbc->close();
?>



</div>

</div>

</div>
         

<?php
   }elseif($page == 'admin-email-template'){ // admin email template
   
   include(BASE);
   $etq = $dbc->query("SELECT * FROM `email_template` ORDER BY `et_id` ASC") or die($dbc->error);
   $dbc->close();
   
          ?>

<style>
.col-container {
    display: table; /* Make the container element behave like a table */
    width: 100%; /* Set full-width to expand the whole page */
}

.col {
    display: table-cell; /* Make elements inside the container behave like table cells */
}
</style>

<div class="col-container">

<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">
<?php include THM.$set['theme'].'/admin_sidebar.php';?>
</div>

<div class="w3-col w3-container w3-rest w3-border col" style="float:none;width:100%;margin-left:300px;">

<h2 class="w3-text-bluepm w3-border-bottom"><i class="fa fa-envelope-o"></i> Șabloane E-mail</h2>

<div class="w3-row w3-margin-top w3-margin-bottom">



<?php
while($ret = $etq->fetch_assoc()){
?>


<div class="w3-row w3-bluepm w3-margin-bottom">

<div class="w3-container w3-col l8 m8 s8">
<h5><?=$lng[$ret['title']]?></h5>
</div>

<div class="w3-container w3-col l4 m4 s4">
<h5 class="w3-right">
<a onclick="document.getElementById('editse<?=$ret['et_id']?>').style.display='block'" style="cursor:pointer;">
<i class="fa fa-pencil-square-o"></i>
</a></h5>
</div>

</div>

<!-- Modal -->
<div id="editse<?=$ret['et_id']?>" class="w3-modal" style="z-index:1007;margin-top:0px;"> <!-- 1 -->

<div class="w3-modal-content w3-animate-top" style="width:1200px;max-width:100%;margin:auto;"> <!-- 2 -->

<span onclick="document.getElementById('editse<?=$ret['et_id']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row w3-bluepm">
<h4 class="w3-container "><?=$lng[$ret['title']]?></h4>
</div>

<div class="w3-row-padding w3-margin-top w3-center">

<div class="w3-bar w3-seagreen">

<button class="w3-bar-item w3-button tablink w3-bluepm w3-hover-bluepm" onclick="openSet(event,'et_ro<?=$ret['et_id']?>')"><?=$lng['lang_romana']?></button>
<button class="w3-bar-item w3-button tablink w3-hover-bluepm" onclick="openSet(event,'et_en<?=$ret['et_id']?>')"><?=$lng['lang_english']?></button>
</div>



<form action="" method="post">

<div id="et_ro<?=$ret['et_id']?>" class="w3-container set">
<textarea class="w3-input w3-border" rows="10" name="et_content_ro" placeholder="<?=$lng['adm_content_ph']?>...">
<?=$ret['content_ro']?>
</textarea>
</div>

<div id="et_en<?=$ret['et_id']?>" class="w3-container set" style="display:none">
<textarea class="w3-input w3-border" rows="10" name="et_content_en" placeholder="<?=$lng['adm_content_ph']?>...">
<?=$ret['content_en']?>
</textarea>
</div>

<button type="submit" class="w3-button w3-bluepm w3-hover-seagreen"><?=$lng['adm_update_btn']?></button>
<input type="hidden" name="etID" value="<?=$ret['et_id']?>"/>
<input type="hidden" name="fn" value="<?=$_SESSION['first_name']?>"/>
<input type="hidden" name="" value=""/>
<input type="hidden" name="templatemodedir" value="true"/>
</form>
</div>

<div class="w3-row-padding w3-margin-top">

<div class="w3-col l6 m6 s12 w3-margin-bottom w3-card">
<h5><strong><?=$lng['adm_html_code_txt']?></strong></h5>

<div class="w3-col l5 m5 s5">&lt;p&gt; ... &lt;/p&gt;</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <?=$lng['adm_paragraph_txt']?></div>

<div class="w3-col l5 m5 s5">&lt;br /&gt;</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <?=$lng['adm_next_line_txt']?></div>

<div class="w3-col l5 m5 s5">&lt;strong&gt;bold&lt;/strong&gt;</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <strong><?=$lng['adm_bold_text_txt']?></strong></div>

<div class="w3-col l5 m5 s5">&lt;em&gt;italic&lt;/em&gt;</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <em><?=$lng['adm_italic_text_txt']?></em></div>

<div class="w3-col l5 m5 s5">&lt;ins&gt;underline&lt;/ins&gt;</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <ins><?=$lng['adm_underline_text_txt']?></ins></div>



</div>

<div class="w3-col l6 m6 s12 w3-margin-bottom w3-card">
<h5><strong><?=$lng['adm_custom_codes_txt']?></strong></h5>

<p class="w3-text-red"><em><?=$lng['adm_custom_codes_alert_txt']?></em></p>

<div class="w3-col l5 m5 s5">{{ first_name }}</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <?=$lng['adm_first_name_txt']?></div>

<div class="w3-col l5 m5 s5">{{ user_email }}</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <?=$lng['adm_user_email_txt']?></div>

<div class="w3-col l5 m5 s5">{{ user_pass }}</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <?=$lng['adm_user_pass_txt']?></div>

<div class="w3-col l5 m5 s5">{{ user_name }}</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <?=$lng['adm_user_name_txt']?></div>

<div class="w3-col l5 m5 s5">{{ confirm_code }}</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <?=$lng['adm_confirmation_code_txt']?></div>

<div class="w3-col l5 m5 s5">{{ msgtousr }}</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <?=$lng['adm_code_message_content_txt']?></div>

<div class="w3-col l5 m5 s5">{{ passreset }}</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <?=$lng['adm_code_pass_reset_txt']?></div>

<div class="w3-col l5 m5 s5">{{ site_name }}</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <?=$lng['adm_site_name_txt']?></div>

<div class="w3-col l5 m5 s5">{{ link_site }}</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <?=$lng['adm_open_site_link_txt']?></div>

<div class="w3-col l5 m5 s5">{{ end_link_site }}</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <?=$lng['adm_closed_site_link_txt']?></div>

<div class="w3-col l5 m5 s5">{{ site_login }}</div>
<div class="w3-col l7 m7 s7 w3-pale-blue">- <?=$lng['adm_link_to_connection_txt']?></div>


</div>

</div>

</div> <!-- END 2 -->

</div> <!-- END 1 -->
<!-- END Modal -->

<?php
if(isset($notAuth)){echo '<h1>'.$notAuth.'</h1>';}
if(isset($updated_et)){echo '<h1>'.$updated_et.'</h1>';}
if(isset($not_updated)){echo '<h1>'.$not_updated.'</h1>';}
//if(isset($robc)){echo '<h1>'.$robc.'</h1>';}
//print_r($_SESSION);
//echo '<p>&nbsp;</p>';
//print_r($_POST);
?>

<?php  
echo '<script>';
echo 'function openSet(evt, setName) {';
echo 'var i, x, tablinks;';
echo 'x = document.getElementsByClassName("set");';
echo 'for (i = 0; i < x.length; i++) {';
echo 'x[i].style.display = "none";';
echo '}';
echo 'tablinks = document.getElementsByClassName("tablink");';
echo 'for (i = 0; i < x.length; i++) {';
echo 'tablinks[i].className = tablinks[i].className.replace(" w3-bluepm", "");';
echo '}';
echo 'document.getElementById(setName).style.display = "block";';
echo 'evt.currentTarget.className += " w3-bluepm";';
echo '}';
echo '</script>';

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

 } ?>

</div>

</div>

</div>
         

<?php
   }elseif($page == 'super-admin-users'){ // admin languages
include(BASE);         
$getlangcode = $dbc->query("SELECT * FROM `languages` ORDER BY `lang_id` ASC") or die($dbc->error);
$dbc->close();
?>

<style>
.col-container {
    display: table; /* Make the container element behave like a table */
    width: 100%; /* Set full-width to expand the whole page */
}

.col {
    display: table-cell; /* Make elements inside the container behave like table cells */
}
</style>

<div class="col-container">

<div class="w3-col w3-card col w3-hide-small w3-hide-medium" style="width:300px;">
<?php include THM.$set['theme'].'/admin_sidebar.php';?>
</div>

<div class="w3-col w3-container w3-rest w3-border col" style="float:none;width:100%;margin-left:300px;">

<h2 class="w3-text-bluepm w3-border-bottom"><i class="fa fa-language"></i> Traduceri</h2>

<div class="w3-row-padding w3-margin-top w3-margin-bottom">

<?php

include(BASE);
$getisforen = $dbc->query("SELECT DISTINCT(`is_for`) FROM `lang_content` WHERE `lang_id`='1' ORDER BY `is_for` ASC") or die($db->error);

$getisforro = $dbc->query("SELECT DISTINCT(`is_for`) FROM `lang_content` WHERE `lang_id`='2' ORDER BY `is_for` ASC") or die($db->error);
  
$getlangcontens = $dbc->query("SELECT * FROM `lang_content` ORDER BY `langc_id` ASC") or die($dbc->error);
$rowlcs = array();
while($rowlc = $getlangcontens->fetch_assoc()){
    $rowlcs[] = $rowlc;
 }
$dbc->close();

echo '<div class="w3-bar w3-seagreen">';
echo '<button class="w3-bar-item w3-button tablink w3-bluepm w3-hover-bluepm" onclick="openSet(event,\'en\')">Engleză</button>';
echo '<button class="w3-bar-item w3-button tablink w3-hover-bluepm" onclick="openSet(event,\'ro\')">Română</button>';
echo '</div>';

echo '<div id="en" class="w3-container w3-border set">';
echo '<h2>Limba engleză</h2>';

 

foreach($getisforen as $gfor){
    echo '<h3 onclick="document.getElementById(\'editlc'.$gfor['is_for'].'\').style.display=\'block\'" style="cursor:pointer;" class="w3-bluepm w3-container">'.str_replace('_', ' ', ucfirst($gfor['is_for'])).'</h3>'; ?>
    
    
    <!-- Modal -->
<div id="editlc<?=$gfor['is_for']?>" class="w3-modal" style="z-index:1007;margin-top:0px;"> <!-- 1 -->

<div class="w3-modal-content w3-animate-top" style="width:1200px;max-width:100%;margin:auto;"> <!-- 2 -->

<span onclick="document.getElementById('editlc<?=$gfor['is_for']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row w3-bluepm">
<h4 class="w3-container "><?=$gfor['is_for']?></h4>
</div>

<div class="w3-row-padding w3-margin-top w3-center">
<?php 
foreach($rowlcs as $rowlc) {
if(($rowlc['is_for'] == $gfor['is_for']) && ($rowlc['lang_id'] == '1')){                
echo '<input class="w3-input w3-card w3-col l5 m5 s5" value="'.$rowlc['name'].'" disabled="">';                
echo '<input class="w3-input w3-card w3-col l5 m5 s5" value="'.$rowlc['value'].'">';
echo '<button class="w3-button w3-block w3-bluepm w3-hover-seagreen w3-col l2 m2 s2 w3-card">Salvare</button>';
  }         
 }  
?>
</div>

</div>
</div>
    
  <?php  
    
        
   }

echo '</div>';


echo '<div id="ro" class="w3-container w3-border set" style="display:none">';
echo '<h2>Limba română</h2>';


foreach($getisforro as $gfor){
    echo '<h3 onclick="document.getElementById(\'editlcro'.$gfor['is_for'].'\').style.display=\'block\'" style="cursor:pointer;" class="w3-bluepm w3-container">'.str_replace('_', ' ', ucfirst($gfor['is_for'])).'</h3>'; ?>
    
    
    <!-- Modal -->
<div id="editlcro<?=$gfor['is_for']?>" class="w3-modal" style="z-index:1007;margin-top:0px;"> <!-- 1 -->

<div class="w3-modal-content w3-animate-top" style="width:1200px;max-width:100%;margin:auto;"> <!-- 2 -->

<span onclick="document.getElementById('editlcro<?=$gfor['is_for']?>').style.display='none'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>

<div class="w3-row w3-bluepm">
<h4 class="w3-container "><?=$gfor['is_for']?></h4>
</div>

<div class="w3-row-padding w3-margin-top w3-center">
<?php 
foreach($rowlcs as $rowlc) {
if(($rowlc['is_for'] == $gfor['is_for']) && ($rowlc['lang_id'] == '2')){                
echo '<input class="w3-input w3-card w3-col l5 m5 s5" value="'.$rowlc['name'].'" disabled="">';                
echo '<input class="w3-input w3-card w3-col l5 m5 s5" value="'.$rowlc['value'].'">';
echo '<button class="w3-button w3-block w3-bluepm w3-hover-seagreen w3-col l2 m2 s2 w3-card">Salvare</button>';
  }         
 }  
?>
</div>

</div>
</div>
    
  <?php  
    
        
   }


//if($getlangcode->num_rows > 0){
//while($rwlangs = $getlangcode->fetch_assoc()){
 //   $langscode = $rwlangs['lang_code'];
 //   $langsgtID = $rwlangs['lang_id'];
 
 //   }
 //}
 ?>

</div>

</div>

</div>
         

<?php

echo '<script>';
echo 'function openSet(evt, setName) {';
echo 'var i, x, tablinks;';
echo 'x = document.getElementsByClassName("set");';
echo 'for (i = 0; i < x.length; i++) {';
echo 'x[i].style.display = "none";';
echo '}';
echo 'tablinks = document.getElementsByClassName("tablink");';
echo 'for (i = 0; i < x.length; i++) {';
echo 'tablinks[i].className = tablinks[i].className.replace(" w3-bluepm", "");';
echo '}';
echo 'document.getElementById(setName).style.display = "block";';
echo 'evt.currentTarget.className += " w3-bluepm";';
echo '}';
echo '</script>';

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

   }
 }else{
    $url = PATH.'myaccount.html';
    ob_end_clean();
    header("Location: $url");
    exit();
  }
}else{
    $url = PATH.'login.html';
    ob_end_clean();
    header("Location: $url");
    exit();
  }
?>