Codice PHP:
<?php function leggi_cvs ($filepath)
{
$filepath= 'studenti.cvs';
$rowlength=6;
$row= array();
if (($handle=fopen("$filepath", "r")) !== FALSE)
while (($row=fgetcvs($handle)) !== FALSE)
{ for ($i=0; $i<$rowlength; $i++ {$rows[]= $row;} }
fclose($handle);}
return $rows;}
function validate_cvs ($rows)
{
return prev_match ("/^[a-z0-9]{0,16}$/i", //stringhe da 0 a 16 caratteri alfanumeric
"/^[a-z0-9]{0,16}$/i",
"/^[a-z0-9]{0,16}$/i",
"/^[a-z0-9]{0,16}$/i", "/bBasicb|bNormalb|bFullb/",
//sole stringhe Basic, Normal, Full
"/^(0[1-9]|[12][0-9]|3[01])[-](0[1-9]|1[012])[-](19|20)dd$/", //stringhe del tipo dd-mm-aaaa )
$file =addslashed (&_REQUEST['file']
echo '{"results":'.json_encode($rows).'}';
php?>;}