note 64401 deleted from function.preg-replace by bjori

From: Date: Thu, 13 Apr 2006 17:08:42 +0000
Subject: note 64401 deleted from function.preg-replace by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-108007@lists.php.net to get a copy of this message
Note Submitter: Grrzzz Reason: bad code ---- I had a problem of removing session variables in user posted links in a forum. a usual link would look like this: index.php?item=forum& sid=72667a30353433363633303031313434393339343437& rfz0543663001144939447=f50be7d71e2f8f0312696905ee9decde I solved it this way: <?php //Filter User posted Session IDs an replace it with their own current ID //in both ways - first name then id or id an then name //(c) by Grrzzz $template = preg_replace( "/rfz([a-z0-9]{19})=([a-z0-9]{32})(\&|\&amp;)sid=([a-z0-9]{44})/", "{session}",$template); $template = preg_replace( "/sid=([a-z0-9]{44})(\&|\&amp;)rfz([a-z0-9]{19})=([a-z0-9]{32})/", "{session}",$template); ?> {session} will be replaced by the own user session data later

« previous php.notes (#108007) next »