Can someone please tell me the php code. Simple <back> button (link to back page or given web address> Thanks
You could use.. echo "<a href=\"" . $_SERVER['HTTP_REFERER'] . "\">Back</a>"; PHP: Not always reliable though.
<?php require_once("config.php"); // path being dynamically requested if(!empty($_REQUEST['src'])) { if(file_exists(stripslashes(PATH.$_REQUEST['src']))) $src = urldecode(stripslashes(PATH.$_REQUEST['src'])); else $src = null; // extra validation $src = stristr($src, '..') ? null : $src; } // see if we're working with a thumbnail or not $size = !empty($_REQUEST['size']) && $_REQUEST['size'] == 'full' ? $_REQUEST['size'] : null; // draw watermarked & thumbnail images function draw_image($src) { global $size; list($width, $height, $type, $attr) = getimagesize($src); $img = imagecreatefromstring(file_get_contents($src)); if($size == 'full') { $red = imagecolorallocate($img, 0xFF, 0x00, 0x00); imagestring($img, 5, 3, 3, WATERMARK, $red); } else { $lowest = min(THMBWIDTH / $width, THMBHEIGHT / $height); if($lowest < 1) { $smallwidth = floor($lowest*$width); $smallheight = floor($lowest*$height); $tmp = imagecreatetruecolor($smallwidth, $smallheight); imagecopyresized($tmp, $img, 0, 0, 0, 0, $smallwidth, $smallheight, $width, $height); imagedestroy($img); $img = $tmp; } } switch($type) { case 1: header("Content-type: image/gif"); imagegif($img); break; case 2: header('Content-Type: image/jpeg'); imagejpeg($img, '', 100); break; case 3: header("Content-type: image/png"); imagepng($img); break; } imagedestroy($img); } if(!empty($src)) { draw_image($src); } else { header("Content-type: image/png"); $img = imagecreatetruecolor(THMBWIDTH, THMBHEIGHT); $black = imagecolorallocate($img, 0x00, 0x00, 0x00); $white = imagecolorallocate($img, 0xFF, 0xFF, 0xFF); imagestring($img, 5, 3, 3, "NO IMAGE", $white); imagepng($img); imagedestroy($img); } ?> PHP: