php-general Digest 31 Mar 2008 04:33:37 -0000 Issue 5377
Topics (messages 272311 through 272323):
Re: new lines in textareas?
272311 by: tedd
272312 by: Paul Scott
272314 by: jeffry s
Re: Google Pagerank script
272313 by: kingzones.gmail.com
Re: APC & FastCGI != upload progress ?
272315 by: steve
Re: preg_replace_callback(), how to pass function argument/param?
272316 by: Casey
272317 by: micky.ambiguism.com
272323 by: Micky Hulse
Re: optimilize web page loading
272318 by: Zoltán Németh
Re: PHP 5 file_get_contents() problems
272319 by: php
LDAP in php
272320 by: pobox.verysmall.org
272321 by: Chris
Re: Quick email address check
272322 by: Chris
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
At 9:26 PM -0700 3/29/08, Mary Anderson wrote:
Hi all,
I have a php script which produces text which is to be displayed
in a textarea. I have the wrap for the text area set to 'hard'. I
need to have newlines inserted in the text.
"\n" and "<br>" don't work. They just get quoted literally in
the text. I suspect I need to use htmlspecialchars , but don't know
what special character to feed it.
Apologies if this should go to an HTML forum. I checked several
archives and did not find anything useful. (They tended to tell me
to put in \n or <br>!)
Thanks
Mary Anderson
Show the code.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On Sun, 2008-03-30 at 12:29 -0400, tedd wrote:
> At 9:26 PM -0700 3/29/08, Mary Anderson wrote:
> >Hi all,
> > I have a php script which produces text which is to be displayed
> >in a textarea. I have the wrap for the text area set to 'hard'. I
> >need to have newlines inserted in the text.
> > "\n" and "<br>" don't work. They just get quoted literally in
> >the text. I suspect I need to use htmlspecialchars , but don't know
> >what special character to feed it.
> >
Only getting to this now, but doesn't nl2br() do what you want?
--Paul
--
------------------------------------------------------------.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za |
:------------------------------------------------------------:
All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
--- End Message ---
--- Begin Message ---
On Mon, Mar 31, 2008 at 12:40 AM, Paul Scott <[EMAIL PROTECTED]> wrote:
>
> On Sun, 2008-03-30 at 12:29 -0400, tedd wrote:
> > At 9:26 PM -0700 3/29/08, Mary Anderson wrote:
> > >Hi all,
> > > I have a php script which produces text which is to be displayed
> > >in a textarea. I have the wrap for the text area set to 'hard'. I
> > >need to have newlines inserted in the text.
> > > "\n" and "<br>" don't work. They just get quoted literally in
> > >the text. I suspect I need to use htmlspecialchars , but don't know
> > >what special character to feed it.
> > >
>
> Only getting to this now, but doesn't nl2br() do what you
> want?<http://www.php.net/unsub.php>
well, i don't think nl2br() is a solution here because nl2br() only replace
the '\n' with
<br/> html tags which is displayed inside the textarea. the textarea will
display a new
line with '\n'..
$str = "hello\nworld";
will display
hello
world
in text area. but
$st = 'hello\nworld'.
will be display as
hello\nworld
just like what TG trying to say..
--- End Message ---
--- Begin Message ---
This is fully working Script...
http://v1.magicbeandip.com/mbd-file/PageRankXor32.zip
Good Luck!!!
On Sun, Mar 30, 2008 at 11:56 AM, Joey <[EMAIL PROTECTED]> wrote:
> Hello All,
>
>
>
> Does anyone have a link to source code for a pagerank script?
>
> I want to provide this to users.
>
>
>
> Thanks!
>
>
>
> Joey
>
>
>
>
>
>
>
>
--
http://www.kingzones.org/
--- End Message ---
--- Begin Message ---
Hmmm... I am working on a PHP daemon for comet style connections...
I'll keep that idea in mind. I guess that using Flash is best solution
at the moment.. at least the only one I have working...
I'm guessing that FastCGI is buffering the upload until complete. PHP
docs might want to document that.
FastCGI is also breaking Apache's deflate module, but that is another issue...
-s
On Wed, Mar 26, 2008 at 6:35 PM, Jim Lucas <[EMAIL PROTECTED]> wrote:
>
> steve wrote:
> > We can get upload progress to work with the APC extension for PHP
> > 5.2.x only on machines that are not using FastCGI. (Apache2.2 if it
> > matters).
> >
> > Does anyone have a suggestion where to look?
> >
> > Will it even be possible?
> >
> > Thanks in advance,
> > -s
> >
>
> I built a work around. It requires you to run a PHP daemon. It handles
> the uploads and passes the information off how ever you want. To a DB,
> to the filesystem. Your choice. From that information, you can create
> a progress meter.
>
> I haven't fleshed out all the bugs, but it seems to work like I want it
> too at least.
>
> Jim Lucas
>
--- End Message ---
--- Begin Message ---
On Sun, Mar 30, 2008 at 1:17 AM, Micky Hulse <[EMAIL PROTECTED]> wrote:
> Hi,
>
> This is probably simple to answer for most of ya'll, but...
>
> preg_replace_callback($f, 'mah_processTags', $text);
>
> Besides the matches, how would I pass function args/param to
> mah_processTags()?
>
> For example, I would like to do something like this:
>
> preg_replace_callback($f, 'mah_processTags($arg1)', $text);
preg_replace_callback($f, 'mah_processTags(\'$0\', $arg1)', $text);
Does this work?
> function mah_processTags($matches, $arg1) { ... }
>
> Is this even possible? I just want to pass-in $arg1 along with the
> matches. :)
>
> Possible?
>
> Many thanks in advance!!!
> Cheers,
> Micky
>
> --
> Wishlist: <http://tinyurl.com/22xonb>
> Switch: <http://browsehappy.com/>
> BCC?: <http://snipurl.com/w6f8>
> My: <http://del.icio.us/mhulse>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
-Casey
--- End Message ---
--- Begin Message ---
Hi Casey! Many thanks for your help! I greatly appreciate it. :)
>> preg_replace_callback($f, 'mah_processTags($arg1)', $text);
> preg_replace_callback($f, 'mah_processTags(\'$0\', $arg1)', $text);
> Does this work?
Ah, interesting... Thanks for the example code... I am at work now, but
will try that as soon as I get home later tonight. Your code examp looks
very promising -- I will let you know how it goes.
A billion thanks!
Cheers,
Micky
--- End Message ---
--- Begin Message ---
Casey wrote:
preg_replace_callback($f, 'mah_processTags(\'$0\', $arg1)', $text);
Does this work?
Awww, does not seem to work. :(
But maybe I need to dink with the code a bit more...
I would like to avoid setting a global here. :D
Thanks for the help Casey! I will let you know if I get it working. I
may just have to think of a different approach here.
Cheers,
Micky
--
Wishlist: <http://tinyurl.com/22xonb>
Switch: <http://browsehappy.com/>
BCC?: <http://snipurl.com/w6f8>
My: <http://del.icio.us/mhulse>
--- End Message ---
--- Begin Message ---
Robert Cummings írta:
On Sat, 2008-03-29 at 10:16 +0100, Zoltán Németh wrote:
One last thing though...
even if this were escaped and even if there were fifty variables
embedded, a good bytecode optimizer (not quite the same as a bytecode
cacher) would optimize the bytecode for caching so that the string is
broken up according to what needs to be interpolated and what does not.
could you tell me more about this bytecode optimizer stuff? how does it
work, how much better/faster is it then APC/EAccelerator/etc?
It really depends on what an optimizer optimizes. TurckMMCache had.has
an optimizer. Zend offers an optimizer too. Optimizer can work in a
number of ways. They may be an explicit part of the bytecode cache
mechanism or possibly plugged as one element in a chain of bytecode
processors... parser -> optmizer -> cacher. I'm not exactly sure how it
works for PHP.
The main difference between a cacher and an optimizer though is that
generally speaking a caher only deals with caching the bytecode. No
processing occurs on the produced bytecode. On the other hand an
optimizer may perform alterates on the bytecodes to enhance speed.
For example... by now most people on the list probably know that:
++$i;
Is faster than:
$i++;
An optmizer might see $i++ and determine that the return value is not
used and thus the operation can be changed from $i++ to ++$i. Smilarly,
the optimizer might encounter the following expression:
$foo = 1 << 8
And reduce the constant expression (1 << 8) to (256). So the expression
essentially becomes:
$foo = 256
Similarly if you take the following expression:
$text = "There was an old man from Nantuckit\n"
."Who's sole possession was a bucket.\n"
."One day with a grin,\n"
."While scratching his chin\n"
."He thought, \"I think I'll build a rocket.\"\n";
This could be optimized by removing concatenation operations and
producing a single unified string within the bytecode.
These are just basic optimizations obviously. Optimization is not a new
thing, if you've ever used the -O flags when building a C program then
you know that C compilers can also perform optimizations.
Cheers,
Rob.
thanks, I get the concept
greets,
Zoltán Németh
--- End Message ---
--- Begin Message ---
Thanks Greg...I am aware of the allow_url_fopen/allow_url_include
relationship.
Your suggestion to look into curl was implemented and there still seems to
be something else afoot.
I created a simple set of curl functions which just printed a remote url to
the browser window. This tested well on an alternate test site which has PHP
5 running.
However back on the hosting client I'm having problems with, curl throws the
following error message:
CURLE_COULDNT_RESOLVE_HOST (6)
Couldn't resolve host. The given remote host was not resolved.
A second test script, uses the popular PayPal Instant Payment Notification
scheme which opens up a socket connection with the paypal server. Even this
method of remote communition was defeated.
So I'm lead to believe there is some other PHP configuration (or server
configuration) which is stopping PHP from connecting with remove services.
Chris
""Greg Bowser"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> The actual setting is allow_url_fopen. allow_url_include controls whether
> or not you can use a remote URL as an include (however, if allow_url_fopen
> is off, then allow_url_include will also be off.)
>
> The short answer to your question is: yes, there is a way. Several ways,
> in
> fact. You could use curl, or you could use an Http client written in php.
> The latter involves using either the socket_ or the fsocket functions.
>
>
> * http://scripts.incutio.com/httpclient/
>
> On Tue, Mar 18, 2008 at 10:11 AM, Chris <[EMAIL PROTECTED]> wrote:
>
>> I've encountered a situation where under PHP 5 the file_get_contents()
>> function will not work properly (actually not at all) if the php.ini
>> Filesystem configuration parameter, allow_url_include is set to OFF.
>> According to the PHP documentation allow_url_include is intended to
>> limiting PHP from accessing scripts on other servers.
>>
>> I have read posts that suggest setting allow_url_include to ON as
>> a solution. Well that's great if you have the ability to modify your
>> php.ini. But what if you have an account on a shared hosting system
>> and the hosting company will NOT make the requested change?
>>
>> Is there a work around to this or how would one access remote web
>> services
>> if allow_url_include is OFF. This looks like a huge problem since many
>> services, like PayPal's IPN and Google maps geocoding, rely on
>> communication
>> with their servers.
>>
>> Thanks,
>> Chris
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
--- End Message ---
--- Begin Message ---
As LDAP can have SQL back-end (I saw an example with PostgreSQL) - is it
a very wild idea to implement (a simple) LDAP server in php?
We have all the address data already in PostgreSQL and a php application
managing all of it.
I am thinking of simple uses, such as providing LDAP address books to
Thunderbird/Squirrelmail users.
For instance, is it too wild to think of Apache/php listening on the
LDAP port (or so), get the request, parse it, get the data from
PostgreSQL and send it back to the LDAP client?
Iv
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
As LDAP can have SQL back-end (I saw an example with PostgreSQL) - is it
a very wild idea to implement (a simple) LDAP server in php?
We have all the address data already in PostgreSQL and a php application
managing all of it.
I am thinking of simple uses, such as providing LDAP address books to
Thunderbird/Squirrelmail users.
For instance, is it too wild to think of Apache/php listening on the
LDAP port (or so), get the request, parse it, get the data from
PostgreSQL and send it back to the LDAP client?
If ldap can already use a database backend, just use the normal ldap_*
functions to do all of the work, don't re-invent it all.
http://www.php.net/ldap
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
I have used this to good effect
function isEmail($email)
{
if
(eregi("^[a-z0-9]+([-_\.]?[a-z0-9])[EMAIL
PROTECTED]([-_\.]?[a-z0-9])+\.[a-z]{2,4}",$email))
{
return TRUE;
} else {
return FALSE;
}
}//end function
I often have a '+' in my email address (which is perfectly valid) and
it really annoys me when a site refuses to accept it.
Didn't notice this before but that regex ignores valid TLD's too like
.museum, .travel .. Probably not that common but certainly valid.
http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---