General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 21st, 2003, 11:25 AM
Awa Awa is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 2 Awa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Where does the extra slah come from?[newbie]

I have a snippet of my php code, looking like this:

$dir=ereg_replace("index.php","",$PHP_SELF).$cat."/bilder/";
?>
<body><div align=center>
<?=returnimg($dir.$img); ?>

But no image is returned, because there's an extra slash. I.e http://www.domain.com//xxx/yyy/bilder/picture.jpg


WHY??!?!??

Please, please, help me...

/Awa

Reply With Quote
  #2  
Old December 21st, 2003, 11:39 AM
mattp23 mattp23 is offline
Moderated
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: UK
Posts: 82 mattp23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 43 m 44 sec
Reputation Power: 6
What is the value of $cat?
Does it begin with /?

Reply With Quote
  #3  
Old December 21st, 2003, 01:10 PM
Awa Awa is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 2 Awa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
$cat

$cat is only the directory containing the directory with the picture, in my example yyy.

Or, to make it more visible, like this:

URL$cat/bilder/picture.jpg

The xxx directory is where the index.php file is found, containing the code.
URL is the url to the homepage, but I haven't written that anywhere in the page, so the extra slash must originate from that code...

Blasted... *pulling my hair in desperation*

The problem lies in the fact that I have my page hosted in the subdirectory /~rrr/. If I had had the page on my own domain, the extra slash wouldn't have mattered, as the page still would have been found... But with two slashes before my homepage directory, my page isn't recognized.

Reply With Quote
  #4  
Old December 21st, 2003, 02:37 PM
mattp23 mattp23 is offline
Moderated
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: UK
Posts: 82 mattp23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 43 m 44 sec
Reputation Power: 6
Why don't you try something like:
PHP Code:
 dirname($_SERVER['PHP_SELF']) . $cat '/bilder/' 

I don't currently have access to a box running PHP so can't test it, but you may like to use something along these lines.

Matt

Reply With Quote
  #5  
Old December 22nd, 2003, 08:08 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
$PHP_SELF usually contains a preceding slash, I believe. So if you're replacing only "index.php" and not "/index.php," you'll have the terminal slash from the URL followed by the preceding slash from $PHP_SELF for a total of two consecutive slashes.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Where does the extra slah come from?[newbie]


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway