php-general Digest 16 Jun 2010 08:57:34 -0000 Issue 6801

2010-06-16 Thread php-general-digest-help

php-general Digest 16 Jun 2010 08:57:34 - Issue 6801

Topics (messages 306171 through 306189):

Re: protecting email addresses on a web site
306171 by: HallMarc Websites
306174 by: Ashley Sheridan

How could I mix popen() and pcntl_alarm() function ?
306172 by: Chian Hsieh
306181 by: Jim Lucas
306188 by: Chian Hsieh

Re: [PHP-WEBMASTER] Web Service Problem
306173 by: Richard Quadling
306180 by: Michael Shadle

Re: Multiple Login in a single PC should not be possible
306175 by: Karl DeSaulniers
306176 by: Ashley Sheridan
306177 by: Karl DeSaulniers
306178 by: Karl DeSaulniers
306179 by: Ashley Sheridan
306182 by: Karl DeSaulniers

SQL Syntax
306183 by: Jan Reiter
306184 by: Daniel Brown
306185 by: Ashley Sheridan
306186 by: Jan Reiter
306187 by: Ashley Sheridan
306189 by: Simcha Younger

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


--
---BeginMessage---


-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: Monday, June 14, 2010 10:52 AM
To: Dotan Cohen
Cc: HallMarc Websites; David Mehler; php-general
Subject: Re: [PHP] protecting email addresses on a web site

On Mon, 2010-06-14 at 17:50 +0300, Dotan Cohen wrote:

 On 14 June 2010 15:36, HallMarc Websites sa...@hallmarcwebsites.com
wrote:
  Another is a CSS solution where you type the email address backwards and
  then use the CSS style declaration:
  style=direction: rtl; unicode-bidi: bidi-override;
 
 
 How does that work with screen readers? How about copy-paste?
 


I don't think there's an accessible way of doing this. Anything that
allows a screen reader to speak the email address would also be
susceptible to spammers email scrapers.

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



Copy-n-paste just gives you the email address backwards; screen readers,
because we are using logical ordering and it is stored in memory the way we
expect to read it, will read it correctly. 

I was not aware that email harvesters used screen readers. Do you have some
documentation I could read to get up to speed on this?

Marc Hall
HallMarc Websites
So many spammers, so few bullets... 
 

__ Information from ESET Smart Security, version of virus signature
database 5199 (20100615) __

The message was checked by ESET Smart Security.

http://www.eset.com
 

---End Message---
---BeginMessage---
On Tue, 2010-06-15 at 13:02 -0400, HallMarc Websites wrote:

 
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
 Sent: Monday, June 14, 2010 10:52 AM
 To: Dotan Cohen
 Cc: HallMarc Websites; David Mehler; php-general
 Subject: Re: [PHP] protecting email addresses on a web site
 
 On Mon, 2010-06-14 at 17:50 +0300, Dotan Cohen wrote:
 
  On 14 June 2010 15:36, HallMarc Websites sa...@hallmarcwebsites.com
 wrote:
   Another is a CSS solution where you type the email address backwards and
   then use the CSS style declaration:
   style=direction: rtl; unicode-bidi: bidi-override;
  
  
  How does that work with screen readers? How about copy-paste?
  
 
 
 I don't think there's an accessible way of doing this. Anything that
 allows a screen reader to speak the email address would also be
 susceptible to spammers email scrapers.
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 
 
 Copy-n-paste just gives you the email address backwards; screen readers,
 because we are using logical ordering and it is stored in memory the way we
 expect to read it, will read it correctly. 
 
 I was not aware that email harvesters used screen readers. Do you have some
 documentation I could read to get up to speed on this?
 
 Marc Hall
 HallMarc Websites
 So many spammers, so few bullets... 
  
 
 __ Information from ESET Smart Security, version of virus signature
 database 5199 (20100615) __
 
 The message was checked by ESET Smart Security.
 
 http://www.eset.com
  
 


I didn't say the harvesters used screen readers. I'm saying that if
something is in plain text that a screen reader can understand, what's
to stop an email address harvester? It's not worth their time to analyse
every image (think about where Google is with image searching right now,
and they have a lot more resources at their disposal) but it is easy
enough to read text in a web page. At a push, it's possible to believe
that some might be using rendered CSS to see how an email is rendered.

Thing is, it's nigh on impossible to hide an email address. Use it once
on a mailing list like this and it's there for the whole world to see on
archive listings. I even though that my email wouldn't be 

php-general Digest 16 Jun 2010 21:02:45 -0000 Issue 6802

2010-06-16 Thread php-general-digest-help

php-general Digest 16 Jun 2010 21:02:45 - Issue 6802

Topics (messages 306190 through 306213):

Re: export from one server to another
306190 by: Richard Quadling

Re: SQL Syntax
306191 by: Carlos Medina
306192 by: Jan Reiter
306193 by: Jan Reiter
306194 by: Carlos Medina
306203 by: Andrew Ballard

Unknown error with imagecreatefromjpeg() on specific GD/PHP versions.
306195 by: Jeff MacDonald
306196 by: Daniel Brown
306197 by: Daniel Brown
306198 by: Richard Quadling
306199 by: Jeff MacDonald
306200 by: Jeff MacDonald
306201 by: Richard Quadling
306202 by: Jeff MacDonald

Re: SQL Syntax [improved SQL]
306204 by: Jan Reiter
306205 by: Tommy Pham

Re: Another parse problem
306206 by: tedd
306207 by: Daniel P. Brown
306212 by: Robert Cummings
306213 by: Shawn McKenzie

Re: Seeking developer for short term project
306208 by: Dev Job

User's IP Validation
306209 by: Juan Rodriguez Monti
306210 by: Bob McConnell
306211 by: David Cesal

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


--
---BeginMessage---
On 16 June 2010 09:42, Merlin Morgenstern merli...@fastmail.fm wrote:


 On Tue, 15 Jun 2010 11:26 +0100, Richard Quadling
 rquadl...@gmail.com wrote:
 On 15 June 2010 11:00, Merlin Morgenstern merli...@fastmail.fm wrote:
  HI there,
 
  I am thinking about building a partner network where partners can export
  content to my server which will then be imported. It should be as easy as
  possible for the partner and not rely on any special php functions.
 
 
  The best way to do this I guess is to deliver them a php file which will
  create a xml structure that I can import. The problem I have now is, how to
  transfer this xml-file to my server? Of course I could do this via FTP, but
  then they need to have FTP enabled inside their php installation. This 
  might
  scare some partners away.
 
  Does anybody have a good suggestion on how to do this?
 
  Thank you for any hint,
 
  Merlin
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 We have just done something similar. We went down the SOAP route as
 this allows third parties to be able to take our WSDL file (which
 describes the services we offer) and create their own code from it,
 essentially wrapping the SOAP comms in a class of language x. I used a
 slightly modified wsdl2php class from sourceforge to create my client
 classes for our own service, rather than manually creating them, as a
 proof of concept. So wsdl2java, wsdl2net (if such things exist) would
 do a similar job.

 For us, the biggest advantage of SOAP over say REST was that SOAP is a
 documented standard (with all its faults). We can supply a single
 document which is man and machine readable and fully describes our
 service. Admittedly, we used the Zend SOAP, WSDL and AutoDiscovery
 classes for all of this, so really, we did VERY little in terms of
 creating the SOAPy bits.

 We have an Authentication service and then a series of services which
 retrieve and supply data. We incorporated version control into all the
 classes. So, V1 is where we are today. As we increase functionality,
 we can incorporate a superseded by mechanism, which the end-user can
 take into account if they so wish. The WSDL file will have the latest
 info, they can re-generate their classes from the WSDL file and then
 take advantage of the new functionality.

 If we find a problem which essentially breaks the contract, we can
 kill a version. And if if has a superseded by, we are again,
 automatically informing the client of the newer code.

 Add to that live (default), test (we think this is what you asked for)
 and dev (this is where we are at the moment if you really want to see
 something) requests for a particular version. As dev becomes test, the
 dev is killed and superseded by the test and then the same for the
 test - live (with test's not being killed).

 So. A simple enough setup, but allows us to move at our own pace in
 terms of further development, allows us to incorporate requests and
 bespoke requests to meet the needs of our partners ... all good. And
 it was good fun doing this. Admittedly, there were a few bugs in the
 Zend code I had to fix (all patches have been supplied but awaiting
 someone to commit them to the code).

 Richard.

 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer :
 

Re: [PHP] Unknown error with imagecreatefromjpeg() on specific GD/PHP versions.

2010-06-16 Thread Jeff MacDonald

On 2010-06-16, at 11:37 AM, Richard Quadling wrote:

 On 16 June 2010 15:26, Jeff MacDonald j...@bignose.ca wrote:
 Hi Everyone,
 
 One of my developers is reporting a problem on our Live server but not our 
 devel server.
 
 Specifically when someon uploads a photo taken by a KODAK EASYSHARE C813, 
 and that image gets processed by imagecreatefromjpeg(), the function returns 
 false.
 
 Our Devel Server Info [this works fine]
PHP Version : 5.2.6-3
GD Version: 2.0 or higher.
EXIF Version: 1.4
 
 Our Live Server Info [this one is the one that fails]
PHP Version: 5.2.13
GD Version : 2.0.34 compatible
EXIF Version : 1.4
 
 To see an example of this in action,
 
 Working function : http://www.equipmentsearch.com/~jeff/tmp/image.php?i=w
 Not working function : http://www.equipmentsearch.com/~jeff/tmp/image.php?i=n
 
 http://www.equipmentsearch.com/~jeff/tmp/image.php.txt is the code.
 
 Does anyone have any ideas or suggestions of where to look next?
 
 Jeff.
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 The @ is suppressing this notice ...
 
 Notice: imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error:
 Corrupt JPEG data: 31 extraneous bytes before marker 0xd9

Thanks!

I guess I'm wondering why this works on the Devel server but not the live?

Jeff.


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



Re: [PHP] Unknown error with imagecreatefromjpeg() on specific GD/PHP versions.

2010-06-16 Thread Richard Quadling
On 16 June 2010 15:37, Richard Quadling rquadl...@gmail.com wrote:
 On 16 June 2010 15:26, Jeff MacDonald j...@bignose.ca wrote:
 Hi Everyone,

 One of my developers is reporting a problem on our Live server but not our 
 devel server.

 Specifically when someon uploads a photo taken by a KODAK EASYSHARE C813, 
 and that image gets processed by imagecreatefromjpeg(), the function returns 
 false.

 Our Devel Server Info [this works fine]
        PHP Version : 5.2.6-3
        GD Version: 2.0 or higher.
        EXIF Version: 1.4

 Our Live Server Info [this one is the one that fails]
        PHP Version: 5.2.13
        GD Version : 2.0.34 compatible
        EXIF Version : 1.4

 To see an example of this in action,

 Working function : http://www.equipmentsearch.com/~jeff/tmp/image.php?i=w
 Not working function : http://www.equipmentsearch.com/~jeff/tmp/image.php?i=n

 http://www.equipmentsearch.com/~jeff/tmp/image.php.txt is the code.

 Does anyone have any ideas or suggestions of where to look next?

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



 The @ is suppressing this notice ...

 Notice: imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error:
 Corrupt JPEG data: 31 extraneous bytes before marker 0xd9

Using djpeg -verbose notworking.jpg

Independent JPEG Group's DJPEG, version 7  27-Jun-2009
Copyright (C) 2009, Thomas G. Lane, Guido Vollbeding
Start of Image
Miscellaneous marker 0xe1, length 17066
Miscellaneous marker 0xe2, length 118
Miscellaneous marker 0xe2, length 514
Miscellaneous marker 0xe2, length 43270
Define Huffman Table 0x01
Define Huffman Table 0x11
Define Huffman Table 0x00
Define Huffman Table 0x10
Define Quantization Table 1  precision 0
Define Quantization Table 0  precision 0
Define Restart Interval 113
Start Of Frame 0xc0: width=1800, height=1200, components=3
Component 1: 2hx2v q=0
Component 2: 1hx1v q=1
Component 3: 1hx1v q=1
Start Of Scan: 3 components
Component 1: dc=0 ac=0
Component 2: dc=1 ac=1
Component 3: dc=1 ac=1
  Ss=0, Se=63, Ah=0, Al=0
Unexpected marker 0xd2
Corrupt JPEG data: 31 extraneous bytes before marker 0xd9
End Of Image




-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Unknown error with imagecreatefromjpeg() on specific GD/PHP versions.

2010-06-16 Thread Jeff MacDonald

On 2010-06-16, at 11:44 AM, Richard Quadling wrote:

 On 16 June 2010 15:37, Richard Quadling rquadl...@gmail.com wrote:
 On 16 June 2010 15:26, Jeff MacDonald j...@bignose.ca wrote:
 Hi Everyone,
 
 One of my developers is reporting a problem on our Live server but not our 
 devel server.
 
 Specifically when someon uploads a photo taken by a KODAK EASYSHARE C813, 
 and that image gets processed by imagecreatefromjpeg(), the function 
 returns false.
 
 Our Devel Server Info [this works fine]
PHP Version : 5.2.6-3
GD Version: 2.0 or higher.
EXIF Version: 1.4
 
 Our Live Server Info [this one is the one that fails]
PHP Version: 5.2.13
GD Version : 2.0.34 compatible
EXIF Version : 1.4
 
 To see an example of this in action,
 
 Working function : http://www.equipmentsearch.com/~jeff/tmp/image.php?i=w
 Not working function : 
 http://www.equipmentsearch.com/~jeff/tmp/image.php?i=n
 
 http://www.equipmentsearch.com/~jeff/tmp/image.php.txt is the code.
 
 Does anyone have any ideas or suggestions of where to look next?
 
 Jeff.
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 The @ is suppressing this notice ...
 
 Notice: imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error:
 Corrupt JPEG data: 31 extraneous bytes before marker 0xd9
 
It would seem our Devel server has GD 2.0.36

Our Live server has GD 2.0.34

So Presumably if i upgrade live it should work. 

Jeff.

 
 -- 
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling


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



Re: [PHP] SQL Syntax

2010-06-16 Thread Andrew Ballard
On Tue, Jun 15, 2010 at 8:58 PM, Jan Reiter the-fal...@gmx.net wrote:
 Hi folks!

 I'm kind of ashamed to ask a question, as I haven't followed this list very
 much lately.

 This isn't exactly a PHP question, but since mysql is the most popular
 database engine used with php, I figured someone here might have an idea.

 I have 2 tables. Table A containing 2 fields. A user ID and a picture ID =
 A(uid,pid) and another table B, containing 3 fields. The picture ID, an
 attribute ID and a value for that attribute = B(pid,aid,value).

 Table B contains several rows for a single PID with various AIDs and values.
 Each AID is unique to a PID.  (e.g. AID = 1 always holding the value for the
 image size and AID = 3 always holding a value for the image type)

This is known as an EAV (Entity-Attribute-Value) design. It is usually
(some would say always) a very bad idea to implement this in a
relational database. and this is no exception.

 The goal is now to join table A on table B using pid, and selecting the rows
 based on MULTIPLE  attributes.

 So the result should only contain rows for images, that relate to an
 attribute ID = 1 (size) that is bigger than 100 AND!!! an attribute ID =
 5 that equals 'jpg'.

 I know that there is an easy solution to this, doing it in one query and I
 have the feeling, that I can almost touch it with my fingertips in my mind,
 but I can't go that final step, if you know what I mean. AND THAT DRIVES ME
 CRAZY!!

The easy solution is to redesign the tables. There are a lot of
reasons why this design is usually a very bad idea. For starters, what
should be a simple query is anything but simple, as you have just
discovered. What's more, there is no simple way (if any way at all)
for your design to prevent an image from having a mime-type of 20174
or a size of 'jpg'.

Andrew

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



Re: [PHP] SQL Syntax [improved SQL]

2010-06-16 Thread Jan Reiter
Hi,

this is the solution I came up with, that is over 10 times faster than my
first attemps.

Tested @31,871 entries in table 'picture' and 222,712 entries in table
'picture_attrib_rel'. 

Old Version:

SELECT * FROM picture as p 

INNER JOIN picture_attrib_rel as pr1 
ON (p.pid = pr1.pid)

INNER JOIN  picture_attrib_rel as pr2 
ON (p.pid = pr2.pid and pr2.val_int  1500)

WHERE pr1.aid = 2 AND pr1.val_int = 1500 
AND pr2.aid = 5 AND pr2.val_int  1000

Takes about 1.9 Seconds on average to return.

The version with temporary tables:

DROP temporary table if exists tmp_size;
DROP temporary table if exists tmp_qi;

CREATE temporary table tmp_size
  SELECT pid FROM picture_attrib_rel 
  WHERE aid = 2 AND val_int = 1500;
CREATE temporary table tmp_qi
  SELECT pid FROM picture_attrib_rel 
  WHERE aid = 5 AND val_int  1000;

SELECT pid,uid FROM tmp_size JOIN tmp_qi USING(pid) JOIN pictures
USING(pid);

DROP temporary table if exists tmp_size;
DROP temporary table if exists tmp_qi;

This takes 0.12 seconds to return, which is quite bearable for now. 


Thanks again for all your input!

Regards,
Jan


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



RE: [PHP] SQL Syntax [improved SQL]

2010-06-16 Thread Tommy Pham
 -Original Message-
 From: Jan Reiter [mailto:the-fal...@gmx.net]
 Sent: Wednesday, June 16, 2010 8:55 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] SQL Syntax [improved SQL]
 
 Hi,
 
 this is the solution I came up with, that is over 10 times faster than my
first
 attemps.
 
 Tested @31,871 entries in table 'picture' and 222,712 entries in table
 'picture_attrib_rel'.
 
 Old Version:
 
 SELECT * FROM picture as p
 
 INNER JOIN picture_attrib_rel as pr1
 ON (p.pid = pr1.pid)
 
 INNER JOIN  picture_attrib_rel as pr2
 ON (p.pid = pr2.pid and pr2.val_int  1500)
 
 WHERE pr1.aid = 2 AND pr1.val_int = 1500 AND pr2.aid = 5 AND pr2.val_int

 1000
 
 Takes about 1.9 Seconds on average to return.
 
 The version with temporary tables:
 
 DROP temporary table if exists tmp_size; DROP temporary table if exists
 tmp_qi;
 
 CREATE temporary table tmp_size
   SELECT pid FROM picture_attrib_rel
   WHERE aid = 2 AND val_int = 1500;
 CREATE temporary table tmp_qi
   SELECT pid FROM picture_attrib_rel
   WHERE aid = 5 AND val_int  1000;
 
 SELECT pid,uid FROM tmp_size JOIN tmp_qi USING(pid) JOIN pictures
 USING(pid);
 
 DROP temporary table if exists tmp_size; DROP temporary table if exists
 tmp_qi;
 
 This takes 0.12 seconds to return, which is quite bearable for now.
 
 
 Thanks again for all your input!
 
 Regards,
 Jan

Jan,

What do you get from this query and how fast does it execute? 

SELECT * FROM picture_attrib_rel par INNER JOIN pictures p ON p.pid =
par.pid WHERE (par.aid = 2 AND par.val_int = 1500) OR (par.aid = 5 AND
par.val_int  1000)

Regards,
Tommy


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



Re: [PHP] Another parse problem

2010-06-16 Thread tedd

Rob and Daniel:

As expected, both of your submission were excellent. If this was an 
assignment in one of my classes (as if I could teach either of you 
anything) you would both receive an A+.


Daniel's routine also returned .ie TLD, but that was not stated as a 
requirement.


Daniel's routine also allow for full-link parsing, but again that was 
not stated as a requirement.


How to deal with duplicate domains was not addressed in the given and 
both routines differed on that point.


The given was to parse domain-names, but both routines pulled out 
sub-domains as well. Perhaps I am wrong in my understanding of what a 
domain name is, but I would normally look at sub domains as not part 
of the domain name. Sub domains are simply extensions of the domain 
name, am I right or wrong?


In any event, I will be examining both your code because neither is 
the way I solved the problem. Mine was a bit more verbose and clumsy 
in comparison. It's always nice to see how the top dog's do it.


Cheers,

tedd

PS: I've been away for the last couple of days.

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

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



Re: [PHP] Another parse problem

2010-06-16 Thread Daniel P. Brown
On Wed, Jun 16, 2010 at 13:22, tedd tedd.sperl...@gmail.com wrote:

 The given was to parse domain-names, but both routines pulled out
 sub-domains as well. Perhaps I am wrong in my understanding of what a domain
 name is, but I would normally look at sub domains as not part of the domain
 name. Sub domains are simply extensions of the domain name, am I right or
 wrong?

Technically, a domain name is anything from the TLD and SLD levels
and below.  An FQDN (commonly called a hostname) is in the format
cname.sld.tld.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!

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



[PHP] Re: Seeking developer for short term project

2010-06-16 Thread Dev Job
Just to clarify, we are looking for a single developer, not a team please.

Thanks!


On Mon, Jun 14, 2010 at 12:46 PM, Dev Job job4d...@gmail.com wrote:

 Our company is looking to hire a PHP Developer for a short term project.
  We're currently in the last couple weeks of the interview phase to narrow
 down our options.  We are looking for a developer that is comfortable
 working with existing code as well as creating new code.  You must be
 skilled in PHP and MySQL in addition to HTML and javascript.  Experience in
 jQuery is a plus!

 We're looking for candidates from the U.S. and UK only right now.

 If you meet the requirements and are intersted, please respond with a
 resume and contact information.

 We'll be making a decision in the next couple weeks, so please respond
 soon!



[PHP] User's IP Validation

2010-06-16 Thread Juan Rodriguez Monti
Hi people,
I would like to know the best way to perform some kind of validation
for an application that I've written.

I have a system that ask through an HTML Form some questions to users.
I use some cookies to save some information from the user side.

However, I would like to implement some code in PHP that would let me
limit to 1 the number of times that the page with the questions was
executed.

I mean, the user fills the HTML's Form, then send it through an HTML
Button, then PHP receives this informations and send an Email
containing the replies to the questions. I would like to limit to one,
the times one single user is able to execute this form.

I thought getting the IP Address, then doing some kind of validation
with it. However I don't know if using cookies is the best idea. I
don't have access to a DataBase for this. So I thought might be a good
idea write to a file in the server the IP, then perform some if to
know if the user already replied the form.

As far as I don't know which is the best way to code this, I felt free
to ask you guys.

Thanks a lot.

Juan

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



RE: [PHP] User's IP Validation

2010-06-16 Thread Bob McConnell
If this is an open site, using the IP won't be any good. We have over
200 people behind our NAT firewall, all of which would show up as coming
from the same IP on your server. Many other networks have the same or a
similar configuration.

If you only allow registered users, add a couple of flags to your user
table and set one of them when they fill out the form. Don't show them
the form after it is set. Having a couple, you can do a couple of
questionnaires simultaneously, and clear the matching flag when you
close the form.

Bob McConnell

-Original Message-
From: Juan Rodriguez Monti [mailto:j...@rodriguezmonti.com.ar] 
Sent: Wednesday, June 16, 2010 2:26 PM
To: php-general@lists.php.net
Subject: [PHP] User's IP Validation

Hi people,
I would like to know the best way to perform some kind of validation
for an application that I've written.

I have a system that ask through an HTML Form some questions to users.
I use some cookies to save some information from the user side.

However, I would like to implement some code in PHP that would let me
limit to 1 the number of times that the page with the questions was
executed.

I mean, the user fills the HTML's Form, then send it through an HTML
Button, then PHP receives this informations and send an Email
containing the replies to the questions. I would like to limit to one,
the times one single user is able to execute this form.

I thought getting the IP Address, then doing some kind of validation
with it. However I don't know if using cookies is the best idea. I
don't have access to a DataBase for this. So I thought might be a good
idea write to a file in the server the IP, then perform some if to
know if the user already replied the form.

As far as I don't know which is the best way to code this, I felt free
to ask you guys.

Thanks a lot.

Juan

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



RE: [PHP] User's IP Validation

2010-06-16 Thread David Cesal
Please, don't forget IP address can be same for many users. I see only way with 
cookies. When user deletes cookies, form pops up again. I don't know any better 
way.

David

Sent from my HTC

-Original Message-
From: Juan Rodriguez Monti j...@rodriguezmonti.com.ar
Sent: 16. cervna 2010 20:26
To: php-general@lists.php.net
Subject: [PHP] User's IP Validation

Hi people,
I would like to know the best way to perform some kind of validation
for an application that I've written.

I have a system that ask through an HTML Form some questions to users.
I use some cookies to save some information from the user side.

However, I would like to implement some code in PHP that would let me
limit to 1 the number of times that the page with the questions was
executed.

I mean, the user fills the HTML's Form, then send it through an HTML
Button, then PHP receives this informations and send an Email
containing the replies to the questions. I would like to limit to one,
the times one single user is able to execute this form.

I thought getting the IP Address, then doing some kind of validation
with it. However I don't know if using cookies is the best idea. I
don't have access to a DataBase for this. So I thought might be a good
idea write to a file in the server the IP, then perform some if to
know if the user already replied the form.

As far as I don't know which is the best way to code this, I felt free
to ask you guys.

Thanks a lot.

Juan

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



Re: [PHP] Another parse problem

2010-06-16 Thread Robert Cummings



Daniel P. Brown wrote:

On Wed, Jun 16, 2010 at 13:22, tedd tedd.sperl...@gmail.com wrote:

The given was to parse domain-names, but both routines pulled out
sub-domains as well. Perhaps I am wrong in my understanding of what a domain
name is, but I would normally look at sub domains as not part of the domain
name. Sub domains are simply extensions of the domain name, am I right or
wrong?


Technically, a domain name is anything from the TLD and SLD levels
and below.  An FQDN (commonly called a hostname) is in the format
cname.sld.tld.


Additionally, extracting top level domains is not so simple since it may 
have 2 or more parts.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



[PHP] Re: Another parse problem

2010-06-16 Thread Shawn McKenzie
On 06/14/2010 08:14 AM, tedd wrote:
 Hi gang:
 
 Considering all the recent parsing, here's another problem to consider
 -- given any text, parse the domain-names out of it.
 
 You may limit the parsing to the most popular TDL's, such as .com, .net,
 and .org, but the finished result should be an array containing all the
 domain-names found in a text file.
 
 Cheers,
 
 tedd


Not extensively tested:

$domains = array();

if(preg_match_all('/[A-Za-z0-9][-A-Za-z0-9\.]*?\.(com|net|org)/i',
$text, $matches)) {
$domains = array_unique($matches[0]);
}

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

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



Re: [PHP] Another parse problem

2010-06-16 Thread Daniel P. Brown
On Wed, Jun 16, 2010 at 15:52, Robert Cummings rob...@interjinn.com wrote:

 Additionally, extracting top level domains is not so simple since it may
 have 2 or more parts.

*Gasp!*  The Great Cummings is incorrect.

/me faints.

Actually, ccTLD's are just the very last group of letters.  For
example, .il, .uk, and .br.  However, the ICANN, registrar policies,
or sponsorship requirements for some of them require the use of an SLD
as well.  For example, .co.il, .org.uk, and .com.br, respectively.
Some ccTLDs offer the SLD options, but don't require them.  For
example, you can register .co.in, .firm.in, .gen.in, or any other
available SLD+ccTLD, or just the ccTLD .in itself.

Still others have no such requirement or even official SLD
endorsements, such as good ol' Canada (Land of Clan Cummings),
Ireland, and here in the US.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!

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



RE: [PHP] User's IP Validation

2010-06-16 Thread Ashley Sheridan
On Wed, 2010-06-16 at 20:36 +0200, David Cesal wrote:

 Please, don't forget IP address can be same for many users. I see only way 
 with cookies. When user deletes cookies, form pops up again. I don't know any 
 better way.
 
 David
 
 Sent from my HTC
 
 -Original Message-
 From: Juan Rodriguez Monti j...@rodriguezmonti.com.ar
 Sent: 16. cervna 2010 20:26
 To: php-general@lists.php.net
 Subject: [PHP] User's IP Validation
 
 Hi people,
 I would like to know the best way to perform some kind of validation
 for an application that I've written.
 
 I have a system that ask through an HTML Form some questions to users.
 I use some cookies to save some information from the user side.
 
 However, I would like to implement some code in PHP that would let me
 limit to 1 the number of times that the page with the questions was
 executed.
 
 I mean, the user fills the HTML's Form, then send it through an HTML
 Button, then PHP receives this informations and send an Email
 containing the replies to the questions. I would like to limit to one,
 the times one single user is able to execute this form.
 
 I thought getting the IP Address, then doing some kind of validation
 with it. However I don't know if using cookies is the best idea. I
 don't have access to a DataBase for this. So I thought might be a good
 idea write to a file in the server the IP, then perform some if to
 know if the user already replied the form.
 
 As far as I don't know which is the best way to code this, I felt free
 to ask you guys.
 
 Thanks a lot.
 
 Juan
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 


Like others have said, unless you have specific user logins, there's no
way to prevent people from viewing the form more than once. As you are
emailing them the answers, I assume there is some form of login system
being used, so you could use that, with some sort of flag to indicate
the email has been sent. If you want to future-proof the system, you
could use some sort of binary bit flag to indicate what forms they've
been sent answers to, for example:

0 - no answers have been sent
1 - only the first set of answers
4 - the 3rd set of answers only
5 - the 3rd and 1st set of answers

etc. This would allow you to use one field to hold sent info on as many
forms as you need.

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




Re: [PHP] Another parse problem

2010-06-16 Thread Robert Cummings

Daniel P. Brown wrote:

On Wed, Jun 16, 2010 at 15:52, Robert Cummings rob...@interjinn.com wrote:

Additionally, extracting top level domains is not so simple since it may
have 2 or more parts.


*Gasp!*  The Great Cummings is incorrect.

/me faints.

Actually, ccTLD's are just the very last group of letters.  For
example, .il, .uk, and .br.  However, the ICANN, registrar policies,
or sponsorship requirements for some of them require the use of an SLD
as well.  For example, .co.il, .org.uk, and .com.br, respectively.
Some ccTLDs offer the SLD options, but don't require them.  For
example, you can register .co.in, .firm.in, .gen.in, or any other
available SLD+ccTLD, or just the ccTLD .in itself.

Still others have no such requirement or even official SLD
endorsements, such as good ol' Canada (Land of Clan Cummings),
Ireland, and here in the US.


Hahah, I can't be right all the time :D I didn't mean to use TLD, I 
meant to use domain name, but not including sub-domained names :) I 
don't even know what that is rightly called to exclude sub-domains. 
Anyways, those, by virtue of your above description can have two or more 
parts and there's not a simple way to extract that part without also 
extracting the sub-domain portions.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] Another parse problem

2010-06-16 Thread Daniel Brown
On Wed, Jun 16, 2010 at 21:42, Robert Cummings rob...@interjinn.com wrote:
[snip!]
 Anyways, those, by
 virtue of your above description can have two or more parts and there's not
 a simple way to extract that part without also extracting the sub-domain
 portions.

True.  Not without some static rules and logic, including
knowledge of which ccTLDs have required or potential country-wide
SLDs.  Though I think the solutions provided by yourself, Shawn, and
myself would suffice for most situations.  I'm hoping Tedd will share
his as well.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!

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