note 50206 deleted from function.ereg-replace by didou

From: Date: Mon, 22 Jan 2007 00:27:00 +0000
Subject: note 50206 deleted from function.ereg-replace by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-122018@lists.php.net to get a copy of this message
Note Submitter: AT-HE ( at_he at h0tmail dot com ) ---- hi.. i am just learning php since a few days.. i had mount a website in my own pc and want let users to post messages.. anyway, i wrote a very tiny page that let you run some commands remotely, that is useful mostly as example of ereg_replace and shell_exec :D <!-----run.php----- <pre> <?php $salida=ereg_replace("<","&lt;",shell_exec($_POST["comando"])); echo "comando: ",$_POST["comando"],"<br>",$salida,"<br>"; ?> <form action="run.php" method="post"> comando: <input type="text" name="comando"> </form> </pre> -----eof-----> the ereg_replace is only for replace the "<" character at the output for his code, which html reads as a tag.. - first tou must write something in the form.. - when page is opened again it takes it, replaces "<" characters and puts in $salida variable (it may be useful later).. - then prints out and you can write something again :) .. i haven't change the ">" and other characters.. i don't know if you can process the same string changing its lenght in the process.. maybe it becomes illegible after changing patterns of diffrent length such $str=ereg_replace("a","aaaaa",$str), dont know yet. greetings ;)

« previous php.notes (#122018) next »