06-12-2015, 13:51
|
|
|
|
חבר מתאריך: 22.06.08
הודעות: 12
|
|
מצטער שאני מציק
אבל אני עדיין לא ממש מבין איך לבדוק את הבדיקה הרלבנטית של הימים והחודשים (אני קופץ ישר לבדיקה של C#)
[התמונה הבאה מגיעה מקישור שלא מתחיל ב https ולכן לא הוטמעה בדף כדי לשמור על https תקין: http://i.imgur.com/REah20W.png]
עכשיו זה מציג לי 0 ימים 0 שעות ו-0 שניות לא משנה מה אני כותב
והגיל עדיין הפוך
זאת בטח טעות ממש מטופשת, אני מרגיש דביל חח
קוד PHP:
<?php
function hebrew ($im,$size,$angle,$x,$y,$color,$font,$text)
{
preg_match_all("/./us",$text,$ar);
$text=implode('',array_reverse($ar[0]));
imagettftext ($im , $size , $angle , $x , $y , $color , $font , $text);
}
$month = $_GET["month"];
$day = $_GET["day"];
$year = $_GET["year"];
date("Y");
$age = date("Y") - $year;
// mktime is the marked time, and time() is the current time.
$target = mktime(0,0,0,$month,$day,$year);
$diff = time()-$target;
$diff = 1303725600 - time();
$days = floor($tDiff / 86400);
$hours = ($tDiff / 3600) % 24;
$minutes = ($tDiff / 60) % 60;
$seconds = ($tDiff) % 60;
$imgname = "img/hpbd.png";
$im = @imagecreatefrompng ($imgname);
$black = imagecolorallocate ($im,0,0,0);
hebrew ($im, 10, 0, 60, 20, $black , "C:/windows/Fonts/arial.ttf", "יום הולדתי ה-$age יחול בעוד $days ימים, $hours שעות, $minutes דקות, ו- $seconds שניות. ");
header ("Content-type: image/png");
imagepng ($im);
imagedestroy ($im);
?>
|