<!--
Version: 1.0
Copyright (C) 2002 Herman Veluwenkamp
Version: 2.0
Copyright (C) 2005 Yo Keller
adr-form.php
-->
<html>
<head><title>form template test</title>
<!--
<style>
body,td,select,textarea,input,pre
{ font: 9pt "arial", "helvetica", sans-serif; }
</style>
<link rel="stylesheet" type="text/css" href="style.css" media="all" />
-->
<link rel="stylesheet" type="text/css" href="search-form.css" media="all" />
<script language="javascript" src="formValidated.js"></script>
<script language="javascript" src="../jsrsClient.js"></script>
<script language="javascript" src="adrForm.js"></script>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<?php
session_start();
if (empty($_SESSION['valid_user'])){
$_SESSION['valid_user'] = 'guest';
}
print "<h1>configuration adresse</h1>";
include_once('../jsrsServer.inc.php');
include '../xmlForm.php';
$verb = 0; // verbose flag
$xslForm = join('', file('jsrs-adr_Conf.xsl'));
$xmlConfig = join('', file('adr-form.xml'));
//$xmlConfig = str_replace('&','&',$xmlConfig);
//$xmlConfig = str_replace('&','&',$xmlConfig);
$xmlForm = new xmlForm($xmlConfig);
if ($xmlForm->validationError)
print "<h2>WARNING: configuration error!!</h2>\n".$xmlForm->newConf."<hr />\n";
else {
print "<h2>configuration OK</h2>";
if ($verb) print $xmlForm->newConf;
//print "<hr />\n";
}
if ($verb) print "magic quotes?:".get_magic_quotes_gpc()."<br />\n";
// do server-side validation
$data = $_REQUEST; //$HTTP_GET_VARS;
if (!empty($data)) {
foreach($data as $k => $v){
if (empty($v)) $v = '';
if (empty($k)) $k = 0;
//$v = htmlentities($v,ENT_QUOTES);
$data[$k] = $v;
}
if ($verb){echo "data:<pre> "; print_r($data); echo "</pre>***<br />\n";}
$result = $xmlForm->validate($data); //validate($v_data);
if (!$result){
print "<h2>input data Error</h2> validationError: erroneous data, insufficient data (or no data at all?)<br />\n";
if($verb)print $xmlForm->newConf;
print "<hr />\n";
}
else print "<h2>data OK</h2><hr />\n";
}
// prepare html form for display
$result = $xmlForm->xslTransform($xslForm, array());
if ($result){
jsrsLog($xmlForm->output,"<div id='".date('r')."'/>",'jsrsLog.html');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<?php
print $xmlForm->output;
?>
</body>
</html>
<?php
}
else print $xmlForm->error;
?>
</body>
</html>
|