iwa-panda2

Manage Weather Data by International Weather Agency (Version 2)
Log | Files | Refs | README

Utils.php (1003B)


      1 <?php
      2 
      3 namespace Lollipop{
      4 
      5     /// this class is a collection of utilities
      6     class Utils
      7     {
      8         public static function missing_fields($not_nullable)
      9         {
     10             $missing = [];
     11             foreach($not_nullable as $column) {
     12                 if($_POST[$column] == null || $_POST[$column] == "") {
     13                     $key = 'missing_' . $column;
     14                     $missing[$key] = "This field cannot be empty!";
     15                 }
     16             }
     17             return $missing;
     18         }
     19 
     20         public static function missing_fields_sans_pw($not_nullable)
     21         {
     22             $missing = [];
     23             foreach($not_nullable as $column) {
     24                 if($_POST[$column] == null || $_POST[$column] == "") {
     25                     if($column != "password") {
     26                         $key = 'missing_' . $column;
     27                         $missing[$key] = "This field cannot be empty!";
     28                     }
     29                 }
     30             }
     31             return $missing;
     32         }
     33     }
     34 }