Disallow filenames with other characters except english

All support enquiries for DFH go in here...

Disallow filenames with other characters except english

Postby test » Sun Oct 30, 2011 10:45 am

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.
test
Standard Member
 
Posts: 37
Joined: Tue Apr 05, 2011 1:21 pm

Re: Disallow filenames with other characters except english

Postby SamEA » Tue Nov 01, 2011 9:31 am

SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Re: Disallow filenames with other characters except english

Postby test » Tue Nov 01, 2011 11:21 am

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.
test
Standard Member
 
Posts: 37
Joined: Tue Apr 05, 2011 1:21 pm

Re: Disallow filenames with other characters except english

Postby SamEA » Thu Nov 03, 2011 4:37 pm

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.
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Re: Disallow filenames with other characters except english

Postby test » Fri Nov 04, 2011 11:49 pm

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. :)
test
Standard Member
 
Posts: 37
Joined: Tue Apr 05, 2011 1:21 pm

Re: Disallow filenames with other characters except english

Postby SamEA » Mon Nov 07, 2011 2:36 pm

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!
}
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm


Return to Daddy's File Host v1.X

Who is online

Users browsing this forum: No registered users and 11 guests

cron