date Functions

1. To convert unix timestamps to given format date date("Y-m-d",timestamp_value); example: date("Y-m-d",1279439784); 2. To convert given date format to unix timestamps strtotime("1984-12-25"); strtotime(date("Y-m-d")); // converts todays date to timestamps

Continue Reading

php validation for image

function isValidImageFile($image_type){ $imageType=explode("/",$image_type); switch(trim(strtolower($imageType[1]))){ case 'jpeg':$returnValue=1;break; case 'pjpeg':$returnValue=1; break; case 'gif':$returnValue= 1; break; case 'png':$returnValue= 1; break; /* if you want more extension than just keep on adding like ###…

Continue Reading

php user log activities

Function LogUserActivity($LogFile, $Activity){ $UserIp = $_SERVER['REMOTE_ADDR']; $TimeRef = date('d-m-Y H:i T'); $Handle = fopen($LogFile, 'a'); $Data = $UserIp.'|'.$TimeRef.'|'.$Activity.'~'; fwrite($Handle, $Data); fclose($Handle); } Function ReadUserActivity($LogFile){ GLOBAL $log; $LogFile = file_get_contents($LogFile); $ExplodedLogFile…

Continue Reading
  • 1
  • 2
Close Menu