php-general Digest 14 Jun 2009 12:21:21 -0000 Issue 6174

Topics (messages 294001 through 294027):

Re: Periodic Actions in PHP?
        294001 by: Sancar Saran
        294007 by: Colin Guthrie
        294008 by: Phpster
        294010 by: bruce

Re: ezmlm response
        294002 by: Ashley Sheridan

Re: Preventing XSS Attacks
        294003 by: Ashley Sheridan

Re: [Bulk] Re: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI?
        294004 by: Ashley Sheridan

Re: 3d image rotating
        294005 by: Ashley Sheridan
        294006 by: Nitsan Bin-Nun
        294012 by: PJ

Re: truncate a mb-string to a given octet length?
        294009 by: Tom Worster

Re: Same Page, Fundamentally Different Behavior OR is Firefox broken?
        294011 by: Matt Neimeyer

High ID (unique, auto increment) causes slow responses on PHP (MySQL)
        294013 by: דניאל דנון
        294014 by: Nitsan Bin-Nun
        294015 by: Stuart

how to pass a number through href url?
        294016 by: PJ
        294017 by: Stuart
        294020 by: PJ
        294027 by: tedd

preg_replace problem
        294018 by: Al
        294021 by: Shawn McKenzie
        294022 by: Al
        294023 by: Al
        294026 by: Al

Re: [Bulk] Re: [PHP] Re: [Bulk] Re: [PHP] Why [?php while (true) { sleep(5);    
} ?] dies on CLI?
        294019 by: Jean-Pierre Arneodo

Re: socket communication programming
        294024 by: Manuel Lemos
        294025 by: HELP!

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On Saturday 13 June 2009 11:42:49 am Parham Doustdar wrote:
> Hi there,
> I'm going to create a small chat script with PHP. The messages you want
> others to see will be added to a flat file (I.E. TXT file), and read and
> displayed by PHP. However, I want this reading and displaying to be
> periodic. This means that I want PHP to check the file for new lines
> every,say, fifteen seconds. How may I do that? I have been unable to find
> any function that acts like a timer. Thanks!

Please search google daemonized php

Regards

--- End Message ---
--- Begin Message ---
'Twas brillig, and Parham Doustdar at 13/06/09 09:42 did gyre and gimble:
Hi there, I'm going to create a small chat script with PHP. The
messages you want others to see will be added to a flat file (I.E.
TXT file), and read and displayed by PHP. However, I want this
reading and displaying to be periodic. This means that I want PHP to
check the file for new lines every,say, fifteen seconds. How may I do
that? I have been unable to find any function that acts like a timer.

For handling periodic tasks in a web environement, I use a little
persistent object (stored using APC) that has it's "process()" method
called on every request. Internally it knows when it was last run and
will actually only do work in it's process() method if it's not been
called for a while.

When this work is done, the user's request is obviously slowed down
slightly, but not in a noticeable way.

If you don't need something this self contained, then a normal cron job is needed.


All that asside, I'm not sure you're asking the right question. If you've got a chat system, then the client side is presumable a web server. You can't really push information from the server side to the client, so you really need to pull it from the client side. Usually you'd have a javascript timeout that submits an ajax request to the server and displays any new messages to the user. In this case, PHP doesn't need to be timed, the client is pulling periodically so it's the client that sets the timer.

Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


--- End Message ---
--- Begin Message ---


On Jun 13, 2009, at 9:11, Colin Guthrie <gm...@colin.guthr.ie> wrote:

'Twas brillig, and Parham Doustdar at 13/06/09 09:42 did gyre and gimble:
Hi there, I'm going to create a small chat script with PHP. The
messages you want others to see will be added to a flat file (I.E.
TXT file), and read and displayed by PHP. However, I want this
reading and displaying to be periodic. This means that I want PHP to
check the file for new lines every,say, fifteen seconds. How may I do
that? I have been unable to find any function that acts like a timer.
For handling periodic tasks in a web environement, I use a little
persistent object (stored using APC) that has it's "process()" method
called on every request. Internally it knows when it was last run and
will actually only do work in it's process() method if it's not been
called for a while.

When this work is done, the user's request is obviously slowed down
slightly, but not in a noticeable way.

If you don't need something this self contained, then a normal cron job is needed.


All that asside, I'm not sure you're asking the right question. If you've got a chat system, then the client side is presumable a web server. You can't really push information from the server side to the client, so you really need to pull it from the client side. Usually you'd have a javascript timeout that submits an ajax request to the server and displays any new messages to the user. In this case, PHP doesn't need to be timed, the client is pulling periodically so it's the client that sets the timer.

Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
 Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
 Mandriva Linux Contributor [http://www.mandriva.com/]
 PulseAudio Hacker [http://www.pulseaudio.org/]
 Trac Hacker [http://trac.edgewall.org/]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


If the goal was to push data, the OP could investigate the use of a comet server. It holds a long running stream allowing the server to push new data to the client.

Bastien

--- End Message ---
--- Begin Message ---
hi...

is this a php/web based app...
are the users using the chat function via the browser..
if this is a browser/web app, are you looking for a way for the
 php web app to refetch the textfile... i would assume so...

have you figured out a rough architecture/design for your app..
in your design, you're going to need to figure out how to
 accomplish updates to the text file, and when you do, you'll
 also have figured out how to do the reads...

i'm assuming that you don't want a continuously running thread
 for your php/web app.. ie one continuously, never ending loop...
 -so you'll have the user add some text, the app will write this to
  a file..
 the user will either select a refresh kind of btn, or your
 app will have to implement a refresh process, which will then
 fetch new/updated data from your files..
 etc...






-----Original Message-----
From: richard.he...@gmail.com [mailto:richard.he...@gmail.com]on Behalf
Of Richard Heyes
Sent: Saturday, June 13, 2009 2:17 AM
To: Parham Doustdar
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] Periodic Actions in PHP?


Hi,

> I'm going to create a small chat script with PHP. The messages you want
others to see
> will be added to a flat file (I.E. TXT file), and read and displayed by
PHP. However, I want
> this reading and displaying to be periodic. This means that I want PHP to
check the file for
> new lines every,say, fifteen seconds. How may I do that? I have been
unable to find any
> function that acts like a timer.

If you're on Unix then look into using cron. Type the following at the
command prompt to get info on cron:

man 5 crontab

Cron tasks can be scheduled at most once per minute. And if you're
using Windows then I believe the equivalent would be task scheduler,
but I've no idea how you would go about using it.

--
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 6th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
On Thu, 2009-06-11 at 13:39 -0400, Daniel Brown wrote:
> On Thu, Jun 11, 2009 at 13:24, Mika Pohjola<pohjola.m...@gmail.com> wrote:
> > It could be arti...@bluemusicgroup.com or m...@bluemusicgroup.com
> >
> > Please, remove. Thanks.
> 
>     Mika,
> 
>     You will need to do this yourself at http://php.net/mailinglists.
> If it's a different address forwarding to your primary that is
> subscribed to the list, you will have to enter that address in the
> (un)subscribe field.
> 
> -- 
> </Daniel P. Brown>
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW10000
> 
Maybe the instructions for unsubscribing should be on the bottom of
every footer from the list, as this thing seems to come up once a week!

Thanks
Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On Thu, 2009-06-11 at 18:27 +0200, Jan G.B. wrote:
> 2009/6/11 HallMarc Websites <m...@hallmarcwebsites.com>
> 
> >
> >
> > > -----Original Message-----
> > > From: tedd [mailto:tedd.sperl...@gmail.com]
> > > Sent: Thursday, June 11, 2009 9:28 AM
> > > To: PHP-General List
> > > Subject: Re: [PHP] Preventing XSS Attacks
> > >
> > > At 7:08 PM +0100 6/10/09, Ashley Sheridan wrote:
> > > >
> > > >So something like this would be acceptable?:
> > > >
> > > >$searchTerms = (isset($_REQUEST['q']))?$_REQUEST['q']:'';
> > > >$searchTerms = htmlentities($searchTerms);
> > > >$dbSearchTerms = mysql_real_escape_string($searchTerms);
> > > >
> > > >Giving me two variables, one for display output to user, the other for
> > > >use in the database?
> > > >
> > > >Thanks
> > > >Ash
> > >
> > > Ash:
> > >
> > > I wouldn't use $_REQUEST.  If you know the request method then use it.
> > >
> > > There can be problems using $_REQUEST.
> > >
> > > Cheers,
> > >
> > > tedd
> > >
> > > --
> > > -------
> > > http://sperling.com  http://ancientstones.com  http://earthstones.com
> > >
> >
> > I agree with tedd whole heartedly and I want to repeat the importance of
> > protecting the data coming back from the db as well by using
> > safeEscapeString in your queries and again the reason for this is to
> > prevent
> > malicious code from being executed.
> >
> > As far as CSRF/XSRF take a read here
> > http://shiflett.org/articles/cross-site-request-forgeries
> >
> > [Marc Hall - HallMarc Websites - http://www.hallmarcwebsites.com
> > 610.446.3346]
> >
> >
> 
> I'd recommend that you *always* use ENT_QUOTES as the second parameter on
> htmlentities or htmlspecialchars. Otherwise a single ' will not be escaped,
> which may be evil.
> 
> Also be sure that you don't code a possibility to include local or even
> remote files: It's so easy to Inject code into logfiles.
> include('whatever'.$_REQUEST['var'].'.whatever') is not a sufficient
> protection.
> 
> Also, like someone already mentioned, *always* prefer _POST over _REQUEST,
> when dealing with a FORM with method POST!
> 
> Regards

In this case I'm expecting input from both forms and links, so have to
use $_REQUEST, really. As far as I can tell, $_REQUEST is no less safe
than any of the others, as they are all getting their data from the
user, so it's all unsafe until validated/cleaned.

Thanks for the ENT_QUOTES thing, I really haven't had my head screwed on
the last few days!

Thanks
Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On Thu, 2009-06-11 at 20:52 +0200, Jean-Pierre Arneodo wrote:
> Ashley Sheridan a écrit :
> > On Thu, 2009-06-11 at 10:47 +0000, Jean-Pierre Arneodo wrote:
> >   
> >> Hi!
> >> I'm stuck.
> >> I don't understand why the php CLI dies after 3 hours in my script.
> >> Any idea to solve?
> >> Thanks
> >>
> >>
> >> PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr  7 2009 
> >> 20:06:36)
> >> Linux ubuntu  2.6.24-19-server #1 SMP Wed Jun 18 14:44:47 UTC 2008 x86_64 
> >> GNU/Linux
> >>
> >> Conf [php.ini]
> >> max_execution_time=0
> >>
> >> <?php
> >> while (true) {
> >>         sleep(5);
> >> }
> >> ?>
> >>
> >>
> >>       
> >>     
> > The while loop will continue executing until its condition is false. As
> > you've got a boolean true as the condition, it will never end.
> >
> > Thanks
> > Ash
> > www.ashleysheridan.co.uk
> >   
> I don't want to stop, but the process dies.
> 
> I've tried the same loop with bash interpretor.
> Same result, it seems to be a ubuntu problem, not a php problem.
> 
> Thanks
> 
> 
> 
Why do you want the process to continue indefinitely? Is it for a daemon
of some kind?

Thanks
Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On Fri, 2009-06-12 at 11:55 +0300, דניאל דנון wrote:
> Hello.
> 
> I'm looking for way to rotate normal images, but not x/y, but with Z also.
> I get a source image (png, jpg, gif...) and I want to rotate it. assuming
> the "depth" of the image is 1 pixel for example...
> 
> I'm looking for a way to do it without using imagemagick - only GD. I know
> it might be slower, but its need to run on a server without imagemagick.
> 
> I've searched information about it, also in PEAR, but I couldn't find
> anything that takes a normal image and rotate it..
> 
> Thanks, Daniel
> 
Are you meaning like rotate it so that at 90° it will appear as a
pixel-wide line on the image?

Thanks
Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
He treats the image as width, height and 1 pixel of depth.

It should not be a problem as long as you finished Kita Yud Bet with 5
points of math (trigo & vectors) ;)

Good luck!

On Sat, Jun 13, 2009 at 1:44 PM, Ashley Sheridan
<a...@ashleysheridan.co.uk>wrote:

> On Fri, 2009-06-12 at 11:55 +0300, דניאל דנון wrote:
> > Hello.
> >
> > I'm looking for way to rotate normal images, but not x/y, but with Z
> also.
> > I get a source image (png, jpg, gif...) and I want to rotate it. assuming
> > the "depth" of the image is 1 pixel for example...
> >
> > I'm looking for a way to do it without using imagemagick - only GD. I
> know
> > it might be slower, but its need to run on a server without imagemagick.
> >
> > I've searched information about it, also in PEAR, but I couldn't find
> > anything that takes a normal image and rotate it..
> >
> > Thanks, Daniel
> >
> Are you meaning like rotate it so that at 90° it will appear as a
> pixel-wide line on the image?
>
> Thanks
> Ash
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
דניאל דנון wrote:
> Hello.
>
> I'm looking for way to rotate normal images, but not x/y, but with Z also.
> I get a source image (png, jpg, gif...) and I want to rotate it. assuming
> the "depth" of the image is 1 pixel for example...
>
> I'm looking for a way to do it without using imagemagick - only GD. I know
> it might be slower, but its need to run on a server without imagemagick.
>
> I've searched information about it, also in PEAR, but I couldn't find
> anything that takes a normal image and rotate it..
>
> Thanks, Daniel
>
>   
Hi Daniel,
I had the same question a short while ago and the only answer I could
find was to redo the image with either gimp or PhotoShop an save it as
png 8 with transparency. The only downside is that this seems to leave
the angled frame (if you use one) a bit scuzzy; but you dont need Z. The
other downside is that you can't dynamically rotate the image. Of
course, I am assuming that by "rotate" you mean turn it at an angle and
not "replace by other images".
HTH
Phil

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-------------------------------------------------------------
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


--- End Message ---
--- Begin Message ---
eddie,

you were quite right and i was wrong.

after discovering that the longest utf8 varchar column that mysql will allow
is varchar(333), i did some tests. on a varchar(255) column, mysql allows
strings with up to 255 utf8 characters to be inserted. and it truncates at
255 characters observing utf8 character sequences.

now i have to go back to the script that convinced me otherwise and figure
out what i misunderstood in it.

section 10.4.1 of the manual could be explicit about it. when i read it i
got the clear impression the parameter referred to octets.


On 6/12/09 1:22 PM, "Tom Worster" <f...@thefsb.org> wrote:

> On 6/12/09 11:52 AM, "Eddie Drapkin" <oorza...@gmail.com> wrote:
> 
>> Correct me if I'm wrong, but should varchar 255 with a utf8 character set
>> mean 
>> 255 unicode characters, not octets?
> 
> in mysql, the length refers to the storage space of the string, not the
> decoded character count. i don't know about other dbms.
> 
> 
>> On Fri, Jun 12, 2009 at 11:50 AM, Tom Worster <f...@thefsb.org> wrote:
>> say a table in the db has a varchar(255) column, 255 being the max number of
>>> octets of strings that can go in the column. now say the php script very
>>> occasionally has to deal with utf8 input strings with octet length > 255 --
>>> it needs to select rows matching the input string or insert the input
>>> string.
>>> 
>>> so what i think i need is a function to truncate a utf8 string to the
>>> longest valid utf8 string that has octet length <= 255.
>>> 
>>> is this what mb_strcut() is for? i'm having a hard time understanding the
>>> man page for that function.



--- End Message ---
--- Begin Message ---
I'd have to check...

But am I to understand that no-cache works with pre-caching? I always
assumed it basically meant "when you get this page, don't keep it for
next time"?

Thanks!

On Fri, Jun 12, 2009 at 2:04 AM, Manuel C.<hippopotam...@gmail.com> wrote:
> Matt Neimeyer a écrit :
>>
>> I'm at a complete loss... So I'm hoping someone can point me in the
>> right direction to even start looking.
>>
>> We have an application written in PHP that lets users send out emails.
>> The basic process is as follows.
>>
>> 1. Go to "start" screen. (This resets anything currently in process
>> for the current logged in user)
>> 2. Upload email addresses and other info (Names, etc)
>> 3. Build Email
>> 4. Send
>>
>> In Step 3 the user can click a "Live Preview" button to see what the
>> email will look like with the merged data.
>>
>> Here's the problem,  this works fine in all versions of IE, versions
>> 1.5 or less of FireFox and versions 3 or less of Safari. However,
>> starting in FireFox 2, and now Safari 4, when you get to step four OR
>> click the live preview button in step three there is no more data in
>> the merge. In those browsers the system is acting like the end user
>> went BACK to the start page (in another window?) and reinitialized all
>> the data.
>>
>> I immediately thought it might be pre-fetching so I tried using the
>> system before and after toggling the network.prefetch-next setting in
>> about:config with FireFox 2.0.0.20 and restarting the browser. No
>> luck. So I added code to my reset function to email me the output of
>> phpinfo() when the reset function is called. Using IE I get 1
>> notification. Using FF I get two notifications. This reinforces my
>> theory that FireFox is prefetching the menu item to start a new
>> mailing (just an <a> link...) from the top of the composer page. Even
>> still... I've disabled prefetch so it SHOULDN'T even be considering
>> those links right? I've also tried adding artificial
>> "?now=<timestamp>" fakes to the end of all menu links since I read
>> somewhere (don't remember where) that FireFox only prefetches pages
>> with no query section in the address.
>>
>> Has anyone run into this behavior before? Any recommendations on how
>> to stop it? Preferably from the server with code of some sort...
>>
>> Thanks in advance.
>>
>> Matt
>>
>
>
> Hi Matt,
>
> Have you tried to put this two lines in the HEAD section of your HTML pages
> :
>        <META http-equiv="Cache-Control" content="no-cache">
>        <META http-equiv="Pragma" content="no-cache">
>
> Hope it helps you.
>
> BR
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
 I've built a certain system where every time new user enters it creates a
"guest row" on "guests" table. he also gets an identifying cookie.

The table contains several fields, one of them is ID which is auto increment
and unique

When he does a certain action it gets recorded in the "done_action" table
with several fields on it, one of them is "guest_id" and his ID on it.


Problem is the guests table has about 30,000 rows (which means ID is high).

 I was wondering whether I should somehow change how the system works.

I've thought about couple of options

A weekly "cleanup" job. opens a table called "guests_tmp", *copies* all data
from guests to guests_tmp.

every row it copies it also changes the ID on the table done_action.

What do you  think?


-- 
Use ROT26 for best security

--- End Message ---
--- Begin Message ---
Just use SERIAL id and you will be good ;) (that's an alias for something
like BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY)

It shouldn't bother you as long as it works.

On Sat, Jun 13, 2009 at 9:16 PM, דניאל דנון <danondan...@gmail.com> wrote:

>  I've built a certain system where every time new user enters it creates a
> "guest row" on "guests" table. he also gets an identifying cookie.
>
> The table contains several fields, one of them is ID which is auto
> increment
> and unique
>
> When he does a certain action it gets recorded in the "done_action" table
> with several fields on it, one of them is "guest_id" and his ID on it.
>
>
> Problem is the guests table has about 30,000 rows (which means ID is high).
>
>  I was wondering whether I should somehow change how the system works.
>
> I've thought about couple of options
>
> A weekly "cleanup" job. opens a table called "guests_tmp", *copies* all
> data
> from guests to guests_tmp.
>
> every row it copies it also changes the ID on the table done_action.
>
> What do you  think?
>
>
> --
> Use ROT26 for best security
>

--- End Message ---
--- Begin Message ---
2009/6/13 דניאל דנון <danondan...@gmail.com>:
>  I've built a certain system where every time new user enters it creates a
> "guest row" on "guests" table. he also gets an identifying cookie.
>
> The table contains several fields, one of them is ID which is auto increment
> and unique
>
> When he does a certain action it gets recorded in the "done_action" table
> with several fields on it, one of them is "guest_id" and his ID on it.
>
>
> Problem is the guests table has about 30,000 rows (which means ID is high).
>
>  I was wondering whether I should somehow change how the system works.
>
> I've thought about couple of options
>
> A weekly "cleanup" job. opens a table called "guests_tmp", *copies* all data
> from guests to guests_tmp.
>
> every row it copies it also changes the ID on the table done_action.
>
> What do you  think?

I think your problem has nothing to do with high IDs. I have tables in
MySQL with primary key IDs that have recently passed 2 billion and
they're still as responsive as they were with 1 row!!

What specific operations are slow, and are you sure it's the MySQL
query that's being slow and not something in the surrounding code? If
it is the MySQL query what is it and what engine are your tables
using?

-Stuart

-- 
http://stut.net/

--- End Message ---
--- Begin Message ---
I wish to be able to edit db field that is displayed in a page by
calling up another page to handle the editing.
The problem is how to pass the id (number) through an href. In other
words, can the number be included in the uri  and then filter the uri to
leave just the number?
Is something like this at all possible?

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-------------------------------------------------------------
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


--- End Message ---
--- Begin Message ---
2009/6/13 PJ <af.gour...@videotron.ca>:
> I wish to be able to edit db field that is displayed in a page by
> calling up another page to handle the editing.
> The problem is how to pass the id (number) through an href. In other
> words, can the number be included in the uri  and then filter the uri to
> leave just the number?
> Is something like this at all possible?

Oh dear $DEITY. Please find a beginners tutorial to PHP and complete
it before asking questions on this list.

http://www.example.com/index.php?id=12345

will give you

$_GET['id'] == 12345

-Stuart

-- 
http://stut.net/

--- End Message ---
--- Begin Message ---
Stuart wrote:
> 2009/6/13 PJ <af.gour...@videotron.ca>:
>   
>> I wish to be able to edit db field that is displayed in a page by
>> calling up another page to handle the editing.
>> The problem is how to pass the id (number) through an href. In other
>> words, can the number be included in the uri  and then filter the uri to
>> leave just the number?
>> Is something like this at all possible?
>>     
>
> Oh dear $DEITY. Please find a beginners tutorial to PHP and complete
> it before asking questions on this list.
>
> http://www.example.com/index.php?id=12345
>
> will give you
>
> $_GET['id'] == 12345
>
> -Stuart
>
> Thank you, Stuart.  ;-) 


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-------------------------------------------------------------
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


--- End Message ---
--- Begin Message ---
At 3:36 PM -0400 6/13/09, PJ wrote:
I wish to be able to edit db field that is displayed in a page by
calling up another page to handle the editing.
The problem is how to pass the id (number) through an href. In other
words, can the number be included in the uri  and then filter the uri to
leave just the number?
Is something like this at all possible?

I stopper answering your questions because of questions like this.

Please understand that this question is so trivial that it clearly demonstrates you have no interest in solving problems yourself through even the most cursory glance at the php manuals. Instead, you would rather add to the noise of this list than look. That's unfortunate.

If you're not going to try to help yourself, then why should anyone help you?

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message --- This preg_replace() should simply replace all "&" with "&amp;" unless the value is already "&amp;"

But; if $value is simple a quote character ["] I get "&quote". e.g., "test" => &quote;test&quote;

Search string and replace works as it should in Regex_Coach.

echo $value.'<br />';
$value=preg_replace("%&(?!amp;)%i", "&amp;", $value);
echo $value;

I tried using \x26 for the "&" in the search string; didn't help.

This seems too obvious to be a bug. Using php5.2.9

Al.......

--- End Message ---
--- Begin Message ---
Al wrote:
> This preg_replace() should simply replace all "&" with "&amp;" unless
> the value is already "&amp;"
> 
> But; if $value is simple a quote character ["] I get "&quote". e.g.,
> "test" => &quote;test&quote;
> 
> Search string and replace works as it should in Regex_Coach.
> 
> echo $value.'<br />';
> $value=preg_replace("%&(?!amp;)%i", "&amp;", $value);
> echo $value;
> 
> I tried using \x26 for the "&" in the search string; didn't help.
> 
> This seems too obvious to be a bug. Using php5.2.9
> 
> Al.......

Your code works for me, unless I'm misunderstanding the problem.  With
the following:

$value = "&quote;test&quote;";

I get:

&quote;test&quote;<br />
&amp;quote;test&amp;quote;

-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---


Shawn McKenzie wrote:
Al wrote:
This preg_replace() should simply replace all "&" with "&amp;" unless
the value is already "&amp;"

But; if $value is simple a quote character ["] I get "&quote". e.g.,
"test" => &quote;test&quote;

Search string and replace works as it should in Regex_Coach.

echo $value.'<br />';
$value=preg_replace("%&(?!amp;)%i", "&amp;", $value);
echo $value;

I tried using \x26 for the "&" in the search string; didn't help.

This seems too obvious to be a bug. Using php5.2.9

Al.......

Your code works for me, unless I'm misunderstanding the problem.  With
the following:

$value = "&quote;test&quote;";

I get:

&quote;test&quote;<br />
&amp;quote;test&amp;quote;


I may not have been very clear. Feed it just "test" with the quotes. You should get back, "test" the same as you gave it. Instead, I get back &quote;test&quote;

Like wise, if I give it just a single quote ["] I get back [&quote;]

--- End Message ---
--- Begin Message ---


Shawn McKenzie wrote:
Al wrote:
This preg_replace() should simply replace all "&" with "&amp;" unless
the value is already "&amp;"

But; if $value is simple a quote character ["] I get "&quote". e.g.,
"test" => &quote;test&quote;

Search string and replace works as it should in Regex_Coach.

echo $value.'<br />';
$value=preg_replace("%&(?!amp;)%i", "&amp;", $value);
echo $value;

I tried using \x26 for the "&" in the search string; didn't help.

This seems too obvious to be a bug. Using php5.2.9

Al.......

Your code works for me, unless I'm misunderstanding the problem.  With
the following:

$value = "&quote;test&quote;";

I get:

&quote;test&quote;<br />
&amp;quote;test&amp;quote;


I tried IE8 thinking it could be a weird browser bug. Same error.

--- End Message ---
--- Begin Message ---


Al wrote:
This preg_replace() should simply replace all "&" with "&amp;" unless the value is already "&amp;"

But; if $value is simple a quote character ["] I get "&quote". e.g., "test" => &quote;test&quote;

Search string and replace works as it should in Regex_Coach.

echo $value.'<br />';
$value=preg_replace("%&(?!amp;)%i", "&amp;", $value);
echo $value;

I tried using \x26 for the "&" in the search string; didn't help.

This seems too obvious to be a bug. Using php5.2.9

Al.......

I erred when I keyed this message. The "But,...." should be as, without the "e" on quote. Which is an HTML entity for quote.

But; if $value is simple a quote character ["] I get "&quot". e.g.,
 "test" => &quot;test&quot;

--- End Message ---
--- Begin Message ---
Ashley Sheridan a écrit :
On Thu, 2009-06-11 at 20:52 +0200, Jean-Pierre Arneodo wrote:
Ashley Sheridan a écrit :
On Thu, 2009-06-11 at 10:47 +0000, Jean-Pierre Arneodo wrote:
Hi!
I'm stuck.
I don't understand why the php CLI dies after 3 hours in my script.
Any idea to solve?
Thanks


PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr  7 2009 
20:06:36)
Linux ubuntu  2.6.24-19-server #1 SMP Wed Jun 18 14:44:47 UTC 2008 x86_64 
GNU/Linux

Conf [php.ini]
max_execution_time=0

<?php
while (true) {
        sleep(5);
}
?>


The while loop will continue executing until its condition is false. As
you've got a boolean true as the condition, it will never end.

Thanks
Ash
www.ashleysheridan.co.uk
I don't want to stop, but the process dies.

I've tried the same loop with bash interpretor.
Same result, it seems to be a ubuntu problem, not a php problem.

Thanks



Why do you want the process to continue indefinitely? Is it for a daemon
of some kind?

Thanks
Ash
www.ashleysheridan.co.uk

No, it isn't a daemon, but it does something and wait the end of processing by polling a daemon.

# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 38912
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 38912
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited




--- End Message ---
--- Begin Message ---
Hello,

on 06/12/2009 11:41 AM HELP! said the following:
> hi
> I can not get the stream_get_contents() to work.  it's returning empty.
> If you have a login details "ALOGINPASS 1A" cant you just fwrite($ft,
> "ALOGINPASS 1A"); or do you need to add other things
> 
> 
> what is the meaning of this string" GET / HTTP/1.0\r\nHost:
> www.example.com\r\nAccept <http://www.example.com/r/nAccept>: */*\r\n\r\n"

If that is regular HTTP, why don't you try an HTTP client class that
lets you customize your request parameters like this one?

http://www.phpclasses.org/httpclient

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

--- End Message ---
--- Begin Message ---
Thanks. I need to access remote data via TCP. Connecting to the given
port has been successful but getting acknowledgement from the remote server
after sending the login packet is a problem. Is there anything wrong sending
the login packet in strings? or what is the best way?

I probably think the server is not detecting the end of the login message.
Is there anyway you can add END of message to login package specified.

Thnaks



On Sat, Jun 13, 2009 at 10:28 PM, Manuel Lemos <mle...@acm.org> wrote:

> Hello,
>
> on 06/12/2009 11:41 AM HELP! said the following:
> > hi
> > I can not get the stream_get_contents() to work.  it's returning empty.
> > If you have a login details "ALOGINPASS 1A" cant you just fwrite($ft,
> > "ALOGINPASS 1A"); or do you need to add other things
> >
> >
> > what is the meaning of this string" GET / HTTP/1.0\r\nHost:
> > www.example.com\r\nAccept <http://www.example.com/r/nAccept>:
> */*\r\n\r\n"
>
> If that is regular HTTP, why don't you try an HTTP client class that
> lets you customize your request parameters like this one?
>
> http://www.phpclasses.org/httpclient
>
> --
>
> Regards,
> Manuel Lemos
>
> Find and post PHP jobs
> http://www.phpclasses.org/jobs/
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>



-- 
www.bemycandy.com

--- End Message ---

Reply via email to