note 53107 deleted from function.trim by felipe

From: Date: Wed, 06 Aug 2008 22:08:34 +0000
Subject: note 53107 deleted from function.trim by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-143253@lists.php.net to get a copy of this message
Note Submitter: thom at xmods dot hu ---- Hi everybody. I make a registration page, and i want to drop \ t \n \r ...etc. I send the trim function to the post but the trim not work good because if i send the post with \ t or \ r or \n it's work but later i have got an empty registration. Here is the code: $fullname = trim($_POST['regfullname']); $messenger = trim($_POST['regmsn']); $nick = trim($_POST['regnick']); $telefon = trim($_POST['regtel']); $email = trim($_POST['regemail']); $www = trim($_POST['regwww']); $pass1 = trim($_POST['regpassword1']); $pass2 = trim($_POST['regpassword2']); $icq = trim($_POST['regicq']); $signature = trim($_POST['regsignature']); $config = trim($_POST['regconfig']); $protect = array( "<" => "&lt;", ">" => "&gt;", "&" => "&amp;", "\"" => "&quot;", "'" => "&#39;", "\n" => " ", "\t" => " ", "\r" => " ", "\0" => " ", "\x0B" => "", " " => "" ); $protectmail = array( "@" => "(KUKAC)", "." => "(PONT)" ); $fullname = strtr($fullname, $protect); $messenger = strtr($messenger, $protect); $nick = strtr($nick, $protect); $telefon = strtr($telefon, $protect); $email = strtr($email, $protectmail); $www = strtr($www, $protect); $pass1 = strtr($pass1, $protect); $pass2 = strtr($pass2, $protect); $icq = strtr($icq, $protect); $signature = strtr($signature, $protect); $config = strtr($config, $protect);

« previous php.notes (#143253) next »