| | |
Having a bit of trouble figuring out my image upload script
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2006
Posts: 3
Reputation:
Solved Threads: 0
Having a bit of trouble figuring out my image upload script. I have modified this a bit, but I am stuck as to how I can get all the links to be output into one space.
Mainly I want this
to be output in a text field for all the images uploaded.
PHP Syntax (Toggle Plain Text)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title><?=$site_name?></title> <style type="text/css"> <!-- .tbl { border-style:solid; border-width:1px; border-color:#CCCCCC; } --> </style> <LINK href="images/style.css" type=text/css rel=stylesheet> <title>Photo Uploaded</title> </head> <script language="JavaScript" type="text/javascript"> var gl1=1; var gl2=1; var gl3=1; var gl4=1; var gl5=1; var gl6=1; var gl7=1; var gl8=1; var gl9=1; var gl10=1; </script> <body> <script language="JavaScript" type="text/javascript"> function check() { if (document.getElementById("to").value=="") {alert("You did not enter an e-mail address!"); return false; } else { if (document.getElementById("from").value=="") {alert("You did not enter your name/nickname!"); return false; } } } </script> <p> </p> <center> <div align="center"></div> <table width="741" height="323" border="0" align="center" cellpadding="0" cellspacing="0" class="table"> <tr> <td width="739" height="299"><div align="center"> <p><span class="text"> <?php require("header.inc.php"); ?> </span><br> </p> <table width="601" border="0"> <tr> <td width="581" class="admintext"><p align="left" class="moreLink style1 style1">You will see the "Download Link" and "Removal Link" below this page.<br> <br> Give the download link to your friends and families worldwide and they can access your file by hitting the link. If you want to remove the image anytime later, please keep the removal link. Hitting the link will result in deleting the image from our server. </p> </td> </tr> </table> <?php function ImageCreateFromBMP($filename) { if (! $f1 = fopen($filename,"rb")) return FALSE; $FILE = unpack("vfile_type/Vfile_size/Vreserved/Vbitmap_offset", fread($f1,14)); if ($FILE['file_type'] != 19778) return FALSE; $BMP = unpack('Vheader_size/Vwidth/Vheight/vplanes/vbits_per_pixel'. '/Vcompression/Vsize_bitmap/Vhoriz_resolution'. '/Vvert_resolution/Vcolors_used/Vcolors_important', fread($f1,40)); $BMP['colors'] = pow(2,$BMP['bits_per_pixel']); if ($BMP['size_bitmap'] == 0) $BMP['size_bitmap'] = $FILE['file_size'] - $FILE['bitmap_offset']; $BMP['bytes_per_pixel'] = $BMP['bits_per_pixel']/8; $BMP['bytes_per_pixel2'] = ceil($BMP['bytes_per_pixel']); $BMP['decal'] = ($BMP['width']*$BMP['bytes_per_pixel']/4); $BMP['decal'] -= floor($BMP['width']*$BMP['bytes_per_pixel']/4); $BMP['decal'] = 4-(4*$BMP['decal']); if ($BMP['decal'] == 4) $BMP['decal'] = 0; $PALETTE = array(); if ($BMP['colors'] < 16777216) { $PALETTE = unpack('V'.$BMP['colors'], fread($f1,$BMP['colors']*4)); } $IMG = fread($f1,$BMP['size_bitmap']); $VIDE = chr(0); $res = imagecreatetruecolor($BMP['width'],$BMP['height']); $P = 0; $Y = $BMP['height']-1; while ($Y >= 0) { $X=0; while ($X < $BMP['width']) { if ($BMP['bits_per_pixel'] == 24) $COLOR = unpack("V",substr($IMG,$P,3).$VIDE); elseif ($BMP['bits_per_pixel'] == 16) { $COLOR = unpack("n",substr($IMG,$P,2)); $COLOR[1] = $PALETTE[$COLOR[1]+1]; } elseif ($BMP['bits_per_pixel'] == 8) { $COLOR = unpack("n",$VIDE.substr($IMG,$P,1)); $COLOR[1] = $PALETTE[$COLOR[1]+1]; } elseif ($BMP['bits_per_pixel'] == 4) { $COLOR = unpack("n",$VIDE.substr($IMG,floor($P),1)); if (($P*2)%2 == 0) $COLOR[1] = ($COLOR[1] >> 4) ; else $COLOR[1] = ($COLOR[1] & 0x0F); $COLOR[1] = $PALETTE[$COLOR[1]+1]; } elseif ($BMP['bits_per_pixel'] == 1) { $COLOR = unpack("n",$VIDE.substr($IMG,floor($P),1)); if (($P*8)%8 == 0) $COLOR[1] = $COLOR[1] >>7; elseif (($P*8)%8 == 1) $COLOR[1] = ($COLOR[1] & 0x40)>>6; elseif (($P*8)%8 == 2) $COLOR[1] = ($COLOR[1] & 0x20)>>5; elseif (($P*8)%8 == 3) $COLOR[1] = ($COLOR[1] & 0x10)>>4; elseif (($P*8)%8 == 4) $COLOR[1] = ($COLOR[1] & 0x8)>>3; elseif (($P*8)%8 == 5) $COLOR[1] = ($COLOR[1] & 0x4)>>2; elseif (($P*8)%8 == 6) $COLOR[1] = ($COLOR[1] & 0x2)>>1; elseif (($P*8)%8 == 7) $COLOR[1] = ($COLOR[1] & 0x1); $COLOR[1] = $PALETTE[$COLOR[1]+1]; } else return FALSE; imagesetpixel($res,$X,$Y,$COLOR[1]); $X++; $P += $BMP['bytes_per_pixel']; } $Y--; $P+=$BMP['decal']; } fclose($f1); return $res; } $mxx=1; while ($mxx<11) { $ext=""; $id1=""; $id2=""; $uploaddir=""; $uploadfile=""; unset($width); unset($max_x); unset($height); unset($max_y); unset($percent); unset($newx); unset($newy); unset($ext); unset($uploadfile); unset($newimage); unset($img); unset($size); unset($sz); unset($tmax_x); unset($tmax_y); unset($ww); unset($hh); unset($resx); unset($resy); unset($thumbnail); unset($tmax_x); unset($tmax_y); unset($xxx); unset($yyy); unset($black); unset($white); unset($text); unset($resx); unset($resy); unset($size); unset($percent); unset($newx); unset($newy); unset($allowed); unset($text); unset($result); unset($uselink); unset($uselink2); unset($remlink); unset($thumblink); unset($rft); unset($mhost); if ($mxx!="1") {$imageident='userimg'.$mxx;} else {$imageident='userimg';} if (isset($_FILES[$imageident]['name']) && $_FILES[$imageident]['name']!="") { require("includes/connect.inc.php"); $query="SELECT slogan FROM img_admin WHERE 1"; $result=mysql_query($query); $slogan=@mysql_result($result,0); $query="SELECT websites FROM img_admin WHERE 1"; $result=mysql_query($query); $websites=@mysql_result($result,0); $query="SELECT hotlink1 FROM img_admin WHERE 1"; $result=mysql_query($query); $hotlink1=@mysql_result($result,0); $query="SELECT hotlink2 FROM img_admin WHERE 1"; $result=mysql_query($query); $hotlink2=@mysql_result($result,0); $query="SELECT hotlink3 FROM img_admin WHERE 1"; $result=mysql_query($query); $hotlink3=@mysql_result($result,0); $query="SELECT websites FROM img_admin WHERE 1"; $result=mysql_query($query); $websites=@mysql_result($result,0); $query="SELECT regularlink FROM img_admin WHERE 1"; $result=mysql_query($query); $regularlink=@mysql_result($result,0); $query="SELECT directlink FROM img_admin WHERE 1"; $result=mysql_query($query); $directlink=@mysql_result($result,0); $query="SELECT forums1 FROM img_admin WHERE 1"; $result=mysql_query($query); $forums1=@mysql_result($result,0); $query="SELECT forums2 FROM img_admin WHERE 1"; $result=mysql_query($query); $forums2=@mysql_result($result,0); $query="SELECT max_x FROM img_admin WHERE 1"; $result=mysql_query($query); $max_x=@mysql_result($result,0); $query="SELECT max_y FROM img_admin WHERE 1"; $result=mysql_query($query); $max_y=@mysql_result($result,0); $query="SELECT jpeg FROM img_files WHERE 1"; $result=mysql_query($query); $jpeg=@mysql_result($result,0); $query="SELECT jpg FROM img_files WHERE 1"; $result=mysql_query($query); $jpg=@mysql_result($result,0); $query="SELECT png FROM img_files WHERE 1"; $result=mysql_query($query); $png=@mysql_result($result,0); $query="SELECT gif FROM img_files WHERE 1"; $result=mysql_query($query); $gif=@mysql_result($result,0); $query="SELECT bmp FROM img_files WHERE 1"; $result=mysql_query($query); $bmp=@mysql_result($result,0); $query="SELECT tif FROM img_files WHERE 1"; $result=mysql_query($query); $tif=@mysql_result($result,0); $query="SELECT tiff FROM img_files WHERE 1"; $result=mysql_query($query); $tiff=@mysql_result($result,0); $ext = strtolower(substr(strrchr(basename($_FILES[$imageident]['name']), '.'), 1)); if ($ext!="jpeg" && $ext!="jpg" && $ext!="png" && $ext!="gif" && $ext!="bmp" && $ext!="tiff" && $ext!="tif") { echo("<br><b>ERROR IN IMAGE</b><br>");//die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=10\">"); } if ($ext=="jpeg" && $jpeg=="no") {die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=10\">");} if ($ext=="jpg" && $jpg=="no") {die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=10\">");} if ($ext=="png" && $png=="no") {die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=10\">");} if ($ext=="gif" && $gif=="no") {die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=10\">");} if ($ext=="bmp" && $bmp=="no") {die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=10\">");} if ($ext=="tiff" && $tiff=="no") {die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=10\">");} if ($ext=="tif" && $tif=="no") {die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=10\">");} $id1 = md5(uniqid(rand(), true)); $id2 = md5(uniqid(rand(), true)); $uploaddir = 'temp/'; $uploadfile = $uploaddir . $id1; $rft=basename($_FILES[$imageident]['name']); $thumbnail="img/$id1/"."t".$rft; if (move_uploaded_file($_FILES[$imageident]['tmp_name'], $uploadfile)) { if (!@getimagesize($uploadfile)) {unlink($uploadfile); /*die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=13\">");*/ $wrong="yes"; } else {$wrong="no";} if ($wrong!="yes") { $day=StrFTime('%d'); $month=StrFTime('%m'); $year=StrFTime('%Y'); $minute=StrFTime('%M'); $hour=StrFTime('%H'); list($width, $height, $type, $attr) = getimagesize($uploadfile); if ($_POST['rightclick']=="yes") {$rightclick="yes";} else {$rightclick="no";} if ($_POST['watermark']=="yes") {$watermark="yes";} else {$watermark="no";} if ($mxx=="1") {$comment=$_POST['comment'];} else {$comment=$_POST['comment'.$mxx];} if ($_POST['rating']=="yes") {$rating="yes";} else {$rating="no";} $rates=0; $rnumber=0; if (getenv(HTTP_X_FORWARDED_FOR)) { $ipaddress=getenv(HTTP_X_FORWARDED_FOR)."(".GetHostByName(getenv(HTTP_X_FORWARDED_FOR)).")"; } else { $ipaddress=getenv(REMOTE_ADDR)." (".GetHostByName(getenv(REMOTE_ADDR)).")"; } if ($ipaddress=="") {$ipaddress="Unknown";} //---------image size check------------ if ($width>$max_x || $height>$max_y) { if ($width>$max_x && ($width>$height || $width==$height)){ $percent=((100*$max_x)/$width); $newx=ceil($width-(((100-$percent)/100)*$width)); $newy=ceil($height-(((100-$percent)/100)*$height)); if ($newx<1) {$newx=1;} if ($newy<1) {$newy=1;} if (strtolower($ext)=="bmp") {unlink($uploadfile); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");} if (strtolower($ext)=="jpg" || strtolower($ext)=="jpeg") {if ($img=imagecreatefromjpeg($uploadfile)) {} else {unlink($uploadfile); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");}} if (strtolower($ext)=="png") {if ($img=imagecreatefrompng($uploadfile)) {} else {unlink($uploadfile); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");}} if (strtolower($ext)=="tiff" || strtolower($ext)=="gif") {die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");} $newimage=imagecreatetruecolor($newx,$newy); imagecopyresampled($newimage,$img,0,0,0,0,$newx,$newy,$width,$height); imagedestroy($img); if (strtolower($ext)=="jpg") {imagejpeg($newimage, $uploadfile);} if (strtolower($ext)=="png") {imagepng($newimage, $uploadfile);} imagedestroy($newimage); $size=filesize($uploadfile); } if ($height>$max_y && $width<$height){ $percent=((100*$max_y)/$height); $newx=ceil($width-(((100-$percent)/100)*$width)); $newy=ceil($height-(((100-$percent)/100)*$height)); if ($newx<1) {$newx=1;} if ($newy<1) {$newy=1;} if (strtolower($ext)=="bmp") {unlink($uploadfile); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");} if (strtolower($ext)=="jpg" || strtolower($ext)=="jpeg") {if ($img=imagecreatefromjpeg($uploadfile)) {} else {unlink($uploadfile); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");}} if (strtolower($ext)=="png") {if ($img=imagecreatefrompng($uploadfile)) {} else {unlink($uploadfile); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");}} if (strtolower($ext)=="tiff" || strtolower($ext)=="gif") {die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");} $newimage=imagecreatetruecolor($newx,$newy); imagecopyresampled($newimage,$img,0,0,0,0,$newx,$newy,$width,$height); imagedestroy($img); if (strtolower($ext)=="jpg") {imagejpeg($newimage, $uploadfile);} if (strtolower($ext)=="png") {imagepng($newimage, $uploadfile);} imagedestroy($newimage); $size=filesize($uploadfile); } } if ($size=="") {$size=filesize($uploadfile);} if ($size != -1 && $size!="") { if ($size<1024){$sz="$size Bytes";} if ($size>=1024 && $size<1024*1024) {$sz=round($size/1024,1); $sz="$sz KB";} if ($size>=1024*1024 && $size<1024*1024*1024) {$sz=round(($size/1024)/1024,1); $sz="$sz MB";} if ($size>=1024*1024*1024 && $size<1024*1024*1024*1024) {$sz=round((($size/1024)/1024)/1024,1); $sz="$sz GB";} if ($size>=1024*1024*1024*1024 && $size<1024*1024*1024*1024*1024) {$sz=round(((($size/1024)/1024)/1024)/1024,1); $sz="$sz TB";} } else { $sz="-"; } $size=$sz; //------------------------------------- @mkdir("img/$id1", 0777); //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- if (strtolower(strtolower($ext))=="bmp" || strtolower(strtolower($ext))=="jpg" || strtolower(strtolower($ext))=="jpeg" || strtolower(strtolower($ext))=="png") { //-------------------------------------------------------------------------- //------------------------Thumbnail works----------------------------------- //-------------------------------------------------------------------------- $tmax_x=175; $tmax_y=130; list($ww, $hh) = getimagesize($uploadfile); $resx=$ww; $resy=$hh; if ($newx!="") {$width=$newx;}; if ($newy!="") {$height=$newy;}; if ($width<$tmax_x && $height<$tmax_y) { if (strtolower($ext)=="bmp") {if ($img=ImageCreateFromBMP($uploadfile)) {} else {unlink($thumbnail); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");}} if (strtolower($ext)=="jpg" || strtolower($ext)=="jpeg") {if ($img=imagecreatefromjpeg($uploadfile)) {} else {unlink($thumbnail); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");}} if (strtolower($ext)=="png") {if ($img=imagecreatefrompng($uploadfile)) {} else {unlink($thumbnail); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");}} if (strtolower($ext)=="tiff" || strtolower($ext)=="gif") {$allowed="false";} $newimage=imagecreatetruecolor($tmax_x,$tmax_y+10); $xxx=ceil((175/2)-($width/2)); $yyy=ceil((140/2)-($height/2)); imagecopyresampled($newimage,$img,$xxx,$yyy+9,0,0,$width,$height,$width,$height); imagedestroy($img); $black = ImageColorAllocate ($newimage, 0, 0, 0); $white = ImageColorAllocate ($newimage, 255, 255, 255); $text="$resx"."x"."$resy - $size"; imagefilledrectangle($newimage,0,0,$tmax_x,10,$black); imagerectangle($newimage,0,0,$tmax_x-1,$tmax_y+9,$black); imagestring($newimage, 1, 2, 1, "$text",$white); imagejpeg($newimage, $thumbnail); imagedestroy($newimage); $resx=$width; $resy=$height; } else { if ($width>$height || $width==$height){ $percent=((100*$tmax_x)/$width); $newx=ceil($width-(((100-$percent)/100)*$width)); $newy=ceil($height-(((100-$percent)/100)*$height)); if ($newx<1) {$newx=1;} if ($newy<1) {$newy=1;} if (strtolower($ext)=="bmp") {if ($img=ImageCreateFromBMP($uploadfile)) {} else {unlink($thumbnail); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");}} if (strtolower($ext)=="jpg" || strtolower($ext)=="jpeg") {if ($img=imagecreatefromjpeg($uploadfile)) {} else {unlink($thumbnail); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");}} if (strtolower($ext)=="png") {if ($img=imagecreatefrompng($uploadfile)) {} else {unlink($thumbnail); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");}} if (strtolower($ext)=="tiff" || strtolower($ext)=="gif") {$allowed="false";} if ($allowed!="false"){ $newimage=imagecreatetruecolor($tmax_x,$tmax_y+10); $xxx=ceil((175/2)-($newx/2)); $yyy=ceil((140/2)-($newy/2)); imagecopyresampled($newimage,$img,$xxx,$yyy+9,0,0,$newx,$newy,$width,$height); imagedestroy($img); $black = ImageColorAllocate ($newimage, 0, 0, 0); $white = ImageColorAllocate ($newimage, 255, 255, 255); $text="$resx"."x"."$resy - $size"; imagefilledrectangle($newimage,0,0,$tmax_x,10,$black); imagerectangle($newimage,0,0,$tmax_x-1,$tmax_y+9,$black); imagestring($newimage, 1, 2, 1, "$text",$white); imagejpeg($newimage, $thumbnail); imagedestroy($newimage); } } if ($width<$height){ $percent=((100*$tmax_y)/$height); $newx=ceil($width-(((100-$percent)/100)*$width)); $newy=ceil($height-(((100-$percent)/100)*$height)); if ($newx<1) {$newx=1;} if ($newy<1) {$newy=1;} if (strtolower($ext)=="bmp") {if ($img=ImageCreateFromBMP($uploadfile)) {} else {unlink($thumbnail); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");}} if (strtolower($ext)=="jpg" || strtolower($ext)=="jpeg") {if ($img=imagecreatefromjpeg($uploadfile)) {} else {unlink($thumbnail); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");}} if (strtolower($ext)=="png") {if ($img=imagecreatefrompng($uploadfile)) {} else {unlink($thumbnail); die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=12\">");}} if (strtolower($ext)=="tiff" || strtolower($ext)=="gif") {$allowed="false";} if ($allowed!="false"){ $newimage=imagecreatetruecolor($tmax_x,$tmax_y+10); $xxx=ceil((175/2)-($newx/2)); $yyy=ceil((140/2)-($newy/2)); imagecopyresampled($newimage,$img,$xxx,$yyy,0,0,$newx,$newy,$width,$height); $black = ImageColorAllocate ($newimage, 0, 0, 0); $white = ImageColorAllocate ($newimage, 255, 255, 255); $text="$resx"."x"."$resy - $size"; imagefilledrectangle($newimage,0,0,$width,10,$black); imagerectangle($newimage,0,0,$tmax_x-1,$tmax_y+9,$black); imagestring($newimage, 1, 2, 1, "$text",$white); imagedestroy($img); imagejpeg($newimage, $thumbnail); imagedestroy($newimage); }} //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- }} else {$resx=$width; $resy=$height;} //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- if ($newx=="") {$newx=$width;} if ($newy=="") {$newy=$height;} $query = "INSERT INTO `img_images` (`realfilename`, `size_width`, `size_height`, `allow_rc`, `watermark`, `comment`, `rating`, `rates`, `rnumber`, `ip`, `minute`, `hour`, `day`, `month`, `year`, `lminute`, `lhour`, `lday`, `lmonth`, `lyear`, `id1`, `id2`, `feedback`) VALUES ('$rft', '$resx', '$resy', '$rightclick', '$watermark', '$comment', '$rating', '$rates', '$rnumber', '$ipaddress', '$minute', '$hour', '$day', '$month', '$year', '$minute', '$hour', '$day', '$month', '$year', '$id1', '$id2', '')"; $result=mysql_query($query); @copy($uploadfile,"img/$id1/$rft"); @unlink($uploadfile); } //} else {die("<META HTTP-EQUIV=\"refresh\" content=\"0;URL=../index.php?error=4\">");} require("includes/disconnect.inc.php"); $uselink="http://"; $uselink=$uselink.$_SERVER['HTTP_HOST']; $uselink=$uselink.dirname($_SERVER['PHP_SELF']); if (strrpos(dirname($_SERVER['PHP_SELF']), "\\") != strlen(dirname($_SERVER['PHP_SELF']))-1 || strrpos(dirname($_SERVER['PHP_SELF']), "/") != strlen(dirname($_SERVER['PHP_SELF']))-1) {$uselink=$uselink."/";} $uselink2=$uselink."view.php?img=$id1"; $uselink2 = str_replace('\\','/',$uselink2); $uselink = str_replace('\\','/',$uselink); $remlink=$uselink."remove.php?img=$id2"; $thumblink=$uselink."img/$id1/t$rft"; $uselink=$uselink."img/$id1/$rft"; $mhost=$_SERVER['HTTP_HOST']; $mhost=str_replace('\\\\','\\',$mhost); $mhost=str_replace("http://","",$mhost); $mhost="http://".$mhost; $uselinks.="\n".$uselink2; ?> <p class="ttl"> <span class="style2"> <?php if ((strtolower(strtolower($ext))=="bmp" || strtolower(strtolower($ext))=="jpg" || strtolower(strtolower($ext))=="jpeg" || strtolower(strtolower($ext))=="png") && $wrong!="yes") {echo("<p class=\"ttl\"><span class=\"footer\">Thumbnail preview (opens in new window)</span><br><a href=\"$uselink2\" target=\"_blank\"><img src=\"$thumbnail\" border=\"0\"></a></p>");} ?> <?php if ($wrong!="yes") {echo $_FILES[$imageident]['name'];} ?> </span><br> <?php if ($wrong!="yes") { ?> <a href="#0" onclick="shide<?php echo $mxx; ?>(); return false;">Show/hide links and options for this image</a> <?php } ?> </p> <script language="JavaScript" type="text/javascript"> function check<?php echo($mxx); ?>() { if (document.getElementById("email<?php echo($mxx); ?>").value==""){alert("You did not enter your e-mail address at e-mail field No. <?php echo($mxx); ?>!"); return false; } } function shide<?php echo $mxx; ?>() { if (gl<?php echo($mxx); ?>==1) { gl<?php echo($mxx); ?>=0; document.getElementById("ui<?php echo($mxx); ?>").innerHTML='<p class="heading1">Use these links to share your picture: </p> <span class="style2"> <?php if ($hotlink3=="yes") {echo(" <p class=\"text\">Show image to friends: <br> <input name=\"textfield222\" type=\"text\" class=\"box\" value=\"$uselink2\" size=\"100\" onClick=\"select();\"></p>"); } ?><?php if ($hotlink1=="yes") {echo("<p class=\"text\">Hotlink for forums 1: <br><input name=\"textfield\" type=\"text\" class=\"box\" value=\"[URL=$mhost][IMG]"); echo($uselink); echo("[/IMG][/URL]\" size=\"100\" onClick=\"select();\"></p>"); } ?> <?php if ($hotlink2=="yes") {echo("<p class=\"text\">Hotlink for forums 2: <br> <input name=\"textfield2\" type=\"text\" class=\"box\" value=\"[url=$mhost][img=$uselink][/url]\" size=\"100\" onClick=\"select();\"></p>"); } ?><?php if (strtolower(strtolower($ext))=="bmp" || strtolower(strtolower($ext))=="jpg" || strtolower(strtolower($ext))=="jpeg" || strtolower(strtolower($ext))=="png"){if ($forums1=="yes" ) {echo(" <p class=\"text\">Thumbnail for forums 1: <br><input name=\"textfieldx\" type=\"text\" class=\"box\" value=\"[URL=$uselink2][IMG]"); echo($thumblink); echo("[/IMG][/URL]\" size=\"100\" onClick=\"select();\"></p>"); }} ?><?php if (strtolower(strtolower($ext))=="bmp" || strtolower(strtolower($ext))=="jpg" || strtolower(strtolower($ext))=="jpeg" || strtolower(strtolower($ext))=="png"){if ($forums2=="yes" ) {echo(" <p class=\"text\">Thumbnail for forums 2: <br> <input name=\"textfieldx1\" type=\"text\" class=\"box\" value=\"[url=$uselink2][img=$thumblink][/url]\" size=\"100\" onClick=\"select();\"></p>"); }} ?> <?php if ($websites=="yes") {echo(" <p class=\"text\">Hotlink for websites: <br> <input name=\"textfield22\" type=\"text\" class=\"box\" value=\'<a href=\"$mhost\"><img src=\"$uselink;\" border=\"0\" width=\"250\" alt=\"$slogan\" /></a>\' size=\"100\" onClick=\"select();\"> </p>"); } ?><?php if ($directlink=="yes") {echo(" <p class=\"text\">Direct link to image: <br> <input name=\"textfield223\" type=\"text\" class=\"box\" value=\"$uselink\" size=\"100\" onClick=\"select();\"></p>"); } ?> </span><p class="heading1">Use this link to remove this image from our server: </p><form action="remmail.php" method="post" name="form<?php echo $mxx; ?>" target="email2" class="style2" onsubmit="window.open(\'remmail.php\', \'email2\', \'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=265,left = 287,top = 209\');"><input name="link" type="hidden" id="link" value="<?php echo $uselink2; ?>"><input name="link" type="hidden" id="link" value="<?php echo $remlink; ?>"><input name="filen" type="hidden" id="filen" value="<?php echo $rft; ?>"><?php echo("<p class=\"text\"><input name=\"textfield223\" type=\"text\" class=\"box\" value=\"$remlink\" size=\"100\" onClick=\"select();\"></p>"); ?> <table width="525" border="0"> <tr> <td width="519" background="../audio/images/middleline.jpg"> </td></tr> </table> <p><span class="heading1"><strong>E-mail me the "show image to friends" and the image removal link:</strong></span></p> <p><span class="heading1"><strong></strong></span><span class="text"> <input name="email" type="text" id="email<?php echo($mxx); ?>"> <input name="Submit2" type="submit" class="smallbutton" value="Submit" onClick="return check<?php echo $mxx; ?>()"> </span></p> </form> <table width="525" border="0"> <tr> <td width="519" background="../audio/images/middleline.jpg"> </td> </tr></table>'; } else { gl<?php echo($mxx); ?>=1; document.getElementById("ui<?php echo($mxx); ?>").innerHTML=''; } } </script> <div id="ui<?php echo $mxx; ?>" name="0"></div> <p class="text style2"> </p> <?php }} $mxx++;} ?> <table width="241" border="0"> <tr> <td width="67" class="text style2"><img src="images/mail.jpg"></td> <td width="164" class="style2 ttl"><strong class="heading1">E-mail image(s):</strong></td> </tr> </table> <form name="form1" method="post" action="mail.php" target="email" onSubmit="window.open('mail.php', 'email', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=265,left = 287,top = 209');"> <table width="618" border="0" class="tbl"> <tr> <td width="272" bgcolor="#F7F7F7" class="style1"><span class="text">To (e-mail):</span> <input name="to" type="text" id="to"> <input name="id" type="hidden" id="id" value="<?php echo($uselinks); ?>"></td> <td width="334" bgcolor="#F7F7F7" class="style1"><span class="text">From (your name or nickame):</span> <input name="from" type="text" id="from"></td> </tr> <center> <tr bgcolor="#F7F7F7"> <td colspan="2" class="style2"><p align="center" class="text style2 style3">Optional message: <br> <textarea name="message" cols="65" rows="5" id="message"></textarea> </p> <p align="center" class="text style2 style3"> <input name="Submit" type="submit" class="submit" value="Send" onClick="return check()"> </p></td> </tr> </table> </form> <br><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="67" valign="top"><div align="left"> <a href="/test2/"><img src="images/bck.jpg" width="60" height="42" border="0"></a></div> <div align="center"></div> <div align="right"></div></td> </tr> </table> <table width="98%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="7%"><div align="right"><img src="images/leftline.jpg" width="54" height="14"></div></td> <td width="100%"><img src="images/middleline.jpg" width="100%" height="14"></td> <td width="6%"><img src="images/rightline.jpg" width="40" height="14"></td> </tr> </table> <div align="center"><span class="footer"> <br> <?php include("footer.inc.php"); ?> </span></div> </div></td> </tr> </table> <div align="center"></div> <p> </p> </body> </html> <?php $yourdir="temp"; $dh = @opendir($yourdir) or die ("Could not open your directory!"); while (false!== ($file = @readdir($dh))) { if ($file!= "." && $file!= "..") { @unlink("$yourdir/$file"); }} ?>
Mainly I want this
PHP Syntax (Toggle Plain Text)
<?php if ($hotlink1=="yes") {echo("<p class=\"text\">Hotlink for forums 1: <br><input name=\"textfield\" type=\"text\" class=\"box\" value=\"<a rel="nofollow" class="t" href="http://$mhost" target="_blank">[IMG]"); echo($uselink); echo("[/IMG]</a>\" size=\"100\" onClick=\"select();\"></p>"); } ?>
to be output in a text field for all the images uploaded.
•
•
Join Date: Jul 2006
Posts: 3
Reputation:
Solved Threads: 0
Well, what I know is that
$mxx is the code for the pictures
and this is the actual working script that outputs the thumbnnails of the uploaded photos along with their links.
My problem is that after you have uploaded the photos, all the links associated with an uploaded picture are hidden by this javascript, and they are single. So, if I upload ten pictures, I have to go one by one to get the links. I don't mind that- but in addition to that I'd like all of the links as specified by this code which is in the above sample
output into one so I can collect all the the hotlinks for forums 1 in one place at the same time- like imagevenue. You can see the script in action and see what I mean about getting links one by one at videolist.biz/host.
Any help will be greatly appreciated- and if I am still unclear just tell me.
Thanks
$mxx is the code for the pictures
and this is the actual working script that outputs the thumbnnails of the uploaded photos along with their links.
PHP Syntax (Toggle Plain Text)
<script language="JavaScript" type="text/javascript"> function check<?php echo($mxx); ?>() { if (document.getElementById("email<?php echo($mxx); ?>").value==""){alert("You did not enter your e-mail address at e-mail field No. <?php echo($mxx); ?>!"); return false; } } function shide<?php echo $mxx; ?>() { if (gl<?php echo($mxx); ?>==1) { gl<?php echo($mxx); ?>=0; document.getElementById("ui<?php echo($mxx); ?>").innerHTML='<p class="heading1">Use these links to share your picture: </p> <span class="style2"> <?php if ($hotlink3=="yes") {echo(" <p class=\"text\">Show image to friends: <br> <input name=\"textfield222\" type=\"text\" class=\"box\" value=\"$uselink2\" size=\"100\" onClick=\"select();\"></p>"); } ?><?php if ($hotlink1=="yes") {echo("<p class=\"text\">Hotlink for forums 1: <br><input name=\"textfield\" type=\"text\" class=\"box\" value=\"[URL=$mhost][IMG]"); echo($uselink); echo("[/IMG][/URL]\" size=\"100\" onClick=\"select();\"></p>"); } ?> <?php if ($hotlink2=="yes") {echo("<p class=\"text\">Hotlink for forums 2: <br> <input name=\"textfield2\" type=\"text\" class=\"box\" value=\"[url=$mhost][img=$uselink][/url]\" size=\"100\" onClick=\"select();\"></p>"); } ?><?php if (strtolower(strtolower($ext))=="bmp" || strtolower(strtolower($ext))=="jpg" || strtolower(strtolower($ext))=="jpeg" || strtolower(strtolower($ext))=="png"){if ($forums1=="yes" ) {echo(" <p class=\"text\">Thumbnail for forums 1: <br><input name=\"textfieldx\" type=\"text\" class=\"box\" value=\"[URL=$uselink2][IMG]"); echo($thumblink); echo("[/IMG][/URL]\" size=\"100\" onClick=\"select();\"></p>"); }} ?><?php if (strtolower(strtolower($ext))=="bmp" || strtolower(strtolower($ext))=="jpg" || strtolower(strtolower($ext))=="jpeg" || strtolower(strtolower($ext))=="png"){if ($forums2=="yes" ) {echo(" <p class=\"text\">Thumbnail for forums 2: <br> <input name=\"textfieldx1\" type=\"text\" class=\"box\" value=\"[url=$uselink2][img=$thumblink][/url]\" size=\"100\" onClick=\"select();\"></p>"); }} ?> <?php if ($websites=="yes") {echo(" <p class=\"text\">Hotlink for websites: <br> <input name=\"textfield22\" type=\"text\" class=\"box\" value=\'<a href=\"$mhost\"><img src=\"$uselink;\" border=\"0\" width=\"250\" alt=\"$slogan\" /></a>\' size=\"100\" onClick=\"select();\"> </p>"); } ?><?php if ($directlink=="yes") {echo(" <p class=\"text\">Direct link to image: <br> <input name=\"textfield223\" type=\"text\" class=\"box\" value=\"$uselink\" size=\"100\" onClick=\"select();\"></p>"); } ?> </span><p class="heading1">Use this link to remove this image from our server: </p><form action="remmail.php" method="post" name="form<?php echo $mxx; ?>" target="email2" class="style2" onsubmit="window.open(\'remmail.php\', \'email2\', \'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=265,left = 287,top = 209\');"><input name="link" type="hidden" id="link" value="<?php echo $uselink2; ?>"><input name="link" type="hidden" id="link" value="<?php echo $remlink; ?>"><input name="filen" type="hidden" id="filen" value="<?php echo $rft; ?>"><?php echo("<p class=\"text\"><input name=\"textfield223\" type=\"text\" class=\"box\" value=\"$remlink\" size=\"100\" onClick=\"select();\"></p>"); ?> <table width="525" border="0"> <tr> <td width="519" background="../audio/images/middleline.jpg"> </td></tr> </table> <p><span class="heading1"><strong>E-mail me the "show image to friends" and the image removal link:</strong></span></p> <p><span class="heading1"><strong></strong></span><span class="text"> <input name="email" type="text" id="email<?php echo($mxx); ?>"> <input name="Submit2" type="submit" class="smallbutton" value="Submit" onClick="return check<?php echo $mxx; ?>()"> </span></p> </form> <table width="525" border="0"> <tr> <td width="519" background="../audio/images/middleline.jpg"> </td> </tr></table>'; } else { gl<?php echo($mxx); ?>=1; document.getElementById("ui<?php echo($mxx); ?>").innerHTML=''; } } </script>
My problem is that after you have uploaded the photos, all the links associated with an uploaded picture are hidden by this javascript, and they are single. So, if I upload ten pictures, I have to go one by one to get the links. I don't mind that- but in addition to that I'd like all of the links as specified by this code which is in the above sample
PHP Syntax (Toggle Plain Text)
<?php if ($hotlink1=="yes") {echo("<p class=\"text\">Hotlink for forums 1: <br><input name=\"textfield\" type=\"text\" class=\"box\" value=\"<a rel="nofollow" class="t" href="http://$mhost" target="_blank">[IMG]"); echo($uselink); echo("[/IMG]</a>\" size=\"100\" onClick=\"select();\"></p>"); } ?>
output into one so I can collect all the the hotlinks for forums 1 in one place at the same time- like imagevenue. You can see the script in action and see what I mean about getting links one by one at videolist.biz/host.
Any help will be greatly appreciated- and if I am still unclear just tell me.
Thanks
![]() |
Other Threads in the PHP Forum
- Previous Thread: Confirmation popup
- Next Thread: Multiple database tables
| Thread Tools | Search this Thread |
301 access apache api array autocomplete beginner binary broken button cakephp checkbox class cms code compression cron curl data database dataentry date display dropdown dropdownlist duplicates dynamic echo email error execution file files folder form forms function functions google href htaccess html htmlspecialchars httppost image include insert integration ip javascript joomla jquery limit link links login mail md5 menu methods mlm multiple mysql oop paypal pdf pdfdownload php phpvotingscript query radio random recursion remote script search secure server session sessions source space sql subscription syntax system table tutorial tutorials update upload url validator variable video virus volume votedown web youtube





