From d43c477605478dc4e66a59d219fad960f0d48c38 Mon Sep 17 00:00:00 2001 From: "Pieter van den Hombergh (homberghp)"
= $sql ?>"); } diff --git a/peer/buit.php b/peer/buit.php deleted file mode 100644 index 609995c..0000000 --- a/peer/buit.php +++ /dev/null @@ -1,148 +0,0 @@ -execute( $sql ); -if ( $resultSet === false ) { - echo ( "
Date time | - -Diplvo | -Cijfer | -Betbew | -Pasprt | -Uittre | -Studielink | -Trans id | - -Operator | -Operator name | -
---|---|---|---|---|---|---|---|---|---|
$date_time | \n" . - "\t$diplvo | \n" . - "\t$cijfer | \n" . - "\t$betbew | \n" . - "\t$pasprt | \n" . - "\t$uittre | \n" . - "\t$renrij | \n" . - "\t$trans_id | \n" . - "\t$operator | \n" . - "\t$operator_name | \n" . - "
$sql1, cause
".$dbConn->ErrorMsg()."\n"; - } - $mustInsert=false; - $ov = array(); - $ov['diplvo'] = $resultSet->fields['diplvo']; - $ov['cijfer'] = $resultSet->fields['cijfer']; - $ov['betbew'] = $resultSet->fields['betbew']; - $ov['pasprt'] = $resultSet->fields['pasprt']; - $ov['uittre'] = $resultSet->fields['uittre']; - $ov['renrij'] = $resultSet->fields['renrij']; - // echo "
\n$sql1\n"; - // echo "
\nov="; - // print_r($resultSet->fields); - // print_r($ov); - - foreach ($_REQUEST['boxes'] as $box) { - if (isSet($_REQUEST[$box])) { - $ov[$box] = 'Ingeleverd'; - } else { - $ov[$box] = 'Gestart'; - } - if ($resultSet->fields[$box] != $ov[$box] ) { - $mustInsert = $mustInsert || true; - } - } - if ($mustInsert) { - $trans_id = $dbConn->transactionStart('jaaglijst update'); - extract($ov); - $sql = "insert into jaaglijst_update (id,cijfer,betbew,diplvo,pasprt,uittre,renrij,trans_id)\n". - "values($id ,'$cijfer','$betbew','$diplvo','$pasprt','$uittre','$renrij',$trans_id);\n"; - $dbConn->log($sql); - $rts=$dbConn->execute($sql); - if ($rts===false){ - $dbConn->Execute("rollback;"); - die("Cannot get update with $sql cause ".$dbConn->ErrorMsg()); - } else { - $dbConn->transactionEnd(); - } - } - // // echo "- - diff --git a/peer/zipit.php b/peer/zipit.php index c1f9822..5178dce 100644 --- a/peer/zipit.php +++ b/peer/zipit.php @@ -1,18 +1,19 @@ Execute( $sql ); diff --git a/peerlib/studentpicker.php b/peerlib/studentpicker.php index 18cd295..1fab8e0 100644 --- a/peerlib/studentpicker.php +++ b/peerlib/studentpicker.php @@ -23,7 +23,7 @@ function __construct(&$con, $newsnummer, $name = 'Add student') { $this->newsnummer = $newsnummer; $this->pickerName = $name; if (isSet($_REQUEST['searchname']) && !preg_match('/;/', $_REQUEST['searchname'])) { - $this->searchString = $_REQUEST['searchname']; + $this->searchString = validate($_REQUEST['searchname'], 'anything','xyz'); } } diff --git a/peerlib/validators.php b/peerlib/validators.php index bb2503f..303c8ee 100644 --- a/peerlib/validators.php +++ b/peerlib/validators.php @@ -1,60 +1,71 @@ array( '/^\d{4,8}$/', 1), - 'doc_id' => array( '/^\d+$/', 0), - 'date' => array( '/^\d{4}-\d{2}-\d{2}','1970-01-01'), - 'prj_id' => array( '/^\d+$/',1), - 'peer_id' => array( '/^\d{4,8}$/', 0 ), - 'milestone'=> array( '/^\d{1,2}$/',1), - 'prj_id_milestone' => array( '/\d+?:\d{1,2}$/','1:1'), - 'prj_id_milestone_grp_num' => array( '/\d+?:\d{1,2}:\d{1,2}$/','1:1:1'), - 'prj_task_id' => array( '/\d+?:\d+?:\d+?$/','0:0:0'), - 'sortorder' => array( '/^(asc|desc)$/','asc'), - 'grp_count' => array( '/^\d{1,2}$/',2), - 'tutor' => array( '/^[A-Z]{3}$/','HEU' ), - 'sclass' => array( '/^\w{1,6}$/','TIPT1' ), - 'grp_num' => array('/^\d{1,3}$/',1), - 'doctype' => array('/^\d+$/',1), - 'fotodir' => array('/^(fotos|mfotos)$/','fotos'), - 'integer' => array('/^\d+$/',1), - 'phone_number' => array('/^\+?(\d|\s){8,20}$/','+31877877777'), - 'signed_integer' => array('/^(\+|-)\d+$/',0), - 'split_minute' => array('/^(\d+\s*days?\s*)?(\d+?(:\d{2}){1,2}|\d{1,2})?$/','0 00:00:00'), - 'timestamp' => array('/^\s*\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/','1955-03-18 21:58:12'), - 'duration' => array('/^\d{2}:\d{2}:\d{2}$/','00:00:00'), - 'cword4' => array('/^\w{1,4}$/','unkn'), - 'cword6' => array('/^\w{1,6}$/','unknow'), - 'email' => array( '/^\w+(\w|\-|\.)*\@[a-zA-Z0-9][a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/','unknown@mythical.com'), - 'project.grp_num' => array( '/^(\w+)?\.\d+$/','dfelt.1'), - 'year_month' => array('/^\d{4}:\d{1,2}$/','2005-01'), - 'grp_num_contact' => array('/^\d+:\d{4,8}$/','1:879417'), - 'countrycode2' => array('/^[A-Z]{2}$/','NL'), - ); + +/* $Id: validators.php 1729 2014-02-06 10:30:18Z hom $ */ +/* + * validator is var name, regex, replacement value + */ +$validators = array( + 'snummer' => array('/^\d{4,8}$/', 1), + 'doc_id' => array('/^\d+$/', 0), + 'date' => array('/^\d{4}-\d{2}-\d{2}', '1970-01-01'), + 'prj_id' => array('/^\d+$/', 1), + 'peer_id' => array('/^\d{4,8}$/', 0), + 'milestone' => array('/^\d{1,2}$/', 1), + 'prj_id_milestone' => array('/\d+?:\d{1,2}$/', '1:1'), + 'prj_id_milestone_grp_num' => array('/\d+?:\d{1,2}:\d{1,2}$/', '1:1:1'), + 'prj_task_id' => array('/\d+?:\d+?:\d+?$/', '0:0:0'), + 'sortorder' => array('/^(asc|desc)$/', 'asc'), + 'grp_count' => array('/^\d{1,2}$/', 2), + 'tutor' => array('/^[A-Z]{3}$/', 'HEU'), + 'sclass' => array('/^\w{1,6}$/', 'TIPT1'), + 'grp_num' => array('/^\d{1,3}$/', 1), + 'doctype' => array('/^\d+$/', 1), + 'fotodir' => array('/^(fotos|mfotos)$/', 'fotos'), + 'integer' => array('/^\d+$/', 1), + 'phone_number' => array('/^\+?(\d|\s){8,20}$/', '+31877877777'), + 'signed_integer' => array('/^(\+|-)\d+$/', 0), + 'split_minute' => array('/^(\d+\s*days?\s*)?(\d+?(:\d{2}){1,2}|\d{1,2})?$/', '0 00:00:00'), + 'timestamp' => array('/^\s*\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/', '1955-03-18 21:58:12'), + 'duration' => array('/^\d{2}:\d{2}:\d{2}$/', '00:00:00'), + 'cword4' => array('/^\w{1,4}$/', 'unkn'), + 'cword6' => array('/^\w{1,6}$/', 'unknow'), + 'email' => array('/^\w+(\w|\-|\.)*\@[a-zA-Z0-9][a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/', 'unknown@mythical.com'), + 'project.grp_num' => array('/^(\w+)?\.\d+$/', 'dfelt.1'), + 'year_month' => array('/^\d{4}:\d{1,2}$/', '2005-01'), + 'grp_num_contact' => array('/^\d+:\d{4,8}$/', '1:879417'), + 'countrycode2' => array('/^[A-Z]{2}$/', 'NL'), + 'anything' => array('/^[A-Za-z0-9_ \.\-\][,]*$/','xyz'), +); + /** * @param $value to be validated * @param $typename : type to validate against * @param $replacement : replacement in $value is invalid * @return $value or replacement if $typename known, 0 if typename unknown */ -function validate($value, $typename, $replacement ) { +function validate($value, $typename, $replacement) { global $validators; - if ( isset( $validators[$typename] ) ) { - if (preg_match($validators[$typename][0],$value)) return $value; - else return $replacement; - } else return 0; + if (isset($validators[$typename])) { + if (preg_match($validators[$typename][0], $value)) + return $value; + else + return $replacement; + } else + return 0; } + /** * date tester. */ -function validate_date($value, $replacement='1970-01-01') { - $match=array(); // 0=full string, 1= year, 2=month, 3=day - if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})$/',$value,$match)) return $replacement; +function validate_date($value, $replacement = '1970-01-01') { + $match = array(); // 0=full string, 1= year, 2=month, 3=day + if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $value, $match)) + return $replacement; // echo "\nov="; - // print_r($ov); - // echo $mustInsert.' + '.$sql; - // echo "\n"; - } -header('Location: '.$_SERVER['HTTP_REFERER']); -?> \ No newline at end of file diff --git a/peer/youvote.php b/peer/youvote.php deleted file mode 100644 index 37d627f..0000000 --- a/peer/youvote.php +++ /dev/null @@ -1,61 +0,0 @@ - - - -You vote - - - - "; - echo "p1 = {$_REQUEST['p1']}"; - echo "p2 = {$_REQUEST['p2']}"; - echo "p3 = {$_REQUEST['p3']}"; - echo "p4 = {$_REQUEST['p4']}"; - echo "p5 = {$_REQUEST['p5']}"; - } - ?> -your votes please
-
"; print_r($match); echo "