Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Echo The Last Time Directory Was Modified..


I want to do the following in a PHP script: Get the time at which a directory was last modified, and then, if it was within the last 30 days, echo that time.




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Get The TIME A File Was Modified ??
1st step - I can get the "current time" -


$tr=time();
echo "TIME = $tr<BR>";
RESULT "TIME = 1135860780"


OK...

I CAN get the last time a file was last modified :-

echo "FILe - '$file'<BR>";
if (file_exists($file)) {
$ta=date ("F d Y H:i:s.", filemtime($file));
echo "The file was last modified: $ta<BR>";
}

RESULT = "The file was last modified: July 30 2005 03:05:20."

However - My problem....

i am having a problem - Converting the time shown above - into a UNIX
timestamp...

$taw = date('d/m/Y H:i:s', $ta) ;
echo "Time Modified = '$taw'<BR>";
$taw=strtotime('$ta');
echo "Time Modified = '$taw'<BR>";
$taw=strtotime($ta);
echo "Time Modified = '$taw'<BR>";

But the result I get is :-

View Replies !   View Related
Header Last Modified Time
For some reason, when you view the http header info for my .php pages, it does not show a last modified date and time. So, thinking that I could create one, I tried this:

<?php header("Last-Modified: ".filectime($_SERVER['PHP_SELF']); ?>
but it doesn't work. Does anyone know how to do what I am trying to do?

View Replies !   View Related
Get File Last Modified Time Of URL
does anyone have a good trick to get the last file modified time of an external file or image. as you konw filemtime does not work (i have php 4.*) on most of the urls. can I get this information some other way?

View Replies !   View Related
Trying To Display The Time Using Echo Time();
I'm trying to make something that will do something liek this:

every 5 minute add 1 to $var1 although i want it so when I leave my browser and come back 10 min later I want to have 2.
how can this be done?

<?php 
// time function everuy 5 min execute{
$starttime = 0;
$var1 = $starttime++;
?>

Also I'm trying to display the time using echo time(); its all numbers all together how i manipulate the (inside) of the time function?

View Replies !   View Related
Echo Current Directory
how to echo the current directory of something without getting the whole url (/home/user/public_html/folder/). So basically if it is in my forum directory I just want to get "/forum/" without the full document root. Anyone know how? I tried REQUEST_URI but the problem is it echoes the whole url (include the filename).

View Replies !   View Related
Echo The Workind Directory And Change It?
is there any way that I can echo the workind dir? so later I can changed using chdir()?

View Replies !   View Related
Echo Directory Modification Date If Less Than 30 Days Old..
I am using the following code to echo the last modification date of a directory.  However, I want it to be conditional such that the modification date will only be echoed if it is less than 30 days old (based on the current date). Code:

View Replies !   View Related
Read A Directory Files, And Create Echo HTML?
i have a foo/ directory and a foobar/ directory, and a barfoo/ directory in root/

for each directory in root, i'll put x or y or z amount of images in each directory. then, have the php write 01.html with the correct links to a) main image, b) thumb images and prev/fwd links.

we could have separate php files to handle the drawing of the new sequenced .html files in each directory (probably best to pass variables), because they're slightly different, or one to rule them all (sounds like too much work).

then, the syntax would need to be sorted out (so index.html has a link to foo/foo.php?=foo01) would work correctly and draw up 01.html with the correct images, being that index.html would probably have to have hardcoded variable-passing links. eh?

it's sweet, 'cause updating would be fast. upload and delete image files. done. I mean, I know that you could go the database/XML route, but sigh ........

View Replies !   View Related
Lists The Files In A Directory Echo Names Without Extension
I have an open directory document which lists the files in a directory. Is there any way to echo the name without the extension.


$dir = $_GET['artist'];
if ($handle = opendir($dir)) {
while ($file = readdir($handle)){
if ($file != '.' && $file != '..' && $file != 'info.txt'){
echo "<a href ="$dir/$file">".$file."</a>";
}
}
closedir($handle);
}

View Replies !   View Related
Echo Time Length Of AVI File..
Is there a PHP function, or some other way, to echo the length of an AVI file?  Like the hours, minutes and seconds?

View Replies !   View Related
Echo Server Response Time?
is there a way I can display the speed at which a server returns any data? for example, I would to display: this server returned the result in : .... secs I was just wondering if this is possible.

View Replies !   View Related
Long Time Responses Echo My Content
I have a php script than sometimes in a day takes long time to echo my content

$starttime =
echo $content
$endtime =
$total = $endtime - $starttime

Is $total is greater than 30 seconds then i receive an email, my client is blocking my content because delays,

Do you have any idea what could be the problem ?

My script does at most 3 queries, then use a template to build my response, i get the content in a variable and then echo.

View Replies !   View Related
Upload Multiple Files At The Same Time Into A Directory.
I'm wondering if there is a way to upload multiple files at the same time into a directory.

View Replies !   View Related
Using Last-Modified
I want to use Last-Modified in a php script, but
it doesn't seem to work somehow.

i use the following code where $FileDate is a formated date like:
Sun, 06 Nov 1994 08:49:37 GMT (RFC 822, updated by RFC 1123)

if($HTTP_IF_MODIFIED_SINCE==$FileDate)
{
header("Status: 404 Not Modified");
die();
}

header("Last-modified: ".$FileDate);
header("Content-type: ".$FileType);
print $FileData;

somehow the server doesn't send the header, or the browser
doesn't sent the If-Modified-Since header. I know for a fact that
$HTTP_IF_MODIFIED_SINCE is the right variable to compare with.

I use apache under linux (and mysql), am i forgetting something
or do i have to set something in my conf file ?

View Replies !   View Related
Last Modified
if there was a way to find out the last time a file was uploaded. So, let's say I have a Word file on my computer that was last modified 2 months ago. I need to upload said Word file using PHP and I need PHP to find out when it was last modified. If I try something like filemtime(),it tells me that it was last modified the exact second it was uploaded. Is there anyway to do this?

View Replies !   View Related
If-Modified-Since
Is there a HTTP-compliant implementation of If-Modified-Since-, If-Match, If-None-Match, If-Range and so on? I want my PHP-script to act exactly as if it was a static HTML-page delivered directly from Apache. I think this isn't easy to implement, especially if you take also weak and strong validators into account.

View Replies !   View Related
Last-modified
I tried putting this at the beginning of a PHP file:

<?php
echo "Last-modified: " . date( "F d Y.", getlastmod() );
print "";
?>

The goal was to ensure that the browser would realize that the page is newly produced HTML. However its not working. The browser shows above the page the expression.

View Replies !   View Related
'echo "": No Such File Or Directory" Error Using "exec" To Pipe In PHP Script
[TCL]
set php {<? print_r("Hello World"); ?>}
puts $php; # PRINTS OUT <? print_r("Hello World"); ?>
puts [exec "echo '$php' | php -q"]
[/TCL]

When I try this within TCL I get the following error:

View Replies !   View Related
Echo: How To View/call Data From Separate File Into Echo
I would like to ask about echo "<--statement==>";

Ok my senario let say like this i got a file name as datax01.php & script.php

Let say on script.php i got a code to use echo. So how from echo i can recall datax01.php to view on that script? Code:

View Replies !   View Related
Getting The Last Modified Row In Mysql Db
Hello. I'm not sure if this should go in the MySQL forum but Oh well. Anyways I've got my webpage to display everything in my Databases table. I've use the following code->

<?php
$linkID = @mysql_connect("localhost", "INSERT YOUR DB USERNAME HERE", "INSERT YOUR DB PASSWORD HERE");
mysql_select_db("INSERT YOUR DB NAME HERE", $linkID);

$resultID = mysql_query("SELECT ibf_members.id, ibf_members.name, ibf_members.email FROM ibf_members", $linkID);

print "<table border=1><TR><TH>ID</TH>";
print "<TH>Name</TH><TH>Last Name</TH></TR>";

while ($row = mysql_fetch_row($resultID))
{
print "<TR>";
foreach ($row as $field)
{
print "<TD>$field</TD>";
}
print "</TR>";
}

print "</table>";

mysql_close($linkID);

?>

But I want it to display the row that was modified last.
I've searched through my php book and looked at all the commands it offers but I didn't find anything that would relate to what I want to happen. So I just want to know what the function is to display -- or at least dump the last modified row into a variable.

View Replies !   View Related
Another Last Modified Question
So a while back I started parsing .htm/.html files as php so I could include some php code snippets within my pages while appearing as static pages.

With that I recently found that I no longer generate any cache headers.

I did some research and found that I can include :

<?php header("Last-Modified: " . gmdate("D, d M Y H:i:s", getlastmod()) . " GMT");?>

at the top of every page. I then validate this with a header check tool online with a few pages I was testing on. While the last modified date does show now it NEVER returns a 304 which is the entire purpose of this. It is ALWAYS 200.

Here is an example of my output from the test :

#1 Server Response: http://www.foo.com/test.htm
HTTP Status Code: HTTP/1.1 200 OK
Date: Wed, 27 Dec 2006 07:24:39 GMT
Server: Apache/1.3.36 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.2 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.27 OpenSSL/0.9.7a
X-Powered-By: PHP/4.4.2
Last-Modified: Wed, 27 Dec 2006 07:15:07 GMT
Connection: close
Content-Type: text/html

Now, shouldn't this be returning 304 to me after it has been cached locally on my machine?

Second question - is it worth creating an etag along with this? What about some of the other cache controls out there? Basically, my only reason for this currently is to comply a little better and save some bandwith. My pages rarely change, but when they ARE updated I would like places like Google to know about it.

View Replies !   View Related
Last Modified Date
Is there any way to access the last modified date of a page off your own domain?

View Replies !   View Related
Modified Guestbook?
is it possible to modify a guestbook script so that i can post regular html codes ??

i want to use the guestbook approach because it has the power to allow only a defined number of posts per page, and automatically creates other pages from the remainders. also, it shows the latest post on top. << This is extremely important for me.

View Replies !   View Related
Modified Date
i need to get the modified date of a certain file in the directory this gives me the modified date of the file this code is in.

to see what this code does you can look at this page it gives me a expiration date of my online photo galleries. Code:

View Replies !   View Related
A File Was Modified
I know how to read a directory and list the files that are in it. Is there a way to tell when each file I find was last modified? PHP Code:

$dir = "path/to/my/directory/folder";
if ($handle = opendir($dir)) {
   ///// This is the correct way to loop over the directory.
   while (false !== ($file = readdir($handle))) {
      $myFiles[] = $file;
      echo "<p>$file</p>";
   }
}

View Replies !   View Related
Last Modified Database
How to use php to get a last modified date and time from the database. I want my footer to have a "Last Updated: 0/0/0000" using the database motified date.

View Replies !   View Related
Topics/last Modified
I'll have a play around with some code later, if I can think of something, but I was just wondering if anyone's done this already or knows a way. I'd like a list of 'hot topics' on my page it would be a list of recently viewed pages in the site. I expect it would have something to do with Last Modified getlastmod() but I can't think beyond that at the mo.

View Replies !   View Related
If-modified-since HTTP Compliant!
is there a HTTP-compliant implementation of If-Modified-Since-, If-Match,
If-None-Match, If-Range and so on?

I want my PHP-script to act exactly as if it was a static HTML-page
delivered directly from Apache.

I think this isn't easy to implement, especially if you take also weak and
strong validators into account.


View Replies !   View Related
Show Last Modified Date From DB In PHP
Is there a way to show in PHP automatic the date when a DB was last
modified?

View Replies !   View Related
Last Modified Java Script
I'm using a very simple Java Script that tells you the date and time the file was last modified. Code:

View Replies !   View Related
Show When The Page Has Been Last Modified
1. I have php script that will show when the page has been last modified. How do I link it on my home page. The link that I am using now does not work. Here is the link:
<? include("updatepage.php"); ?>

2. I have a php forum. When I link it this way <a href="xxxxx/index.php"> it brings up the source code. When I link it this way <a href="xxxxxx/"> it brings up the dir. When I link it this way <a href="http://xxx/xxxxx/index.php"> it works. How do I get it to work with this linking <a href="xxxxxx/index.php">

View Replies !   View Related
Compile Certain .php Pages So They Cannot Be Modified
I have started building a php mysql internal application which I may like on sell some day. I was wondering if it was possilbe to compile certain .php pages so they cannot be modified, kinda like what you can do with other languages such as java and c when you compile the code.

View Replies !   View Related
Access To 'If-Modified-Since' Header
how can i access to mentioned header, sent from a user? so i can determine whether send him back 200 OK or 304 not modified..

View Replies !   View Related
Not Modified" Responce
The standard says "The 304 response MUST NOT contain a message-body,
and thus is always terminated by the first empty line after the header
fields"

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

PHP script I do the time calculations and then I simply do:

header('HTTP/1.1 304 Not Modified') exit ;

But when I retrieve the responce as raw text I see that the responce
does have a body. It is just 8 bytes of binary data and I dont know how
to prevent that from being sent after the headers.

View Replies !   View Related
Hyperlink Modified Dynamically
I want a Hyperlink that modifies dynamically the target after every click. The link text/gif should be permanent, but the link target should be taken from a dynamic file/table in the server, and modified following every click by any user.

View Replies !   View Related
Displaying Modified Date Of A URL File
I want to display a web page with links to various documents and display the date each document was last modified next to the link. I've found the filemtime command and that works quite nicely for "local" files. However, filemtime doesn't work if the file(s) are refered to by their URLs (which is how I need to do it).

A comment on the manual page (http://www.php.net/manual/function.filemtime.php3) refers to having to use "Socket Operations" but the link posted with that comment doesn't work (it just goes to a page saying the website has been rearranged).

View Replies !   View Related
Modified Date For Alternative File
Is there a way to add the last modified date for an alternative file into another one? My problem is that when I use getlastmod it is looking at the date on a file that controls headers/background etc for the page, but not the file that is accessed during modification of the data. Is there any way to add a line of code to get the modified date from the data file?

View Replies !   View Related
Change Modified Date Automatically
on my website my index page is php, and I update some of the content on a daily basis, I use a news script, but this does not update the pages actual "Date Modified"

I want to be able to have this as always changing as my content is too, I dont want search engine spiders thinking that I do not update my content..

so rather than manually opening my pages then re-saving them is there any way to automatically do this?

View Replies !   View Related
Finding Out When Remote Files Have Been Modified
Is there any way I can find out when a file on a remote web server was last modified. filemtime() only appears to work on local files and folders.

View Replies !   View Related
List Directories By Date Modified
I have a script that reads all directory names within a specific location (only containing folders), then lists all jpeg files in those directories. Here is my script:

function getDir($dir,$foldername){
$d2 = opendir($dir);
while (false !== ($file = readdir($d2))) {
$ext=substr($file,(strlen($file)-3),strlen($file));
if($ext=="jpg" || $ext=="JPG"){
// list $file under heading $foldername
}
}
}
$d1 = opendir('ONLINE/');
while (false !== ($folder= readdir($d1))) {
if($folder!="" && $folder!="." && $folder!=".."){
getDir('ONLINE/'.$folder."/",$folder);
}
}

View Replies !   View Related
Deleting Files In A Folder Modified Before Certain Date
I use a cache system that requires creation of files in a folder .

Now , what i need to know is how can i delete files created say 3 days ago.

So that the cache remains fresh.

The directory contains around 20,000 files , about 10,000 are generated each day (if they dont exist)

So getting info about the each file after using opendir will cause the server to slow down.

View Replies !   View Related
Update Database Based On Modified Fields
I have a php page that retrieves entries from a mysql database and puts the data back in their corresponding fields. I would also like to offer the option of updating the database within this page.

What I'm thinking is that whenever the user modifies a field, the value is then updated in the database. What I'm concerned with is the time it will take to update the database if I use many select and update commands.

Is there a smart way to detect which fields were modified and then only update the fields that have changed using some php coding and not javascript. Or only doing an UPDATE command will be the best way to do it.

View Replies !   View Related
If (Username Exists){echo 1} Else {echo 2}
I want someone to create an account and when they initially log in there should be a form that says create a character, if they dont fill it in and log out then the next time they log in it will still be there,

if they do fill it out I want there user info to show, the problem that I am having is that when they create a charachter the character form stays on tyhe screen, I dont want it to do that. Code:

View Replies !   View Related
*modified * Query Failed - Resource Id #2, Error In Syntax !!! Officially Lost
Here's what I get

"Query failed
Resource id #2

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #2' at line 1" Code:

View Replies !   View Related
Include Or Require A File From A Protected Directory And Maintain The Directory's Access Control?
I have an htaccess protected directory and I'm accessing a file in it through a require "admin/admin.php"; command (admin being the protected directory). I was hoping for the username and password popup window, instead I got direct access to my file.

Is there another way to include or require a file from a protected directory and maintain the directory's access control??

View Replies !   View Related
Virtual Directories? Scripts Directory Nor The Php Directory Physically Exisit On The Server
I have seen websites that use a sort of "virtual directory" system...

Lets say when you click on something it goes to
http://www.example.com/scripts/php/

Neither the scripts directory nor the php directory physically exisit on
the server, does anyone know how this is done?

View Replies !   View Related
Max Execution Time Means Server Execution Time Or Client Browser Hung Up Time?
The max execution time is set up to be 30.

When I submit the requests of execution through the client browser, it shows the execution was running. It still hung up there after 30 seconds, after 2 minutes ...

And the browser hung there forever.

I have another page which saves the reports of the execution, so I open another browser window, and check out the report. It shows me the execution is still going even after 1 minute, 2 minutes... Code:

View Replies !   View Related
How Can I Include A File Relative To The Top Level Directory From Any Other Directory ?
How can I include a file relative to the top level directory from any other
directory ?
I really hate to use absolut url or put all my files in one directory.

eg : include("<symbol for top>/somefile.php"); ?

View Replies !   View Related
Open A Directory And Set The Names Of The Files In That Directory In An Array
I'm trying to open a directory and set the names of the files in that directory in an array (ei. file[0], file[1],file[2]...) for howmany files there mey be in the dir.

View Replies !   View Related
Is There A Way To Echo An Echo Command?
Is this possible ? for those of you who don't understand what am i trying to ask:

<?php echo '<?php echo "This is what i'm trying to do!"; ?>'; ?>

View Replies !   View Related
How To Copy Files From Ftp Directory To Web-accessible Directory?
I need to copy files from an ftp directory to a web-accessible directory and then delete the files in the ftp directory. (I am doing it this way because web-based form upload can not exceed 2MB and I can't change that)

View Replies !   View Related
What Should I Use To Set Up Modified "Calendar" Form?
I have events that take place every Monday, Wednesday, Saturday, and Sunday, and I want to generate my copy--which is the same for most events--and my printed schedule from a php form.

My plan is to first generate a form that lists pulldown boxes for each of those days in the next month--I could specify the month, but I don't think that fits my bill, and then utilize the pulldowns to set the events.

However, I'm not sure where to begin to return just the days I need...should I use getdate() as my basis for this?  From what I'm reading, it seems right, but I'm not sure.

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved