note 55939 added to function.ereg

From: Date: Thu, 18 Aug 2005 12:30:24 +0000
Subject: note 55939 added to function.ereg
Groups: php.notes 
Request: Send a blank email to php-notes+get-93833@lists.php.net to get a copy of this message
On PHP 5 I use these functions to validate people names (on site registration), files and dir names (on uploads) and safe html text to be stored in mysql. -- People names function convalida_nome($string){ if (ereg("[^[:space:]a-zA-Z0-9_.-\\']", $string)) { return false; } else { return true; } } -- Files and dirs function convalida_file($string){ if (ereg("[^a-zA-Z0-9_-]", $string)) { return false; } else { return true; } } -- HTML text (to be put on MySQL after doing htmlentities() ) function convalida_titolo($string){ if (ereg("[^[:space:]a-zA-Z0-9_.-\\'\\"?!]", $string)) { return false; } else { return true; } } ---- Manual Page -- http://www.php.net/manual/en/function.ereg.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55939 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55939&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55939&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55939&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55939&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55939&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55939&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55939&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93833) next »