Hi,
I am making a script that will allow a user to create a page on my site. I only want alphanumerical characters, hyphens, periods, and underscores allowed. As well, two consecutive periods in a row isn't allowed. Here is the script I tried:
No matter what I type in the filename field, I get the error above. What am I doing wrong?PHP Code:<?PHP
if (ereg("^[[:alnum:]][[:alnum:]_.-]*[[:alnum:]]$ ",$filename)) {
if (ereg("..",$filename))
$error = "invalidfname";
else
$error = "none";
}
else
$error = "invalidfname";
.....
if ($error == "invalidfname") {
?>
<FONT color="red">
<B>ERROR: THE FILENAME YOU CHOSE IS INVALID. ONLY
ALPHANUMERICAL CHARACTERS, UNDERSCORES, HYPHENS, AND
PERIODS ARE ALLOWED. TWO CONSECUTIVE PERIODS ARE NOT
ALLOWED. PLEASE MAKE THE NECCESSARY CHANGES BELOW.</B>
</FONT>
<?PHP
}








Bookmarks