Re: Re: Running PHP Function from ECHO'd MySQL Data

From: Date: Fri, 23 Nov 2001 19:19:39 +0000
Subject: Re: Re: Running PHP Function from ECHO'd MySQL Data
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-75602@lists.php.net to get a copy of this message
Hi, Yeah, I saw this trick: <?=eval("?>".$row[content]."<?");?> :) I'll be careful since only the staff can add articles, and if they put dastardly code in, well, I'll just beat them silly. In other words, the "public" won't be doing anything that will be "eval'd" so I should be pretty safe. Is this the most elegant way? I mean I guess the other way is to scan through until I find <?= and then ;?> and run the stuff in between... But that'd probably be through eval() as well. P.S. Thanks Chris. Chris Hobbs <chobbs@silvervalley.k12.ca.us> tapped out: > eval() is your friend - but be careful with it. > > Erik J. Barzeski wrote: > >> Hi, >> >> I've come upon a stumbling block and I'd like to resolve it the best way. I >> could probably think of a few work-arounds, but I'd rather not hack it if >> there's an elegant solution... >> >> I have a function, let's call it "do_stuff" that I include() in my head.inc >> file, which every page on the site include()s. So the function is available. >> >> Now, I have a bunch of articles in a MySQL database. The article "body" (a >> blob) has minimal HTML, like <p> and </b> and so on. It also contains stuff >> like this: >> >> <?=do_stuff("item1.jpg", "something else here");?> >> >> Now... How can I get PHP to process these commands? Obviously echo is not >> the way to go, since that's post-processing... What's the most elegant >> solution? >> >> Please email me off-list as I get the digest and won't see any answers for >> quite some time. Feel free as always to CC the list of course. >> >> P.S. I looked around quickly and didn't find the solution, so yes, this >> email to the list is pretty early in my "research" stage. >> >> Thanks! >> >> > > -- Kindest regards, Erik J. Barzeski My name is Ozymandias, king of kings: Look on my works, ye Mighty, and despair! ******************************************************************* Email: erik@(anything below) AIM: iacas ICQ: 8186546 http://barzeski.com/ http://weims.net/ http://techstra.net/ http://cocoadevcentral.com/ http://soundsetcentral.com/ http://applescriptcentral.com/ *******************************************************************

« previous php.general (#75602) next »