GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • codeigniter4/CodeIgniter4
  • Home
  • Welcome to CodeIgniter4
  • Server Requirements
  • Credits
  • PSR Compliance
  • License Agreement
  • Installation
  • Composer Installation
  • Manual Installation
  • Running Your App
  • Worker Mode
  • Troubleshooting
  • Deployment

This view

  • Original page
  • New address

GeezerVison is showing codeigniter4.github.io — Security Helper - CodeIgniter

Edit this page

Security Helper¶

The Security Helper file contains security-related functions.

Loading this Helper¶

This helper is loaded using the following code:

<?php

helper('security');

Available Functions¶

The following functions are available:

sanitize_filename($filename[, $relativePath = false])¶

  • Parameters

    • $filename string Filename
    • $relativePath bool Whether the relative path is acceptable (available since v4.6.2)
  • Returns: Sanitized file name

  • Return type: string

Provides protection against directory traversal.

Backslashes are always removed. If $relativePath is true, forward slashes are preserved to allow relative paths such as path/to/file.txt, while parent-directory sequences (../) are removed.

Note

When passing relative paths to this helper, use forward slashes (/) as directory separators, including on Windows.

For more info, please see the Security Library documentation.

strip_image_tags($str)¶

  • Parameters

    • $str string Input string
  • Returns: The input string with no image tags

  • Return type: string

This is a security function that will strip image tags from a string. It leaves the image URL as plain text.

Example:

<?php

$string = strip_image_tags($string);

encode_php_tags($str)¶

  • Parameters

    • $str string Input string
  • Returns: Safely formatted string

  • Return type: string

This is a security function that converts PHP tags to entities.

Example:

<?php

$string = encode_php_tags($string);
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.