<?php
$must_login     = false ;
$require_path   = '../../' ;
$require_sub    = '../' ;
require( $require_sub.'header.php' ) ;

$status         = '300' ;
$test_file      = $array['test_file'] ;

// if ( $array['name'] != '' && $array['mobile'] != '' && $array['temperature'] != '' ){
if ( $array['name'] != '' && $array['mobile'] != '' ){
    $status     = '203' ;

    /*
    $test_filename = '' ;
    $test_filetype = '' ;
    foreach ( $test_file as $k => $v ){
        if ( $v['type']  == 'local' ){
            $file_upload  = ( $v['file'] ) ;
            $upload       = uploadImage( 'Visitor', md5( $array['name'] ), $file_upload ) ;
            if ( $upload['status'] != '200' ){
                $count_upload++ ;
            }else{
                $test_filename = $upload['data']['file_name'] ;
                $test_filetype = $upload['data']['file_type'] ;
            }
        }
    }

    if ( $test_file != '' ){

        if ( $mysqli->query( "INSERT INTO visitor
                              ( name, mobile, temperature, test_file, test_filetype ) VALUES
                             (  '".$array['name']."', '".$array['mobile']."', '".$array['temperature']."', '".$test_filename."', '".$test_filetype."' )" ) ){
            $status = '200' ;
        }

    }
    */

	if ( $mysqli->query( "INSERT INTO visitor
                          ( name, mobile ) VALUES
                          (  '".$array['name']."', '".$array['mobile']."' )" ) ){
        $status = '200' ;
    }

}

require( $require_sub.'footer.php' ) ;
?>