Jump to content

URL Being Called Twice


nebuLa

Recommended Posts

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>&nbsp;&nbsp;<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.png

When I click on Upload Another, it takes me here(this is correct):
http://www.punkyourspace.com/upload

Here 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

$filename obviously contains the full path to the image. So you need to split the image

So lets say the image is located here: http://www.punkyourspace.com/viewimage/86Vgcu7dgx.png

Assuming $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>&nbsp;&nbsp;<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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.