inc/record.inc.php
changeset 30 380197766e7e
parent 21 31e17a9406eb
child 36 4ec5ab29f634
equal deleted inserted replaced
29:e1c60f72d494 30:380197766e7e
  1005 
  1005 
  1006 }
  1006 }
  1007 
  1007 
  1008 
  1008 
  1009 /*
  1009 /*
       
  1010  * zone_count
       
  1011  * Does a select query to count how many zones we have in the database
       
  1012  *
       
  1013  * @todo: see whether or not it is possible to add the records
       
  1014  * @param $userid integer The userid of the current user
       
  1015  * @return integer the number of zones
       
  1016  */
       
  1017 
       
  1018 function zone_count($userid=true, $letterstart=all) {
       
  1019         global $db;
       
  1020         if((!level(5) || !$userid) && !level(10) && !level(5))
       
  1021         {
       
  1022                 $add = " AND zones.owner=".$_SESSION["userid"];
       
  1023         }
       
  1024         else
       
  1025         {
       
  1026                 $add = "";
       
  1027         }
       
  1028 
       
  1029         if ($letterstart!=all && $letterstart!=1) {
       
  1030            $add .=" AND domains.name LIKE '".$letterstart."%' ";
       
  1031         } elseif ($letterstart==1) {
       
  1032            $add .=" AND substring(domains.name,1,1) REGEXP '^[[:digit:]]'";
       
  1033         }
       
  1034 
       
  1035         $query = 'SELECT count(distinct zones.domain_id) as zone_count FROM zones, domains WHERE zones.domain_id = domains.id '.$add;
       
  1036         $numRows = $db->queryOne($query);
       
  1037         return $numRows;
       
  1038 }
       
  1039 
       
  1040 /*
  1010  * Get a record from an id.
  1041  * Get a record from an id.
  1011  * Retrieve all fields of the record and send it back to the function caller.
  1042  * Retrieve all fields of the record and send it back to the function caller.
  1012  * return values: the array with information, or -1 is nothing is found.
  1043  * return values: the array with information, or -1 is nothing is found.
  1013  */
  1044  */
  1014 function get_record_from_id($id)
  1045 function get_record_from_id($id)