Wednesday, 24 February 2016

PHP mp3 Audio file upload

<?php /* ini_set("error_display",1); ini_set('memory_limit', '32M'); ini_set('upload_max_filesize', '24M'); ini_set('post_max_size', '32M'); //echo ini_get('upload_max_filesize'); */ $uploadpath = 'upload/';      // directory to store the uploaded files $max_size = 30000;          // maximum file size, in KiloBytes $alwidth = 900;            // maximum allowed width, in pixels $alheight = 800;           // maximum allowed height,...

PHP MYSQL - DATE and TIME functions

TIMEDIFF( ) Synopsis TIMEDIFF(time, time) This function returns the time difference between the two times given. Although the arguments may be given in time or date-and-time format, both arguments must be of the same datatype. This function is available as of Version 4.1.1 of MySQL. SELECT appointment AS Appointment, NOW( ) AS Now, TIMEDIFF(appointment, NOW( )) AS 'Time Remaining' FROM appointments WHERE rec_id='3783'; +--------------------+--------------------+----------------+ | Appointment | Now ...

uniqid() - Four ways to generate unique id by PHP

 Four ways to generate unique id by PHP 1. Using uniqid() function <?php//creates a unique id with the 'about' prefix$a = uniqid(about);echo $a;echo "<br>";//creates a longer unique id with the 'about' prefix$b = uniqid (about, true);echo $b;echo "<br>";//creates a unique ID with a random number as a prefix - more secure than a static prefix $c = uniqid (rand(), true);echo $c;echo "<br>";//this md5 encrypts the username from above, so its ready to be stored in your database$md5c = md5($c);echo $md5c;echo "<br>";?> 2....

Friday, 5 February 2016

PHP Get last 12 months from now

<?php $months = array(); for ($i = 1; $i <= 12; $i++) {     $months[] = date("Ym", strtotime( date( 'Y-m-01' )." -$i months")); } print_r($months); ?>...