Skip to main content

Posts

Showing posts with the label codeigniter

Fencing ( Latitude Longitude )

 Check Lat/Long is Inside/Outside of fencing <?php function onLine($side,$point)  //check whether p is on the line or not {   if ($point['x'] <= max($side['x']['x'], $side['y']['x']) && $point['x'] <= min($side['x']['x'], $side['y']['x']) &&    ($point['y'] <= max($side['x']['y'], $side['y']['y']) && $point['y'] <= min($side['x']['y'], $side['y']['y'])))       return true; return false; } function direction($point1,$point2,$point3) {    $val=($point2['y']-$point1['y'])*($point3['x']-$point2['x'])-($point2['x']-$point1['x'])*($point3['y']-$point2['y']);    if ($val == 0)    return 0; //colinear    else if ($val <0)    return 2;          //anti-clockwise direction    return 1;          //clockwise direction } function...

WEEK DATE

Previous week - $previous_week = strtotime("-1 week +1 day"); $start_week = strtotime("last sunday midnight",$previous_week); $end_week = strtotime("next saturday",$start_week); $start_week = date("Y-m-d",$start_week); $end_week = date("Y-m-d",$end_week); echo $start_week.' '.$end_week ; Current week - $d = strtotime("today"); $start_week = strtotime("last sunday midnight",$d); $end_week = strtotime("next saturday",$d); $start = date("Y-m-d",$start_week); $end = date("Y-m-d",$end_week);  Next Week - $d = strtotime("+1 week -1 day"); $start_week = strtotime("last sunday midnight",$d); $end_week = strtotime("next saturday",$d); $start = date("Y-m-d",$start_week); $end = date("Y-m-d",$end_week);

SEARCH BETWEEN DATES CODEIGNITER

# search the saved data by date.      public   function   searchBydate ()     {          $startdate     = ( trim ( $this -> input -> get ( 'startdate' )));          $enddate     = ( trim ( $this -> input -> get ( 'enddate' )));          $column  =  array (  'id' ,  'userid' ,  'filename'  );          // SELECT * FROM `library` WHERE `date` BETWEEN 'startdate' AND 'enddate '           $where  =  array (                       ...

CONTROLLER PROJECT II

<?php defined ( 'BASEPATH' ) OR  exit ( 'No direct script access allowed' ); require  APPPATH  .   '/libraries/API_Controller.php' ; class   Services   extends   API_Controller  {           public   function   __construct ()     {             header ( 'Access-Control-Allow-Origin: *' );          header ( "Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE" );          parent :: __construct ();          //SMTP & mail configuration          $config  =  array (              'protocol' ...