php-general Digest 9 Jul 2010 10:12:24 -0000 Issue 6837

2010-07-09 Thread php-general-digest-help

php-general Digest 9 Jul 2010 10:12:24 - Issue 6837

Topics (messages 306762 through 306782):

Re: Simple XML - problem with errors
306762 by: Marc Guay
306763 by: Gary .
306764 by: Richard Quadling
306765 by: Marc Guay
306766 by: Nisse Engström
306774 by: Gary .
306775 by: Gary .
306776 by: Gary .
306779 by: Richard Quadling

Login using just cookies, bad idea?
306767 by: Michael Calkins
306770 by: Ashley Sheridan
306778 by: Adam Richardson

Re: Setting up a XDebug debugging environment for PHP / WAMP / Eclipse PDT
306768 by: Adam Richardson

MSSQL failing.
306769 by: Paul Halliday
306773 by: Tommy Pham
306777 by: Andrew Ballard
306782 by: Paul Halliday

Re: Date Test...
306771 by: Ashley Sheridan
306772 by: Don Wieland

validating form input
306780 by: David Mehler
306781 by: Michael Shadle

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---
  I wonder what the difference is between doing new
 SimpleXMLElement and calling simplexml_load_string which results in the
 libxml_use_internal_errors call being ineffective. Odd.

The documentation for Dealing with XML errors only mentions
simplexml_load_string() and this comment
http://ca3.php.net/manual/en/simplexml.examples-basic.php#93263 shows
that you're not the first person to run into this.

Marc
---End Message---
---BeginMessage---
Okay. At least one of the problems with this so called HTML seems to
be that the body tag looks like
BODY vlink=#ff ...
and xml_parse complains that  required on that line (i.e. it is
claiming it can't find the end of the tag!).

I'm guessing that those attributes must be quoted in XML and
should be in HTML (but patently aren't)? Is there any way to get
xml_parse to ignore that? My element_handler functions never even get
a chance to see that line.

Regex to insert quotes or remove the attributes entirely, perhaps?
*gulp* I hope there's a better way than that.
---End Message---
---BeginMessage---
On 8 July 2010 16:15, Gary . php-gene...@garydjones.name wrote:
 Okay. At least one of the problems with this so called HTML seems to
 be that the body tag looks like
 BODY vlink=#ff ...
 and xml_parse complains that  required on that line (i.e. it is
 claiming it can't find the end of the tag!).

 I'm guessing that those attributes must be quoted in XML and
 should be in HTML (but patently aren't)? Is there any way to get
 xml_parse to ignore that? My element_handler functions never even get
 a chance to see that line.

 Regex to insert quotes or remove the attributes entirely, perhaps?
 *gulp* I hope there's a better way than that.

So. Essentially, you want to parse some plain text which may or may
not be well formed XML.

In short ... good luck.

How badly formed is the file going to be?

If it is things like missing , then this could be managed with regex.
Essentially you are going to have to do the clean up that Tidy could
do for you.
---End Message---
---BeginMessage---
 And yes, I'd rather use DOM, but I can't.

Could you use this: http://simplehtmldom.sourceforge.net/?
---End Message---
---BeginMessage---
On Thu, 8 Jul 2010 17:15:02 +0200, Gary . wrote:

 Okay. At least one of the problems with this so called HTML seems to
 be that the body tag looks like
 BODY vlink=#ff ...
 and xml_parse complains that  required on that line (i.e. it is
 claiming it can't find the end of the tag!).
 
 I'm guessing that those attributes must be quoted in XML and
 should be in HTML (but patently aren't)?

For that attribute value, it's a must in both cases.
And for strict versions of (X)HTML, the attribute does
not exist at all.


/Nisse
---End Message---
---BeginMessage---
On 7/8/10, Richard Quadling wrote:
 On 8 July 2010 16:15, Gary wrote:
 Okay. At least one of the problems with this so called HTML seems to
 be that the body tag looks like
 BODY vlink=#ff ...
 and xml_parse complains that  required on that line (i.e. it is
 claiming it can't find the end of the tag!).

 I'm guessing that those attributes must be quoted in XML and
 should be in HTML (but patently aren't)? Is there any way to get
 xml_parse to ignore that? My element_handler functions never even get
 a chance to see that line.

 Regex to insert quotes or remove the attributes entirely, perhaps?
 *gulp* I hope there's a better way than that.

 So. Essentially, you want to parse some plain text which may or may
 not be well formed XML.

No. I don't *want* to And it isn't plain text, it's just sh*t html
(no doctype,  missing closing tags in some cases, etc. It's an
absolute mess). Browsers 

Re: [PHP] MSSQL failing.

2010-07-09 Thread Paul Halliday

 What am I missing?


 Is the slash before the domain name above just a typo in your e-mail?
 It took a while to get mssql configured to where I could test it here
 since we're using Microsoft's SQL Server Driver for PHP (if you are
 running PHP under Windows, I'd strongly recommend this over the old
 mssql library anyway), but this worked:

 ?php

 $hostname = 'hostname:1433';

 $username = 'DOMAIN\Username';
 $password = 'password';

 $conn = mssql_connect($hostname, $username, $password) or die('Unable
 to connect');

 var_dump($conn);

 ?

 Andrew


It was a typo :) The installation is running on FreeBSD. I am looking
at TDS right now as a possible cause.

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



Re: [PHP] MSSQL failing.

2010-07-09 Thread Paul Halliday
On Fri, Jul 9, 2010 at 7:12 AM, Paul Halliday paul.halli...@gmail.com wrote:

 What am I missing?


 Is the slash before the domain name above just a typo in your e-mail?
 It took a while to get mssql configured to where I could test it here
 since we're using Microsoft's SQL Server Driver for PHP (if you are
 running PHP under Windows, I'd strongly recommend this over the old
 mssql library anyway), but this worked:

 ?php

 $hostname = 'hostname:1433';

 $username = 'DOMAIN\Username';
 $password = 'password';

 $conn = mssql_connect($hostname, $username, $password) or die('Unable
 to connect');

 var_dump($conn);

 ?

 Andrew


 It was a typo :) The installation is running on FreeBSD. I am looking
 at TDS right now as a possible cause.


Got it:

In /usr/local/etc/freetds.conf:

[global]
   host = 10.x.x.x
   port = 1433
   client charset = UTF-8
   tds version = 8.0
   text size = 20971520

Thanks.

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



Re: [PHP] State and City Database

2010-07-09 Thread Thijs Lensselink

On 07/07/2010 10:02 PM, tedd wrote:

Hi gang:

Does anyone have a source for a US State and City database?

Cheers,

tedd
   


Hey Tedd,

Maybe this helps. I used the data files for some other projects..

http://earth-info.nga.mil/gns/html/
http://geonames.usgs.gov/



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



Re: [PHP] MSSQL failing.

2010-07-09 Thread Andrew Ballard
On Fri, Jul 9, 2010 at 7:10 AM, Paul Halliday paul.halli...@gmail.com wrote:
 On Fri, Jul 9, 2010 at 7:12 AM, Paul Halliday paul.halli...@gmail.com wrote:
 It was a typo :) The installation is running on FreeBSD. I am looking
 at TDS right now as a possible cause.


 Got it:

 In /usr/local/etc/freetds.conf:

 [global]
       host = 10.x.x.x
       port = 1433
       client charset = UTF-8
       tds version = 8.0
       text size = 20971520

 Thanks.


I'm glad you got it working. That's pretty much what I found when I
tried to set it up here as well. I left the host and port out of my
freetds.conf file, though.


Andrew

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



Re: [PHP] State and City Database

2010-07-09 Thread tedd

At 2:07 PM +0200 7/9/10, Thijs Lensselink wrote:

On 07/07/2010 10:02 PM, tedd wrote:

Hi gang:

Does anyone have a source for a US State and City database?

Cheers,

tedd



Hey Tedd,

Maybe this helps. I used the data files for some other projects..

http://earth-info.nga.mil/gns/html/
http://geonames.usgs.gov/


LOL

Did you look at the name of the Executive Secretary on that page? 
Being dyslexic, I immediately read You Lost, which seemed ironic 
for the USGS.


I know I asked in my post for US State and City database and did not 
mention zip codes, but that was something I was after as well.


Strangely enough, the USGS states that it's the U.S. Census Bureau 
who keeps the zip codes. But the U.S. Census Bureau says it's the US 
Postal Service and the US Postal Service points to private businesses 
such as:


http://www.zip-codes.com/

I was almost certain that the UP Postal Service had something, but I 
couldn't find it.


I'm not sure where I got my current database, but I think I'll just 
stick with it and allow the client to get a subscription for an 
update (if they want).


Here's an example of my copy working:

http://php1.net/b/zipcode-states/index.php

In any event, thanks for the link.

Cheers,

tedd


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



[PHP] Last day to submit your Surge 2010 CFP!

2010-07-09 Thread Jason Dixon
Today is your last chance to submit a CFP abstract for the 2010 Surge
Scalability Conference.  The event is taking place on Sept 30 and Oct 1,
2010 in Baltimore, MD.  Surge focuses on case studies that address
production failures and the re-engineering efforts that led to victory
in Web Applications or Internet Architectures.

You can find more information, including suggested topics and our
current list of speakers, online:

http://omniti.com/surge/2010

The final lineup should be available on the conference website next
week.  If you have questions about the CFP, attending Surge, or having
your business sponsor/exhibit at Surge 2010, please contact us at
su...@omniti.com.

Thanks!

-- 
Jason Dixon
OmniTI Computer Consulting, Inc.
jdi...@omniti.com
443.325.1357 x.241

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



[PHP] Re: validating form input

2010-07-09 Thread Shawn McKenzie
On 07/08/2010 02:38 PM, David Mehler wrote:
 Hello,
 Got a form that takes in data to enter in to a database. I want to
 make it as secure and as invulnerable to sql injection and other
 attacks as possible. I'm wondering if mysqli_real_escape_string or
 stripslashes should be used or if the former does the latter. For
 example, I have a name variable:
 

In general this is fine:

 $name = mysqli_real_escape_string($DatabaseLink, trim($_POST['name']));
 
 or should I do:

You need to do something like this only if magic_quotes are enabled on
your PHP installation, except you would stripslashes first:

if(get_magic_quotes_gpc()) {
   $_POST['name'] = stripslashes($_POST['name']);
}
$name = mysqli_real_escape_string($DatabaseLink, trim($_POST['name']));

 
 $name = stripslashes(mysqli_real_escape_string($dbc, trim($_POST['name'])));
 
 Thanks.
 Dave.


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

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



[PHP] Login In script quesitons

2010-07-09 Thread Gary
 include('includes/footer.inc.php');?/div
/div


/body
!-- InstanceEnd --/html



__ Information from ESET Smart Security, version of virus signature 
database 5265 (20100709) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Login In script quesitons

2010-07-09 Thread Richard Quadling
On 9 July 2010 16:42, Gary gp...@paulgdesigns.com wrote:
[snip]

Take a look at https://code.google.com/p/loginsystem-rd/

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



Re: [PHP] State and City Database

2010-07-09 Thread Paul M Foster
On Fri, Jul 09, 2010 at 10:43:09AM -0400, tedd wrote:


snip


 Here's an example of my copy working:

 http://php1.net/b/zipcode-states/index.php

Problem: the city and state select drop-downs won't stay dropped for me,
and won't accept anything but Lansing, Michigan. They don't drop down
long enough for me to select anything else. Zip drop down appears to
work okay.

Paul

-- 
Paul M. Foster

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



Re: [PHP] State and City Database

2010-07-09 Thread Jim Lucas
Paul M Foster wrote:
 On Fri, Jul 09, 2010 at 10:43:09AM -0400, tedd wrote:
 
 
 snip
 
 Here's an example of my copy working:

 http://php1.net/b/zipcode-states/index.php
 
 Problem: the city and state select drop-downs won't stay dropped for me,
 and won't accept anything but Lansing, Michigan. They don't drop down
 long enough for me to select anything else. Zip drop down appears to
 work okay.
 
 Paul
 

Similar issue here too.  But I can at least select a state (if I'm quick) and
then when I click on the city, the list blinks and then deletes the contents of
the state and zip code dropdown menus.

System: Windows XP SP3 + FF v3.5.3 w/Firebug

Checking with my Opera 9.24 install, seems to do something similar.  Timer is
very fast and it doesn't allow for me to click on anything.

-- 
Jim Lucas

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

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



Re: [PHP] State and City Database

2010-07-09 Thread Floyd Resler

On Jul 9, 2010, at 1:58 PM, Jim Lucas wrote:

 Paul M Foster wrote:
 On Fri, Jul 09, 2010 at 10:43:09AM -0400, tedd wrote:
 
 
 snip
 
 Here's an example of my copy working:
 
 http://php1.net/b/zipcode-states/index.php
 
 Problem: the city and state select drop-downs won't stay dropped for me,
 and won't accept anything but Lansing, Michigan. They don't drop down
 long enough for me to select anything else. Zip drop down appears to
 work okay.
 
 Paul
 
 
 Similar issue here too.  But I can at least select a state (if I'm quick) and
 then when I click on the city, the list blinks and then deletes the contents 
 of
 the state and zip code dropdown menus.
 
 System: Windows XP SP3 + FF v3.5.3 w/Firebug
 
 Checking with my Opera 9.24 install, seems to do something similar.  Timer is
 very fast and it doesn't allow for me to click on anything.
 
 -- 
 Jim Lucas
 

I tried it in Safari and it works just fine.

Take care,
Floyd



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



Re: [PHP] State and City Database

2010-07-09 Thread Jim Lucas
Floyd Resler wrote:
 On Jul 9, 2010, at 1:58 PM, Jim Lucas wrote:
 
 Paul M Foster wrote:
 On Fri, Jul 09, 2010 at 10:43:09AM -0400, tedd wrote:


 snip

 Here's an example of my copy working:

 http://php1.net/b/zipcode-states/index.php
 Problem: the city and state select drop-downs won't stay dropped for me,
 and won't accept anything but Lansing, Michigan. They don't drop down
 long enough for me to select anything else. Zip drop down appears to
 work okay.

 Paul

 Similar issue here too.  But I can at least select a state (if I'm quick) and
 then when I click on the city, the list blinks and then deletes the contents 
 of
 the state and zip code dropdown menus.

 System: Windows XP SP3 + FF v3.5.3 w/Firebug

 Checking with my Opera 9.24 install, seems to do something similar.  Timer is
 very fast and it doesn't allow for me to click on anything.

 -- 
 Jim Lucas

 
 I tried it in Safari and it works just fine.
 
 Take care,
 Floyd
 
 
 

Just for giggles, I downloaded and installed Safari just now v5.0 (7533.16) and
tried it.

The page is non functional.  The drop down menus exist, but when I select the
state in the state list, it doesn't update the city list or zip code list.  And
when I change the city, it doesn't update the zip code field.

-- 
Jim Lucas

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

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



Re: [PHP] State and City Database

2010-07-09 Thread Floyd Resler

On Jul 9, 2010, at 2:32 PM, Jim Lucas wrote:

 Floyd Resler wrote:
 On Jul 9, 2010, at 1:58 PM, Jim Lucas wrote:
 
 Paul M Foster wrote:
 On Fri, Jul 09, 2010 at 10:43:09AM -0400, tedd wrote:
 
 
 snip
 
 Here's an example of my copy working:
 
 http://php1.net/b/zipcode-states/index.php
 Problem: the city and state select drop-downs won't stay dropped for me,
 and won't accept anything but Lansing, Michigan. They don't drop down
 long enough for me to select anything else. Zip drop down appears to
 work okay.
 
 Paul
 
 Similar issue here too.  But I can at least select a state (if I'm quick) 
 and
 then when I click on the city, the list blinks and then deletes the 
 contents of
 the state and zip code dropdown menus.
 
 System: Windows XP SP3 + FF v3.5.3 w/Firebug
 
 Checking with my Opera 9.24 install, seems to do something similar.  Timer 
 is
 very fast and it doesn't allow for me to click on anything.
 
 -- 
 Jim Lucas
 
 
 I tried it in Safari and it works just fine.
 
 Take care,
 Floyd
 
 
 
 
 Just for giggles, I downloaded and installed Safari just now v5.0 (7533.16) 
 and
 tried it.
 
 The page is non functional.  The drop down menus exist, but when I select the
 state in the state list, it doesn't update the city list or zip code list.  
 And
 when I change the city, it doesn't update the zip code field.
 
 -- 
 Jim Lucas
 

That's weird.  I just tried again just to make sure I wasn't seeing things.  I 
selected Indiana and the city list populated with the cities from Indiana.  I 
then chose Indianapolis and the zip codes list populated with Indianapolis zip 
codes.  I'm using Safari 5 on the Mac.  I just tried in in Firefox 3.6.6 on my 
Mac and experienced the same thing you did - the state drop-down doesn't stay 
opened.  Really kind of odd, isn't it?!

Take care,
Floyd



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



Re: [PHP] State and City Database

2010-07-09 Thread tedd

To all:

http://php1.net/b/zipcode-states/index.php

I have not tried the state/city/zip demo with any other than the 
Safari browser. It works for that browser.


Sorry, I should have checked it out via other browsers before 
introducing it to the list.


I will work on it.

Cheers,

tedd

--
---
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] Login In script quesitons

2010-07-09 Thread Gary

Richard Quadling rquadl...@gmail.com wrote in message 
news:aanlktilbmyedd8paky9dwgn0q7t6kem4zzutu_49u...@mail.gmail.com...
 On 9 July 2010 16:42, Gary gp...@paulgdesigns.com wrote:
 [snip]

 Take a look at https://code.google.com/p/loginsystem-rd/


Richard

Thank you for your quick reply and the link.  Since I see you are one of the
creators, thank you for that as well.

I am getting the following error and I'm not sure how to correct it.

Warning: Cannot modify header information - headers already sent by (output
started at /home/content/45/6359745/html/login/include/loginGlobals.php:281)
in /home/content/45/6359745/html/login/include/form_token.php on line 15

Warning: Cannot modify header information - headers already sent by (output
started at /home/content/45/6359745/html/login/include/loginGlobals.php:281)
in /home/content/45/6359745/html/login/include/form_token.php on line 22

Line 15 is: setcookie(token, , time()-42000);
Line 22 is :if (setcookie(token, $_SESSION[token], time()+86400)) {

loginGlobals stops at line 278

Again, thank you for all your help.

gary






__ Information from ESET Smart Security, version of virus signature 
database 5266 (20100709) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Login In script quesitons

2010-07-09 Thread Ashley Sheridan
On Fri, 2010-07-09 at 15:43 -0400, Gary wrote:

 Richard Quadling rquadl...@gmail.com wrote in message 
 news:aanlktilbmyedd8paky9dwgn0q7t6kem4zzutu_49u...@mail.gmail.com...
  On 9 July 2010 16:42, Gary gp...@paulgdesigns.com wrote:
  [snip]
 
  Take a look at https://code.google.com/p/loginsystem-rd/
 
 
 Richard
 
 Thank you for your quick reply and the link.  Since I see you are one of the
 creators, thank you for that as well.
 
 I am getting the following error and I'm not sure how to correct it.
 
 Warning: Cannot modify header information - headers already sent by (output
 started at /home/content/45/6359745/html/login/include/loginGlobals.php:281)
 in /home/content/45/6359745/html/login/include/form_token.php on line 15
 
 Warning: Cannot modify header information - headers already sent by (output
 started at /home/content/45/6359745/html/login/include/loginGlobals.php:281)
 in /home/content/45/6359745/html/login/include/form_token.php on line 22
 
 Line 15 is: setcookie(token, , time()-42000);
 Line 22 is :if (setcookie(token, $_SESSION[token], time()+86400)) {
 
 loginGlobals stops at line 278
 
 Again, thank you for all your help.
 
 gary
 
 
 
 
 
 
 __ Information from ESET Smart Security, version of virus signature 
 database 5266 (20100709) __
 
 The message was checked by ESET Smart Security.
 
 http://www.eset.com
 
 
 
 
 


My guess is that you've put the login PHP code after some HTML in that
page? If you output any content at all (even a blank space) it will
output the default headers. What you need to do is have any logic that
includes a header() call before any output.

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




[PHP] Arrays passed to functions lose their indexing - how to maintain?

2010-07-09 Thread Marc Guay
Hi folks,

I have an array that looks a little something like this:

Array ( [6] = 43.712608, -79.360092 [7] = 43.674088, -79.388557 [8]
= 43.674088, -79.388557 [9] = 43.704666, -79.397873 [10] =
43.674393, -79.372147 )

but after I pass it to a function, it loses it's indexing and becomes:

Array ( [0] = 43.712608, -79.360092 [1] = 43.674088, -79.388557 [2]
= 43.674088, -79.388557 [3] = 43.704666, -79.397873 [4] =
43.674393, -79.372147 )

The indexing is important and I'd like to hang onto it.  Any ideas?  pointers?

Marc

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



Re: [PHP] Arrays passed to functions lose their indexing - how to maintain?

2010-07-09 Thread Ashley Sheridan
On Fri, 2010-07-09 at 15:55 -0400, Marc Guay wrote:

 Hi folks,
 
 I have an array that looks a little something like this:
 
 Array ( [6] = 43.712608, -79.360092 [7] = 43.674088, -79.388557 [8]
 = 43.674088, -79.388557 [9] = 43.704666, -79.397873 [10] =
 43.674393, -79.372147 )
 
 but after I pass it to a function, it loses it's indexing and becomes:
 
 Array ( [0] = 43.712608, -79.360092 [1] = 43.674088, -79.388557 [2]
 = 43.674088, -79.388557 [3] = 43.704666, -79.397873 [4] =
 43.674393, -79.372147 )
 
 The indexing is important and I'd like to hang onto it.  Any ideas?  
 pointers?
 
 Marc
 


Are you passing the array variable by reference? If so, it's probably
the logic of the function that is re-writing the keys. What does the
function look like?

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




Re: [PHP] Login In script quesitons

2010-07-09 Thread Gary

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:1278705035.2295.2.ca...@localhost...
 On Fri, 2010-07-09 at 15:43 -0400, Gary wrote:

 Richard Quadling rquadl...@gmail.com wrote in message
 news:aanlktilbmyedd8paky9dwgn0q7t6kem4zzutu_49u...@mail.gmail.com...
  On 9 July 2010 16:42, Gary gp...@paulgdesigns.com wrote:
  [snip]
 
  Take a look at https://code.google.com/p/loginsystem-rd/
 

 Richard

 Thank you for your quick reply and the link.  Since I see you are one of 
 the
 creators, thank you for that as well.

 I am getting the following error and I'm not sure how to correct it.

 Warning: Cannot modify header information - headers already sent by 
 (output
 started at 
 /home/content/45/6359745/html/login/include/loginGlobals.php:281)
 in /home/content/45/6359745/html/login/include/form_token.php on line 15

 Warning: Cannot modify header information - headers already sent by 
 (output
 started at 
 /home/content/45/6359745/html/login/include/loginGlobals.php:281)
 in /home/content/45/6359745/html/login/include/form_token.php on line 22

 Line 15 is: setcookie(token, , time()-42000);
 Line 22 is :if (setcookie(token, $_SESSION[token], time()+86400)) {

 loginGlobals stops at line 278

 Again, thank you for all your help.

 gary






 __ Information from ESET Smart Security, version of virus 
 signature database 5266 (20100709) __

 The message was checked by ESET Smart Security.

 http://www.eset.com







 My guess is that you've put the login PHP code after some HTML in that
 page? If you output any content at all (even a blank space) it will
 output the default headers. What you need to do is have any logic that
 includes a header() call before any output.

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

Ashley

I am aware of that would cause a problem.  I am not finding any html at all 
on either page.

Thanks for your reply.

Gary 



__ Information from ESET Smart Security, version of virus signature 
database 5266 (20100709) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Login In script quesitons

2010-07-09 Thread Ashley Sheridan
On Fri, 2010-07-09 at 15:58 -0400, Gary wrote:

 Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
 news:1278705035.2295.2.ca...@localhost...
  On Fri, 2010-07-09 at 15:43 -0400, Gary wrote:
 
  Richard Quadling rquadl...@gmail.com wrote in message
  news:aanlktilbmyedd8paky9dwgn0q7t6kem4zzutu_49u...@mail.gmail.com...
   On 9 July 2010 16:42, Gary gp...@paulgdesigns.com wrote:
   [snip]
  
   Take a look at https://code.google.com/p/loginsystem-rd/
  
 
  Richard
 
  Thank you for your quick reply and the link.  Since I see you are one of 
  the
  creators, thank you for that as well.
 
  I am getting the following error and I'm not sure how to correct it.
 
  Warning: Cannot modify header information - headers already sent by 
  (output
  started at 
  /home/content/45/6359745/html/login/include/loginGlobals.php:281)
  in /home/content/45/6359745/html/login/include/form_token.php on line 15
 
  Warning: Cannot modify header information - headers already sent by 
  (output
  started at 
  /home/content/45/6359745/html/login/include/loginGlobals.php:281)
  in /home/content/45/6359745/html/login/include/form_token.php on line 22
 
  Line 15 is: setcookie(token, , time()-42000);
  Line 22 is :if (setcookie(token, $_SESSION[token], time()+86400)) {
 
  loginGlobals stops at line 278
 
  Again, thank you for all your help.
 
  gary
 
 
 
 
 
 
  __ Information from ESET Smart Security, version of virus 
  signature database 5266 (20100709) __
 
  The message was checked by ESET Smart Security.
 
  http://www.eset.com
 
 
 
 
 
 
 
  My guess is that you've put the login PHP code after some HTML in that
  page? If you output any content at all (even a blank space) it will
  output the default headers. What you need to do is have any logic that
  includes a header() call before any output.
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 Ashley
 
 I am aware of that would cause a problem.  I am not finding any html at all 
 on either page.
 
 Thanks for your reply.
 
 Gary 
 
 
 
 __ Information from ESET Smart Security, version of virus signature 
 database 5266 (20100709) __
 
 The message was checked by ESET Smart Security.
 
 http://www.eset.com
 
 
 
 
 

What does your code look like now?

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




Re: [PHP] Login In script quesitons

2010-07-09 Thread Gary

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:1278705549.2295.4.ca...@localhost...
 On Fri, 2010-07-09 at 15:58 -0400, Gary wrote:

 Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
 news:1278705035.2295.2.ca...@localhost...
  On Fri, 2010-07-09 at 15:43 -0400, Gary wrote:
 
  Richard Quadling rquadl...@gmail.com wrote in message
  news:aanlktilbmyedd8paky9dwgn0q7t6kem4zzutu_49u...@mail.gmail.com...
   On 9 July 2010 16:42, Gary gp...@paulgdesigns.com wrote:
   [snip]
  
   Take a look at https://code.google.com/p/loginsystem-rd/
  
 
  Richard
 
  Thank you for your quick reply and the link.  Since I see you are one 
  of
  the
  creators, thank you for that as well.
 
  I am getting the following error and I'm not sure how to correct it.
 
  Warning: Cannot modify header information - headers already sent by
  (output
  started at
  /home/content/45/6359745/html/login/include/loginGlobals.php:281)
  in /home/content/45/6359745/html/login/include/form_token.php on line 
  15
 
  Warning: Cannot modify header information - headers already sent by
  (output
  started at
  /home/content/45/6359745/html/login/include/loginGlobals.php:281)
  in /home/content/45/6359745/html/login/include/form_token.php on line 
  22
 
  Line 15 is: setcookie(token, , time()-42000);
  Line 22 is :if (setcookie(token, $_SESSION[token], time()+86400)) 
  {
 
  loginGlobals stops at line 278
 
  Again, thank you for all your help.
 
  gary
 
 
 
 
 
 
  __ Information from ESET Smart Security, version of virus
  signature database 5266 (20100709) __
 
  The message was checked by ESET Smart Security.
 
  http://www.eset.com
 
 
 
 
 
 
 
  My guess is that you've put the login PHP code after some HTML in that
  page? If you output any content at all (even a blank space) it will
  output the default headers. What you need to do is have any logic that
  includes a header() call before any output.
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk

 Ashley

 I am aware of that would cause a problem.  I am not finding any html at 
 all
 on either page.

 Thanks for your reply.

 Gary



 __ Information from ESET Smart Security, version of virus 
 signature database 5266 (20100709) __

 The message was checked by ESET Smart Security.

 http://www.eset.com






 What does your code look like now?

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


Ashley

This is form_token.php

?php
if (!isset($_SESSION)) {
 session_start();
}
?
?php

function generateToken(){
 
/*
 * Create and set a new token for CSRF protection * on initial entry or after 
form errors and we are going to redisplay theform. 
**/
 $salt=; $tokenStr=; $salt = sha1($_SERVER[HTTP_HOST]); 
setcookie(token, , time()-42000); $_SESSION[salt]=$salt; 
$_SESSION[guid] = getGUID(); $_SESSION[ip] = $_SERVER[REMOTE_ADDR]; 
$_SESSION[time] = time(); $tokenStr = IP: . $_SESSION[ip] . ,SESSIONID: 
. session_id() .,GUID: . $_SESSION[guid]; 
$_SESSION[token]=sha1(($tokenStr.$_SESSION[salt]).$_SESSION[salt]); if 
(setcookie(token, $_SESSION[token], time()+86400)) {  
$_SESSION[usecookie]=True; }}function checkToken() { 
/*
 * Check the posted token for correctness 
**/
 $oldToken=; $testToken=; $tokenStr=; 
$page=basename($_SERVER['PHP_SELF']); $oldToken=$_POST[token]; $tokenStr = 
IP: . $_SESSION[ip] . ,SESSIONID: . session_id() .,GUID: . 
$_SESSION[guid]; 
$testToken=sha1(($tokenStr.$_SESSION[salt]).$_SESSION[salt]); 
$checkToken=False; If ($oldToken===$testToken) { $diff = time() - 
$_SESSION[time];  If ($diff=300) { // Five minutes max  If 
($_SESSION[usecookie]) {   If ($_COOKIE[token]===$oldToken) {
/*
 * Destroy the old form token, then * generate a new token for the 
form, which may or may not be needed. Wewant to do this * before headers 
are written. When writeToken() or writeTokenH() iscalled we are only * 
writing the pre-generated token to the form. The cookie will havealready been 
written. 
**/
 setcookie(token, '', time()-42000); generateToken(); return 
true;}else{ $_SESSION = array();   if 
(isset($_COOKIE[session_name()])) { setcookie(session_name(), '', 
time()-42000); } session_destroy(); header(Location: http://;. 
lg_domain . lg_form_error .?p= . $page .t=ec);}   }else{  return 
True; }}else{ $_SESSION = array(); if 
(isset($_COOKIE[session_name()])) {   setcookie

Re: [PHP] Login In script quesitons

2010-07-09 Thread Ashley Sheridan
On Fri, 2010-07-09 at 16:04 -0400, Gary wrote:

 ?
 ?php


That bit of the code has a newline in it, which counts as output :p

I've not looked over the rest yet, but see if that helps.

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




Re: [PHP] Arrays passed to functions lose their indexing - how to maintain?

2010-07-09 Thread Marc Guay
My bad, I had some leftover code running array_values() on it before
it got passed.

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



Re: [PHP] Login In script quesitons

2010-07-09 Thread Gary

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:1278706121.2295.5.ca...@localhost...
 On Fri, 2010-07-09 at 16:04 -0400, Gary wrote:

 ?
 ?php


 That bit of the code has a newline in it, which counts as output :p

 I've not looked over the rest yet, but see if that helps.

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

Ashley

Actually I had added that closing and opening tag in trying to solve the 
problem, I put it back and still have the issue.

I looked at the code as it looks on the board, would it be easier if I sent 
you the files?

Thanks again.

Gary 



__ Information from ESET Smart Security, version of virus signature 
database 5266 (20100709) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Login In script quesitons

2010-07-09 Thread Gary
Ashley  Richard

I think I found the issue.

In loginGlobals.php, the error was pointing to line 281, when the code 
stopped and 278. (I know most of the time this just means there is a missing 
bracket or semi-colon in the code), however, what I did is put my curser on 
link 281, backspaced to eliminate white space, and it seems to be working.

I will let you know if this is just premature exhuberation.

Thanks again for all your help.

Gary


Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:1278706121.2295.5.ca...@localhost...
 On Fri, 2010-07-09 at 16:04 -0400, Gary wrote:

 ?
 ?php


 That bit of the code has a newline in it, which counts as output :p

 I've not looked over the rest yet, but see if that helps.

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





 __ Information from ESET Smart Security, version of virus 
 signature database 5266 (20100709) __

 The message was checked by ESET Smart Security.

 http://www.eset.com

 



__ Information from ESET Smart Security, version of virus signature 
database 5266 (20100709) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



RE: [PHP] State and City Database

2010-07-09 Thread Tommy Pham
 -Original Message-
 From: tedd [mailto:tedd.sperl...@gmail.com]
 Sent: Friday, July 09, 2010 12:17 PM
 To: PHP
 Subject: Re: [PHP] State and City Database
 
 To all:
 
 http://php1.net/b/zipcode-states/index.php
 
 I have not tried the state/city/zip demo with any other than the Safari
 browser. It works for that browser.
 
 Sorry, I should have checked it out via other browsers before introducing
it to
 the list.
 
 I will work on it.
 
 Cheers,
 
 tedd
 
 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com
 


Tedd,

Looking at your source, shouldn't be 'onChange' instead of 'onClick'  for
the selects?

Regards,
Tommy


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



RE: [PHP] State and City Database

2010-07-09 Thread Tommy Pham
 -Original Message-
 From: Tommy Pham [mailto:tommy...@gmail.com]
 Sent: Friday, July 09, 2010 3:15 PM
 To: 'PHP'
 Subject: RE: [PHP] State and City Database
 
  -Original Message-
  From: tedd [mailto:tedd.sperl...@gmail.com]
  Sent: Friday, July 09, 2010 12:17 PM
  To: PHP
  Subject: Re: [PHP] State and City Database
 
  To all:
 
  http://php1.net/b/zipcode-states/index.php
 
  I have not tried the state/city/zip demo with any other than the
  Safari browser. It works for that browser.
 
  Sorry, I should have checked it out via other browsers before
  introducing it to the list.
 
  I will work on it.
 
  Cheers,
 
  tedd
 
  --
  ---
  http://sperling.com  http://ancientstones.com  http://earthstones.com
 
 
 
 Tedd,
 
 Looking at your source, shouldn't be 'onChange' instead of 'onClick'  for
the
 selects?
 
 Regards,
 Tommy

Sorry, force of habit camel case... :)  I meant 'onchange' instead of
'onclick'.


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



[PHP] SOAPParam - Does it possible?

2010-07-09 Thread Augusto Flavio
Hi,



I'm creating a wsdl server but I have one doubt about the
soapparam::soapparam().


I want to know how to return several parameters using the
soapparam::soapparam().


I'm doing this:


class MyApi implements API {

  public function Send($param) {
  $resp = array('resposta' = 'works', 'events' = array ('from' = 'smith',
'text' = 'Hello world', 'to' = 'john'));
  return new SoapParam($resp, 'events');
  }

Looking in the php.net Docs the soapparam() has this definition:

*SoapParam::SoapParam* (
mixedhttp://br3.php.net/manual/en/language.pseudo-types.php#language.types.mixed
$data , string $name )

 *data*

The data to pass or return. This parameter can be passed directly as PHP
value, but in this case it will be named as *paramN* and the SOAP service
may not understand it.
 *name*

The parameter name.

But How can I return the entire array: $resp = array('resposta' = 'works',
'events' = array ('from' = 'smith', 'text' = 'Hello world', 'to' =
'john')); ?


Looks this wsdl schema in this email

I think you will understand more about my problem.

Thanks



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

Re: [PHP] State and City Database

2010-07-09 Thread Jason Pruim


On Jul 9, 2010, at 10:43 AM, tedd wrote:


At 2:07 PM +0200 7/9/10, Thijs Lensselink wrote:

On 07/07/2010 10:02 PM, tedd wrote:

Hi gang:

Does anyone have a source for a US State and City database?

Cheers,

tedd



Hey Tedd,

Maybe this helps. I used the data files for some other projects..

http://earth-info.nga.mil/gns/html/
http://geonames.usgs.gov/


LOL

Did you look at the name of the Executive Secretary on that page?  
Being dyslexic, I immediately read You Lost, which seemed ironic  
for the USGS.


I know I asked in my post for US State and City database and did not  
mention zip codes, but that was something I was after as well.


Strangely enough, the USGS states that it's the U.S. Census Bureau  
who keeps the zip codes. But the U.S. Census Bureau says it's the US  
Postal Service and the US Postal Service points to private  
businesses such as:


http://www.zip-codes.com/

I was almost certain that the UP Postal Service had something, but I  
couldn't find it.


I'm not sure where I got my current database, but I think I'll just  
stick with it and allow the client to get a subscription for an  
update (if they want).


Hey tedd,

the US Postal Service does control the Zip Codes... The reason you  
couldn't get anything out of them is they do not publicly sell or give  
that data out to anyone except for a few private businesses who resell  
it... One of the best/cheapest sources I've found for mailing lists  
(it includes the actual delivery address plus the city, state,  zip)  
is melissadata.com.


Although it's not free nor exactly what you asked for they may be able  
to point you in a better direction to get exactly what you want.


If you need any additional help let me know. My day job is working  
directly with the post office and mailing lists :)




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