php-general Digest 30 Oct 2005 15:36:19 -0000 Issue 3766

2005-10-30 Thread php-general-digest-help
php-general Digest 30 Oct 2005 15:36:19 - Issue 3766 Topics (messages 224837 through 224845): Re: Substr by words 224837 by: Gustavo Narea 224838 by: Gustavo Narea 224839 by: Gustavo Narea 224842 by: Marcus Bointon 224845 by: Gustavo Narea Re: Type

[PHP] Re: Substr by words

2005-10-30 Thread Gustavo Narea
My script will fail if the amount of words in $MyOriginalString is less than $MaxWords. So, this is the new suggestion: ?php $MyOriginalString = This is my original string.\nWhat do you think about this script?; $MaxWords = 50; // How many words are needed? $replacement = ereg_replace

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

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] 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 the

[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=input type=text size=40 value=?php if($searchenquiry) echo stripslashes(htmlspecialchars($searchenquiry)); ? name=searchenquiry /; the php is not activated; rather I see ?php ... ? in my html

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

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] Re: Substr by words

2005-10-30 Thread Gustavo Narea
Other mistake in my last script. Gustavo Narea wrote: ?php $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(

[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

[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

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

[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: ?php // simple no frills qt embed $qtembed = EOB item ?xml version=1.0 encoding=UTF-8? object classid=clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B height=352 width=216

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] 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='input type=text

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

[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. ?php $contents = div class=\indent\ style=\font-size: 16px; font-family: arial,helvetica; font-weight: bold;\About the Project/div ?php echo \hello world\; ?; echo eval($contents); ? I

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. ?php $contents = div class=\indent\ style=\font-size: 16px; font-family: arial,helvetica; font-weight: bold;\About the

Re: [PHP] eval();

2005-10-30 Thread John Taylor-Johnston
?php $contents = div class=\indent\ style=\font-size: 16px; font-family: arial,helvetica; font-weight: bold;\About the Project/div ?php echo \hello world\; ?; echo eval($contents); ? eval() expects PHP code, not HTML with embedded PHP code. Try this (untested): eval( ? $contents ?php );

Re: [PHP] eval();

2005-10-30 Thread Jasper Bryant-Greene
On Sun, 2005-10-30 at 21:24 -0500, John Taylor-Johnston wrote: ?php $contents = div class=\indent\ style=\font-size: 16px; font-family: arial,helvetica; font-weight: bold;\About the Project/div ?php echo \hello world\; ?; echo eval($contents); ? eval() expects PHP code, not HTML with

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 value of $code?

Re: [PHP] eval();

2005-10-30 Thread John Taylor-Johnston
eval( ? $contents ?php ); 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

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

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

Re: [PHP] eval();

2005-10-30 Thread Richard Lynch
On Sun, October 30, 2005 8:51 pm, John Taylor-Johnston wrote: eval( ? $contents ?php ); 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

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 habit as in some

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] 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