PHP Classes

File: usefullfunctions.php

Recommend this page to a friend!
  Classes of zinsou A.A.E.Moïse   tinyUGatMs   usefullfunctions.php   Download  
File: usefullfunctions.php
Role: Auxiliary script
Content type: text/plain
Description: usefull functions php script
Class: tinyUGatMs
Manage users and groups of events in a database
Author: By
Last change:
Date: 7 years ago
Size: 1,074 bytes
 

Contents

Class file image Download
<?php
function inrangetime($x,$y,$z){
    if(
is_array($x)&&is_array($y)&&is_array($z)){
        if(
count($x)==3&&count($y)==3&&count($z)==3){
           
$xtimeinsecond=$x[0]*3600+$x[1]*60+$x[2];
           
$ytimeinsecond=$y[0]*3600+$y[1]*60+$y[2];
           
$ztimeinsecond=$z[0]*3600+$z[1]*60+$z[2];
            if(
$xtimeinsecond>$ytimeinsecond&&$xtimeinsecond<$ztimeinsecond){
                return
true;
            }else{
                return
false;
            }
        }else{
            return
false;
        }
    }else{
        return
false;
    }
}

function
dologout(){
   
session_destroy();
}

function
reccurence_reached($x,$y){
   
$recurrence=array('dayly'=>1,'weekly'=>7,'monthly'=>30,'quartely'=>90,'yearly'=>365);
    if(
is_integer($x)&&array_key_exists($y,$recurrence)){
       
$secondsin_aday=86400;
       
$time=time();
       
$time=$time-$y;
       
$secondsforreccurence=$recurrence[$y]*$secondsin_aday;
       
$ntimes=$time/$secondsforreccurence;
       
$marge=$time%$secondsforreccurence;
       
// var_dump($marge);echo'<br>';var_dump($ntimes);
       
if($marge<$secondsin_aday){
            return (int)
$ntimes;
        }else{
            return
false;
        }
    }else{
        return
false;
    }
}
?>