Page 1 of 1

Disallow filenames with other characters except english

PostPosted: Sun Oct 30, 2011 10:45 am
by test
How?

Let's say I don't people will upload files with Hebrew, Arabic, Russian, Japanese etc in the filename.

Long story short - only English characters in the filename (or image name) will be accepted and uploaded. How do I do that?

Thanks.

Re: Disallow filenames with other characters except english

PostPosted: Tue Nov 01, 2011 9:31 am
by SamEA

Re: Disallow filenames with other characters except english

PostPosted: Tue Nov 01, 2011 11:21 am
by test
Well, I tried something slightly different - allowing only alphanumeric chars in the registration e-mail, and I've altered this code:

Code: Select all
if (strstr($_POST['email'], '@')) {


Inside ./pages/register.php, to this:

Code: Select all
if ((strstr($_POST['email'], '@')) && (!eregi("^[A-Z0-9_-.]*$", $_POST['email']))) {


I get this error:

Warning: eregi() [function.eregi]: REG_ERANGE in /test/pages/register.php on line 47 (the line I've altered).

*P. S. - Any news about the file password feature problem?

Thanks for your help.

Re: Disallow filenames with other characters except english

PostPosted: Thu Nov 03, 2011 4:37 pm
by SamEA
I haven't forgotten about you and will come up with a solution by tonight hopefully, just need to install a fresh copy of DFH. This is mainly because of on-going university research and assignments.

Re: Disallow filenames with other characters except english

PostPosted: Fri Nov 04, 2011 11:49 pm
by test
SamEA wrote:I haven't forgotten about you and will come up with a solution by tonight hopefully, just need to install a fresh copy of DFH. This is mainly because of on-going university research and assignments.


I know, and I appreciate it, thanks alot. :)

Re: Disallow filenames with other characters except english

PostPosted: Mon Nov 07, 2011 2:36 pm
by SamEA
Try adding before
Code: Select all
if (strstr($_POST['email'], '@')){
This
Code: Select all
if (preg_match("/[^\x00-\x7F]/",$string)) {
// Does contain foreign characters!
}else{
// Does not contain foreign characters!
}