<?php
    session_start();
    require_once "user_Json.php";
 
    
    require_once "baratok_Json.php";

    
?>
<!DOCTYPE HTML >
<html lang="hu">
<head>
  <meta charset="utf-8">
    <title>Ismerös keres</title>
    <link href="../css/op/barat.css" rel="stylesheet" type="text/css">
    <link rel="shortcut icon" sizes="256x256" href="kep.php?id=0" >

    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
<body id='ikeres_body'>
<form action='ismeros_keres.php' method='post' id='ikeres_form'>
        <input type='text' name='ikeres_text_nev' id='ikeres_text_nev'>
        
        <input type='number' name='ikeres_id' id='ikeres_id' min=-1 value=-1>
        <input type='submit' value='keres' id='keres_button' >
      </form>
    <?php
      $s="";
        if(isset($_POST['ikeres_id'])&& $_POST['ikeres_id']>-1){
            $T=user_keres($_POST['ikeres_id'],false,$GLOBALS['user_json']);
            if($T!=null){
                
                    $s= playyer_list_tostring($T->id,"+","add","add");
                
            }
        }
        

        if(isset($_POST['ikeres_text_nev'])&& !empty($_POST['ikeres_text_nev'])){
            $T=usernev_keres($_POST['ikeres_text_nev'],false,$GLOBALS['user_json']);
            if($T!=null){
                foreach($T as $i){
                    $s.= playyer_list_tostring($i,"+","add","add");
                }
            }
        }
        echo $s;
      

       
    ?>

    <script type="text/javascript">
        function user_add(id){
            var xmlhttp = new XMLHttpRequest();
            $.ajax({
            url: "ismeros_add.php",
            type: "post",
            data:{id:id},
            });
            
        }
    </script>


</body>
</html>