php-general Digest 28 Mar 2009 04:27:29 -0000 Issue 6036

2009-03-27 Thread php-general-digest-help

php-general Digest 28 Mar 2009 04:27:29 - Issue 6036

Topics (messages 290755 through 290782):

Re: Regex
290755 by: Jesse.Hazen.arvatousa.com

Regex help please
290756 by: Shawn McKenzie
290759 by: haliphax
290762 by: Shawn McKenzie

Re: flushing AJAX scripts
290757 by: jim white
290758 by: Andrea Giammarchi
290760 by: Andrea Giammarchi

Re: utf-8-safe replacement for strtr()?
290761 by: Tom Worster

Re: Multiple cookies on the same computer
290763 by: Ken Watkins
290764 by: Ashley Sheridan
290767 by: Ken Watkins
290779 by: Michael A. Peters

fpdf adding font error
290765 by: Thodoris
290773 by: Tony Marston

Re: php5activescript.dll
290766 by: Jacques Manukyan

Re: Exporting text with chinese characters in CSV
290768 by: Michael Shadle

hierarchies
290769 by: PJ
290770 by: Jason Pruim
290772 by: PJ
290774 by: Jason Pruim
290776 by: Shawn McKenzie

pdflib greek problem
290771 by: Thodoris
290780 by: Michael A. Peters

validating and sanitizing input string encoding
290775 by: Tom Worster

SESSION values show up days later!
290777 by: Mary Anderson
290778 by: Tom Worster
290782 by: Paul M Foster

Sort a multi-dimensional array on a certain key followed by another key
290781 by: TS

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 ---
Jochem,

To be more specific, the error I get when using this regex is No ending
delimiter '/' found

 
 
 
Thanks,
 
Jesse Hazen
-Original Message-
From: Jochem Maas [mailto:joc...@iamjochem.com] 
Sent: Thursday, March 26, 2009 11:45 PM
To: Hazen, Jesse, arvato digital services llc
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] Regex

jesse.ha...@arvatousa.com schreef:
> Hi,
> 
>  
> 
> Brand new to regex. So I have a cli which runs a regex on users input,
> to make sure that only 0-9 and A-Z are accepted. It should strip
> everything else. My problem is that when you press control-Z (on
> Windows; I have not yet tested this on linux, and I will, but I would
> like this to be compatible with both OS's) it loops infinitely saying
> invalid data (because of the next method call, which decides what to
do
> based on your input). So, here is the input code. Is there a way I can
> ensure that control commands are stripped, here?
> 

there is, your control-Z is not a Z at all, and it's only printed as ^Z
so you can see it ... it's actually a non-printing char.

try this regexp for stripping control chars:

/[\x00-\x1f]+/

>  
> 
>  
> 
>  
> 
> public function getSelection() {
> 
>  
> 
> $choice =
> $this->validateChoice(trim(strtoupper(fgets(STDIN;
> 
> return $choice;
> 
>  
> 
> }
> 
>  
> 
> private function validateChoice($choice) {
> 
>  
> 
> $choice =
> ereg_replace("/[^0-9A-Z]/","",$choice);
> 
> return $choice;
> 
>  
> 
> }
> 
>  
> 
>  
> 
>  
> 
> I have tried a ton of different things to try and fix this. Tried
> /\c.|[^0-9A-Z]/, and many variations of \c and the [^0-9A-Z], to no
> avail. I also tried using both preg_replace() as well as
ereg_replace().
> I spent a lot of time on the regex section of the PHP manual, but I am
> not finding anything. Any advise on how to accomplish this?
> 
>  
> 
>  
> 
>  
> 
> Thanks,
> 
>  
> 
> Jesse Hazen
> 
> 

--- End Message ---
--- Begin Message ---
I'm normally OK with regex, especially if I fiddle with it long enough,
however I have fiddled with this one so long that I'm either totally
missing it or it's something simple.  Does it have anything to do with
the backref, or the fact that the value of the backref has a $?  I have:

$out = '
{$sites}


{Site.id}


{/$sites}';

And I want to capture the first {$tag}, everything in between and the
last {$/tag}.  I have tried several things and here is my current regex
that looks like it should work, but doesn't:

preg_match_all('|{\$([^}]+)}(.+)({/\1})|Us', $out, $matches);


Gives:

Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

[3] => Array
(
)

)

-- 
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
On Fri, Mar 27, 2009 at 9:40 AM, Shawn McKenzie  wrote:
> I'm normally OK with regex, especially if I fiddle with it long enough,
> however I have fiddled with this one so long that I'm either totally
> missing it or it's something simple.  Does it have anythi

php-general Digest 27 Mar 2009 14:19:26 -0000 Issue 6035

2009-03-27 Thread php-general-digest-help

php-general Digest 27 Mar 2009 14:19:26 - Issue 6035

Topics (messages 290728 through 290754):

Re: Multiple cookies on the same computer
290728 by: dg
290731 by: Shawn McKenzie
290732 by: Shawn McKenzie
290748 by: Ken Watkins
290750 by: Ken Watkins
290754 by: Shawn McKenzie

Re: flushing AJAX scripts
290729 by: Raymond Irving
290743 by: Andrea Giammarchi

Re: Regex
290730 by: Shawn McKenzie
290736 by: Jochem Maas
290744 by: Bob McConnell
290749 by: Jesse.Hazen.arvatousa.com
290751 by: Jesse.Hazen.arvatousa.com

Re: Limit Local Search to Content
290733 by: George Langley

PHP and making a ZIP file
290734 by: Ron Piggott
290735 by: Chris
290739 by: Ashley Sheridan

WHILE LOOP PROBLEM
290737 by: Andrew Williams
290738 by: Craig Whitmore
290742 by: Arno Kuhl

Exporting text with chinese characters in CSV
290740 by: Ai Leen
290741 by: Ashley Sheridan

php5activescript.dll
290745 by: Robert Johnson

Error printer_open()
290746 by: Gerardo Picotti
290747 by: Bastien Koert
290752 by: Gerardo Picotti
290753 by: Shawn McKenzie

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 Mar 26, 2009, at 7:14 PM, Ken Watkins wrote:

To keep up with their identities, I created a script for each family  
member to run (dad.php, mom.php, etc.), and it sets a cookie on each  
computer and uses sessions so I know who is connecting.


Each family member only uses her/his own page?  Maybe set a unique  
cookie name based on each page?
--- End Message ---
--- Begin Message ---
Ken Watkins wrote:
> Hi all.
> 
> Newbie here.
> 
> I have set up a blog site where my family creates posts and they get emailed 
> to members of the family. To keep up with their identities, I created a 
> script for each family member to run (dad.php, mom.php, etc.), and it sets a 
> cookie on each computer and uses sessions so I know who is connecting. It 
> works great unless I want to share a computer between two users.
> 
> I thought I had a solution: install both Firefox and IE on the same computer 
> and set two different cookies. But this doesn't seem to work. My question is: 
> Is it possible to set one cookie for IE and another for Firefox so that, 
> depending on which browser is used, I can tell who is connecting to the blog? 
> If this is not possible, is there another easy way to do it?
> 
> Thanks for your help.
> 
> - Ken Watkins
> 
> 

Even if you don't need it secure, have a login.  Dad and mom can login
with dad or mom with no password if all you need to do is give them
their own cookie/session.


-- 
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:
> Ken Watkins wrote:
>> Hi all.
>>
>> Newbie here.
>>
>> I have set up a blog site where my family creates posts and they get emailed 
>> to members of the family. To keep up with their identities, I created a 
>> script for each family member to run (dad.php, mom.php, etc.), and it sets a 
>> cookie on each computer and uses sessions so I know who is connecting. It 
>> works great unless I want to share a computer between two users.
>>
>> I thought I had a solution: install both Firefox and IE on the same computer 
>> and set two different cookies. But this doesn't seem to work. My question 
>> is: Is it possible to set one cookie for IE and another for Firefox so that, 
>> depending on which browser is used, I can tell who is connecting to the 
>> blog? If this is not possible, is there another easy way to do it?
>>
>> Thanks for your help.
>>
>> - Ken Watkins
>>
>>
> 
> Even if you don't need it secure, have a login.  Dad and mom can login
> with dad or mom with no password if all you need to do is give them
> their own cookie/session.
> 
> 

Optionally, I just thought that if this was too much for them to
do/remember, they could have their own bookmarks, like "Dad - Yoursite"
(http://www.yoursite.com/index.php?person=dad) and Mom - Yoursite
(http://www.yoursite.com/index.php?person=mom) and set the
session/cookie or whatever you're doing based on $_GET['person'].

I would still opt for the login though, even if not secure.

-- 
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
>>> On 3/26/2009 at 11:12 PM, in message <70.12.30978.2144c...@pb1.pair.com>, 
>>> Shawn McKenzie  wrote:
Shawn McKenzie wrote:
> Ken Watkins wrote:
>> Hi all.
>>
>> Newbie here.
>>
>> I have set up a blog site where my family creates posts and they get emailed 
>> to members of the family. To keep up with their iden