23 lip 2009

Sprawdzenie poprawności obrazka

if($_FILES['foto']['tmp_name']) {

$tab = getimagesize($_FILES['foto']['tmp_name']);
 $width = $tab[0];
 $height = $tab[1];
 $mime = $tab['mime'];

if($width<600 && $height<400) 
  $errors[]='złe wymiary zdjęcia, minimalne wymiary 600x400';

if(!preg_match("/(jpg|jpeg|png|gif)/", $mime)) 
  $errors[]='zły format zdjęcia';
}
23 lip 2009

Dodanie do daty akutalnej godziny

echo date('H:i:s', strtotime('now')) . ' ';
echo date('Y-m-d', strtotime("+2 days")) . ' ' . date('H:i:s', strtotime('now')) . '';
$task_dateend = date('Y-m-d H:i:s', strtotime(date('Y-m-d', strtotime("+2 days")) . ' ' . date('H:i:s', strtotime('now'))));
echo $task_dateend;

Wynki:
2009-07-25 14:02:51