Example #1
0
 public static function registerUser($name, $email, $password)
 {
     $passwordHash = FunctionLibrary::passwordEncrypt($password);
     $db = DB::getConnection();
     if ($db) {
         $sql = "INSERT  INTO user(";
         $sql .= "name, email, password, role";
         $sql .= ") VALUES(";
         $sql .= "?, ?, ?, 'admin'";
         $sql .= ")";
         $stmt = $db->prepare($sql);
         $stmt->bindParam(1, $name, PDO::PARAM_STR);
         $stmt->bindParam(2, $email, PDO::PARAM_STR);
         $stmt->bindParam(3, $passwordHash, PDO::PARAM_STR);
         return $stmt->execute();
     }
 }