Location: PHPKode > scripts > hrwsPassport > hrwspassport/hrwsPassport.demo.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Identity Card and Passport Check - Demo</title>
</head>

<body>
<h2>Validation of German Identity Cards or Passport Numbers</h2>

<?php
if (isset($_POST['codea'])) {
	require_once('hrwsPassport.class.php');
	$card = new hrwsPassport();
	$values = $card->pak_check(array($_POST['codea'],$_POST['codeb'],$_POST['codec'],$_POST['coded']));
	if ($values['valid'] == true) {
		echo "Numbers are valid!<br>".
			"Age: ".$values['age']."<br>Birthdate: ";
		if ($values['birthday'] == -1) {
			$monname = array("", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
			echo sprintf("%02d. %s %04d",$values['bday'],$monname[$values['bmonth']],$values['byear']);
		} else echo strftime("%d. %b %Y", $values['birthday']);
		echo "<br>Valid until: ".strftime("%d. %b %Y", $values['validto'])."<br>\n";
	} else if ($values['error'] == -1) echo "This Identity Card or Passport has expired!<br>";
	else echo "Wrong numbers! Please check again.<br>";
}

	echo "<br><form action=\"\" method=\"post\">".
		"Please enter your Identity Card or Passport numbers:<br>\n".
		"<input type=\"Text\" name=\"codea\" size=\"10\" maxlength=\"10\" value=\"".$_POST['codea']."\">\n".
		"<input type=\"Text\" name=\"codeb\" size=\"7\" maxlength=\"7\" value=\"".$_POST['codeb']."\">\n".
		"<input type=\"Text\" name=\"codec\" size=\"7\" maxlength=\"7\" value=\"".$_POST['codec']."\">\n".
		"<input type=\"Text\" name=\"coded\" size=\"1\" maxlength=\"1\" value=\"".$_POST['coded']."\">\n".
		"<input type=\"Submit\" value=\"validate\"><br>\n".
		"</form>\n";

?>

</body>
</html>
Return current item: hrwsPassport