|
|
2008-07-31, 03:53 PM | #1 |
Hello, is this President Clinton? Good! I figured if anyone knew where to get some tang it would be you
|
split an url
hi guys and gals
I think I am getting tired, I have an url in a database called the following: ../../file.extention I need to change that url to: ../file.extention I can't for the life of me figure it... I know I am stupid... I need to split, but I cant get it to work All help appreciated Xallow |
2008-07-31, 04:18 PM | #2 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
If you're trying to remove it from the database, you could do:
Code:
update tablename set path=replace(path,'../../','../'); If you are trying to remove it from some data, and you knew it was just the first three characters, Code:
$path = substr('../../file.extension',3); Code:
$path = preg_replace('/^..\//','','../../file.extension'); Another possibility is parse_url, but, I am not sure how it would react. If you knew that you wanted to pull the first 'section' at the first /, you could do something like Code:
$arr = (explode('/','../../file.extension')); array_shift($arr); $path = join($arr,'/');
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
2008-08-01, 05:43 PM | #3 |
Hello, is this President Clinton? Good! I figured if anyone knew where to get some tang it would be you
|
Thanks, that worked, I have another question though.
Is it not possible to get access to a folder on my server from my website? I created a folder on the server where my domains are hosted to use the files from that folder on all my sites, but when I link to those files I get nothing. Do I need to set some permission thingies or something? |
2008-08-01, 07:45 PM | #4 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
Depends on the server config. There are so many possible answers and configurations that you might need to check with your host. They could be restricting opens, you might be served from two different fileservers, so, while the path may look identical, you could be on two totally different paths, or many other possibilities.
You might do something like: Code:
echo getcwd();
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
|
|