RE: [PHP] eval();

2005-10-30 Thread Josh McDonald
Keep in mind, eval()ing code you pull from the database will also raise the damage from a SQL injection attack or similar from a PITA restore-your-database to a much bigger PITA format-webserver. -Josh -- My name was Brian McGee I stayed up listening to Queen When I was seventeen Josh 'G-Fu

Re: [PHP] [DONE] Substr by words

2005-10-30 Thread Richard Lynch
On Sun, October 30, 2005 6:04 am, Marcus Bointon wrote: > On 29 Oct 2005, at 20:41, Richard Lynch wrote: > >> It was probably replacing *TWO* spaces with one. >> >> If so, it should really be in a while loop, because there could be 3 >> or more spaces in a row, and if the goal is only single-spaced

Re: [PHP] Type of form element

2005-10-30 Thread Richard Lynch
On Sun, October 30, 2005 5:52 am, Marcus Bointon wrote: > On 29 Oct 2005, at 20:59, Richard Lynch wrote: > >> So you will most likely be using isset($_POST['checkbox_name']) >> rather >> than testing for "on" > > I classify using isset for checking for the existence of array keys > to be a bad habi

Re: [PHP] eval();

2005-10-30 Thread Richard Lynch
On Sun, October 30, 2005 8:51 pm, John Taylor-Johnston wrote: > eval( " ?> $contents >>However, if eval() is the answer, you're probably asking the wrong >>question. You should take a hard look at your code and think of a >> better >>way to do what you need to do. >> >> > Back to the drawing board

Re: [PHP] Re: Substr by words

2005-10-30 Thread Gustavo Narea
Hello, Marcus. Marcus Bointon wrote: On 30 Oct 2005, at 15:35, Gustavo Narea wrote: I think that trim($matches[0]) will return the whole string with no change. No, it will return the entire matching pattern, not just the sub- matches. I added the trim to remove any leading space, and there w

Re: [PHP] un-eval()

2005-10-30 Thread John Taylor-Johnston
I guess I won the powerball $100 million. I'd feel better with the cash ;) John Robert Cummings wrote: Does eval() have a synonym? The infinite set of source code permutations that can output the word 'red' as a sole output regardless of whatever other logic may occur within the content of $code

Re: [PHP] eval();

2005-10-30 Thread John Taylor-Johnston
eval( " ?> $contents However, if eval() is the answer, you're probably asking the wrong question. You should take a hard look at your code and think of a better way to do what you need to do. Back to the drawing board? It is either store my html+embedded code in a mysql record, or in an html

Re: [PHP] un-eval()

2005-10-30 Thread Robert Cummings
On Sun, 2005-10-30 at 21:15, Chris Shiflett wrote: > John Taylor-Johnston wrote: > > Does eval() have a synonym? > > I don't usually like to answer a question with a question, but consider > this: > > eval($code); > > This produces the following output: > > red > > Given this, what was the va

Re: [PHP] eval();

2005-10-30 Thread Jasper Bryant-Greene
On Sun, 2005-10-30 at 21:24 -0500, John Taylor-Johnston wrote: > > >>$contents = " >>arial,helvetica; font-weight: bold;\">About the Project > >>"; > >>echo eval($contents); > >>?> > >>eval() expects PHP code, not HTML with embedded PHP code. Try this > >>(untested): > >> > >>eval( " ?> $contents

Re: [PHP] eval();

2005-10-30 Thread John Taylor-Johnston
$contents = "arial,helvetica; font-weight: bold;\">About the Project "; echo eval($contents); ?> eval() expects PHP code, not HTML with embedded PHP code. Try this (untested): eval( " ?> $contents Scary. But it works. Shouldn't that error because of the unexpected ?> and example? John --

Re: [PHP] eval();

2005-10-30 Thread Jasper Bryant-Greene
On Sun, 2005-10-30 at 21:16 -0500, John Taylor-Johnston wrote: > I need to generate embedded php within in a mysql record. $contents is > the actual contents of that record. > > $contents = " arial,helvetica; font-weight: bold;\">About the Project > "; > echo eval($contents); > ?> > > I get thi

[PHP] eval();

2005-10-30 Thread John Taylor-Johnston
I need to generate embedded php within in a mysql record. $contents is the actual contents of that record. $contents = "arial,helvetica; font-weight: bold;\">About the Project "; echo eval($contents); ?> I get this error: Parse error: parse error in /var/www/html2/test.php(4) : eval()'d code

Re: [PHP] un-eval()

2005-10-30 Thread Chris Shiflett
John Taylor-Johnston wrote: Does eval() have a synonym? I don't usually like to answer a question with a question, but consider this: eval($code); This produces the following output: red Given this, what was the value of $code? Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy htt

[PHP] un-eval()

2005-10-30 Thread John Taylor-Johnston
Does eval() have a synonym? I store html in a mysql record, extract it into $contents. Under normal circumstances, I have to eval($contents) to get any embedded php code to work. But when I use FCKeditor: http://testesp.flsh.usherb.ca/~johj2201/ramtest.php $contents=''; $oFCKeditor->Value

Re: [PHP] Using Ajax to spit out a php-generated embed tag

2005-10-30 Thread comex
> Can you use AJAX to output an entire php-generated > embed tag into a web page? You could use XMLHttpRequest's responseText property with innerHTML, which is probably easier than using XML. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Using Ajax to spit out a php-generated embed tag

2005-10-30 Thread Graham Anderson
Can you use AJAX to output an entire php-generated embed tag into a web page? something like: height="352" width="216" codebase="http://www.apple.com/qtactivex/ qtplugin.cab"> EOB; header('Content-Type: text/xml'); // ajax only seems to like text/xml header('Content-Length: '.strle

Re: [PHP] Re: Substr by words

2005-10-30 Thread Marcus Bointon
On 30 Oct 2005, at 15:35, Gustavo Narea wrote: I think that trim($matches[0]) will return the whole string with no change. No, it will return the entire matching pattern, not just the sub- matches. I added the trim to remove any leading space, and there will nearly always be a trailing sp

[PHP] Re: Fabforce 4.0.5.6 Beta

2005-10-30 Thread Daniel Bowett
Vizion wrote: I am trying to run Fabforce DBDesigner 4.0.5.6 Beta on: win xp pro Version 2002 Service Pack 2 PHP 5.0.5 Mysql server 5.0.13 installed from 5.0.13-rc-win32.zip and as Fabforce have closed their forum due to hacker problems I am hoping someopne here might have some idea how to solv

[PHP] Fabforce 4.0.5.6 Beta

2005-10-30 Thread Vizion
I am trying to run Fabforce DBDesigner 4.0.5.6 Beta on: win xp pro Version 2002 Service Pack 2 PHP 5.0.5 Mysql server 5.0.13 installed from 5.0.13-rc-win32.zip and as Fabforce have closed their forum due to hacker problems I am hoping someopne here might have some idea how to solve a problem. I

Re: [PHP] Re: Substr by words

2005-10-30 Thread Gustavo Narea
Other mistake in my last script. Gustavo Narea wrote: $MyOriginalString = "This is my original string.\nWhat do you think about this script?"; $MaxWords = 6; // How many words are needed? $replacement = preg_match("/^(\W*\b\w+\b){1,$MaxWords}/", '', $MyOriginalString); $result = substr( $MyOr

Re: [PHP] Re: Substr by words

2005-10-30 Thread Gustavo Narea
Hello. Marcus Bointon wrote: On 30 Oct 2005, at 06:22, Gustavo Narea wrote: You could get the regex to do the search and the extraction in one go: $MyOriginalString = "This is my original string.\nWhat do you think about this script?"; $MaxWords = 6; // How many words are needed? $matches =

Re: [PHP] php not activated

2005-10-30 Thread Marcus Bointon
On 30 Oct 2005, at 14:13, John Taylor-Johnston wrote: echo $contents; PHP doesn't now that it's PHP - it just treats it as text. You can tell it to run it as PHP explicitly using: eval($contents); Eval is usually worth avoiding, but it will do what you ask. Your display function could be

[PHP] php not activated

2005-10-30 Thread John Taylor-Johnston
I have some html + php stored in a mysql record. But when I echo the contents: $mydata->HTML=""; the php is not activated; rather I see in my html source. It worked before, I thought. P.S. is there a better way to use this function? John snip- display(); echo $contents; f

Re: [PHP] Re: Substr by words

2005-10-30 Thread Marcus Bointon
On 30 Oct 2005, at 06:22, Gustavo Narea wrote: $replacement = ereg_replace ("^([[:space:]]*[^[:space:][:cntrl:]]+) {1,$MaxWords}", "",$MyOriginalString); echo substr( $MyOriginalString, 0, ($replacement) ? -strlen ($replacement) : strlen($MyOriginalString)); You could get the regex to do th

Re: [PHP] [DONE] Substr by words

2005-10-30 Thread Marcus Bointon
On 29 Oct 2005, at 20:41, Richard Lynch wrote: It was probably replacing *TWO* spaces with one. If so, it should really be in a while loop, because there could be 3 or more spaces in a row, and if the goal is only single-spaced words... I can hardly think of a better application for a regex:

Re: [PHP] Type of form element

2005-10-30 Thread Marcus Bointon
On 29 Oct 2005, at 20:59, Richard Lynch wrote: So you will most likely be using isset($_POST['checkbox_name']) rather than testing for "on" I classify using isset for checking for the existence of array keys to be a bad habit as in some common cases it will not work as you expect, for exam