[PHP] Re: help for memcached Segmentation fault

2011-06-27 Thread xucheng
sorry, the right $config['memcached'] variable is

$config['memcached']=array(array('host'=>'localhost', port=11211,
persistent=1,weight=1));

2011/6/28 xucheng :
> Hi all,
>       I wrap pecl-memcache into a class used as a sigleton class .
> the code is :
> ==code===
>       class Mem{
>
>        private static $_instance = null ;//singlton object instance
>
>        private function __construct(){
>
>                        global $config ;
>                        $servers = $config['memcached'] ;
>                        $mem = new Memcache ;
>                        foreach($servers as $server){
>                                $mem->addServer($server['host'],
> $server['port'], intval($server['persistent']) > 0 ? 1 : 0,
> intval($server['weight']) > 0 ? intval($server['weight']) : 1 ) ;
>                        }
>                        return $mem ;
>
>        }
>
>        private static function getInstance(){
>
>                        if(self::$_instance === null || !(
> self::$_instance instanceof Mem ) ){
>
>                                        self::$_instance = new Mem() ;
>
>                        }
>
>                        return true ;
>
>        }
>
>        public static function get($key){
>
>                        self::getInstance() ;
>                        return self::$_instance->get(md5(strtolower($key))) ;
>
>        }
>
>        public static function set($key, $value, $ttl=0){
>                        self::getInstance() ;
>                        $compress = (is_bool($value) || is_int($value)
> || is_float($value)) ? false : MEMCACHE_COMPRESSED ;
>                        return
> self::$_instance->set(md5(strtolower($key)), $value, $compress, $ttl)
> ;
>
>        }
>
>        public static function rm($key){
>                        self::getInstance() ;
>                        return
> self::$_instance->delete(md5(strtolower($key)),0) ;
>        }
> }
>
> ===code==
>
> and $config['memcached'] is an array contains info about the server .
> $config['memcached'] = array('host'=>'localhost', port=11211,
> persistent=1,weight=1) ;
>
> when i run this , i got "Segmentation fault" ! I cannot figure out
> what's the problem . any commet appreciate .
>
> and i used memcached 1.4.5 , and libevent-1.4.13-1
> php 5.2.16
>


[PHP] Re: help with _get error

2011-03-23 Thread Shane Rutter

On 23/03/2011 17:46, Jack wrote:

Hello All,



I'm having a problem with this line of code which worked fine for years:

$l_url2 = ".".$_GET[SERVER_NAME];



Here is the error:

[Wed Mar 23 13:33:49 2011] [error] [client 16.139.201.61] PHP Notice:  Use
of undefined constant SERVER_NAME - assumed 'SERVER_NAME' in
/home//modules/jack.php on line 322



Thanks!

J






You need to put the name of the GET data you want to read in brackets. 
Like so.


$_GET['SERVER_NAME'];

or

$l_url2 = ".".$_GET['SERVER_NAME'];


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



Re: [PHP] Re: Help! Made a boo-boo encrypting credit cards

2011-03-04 Thread David Hutto
Maybe I missed something here, but aren't the cc's held by the
merchant account provider, and just an id by you to recharge(recurring
or once), which can be disputed. I ask because it's been a while since
I had to look at this. So let the OP's question take precedence, and
mine secondary if necessary, if not then I'l move it to another post.

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



Re: [PHP] Re: Help! Made a boo-boo encrypting credit cards

2011-03-04 Thread Richard Quadling
2011/3/4 Nisse Engström :
> On Fri, 11 Feb 2011 14:42:18 -0800, Brian Dunning wrote:
>
>> Hey all -
>>
>> I'm using mcrypt to store credit cards into MySQL. About 90%
>> of them decrypt fine, but about 10% decrypt as nonsense
>> ("b1�\�JEÚU�A���" is a good example). Maybe there is a
>> character that appears in about 10% of my encryptions that's
>> not being encoded properly???
>
> Can you come up with a phony CC number that fails the
> decryption? If so, please post:
>
>  $cc_number
>  binhex($iv)
>  binhex($cc_encrypt)
>  binhex($row['encrypt_iv']))
>  binhex($row['cc_encrypt']))
>
> More below...
>
>> // Encryption is set up at the top of the script:
>> $crypto = mcrypt_module_open('rijndael-256', '', 'ofb', '');
>> $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($crypto), MCRYPT_DEV_RANDOM);
>> $ks = mcrypt_enc_get_key_size($crypto);
>> $key = substr(md5('my_funky_term'), 0, $ks);
>>
>> // When the card number is collected by the form, it's encrypted:
>> $cc_number = addslashes($_POST['cc_number']);
>> mcrypt_generic_init($crypto, $key, $iv);
>> $cc_encrypt = mcrypt_generic($crypto, $cc_number);
>> mcrypt_generic_deinit($crypto);
>>
>> // This is written to the database:
>> $query = "update accounts set cc_encrypt='$cc_encrypt', encrypt_iv='$iv', 
>> other_fields='$other_stuff' where id='$account_id' limit 1";
>> $result = mysql_query($query) or die(mysql_error());
>
> No mysql_real_escape_string()?
>
>> Both the cc_encrypt and encrypt_iv fields are tinytext, latin1_swedish_ci, 
>> MyISAM, MySQL 5.0.91
>
> Why are you using text fields for storing binary data?
> Sounds like this could go horribly wrong for a number
> or reasons.
>
>> In another script, when I retrieve, I first set it up at the top of the 
>> script exactly like step #1 above, then retrieve it like this:
>>
>> mcrypt_generic_init($crypto, $key, $row['encrypt_iv']);
>> $cc_number = trim(mdecrypt_generic($crypto, $row['cc_encrypt']));
>> mcrypt_generic_deinit($crypto);
>
>
> /Nisse
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Considering their is no validation of the credit card number, you
could just use a random string of numbers starting with 99.

According to 
http://en.wikipedia.org/wiki/List_of_Bank_Identification_Numbers#References,
nothing starts with 99.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



[PHP] Re: Help! Made a boo-boo encrypting credit cards

2011-03-04 Thread Nisse Engström
On Fri, 11 Feb 2011 14:42:18 -0800, Brian Dunning wrote:

> Hey all -
> 
> I'm using mcrypt to store credit cards into MySQL. About 90%
> of them decrypt fine, but about 10% decrypt as nonsense
> ("b1�\�JEÚU�A���" is a good example). Maybe there is a
> character that appears in about 10% of my encryptions that's
> not being encoded properly???

Can you come up with a phony CC number that fails the
decryption? If so, please post:

  $cc_number
  binhex($iv)
  binhex($cc_encrypt)
  binhex($row['encrypt_iv']))
  binhex($row['cc_encrypt']))

More below...

> // Encryption is set up at the top of the script:
> $crypto = mcrypt_module_open('rijndael-256', '', 'ofb', '');
> $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($crypto), MCRYPT_DEV_RANDOM);
> $ks = mcrypt_enc_get_key_size($crypto);
> $key = substr(md5('my_funky_term'), 0, $ks);
> 
> // When the card number is collected by the form, it's encrypted:
> $cc_number = addslashes($_POST['cc_number']);
> mcrypt_generic_init($crypto, $key, $iv);
> $cc_encrypt = mcrypt_generic($crypto, $cc_number);
> mcrypt_generic_deinit($crypto);
> 
> // This is written to the database:
> $query = "update accounts set cc_encrypt='$cc_encrypt', encrypt_iv='$iv', 
> other_fields='$other_stuff' where id='$account_id' limit 1";
> $result = mysql_query($query) or die(mysql_error());

No mysql_real_escape_string()?

> Both the cc_encrypt and encrypt_iv fields are tinytext, latin1_swedish_ci, 
> MyISAM, MySQL 5.0.91

Why are you using text fields for storing binary data?
Sounds like this could go horribly wrong for a number
or reasons.

> In another script, when I retrieve, I first set it up at the top of the 
> script exactly like step #1 above, then retrieve it like this:
> 
> mcrypt_generic_init($crypto, $key, $row['encrypt_iv']);
> $cc_number = trim(mdecrypt_generic($crypto, $row['cc_encrypt']));
> mcrypt_generic_deinit($crypto);


/Nisse

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



[PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-18 Thread WalkinRaven

On 01/08/2011 04:55 PM, WalkinRaven wrote:

PHP 5.3 PCRE

Regular Express to match domain names format according to RFC 1034 -
DOMAIN NAMES - CONCEPTS AND FACILITIES

/^
(
[a-z] |
[a-z] (?:[a-z]|[0-9]) |
[a-z] (?:[a-z]|[0-9]|\-){1,61} (?:[a-z]|[0-9]) ) # One label

(?:\.(?1))*+ # More labels
\.? # Root domain name
$/iDx

This rule matches only  and . but not 

I don't know what wrong with it.

Thank you.


Thank you all, and I think I've found the problem: If you don't use 
'Recursive Reference' feature, all will work well.


Detail:
http://ndss.walkinraven.name/2011/01/bug-related-to-recursive-reference-in.html

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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-11 Thread Ashley Sheridan
On Tue, 2011-01-11 at 14:44 -0500, Steve Staples wrote:

> On Tue, 2011-01-11 at 19:00 +, Ashley Sheridan wrote:
> > On Tue, 2011-01-11 at 17:07 +0100, Michelle Konzack wrote:
> > 
> > > Hello Ashley Sheridan,
> > > 
> > > Am 2011-01-08 17:09:27, hacktest Du folgendes herunter:
> > > > Also, each label is checked to ensure it doesn't run over 63 characters,
> > > > and the whole thing isn't over 253 characters. Lastly, each label is
> > > > checked to ensure it doesn't completely consist of digits.
> > > 
> > > Do you know, that there are MANY domains with numbers only?
> > > 
> > > Like <163.com> or <126.net> which are legal names.
> > > 
> > > Oh I should mention that I block ANY mails from this two  domains  since
> > > chinese spamers use it excessively.
> > > 
> > > Thanks, Greetings and nice Day/Evening
> > > Michelle Konzack
> > > 
> > 
> > 
> > I just based the code on the spec.
> > 
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> > 
> > 
> 
> my old (still kinda active but not really) business was/is called
> 990WEBS, and my URL is www.990webs.ca / www.990webs.com  is the url with
> preceeding numerals an issue?  or is this only numerals only?
> 
> it also is my business number :P   990-9327 (WEBS)
> 
> TheStapler.ca is also my domain...   which is a my nickname (last name
> is staples) ANYWAY... way off topic there, was just wodnering about
> the "legality" of my 990webs domains... since i can't think of any other
> domains that start with numbers off the top of my head?
> 
> 
> 
> -- 
> 
> Steve Staples
> Web Application Developer
> 519.258.2333 x8414
> 
> 


Ah, it was my mistake, I misread the spec. It's only the TLD that must
not be completely numeric, so that check can be taken out of the code I
gave earlier.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-11 Thread Steve Staples
On Tue, 2011-01-11 at 19:00 +, Ashley Sheridan wrote:
> On Tue, 2011-01-11 at 17:07 +0100, Michelle Konzack wrote:
> 
> > Hello Ashley Sheridan,
> > 
> > Am 2011-01-08 17:09:27, hacktest Du folgendes herunter:
> > > Also, each label is checked to ensure it doesn't run over 63 characters,
> > > and the whole thing isn't over 253 characters. Lastly, each label is
> > > checked to ensure it doesn't completely consist of digits.
> > 
> > Do you know, that there are MANY domains with numbers only?
> > 
> > Like <163.com> or <126.net> which are legal names.
> > 
> > Oh I should mention that I block ANY mails from this two  domains  since
> > chinese spamers use it excessively.
> > 
> > Thanks, Greetings and nice Day/Evening
> > Michelle Konzack
> > 
> 
> 
> I just based the code on the spec.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 

my old (still kinda active but not really) business was/is called
990WEBS, and my URL is www.990webs.ca / www.990webs.com  is the url with
preceeding numerals an issue?  or is this only numerals only?

it also is my business number :P   990-9327 (WEBS)

TheStapler.ca is also my domain...   which is a my nickname (last name
is staples) ANYWAY... way off topic there, was just wodnering about
the "legality" of my 990webs domains... since i can't think of any other
domains that start with numbers off the top of my head?



-- 

Steve Staples
Web Application Developer
519.258.2333 x8414


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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-11 Thread Per Jessen
Michelle Konzack wrote:

> Hello Ashley Sheridan,
> 
> Am 2011-01-08 17:09:27, hacktest Du folgendes herunter:
>> Also, each label is checked to ensure it doesn't run over 63
>> characters, and the whole thing isn't over 253 characters. Lastly,
>> each label is checked to ensure it doesn't completely consist of
>> digits.
> 
> Do you know, that there are MANY domains with numbers only?
> 

Here is a list of 197 such Swiss domains:

http://public.jessen.ch/files/ch-domains-only-numeric.txt



-- 
Per Jessen, Zürich (0.0°C)


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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-11 Thread Ashley Sheridan
On Tue, 2011-01-11 at 17:07 +0100, Michelle Konzack wrote:

> Hello Ashley Sheridan,
> 
> Am 2011-01-08 17:09:27, hacktest Du folgendes herunter:
> > Also, each label is checked to ensure it doesn't run over 63 characters,
> > and the whole thing isn't over 253 characters. Lastly, each label is
> > checked to ensure it doesn't completely consist of digits.
> 
> Do you know, that there are MANY domains with numbers only?
> 
> Like <163.com> or <126.net> which are legal names.
> 
> Oh I should mention that I block ANY mails from this two  domains  since
> chinese spamers use it excessively.
> 
> Thanks, Greetings and nice Day/Evening
> Michelle Konzack
> 


I just based the code on the spec.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-11 Thread Per Jessen
tedd wrote:

> At 11:54 AM +0100 1/11/11, Per Jessen wrote:
>>tedd wrote:
>>
>>>  At that time, I registered almost 30 names.
>>>  Fortunately, all of my names passed and I was
>>>  permitted to keep them. Unfortunately, all
>>>  browser manufactures (except Safari) negated some
>>>  of the work done by the IDNS WG and as a result
>>>  PUNYCODE is shown instead of the actual
>>>  characters intended.
>>
>>Only for characters that are not part of a national alphabet, I
>>believe?
>>
>>This one works fine:  http://rugbrød.ch/
> 
> Not for me. It translates to:
> 
> xn--rugbrd-fya.ch

Probably a browser issue.  The above works fine with e.g. FF3.6 amd
Konqueror 3.5.

>>Besides, many domain registrars also limit the available characters to
>>those that are part of a national alphabet.
>>
>>
> 
> National alphabet? Never heard of it -- what Nation?

Perhaps not the correct expression, but most non-English languages have
their own alphabets, and despite some countries sharing a language,
what they allow for domain name registration isn't always the same
(ref. Michelle Konzacks earlier posting).
For instance, while 'ï' is used in Dutch, English, and French (I
believe), it is not used in Danish, so it is not allowed in Danish
domain names.  

Here is the list of characters accepted by the German registrar: 

http://www.denic.de/de/domains/internationalized-domain-names/idn-liste.html

The Swiss registrar:

https://www.nic.ch/reg/wcmPage.action?res=/reg/guest/faqs/idn.jsp&plain&lid=de

Austrian registrar:

http://www.nic.at/fileadmin/www.nic.at/documents/idn/idn_at_tld_de.txt

Danish registrar:

https://www.dk-hostmaster.dk/selvbetjening/koeb-dk-domaenenavn/tegnsaet-for-domaenenavne/
(quite limited: a-z, 0-9, hyphen, æ, ø, å, ö, ä, ü, é)

> Are the Greek letters Sigma, Delta, Pi part of this "National
> alphabet"?  

No, only the Greek alphabet which probably is used in Greece and Cyprus
only. 

> In addition, many registrars are clueless about IDNS, Char Sets, and
> what is legal and not. 

Not in my experience.  The various national/European registrars usually
have very strict regulations, and any domain registrar offering his or
her services to the public had better understand them. 


-- 
Per Jessen, Zürich (0.0°C)


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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-11 Thread tedd

At 11:54 AM +0100 1/11/11, Per Jessen wrote:

tedd wrote:


 At that time, I registered almost 30 names.
 Fortunately, all of my names passed and I was
 permitted to keep them. Unfortunately, all
 browser manufactures (except Safari) negated some
 of the work done by the IDNS WG and as a result
 PUNYCODE is shown instead of the actual
 characters intended.


Only for characters that are not part of a national alphabet, I believe?

This one works fine:  http://rugbrød.ch/


Not for me. It translates to:

xn--rugbrd-fya.ch



Besides, many domain registrars also limit the available characters to
those that are part of a national alphabet.


--
Per Jessen, Zürich (0.0°C)


National alphabet? Never heard of it -- what Nation?

Are the Greek letters Sigma, Delta, Pi part of 
this "National alphabet"? While they are common 
in our English language, I don't think they are 
not included.


In addition, many registrars are clueless about 
IDNS, Char Sets, and what is legal and not. Plus, 
the are many differences between different TLD 
registrars. For example, the TLD COM can have 
single characters whereas the ORG will not allow 
single characters regardless of language 
(including ASCII).


The IDNS is still in a state of flux.

Cheers,

tedd


--
---
http://sperling.com/

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



[PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-11 Thread Michelle Konzack
Hello Ashley Sheridan,

Am 2011-01-08 17:09:27, hacktest Du folgendes herunter:
> Also, each label is checked to ensure it doesn't run over 63 characters,
> and the whole thing isn't over 253 characters. Lastly, each label is
> checked to ensure it doesn't completely consist of digits.

Do you know, that there are MANY domains with numbers only?

Like <163.com> or <126.net> which are legal names.

Oh I should mention that I block ANY mails from this two  domains  since
chinese spamers use it excessively.

Thanks, Greetings and nice Day/Evening
Michelle Konzack

-- 
# Debian GNU/Linux Consultant ##
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsyst...@tdnet France EURL   itsyst...@tdnet UG (limited liability)
Owner Michelle KonzackOwner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz Kinzigstraße 17
67100 Strasbourg/France   77694 Kehl/Germany
Tel: +33-6-61925193 mobil Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

  
 

Jabber linux4miche...@jabber.ccc.de
ICQ#328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/


signature.pgp
Description: Digital signature


Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-11 Thread Per Jessen
tedd wrote:

> At that time, I registered almost 30 names.
> Fortunately, all of my names passed and I was
> permitted to keep them. Unfortunately, all
> browser manufactures (except Safari) negated some
> of the work done by the IDNS WG and as a result
> PUNYCODE is shown instead of the actual
> characters intended.

Only for characters that are not part of a national alphabet, I believe?

This one works fine:  http://rugbrød.ch/

Besides, many domain registrars also limit the available characters to
those that are part of a national alphabet. 


-- 
Per Jessen, Zürich (0.0°C)


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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-10 Thread tedd

At 11:57 AM -0500 1/10/11, Steve Staples wrote:

On Mon, 2011-01-10 at 11:39 -0500, tedd wrote:

 > >>>For example --

 >>>
 >>>http://xn--19g.com
 >>>

 > >>>-- is square-root dot com.

on my Ubuntu box, I can copy and past the ˆ (square-root) character and
it displays properly in he address bar on google chome, but it
translates it back to the http://xn--19g.com and doesn't show anything
else (well... the page loads...LOL)

so did you register the xn--19q.com address knowing that it would
work/translate to ˆ.com (square-root) ?

--

Steve Staples


Steve:

When I was associated with the IDNS WG (not a 
member), there came a time where the "powers that 
be" wanted to "try out" their solutions, namely 
PUNYCODE. As such, we were allowed to register 
IDNS domain names on a trial basis. The 
conditions of the trial were that we could 
register any IDNS we wanted (at $100 a pop) and 
if at anytime over the following year our names 
caused problems, then we would forfeit our names 
without compensation. In short, a $100 per-name 
bet!


At that time, I registered almost 30 names. 
Fortunately, all of my names passed and I was 
permitted to keep them. Unfortunately, all 
browser manufactures (except Safari) negated some 
of the work done by the IDNS WG and as a result 
PUNYCODE is shown instead of the actual 
characters intended.


I continue to hold on to my domain names because 
I believe that the PUNYCODE problem will be 
resolved someday and my single character domain 
names will be valuable. Please realize that 
single character ASCII characters are estimated 
to sell for over a million dollars each -- you 
may want to review this:


http://www.cbsnews.com/stories/2005/11/28/tech/main1080245.shtml

In any event, this is out of the main stream of 
PHP. However, it should just be noted that 
Unicode characters, which started this thread, 
are very involved and many software manufactures 
are not implementing solutions correctly. In 
contrast, the PHP community has provided numerous 
Multibyte String Functions (mb_) for dealing with 
Unicode. So, our PHP applications can correctly 
deal with what Unicode provides that are far 
exceed simple ASCII.


Cheers,

tedd

--
---
http://sperling.com/

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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-10 Thread Steve Staples
On Mon, 2011-01-10 at 11:39 -0500, tedd wrote:
> At 11:41 AM -0600 1/9/11, Donovan Brooke wrote:
> >Daniel Brown wrote:
> >>On Sun, Jan 9, 2011 at 11:58, tedd  wrote:
> >>>
> >>>For example --
> >>>
> >>>http://xn--19g.com
> >>>
> >>>-- is square-root dot com. In all browsers except Safari...
> >
> >but yes, the actual square root character appears in safari only.
> >
> >Interesting!
> >Donovan
> 
> Donovan:
> 
> Yes, Safari shows ALL Unicode Code-Points (i.e., 
> Characters) as they were intended.
> 
> Here's a couple of examples:
> 
> http://xn--u2g.com
> 
> http://xn--w4h.com
> 
> Interesting enough, the above characters cannot 
> be typed directly from a key-board, but are shown 
> correctly by a Browser.
> 
> However as I said, these can only be seen 
> correctly by the Safari browser. If you use IE, 
> then the URL's will be shown as PUNYCODE -- M$ 
> has a "better idea".
> 
> What I also find interesting is that there are no 
> restrictions for using IDNS names in email 
> addresses. However, even Apple's Mail program 
> restricts these to standard ASCII.
> 
> IOW, an email address of t...@ˆ.com is perfectly 
> legal (and will work), but no email application 
> will allow it.
> 
> Cheers,
> 
> tedd
> -- 
> ---
> http://sperling.com/
> 
on my Ubuntu box, I can copy and past the √ (square-root) character and
it displays properly in he address bar on google chome, but it
translates it back to the http://xn--19g.com and doesn't show anything
else (well... the page loads...LOL)

so did you register the xn--19q.com address knowing that it would
work/translate to √.com (square-root) ?

-- 

Steve Staples
Web Application Developer
519.258.2333 x8414


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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-10 Thread tedd

At 11:41 AM -0600 1/9/11, Donovan Brooke wrote:

Daniel Brown wrote:

On Sun, Jan 9, 2011 at 11:58, tedd  wrote:


For example --

http://xn--19g.com

-- is square-root dot com. In all browsers except Safari...


but yes, the actual square root character appears in safari only.

Interesting!
Donovan


Donovan:

Yes, Safari shows ALL Unicode Code-Points (i.e., 
Characters) as they were intended.


Here's a couple of examples:

http://xn--u2g.com

http://xn--w4h.com

Interesting enough, the above characters cannot 
be typed directly from a key-board, but are shown 
correctly by a Browser.


However as I said, these can only be seen 
correctly by the Safari browser. If you use IE, 
then the URL's will be shown as PUNYCODE -- M$ 
has a "better idea".


What I also find interesting is that there are no 
restrictions for using IDNS names in email 
addresses. However, even Apple's Mail program 
restricts these to standard ASCII.


IOW, an email address of t...@ˆ.com is perfectly 
legal (and will work), but no email application 
will allow it.


Cheers,

tedd
--
---
http://sperling.com/

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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-10 Thread tedd

At 12:23 PM -0500 1/9/11, Daniel Brown wrote:

On Sun, Jan 9, 2011 at 11:58, tedd  wrote:


 For example --

 http://xn--19g.com


 > -- is square-root dot com. In all browsers except Safari, PUNYCODE is shown

 in the address bar, but in Safari it's shown as –.com


Not sure if that's a typo or an issue in translation while the
email was being relayed through the tubes, but –.com directs to
xn--wqa.com here.

--



Daniel et al:

Translation of Unicode characters by various 
software programs is unpredictable -- this 
includes email applications.


While I can send/receive ˆ (square root) through 
my email program (Eudora) what your email program 
displays to you can be (as shown) something 
completely different. The mapping of the 
code-points (i.e., square-root) to what your 
program displays (much like a web site) depends 
upon how your email program works. If your email 
program has the correct Char Set and will map it 
to the what was actually received, then the 
character will be displayed correctly. If not, 
then things like –.com happen.


Unfortunately, this mapping problem has not been 
of great importance for most applications. As it 
is now, most applications work for English 
speaking people and that seems good enough, or so 
many manufactures think. However, as the "rest of 
the world" starts using applications (and logging 
on to the net) it will obviously become more 
advantageous for manufactures to make their 
software work correctly for other-than-English 
languages. Apple is doing that and last year the 
majority of their income came from overseas 
(i.e., other than USA).


The mapping of other than English characters was 
the problem addressed by the IDNS WG, where I 
added my minor contribution circa 2000. 
Unfortunately, homographic issues were not 
resolved by the WG. However, a solution was 
proposed (I entitled as the "Fruit-loop" 
solution) which was to color-code (flag) the 
characters in the address bar of a browser IF the 
URL contained a mixed Char Set. Unfortunately, 
that solution was not pursued and instead Browser 
manufactures choose to show raw PUNYCODE, which 
was never intended to be seen by the end users. A 
giant step backwards IMO.


Cheers,

tedd

--
---
http://sperling.com/

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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-09 Thread Ashley Sheridan
On Sun, 2011-01-09 at 12:38 -0500, Daniel Brown wrote:

> On Sun, Jan 9, 2011 at 12:32, Ashley Sheridan  
> wrote:
> >
> > ^ is to the power of, not square root, which is √, which does translate to 
> > Tedds domain
> 
> Thanks for the math lesson, professor, but I already knew that.  ;-P
> 
> My point is, and as you can see in the quoted text from my email,
> that I don't know if it was a typo on Tedd's part or what, but ^.com
> is what came through here.
> 
> --
> 
> Network Infrastructure Manager
> Documentation, Webmaster Teams
> http://www.php.net/


Sorry, lol!

It came through as an unrecognised character for me, maybe some email
issue then?

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-09 Thread Ashley Sheridan
On Sun, 2011-01-09 at 12:23 -0500, Daniel Brown wrote:

> On Sun, Jan 9, 2011 at 11:58, tedd  wrote:
> >
> > For example --
> >
> > http://xn--19g.com
> >
> > -- is square-root dot com. In all browsers except Safari, PUNYCODE is shown
> > in the address bar, but in Safari it's shown as ˆ.com
> 
> Not sure if that's a typo or an issue in translation while the
> email was being relayed through the tubes, but ˆ.com directs to
> xn--wqa.com here.
> 
> -- 
> 
> Network Infrastructure Manager
> Documentation, Webmaster Teams
> http://www.php.net/
> 


^ is to the power of, not square root, which is √, which does translate
to Tedds domain

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-09 Thread Donovan Brooke

Daniel Brown wrote:

On Sun, Jan 9, 2011 at 11:58, tedd  wrote:


For example --

http://xn--19g.com

-- is square-root dot com. In all browsers except Safari, PUNYCODE is shown
in the address bar, but in Safari it's shown as ˆ.com


 Not sure if that's a typo or an issue in translation while the
email was being relayed through the tubes, but ˆ.com directs to
xn--wqa.com here.



error in translation.

I get the same domain for:
seamonkey
firefox
googlechrome
safari

but yes, the actual square root character appears in safari only.

Interesting!
Donovan




--
D Brooke

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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-09 Thread Daniel Brown
On Sun, Jan 9, 2011 at 12:32, Ashley Sheridan  wrote:
>
> ^ is to the power of, not square root, which is √, which does translate to 
> Tedds domain

Thanks for the math lesson, professor, but I already knew that.  ;-P

My point is, and as you can see in the quoted text from my email,
that I don't know if it was a typo on Tedd's part or what, but ^.com
is what came through here.

--

Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-09 Thread Daniel Brown
On Sun, Jan 9, 2011 at 11:58, tedd  wrote:
>
> For example --
>
> http://xn--19g.com
>
> -- is square-root dot com. In all browsers except Safari, PUNYCODE is shown
> in the address bar, but in Safari it's shown as ˆ.com

Not sure if that's a typo or an issue in translation while the
email was being relayed through the tubes, but ˆ.com directs to
xn--wqa.com here.

-- 

Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-09 Thread tedd

At 12:15 PM +0100 1/9/11, Per Jessen wrote:

Tamara Temple wrote:

 > I'm wondering what mods to make for this now that unicode chars are

 allowed in domain names


You're talking about IDNs ?  The actual domain name is still US-ASCII,
only when you decode punycode do you get UTF8 characters.

Per Jessen, Zürich (10.1°C)



Unfortunately, you are correct.

It was never the intention of the IDNS WG for the 
end-user to see PUNYCODE, but rather that all 
IDNS be seen by the end-user as actual Unicode 
code points (Unicode characters). The only 
browser that currently supports this is Safari.


For example --

http://xn--19g.com

-- is square-root dot com. In all browsers except 
Safari, PUNYCODE is shown in the address bar, but 
in Safari it's shown as ˆ.com


The IDNS works, but for fear of homographic 
attacks IE (and other browsers) will not show the 
IDNS correctly.


Cheers,

tedd

--
---
http://sperling.com/

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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-09 Thread Per Jessen
Tamara Temple wrote:

> On Jan 8, 2011, at 2:22 PM, Al wrote:
> 
>>
>>
>> On 1/8/2011 3:55 AM, WalkinRaven wrote:
>>> PHP 5.3 PCRE
>>>
>>> Regular Express to match domain names format according to RFC 1034
>>> - DOMAIN
>>> NAMES - CONCEPTS AND FACILITIES
>>>
>>> /^
>>> (
>>> [a-z] |
>>> [a-z] (?:[a-z]|[0-9]) |
>>> [a-z] (?:[a-z]|[0-9]|\-){1,61} (?:[a-z]|[0-9]) ) # One label
>>>
>>> (?:\.(?1))*+ # More labels
>>> \.? # Root domain name
>>> $/iDx
>>>
>>> This rule matches only  and . but not
>>> 
>>>
>>> I don't know what wrong with it.
>>>
>>> Thank you.
>>
>>
>>
>> Look at filter_var()
>>
>> Validates value as URL (according to »
>> http://www.faqs.org/rfcs/rfc2396) ,
>>
> 
> 
> I'm wondering what mods to make for this now that unicode chars are
> allowed in domain names

You're talking about IDNs ?  The actual domain name is still US-ASCII,
only when you decode punycode do you get UTF8 characters.


-- 
Per Jessen, Zürich (10.1°C)


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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-08 Thread Tamara Temple

On Jan 8, 2011, at 2:22 PM, Al wrote:




On 1/8/2011 3:55 AM, WalkinRaven wrote:

PHP 5.3 PCRE

Regular Express to match domain names format according to RFC 1034  
- DOMAIN

NAMES - CONCEPTS AND FACILITIES

/^
(
[a-z] |
[a-z] (?:[a-z]|[0-9]) |
[a-z] (?:[a-z]|[0-9]|\-){1,61} (?:[a-z]|[0-9]) ) # One label

(?:\.(?1))*+ # More labels
\.? # Root domain name
$/iDx

This rule matches only  and . but not  



I don't know what wrong with it.

Thank you.




Look at filter_var()

Validates value as URL (according to » http://www.faqs.org/rfcs/rfc2396) 
,





I'm wondering what mods to make for this now that unicode chars are  
allowed in domain names




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



[PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-08 Thread Al



On 1/8/2011 3:55 AM, WalkinRaven wrote:

PHP 5.3 PCRE

Regular Express to match domain names format according to RFC 1034 - DOMAIN
NAMES - CONCEPTS AND FACILITIES

/^
(
[a-z] |
[a-z] (?:[a-z]|[0-9]) |
[a-z] (?:[a-z]|[0-9]|\-){1,61} (?:[a-z]|[0-9]) ) # One label

(?:\.(?1))*+ # More labels
\.? # Root domain name
$/iDx

This rule matches only  and . but not 

I don't know what wrong with it.

Thank you.




Look at filter_var()

Validates value as URL (according to » http://www.faqs.org/rfcs/rfc2396),


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



[PHP] RE: Help with variable variables not being set for a multi-dimensional array

2010-11-09 Thread Daevid Vincent
 

> -Original Message-
> From: Daevid Vincent [mailto:dae...@daevid.com] 
> Sent: Tuesday, November 09, 2010 6:55 PM
> To: 'php-general@lists.php.net'
> Subject: Help with variable variables not being set for a 
> multi-dimensional array
> 
> I've used variable variables before but for some reason I 
> can't figure this snippet out. Why doesn't $ini_file get set 
> (or appended to). Is there a better more elegant solution to 
> parsing these keys and splitting them into sub-array keys as 
> you see what I'm trying to do. I was thinking some recursion, 
> but it seems overkill for such a simple task.
> 
> Given an .ini file like so:
> 
> [production]
> agis_core.adapter = Mysqli
> agis_core.params.host = 10.10.10.46
> agis_core.params.username = USERNAME
> agis_core.params.password = PASSWORD
> agis_core.params.dbname   = agis_core
> agis_core.params.port = 3306
> 
> I'm writing a simple parser (to be semi-compatible with the 
> Zend Framework one apparently but without the bloat of ZF)
> 
> require_once $path.'/../classes/IniParser.class.php';
> try
> {
>   $config_ini = new IniParser($path.'/../config.ini', true, true);
> }
> catch (Exception $e)
> {
>   echo 'Caught Exception parsing ini 
> file.'.$e->getMessage()."\n";
> }
> 
> 
> class IniParser
> {
>   private $file;
>   public  $ini_array;
> 
>   function __construct($file, $process_sections=true, 
> $explode=false)
>   {
>   $this->file = $file;
>   $this->ini_array = 
> parse_ini_file($file,$process_sections);
>   if (!$this->ini_array)
>   {
>   //we only check this if we failed since 
> Disk I/O is expensive
>   if (!file_exists($file)) throw new 
> Exception('File Not Found: '.$file);
>   }
> 
>   if ($explode) $this->explode_ini();
>   }
> 
>   public function explode_ini()
>   {
>   $ini_array = array();
> 
>   foreach($this->ini_array as $heading => $key_vals)
>   {
>   foreach ($key_vals as $k => $v)
>   {
>   $path = 'ini_array[\''.$heading.'\']';
>   $subsection = explode('.', $k);
>   foreach ($subsection as $ss) 
> $path .= '[\''.$ss.'\']';
>   //echo $path.' = '.$v.'';
>   $$path = $v;
>   var_dump($path, $$path, $ini_array);
>   }
>   }
> 
>   $this->ini_array = $ini_array;
>   }
> }
> ?>
> 
> But the $ini_array is not being set?!? Here is the output I get...
> 
> string 'ini_array['production']['agis_core']['adapter']' (length=47)
> 
> string 'Mysqli' (length=6)
> 
> array
>   empty
> 
> string 
> 'ini_array['production']['agis_core']['params']['host']' (length=54)
> 
> string '10.10.10.46' (length=11)
> 
> array
>   empty
> 
> string 
> 'ini_array['production']['agis_core']['params']['username']' 
> (length=58)
> 
> string 'USERNAME' (length=7)
> 
> array
>   empty
> 
> ...
> 

FYI, if I swap out the guts with this snippet:

foreach ($key_vals as $k => $v)
{
$path = 'ini_array[\''.$heading.'\']';
$subsection = explode('.', $k);
foreach ($subsection as $ss) $path .= '[\''.$ss.'\']';
$path = '$'.$path.' = \''.$v.'\';';
eval($path); //it's not elegant but it works!
}

It works. Not sure if it's any better or worse than the other hack though.
I'd still like to know what is wrong with the initial version for future
reference.


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



Re: [PHP] Re: Help with exec.

2010-03-03 Thread Paul Halliday
and its that easy!

it took me a minute to figure out; but all I had to do was:

if (is_resource($process)) {

for ($i = 0; $i < sizeof($src_ip); $i++) {
fwrite($pipes[0], "$sig_desc[$i],$src_ip[$i],$dst_ip[$i]\n");
}

fclose($pipes[0]);
fclose($pipes[1]);
proc_close($process);
}

thanks.

On Wed, Mar 3, 2010 at 10:08 AM, Ian  wrote:
> On 03/03/2010 13:01, Paul Halliday wrote:
>> I need to pipe some data to an external application.
>>
>> I have this:
>>
>> while ($row = mysql_fetch_array($theData[0])) {
>>     $src_ip[] = $row[0];
>>     $dst_ip[] = $row[1];
>>     $sig_desc[] = $row[2];
>>
>>     $rec ++;
>>     if ( $rec == $recCount ) {
>>             break;
>>     }
>> }
>>
>> for ($i = 0; $i < sizeof($src_ip); $i++) {
>>     $tmpResult[] = "$sig_desc[$i],$src_ip[$i],$dst_ip[$i]\n";
>> }
>>
>>
>> The external program is called like:
>>
>> cat results.csv | theprogram outputfilename
>>
>> Is there a way mimic this w/o outputting $tmpResult to a file first?
>>
>> Thanks.
>>
>
> Hi,
>
> I have used this code to feed data to gpg and read back the encrypted
> result, Im sure you can adapt it to your needs.
>
> function Encrypt($data){
>
>        # http://www.theoslogic.com/scripts/php-gpg/
>
>        $gpg_command="/usr/bin/gpg $parameters";
>
>        $errLog = "/tmp/errors.log";
>
>        $dspecs = array(
>                0=>array("pipe", "r"),
>                1=>array("pipe", "w"),
>                2=>array("file", $errLog, "a")
>        );
>
>        $encrypted="";
>        $procdata="";
>
>        $gpgproc = proc_open($gpg_command, $dspecs, $pipes);
>
>        if (is_resource($gpgproc)) {
>                fwrite($pipes[0], $data);
>                fclose($pipes[0]);
>
>                while($procdata = fgets($pipes[1], 1024)) {
>                        $encrypted .= $procdata;
>                }
>                fclose($pipes[1]);
>        }
>
>        return $encrypted;
> }
>
> It works really well.
>
> Regards
>
> Ian
> --
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



[PHP] Re: Help with exec.

2010-03-03 Thread Ian
On 03/03/2010 13:01, Paul Halliday wrote:
> I need to pipe some data to an external application.
> 
> I have this:
> 
> while ($row = mysql_fetch_array($theData[0])) {
> $src_ip[] = $row[0];
> $dst_ip[] = $row[1];
> $sig_desc[] = $row[2];
> 
> $rec ++;
> if ( $rec == $recCount ) {
> break;
> }
> }
> 
> for ($i = 0; $i < sizeof($src_ip); $i++) {
> $tmpResult[] = "$sig_desc[$i],$src_ip[$i],$dst_ip[$i]\n";
> }
> 
> 
> The external program is called like:
> 
> cat results.csv | theprogram outputfilename
> 
> Is there a way mimic this w/o outputting $tmpResult to a file first?
> 
> Thanks.
> 

Hi,

I have used this code to feed data to gpg and read back the encrypted
result, Im sure you can adapt it to your needs.

function Encrypt($data){

# http://www.theoslogic.com/scripts/php-gpg/

$gpg_command="/usr/bin/gpg $parameters";

$errLog = "/tmp/errors.log";

$dspecs = array(
0=>array("pipe", "r"),
1=>array("pipe", "w"),
2=>array("file", $errLog, "a")
);

$encrypted="";
$procdata="";

$gpgproc = proc_open($gpg_command, $dspecs, $pipes);

if (is_resource($gpgproc)) {
fwrite($pipes[0], $data);
fclose($pipes[0]);

while($procdata = fgets($pipes[1], 1024)) {
$encrypted .= $procdata;
}
fclose($pipes[1]);
}

return $encrypted;
}

It works really well.

Regards

Ian
-- 


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



[PHP] Re: help, please, understanding my problem

2010-02-23 Thread Stan
Thanks all.

I rediscovered DIFF, compared the source for the first and second rendering.
Besides the unique variable names there was also the message ... which
contained imbedded single quote marks.  When I changed them to imbedded
double quote marks the problem went away.

""Stan""  wrote in message
news:11.66.00376.2ce92...@pb1.pair.com...
> I have a PHP page that has
>  require_once("genMyOverlay.js.php");
>  .
>  .
>  .
>  echo "";
>  echo "doit(\"mydiv\");";
>  echo "";
>
> genMyOverlay.js.php contains: createDiv() (see below) that creates a  ID="mydiv"> and sets it up to overlay a portion of the wbe page and
> doit()starts it off.
>
> invoke the web page once and it works like it should.  invoke the web page
a
> second time (and thereafter until a new session) and it gets error:
>  "doit is not defined"
>
> view the source (at the client browser) and it is identical both (all)
times
>
> can anyone please help me understand what is happening?
>
> genMyOverlay.js.php contains
>  
>   echo "