Jump to content
php.lv forumi

demo list!


lazda144

Recommended Posts

kaa var uztaisiit apmeeram taadu lapu!! (bildes naw svariigas galvenais kaa pa dienaam sadaliit!!)

 

man ir viens demo skripts bet loti vienkars!!

 

<?php
if ($handle = opendir('C:/wamp/www/demo/')) {
while (false !== ($file = readdir($handle))) {
if (strlen($file) > 4)
{
$gabali = explode("-", $file);
$date = $gabali[1];
$mape = $gabali[2];
$mapesgabali = explode(".", $mape);
$name = $mapesgabali[0];
$year = substr($date,0,2);
$month = substr($date,2,2);
$day = substr($date,4,2);
$hour = substr($date,6,2);
$minute = substr($date,8,2);
echo "<center> $day.$month.$year             $hour:$minute             $name             
<a href=\"demo/$file\">Novilkt</a></br></center>";
}
}
closedir($handle);
}
?>

Link to comment
Share on other sites

imho vieglāk uzreiz samest pa attiecīgajām laika direktorijām, jo ja kaut kas nobrūk, tad liekot no rezerves kopijām tie laiki nobrūk.

Nu var jau arī rakstī kādā DB vai txt failā kāds kuram failam tas datums bija.

http://lv.php.net/manual/en/function.filemtime.php

Link to comment
Share on other sites

<?
$handle="./bla/bla/bla/";
$today=date("Y-m-d");
while(false !== ($file = readdir($handle)))
{
 $created=filemtime($handle.$file);
 $filedate=date("Y-m-d h:i:s",$created);
 $filedate=explode(" ",$filedate);
 if($filedate[0]==$today){ echo "bla bla bla"; }
}
?>

 

ej un mācies

Link to comment
Share on other sites

tik un taa neit!!

 

Warning: readdir(): supplied argument is not a valid Directory resource in C:\wamp\www\dem.php on line 4

 

<?php
$handle="/demo/";
$today=date("Y-m-d");
while(false !== ($file = readdir($handle)))
{
 $created=filemtime($handle.$file);
 $filedate=date("Y-m-d h:i:s",$created);
 $filedate=explode(" ",$filedate);
 if($filedate[0]==$today){ echo "bla bla bla"; }
}
?>

Edited by lazda144
Link to comment
Share on other sites

×
×
  • Create New...