Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Question about my header inject protect function

Featured Replies

Hey i was wondering will my function protect againest most header injection attempts

 

 

<?php
function DOprotect($string){
 // OUR PROTECT FUNCTION
 $string = stripslashes($string);
 $string = trim($string);
 $string = strip_tags($string);

 //Header inject protection
 $find = array(
'bcc:',
'cc:',
'to:',
'from:',
'content-type:',
'mime-version:',
'multipart/mixed',
'content-transfer-encoding:'
);
$string = str_replace("@","AT",$string);
$string = str_replace($find,"",strtolower($string));

 return $string;
}



?>

Thanks in advance

The obvious answer, and generally good advice with security, is to try to break it yourself. Your code looks OK at a glance, but I'm not a PHP expert.

 

And however rare anything is, it is still worth covering: security flaws should be closed, just as small minorities of users should be catered for....

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.