Re: Is it possible to parse a variable by character?
| From: | Sean Coyle | Date: | Wed, 18 Apr 2001 13:35:04 +0000 |
| Subject: | Re: Is it possible to parse a variable by character? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49204@lists.php.net to get a copy of this message | ||
Christian,
Thanks for pointing that out! Everything works excellently now!
Now, all I have to do, is run another ereg_replace() to look for any
duplicate full stops '.' and replace them with one, but I don't think that
one will be to hard.
For those of you interested, this is what the code looks like now:
if(strlen($flf_desc)) {
$f_loc_lower = strtolower($f_loc_name);
$f_loc_new = "";
$f_loc_new = ereg_replace("[^_a-z0-9\.-]", "", $f_loc_lower);
$f_loc_name = "";
$f_loc_name = $f_loc_new;
$path = $destination.$f_loc_name;
!file_exists($path) or die("Unable to copy $f_loc_name to location
$URL_sitepath.<BR>Because $f_loc_name already exists there");
copy($f_loc, $path) or die("Unable to copy $f_loc_name to location
$URL_sitepath. <b><BR>Please phone your admistrator immediatly ASAP</b>");
$flf_loc = $URL_sitepath.$f_loc_name;
$f_loc = $flf_loc;
$flf_name = "$f_loc_name";
$uploadline2 = "<b>$f_loc_name was uploaded succesfully.</b><br>";
$uploadline3 = "If you wish to give a path for your clients to
download this file<BR>without having to log in, please send them this
URL<BR><A HREF=\"$flf_loc\">$flf_loc</A>";
}
Thanks the the help!
Cheers,
Sean
On 4/18/01 5:08 AM, in article 01041814104906.00662@chrisbig, "Christian
Reiniger" <creinig@mayn.de> wrote:
> On Wednesday 18 April 2001 12:00, you wrote:
>>> Warning: REG_ERANGE in
>>> /home/httpd/www/worldvibe.org/digitall/edit_f.php on line 91
>>>
>>> Here are lines surrounding 91:
>>>
>>> 89-> strtolower($f_loc_name);
>>> 90-> $f_loc_new = "";
>>> 91-> $f_loc_new = ereg_replace("[^[_a-z0-9-\.]]", "",
>>> $f_loc_name);
>>> 92-> $f_loc_name = "";
>>> 93-> $f_loc_name = $f_loc_new;
>>
>> $f_loc_new = ereg_replace("[^_a-z0-9-\.]", "", $f_loc_name);
>
> That, and because the dash needs to be the last character in the
> character class:
> $f_loc_new = ereg_replace("[^_a-z0-9.-]", "", $f_loc_name);
>