format($format) == $date; } function checkValue($id,$idx){ if($idx==1){ if($_POST[$id]!=""){ if(strlen($_POST[$id])!=1){ $jsone['result'] = "Fail"; $jsone['message'] = "You have entered a wrong length on " . $id . ", it should be 1 byte"; echo json_encode($jsone); exit; } if(!is_numeric($_POST[$id])){ $jsone['result'] = "Fail"; $jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric"; echo json_encode($jsone); exit; } } } if($idx==2){ if($_POST[$id]!=""){ if(strlen($_POST[$id])!=1){ $jsone['result'] = "Fail"; $jsone['message'] = "You have entered a wrong length on " . $id . ", it should be 1 byte"; echo json_encode($jsone); exit; } if(!is_numeric($_POST[$id])){ $jsone['result'] = "Fail"; $jsone['message'] = "You have entered a wrong value on " . $id . ", it should be 0 or 1"; echo json_encode($jsone); exit; } } } // if($idx==2){ // if($_POST[$id]!=""){ // if(strlen($_POST[$id])>2){ // $jsone['result'] = "Fail"; // $jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric"; // echo json_encode($jsone); // exit; // } // if(!is_numeric($_POST[$id]) & !is_numeric($_POST[$id])){ // $jsone['result'] = "Fail"; // $jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric"; // echo json_encode($jsone); // exit; // } // } // } } ?>