ValidationServlet.java 를 ValidationServlet.php 으로 :: 2009/09/16 20:26

<?php
/**
* Checks to see whether the argument is a valid date.
* A null date is considered invalid. This method
* used the default data formatter and lenient
* parsing.
*
* @param date a String representing the date to check
* @return message a String represnting the outcome of the check
*/

$formDate = $_GET["birthDate"];

// 넘어온 값을 바로 검증 시켜서 true, false 값을 넣자
$isPassed = validateDate($formDate);
$message = "i love you";

// xml 로 보내주자,
header('Content-Type: text/xml; charset=UTF-8'); // 이줄 ㅈㄴ 중요함.
echo ("<response>");
echo ("<passed>" . $isPassed . "</passed>");
echo ("<message>" . $message . "</message>");
echo ("</response>");

function validateDate($date){
    $isValid = "false";

    // check mm/dd/yyyy
    if($date != ""){
        if(preg_match("/[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{4}/",$date)){
            $isValid = "true";
        }
    }

    return $isValid;

}

?>

이올린에 북마크하기

2009/09/16 20:26 2009/09/16 20:26
Trackback Address :: http://www.foxwolf.net/gihun/trackback/52
↓↓↓ 거침없이 의견 남겨 주세요! ↓↓↓
[로그인][오픈아이디란?]
Name
Password
Homepage

Secret
< PREV |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  ...  37  |  NEXT >