Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    filemtime Questions

    I have been using filemtime to get the Last Modified date and time on specific files for my site. However, I would like to check the entire directory of my site in this manner but I am unsure if this is possible.

    Also, is it possible to output the last time a site's database was updated, using this manner or any other? Since the code isn't updated very often, but the database is, I'd like to have it noted on the site when the last update of any sort happened.

    Thanks in advance for any tips.

  • #2
    New Coder
    Join Date
    Feb 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I thought I had this worked out, but apparently not. You can see that I am checking for the last updated time of a file and the database. I am then outputting a bit of footer code depending on which was last updated, reflecting the updated time of the most recent of the two. Therefore, the last updated time of the site. Any ideas where I am going wrong here? The file update works fine, the database update is displaying an old timestamp.

    PHP Code:
    <? 
    $thename
    ="Theme1"

    $last_modified filemtime("modules/xxx/pnuser.php"); 

    $query "SHOW TABLE STATUS FROM dbname"
    $result mysql_query($query); 

    $data mysql_fetch_array($result); 

    $mydate strtotime($data['Update_time']); 

    if (
    $last_modified $mydate

    echo 
    '<P ALIGN="center"><table WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BORDER="0">' 
      
    .'<tr>' 

        
    .'<td WIDTH="100" HEIGHT="14">Site v 2.0</td>' 
        
    .'<td class="footer" HEIGHT="14" ALIGN="LEFT" VALIGN="MIDDLE" BGCOLOR="000080"><FONT COLOR="FFFFFF"><b>'._DATEPUBTEXT.' '.(date("Y-m-d H:i:s"$last_modified)).' </b></FONT></TD>' 
        
    .'<td WIDTH="50" HEIGHT="14" ALIGN="CENTER" VALIGN="MIDDLE" BGCOLOR="000080"><A HREF="#TOP"><IMG alt="'._TOPPAGETEXT.'" border="0" src="themes/'.$thename.'/images/ffffff_h_arrow.gif" width="15" height="14"></A></TD>' 
        
    .'<td class="footer" WIDTH="250" HEIGHT="14" ALIGN="RIGHT" VALIGN="MIDDLE" BGCOLOR="000080"><A class="footer" href="'._NOTICELINK.'"><FONT COLOR="FFFFFF"><b>'._IMPORTANTTEXT.'&nbsp;</b></FONT></a></TD></tr></table>' 
      
    .'<td WIDTH="150" HEIGHT="14"><IMG border="0" alt=" " src="themes/'.$thename.'/images/blank.jpg" width="75" height="14"></td>'
      } 
      else 
      { 
      echo 
    '<P ALIGN="center"><table WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BORDER="0">' 
        
    .'<tr>' 
       
          
    .'<td WIDTH="100" HEIGHT="14">Theme v 2.0</td>' 
          
    .'<td class="footer" HEIGHT="14" ALIGN="LEFT" VALIGN="MIDDLE" BGCOLOR="000080"><FONT COLOR="FFFFFF"><b>'._DATEPUBTEXT.' '.$data['Update_time'].'</b></FONT></TD>' 
          
    .'<td WIDTH="50" HEIGHT="14" ALIGN="CENTER" VALIGN="MIDDLE" BGCOLOR="000080"><A HREF="#TOP"><IMG alt="'._TOPPAGETEXT.'" border="0" src="themes/'.$thename.'/images/ffffff_h_arrow.gif" width="15" height="14"></A></TD>' 
          
    .'<td class="footer" WIDTH="250" HEIGHT="14" ALIGN="RIGHT" VALIGN="MIDDLE" BGCOLOR="000080"><A class="footer" href="'._NOTICELINK.'"><FONT COLOR="FFFFFF"><b>'._IMPORTANTTEXT.'&nbsp;</b></FONT></a></TD></tr></table>' 
        
    .'<td WIDTH="150" HEIGHT="14"><IMG border="0" alt=" " src="themes/'.$thename.'/images/blank.jpg" width="75" height="14"></td>'
      } 
    echo 
    '<table width=100%>' 
        
    .'<tr>' 
        
    .'<td align="middle">' 
        
    .'<a href="mailto<img src="images/smilies/tongue.gif" border="0" alt="">erson@place">Contact Webmaster</a>' 
        
    .'</td>' 
        
    .'</tr>' 
        
    .'</table></P>'

    ?>

  • #3
    Regular Coder
    Join Date
    May 2004
    Location
    sweden
    Posts
    236
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am not a mySQL type of guy but in SQL Server you would use a scratch table and a triggered column so that each time a DELETE,UPDATE or INSERT was done on a table then the scratch table would be written to.

    Now to fake this using MySQL might be a pain in the rear. So I suggest you create a Function that writes to the scratch table and use this at the appropriate places within your application ie place updateTable(); after each instance of an execution of UPDATE,DELETE or INSERT.
    Carl McDade
    _____________
    Hiveminds Magazine
    for web publisher and community builders
    eRuby Tutorials


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •