makeshift_theory Posted September 26, 2006 Share Posted September 26, 2006 Ok I have this script to publish files that are edited using this CMS tool that I have been working on. It works in Firefox but however in IE it is assigning the current time to $res_['site_lastftp'] instead of the actual last time like it is suppose to. I think it's executing the code all at once and I'm not sure of a fix, here is the code:[code] </table> <? } else{ $flag=1; if ($res['site_ftpdirectory']!=""){ $f=ftp_chdir($ftp_conn,$site_ftpdirectory); if ($f) $flag=1; else $flag=0; } else $flag=1; if ($flag==1){ $filefailed=""; // File has not failed if( is_dir($root_path) ){ $fsys = new filesysclass(); if(substr($root_path, -1) != '/'){ $root_path = $root_path.'/'; } $files = $fsys->get_file_list($root_path . "images/"); $totfiles = count($files); $htmlfiles = $fsys->get_file_list($root_path); $htmfiles = count($htmlfiles); foreach($htmlfiles as $htname){ // For HTML Files $htlast_modified=filemtime($root_path.'/'.$htname); $htlastmod=date("Y-m-d H:i:s", $htlast_modified); echo $publish . $htname; if ($publish=='U'){ // If publish = LAST SAVED ONLY echo $htlastmod . " <br>" . $res['site_lastftp'] . "<br><br>"; if ($htlastmod>=$res['site_lastftp']){ echo "a change has been made" . $htname; $htfileupload=$root_path . $htname; $htname = $site_ftpdirectory . $htname; $htupload = ftp_put($ftp_conn,$htname,$htfileupload,FTP_ASCII); if (!$htupload){ if ($filefailed=="") $filefailed=$htname; else $filefailed=$filefailed.", ".$htname; } else { $filesuccess[] = $name; } } } else{ // IF ALL FILES ARE TO PUBLISH $htfileupload=$root_path . $htname; $htname = $site_ftpdirectory . $htname; $htupload = ftp_put($ftp_conn,$htname,$htfileupload,FTP_ASCII); if (!$htupload){ if ($filefailed=="") $filefailed=$htname; else $filefailed=$filefailed.", ".$htname; } else { $filesuccess[] = $htname; } } } // End HTML file publish foreach($files as $name){ // For IMAGE FILES $last_modified=filemtime($root_path.'/'.$name); $lastmod=date("Y-m-d H:i:s", $last_modified); if ($publish=='U'){ // If publish = LAST SAVED ONLY if ($lastmod>=$res['site_lastftp']){ $fileupload=$root_path . $name; $name = $site_ftpdirectory . $name; $upload = ftp_put($ftp_conn,$name,$fileupload,FTP_ASCII); if (!$upload){ if ($filefailed=="") $filefailed=$name; else $filefailed=$filefailed.", ".$name; } $filesuccess[] = $name; } } else{ // IF ALL FILES ARE TO PUBLISH $fileupload=$root_path . "images/" . $name; $name = $site_ftpdirectory . "images/" . $name; $upload = ftp_put($ftp_conn,$name,$fileupload,FTP_ASCII); if (!$upload){ if ($filefailed=="") $filefailed=$name; else $filefailed=$filefailed.", ".$name; } else { $filesuccess[] = $name; } } } } if ($filefailed!=""){ ?> <table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td colspan="2" align="center" class="border3a style2"><font color="#FF3300">Could not Upload the following files: <?=$filefailed?> ! Try again.</font></td> </tr> <tr> <td colspan="2" align="center" valign="middle" class="border3a"><a href="browse_sites.php" onMouseOver="javascript:hoveron('back_btn');" onMouseOut="javascript:hoveroff('back_btn');"><img src="images/back_btn_off.jpg" name="back_btn" border="0"></a></td> </tr> </table> <? } else{ // $str="update site_info set site_lastftp=now() where site_id=$sid"; // $rs=$DB->doSQL($str);[/code]If you need more code ask, it's a lot so I don't want to scare off anyone with a lot of code lol. Quote Link to comment Share on other sites More sharing options...
makeshift_theory Posted September 26, 2006 Author Share Posted September 26, 2006 Nvm I think I found the problem, in the code the developers that we got to start this (these developers SUCK god I have seen such swiss cheese code.) Anywho to the point, they used an extract function to grab the variables for everything throughout. With this being said that extract function doesn't close anywhere so when it does the date update it updates it and throws the variable back around. It's a bad bad loop!!!! lol so yea.... my rant is done... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.