Unable to open remote file.

"; exit;} while (!feof($fp)) { $line = fgets($fp, 2048); $out = array($line); list($K,$V)=split("\:",$out[0]); if ($K=="LOC") $Loc=rtrim($V); if ($K=="DIR") $Dir=rtrim($V); }#end while fclose($fp); #===================== process POST data $cnt=0;$Chk[0]="";$Txt[0]=""; foreach ($_POST as $key => $value) { if ($value=="XXXX") { if ($Chk[$i]=="on")$Chk[$i]=""; else $Chk[$i]="#"; $cnt++;$i=""; #increment cnt and reset variables }#end if if (substr($key,0,9)=="photo_nam"){ $i=substr($key,9); $Name[$i]=$value; } if (substr($key,0,9)=="photo_txt"){ $Txt[$i]=$value; $Txt[$i]=str_replace("\\","",$Txt[$i]); #deal with \ on meta chars $Txt[$i]=str_replace("\"","'",$Txt[$i]); #convert quotes to apostrophes } if (substr($key,0,9)=="photo_chk"){$Chk[$i]=$value;} if (substr($key,0,9)=="photo_dir"){$Fldr[$i]=$value;} if (substr($key,0,9)=="photo_srt"){$Sort[$i]=$value;} if ($Fldr[$i]=="")$Fldr[$i]=$Dir; if ($key=="SelChk") $radio=$value; }#end foreach #===================== Synchronize POST and .lst $fp1=fopen("PhotoMgr_continue.htm","w+"); #prepare a redirect html file fwrite($fp1,""."\n"); fclose($fp1); $fp=fopen($LstFile,"r"); # read existing .lst file to make sure synchronized with POST variables if (!$fp) {echo "

Unable to open remote file.

"; exit;} $Ext=0;$j=0; while (!feof($fp)) { #get last line from .lst file $n=$Name[$j++]; $f=fgets($fp); $out = array(trim($f)); list($a,$f1,$b)=split("~",$out[0]); $f1=substr($f1,0,strlen($f1)-4); if ($n!=$f1)$Ext=1; #if names are not same, set flag to avoid corrupting .lst file }#end while if ($Ext==1&&$cnt>0){ # if last image names not same AND not initial session prepare to abort $fp1=fopen("PhotoMgr_continue.htm","w+"); # re-write redirect html file to pause fwrite($fp1,"

Please wait longer before submitting. Continue
"."\n"); fclose($fp1); }#end if else { #if synchronized then continue fclose($fp); if ($cnt>0){ #if intial session, don't write .lst file #===================== re-write .lst file $fp=fopen($LstFile,"w+"); for ($i=0;$i<$cnt;$i++){ #sort folders and sort number $t=sprintf("%05d",$Sort[$i]); $So[$i]=$Fldr[$i]."~".$t."~".$Name[$i].".jpg~".$Txt[$i]."~".$Chk[$i]; }#end for i sort($So); # sort($So,SORT_NUMERIC); for ($i=0;$i<$cnt;$i++){ list($d,$a,$n,$t,$c)=split("~",$So[$i]); #get fields $s1=$c.$d."~".$n."~".$t; #rearrange fields fwrite($fp,$s1."\n"); #write to .lst file }#end for i fclose($fp); }#end if #===================== read data from .lst file $cnt=0; $fp=fopen($LstFile,"r"); if (!$fp) {echo "

Unable to open remote file.

"; exit;} while (!feof($fp)) { $line = fgets($fp); list($Fldr[$cnt],$N,$Txt[$cnt])=split("~",trim($line)); $Txt[$cnt]=str_replace("\"","'",$Txt[$cnt]); #convert quotes to apostrophes $Name[$cnt]=substr($N,0,strlen($N)-4); if (substr($Fldr[$cnt],0,1)=="#"){ $Chk[$cnt]=""; $Fldr[$cnt]=substr($Fldr[$cnt],1); }#end if else $Chk[$cnt]="CHECKED"; if ($radio=="A" ||($radio=="C"&&$Chk[$cnt]=="CHECKED") ||($radio=="N"&&$Chk[$cnt]=="") )$Visible[$cnt]=1; else $Visible[$cnt]=0; $cnt++; }#end while fclose($fp); for ($i=0;$i<$cnt;$i++)$DirHash[$Fldr[$i]]=0; #initialize DirHash for ($i=0;$i<$cnt;$i++)if ($Visible[$i]==1)++$DirHash[$Fldr[$i]]; #Make a count visible lines in each Folder $dNo=0;foreach ($DirHash as $key => $value) {if ($key!=""){ $dir[$dNo]=$key; $dNo++; }}sort($dir); #===================== Write .htm file $fp=fopen($HtmFile,"w+"); $s="PhotoMgr.htm";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="

Q&D Photo Manager";fwrite($fp,$s."\n"); $s="

";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="
Q&D instructions:
1) Allow sufficient time for ALL images to load before making changes.
2) First select photos with check boxes on left of image.
3) Press 'SAVE' button to commit selections.
4) Use radio buttons to show only selected photos.
5) Group photos by modifying folder name in 'Folder' text boxes.
6) Add captions to photo using text boxes on right.
7) Alter ordering within Folders by changing number in Sort box on right.
8) Use Folder Links to navigate among folder groups.
9) Clicking on small image will launch a larger image in another window.

C.B.Snow, 6/30/2005
";fwrite($fp,$s."\n"); $s="

";fwrite($fp,$s."\n"); $s="
";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $rad1="";$rad3="";$rad3=""; if ($radio=="A")$rad1="CHECKED"; if ($radio=="C")$rad2="CHECKED"; if ($radio=="N")$rad3="CHECKED"; $s="
";fwrite($fp,$s."\n"); $s="

";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="
Show allShow CheckedShow Not Checked

";fwrite($fp,$s."\n"); $s="

";fwrite($fp,$s."\n"); $s="

Folder Links
";fwrite($fp,$s."\n"); $d=0; for ($d=0;$d<$dNo;$d++){$key=$dir[$d]; if ($key!=""){ #skip blanks $s="Goto: {$key} ({$DirHash[$key]})
";fwrite($fp,$s."\n"); }#end if }#end foreach $s="

";fwrite($fp,$s."\n"); for ($d=0;$d<$dNo;$d++){ $key=$dir[$d]; $Srt=0; $D=$key; $C=$DirHash[$key]; if ($D!=""){ $s="
";fwrite($fp,$s."\n"); $s="

{$key}

";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); for ($i=0;$i<$cnt;$i++){ if ($Fldr[$i]==$D){ if ($Visible[$i]==1){ $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s=""."\n"; $h=$h.""."\n"; if ($Chk[$i]=="CHECKED")$h=$h.""."\n"; $h=$h.""."\n"; $h=$h.""."\n"; $t=sprintf("%d0",++$Srt); $h=$h.""."\n"; $h=$h." Click here to save all changes.";fwrite($fp,$s."\n"); $s="
Return to Top";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); }#end if $D }#end foreach fwrite($fp,$h."\n"); #write HIDDEN $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); fclose($fp); # #PhotoMgr15 echo "





Working!
"; }#end else $n!=$f ?>

SelectFolderPhotoCaptionSort
";fwrite($fp,$s."\n"); $s="{$Name[$i]}";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $s="";fwrite($fp,$s."\n"); $t=sprintf("%d0",++$Srt); $s="";fwrite($fp,$s."\n"); $s="