note 64401 added to function.preg-replace

From: Date: Thu, 13 Apr 2006 15:07:18 +0000
Subject: note 64401 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-107995@lists.php.net to get a copy of this message
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 ---- Server IP: 212.124.37.9 Probable Submitter: 84.187.105.124 (proxied: unknown) ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- http://master.php.net/note/edit/64401 Del: integrated -- http://master.php.net/note/delete/64401/integrated Del: useless -- http://master.php.net/note/delete/64401/useless Del: bad code -- http://master.php.net/note/delete/64401/bad+code Del: spam -- http://master.php.net/note/delete/64401/spam Del: non-english -- http://master.php.net/note/delete/64401/non-english Del: in docs -- http://master.php.net/note/delete/64401/in+docs Del: other reasons-- http://master.php.net/note/delete/64401 Reject -- http://master.php.net/note/reject/64401 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#107995) next »