<?php

require_once('connect.php');

// Created by Ilhomjon on 30.09.2020

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

    if ($_POST['agent_id']!="" && $_POST['zakaz_txt']!="" ) {

        $agent_id = $_POST['agent_id'];
        $kontr_id = $_POST['kontr_id'];
        $zakaz_txt = $_POST['zakaz_txt'];
        $vaqti = $_POST['vaqti'];
        $zakaz_raqam = $_POST['zakaz_raqam'];
        $zakaz_int = $_POST['zakaz_int'];


         date_default_timezone_set('Asia/Tashkent');
        $timestamp = time();
        $date_time = date("H:i:s d.m.Y", $timestamp);

        mysqli_set_charset($conn,"utf8");
        $query = mysqli_query($conn,"SET NAMES utf8");

        $txt = $date_time."^".$txt;

        $query = "INSERT INTO zakaz (agent_id, kontr_id, malumot, vaqti, zakaz_raqam, zakaz_int) VALUES ('$agent_id','$kontr_id','$zakaz_txt','$vaqti','$zakaz_raqam','$zakaz_int')";

        if(mysqli_query($conn, $query)){
         echo "ok";
        }else{
         echo "no";

        }


    }else{
          echo "no_c";
    }
}
else
{
     echo "error";
}

$conn->close();
?>
