Menu

[r11]: / general / data_funcs.inc.php  Maximize  Restore  History

Download this file

27 lines (23 with data), 758 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
/**
* Data functions that will be used through the app
* These functions are global and shoudl be safer
* @author David Bates (norman77@users.sourceforge.net) ($Author: norman77 $)
* @since 05-Nov-2008
* @version $Revision: 1.3 $
*/
/**
* Scrubs data .. makes it safe for writting into settings.php or database
* @return array $returnData Scrubbed Data
* @param array $data Data from Post or GET (key - val paris)
*/
function scrubData($data) {
$regEx = "/[^a-zA-Z0-9 .@:\/_]*/"; // Used to remove characters, if they aren't in this list, they will be removed
$retData = array();
foreach ($data as $key => $val) {
$dVal = preg_replace($regEx, '', $val);
$retData[$key] = $dVal;
}
return $retData;
}
?>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.