ok ... her sourcet .... gratiz d:-))
<?
error_reporting (E_ALL); // report all PHP errors
$arrTestAllCases
=array(\"\",
\" \",
\" \",
\" a\",
\" aa aa \",
\" aa aa aa \",
\" @3847849¤\",
\" 23 aa aa \",
\" aa aa a!a\",
\" ajajaj æøåÆØÅ ÇüéäàåçëèïìÄÅÉæÆöòùÿÖÜáíóú O\'Niell \"
);
print \"<HTML><BODY>\";
for ($i=0; $i<count($arrTestAllCases); $i++)
{
$test=$arrTestAllCases[$i];
$resVar=validate_name($test);
print \"<P><PRE>validate_name("\";
print $test;
print \"")="\";
print $resVar;
print \""</PRE></P>\";
}
print \"</BODY></HTML>\";
?>
<?
/* Copyright (c) G-Solutions. All rights reserved.
*
http://www.g-solutions.dk *
* Redistributions of this source code must retain the above copyright
* notice, and the following disclaimer.
Disclaimer:
THIS SOFTWARE IS PROVIDED BY G-SOLUTIONS (DENMARK) ``AS IS\'\' AND ANY
EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL G-SOLUTIONS (DENMARK)
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/*
$other_ibm_chars=\"ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜáíóúñÑ\";
//are those we picked up from: LaFore, Robert, \"Object-Oriented Programming
//in C++\", 3rd Ed., 1999, Sams, ISBN 0-57169-160-X (Appendix A, p.777-p.786),
//and we think that they (or at least some of them) should be used when
//validating names provided by end-user !
$extra_1s=\"ØøÝýÐßð\'\";
//are those we found elsewhere and added to make the list even more complete !
*/
function validate_name($name_input,
$other_ibm_chars=\"ÇüéäàåçëèïìÄÅÉæÆöòùÿÖÜáíóú\",
$extra_1s=\"ØøÝýß\'\")
{
// make sure that arguments $other_ibm_chars and $extra_1s
// do NOT include SPACE !!!!
// if you encounter errors try to check charset
// in your PHP Configuration File (php.ini) !!!
// tip: try using phpinfo(ALL_INFO); !
// Chars used as function arguments must be included in charset used
// by PHP !
if (ereg(\"^(( )*[A-Za-z\". $other_ibm_chars
. $extra_1s .\"-]{2,47}){2,4}( )*$\",
$name_input)
)
{
$tmpVar=trim(eregi_replace(\" +\", \" \",$name_input));
$str_len=strlen($tmpVar);
if ($str_len>=5 && $str_len<=50)
return $tmpVar;
else
return \"0\";
}
else
return \"0\";
}
/*
* The end of source code copyrighted by G-Solutions
*/
?>