Re: [PHP] formatting textarea input on output

2003-03-25 Thread CPT John W. Holmes
> i have a textarea in a form which gets inserted into a table in my > database (mySQL). When displaying this text back to the screen, how do > i retain the line breaks etc. that were in the original input? I bet if you searched for "textarea" and "line breaks" you'd of found the nl2br() function.

RE: [PHP] formatting textarea input on output

2003-03-25 Thread daniel
/** * converts line break and spaces to page break * * @access public */ function nlbr($string) { return preg_replace("/(\r\n|\n|\r)/", "\n", $string); } here is one i use , what i'm still trying to work out , its a way

Re: [PHP] formatting textarea input on output

2003-03-25 Thread Charles Kline
I hang my head in shame... yes. As a matter of fact, I did on my second skim through my PHP ref. manual... thanks for the pointer just the same. - charles On Tuesday, March 25, 2003, at 05:38 PM, CPT John W. Holmes wrote: i have a textarea in a form which gets inserted into a table in my databa

RE: [PHP] flush not flushing?

2003-03-25 Thread Bryan Koschmann - GKT
Daniel- I just tried this, didn't seem to make a difference. Thanks for the reply! Bryan On Tue, 25 Mar 2003, daniel wrote: |hi , i have had similar issues its worked by doing a ob_flush before flush |then u want a sleep statement so maybe try | |ob_flush(); |flush(); |sleep(2); | |??

[PHP] Object Aggregation - does anyone have experience with it?

2003-03-25 Thread Christopher E. Welton
I am using php 4.2.2 with Apache 2.0 on Red Hat 8.0 When I attempt to dynamically aggregate two objects using the aggregate() call, I get the following message: Fatal error: Call to undefined function: aggregate() the man page for aggregate() lists the following info: aggregate (PHP 4 >= 4.2.0)

Re: [PHP] formatting textarea input on output

2003-03-25 Thread CPT John W. Holmes
> /** > * converts line break and spaces to page break > * > * @access public > */ > > function nlbr($string) { > return preg_replace("/(\r\n|\n|\r)/", "\n", $string); > } ummm www.php.net/nl2br() ?? Start a new thread for your question, don't hijack someone else's thread. ---John H

[PHP] foreach statement

2003-03-25 Thread shaun
how do i surpress an error message for a foreach statement? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] foreach statement

2003-03-25 Thread Richard Whitney
Get rid of the error Quoting shaun <[EMAIL PROTECTED]>: ### how do i surpress an error message for a foreach statement? ### ### ### ### -- ### PHP General Mailing List (http://www.php.net/) ### To unsubscribe, visit: http://www.php.net/unsub.php ### ### -- Richard Whitney * Transcend D

RE: [PHP] foreach statement

2003-03-25 Thread Jennifer Goodie
You don't. >From http://www.php.net/manual/en/control-structures.foreach.php "Note: foreach does not support the ability to suppress error messages using '@'." You should check the validity of your argument before passing it to foreach if(is_array($array)){ foreach($array as $key=>$val){

RE: [PHP] formatting textarea input on output

2003-03-25 Thread daniel
umm nl2br doesnt work most the time , "nl2br -- Inserts HTML line breaks before all newlines in a string " sorry to give a wrong example this is for splitting your content into paragraphs obviously where there is a break in the content like so efwojeiowerjwetwpjwewoj eioptejoiejiojtei it won

Re: [PHP] foreach statement

2003-03-25 Thread Jim Lucas
i have this little function that I wrote to do just that. function alternate(&$a, $b) { return($a = ($a?$a:$b) ); } just call it like this alternate($myArr, array()); foreach($myArr AS $k => $v) { do something here } Jim - Original Message - From: "Jennifer Goodie" <[EMAIL PROTECTED

[PHP] can i ask?

2003-03-25 Thread M.N. Ikhwan S.
ScriptAlias /php/ "c:/php/" AddType application/x-httpd-php .php Action application/x-httpd-php "/php/php.exe" i'm using apache 2.0 as my web server. and i'm about to ask these question, where am i going to put these three lines? under what line in httpd.conf? ikhwan

RE: [PHP] Disabling output control when using "ob_start"

2003-03-25 Thread John W. Holmes
> Is there a way to disable the call back function set by "ob_start"? > I tried: > ob_end_flush(); > ob_end_clean(); > ob_implicit_flush(true); > > Nothing seams to work. I can't detect the call back function and I can't > prevent it either. The call back function is called no matter what! > > Mi

RE: [PHP] variables??

2003-03-25 Thread John W. Holmes
> It is considered more secure to declare the variable explicitly. > > $var = $_GET["var"]; Ummm... that's the same result as having register_globals on (basically). You're not helping anything and it's certainly not any more "secure". ---John W. Holmes... PHP Architect - A monthly magazine for

RE: [PHP] Default setting garbage

2003-03-25 Thread John W. Holmes
> Why is it that when I send call this function: > function GetNextDate($whichfriday, $month = "", $frequency = 1, $basedate > = "") > > with this line: > GetNextDate("4", "2003-03", "5"); > > that $frequency ends up ""? Whether I set it myself when I call the > function, or I leave it blank and

[PHP] How to prevent execution of PHP in specific directory.

2003-03-25 Thread Heo, Jungsu
Hello, there. (Sorry to bother you if this kind of message already posted, but I cannot find the answer) My system hosts customers using Apache Virtual Host. If a customer has www.a.com, image.a.com , DocumentRoot of http://www.a.com is /usr/local/apache/htdocs/ and http://image.a.com is /home/

RE: [PHP] Changing variables in a text file

2003-03-25 Thread John W. Holmes
> I have a text file with a series of project variables. > > For example > $var1=""; > $var2=""; > $template="blue"; > $anothervar="foo"; > > Let say I need to change $template="blue"; to $template="red";. How can I > do > that keeping the rest of the file intact? You have to write the w

RE: [PHP] Benchmarking

2003-03-25 Thread John W. Holmes
> I've been making a web ap PHP based, but I fear the number of arrays it > has > is too big. Is there any way to benchmark a script, or are there any > recomendations or standards about how much time execution takes and how > many > resources it takes? The benchmarking is just a matter of subtrac

Re: [PHP] variables??

2003-03-25 Thread Leif K-Brooks
No, it is more secure. The problem with register_globals is that ALL variables become global - not just the ones you want to be. Example: if(something) $authorized = true; if($authorized){ ...do something requiring security... } A hacker could easily go to script.php?authorized=1, and gain acce

RE: [PHP] Difference between months

2003-03-25 Thread John W. Holmes
> How do I subtract the difference of months between two dates? > > For instance, if one date is 2003-12 and the other is 2002-08, I need to > know that there are 16 months between them. If one date is 2003-04 and the > other is 2003-01, I need to know that there are 3 months between them. How > c

RE: [PHP] variables??

2003-03-25 Thread John W. Holmes
Okay, true. But they key here is the "act accordingly", meaning you sanitize and validate the variable before using it anywhere. Sometimes the way it's represented is that just using $_GET['var'] is going to make things more secure than using $var, which is not the case unless you know what exact

RE: [PHP] Mac IE File download problem - any solutions?

2003-03-25 Thread Daniel Leighton
Actually, I think you may have misunderstood. On Mozilla (Mac), Netscape (Mac) and Safari the script works exactly as I have intended: sending the "Content-Type: application/octet-stream" header causes the file to download; sending the "Content-Type: video/quicktime" causes the file to be playe

[PHP] imap_open Error

2003-03-25 Thread Brian Mitchell
I'm using the following code to try to open a stream to access my email: $user_id = "userid"; $password = "password"; $inbox = @imap_open("{mail.host.com:143}INBOX", $user_id, $password); I've verified the correct username, password, hostname combination by setting up an IMAP account thr

[PHP] Re: NewB Q on Arrays.

2003-03-25 Thread chris
On Tue, 25 Mar 2003 21:18:48 +1000, Inpho <[EMAIL PROTECTED]> wrote: Hey All, I'm still a newB in php and mysql so I'm asking for your patience up front. i want to get a list of results from an array, which I can do with: $result=mysql_query("select * from mvlogtbl",$db); while ($row=mysql_fet

[PHP] RE: session id

2003-03-25 Thread Uttam
session_start(); should be on the first line in the script. regds, -Original Message- From: Iggy [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 20:08 To: [EMAIL PROTECTED] Subject: session id can somebody tell me why I am getting this: Warning: session_start() [function.session

[PHP] Re: ho to remove an empty space

2003-03-25 Thread chris
On Mon, 24 Mar 2003 22:10:28 -0800, Webdev <[EMAIL PROTECTED]> wrote: somehow when I have try to develop an application where I read five or six values into an individual arrays the array who carries the emails has the email and an additional empty field after the email somehow complex well

[PHP] RE: connecting to mysql db

2003-03-25 Thread Uttam
Yes, It is necessary because script executes & ends for every request. Variables can be made persistent by using cookie/sessions but mysql connection is a resource which can not be saved & restored as session variable. For efficient use of resources, you may use mysql_pconnect() (only when php is

Re: [PHP] NewB Q on Arrays.

2003-03-25 Thread Frappy John
> What i want to be able to do is determine if a certain > user has watched a movie. If you want to check the log to see if a single user has viewed a particular movie, then include the user and movie in the select statement: select uid, mvid from mvlogtbl where uid = $userID and mvid = $movi

[PHP] help with preg_replace please

2003-03-25 Thread Justin French
Hi, Total newbie on reg exps, and even worse with preg!!! I get the following error: Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /usr/local/apache/htdocs/lib/lib_string.inc on line 218 Using this code: $str = preg_replace("!([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])!ei

Re: [PHP] help with preg_replace please

2003-03-25 Thread Jason Wong
On Wednesday 26 March 2003 13:59, Justin French wrote: > Parse error: parse error, expecting `T_VARIABLE' or `'$'' in > /usr/local/apache/htdocs/lib/lib_string.inc on line 218 > > Using this code: > $str = > preg_replace("!([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])!ei", " href=\"{$1}://{$2

Re: [PHP] help with preg_replace please

2003-03-25 Thread Jason Paschal
what that guy said, or use ereg_replace instead of preg_... From: Jason Wong <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [PHP] help with preg_replace please Date: Wed, 26 Mar 2003 14:08:44 +0800 On Wednesday 26 March 2003 13:59, Justin French wrote: > Pa

<    1   2