nebuLa Posted December 29, 2006 Share Posted December 29, 2006 I'm using a script and whenever a page is generated, the URL for the links are being called twice. Example:Here is the code from the section of the file I'm having issues with:[code] <a href="/viewimage/<?=$filename?>" target="_blank" class="pagelinks" >View Image and Codes</a> <a class="pagelinks" href="<?=HOMEPAGE?>upload"><b>Upload Another<b></a><br><br> <a href="/viewimage/<?=$filename?>" target="_blank"><img src="<?=$filename?>" border="0" width="170"></a><br>[/code]Here is what's happening:When I click on View Image and Codes, it takes me here:http://www.punkyourspace.com/viewimage/http://www.punkyourspace.com/uploads/images/2006-12-29/86Vgcu7dgx.pngWhen I click on Upload Another, it takes me here(this is correct):http://www.punkyourspace.com/uploadHere is a screnshot of the page, or you can visit it and try for yourself at http://www.punkyourspace.com/upload[img]http://www.punkyourspace.com/uploads/images/2006-12-29/GEawioYY32.jpg[/img] Link to comment https://forums.phpfreaks.com/topic/32235-url-being-called-twice/ Share on other sites More sharing options...
glenelkins Posted December 30, 2006 Share Posted December 30, 2006 $filename obviously contains the full path to the image. So you need to split the imageSo lets say the image is located here: http://www.punkyourspace.com/viewimage/86Vgcu7dgx.pngAssuming $filename = "http://www.punkyourspace.com/uploads/images/2006-12-29/86Vgcu7dgx.png"[code]$filename_split = explode("/",$filename);$image = $filename_split[6];?><a href="/viewimage/<? echo $image; ?>" target="_blank" class="pagelinks" >View Image and Codes</a> <a class="pagelinks" href="<?=HOMEPAGE?>upload"><b>Upload Another<b></a><br><br> <a href="/viewimage/<?=$filename?>" target="_blank"><img src="<?=$filename?>" border="0" width="170"></a><br>[/code]Is this what you mean? Link to comment https://forums.phpfreaks.com/topic/32235-url-being-called-twice/#findComment-149593 Share on other sites More sharing options...
nebuLa Posted December 30, 2006 Author Share Posted December 30, 2006 I tried that, then I realized that it needed to go to that full path, but....the full path had http:/www instead of http://www so I added:$bg = str_replace("http:/","http://",$bg);Problem solved. Thanks for the reply though :-) Link to comment https://forums.phpfreaks.com/topic/32235-url-being-called-twice/#findComment-149595 Share on other sites More sharing options...
trq Posted December 30, 2006 Share Posted December 30, 2006 Sorry, youve lost me and the link you provided seems erelevent.Post some relevent code. Link to comment https://forums.phpfreaks.com/topic/32235-url-being-called-twice/#findComment-149596 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.