Re: [PHP] https question

2013-09-25 Thread Joshua Kehn
On Sep 25, 2013, at 1:55 PM, Tedd Sperling t...@sperling.com wrote:

 Hi gang:
 
 I have a client who had his entire site moved to another host -- no big 
 problem.
 
 However, the old site had a https directory, where I had secure scripts to do 
 credit-card transactions, but the new site doesn't have a https directory -- 
 in fact it doesn't even have a http directory at all. So, what options do I 
 have to do secure transactions?
 
 I remember someone saying that this could be done via a .htaccess file, but I 
 don't have the code, nor am I positive this is the answer.
 
 What do you recommend?
 
 Thanks,
 
 tedd

Did you setup the server (Apache / nginx) configuration? The entire site should 
be served under https if you're doing CC processing

Best,

–Josh

Joshua Kehn | @joshkehn 
http://joshuakehn.com


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



Re: [PHP] https question

2013-09-25 Thread Tedd Sperling
On Sep 25, 2013, at 1:58 PM, Joshua Kehn josh.k...@gmail.com wrote:

 On Sep 25, 2013, at 1:55 PM, Tedd Sperling t...@sperling.com wrote:
 
 Hi gang:
 
 I have a client who had his entire site moved to another host -- no big 
 problem.
 
 However, the old site had a https directory, where I had secure scripts to 
 do credit-card transactions, but the new site doesn't have a https directory 
 -- in fact it doesn't even have a http directory at all. So, what options do 
 I have to do secure transactions?
 
 I remember someone saying that this could be done via a .htaccess file, but 
 I don't have the code, nor am I positive this is the answer.
 
 What do you recommend?
 
 Thanks,
 
 tedd
 
 Did you setup the server (Apache / nginx) configuration? The entire site 
 should be served under https if you're doing CC processing
 
 Best,
 
 –Josh

I understand that cc processing should be done via https.

Normally, that means to me that I place my $ scripts in a https directory -- 
the problem is that I don't have one with this host.

So, I am asking how does one do that with a https directory?

Thanks,

tedd
___
tedd sperling
tedd.sperl...@gmail.com


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



Re: [PHP] https question

2013-09-25 Thread Joshua Kehn
On Sep 25, 2013, at 2:24 PM, Tedd Sperling tedd.sperl...@gmail.com wrote:
 
 I understand that cc processing should be done via https.
 
 Normally, that means to me that I place my $ scripts in a https directory -- 
 the problem is that I don't have one with this host.
 
 So, I am asking how does one do that with a https directory?
 
 Thanks,
 
 tedd
 ___
 tedd sperling
 tedd.sperl...@gmail.com
 


I'm saying the site should be served entirely under HTTPS. There shouldn't be 
separate https/http directories. Apache (or whatever your web server is) has a 
certificate installed on it and that vhost is configured to only respond to 
https requests. Typically this also means running a separate vhost on http that 
redirects to the https variant.

Where is this new host? It should be a dedicated box (vps or other) due to how 
the certificates need to be issued (dedicated ip address).

Best,

–Josh

Joshua Kehn | @joshkehn 
http://joshuakehn.com


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



Re: [PHP] https question

2013-09-25 Thread Daniel Brown
On Wed, Sep 25, 2013 at 1:55 PM, Tedd Sperling t...@sperling.com wrote:
 Hi gang:

 I have a client who had his entire site moved to another host -- no big 
 problem.

 However, the old site had a https directory, where I had secure scripts to do 
 credit-card transactions, but the new site doesn't have a https directory -- 
 in fact it doesn't even have a http directory at all. So, what options do I 
 have to do secure transactions?

 I remember someone saying that this could be done via a .htaccess file, but I 
 don't have the code, nor am I positive this is the answer.

 What do you recommend?

Sounds like it may have been moved from a Plesk server to a
non-Plesk server (or something using a similar path setup).  If it's
still Apache-based, yes, an .htaccess mod_rewrite directive should
suffice.  And, while it's out-of-scope for this list, an example, for
posterity:

# .htaccess - placed in the web root
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [QSA,R,L]


-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Friday's Question

2013-09-23 Thread Eric K. Dickinson

54, Only when the surface of the desk is problematic.

On 09/20/2013 12:58 PM, Larry Martell wrote:

On Fri, Sep 20, 2013 at 10:51 AM, Tedd Sperling t...@sperling.com wrote:

Hi gang:

Do you use a Mousepad?

My reason for asking is that I've used a Mousepad ever since mice first came 
out (back when they had one ball).

Now that mice are optical (no balls), Mousepads are not really needed -- or so 
I'll told by the college -- you see, they don't provide Mousepads for their 
student's computers.

As such, I wondered what's the percentage of programmers still using a Mousepad?

Secondly, are Mousepads used primarily by older programmers (like me) while 
younger programmers don't use Mousepads, or what?

So -- please respond with:

Age: *
Mousepad: Yes/No


54 Yes



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



Re: [PHP] Friday's Question

2013-09-21 Thread Ashley Sheridan
On Sat, 2013-09-21 at 11:07 +1000, Daniel wrote:

 25 network admin and programmer and yes I use a mouse pad - my mouse
 hates me if I dont use it.
 
 -- 
 Regards,
 Daniel Fenn
 


29 and don't use a mouse pad right now, although I did before I moved
because the surface of my desk was too shiny. That's the only reason I
ever use one now.

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




RE: [PHP] Friday's Question

2013-09-20 Thread Jen Rasmussen


-Original Message-
From: larry.mart...@gmail.com [mailto:larry.mart...@gmail.com] On Behalf Of 
Larry Martell
Sent: Friday, September 20, 2013 12:26 PM
To: j...@cetaceasound.com
Cc: Tedd Sperling; PHP General
Subject: Re: [PHP] Friday's Question

On Fri, Sep 20, 2013 at 11:20 AM, Jen Rasmussen j...@cetaceasound.com wrote:
 -Original Message-
 What in the heck is a Bag Bomb?

It's a salve for cow udders. Not sure what a person would do with it.


Ha! Interesting. Thanks :)


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



Re: [PHP] Friday's Question

2013-09-20 Thread Larry Martell
On Fri, Sep 20, 2013 at 11:35 AM, Joshua Kehn josh.k...@gmail.com wrote:
 On Sep 20, 2013, at 1:26 PM, Larry Martell la...@software-horizons.com 
 wrote:

 On Fri, Sep 20, 2013 at 11:24 AM, Joshua Kehn josh.k...@gmail.com wrote:


 Slightly snobbish solution: Don't use windows.

 Unfortunately required to VPN into most of my clients corporate networks.

 Windows is required to VPN in? I'm guessing they use some proprietary client 
 then? --jk

Yes, and/or they validate the host ID, and/or there's some soft key
RSA thing involved.

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



Re: [PHP] Friday's Question

2013-09-20 Thread Joshua Kehn
On Sep 20, 2013, at 1:04 PM, Daniel Brown danbr...@php.net wrote:

I'm in my mid-thirties and - despite having an optical mouse - I
 do indeed still use a mousepad.  A customized one that the wife did
 for me for Christmas one year: images of Futurama, the Cleveland
 Browns, Minnesota Vikings, and several aircraft, all surrounding a
 picture of her and our daughter.  I've found that shiny surfaces -
 such as my desk - reflect too much of the laser, causing the mouse to
 be far less responsive.
 
 -- 
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/

I'm in my 20's and rarely, if ever, use a dedicated mouse. I've transitioned to 
having all my workstations be laptops of one sort or another and they have 
built-in trackpads. Of course I also rarely use the mouse when there are so 
many keyboard shortcuts available.

Best,

–Josh

Joshua Kehn | @joshkehn 
http://joshuakehn.com

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



Re: [PHP] Friday's Question

2013-09-20 Thread Kirk . Johnson
Tedd Sperling t...@sperling.com wrote on 09/20/2013 10:51:49 AM:

 Do you use a Mousepad?

[-snip-]

Age: Bag Bomb
Mousepad: Yes

Padding for my wrist and quieter moving the mouse around - no scraping. So 
yes, I'm even too old to be plugged into an iPud or an iPeed, whatever 
they are :)

Kirk


RE: [PHP] Friday's Question

2013-09-20 Thread Jeff Burcher
 -Original Message-
 From: Tedd Sperling [mailto:t...@sperling.com]
 Sent: Friday, September 20, 2013 12:52 PM
 To: php-general@lists.php.net
 Subject: [PHP] Friday's Question
 
 Hi gang:
 
 Do you use a Mousepad?
 
 My reason for asking is that I've used a Mousepad ever since mice first
came
 out (back when they had one ball).
 
 Now that mice are optical (no balls), Mousepads are not really needed --
or
 so I'll told by the college -- you see, they don't provide Mousepads for
their
 student's computers.
 
 As such, I wondered what's the percentage of programmers still using a
 Mousepad?
 
 Secondly, are Mousepads used primarily by older programmers (like me)
 while younger programmers don't use Mousepads, or what?
 
 So -- please respond with:
 
 Age: *
 Mousepad: Yes/No
 
 Thank you,
 
 tedd
 
 PS: * If you don't want to provide your actual age, then indicate your age
by
 stating young, middle-age, old-age, ancient, or whatever term
 describes your age.
 
 Alternate -- I claim that you can tell a man's age by ten-times the number
of
 personal products he routinely uses, for example:
 
 Years Old - Personal Products
 10Toothpaste
 20Toothpaste, Deodorant
 30Toothpaste, Deodorant, Aftershave
 40Toothpaste, Deodorant, Aftershave, Minoxidil
 50Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H
 60Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag
 Bomb
 70Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag
 Bomb, Fixodent
 
 So, you could indicate age by stating Bag Bomb like me.
 
 ___
 tedd sperling
 t...@sperling.com
 
 
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
 http://www.php.net/unsub.php
 

 Age: 54
 Mousepad: Yes

Laser mice don't like reflective surfaces so much and if I don't carve out
desk space for my mouse with a mousepad, I find that moving my mouse over
multiple sheets of paper, paperclips, and whatnot is not very effective and
somewhat frustrating.

Jeff




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



Re: [PHP] Friday's Question

2013-09-20 Thread Matijn Woudt
On Fri, Sep 20, 2013 at 6:51 PM, Tedd Sperling t...@sperling.com wrote:

 Hi gang:

 Do you use a Mousepad?

 My reason for asking is that I've used a Mousepad ever since mice first
 came out (back when they had one ball).

 Now that mice are optical (no balls), Mousepads are not really needed --
 or so I'll told by the college -- you see, they don't provide Mousepads for
 their student's computers.

 As such, I wondered what's the percentage of programmers still using a
 Mousepad?

 Secondly, are Mousepads used primarily by older programmers (like me)
 while younger programmers don't use Mousepads, or what?

 So -- please respond with:

 Age: *
 Mousepad: Yes/No



Age: 21
Mouse: No, so why would I need a mousepad?


RE: [PHP] Friday's Question

2013-09-20 Thread Jen Rasmussen
-Original Message-
From: Tedd Sperling [mailto:t...@sperling.com] 
Sent: Friday, September 20, 2013 11:52 AM
To: php-general@lists.php.net
Subject: [PHP] Friday's Question

Hi gang:

Do you use a Mousepad?

My reason for asking is that I've used a Mousepad ever since mice first came
out (back when they had one ball).

Now that mice are optical (no balls), Mousepads are not really needed -- or
so I'll told by the college -- you see, they don't provide Mousepads for
their student's computers.

As such, I wondered what's the percentage of programmers still using a
Mousepad?

Secondly, are Mousepads used primarily by older programmers (like me) while
younger programmers don't use Mousepads, or what?

So -- please respond with:

Age: *
Mousepad: Yes/No

Thank you,

tedd

PS: * If you don't want to provide your actual age, then indicate your age
by stating young, middle-age, old-age, ancient, or whatever term
describes your age.

Alternate -- I claim that you can tell a man's age by ten-times the number
of personal products he routinely uses, for example:

Years Old   - Personal Products
10  Toothpaste
20  Toothpaste, Deodorant
30  Toothpaste, Deodorant, Aftershave
40  Toothpaste, Deodorant, Aftershave, Minoxidil
50  Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H
60  Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag
Bomb
70  Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag
Bomb, Fixodent

So, you could indicate age by stating Bag Bomb like me.

___
tedd sperling
t...@sperling.com


41  Mouse (yes) - I already have issues with my hands from work (carpal
tunnel) so I need all the cushion I can get, andoh yeah Fixodent
LOL. What in the heck is a Bag Bomb?

Jen


--
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] Friday's Question

2013-09-20 Thread Daniel Brown
On Fri, Sep 20, 2013 at 12:51 PM, Tedd Sperling t...@sperling.com wrote:
 Hi gang:

 Do you use a Mousepad?

I'm in my mid-thirties and - despite having an optical mouse - I
do indeed still use a mousepad.  A customized one that the wife did
for me for Christmas one year: images of Futurama, the Cleveland
Browns, Minnesota Vikings, and several aircraft, all surrounding a
picture of her and our daughter.  I've found that shiny surfaces -
such as my desk - reflect too much of the laser, causing the mouse to
be far less responsive.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Friday's Question

2013-09-20 Thread Larry Martell
On Fri, Sep 20, 2013 at 10:51 AM, Tedd Sperling t...@sperling.com wrote:
 Hi gang:

 Do you use a Mousepad?

 My reason for asking is that I've used a Mousepad ever since mice first came 
 out (back when they had one ball).

 Now that mice are optical (no balls), Mousepads are not really needed -- or 
 so I'll told by the college -- you see, they don't provide Mousepads for 
 their student's computers.

 As such, I wondered what's the percentage of programmers still using a 
 Mousepad?

 Secondly, are Mousepads used primarily by older programmers (like me) while 
 younger programmers don't use Mousepads, or what?

 So -- please respond with:

 Age: *
 Mousepad: Yes/No

54 Yes

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



Re: [PHP] Friday's Question

2013-09-20 Thread Aziz Saleh
Haha, like your product usage chart Tedd,

Age: 31
Mousepad: Webster New Dictionary of Synonyms, too lazy of having to go to
Microcenter and buy one!

Aziz


On Fri, Sep 20, 2013 at 12:58 PM, Larry Martell la...@software-horizons.com
 wrote:

 On Fri, Sep 20, 2013 at 10:51 AM, Tedd Sperling t...@sperling.com wrote:
  Hi gang:
 
  Do you use a Mousepad?
 
  My reason for asking is that I've used a Mousepad ever since mice first
 came out (back when they had one ball).
 
  Now that mice are optical (no balls), Mousepads are not really needed --
 or so I'll told by the college -- you see, they don't provide Mousepads for
 their student's computers.
 
  As such, I wondered what's the percentage of programmers still using a
 Mousepad?
 
  Secondly, are Mousepads used primarily by older programmers (like me)
 while younger programmers don't use Mousepads, or what?
 
  So -- please respond with:
 
  Age: *
  Mousepad: Yes/No

 54 Yes

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




Re: [PHP] Friday's Question

2013-09-20 Thread Larry Martell
On Fri, Sep 20, 2013 at 11:16 AM, Joshua Kehn josh.k...@gmail.com wrote:
 On Sep 20, 2013, at 1:04 PM, Daniel Brown danbr...@php.net wrote:

I'm in my mid-thirties and - despite having an optical mouse - I
 do indeed still use a mousepad.  A customized one that the wife did
 for me for Christmas one year: images of Futurama, the Cleveland
 Browns, Minnesota Vikings, and several aircraft, all surrounding a
 picture of her and our daughter.  I've found that shiny surfaces -
 such as my desk - reflect too much of the laser, causing the mouse to
 be far less responsive.

 I'm in my 20's and rarely, if ever, use a dedicated mouse. I've transitioned 
 to having all my workstations be laptops of one sort or another and they have 
 built-in trackpads. Of course I also rarely use the mouse when there are so 
 many keyboard shortcuts available.

When I'm on my MacBook (which is most of the time) I use the trackpad.
But in the unfortunate times I have to be on a Windows box I always
connect a mouse.

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



Re: [PHP] Friday's Question

2013-09-20 Thread Joshua Kehn
On Sep 20, 2013, at 1:26 PM, Larry Martell la...@software-horizons.com wrote:

 On Fri, Sep 20, 2013 at 11:24 AM, Joshua Kehn josh.k...@gmail.com wrote:
 
 
 Slightly snobbish solution: Don't use windows.
 
 Unfortunately required to VPN into most of my clients corporate networks.

Windows is required to VPN in? I'm guessing they use some proprietary client 
then? --jk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Friday's Question

2013-09-20 Thread Camilo Sperberg

On 20 sep. 2013, at 18:51, Tedd Sperling t...@sperling.com wrote:

 Hi gang:
 
 Do you use a Mousepad?
 
 My reason for asking is that I've used a Mousepad ever since mice first came 
 out (back when they had one ball).
 
 Now that mice are optical (no balls), Mousepads are not really needed -- or 
 so I'll told by the college -- you see, they don't provide Mousepads for 
 their student's computers.
 
 As such, I wondered what's the percentage of programmers still using a 
 Mousepad?
 
 Secondly, are Mousepads used primarily by older programmers (like me) while 
 younger programmers don't use Mousepads, or what?
 
 So -- please respond with:
 
 Age: *
 Mousepad: Yes/No
 
 Thank you,
 
 tedd
 
 PS: * If you don't want to provide your actual age, then indicate your age by 
 stating young, middle-age, old-age, ancient, or whatever term 
 describes your age.
 
 Alternate -- I claim that you can tell a man's age by ten-times the number of 
 personal products he routinely uses, for example:
 
 Years Old - Personal Products
 10Toothpaste
 20Toothpaste, Deodorant
 30Toothpaste, Deodorant, Aftershave
 40Toothpaste, Deodorant, Aftershave, Minoxidil
 50Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H
 60Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag Bomb
 70Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag Bomb, 
 Fixodent
 
 So, you could indicate age by stating Bag Bomb like me.
 
 ___
 tedd sperling
 t...@sperling.com
 
 
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


Age: Aftershave (but I've began using it only a year ago xD)
Mousepad: No, but if I had to use a mouse, I prefer a mousepad

I currently use only my MBP's trackpad, and it is so customizable I ended up 
buying a magic trackpad for my Mac at work as well. But, back in the days of 
Windows I was using a mousepad, mainly because it just looks better than having 
nothing at all.

Greetings.



Met vriendelijke groet,
Camilo Sperberg


W: http://unreal4u.com
T: http://twitter.com/unreal4u


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



Re: [PHP] Friday's Question

2013-09-20 Thread Daniel Brown
On Fri, Sep 20, 2013 at 1:20 PM, Jen Rasmussen j...@cetaceasound.com wrote:
 LOL. What in the heck is a Bag Bomb?

He's referring to Bag Balm.

http://www.bagbalm.com/


-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Friday's Question

2013-09-20 Thread Larry Martell
On Fri, Sep 20, 2013 at 11:20 AM, Jen Rasmussen j...@cetaceasound.com wrote:
 -Original Message-
 What in the heck is a Bag Bomb?

It's a salve for cow udders. Not sure what a person would do with it.

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



Re: [PHP] Friday's Question

2013-09-20 Thread Larry Martell
On Fri, Sep 20, 2013 at 11:24 AM, Joshua Kehn josh.k...@gmail.com wrote:

 On Sep 20, 2013, at 1:23 PM, Larry Martell la...@software-horizons.com 
 wrote:

 On Fri, Sep 20, 2013 at 11:16 AM, Joshua Kehn josh.k...@gmail.com wrote:

 I'm in my 20's and rarely, if ever, use a dedicated mouse. I've 
 transitioned to having all my workstations be laptops of one sort or 
 another and they have built-in trackpads. Of course I also rarely use the 
 mouse when there are so many keyboard shortcuts available.

 When I'm on my MacBook (which is most of the time) I use the trackpad.
 But in the unfortunate times I have to be on a Windows box I always
 connect a mouse.

 Slightly snobbish solution: Don't use windows.

Unfortunately required to VPN into most of my clients corporate networks.

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



Re: [PHP] Friday's Question

2013-09-20 Thread Sean Greenslade
On Fri, Sep 20, 2013 at 12:51:49PM -0400, Tedd Sperling wrote:
 Hi gang:
 
 Do you use a Mousepad?

College Student (Electrical Engineer, go figure).
Age: 20
Mousepad: yes

I've used both optical and laser mice (they're a bit different, but
similar tech) and I've found that I like having the pad because it
sets the DPI of the mouse consistently. My favorite mousepad is this
cheap as hell thin rubber and cloth one that I got from dealextreme.com
many years ago. Go figure...

--Sean

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



Re: [PHP] Friday's Question

2013-09-20 Thread Joshua Kehn

On Sep 20, 2013, at 1:23 PM, Larry Martell la...@software-horizons.com wrote:

 On Fri, Sep 20, 2013 at 11:16 AM, Joshua Kehn josh.k...@gmail.com wrote:
 
 I'm in my 20's and rarely, if ever, use a dedicated mouse. I've transitioned 
 to having all my workstations be laptops of one sort or another and they 
 have built-in trackpads. Of course I also rarely use the mouse when there 
 are so many keyboard shortcuts available.
 
 When I'm on my MacBook (which is most of the time) I use the trackpad.
 But in the unfortunate times I have to be on a Windows box I always
 connect a mouse.

Slightly snobbish solution: Don't use windows.

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



Re: [PHP] Friday's Question

2013-09-20 Thread Tedd Sperling
On Sep 20, 2013, at 1:25 PM, Larry Martell la...@software-horizons.com wrote:

 On Fri, Sep 20, 2013 at 11:20 AM, Jen Rasmussen j...@cetaceasound.com wrote:
 -Original Message-
 What in the heck is a Bag Bomb?
 
 It's a salve for cow udders. Not sure what a person would do with it.


Feet.

Wait until you have callus as feet.

tedd
___
tedd sperling
t...@sperling.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Friday's Question

2013-09-20 Thread Curtis Maurand

On 9/20/2013 1:24 PM, Joshua Kehn wrote:

On Sep 20, 2013, at 1:23 PM, Larry Martell la...@software-horizons.com wrote:


On Fri, Sep 20, 2013 at 11:16 AM, Joshua Kehn josh.k...@gmail.com wrote:

I'm in my 20's and rarely, if ever, use a dedicated mouse. I've transitioned to 
having all my workstations be laptops of one sort or another and they have 
built-in trackpads. Of course I also rarely use the mouse when there are so 
many keyboard shortcuts available.

When I'm on my MacBook (which is most of the time) I use the trackpad.
But in the unfortunate times I have to be on a Windows box I always
connect a mouse.

Slightly snobbish solution: Don't use windows.


I'm agnostic when it comes to operating systems.  I use Windows, Linux 
and Mac.  I always go for a mouse.  If the surface is really shiny, 
you'll need something under the mouse.  In the case of a shiny surface, 
I've even used a piece of paper under the mouse in a pinch.  I tend to 
use a mousepad in those cases, though.  I'm not using one at home, but I 
do use one at work.  It's a matter of taste.




--jk



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



Re: [PHP] Friday's Question

2013-09-20 Thread Mattias Thorslund

40, and no mouse pad atm. Seems that this table top is okay.

This is an optical mouse without a ball underneath. However this 
mac-y-mouse DOES have a ball on top, for scrolling.


Go figure.

Mattias

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



Re: [PHP] Friday's Question

2013-09-20 Thread Bastien


Thanks,

Bastien

 On Sep 20, 2013, at 12:51 PM, Tedd Sperling t...@sperling.com wrote:
 
 Hi gang:
 
 Do you use a Mousepad?
 
 My reason for asking is that I've used a Mousepad ever since mice first came 
 out (back when they had one ball).
 
 Now that mice are optical (no balls), Mousepads are not really needed -- or 
 so I'll told by the college -- you see, they don't provide Mousepads for 
 their student's computers.
 
 As such, I wondered what's the percentage of programmers still using a 
 Mousepad?
 
 Secondly, are Mousepads used primarily by older programmers (like me) while 
 younger programmers don't use Mousepads, or what?
 
 So -- please respond with:
 
 Age: *
 Mousepad: Yes/No
 
 Thank you,
 
 tedd
 
 PS: * If you don't want to provide your actual age, then indicate your age by 
 stating young, middle-age, old-age, ancient, or whatever term 
 describes your age.
 
 Alternate -- I claim that you can tell a man's age by ten-times the number of 
 personal products he routinely uses, for example:
 
 Years Old- Personal Products
 10Toothpaste
 20Toothpaste, Deodorant
 30Toothpaste, Deodorant, Aftershave
 40Toothpaste, Deodorant, Aftershave, Minoxidil
 50Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H
 60Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag Bomb
 70Toothpaste, Deodorant, Aftershave, Minoxidil, Preparation-H, Bag Bomb, 
 Fixodent
 
 So, you could indicate age by stating Bag Bomb like me.
 
 ___
 tedd 

Every time I see something about mice, i always remember this article from IBM 
on how to care for your mouse. Best technical doc ever!

http://www.snopes.com/humor/business/mouse.asp

But in any case, 43

Use a mouse: yes mousepad occasionally depending on table surface 



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



Re: [PHP] Friday's Question

2013-09-20 Thread Simon J Welsh
On 21/09/2013, at 4:51, Tedd Sperling t...@sperling.com wrote:

 Hi gang:
 
 Do you use a Mousepad?
 
 My reason for asking is that I've used a Mousepad ever since mice first came 
 out (back when they had one ball).
 
 Now that mice are optical (no balls), Mousepads are not really needed -- or 
 so I'll told by the college -- you see, they don't provide Mousepads for 
 their student's computers.
 
 As such, I wondered what's the percentage of programmers still using a 
 Mousepad?
 
 Secondly, are Mousepads used primarily by older programmers (like me) while 
 younger programmers don't use Mousepads, or what?
 
 So -- please respond with:
 
 Age: *
 Mousepad: Yes/No
 
 Thank you,

22 and I entirely use trackpads (inbuilt or bluetooth Magic Trackpad).
---
Simon Welsh
Admin of http://simon.geek.nz/


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



Re: [PHP] Friday's Question

2013-09-20 Thread Daniel
25 network admin and programmer and yes I use a mouse pad - my mouse
hates me if I dont use it.

-- 
Regards,
Daniel Fenn

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



Re: [PHP] syntax question

2013-07-10 Thread Přemysl Fiala

Hello,

is an alternative syntax.

http://php.net/manual/en/control-structures.alternative-syntax.php

Premek.


On Wed, 10 Jul 2013 13:15:22 +0200, Jim Giner  
jim.gi...@albanyhandball.com wrote:


Can someone tell me what this syntax is?  I looked around but don't see  
any mention of it.


while(condition) : (statement);






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



Re: [PHP] syntax question

2013-07-10 Thread Jim Giner

Thanks!

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



Re: [PHP] filesize question

2013-05-08 Thread tamouse mailing lists
On Tue, May 7, 2013 at 10:16 PM, Curtis Maurand cur...@maurand.com wrote:
 find -name *.js -exec removestring.php '{}' \;

 That's how I get the I put file name. I think that I need the if statement
 to look at the filesize and make sure that I can open them and they are at
 least the size of the string that I'm looking to cleanse.


That's  how you pass the name into the php script; how does $inputfile
get set (via $argv somehow) once you're inside php?

This line:

 $inputline = fread($inputfile, filesize($argv[1]));

Somehow, you opened $inputfile (assuming via fopen) by passing it a
file name, presumably off the command line. Show me(us) where that
happens.

 Would that joomla.modules would use the ftp layer if it were turned on. Then
 I wouldn't have to be scanning files dor malicious iframes or if clamav
 coyld remove offending code without removing the entire file...

I don't know anything about joomla.

 tamouse mailing lists tamouse.li...@gmail.com wrote:

 On Tue, May 7, 2013 at 8:16 AM, Curtis Maurand cur...@maurand.com wrote:

 Hello,
 I'm feeding a filename to a php script on the command line (command line
 program).  I run the following against it:

 $inputline = fread($inputfile, filesize($argv[1]));

 I'm getting an error complaining that the second parameter can't be '0'


 The thing to look for, is how did you get $inputfile out of the
 command line, and why you'd expect the file name to be in $argv[1] at
 that point? Marco's suggestion isn't really going to work as
 $inputfile will be a file handle, and filesize() needs the name of the
 file. Maybe want to give us a wider look at what your code is doing?

 Generically, you can wrap this
 up as:

 function binread_file($filename)
 {
 $handle = fopen($filename,'rb');
 if (FALSE === $handle) die(Unable to open $filename);
 $contents = fread($handle, filesize($filename));
 if (FALSE === $contents) die(Unable to read $filename);
 return $contents;
 }


 --
 Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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



Re: [PHP] filesize question

2013-05-07 Thread ma...@behnke.biz


 Curtis Maurand cur...@maurand.com hat am 7. Mai 2013 um 15:16 geschrieben:


 Hello,
 I'm feeding a filename to a php script on the command line (command line
 program).  I run the following against it:

 $inputline = fread($inputfile, filesize($argv[1]));

mayve

$inputline = fread($inputfile, filesize($inputfile));


 I'm getting an error complaining that the second parameter can't be '0'

 any ideas?

 thanks,
 Curtis





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


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



Re: [PHP] filesize question

2013-05-07 Thread tamouse mailing lists
On Tue, May 7, 2013 at 8:16 AM, Curtis Maurand cur...@maurand.com wrote:
 Hello,
 I'm feeding a filename to a php script on the command line (command line
 program).  I run the following against it:

 $inputline = fread($inputfile, filesize($argv[1]));

 I'm getting an error complaining that the second parameter can't be '0'

The thing to look for, is how did you get $inputfile out of the
command line, and why you'd expect the file name to be in $argv[1] at
that point? Marco's suggestion isn't really going to work as
$inputfile will be a file handle, and filesize() needs the name of the
file. Maybe want to give us a wider look at what your code is doing?

Generically, you can wrap this up as:

 function binread_file($filename)
 {
   $handle = fopen($filename,'rb');
   if (FALSE === $handle) die(Unable to open $filename);
   $contents = fread($handle, filesize($filename));
   if (FALSE === $contents) die(Unable to read $filename);
   return $contents;
 }

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



Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-21 Thread Bastien Koert
I have an app that gets passed in xml and use this code to read that data in

// We use php://input to get the raw $_POST results.
$xml_post = file_get_contents('php://input');

Maybe it will help

Bastien


On Sat, Apr 20, 2013 at 7:48 AM, shiplu shiplu@gmail.com wrote:

 
 
 
  Question: how do you use $mylist when the xml is not as a file but is
  returned on a web page?
 

 I assume  It returns as a string from page. Then use
 simplexml_load_string(). See
 http://php.net/manual/en/function.simplexml-load-string.php


 --
 Shiplu.Mokadd.im
 ImgSign.com | A dynamic signature machine
 Innovation distinguishes between follower and leader




-- 

Bastien

Cat, the other other white meat


Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-21 Thread shiplu
On Apr 22, 2013 7:00 AM, Bastien Koert phps...@gmail.com wrote:

 I have an app that gets passed in xml and use this code to read that data
in

 // We use php://input to get the raw $_POST results.
 $xml_post = file_get_contents('php://input');

$xml_post is string.  I think now you know what to do.


Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-20 Thread tamouse mailing lists
This will be brief as I'm on a tablet...

On Apr 19, 2013 5:53 PM, dealTek deal...@gmail.com wrote:


 On Apr 19, 2013, at 3:32 PM, tamouse mailing lists 
tamouse.li...@gmail.com wrote:

 
  page1.php is sending out to credit card company - getting processed -
then coming back to the *same page1.php* with the XML data listed below...
 
  Please expand what you mean by sending out and coming back - is
  this a REST or SOAP API call? In that case, the response body is
  likely to be the XML.
 
 
  - so I'm not going to some other page to get it - it is coming to me
to the same page I am on..
 
  so - after the XML result comes in - I need to assign the php to the
XML somehow...
 
  How do you recognize the XML result com(ing) in ?
 

 Hi tamouse,

 with my untrained eye - it appears that this  is what is 'sending out'


  $data = sendXMLviaCurl($xmlRequest,$gatewayURL);

This is the  sending and receiving -- the function uses curl to send your
xml request and returns the response from that.



 and this might be what is 'responding back' on the same page


 $gwResponse = @new SimpleXMLElement((string)$data);

$data contains the response, this is how you are processing it.

Skipping the long and monolithic code, what I will suggest is that you
break things up into modules, functions and procrdures, and write unit
tests that will check each piece seperately. After you've verified that
each step is working, then you can start to integrate the pieces, following
the stricture of keeping code (logic), data, and presentation seperate.

It is much easier to deal with debugging when your code is simple and does
only one thing. Break out the part you are asking here about, the API call.
Build up a viable test request that will get you a known response and make
sure you are getting what you expect. My suspicion is that the response
here isnot what you expect.




Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-20 Thread Matijn Woudt
On Sat, Apr 20, 2013 at 12:51 AM, dealTek deal...@gmail.com wrote:


 On Apr 19, 2013, at 3:32 PM, tamouse mailing lists 
 tamouse.li...@gmail.com wrote:

 
  page1.php is sending out to credit card company - getting processed -
 then coming back to the *same page1.php* with the XML data listed below...
 
  Please expand what you mean by sending out and coming back - is
  this a REST or SOAP API call? In that case, the response body is
  likely to be the XML.
 
 
  - so I'm not going to some other page to get it - it is coming to me to
 the same page I am on..
 
  so - after the XML result comes in - I need to assign the php to the
 XML somehow...
 
  How do you recognize the XML result com(ing) in ?
 

 Hi tamouse,

 with my untrained eye - it appears that this  is what is 'sending out'


  $data = sendXMLviaCurl($xmlRequest,$gatewayURL);


 and this might be what is 'responding back' on the same page


 $gwResponse = @new SimpleXMLElement((string)$data);


 you can see these lines towards the bottom at - // Process Step Three...


Why did you prefix this with @? This way your hiding the real error that is
probably the answer to why it is not working.

- Matijn


Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-20 Thread shiplu



 Question: how do you use $mylist when the xml is not as a file but is
 returned on a web page?


I assume  It returns as a string from page. Then use
simplexml_load_string(). See
http://php.net/manual/en/function.simplexml-load-string.php


-- 
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader


Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread Sebastian Krebs
A webpage is a file, that (usually) a browser downloads and parses.
You'll do exactly the same :-) I don't know exactly, but you can try to
pass the URL directly to simplexml_load_file(). If this doesn't work,
download the content (for example with file_get_contents()) and pass it to
simplexml_load_string(). There are obviously many other approaches, but you
should now have an idea :-)

Or you use a specialized library like Guzzle.
Am 19.04.2013 22:17 schrieb dealTek deal...@gmail.com:

 Hi all,

 newbie - just starting with trying to parse XML...


 $mylist = simplexml_load_file('thelist.xml');

 then use a foreach to echo the data...

 ?php
 $mysongs = simplexml_load_file('songs.xml');

 foreach ($mysongs as $songinfo) {
 $title=$songinfo-title;
 $artist=$songinfo-artist;
 $date=$songinfo['dateplayed'];
 echo $title.' --- ';
 echo $artist.' --- ';
 echo $date.' --- ';
 echo ' /br ';
 }

 ?

 that I get ...

 Question: how do you use $mylist when the xml is not as a file but is
 returned on a web page?


 an example of the real xml I am trying to work with is like this demo
 below 

 Goal : when this response comes back - I would like to be able to get the
 data as php and then update the database


 example
 ?xml version=1.0 encoding=UTF-8?
 response
   result1/result
   result-textSUCCESS/result-text
   transaction-id1865264174/transaction-id
   result-code100/result-code
   authorization-code123456/authorization-code
   avs-resultN/avs-result
   cvv-resultN/cvv-result
   action-typesale/action-type
   amount12.00/amount
   ip-address::1/ip-address
   industryecommerce/industry
   processor-idccprocessora/processor-id
   currencyUSD/currency
   order-descriptionSmall Order/order-description
   merchant-defined-field-1Red/merchant-defined-field-1
   merchant-defined-field-2Medium/merchant-defined-field-2
   order-id1234/order-id
   tax-amount2.00/tax-amount
   shipping-amount0.00/shipping-amount
   billing
 first-nameJohn/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 phone555-555-/phone
 emailt...@example.com/email
 companyAcme, Inc./company
 cc-number40**0002/cc-number
 cc-exp0118/cc-exp
   /billing
   shipping
 first-nameMary/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 address2Unit #2/address2
   /shipping
   product
 product-codeSKU-123456/product-code
 descriptiontest product description/description
 commodity-codeabc/commodity-code
 unit-of-measure1/unit-of-measure
 unit-cost5./unit-cost
 quantity1./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
   product
 product-codeSKU-123456/product-code
 descriptiontest 2 product description/description
 commodity-codeabc/commodity-code
 unit-of-measure2/unit-of-measure
 unit-cost2.5000/unit-cost
 quantity2./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
 /response








 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]




Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread dealTek

On Apr 19, 2013, at 1:33 PM, Sebastian Krebs krebs@gmail.com wrote:

 A webpage is a file, that (usually) a browser downloads and parses. You'll 
 do exactly the same :-) I don't know exactly, but you can try to pass the URL 
 directly to simplexml_load_file(). If this doesn't work, download the content 
 (for example with file_get_contents()) and pass it to 
 simplexml_load_string(). There are obviously many other approaches, but you 
 should now have an idea :-)
 

Thanks Sebastian for the help

Actually what is happening in my case is:

page1.php is sending out to credit card company - getting processed - then 
coming back to the *same page1.php* with the XML data listed below...

- so I'm not going to some other page to get it - it is coming to me to the 
same page I am on..

so - after the XML result comes in - I need to assign the php to the XML 
somehow...

I hope I am making myself clear

Thanks in advance for the help


 Or you use a specialized library like Guzzle.
 
 Am 19.04.2013 22:17 schrieb dealTek deal...@gmail.com:
 Hi all,
 
 newbie - just starting with trying to parse XML...
 
 
 $mylist = simplexml_load_file('thelist.xml');
 
 then use a foreach to echo the data...
 
 ?php
 $mysongs = simplexml_load_file('songs.xml');
 
 foreach ($mysongs as $songinfo) {
 $title=$songinfo-title;
 $artist=$songinfo-artist;
 $date=$songinfo['dateplayed'];
 echo $title.' --- ';
 echo $artist.' --- ';
 echo $date.' --- ';
 echo ' /br ';
 }
 
 ?
 
 that I get ...
 
 Question: how do you use $mylist when the xml is not as a file but is 
 returned on a web page?
 
 
 an example of the real xml I am trying to work with is like this demo below 
 
 
 Goal : when this response comes back - I would like to be able to get the 
 data as php and then update the database
 
 
 example
 ?xml version=1.0 encoding=UTF-8?
 response
   result1/result
   result-textSUCCESS/result-text
   transaction-id1865264174/transaction-id
   result-code100/result-code
   authorization-code123456/authorization-code
   avs-resultN/avs-result
   cvv-resultN/cvv-result
   action-typesale/action-type
   amount12.00/amount
   ip-address::1/ip-address
   industryecommerce/industry
   processor-idccprocessora/processor-id
   currencyUSD/currency
   order-descriptionSmall Order/order-description
   merchant-defined-field-1Red/merchant-defined-field-1
   merchant-defined-field-2Medium/merchant-defined-field-2
   order-id1234/order-id
   tax-amount2.00/tax-amount
   shipping-amount0.00/shipping-amount
   billing
 first-nameJohn/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 phone555-555-/phone
 emailt...@example.com/email
 companyAcme, Inc./company
 cc-number40**0002/cc-number
 cc-exp0118/cc-exp
   /billing
   shipping
 first-nameMary/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 address2Unit #2/address2
   /shipping
   product
 product-codeSKU-123456/product-code
 descriptiontest product description/description
 commodity-codeabc/commodity-code
 unit-of-measure1/unit-of-measure
 unit-cost5./unit-cost
 quantity1./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
   product
 product-codeSKU-123456/product-code
 descriptiontest 2 product description/description
 commodity-codeabc/commodity-code
 unit-of-measure2/unit-of-measure
 unit-cost2.5000/unit-cost
 quantity2./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
 /response
 
 
 
 
 
 
 
 
 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]
 


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread tamouse mailing lists
On Fri, Apr 19, 2013 at 4:04 PM, dealTek deal...@gmail.com wrote:

 On Apr 19, 2013, at 1:33 PM, Sebastian Krebs krebs@gmail.com wrote:

 A webpage is a file, that (usually) a browser downloads and parses. You'll 
 do exactly the same :-) I don't know exactly, but you can try to pass the 
 URL directly to simplexml_load_file(). If this doesn't work, download the 
 content (for example with file_get_contents()) and pass it to 
 simplexml_load_string(). There are obviously many other approaches, but you 
 should now have an idea :-)


 Thanks Sebastian for the help

 Actually what is happening in my case is:

 page1.php is sending out to credit card company - getting processed - then 
 coming back to the *same page1.php* with the XML data listed below...

Please expand what you mean by sending out and coming back - is
this a REST or SOAP API call? In that case, the response body is
likely to be the XML.


 - so I'm not going to some other page to get it - it is coming to me to the 
 same page I am on..

 so - after the XML result comes in - I need to assign the php to the XML 
 somehow...

How do you recognize the XML result com(ing) in ?




 I hope I am making myself clear

 Thanks in advance for the help


 Or you use a specialized library like Guzzle.

 Am 19.04.2013 22:17 schrieb dealTek deal...@gmail.com:
 Hi all,

 newbie - just starting with trying to parse XML...


 $mylist = simplexml_load_file('thelist.xml');

 then use a foreach to echo the data...

 ?php
 $mysongs = simplexml_load_file('songs.xml');

 foreach ($mysongs as $songinfo) {
 $title=$songinfo-title;
 $artist=$songinfo-artist;
 $date=$songinfo['dateplayed'];
 echo $title.' --- ';
 echo $artist.' --- ';
 echo $date.' --- ';
 echo ' /br ';
 }

 ?

 that I get ...

 Question: how do you use $mylist when the xml is not as a file but is 
 returned on a web page?


 an example of the real xml I am trying to work with is like this demo below 
 

 Goal : when this response comes back - I would like to be able to get the 
 data as php and then update the database


 example
 ?xml version=1.0 encoding=UTF-8?
 response
   result1/result
   result-textSUCCESS/result-text
   transaction-id1865264174/transaction-id
   result-code100/result-code
   authorization-code123456/authorization-code
   avs-resultN/avs-result
   cvv-resultN/cvv-result
   action-typesale/action-type
   amount12.00/amount
   ip-address::1/ip-address
   industryecommerce/industry
   processor-idccprocessora/processor-id
   currencyUSD/currency
   order-descriptionSmall Order/order-description
   merchant-defined-field-1Red/merchant-defined-field-1
   merchant-defined-field-2Medium/merchant-defined-field-2
   order-id1234/order-id
   tax-amount2.00/tax-amount
   shipping-amount0.00/shipping-amount
   billing
 first-nameJohn/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 phone555-555-/phone
 emailt...@example.com/email
 companyAcme, Inc./company
 cc-number40**0002/cc-number
 cc-exp0118/cc-exp
   /billing
   shipping
 first-nameMary/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 address2Unit #2/address2
   /shipping
   product
 product-codeSKU-123456/product-code
 descriptiontest product description/description
 commodity-codeabc/commodity-code
 unit-of-measure1/unit-of-measure
 unit-cost5./unit-cost
 quantity1./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
   product
 product-codeSKU-123456/product-code
 descriptiontest 2 product description/description
 commodity-codeabc/commodity-code
 unit-of-measure2/unit-of-measure
 unit-cost2.5000/unit-cost
 quantity2./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
 /response








 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]



 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]


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



Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread dealTek

On Apr 19, 2013, at 3:32 PM, tamouse mailing lists tamouse.li...@gmail.com 
wrote:

 
 page1.php is sending out to credit card company - getting processed - then 
 coming back to the *same page1.php* with the XML data listed below...
 
 Please expand what you mean by sending out and coming back - is
 this a REST or SOAP API call? In that case, the response body is
 likely to be the XML.
 
 
 - so I'm not going to some other page to get it - it is coming to me to the 
 same page I am on..
 
 so - after the XML result comes in - I need to assign the php to the XML 
 somehow...
 
 How do you recognize the XML result com(ing) in ?
 

Hi tamouse,

with my untrained eye - it appears that this  is what is 'sending out'


 $data = sendXMLviaCurl($xmlRequest,$gatewayURL);


and this might be what is 'responding back' on the same page


$gwResponse = @new SimpleXMLElement((string)$data);


you can see these lines towards the bottom at - // Process Step Three...


---



the page code is long - so i cut out some extra lines - but this is
===


all page code - with edits...

?php





// API Setup Parameters

$gatewayURL = 'https://secure.webxxx.com/api/test';

$APIKey = 'xxx';





// If there is no POST data or a token-id, print the initial shopping cart form 
to get ready for Step One.

if (empty($_POST['DO_STEP_1']) empty($_GET['token-id'])) {



print '  !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;';

print '

html

  head

meta http-equiv=Content-Type content=text/html; charset=UTF-8 /

titleCollect non-sensitive Customer Info /title

  /head

  body

  ph2Step One: Collect non-sensitive payment information.br //h2/p



  h3 Customer Information/h3

  h4 Billing Details/h4



form action= method=post

  table

  trtdCompany/tdtdinput type=text 
name=billing-address-company value=Acme, Inc./td/tr

 
 
 --- more



  trtdh4br / Shipping Details/h4

  
  
  --more
  

  trtd colspan=2nbsp;/td

  trtd colspan=2 align=centerTotal Amount $12.00 /td/tr

  trtd colspan=2 align=centerinput type=submit value=Submit 
Step Oneinput type=hidden name =DO_STEP_1 value=true/td/tr

  /table



/form

  /body

/html



';

}else if (!empty($_POST['DO_STEP_1'])) {



// Initiate Step One: Now that we've collected the non-sensitive payment 
information, we can combine other order information and build the XML format.

$xmlRequest = new DOMDocument('1.0','UTF-8');



$xmlRequest-formatOutput = true;

$xmlSale = $xmlRequest-createElement('sale');



// Amount, authentication, and Redirect-URL are typically the bare mininum.

appendXmlNode($xmlSale,'api-key',$APIKey);

appendXmlNode($xmlSale,'redirect-url',$_SERVER['HTTP_REFERER']);

appendXmlNode($xmlSale, 'amount', '12.00');

appendXmlNode($xmlSale, 'ip-address', $_SERVER[REMOTE_ADDR]);

//appendXmlNode($xmlSale, 'processor-id' , 'processora');

appendXmlNode($xmlSale, 'currency', 'USD');

//appendXmlNode($xmlSale, 'dup-seconds' , '2');



// Some additonal fields may have been previously decided by user

appendXmlNode($xmlSale, 'order-id', '1234');

appendXmlNode($xmlSale, 'order-description', 'Small Order');

appendXmlNode($xmlSale, 'merchant-defined-field-1' , 'Red');

appendXmlNode($xmlSale, 'merchant-defined-field-2', 'Medium');

appendXmlNode($xmlSale, 'tax-amount' , '2.00');

appendXmlNode($xmlSale, 'shipping-amount' , '0.00');



/*if(!empty($_POST['customer-vault-id'])) {

appendXmlNode($xmlSale, 'customer-vault-id' , 
$_POST['customer-vault-id']);

}else {

 $xmlAdd = $xmlRequest-createElement('add-customer');

 appendXmlNode($xmlAdd, 'customer-vault-id' ,411);

 $xmlSale-appendChild($xmlAdd);

}*/





// Set the Billing  Shipping from what was collected on initial shopping 
cart form

$xmlBillingAddress = $xmlRequest-createElement('billing');

appendXmlNode($xmlBillingAddress,'first-name', 
$_POST['billing-address-first-name']);

//-more


//billing-address-email

appendXmlNode($xmlBillingAddress,'country', 
$_POST['billing-address-country']);

appendXmlNode($xmlBillingAddress,'email', $_POST['billing-address-email']);

//more

$xmlSale-appendChild($xmlBillingAddress);





$xmlShippingAddress = $xmlRequest-createElement('shipping');

appendXmlNode($xmlShippingAddress,'first-name', 
$_POST['shipping-address-first-name']);

appendXmlNode($xmlShippingAddress,'last-name', 
$_POST['shipping-address-last-name']);

// more

appendXmlNode($xmlShippingAddress,'fax', $_POST['shipping-address-fax']);

$xmlSale-appendChild($xmlShippingAddress);


Re: [PHP] htaccess question

2013-04-09 Thread Daniel Brown
On Tue, Apr 9, 2013 at 2:07 PM, Al n...@ridersite.org wrote:
 I know it's not a php question, but I can't readily find the answer
 elsewhere.

 I want to make this directive universal. Put htaccess file on any host in
 any folder.

 This works
 RewriteEngine On

 RewriteCond %{SERVER_PORT} !=443

 RewriteRule ^(.*)$ https://www.foo.org/bar/$1 [R=301,L]  #Here the foo.org
 and /bar must be specified

 I want what is in effect

 RewriteRule ^(.*)$ https://{host_name}/{directory}/$1 [R=301,L]

 I can easily do this with php regex capturing the (host and dir) and then
 rewriting the text string; but the Apache directives are not obvious.

You were on the right track:

RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


--
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] target question

2013-03-25 Thread Samuel Lopes Grigolato
Have you tried to set a Content-Disposition header in the PHP script that
creates the PDF, asking the browser to attach the download? This way you
don't even need a new window.

Example from php.net/manual:

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename=downloaded.pdf');


On Mon, Mar 25, 2013 at 11:01 AM, Jim Giner jim.gi...@albanyhandball.comwrote:

 target as in the form attribute

 In my appl devl I utilize an extra window when my current form is asked to
 generate a pdf report.  Works well since that way the user can generate one
 report into a new window, read it, close it, and still have the reports
 menu in front of him/her and generate a 2nd report.

 I'm experiencing a problem tho and I'm guessing it's associated with ie9
 or FPDF. In my reports menu form, when I click on a button that will
 generate a pdf, I alter the form's target to create a new window.  This
 used to work last fall, but since then I have a new laptop running ie9, not
 8.  The target changing js logic is working as far as I can see (alerts in
 my js) but the effect is not there.  Instead of a new window, the pdf opens
 up in the same window where the menu was and so when the user does a back
 he ends up going up one too many levels and has to re-request the reports
 menu.

 Didn't have this much trouble originally setting this up as I'm having now
 trying to debug this.  I'm using the FPDF extension/class to generate my
 pdfs - made no recent changes there.  Also my concept works very well still
 in a simple html document that has only two buttons on it which I created
 today to test a theory.  That is - maybe it's not just IE9, but FPDF.

 Anyone have any experience in this area?

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




Re: [PHP] target question

2013-03-25 Thread Jim Giner

On 3/25/2013 10:13 AM, Samuel Lopes Grigolato wrote:

Have you tried to set a Content-Disposition header in the PHP script that
creates the PDF, asking the browser to attach the download? This way you
don't even need a new window.

Example from php.net/manual:

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename=downloaded.pdf');


On Mon, Mar 25, 2013 at 11:01 AM, Jim Giner jim.gi...@albanyhandball.comwrote:


target as in the form attribute

In my appl devl I utilize an extra window when my current form is asked to
generate a pdf report.  Works well since that way the user can generate one
report into a new window, read it, close it, and still have the reports
menu in front of him/her and generate a 2nd report.

I'm experiencing a problem tho and I'm guessing it's associated with ie9
or FPDF. In my reports menu form, when I click on a button that will
generate a pdf, I alter the form's target to create a new window.  This
used to work last fall, but since then I have a new laptop running ie9, not
8.  The target changing js logic is working as far as I can see (alerts in
my js) but the effect is not there.  Instead of a new window, the pdf opens
up in the same window where the menu was and so when the user does a back
he ends up going up one too many levels and has to re-request the reports
menu.

Didn't have this much trouble originally setting this up as I'm having now
trying to debug this.  I'm using the FPDF extension/class to generate my
pdfs - made no recent changes there.  Also my concept works very well still
in a simple html document that has only two buttons on it which I created
today to test a theory.  That is - maybe it's not just IE9, but FPDF.

Anyone have any experience in this area?

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





And what happens to my original menu window?

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



Re: [PHP] target question

2013-03-25 Thread Paul M Foster
On Mon, Mar 25, 2013 at 10:01:03AM -0400, Jim Giner wrote:

 target as in the form attribute
 
 In my appl devl I utilize an extra window when my current form is
 asked to generate a pdf report.  Works well since that way the user
 can generate one report into a new window, read it, close it, and
 still have the reports menu in front of him/her and generate a 2nd
 report.
 
 I'm experiencing a problem tho and I'm guessing it's associated with
 ie9 or FPDF. In my reports menu form, when I click on a button that
 will generate a pdf, I alter the form's target to create a new
 window.  This used to work last fall, but since then I have a new
 laptop running ie9, not 8.  The target changing js logic is working
 as far as I can see (alerts in my js) but the effect is not there.
 Instead of a new window, the pdf opens up in the same window where
 the menu was and so when the user does a back he ends up going up
 one too many levels and has to re-request the reports menu.
 
 Didn't have this much trouble originally setting this up as I'm
 having now trying to debug this.  I'm using the FPDF extension/class
 to generate my pdfs - made no recent changes there.  Also my concept
 works very well still in a simple html document that has only two
 buttons on it which I created today to test a theory.  That is -
 maybe it's not just IE9, but FPDF.
 
 Anyone have any experience in this area?

This behavior of the browser actually conforms to the standard as far as
I know. The target attribute is attached only to the a tag,
according to w3schools.com. It may work when you use it with a form tag,
it doesn't surprise me if IE doesn't honor it (of course, nothing IE
does would surprise me). In any case, using it with the form tag appears
to be non-standard usage, which may or may not be supported by
individual browsers.

I handle this situation differently. My generator code (also using
FPDF) dumps the PDF in a PDF directory. Then I provide a link elsewhere
with an Adobe Acrobat logo which, when clicked, opens the PDF in a
separate window, using the aforementioned 

a href=example.com/pdfs/something.pdf target=_blankMy PDF/a 

paradigm.

In any case, I doubt very much FPDF has anything to do with this. It
just dumps its creation to wherever you tell it. The browser determines
what helper application it will use to open it when it downloads the
content. Whether to open a separate window/tab is determined by the
HTML the browser is looking at when it makes the content request.

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

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



RE: [PHP] target question

2013-03-25 Thread Ford, Mike
 -Original Message-
 From: Paul M Foster [mailto:pa...@quillandmouse.com]
 Sent: 25 March 2013 16:09
 
 This behavior of the browser actually conforms to the standard as
 far as
 I know. The target attribute is attached only to the a tag,
 according to w3schools.com

Actually, the W3C HTML 4.01 Recommendation says:

target = frame-target [CI]

This attribute specifies the name of a frame where a document
is to be opened.

By assigning a name to a frame via the name attribute, authors
can refer to it as the target of links defined by other
elements. The target attribute may be set for elements that
create links (A, LINK), image maps (AREA), and forms (FORM).

In the current HTML5 draft, target is explicitly a permitted
attribute of the form tag -- although I believe it was originally
marked as deprecated.

None of this really addresses the OP's problem, however, about
which I have very little clue.


Cheers!

Mike

-- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Portland PD507, City Campus, Leeds Metropolitan University,
Portland Way, LEEDS,  LS1 3HE,  United Kingdom 
E: m.f...@leedsmet.ac.uk T: +44 113 812 4730



To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] target question

2013-03-25 Thread Stuart Dallas
On 25 Mar 2013, at 16:35, Ford, Mike m.f...@leedsmet.ac.uk wrote:

 -Original Message-
 From: Paul M Foster [mailto:pa...@quillandmouse.com]
 Sent: 25 March 2013 16:09
 
 This behavior of the browser actually conforms to the standard as
 far as
 I know. The target attribute is attached only to the a tag,
 according to w3schools.com
 
 Actually, the W3C HTML 4.01 Recommendation says:
 
target = frame-target [CI]
 
This attribute specifies the name of a frame where a document
is to be opened.
 
By assigning a name to a frame via the name attribute, authors
can refer to it as the target of links defined by other
elements. The target attribute may be set for elements that
create links (A, LINK), image maps (AREA), and forms (FORM).
 
 In the current HTML5 draft, target is explicitly a permitted
 attribute of the form tag -- although I believe it was originally
 marked as deprecated.

Indeed. In fact w3schools.com is known to be a very unreliable source of 
information these days. My advice would be to avoid it at all costs!

http://w3fools.com/

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

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



Re: [PHP] target question

2013-03-25 Thread Paul M Foster
On Mon, Mar 25, 2013 at 04:37:50PM +, Stuart Dallas wrote:

 On 25 Mar 2013, at 16:35, Ford, Mike m.f...@leedsmet.ac.uk wrote:
 
  -Original Message-
  From: Paul M Foster [mailto:pa...@quillandmouse.com]
  Sent: 25 March 2013 16:09
  
  This behavior of the browser actually conforms to the standard as
  far as
  I know. The target attribute is attached only to the a tag,
  according to w3schools.com
  
  Actually, the W3C HTML 4.01 Recommendation says:
  
 target = frame-target [CI]
  
 This attribute specifies the name of a frame where a document
 is to be opened.
  
 By assigning a name to a frame via the name attribute, authors
 can refer to it as the target of links defined by other
 elements. The target attribute may be set for elements that
 create links (A, LINK), image maps (AREA), and forms (FORM).
  
  In the current HTML5 draft, target is explicitly a permitted
  attribute of the form tag -- although I believe it was originally
  marked as deprecated.
 
 Indeed. In fact w3schools.com is known to be a very unreliable source of 
 information these days. My advice would be to avoid it at all costs!
 
 http://w3fools.com/

Interesting. I wasn't aware of this. Thanks for the info. 

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

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



Re: [PHP] target question

2013-03-25 Thread Samuel Lopes Grigolato
With the header Content-Disposition: attachment the browser will
offer the response as a regular file download (with save/open
options). Your original page (menu) will remain intact.

Please note that this solution will not present the PDF directly to
the user (as it would with a popup window), instead he will need to
open the downloaded file in his computer.

On Mon, Mar 25, 2013 at 12:23 PM, Jim Giner
jim.gi...@albanyhandball.com wrote:
 On 3/25/2013 10:13 AM, Samuel Lopes Grigolato wrote:

 Have you tried to set a Content-Disposition header in the PHP script that
 creates the PDF, asking the browser to attach the download? This way you
 don't even need a new window.

 Example from php.net/manual:

 // It will be called downloaded.pdf
 header('Content-Disposition: attachment; filename=downloaded.pdf');


 On Mon, Mar 25, 2013 at 11:01 AM, Jim Giner
 jim.gi...@albanyhandball.comwrote:

 target as in the form attribute

 In my appl devl I utilize an extra window when my current form is asked
 to
 generate a pdf report.  Works well since that way the user can generate
 one
 report into a new window, read it, close it, and still have the reports
 menu in front of him/her and generate a 2nd report.

 I'm experiencing a problem tho and I'm guessing it's associated with ie9
 or FPDF. In my reports menu form, when I click on a button that will
 generate a pdf, I alter the form's target to create a new window.  This
 used to work last fall, but since then I have a new laptop running ie9,
 not
 8.  The target changing js logic is working as far as I can see (alerts
 in
 my js) but the effect is not there.  Instead of a new window, the pdf
 opens
 up in the same window where the menu was and so when the user does a back
 he ends up going up one too many levels and has to re-request the reports
 menu.

 Didn't have this much trouble originally setting this up as I'm having
 now
 trying to debug this.  I'm using the FPDF extension/class to generate my
 pdfs - made no recent changes there.  Also my concept works very well
 still
 in a simple html document that has only two buttons on it which I created
 today to test a theory.  That is - maybe it's not just IE9, but FPDF.

 Anyone have any experience in this area?

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



 And what happens to my original menu window?


 --
 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] target question

2013-03-25 Thread Jim Giner

On 3/25/2013 1:12 PM, Samuel Lopes Grigolato wrote:

With the header Content-Disposition: attachment the browser will
offer the response as a regular file download (with save/open
options). Your original page (menu) will remain intact.

Please note that this solution will not present the PDF directly to
the user (as it would with a popup window), instead he will need to
open the downloaded file in his computer.

On Mon, Mar 25, 2013 at 12:23 PM, Jim Giner
jim.gi...@albanyhandball.com wrote:

On 3/25/2013 10:13 AM, Samuel Lopes Grigolato wrote:


Have you tried to set a Content-Disposition header in the PHP script that
creates the PDF, asking the browser to attach the download? This way you
don't even need a new window.

Example from php.net/manual:

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename=downloaded.pdf');


On Mon, Mar 25, 2013 at 11:01 AM, Jim Giner
jim.gi...@albanyhandball.comwrote:


target as in the form attribute

In my appl devl I utilize an extra window when my current form is asked
to
generate a pdf report.  Works well since that way the user can generate
one
report into a new window, read it, close it, and still have the reports
menu in front of him/her and generate a 2nd report.

I'm experiencing a problem tho and I'm guessing it's associated with ie9
or FPDF. In my reports menu form, when I click on a button that will
generate a pdf, I alter the form's target to create a new window.  This
used to work last fall, but since then I have a new laptop running ie9,
not
8.  The target changing js logic is working as far as I can see (alerts
in
my js) but the effect is not there.  Instead of a new window, the pdf
opens
up in the same window where the menu was and so when the user does a back
he ends up going up one too many levels and has to re-request the reports
menu.

Didn't have this much trouble originally setting this up as I'm having
now
trying to debug this.  I'm using the FPDF extension/class to generate my
pdfs - made no recent changes there.  Also my concept works very well
still
in a simple html document that has only two buttons on it which I created
today to test a theory.  That is - maybe it's not just IE9, but FPDF.

Anyone have any experience in this area?

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





And what happens to my original menu window?


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

Thanks for the pointer - but not what I'm looking to do.  Trying to make 
it effortless for the user so having to go and open a pdf would be 
another pia.



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



Re: [PHP] target question

2013-03-25 Thread Lester Caine

Jim Giner wrote:

Thanks for the pointer - but not what I'm looking to do.  Trying to make it
effortless for the user so having to go and open a pdf would be another pia.


Actually it IS worth pointing out that how the browser handles a pdf file is 
very much controlled by the browser itself? Opening in a browser page only works 
if there is a suitable plugin, so what *I* get is the option to save file or 
open in a third party app as I don't currently have any plugins loaded for pdf.


We use pdf's for agendas and minutes, but I have yet to find a reliable way to 
display them as a pop-up or opening in a separate page even using 'target'. The 
compromise I came up with is to open them in a flash player as in 
http://northwaypc.org.uk/fisheye/image/1030


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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



Re: [PHP] target question

2013-03-25 Thread Matijn Woudt
On Mon, Mar 25, 2013 at 7:11 PM, Lester Caine les...@lsces.co.uk wrote:

 Jim Giner wrote:

 Thanks for the pointer - but not what I'm looking to do.  Trying to make
 it
 effortless for the user so having to go and open a pdf would be another
 pia.


 Actually it IS worth pointing out that how the browser handles a pdf file
 is very much controlled by the browser itself? Opening in a browser page
 only works if there is a suitable plugin, so what *I* get is the option to
 save file or open in a third party app as I don't currently have any
 plugins loaded for pdf.

 We use pdf's for agendas and minutes, but I have yet to find a reliable
 way to display them as a pop-up or opening in a separate page even using
 'target'. The compromise I came up with is to open them in a flash player
 as in 
 http://northwaypc.org.uk/**fisheye/image/1030http://northwaypc.org.uk/fisheye/image/1030



Please, don't advise flash to anyone. It's outdated, and is not gonna be
supported for a long time anymore. iOS never supported, and Android does
also not support since Jelly Bean I think.
I checked your solution, and on my 1920x1080 screen, it shows the pdf quite
small. I can zoom, but the bounding box does not get bigger, which means I
have scroll the page from left to right to view it. In a native solution it
would show the PDF as wide as my screen is, which makes it normally
readable.
I don't see what the problem is with showing a pdf in a pop up or new
tab/window, it should work just as any other. Can u perhaps show us a
simple code that does not work? (under 50 lines of code, if possible).

Regards,

Matijn


Re: [PHP] target question

2013-03-25 Thread Gabriel Ricci
I agree with Matjin in this one, Flash is not a good solution in this case,
in fact, Flash is not a good solution in a lot of cases lately, but
handling PDFs in the browser can be tricky sometimes.

I remember that some time ago I had to build a system that prints a PDF
after it is loaded from the server, without any user interaction, and there
is no way to do that using only HTML/JS due to security restrictions of
course. The solution I came up with was to create a java printer
application that also open a local (tiny) http server, and the browser call
this java application (ajax) sending the URL of the PDF, the java
application downloads the document and prints it directly. The only
downside is that the user need to open this printer application.

Best regards.


Att.

Gabriel Ricci


Website http://gabrielricci.github.com
Follow @gabrielricci http://www.twitter.com/gabrielricci
Facebook profile http://www.facebook.com/gabrielricci2, GitHub
profilehttp://www.github.com/gabrielricci/
http://code.google.com/p/syslibjs/


On Mon, Mar 25, 2013 at 3:25 PM, Matijn Woudt tijn...@gmail.com wrote:

 On Mon, Mar 25, 2013 at 7:11 PM, Lester Caine les...@lsces.co.uk wrote:

  Jim Giner wrote:
 
  Thanks for the pointer - but not what I'm looking to do.  Trying to make
  it
  effortless for the user so having to go and open a pdf would be another
  pia.
 
 
  Actually it IS worth pointing out that how the browser handles a pdf file
  is very much controlled by the browser itself? Opening in a browser page
  only works if there is a suitable plugin, so what *I* get is the option
 to
  save file or open in a third party app as I don't currently have any
  plugins loaded for pdf.
 
  We use pdf's for agendas and minutes, but I have yet to find a reliable
  way to display them as a pop-up or opening in a separate page even using
  'target'. The compromise I came up with is to open them in a flash player
  as in http://northwaypc.org.uk/**fisheye/image/1030
 http://northwaypc.org.uk/fisheye/image/1030
 
 
 
 Please, don't advise flash to anyone. It's outdated, and is not gonna be
 supported for a long time anymore. iOS never supported, and Android does
 also not support since Jelly Bean I think.
 I checked your solution, and on my 1920x1080 screen, it shows the pdf quite
 small. I can zoom, but the bounding box does not get bigger, which means I
 have scroll the page from left to right to view it. In a native solution it
 would show the PDF as wide as my screen is, which makes it normally
 readable.
 I don't see what the problem is with showing a pdf in a pop up or new
 tab/window, it should work just as any other. Can u perhaps show us a
 simple code that does not work? (under 50 lines of code, if possible).

 Regards,

 Matijn



Re: [PHP] target question

2013-03-25 Thread Lester Caine

Matijn Woudt wrote:

I don't see what the problem is with showing a pdf in a pop up or new
tab/window, it should work just as any other. Can u perhaps show us a simple
code that does not work? (under 50 lines of code, if possible).


There is no problem getting it to appear as a pop-up or in a new tab. The 
problem is that you have no idea exactly how the browser IS displaying it to a user.


I quite agree that flash now needs replacing but 5 years ago it was a workable 
solution. Replacing that with another viewer would be nice nowadays,but there is 
nothing suitable? The point here was to allow the pdf to be wrapped with other 
links, and managing selection of things such as filtering terms for a report 
which is then output as a pdf makes sense. The report can also be printed if 
required, something which is not practical directly from an html page.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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



Re: [PHP] Stupid question

2013-02-28 Thread Daniel Brown
On Wed, Feb 27, 2013 at 9:14 PM, Curtis Maurand cur...@maurand.com wrote:

 Well that means the docs on the PEAR MDB2 website are incorrect and should
 be fixed.  Thanks for the lesson.

If there's an issue with the docs, you're right, they should
definitely be fixed.  We'd appreciate it very much if you could take a
moment and submit it as a bug report at https://bugs.php.net/.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Stupid question

2013-02-27 Thread Sebastian Krebs
2013/2/27 tamouse mailing lists tamouse.li...@gmail.com

 On Tue, Feb 26, 2013 at 4:41 PM, Jim Lucas li...@cmsws.com wrote:
  On 02/26/2013 01:27 PM, Curtis Maurand wrote:
 
  I have the following:
 
  $dsn = mysqli://$username:$password@$hostname2/$database;
  $options = array(
  'debug' = 3,
  'result_buffering' = false,
  );
  $dbh = MDB2::factory($dsn, $options);
  if (PEAR::isError($mdb2))
  {
  die($mdb2-getMessage());
  }
 
 
 
 
  function tallyCart($_u_id,$dbh){
  while($row = $result-fetchrow(MDB2_FETCHMODE_ASSOC)) {
 
 
  Talking in code.  The above two lines tell me...
 
  $dbh != $result
 
  isset($result) === false
 
 
 
  $_showCheckOut=1;
  $_pdetail=new ProductDetail($row{'product_ID'},
  $row{'product_Quantity'}, $_u_id);
  $_getSubTotal += $_pdetail-_subTotal;
  $_counter++;
  }
  }
 
  I'm getting: Call to undefined method MDB2_Error::fetchrow()
 
  anyone have any ideas? Can I not pass a database handle to a function?
 
  Thanks,
  Curtis
 
 
 
 
  --
  Jim Lucas
 
  http://www.cmsws.com/
  http://www.cmsws.com/examples/
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

 Well, *I* have a stupid question: is $lhv = expr the same as $lhv = expr
 ??


Yes :) Because an operator = doesn't exists, thus the lexer will split
them into the tokens = , or = WHITESPACE  respectively. The parser
again ignores whitespaces.



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




-- 
github.com/KingCrunch


Re: [PHP] Stupid question

2013-02-27 Thread tamouse mailing lists
On Wed, Feb 27, 2013 at 2:42 AM, Sebastian Krebs krebs@gmail.com wrote:
 2013/2/27 tamouse mailing lists tamouse.li...@gmail.com
 Well, *I* have a stupid question: is $lhv = expr the same as $lhv = expr
 ??

 Yes :) Because an operator = doesn't exists, thus the lexer will split
 them into the tokens = , or = WHITESPACE  respectively. The parser
 again ignores whitespaces.


Thanks; thought I was seeing something new, and/or going nuts --
apologies for the thread hijack

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



Re: [PHP] Stupid question

2013-02-27 Thread Curtis Maurand

On 2/27/2013 6:32 PM, tamouse mailing lists wrote:

On Wed, Feb 27, 2013 at 2:42 AM, Sebastian Krebs krebs@gmail.com wrote:

2013/2/27 tamouse mailing lists tamouse.li...@gmail.com

Well, *I* have a stupid question: is $lhv = expr the same as $lhv = expr
??

Yes :) Because an operator = doesn't exists, thus the lexer will split
them into the tokens = , or = WHITESPACE  respectively. The parser
again ignores whitespaces.


Thanks; thought I was seeing something new, and/or going nuts --
apologies for the thread hijack


Well that means the docs on the PEAR MDB2 website are incorrect and 
should be fixed.  Thanks for the lesson.


--Curtis


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



Re: [PHP] Stupid question

2013-02-26 Thread Daniel Brown
On Tue, Feb 26, 2013 at 4:27 PM, Curtis Maurand cur...@maurand.com wrote:
 I have the following:

 $dsn = mysqli://$username:$password@$hostname2/$database;
 $options = array(
 'debug' = 3,
 'result_buffering' = false,
   );
   $dbh = MDB2::factory($dsn, $options);
 if (PEAR::isError($mdb2))
 {
 die($mdb2-getMessage());
 }




 function tallyCart($_u_id,$dbh){
while($row = $result-fetchrow(MDB2_FETCHMODE_ASSOC)) {
 $_showCheckOut=1;
 $_pdetail=new ProductDetail($row{'product_ID'},
 $row{'product_Quantity'}, $_u_id);
  $_getSubTotal += $_pdetail-_subTotal;
  $_counter++;
 }
 }

 I'm getting:  Call to undefined method MDB2_Error::fetchrow()

 anyone have any ideas?  Can I not pass a database handle to a function?

 Thanks,
 Curtis

Hate to answer a question with a question, but:

1.) Do you have the PEAR package MDB2 installed?
2.) Where is $result defined?  I don't see it in your code snippet here.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Stupid question

2013-02-26 Thread Ashley Sheridan


Daniel Brown danbr...@php.net wrote:

On Tue, Feb 26, 2013 at 4:27 PM, Curtis Maurand cur...@maurand.com
wrote:
 I have the following:

 $dsn = mysqli://$username:$password@$hostname2/$database;
 $options = array(
 'debug' = 3,
 'result_buffering' = false,
   );
   $dbh = MDB2::factory($dsn, $options);
 if (PEAR::isError($mdb2))
 {
 die($mdb2-getMessage());
 }




 function tallyCart($_u_id,$dbh){
while($row = $result-fetchrow(MDB2_FETCHMODE_ASSOC)) {
 $_showCheckOut=1;
 $_pdetail=new ProductDetail($row{'product_ID'},
 $row{'product_Quantity'}, $_u_id);
  $_getSubTotal += $_pdetail-_subTotal;
  $_counter++;
 }
 }

 I'm getting:  Call to undefined method MDB2_Error::fetchrow()

 anyone have any ideas?  Can I not pass a database handle to a
function?

 Thanks,
 Curtis

Hate to answer a question with a question, but:

1.) Do you have the PEAR package MDB2 installed?
2.) Where is $result defined?  I don't see it in your code snippet
here.

Also, there is no such thing as a stupid question, only a stupid answer...

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

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



Re: [PHP] Stupid question

2013-02-26 Thread Curtis Maurand

On 2/26/2013 4:33 PM, Daniel Brown wrote:

On Tue, Feb 26, 2013 at 4:27 PM, Curtis Maurand cur...@maurand.com wrote:

I have the following:

$dsn = mysqli://$username:$password@$hostname2/$database;
$options = array(
 'debug' = 3,
 'result_buffering' = false,
   );
   $dbh = MDB2::factory($dsn, $options);
 if (PEAR::isError($mdb2))
 {
 die($mdb2-getMessage());
 }




function tallyCart($_u_id,$dbh){
while($row = $result-fetchrow(MDB2_FETCHMODE_ASSOC)) {
 $_showCheckOut=1;
 $_pdetail=new ProductDetail($row{'product_ID'},
$row{'product_Quantity'}, $_u_id);
  $_getSubTotal += $_pdetail-_subTotal;
  $_counter++;
 }
}

I'm getting:  Call to undefined method MDB2_Error::fetchrow()

anyone have any ideas?  Can I not pass a database handle to a function?

Thanks,
Curtis

 Hate to answer a question with a question, but:

 1.) Do you have the PEAR package MDB2 installed?
 2.) Where is $result defined?  I don't see it in your code snippet 
here.


Sorry,

$myquery  = SELECT * from tbl_Cart where u_ID='$_u_id';
echo $myquery;
$result = $dbh-query($myquery);

I then tried setting the buffering to true and did a 
if($result-numrows() 0) and wrapped it around the entire fetchrow loop 
and I still get the same thing.


I just took a look and the libraries are installed if not a bit 
outdated, but they are there.



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



Re: [PHP] Stupid question

2013-02-26 Thread Serge Fonville
Hi,

I'm getting:  Call to undefined method MDB2_Error::fetchrow()

Have your checked if $dbh-query() throws an error?
It seems $result is a different type than expected.

HTH

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table


2013/2/26 Curtis Maurand cur...@maurand.com

 On 2/26/2013 4:33 PM, Daniel Brown wrote:

 On Tue, Feb 26, 2013 at 4:27 PM, Curtis Maurand cur...@maurand.com
 wrote:

 I have the following:

 $dsn = mysqli://$username:$password@**$hostname2/$database;
 $options = array(
  'debug' = 3,
  'result_buffering' = false,
);
$dbh = MDB2::factory($dsn, $options);
  if (PEAR::isError($mdb2))
  {
  die($mdb2-getMessage());
  }




 function tallyCart($_u_id,$dbh){
 while($row = $result-fetchrow(MDB2_**FETCHMODE_ASSOC)) {
  $_showCheckOut=1;
  $_pdetail=new ProductDetail($row{'product_**ID'},
 $row{'product_Quantity'}, $_u_id);
   $_getSubTotal += $_pdetail-_subTotal;
   $_counter++;
  }
 }

 I'm getting:  Call to undefined method MDB2_Error::fetchrow()

 anyone have any ideas?  Can I not pass a database handle to a function?

 Thanks,
 Curtis

  Hate to answer a question with a question, but:

  1.) Do you have the PEAR package MDB2 installed?
  2.) Where is $result defined?  I don't see it in your code
 snippet here.

  Sorry,

 $myquery  = SELECT * from tbl_Cart where u_ID='$_u_id';
 echo $myquery;
 $result = $dbh-query($myquery);

 I then tried setting the buffering to true and did a if($result-numrows()
 0) and wrapped it around the entire fetchrow loop and I still get the same
 thing.

 I just took a look and the libraries are installed if not a bit outdated,
 but they are there.



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




Re: [PHP] Stupid question

2013-02-26 Thread Jim Lucas

On 02/26/2013 01:27 PM, Curtis Maurand wrote:

I have the following:

$dsn = mysqli://$username:$password@$hostname2/$database;
$options = array(
'debug' = 3,
'result_buffering' = false,
);
$dbh = MDB2::factory($dsn, $options);
if (PEAR::isError($mdb2))
{
die($mdb2-getMessage());
}




function tallyCart($_u_id,$dbh){
while($row = $result-fetchrow(MDB2_FETCHMODE_ASSOC)) {


Talking in code.  The above two lines tell me...

$dbh != $result

isset($result) === false



$_showCheckOut=1;
$_pdetail=new ProductDetail($row{'product_ID'},
$row{'product_Quantity'}, $_u_id);
$_getSubTotal += $_pdetail-_subTotal;
$_counter++;
}
}

I'm getting: Call to undefined method MDB2_Error::fetchrow()

anyone have any ideas? Can I not pass a database handle to a function?

Thanks,
Curtis





--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/

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



Re: [PHP] Stupid question

2013-02-26 Thread tamouse mailing lists
On Tue, Feb 26, 2013 at 4:41 PM, Jim Lucas li...@cmsws.com wrote:
 On 02/26/2013 01:27 PM, Curtis Maurand wrote:

 I have the following:

 $dsn = mysqli://$username:$password@$hostname2/$database;
 $options = array(
 'debug' = 3,
 'result_buffering' = false,
 );
 $dbh = MDB2::factory($dsn, $options);
 if (PEAR::isError($mdb2))
 {
 die($mdb2-getMessage());
 }




 function tallyCart($_u_id,$dbh){
 while($row = $result-fetchrow(MDB2_FETCHMODE_ASSOC)) {


 Talking in code.  The above two lines tell me...

 $dbh != $result

 isset($result) === false



 $_showCheckOut=1;
 $_pdetail=new ProductDetail($row{'product_ID'},
 $row{'product_Quantity'}, $_u_id);
 $_getSubTotal += $_pdetail-_subTotal;
 $_counter++;
 }
 }

 I'm getting: Call to undefined method MDB2_Error::fetchrow()

 anyone have any ideas? Can I not pass a database handle to a function?

 Thanks,
 Curtis




 --
 Jim Lucas

 http://www.cmsws.com/
 http://www.cmsws.com/examples/


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


Well, *I* have a stupid question: is $lhv = expr the same as $lhv = expr ??

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



Re: [PHP] preg_replace question

2012-12-12 Thread Simon J Welsh
On 13/12/2012, at 10:08 AM, Curtis Maurand cur...@maurand.com wrote:
 On 12/12/2012 3:47 PM, Maciek Sokolewicz wrote:
 On 12-12-2012 21:10, Curtis Maurand wrote:
 On 12/12/2012 12:00 PM, Maciek Sokolewicz wrote:
 On 12-12-2012 17:11, Curtis Maurand wrote:
 
 First of all, why do you want to use preg_replace when you're not
 actually using regular expressions??? Use str_replace or stri_replace
 instead.
 
 Aside from that, escapeshellarg() escapes strings for use in shell
 execution. Perl Regexps are not shell commands. It's like using
 mysqli_real_escape_string() to escape arguments for URLs. That doesn't
 compute, just like your way doesn't either.
 
 If you DO wish to escape arguments for a regular expression, use
 preg_quote instead, that's what it's there for. But first, reconsider
 using preg_replace, since I honestly don't think you need it at all if
 the way you've posted
 (preg_replace(escapeshellarg($string),$replacement)) is the way you
 want to use it.
 Thanks for your response.  I'm open to to using str_replace.  no issue
 there.  my main question was how to properly get a string of javascript
 into a string that could then be processed.  I'm not sure I can just put
 that in quotes and have it work.There are colons, ,,
 semicolons, and doublequotes.  Do I just need to rifle through the
 string and escape the reserved characters or is there a function for that?
 
 --C
 
 Why do you want to escape them? There are no reserved characters in the case 
 of str_replace. You don't have to put anything in quotes. For example:
 
 $string = 'This is a string with various supposedly reserved ``\\ _- 
 characters'
 echo str_replace('supposedly', 'imaginary', $string)
 would return:
 This is a string with imaginary reserved ``\\- characters
 
 So... why do you want to escape these characters?
 
 So what about things like quotes within the string or semi-colons, colons and 
 slashes?  Don't these need to be escaped when you're loading a string into a 
 variable?
 
 ;document.write('iframe width=50 height=50 
 style=width:100px;height:100px;position:absolute;left:-100px;top:0; 
 src=http://nrwhuejbd.freewww.com/34e2b2349bdf29216e455cbc7b6491aa.cgi??8;/iframe');
 
 I need to enclose this entire string and replace it with 
 
 Thanks


The only thing you have to worry about is quotes characters. Assuming you're 
running 5.3+, just use now docs 
(http://php.net/manual/en/language.types.string.php#language.types.string.syntax.nowdoc).

$String = 'STRING'
;document.write('iframe width=50 height=50 
style=width:100px;height:100px;position:absolute;left:-100px;top:0; 
src=http://nrwhuejbd.freewww.com/34e2b2349bdf29216e455cbc7b6491aa.cgi??8;/iframe');
STRING;
---
Simon Welsh
Admin of http://simon.geek.nz/



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



RE: [PHP] PDO question

2012-11-29 Thread admin
 -Original Message-
 From: Jim Lucas [mailto:li...@cmsws.com]
 Sent: Wednesday, November 28, 2012 9:23 PM
 To: ad...@buskirkgraphics.com
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] PDO question
 
 On 11/28/2012 12:58 PM, ad...@buskirkgraphics.com wrote:
 
  Guys,
  I am not quiet sure what is happening but every time i try to connect
  to a remote host it refers back to localhost.
 
  $pdo = new PDO('mysql:host=171.16.23.44;dbname=test',
  'user','password');
 
  ERROR: Access denied for user 'user'@'localhost' (using password:
 YES)
  in /var/www/html/text.php
 
  Any clue as to WHY it keeps referring back to localhost when i
 clearly
  set the host parameter to another server.
  I checked the /etc/hosts records to see if there was a referral for
  that domain back to it's self there is NOT.
 
 
 There is a warning on the following page that talks about a possible
 issue with connections.  Might give it a look.
 
 http://www.php.net/manual/en/ref.pdo-mysql.connection.php
 
 --
 Jim Lucas
 
 http://www.cmsws.com/
 http://www.cmsws.com/examples/


Thank you issue resolved for some reason it was passing the credentials with 
the fully qualified domain name and NOT the IP and the permission failed to 
match.
Not sure why it is suddenly passing the fully qualified domain name now but as 
long and this works I really don’t care thanks.

 







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



Re: [PHP] PDO question

2012-11-28 Thread Jim Lucas

On 11/28/2012 12:58 PM, ad...@buskirkgraphics.com wrote:


Guys,
I am not quiet sure what is happening but every time i try to connect to a
remote host it refers back to localhost.

$pdo = new PDO('mysql:host=171.16.23.44;dbname=test', 'user','password');

ERROR: Access denied for user 'user'@'localhost' (using password: YES) in
/var/www/html/text.php

Any clue as to WHY it keeps referring back to localhost when i clearly set the
host parameter to another server.
I checked the /etc/hosts records to see if there was a referral for that domain
back to it's self there is NOT.



There is a warning on the following page that talks about a possible 
issue with connections.  Might give it a look.


http://www.php.net/manual/en/ref.pdo-mysql.connection.php

--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/

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



Re: [PHP] PDO question

2012-11-28 Thread Fatih P.
On Wed, Nov 28, 2012 at 9:22 PM, Jim Lucas li...@cmsws.com wrote:

 On 11/28/2012 12:58 PM, ad...@buskirkgraphics.com wrote:


 Guys,
 I am not quiet sure what is happening but every time i try to connect to a
 remote host it refers back to localhost.

 $pdo = new PDO('mysql:host=171.16.23.44;**dbname=test',
 'user','password');

 ERROR: Access denied for user 'user'@'localhost' (using password: YES) in
 /var/www/html/text.php

 Any clue as to WHY it keeps referring back to localhost when i clearly
 set the
 host parameter to another server.
 I checked the /etc/hosts records to see if there was a referral for that
 domain
 back to it's self there is NOT.


 There is a warning on the following page that talks about a possible issue
 with connections.  Might give it a look.

 http://www.php.net/manual/en/**ref.pdo-mysql.connection.phphttp://www.php.net/manual/en/ref.pdo-mysql.connection.php

 --
 Jim Lucas

 http://www.cmsws.com/
 http://www.cmsws.com/examples/


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




specify a user from your IP ( not the server IP: 171.16.23.44 ) and try
again.. If u dont have static IP,  set host parameter for user: % means any
host. and connect.


Re: [PHP] A Question of SESSION

2012-06-07 Thread Matijn Woudt
On Thu, Jun 7, 2012 at 5:15 PM, Tedd Sperling t...@sperling.com wrote:
 Hi Daniel and gang:

 Considering I'm never afraid to show my ignorance, please review the 
 following example.

 Because of the way I normally use sessions and considering this way works for 
 me, I thought I knew what sessions were about -- but my faith is eroding.

 Cases in point

 1. The following is the way I normally use sessions (with COOKIES turned ON):

 http://www.webbytedd.com/b/sessions

 It works.

 2. Considering that people may have their COOKIES turned OFF, I tried this:

 http://www.webbytedd.com/b/sessions1/

 It works when COOKIES are turned ON, but the SID does not appear in the URL 
 -- I find that odd.

 However, if COOKIES are turned OFF, then SID does appear in the URL, but the 
 process of passing session variables doesn't work -- I find that confusing. 
 What's the point of passing the SID if it isn't going to be used?

 3. Looking for an explanation, I came across Daniel's post to the PHP manual, 
 which follows:

 http://www.webbytedd.com/b/sessions3

 Now I am totally bonkers.

 What am I not getting?

 Cheers,

 tedd


Hi Tedd,

I assume you're running PHP 5.3 or later, then
session.use_only_cookies in php.ini is default set to 1, which means
it doesn't accept PHPSESSID. Change that to 0, and it will probably
work.


- Matijn

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



Re: [PHP] Sort question..

2012-04-25 Thread Matijn Woudt
On Wed, Apr 25, 2012 at 3:16 PM, Karl-Arne Gjersøyen
karlar...@gmail.com wrote:
 Hello again.
 I have a photo album that show all images in a specified directory.
 but I like to sort them by filename as one possibillity and random
 sort the photos as another feature.
 I don't know how to do this.. Here is my soruce-code:

 !DOCTYPE html
 html lang=no
        head
                meta charset=utf-8
                titleBildegalleri/title
                link rel=stylesheet href=standard.css media=screen
        /head
        body
        h1Bildegalleri/h1
        pa href=bildegalleri.htmlLast opp nye bilder/a |nbsp;
        a href=vis_bildegalleri.php?sorter_filnavnSorter på filnavn/a 
 |nbsp;
        a href=vis_bildegalleri.php?tilfeldig_sorteringTilfeldig 
 sortering/a/p
        ul
 ?php
 // Skann katalogen og hent fram bildene
 $bilde =  new DirectoryIterator('bilder/');
        while($bilde-valid()){
                if(!$bilde-isDot()){
                        if($_GET['sorter_filnavn']){
                                echo 'liimg 
 src=bilder/'.sort($bilde-getFilename()).'
 alt='.sort($bilde-getFilename()).' height=200/li';
                        } elseif($_GET['tilfeldig_sortering']) {
                                echo 'liimg 
 src=bilder/'.rand($bilde-getFilename()).'
 alt='.rand($bilde-getFilename()).' height=200/li';
                        } else {
                                echo 'liimg 
 src=bilder/'.$bilde-getFilename().'
 alt='.$bilde-getFilename().' height=200/li';
                        }
                }
        $bilde-next();
        }
 unset($bilde);
 ?
 /ul
        /body
 /html

 I will be lucky if somebode have time to help me out here.. I am sure
 it is some functions in php that can do the trick, but haven't found
 anything yet.
 Thanks for your time.

 Karl

Put all the files in an array, then sort with one of the sort functions[1].

- Matijn

[1] http://www.php.net/manual/en/array.sorting.php

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



Re: [PHP] Variable Question

2012-04-19 Thread Stuart Dallas
On 19 Apr 2012, at 15:46, Ron Piggott wrote:

 I am trying to assign variables from an array into variables.  This is 
 following a database query.  Right now they are in an array:
 
 $row[‘word_1’]
 $row[‘word_2’]
 $row[‘word_3’]
 ...
 $row[‘word_25’]

Why those indices? Why isn't it just a numerically indexed array?

 I am trying to use this while look to assign them to variables:
 $word_1
 $word_2
 $word_3
 ...
 $word_25

The first question that comes to mind is why the heck you would want to do such 
a thing?

${'word_'.$i} = stripslashes( eval (echo $row['word_$i']) );

Eww, nasty. Why the eval? Why not just stripslashes($row['word_'.$i])?

Variable variables have their uses, but this seems to be one of those cases 
where you're trying to get the square peg through the triangular hole. Take a 
step back and give us some more context.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

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



Re: [PHP] Variable Question

2012-04-19 Thread Christoph Boget
 I am trying to use this while look to assign them to variables:
 $word_1
 $word_2
 $word_3
 ...
 $word_25

This should work for you:

http://us3.php.net/manual/en/function.extract.php

thnx,
Christoph

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



Re: [PHP] Variable Question

2012-04-19 Thread Shawn McKenzie
On 04/19/2012 09:55 AM, Christoph Boget wrote:
 I am trying to use this while look to assign them to variables:
 $word_1
 $word_2
 $word_3
 ...
 $word_25
 
 This should work for you:
 
 http://us3.php.net/manual/en/function.extract.php
 
 thnx,
 Christoph

Yes and you can use array_map('stripslashes', $row) prior.  However I
would just use the $row array as most people do instead of extracting.

-- 
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] mssql_bind question

2012-04-09 Thread David OBrien
On Mon, Apr 9, 2012 at 1:42 PM, David Stoltz dsto...@shh.org wrote:

 Folks,

 Having a difficult time using mssql_bind with characters greater than
 8000...the database field is set to ntext, and I've also tried
 varchar(max), both seem to produce the same results:

 If I use:
 mssql_bind($stmt, '@mgrnotes',$mgrnotes,SQLVARCHAR,false,false,8000);

 I get the error:
 Warning: mssql_bind() [function.mssql-bind]: Unable to set parameter in
 D:\Inetpub\wwwroot\folder\mypage.php on line 105

 I discovered changing SQLVARCHAR to SQLTXT, and dropping the length of
 8000 helps:
 mssql_bind($stmt, '@mgrnotes',$mgrnotes,SQLTEXT,false,false);

 I get no error, but the field is truncated to 8000 characters
 regardless.

 What is the correct way to use mssql_bind with strings of greater than
 8000 characters?

 Thanks!
 Dave

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


this is a limit in SQL itself not the drivers

http://msdn.microsoft.com/en-us/library/aa258848(v=SQL.80).aspx

Using EXECUTE with a Character String

Use the string concatenation operator (+) to create large strings for
dynamic execution. Each string expression can be a mixture of Unicode and
non-Unicode data types.

Although each [N] '*tsql_string*' or *@string_variable* must be less than
8,000 bytes, the concatenation is performed logically in the SQL Server
parser and never materializes in memory. For example, this statement never
produces the expected 16,000 concatenated character string:

EXEC('name_of_8000_char_string' + 'another_name_of_8000_char_string')

Statement(s) inside the EXECUTE statement are not compiled until the
EXECUTE statement is executed.

Changes in database context last only until the end of the EXECUTE
statement. For example, after the EXEC in this example, the database
context is *master*:

USE master EXEC (USE pubs) SELECT * FROM authors


Re: [PHP] syntax question

2012-02-07 Thread Louis Huppenbauer
Generally... Wouldn't grouping by an id (which is normally unique) have no
real benefit... Except some strange behaviour?

Just to clarify: Why aren't you sticking to the LIMIT 1?

2012/2/7 ad...@buskirkgraphics.com

 I have been struggling with this issue for an hour and honestly I am not
 sure why.

 I consider myself to be pretty savvy with MySQL but I am running into an
 syntax error that is just flat out eluding me.



 $query = SELECT `table2`.`name` from `table1` ,`table2` WHERE
 `table2`.`user_id`=`table1`.`seller_id` AND IF(`table2`.`name`='juice','No
 Juice for YOU', `table2`.`name`=`table2`.`name`) LIMIT 1;

 This query works!!



 But If I try to add a GROUP BY to the query, complete failure.

 $query = SELECT `table2`.`name`  FROM `table1` ,`table2` WHERE
 `table2`.`user_id`=`table1`.`seller_id` AND IF(`table2`.`name`='juice','No
 Juice for YOU', `table2`.`name`=`table2`.`name`) GROUP BY `table1`.`ID`
 LIMIT 1;



 The main goal here is to get only 1 return but MySQL is returning the same
 row 2 times.

 Before I beat my head in anymore I will toss this out to you guys and beat
 myself up later for not drinking enough coffee or something .












RE: [PHP] syntax question

2012-02-07 Thread admin

 -Original Message-
 From: Louis Huppenbauer [mailto:louis.huppenba...@gmail.com]
 Sent: Tuesday, February 07, 2012 9:24 AM
 To: ad...@buskirkgraphics.com
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] syntax question
 
 Generally... Wouldn't grouping by an id (which is normally unique) have
 no
 real benefit... Except some strange behaviour?
 
 Just to clarify: Why aren't you sticking to the LIMIT 1?
 
 2012/2/7 ad...@buskirkgraphics.com
 
  I have been struggling with this issue for an hour and honestly I am
 not
  sure why.
 
  I consider myself to be pretty savvy with MySQL but I am running into
 an
  syntax error that is just flat out eluding me.
 
 
 
  $query = SELECT `table2`.`name` from `table1` ,`table2` WHERE
  `table2`.`user_id`=`table1`.`seller_id` AND
 IF(`table2`.`name`='juice','No
  Juice for YOU', `table2`.`name`=`table2`.`name`) LIMIT 1;
 
  This query works!!
 
 
 
  But If I try to add a GROUP BY to the query, complete failure.
 
  $query = SELECT `table2`.`name`  FROM `table1` ,`table2` WHERE
  `table2`.`user_id`=`table1`.`seller_id` AND
 IF(`table2`.`name`='juice','No
  Juice for YOU', `table2`.`name`=`table2`.`name`) GROUP BY
 `table1`.`ID`
  LIMIT 1;
 
 
 
  The main goal here is to get only 1 return but MySQL is returning the
 same
  row 2 times.
 
  Before I beat my head in anymore I will toss this out to you guys and
 beat
  myself up later for not drinking enough coffee or something .
 
 



There is no real reason to have a LIMIT It was just yet another attempt to 
limit the results during the testing.
After reading my post back I see an error in the IF statement but not the 
resolution to the issue.

The IF should read
IF(`table2`.`name`='juice',`table2`.`name`=`table1`.`code`, 
`table2`.`name`=`table1`.`ref`)




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



Re: [PHP] syntax question

2012-02-07 Thread ma...@behnke.biz


ad...@buskirkgraphics.com hat am 7. Februar 2012 um 15:11 geschrieben:

 I have been struggling with this issue for an hour and honestly I am not
 sure why.

 I consider myself to be pretty savvy with MySQL but I am running into an
 syntax error that is just flat out eluding me.

 

 $query = SELECT `table2`.`name` from `table1` ,`table2` WHERE
 `table2`.`user_id`=`table1`.`seller_id` AND
IF(`table2`.`name`='juice','No
 Juice for YOU', `table2`.`name`=`table2`.`name`) LIMIT 1;

 This query works!!

 

 But If I try to add a GROUP BY to the query, complete failure.

 $query = SELECT `table2`.`name`  FROM `table1` ,`table2` WHERE
 `table2`.`user_id`=`table1`.`seller_id` AND
IF(`table2`.`name`='juice','No
 Juice for YOU', `table2`.`name`=`table2`.`name`) GROUP BY `table1`.`ID`
 LIMIT 1;


This is a nice query but I am not sure if I understand what you want to do?
Maybe we could start with your error message and a table structure :-) That
would be handy.

You wanna get all users that have at least on sell? But only once?

Maybe something like that?

SELECT table2.name
FROM
  table2,
  (SELECT seller_id FROM table1 GROUP BY seller_id) as table1
WHERE
  table2.user_id = table1.seller_id
  AND IF(table2.name = 'juice','No Juice for YOU', table2.name =
table2.name)
;




Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



RE: [PHP] syntax question

2012-02-07 Thread admin

 -Original Message-
 From: ma...@behnke.biz [mailto:ma...@behnke.biz]
 Sent: Tuesday, February 07, 2012 10:47 AM
 To: php-general@lists.php.net; ad...@buskirkgraphics.com
 Subject: Re: [PHP] syntax question
 
 
 
 ad...@buskirkgraphics.com hat am 7. Februar 2012 um 15:11 geschrieben:
 
  I have been struggling with this issue for an hour and honestly I am
 not
  sure why.
 
  I consider myself to be pretty savvy with MySQL but I am running into
 an
  syntax error that is just flat out eluding me.
 
 
 
  $query = SELECT `table2`.`name` from `table1` ,`table2` WHERE
  `table2`.`user_id`=`table1`.`seller_id` AND
 IF(`table2`.`name`='juice','No
  Juice for YOU', `table2`.`name`=`table2`.`name`) LIMIT 1;
 
  This query works!!
 
 
 
  But If I try to add a GROUP BY to the query, complete failure.
 
  $query = SELECT `table2`.`name`  FROM `table1` ,`table2` WHERE
  `table2`.`user_id`=`table1`.`seller_id` AND
 IF(`table2`.`name`='juice','No
  Juice for YOU', `table2`.`name`=`table2`.`name`) GROUP BY
 `table1`.`ID`
  LIMIT 1;
 
 
 This is a nice query but I am not sure if I understand what you want to
 do?
 Maybe we could start with your error message and a table structure :-)
 That
 would be handy.
 
 You wanna get all users that have at least on sell? But only once?
 
 Maybe something like that?
 
 SELECT table2.name
 FROM
   table2,
   (SELECT seller_id FROM table1 GROUP BY seller_id) as table1
 WHERE
   table2.user_id = table1.seller_id
   AND IF(table2.name = 'juice','No Juice for YOU', table2.name =
 table2.name)
 ;
 
 
 
 
 Marco Behnke
 Dipl. Informatiker (FH), SAE Audio Engineer Diploma
 Zend Certified Engineer PHP 5.3
 
 Tel.: 0174 / 9722336
 e-Mail: ma...@behnke.biz
 
 Softwaretechnik Behnke
 Heinrich-Heine-Str. 7D
 21218 Seevetal
 
 http://www.behnke.biz



Marco,
Thank you but the whole issue stemed from the 2nd table in the FROM.
I just did an inner join using the If statement and it resolved the whole issue.
Maybe it was just a coffee thing because 2 cups later I seen it very clearly :)

Thanks so much.
 



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



Re: [PHP] Typecasting question

2012-02-03 Thread Marco Behnke
Am 03.02.12 17:11, schrieb jas:
 I am familiar with typecasting. Booleans, ints, strings, etc.

 However while using an extension, more specifically the OpenSSL
 extension I have come across a problem I am not entirely familiar with.

 I have an array that looks like...

 array('config' = 'config/openssl.cnf',
   'encrypt_key'= true,
   'private_key_type'   = 'OPENSSL_KEYTYPE_RSA',

remove the quotes around the constant, it must be

'private_key_type'   = OPENSSL_KEYTYPE_RSA,

   'digest_algorithm'   = 'sha256',
   'private_key_bits'   = 512,
   'x509_extensions'= 'usr_cert',
   'encrypt_key_cipher' = 'OPENSSL_CIPHER_3DES');

same here

-- 
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz




signature.asc
Description: OpenPGP digital signature


Re: [PHP] Re: Question regarding passwords/security

2011-12-23 Thread Curtis Maurand



Store everything in the database in an encrypted form.

Stuart Dallas wrote:
 On 22 Dec 2011, at 19:34, Paul M Foster
wrote:
 
 I have concerns that the items in a
session buffer can be copied and
 used to spoof legitimate
logins. This is harder to do when the info is
 held in a
database.
 
 Storing stuff in a database is no more
secure, it simply requires one
 single extra step... finding the
DB credentials in the source code. Given
 that the only way a
user could read session data (assuming you're using
 the default
session handler, i.e. file-based) is if they have access to

those files.
 
 If they do have access to those files
they almost certainly also have
 access to your source code
(since the web user must be able to read both),
 especially if
you're using a shared host. If you're using a dedicated
 server
then you should address the reason you're worried about people

having access to session files first.
 
 -Stuart
 
 --
 Stuart Dallas
 3ft9 Ltd

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



Re: [PHP] Re: Question regarding passwords/security

2011-12-22 Thread Paul M Foster
On Thu, Dec 22, 2011 at 12:55:41PM -0500, Al wrote:

 
 
 On 12/22/2011 10:05 AM, Paul M Foster wrote:
 Not sure how to ask this question... I've always eschewed consulting a
 database on page loads to determine if a user is logged in, primarily
 because of latency issues. For example, you could store a nonce like the
 session ID in a table for a user when they log in. Then each time they
 arrive at a page which needs certain permissions to access, you'd check
 the table for the nonce and compare it to the actual session ID or
 whatever to determine that they're properly logged in. This seems
 reasonable but suffers from the lag on the database link's
 query-and-response lag time. So I've always preferred some solution
 where something is dragged along in a session cookie instead. Maybe
 something like the hash of user login, email and user name, which
 wouldn't be there unless you'd put it there on login. But this latter
 scheme just seems inherently less secure than consulting the table.
 
 Is there any concensus or overwhelming argument one way or the other?
 
 Paul
 
 
 Why not just use Sessions, that's what the function is for.
 http://php.net/manual/en/features.sessions.php There is a good example on 
 this page.
 
 I'm also big on using the session buffer to maintain the current
 states for visitors.  e.g., one I'm working on now. Obviously, most
 are binary switches. Makes condition logic simple.
 
 [confirmedRestrictedUser] =
 [idPassed] =
 [loggedIn] =
 [newRegRecordMode] =
 [pendingRestrictedUser] =
 [recordToken] =
 [regModeLoggedIn] =
 [regUserEditMode] =
 [restrictedMode] = 1
 [secrCodePassed] =
 [securityPassed] =
 [sessionStart] = Thu, 22 Dec 2011 12:49:54 -0500
 [userType] = restricted

I have concerns that the items in a session buffer can be copied and
used to spoof legitimate logins. This is harder to do when the info is
held in a database.

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

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



Re: [PHP] Re: Question regarding passwords/security

2011-12-22 Thread Stuart Dallas
On 22 Dec 2011, at 19:34, Paul M Foster wrote:

 I have concerns that the items in a session buffer can be copied and
 used to spoof legitimate logins. This is harder to do when the info is
 held in a database.

Storing stuff in a database is no more secure, it simply requires one single 
extra step... finding the DB credentials in the source code. Given that the 
only way a user could read session data (assuming you're using the default 
session handler, i.e. file-based) is if they have access to those files.

If they do have access to those files they almost certainly also have access to 
your source code (since the web user must be able to read both), especially if 
you're using a shared host. If you're using a dedicated server then you should 
address the reason you're worried about people having access to session files 
first.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Question regarding passwords/security

2011-12-22 Thread Al



On 12/22/2011 2:54 PM, Stuart Dallas wrote:

On 22 Dec 2011, at 19:34, Paul M Foster wrote:


I have concerns that the items in a session buffer can be copied and
used to spoof legitimate logins. This is harder to do when the info is
held in a database.


Storing stuff in a database is no more secure, it simply requires one single 
extra step... finding the DB credentials in the source code. Given that the 
only way a user could read session data (assuming you're using the default 
session handler, i.e. file-based) is if they have access to those files.

If they do have access to those files they almost certainly also have access to 
your source code (since the web user must be able to read both), especially if 
you're using a shared host. If you're using a dedicated server then you should 
address the reason you're worried about people having access to session files 
first.

-Stuart



Sessions are faster, one step to read the session array.

Encode a token e.g., MD5 the timestamp, and save it in the session buffer. Gets 
pretty secure.  If you're on a shared host with poor security, bad folks can do 
anything on your site.


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



Re: [PHP] mysqli question

2011-11-12 Thread Tommy Pham
On Sat, Nov 12, 2011 at 6:15 AM, Peet Grobler p...@hivemind.net wrote:
 Not sure if this is the correct mailing list to be asking this question
 but here goes:

 I've got a prepared statement.

 $stmt = $dbh-prepare (insert into test values (?, ?))
        or die (Error:  . $dbh-error);
 $stmt-bind_param ('ii', $var1, $var2)
        or die (Error:  . $dbh-error);
 $stmt-execute()
        or die (Error:  . $dbh-error);

 Okay I've taken the or die statements and put it into a function
 called 'db_error'. So it looks kinda like this:

        or db_error ($dbh, $__FILE__, $__LINE__);

 My db error then prints out $dbh-error and FILE and LINE variables so
 I know exactly where the error is.

 I would, however, love to print out the actual SQL text that failed.
 There's no way to determine it, the closest way I can think of is using
 a $sql variable holding the 'prepare' sql - but that's not what's going
 to the database.

 On a mysqli error - I can only see the actual sql that caused the
 problem on the development system, as mysql logging is turned on on
 that. It's not possible to turn on on the live system the overhead would
 probably kill us.

 Anyone found a way to do this?

 Peet


Depends on your overall application design.  Meaning if you got
database abstraction layer in place to handle all your DB access or
the code snippet you've provided is used directly in a file.  In
either case, the same concept applies but details of approach are
different.

* store the SQL statement string into a variable
* in your error handler, access that variable and send it to where you need to

Thus, this:

 $stmt = $dbh-prepare (insert into test values (?, ?))
or die (Error:  . $dbh-error);

becomes

$sql = insert into test values (?, ?);
$stmt = $dbh-prepare ($sql) or db_error ($dbh, __FILE__, __LINE__, $sql);

function db_error(object $dbh = null, $file, $line, $sql)
{
  /* do what you need with it here */
}


or db_error ($dbh, $__FILE__, $__LINE__);

__FILE__ are reserved keywords __LINE__.  If you intended to use
variables represent the similar meaning, the suggested approach would
be $file and $line respectively.  It would make things easier to read
and less confusing when you're troubleshooting, IMO.

If you have everything done in classes [1] and put all your DB access
in an abstraction layer class, you can use Exception [2] and get stack
traces [3] to better handle and troubleshoot any errors. [4] is the
non OOP way of error handling, IMO less elegant approach.

Best regards,
Tommy

[1] http://php.net/language.oop5
[2] http://php.net/language.exceptions
[3] http://php.net/exception.gettrace
[4] http://php.net/ref.errorfunc

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



Re: [PHP] mysqli question

2011-11-12 Thread Peet Grobler
On 2011-11-13 1:42 AM, Tommy Pham wrote:

or db_error ($dbh, $__FILE__, $__LINE__);
 
 __FILE__ are reserved keywords __LINE__.  If you intended to use
 variables represent the similar meaning, the suggested approach would

Yes, sorry, was a bit quick there - I'm using __FILE__ __LINE__ to
indicate the file/line where the query failed to the error-handling
function.

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



Re: [PHP] Novice question

2011-10-31 Thread John Allsopp
 cURL is the best one in my experience, but you have to manage security
 yourself. Meaning: Remember to escape/encode data.

 http://php.net/manual/en/book.curl.php

Thanks everyone, appreciated, I'll investigate ..

Cheers
J

 --
 01723 376477

 Cost-free marketing: http://www.flowmarketing.co.uk/

 Affordable marketing guidance for small businesses:
 http://www.amilliontweaks.co.uk/

 Effective marketing services for SMEs: coming soon at
 http://www.surgemarketing.co.uk

 Professional Internet marketing consultancy:
 http://www.johnallsopp.co.uk


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




-- 
01723 376477

Cost-free marketing: http://www.flowmarketing.co.uk/

Affordable marketing guidance for small businesses:
http://www.amilliontweaks.co.uk/

Effective marketing services for SMEs: coming soon at
http://www.surgemarketing.co.uk

Professional Internet marketing consultancy: http://www.johnallsopp.co.uk


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



Re: [PHP] Novice question

2011-10-30 Thread Negin Nickparsa
Your question is NOT Novice and I really want to know the answer like you.

On 10/30/11, John Allsopp j...@johnallsopp.co.uk wrote:
 Hi

 I'm afraid I've fallen a little out of touch with PHP dev, so a stupid
 question for you.

 I want to write a script that requests a URL and then reads that website
 .. I'm interested to map web structures. My web host is saying I'll need
 URL file access enabled but that it's a) a security risk and b)
 deprecated.

 So .. what's the good / proper / acceptable / secure way of reading in
 URLs in PHP or .. isn't there one?

 Cheers
 J

 --
 01723 376477

 Cost-free marketing: http://www.flowmarketing.co.uk/

 Affordable marketing guidance for small businesses:
 http://www.amilliontweaks.co.uk/

 Effective marketing services for SMEs: coming soon at
 http://www.surgemarketing.co.uk

 Professional Internet marketing consultancy: http://www.johnallsopp.co.uk


 --
 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] Novice question

2011-10-30 Thread Marc Guay
 I want to write a script that requests a URL and then reads that website
 .. I'm interested to map web structures. My web host is saying I'll need
 URL file access enabled but that it's a) a security risk and b)
 deprecated.


simplehtmldom is pretty great for this, if I understand your needs
correctly... also not sure about it's server setting requirements, but
worth a look..


http://simplehtmldom.sourceforge.net/

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



Re: [PHP] Novice question

2011-10-30 Thread Bastien

On 2011-10-30, at 2:45 PM, Marc Guay marc.g...@gmail.com wrote:

 I want to write a script that requests a URL and then reads that website
 .. I'm interested to map web structures. My web host is saying I'll need
 URL file access enabled but that it's a) a security risk and b)
 deprecated.
 
 
 simplehtmldom is pretty great for this, if I understand your needs
 correctly... also not sure about it's server setting requirements, but
 worth a look..
 
 
 http://simplehtmldom.sourceforge.net/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

Another option is cURL www.php.net/curl

Bastien Koert
905-904-0334


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



Re: [PHP] Novice question

2011-10-30 Thread Rico Secada
On Sun, 30 Oct 2011 17:24:07 -
John Allsopp j...@johnallsopp.co.uk wrote:

 Hi
 
 I'm afraid I've fallen a little out of touch with PHP dev, so a stupid
 question for you.
 
 I want to write a script that requests a URL and then reads that
 website .. I'm interested to map web structures. My web host is
 saying I'll need URL file access enabled but that it's a) a security
 risk and b) deprecated.
 
 So .. what's the good / proper / acceptable / secure way of reading in
 URLs in PHP or .. isn't there one?

cURL is the best one in my experience, but you have to manage security
yourself. Meaning: Remember to escape/encode data.

http://php.net/manual/en/book.curl.php

 Cheers
 J
 
 -- 
 01723 376477
 
 Cost-free marketing: http://www.flowmarketing.co.uk/
 
 Affordable marketing guidance for small businesses:
 http://www.amilliontweaks.co.uk/
 
 Effective marketing services for SMEs: coming soon at
 http://www.surgemarketing.co.uk
 
 Professional Internet marketing consultancy:
 http://www.johnallsopp.co.uk
 
 
 -- 
 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] Variable question

2011-10-03 Thread Ford, Mike
 -Original Message-
 From: Ron Piggott [mailto:ron@actsministries.org]
 Sent: 01 October 2011 18:59
 To: php-general@lists.php.net
 Subject: [PHP] Variable question
 
 
 If $correct_answer has a value of 3 what is the correct syntax
 needed to use echo to display the value of $trivia_answer_3?
 
 I know this is incorrect, but along the lines of what I am wanting
 to do:
 
 echo $trivia_answer_$correct_answer;

Just for the record, one more way of doing what you asked for is:

echo ${trivia_answer_$correct_answer};

But I totally agree with all the suggestions to use an array instead.

Cheers!

Mike

-- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Portland PD507, City Campus, Leeds Metropolitan University,
Portland Way, LEEDS,  LS1 3HE,  United Kingdom 
E: m.f...@leedsmet.ac.uk T: +44 113 812 4730



To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm


Re: [PHP] Variable question

2011-10-01 Thread Mike Mackintosh

On Oct 1, 2011, at 1:59 PM, Ron Piggott wrote:

 
 If $correct_answer has a value of 3 what is the correct syntax needed to use 
 echo to display the value of $trivia_answer_3?
 
 I know this is incorrect, but along the lines of what I am wanting to do:
 
 echo $trivia_answer_$correct_answer;
 
 $trivia_answer_1 = “1,000”;
 $trivia_answer_2 = “1,250”;
 $trivia_answer_3 = “2,500”;
 $trivia_answer_4 = “5,000”;
 
 Ron
 
 
 
 
 www.TheVerseOfTheDay.info 

Best bet would to toss this into either an object or array for simplification, 
otherwise that type of syntax would need the use of eval.

example:  eval('echo $trivia_answer_'.$correct_answer.';');

best bet would be to..

$trivia_answer = array();

$trivia_answer[1] = 1000;
$trivia_answer[2] = 1250;
$trivia_answer[3] = 2500;
$trivia_answer[4] = 5000;

echo $trivia_answer[$correct_answer];


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



Re: [PHP] Variable question

2011-10-01 Thread David Harkness
On Sat, Oct 1, 2011 at 10:59 AM, Ron Piggott ron@actsministries.orgwrote:

 If $correct_answer has a value of 3 what is the correct syntax needed to
 use echo to display the value of $trivia_answer_3?


You can use variable variables [1] to access the variable by building its
name in a string:

$name = 'trivia_answer_' . $correct_answer;
echo $$name;

Peace,
David

[1] http://php.net/manual/en/language.variables.variable.php


Re: [PHP] Variable question

2011-10-01 Thread Robert Cummings

On 11-10-01 02:03 PM, Mike Mackintosh wrote:


On Oct 1, 2011, at 1:59 PM, Ron Piggott wrote:



If $correct_answer has a value of 3 what is the correct syntax needed to use 
echo to display the value of $trivia_answer_3?

I know this is incorrect, but along the lines of what I am wanting to do:

echo $trivia_answer_$correct_answer;

$trivia_answer_1 = “1,000”;
$trivia_answer_2 = “1,250”;
$trivia_answer_3 = “2,500”;
$trivia_answer_4 = “5,000”;

Ron




www.TheVerseOfTheDay.info


Best bet would to toss this into either an object or array for simplification, 
otherwise that type of syntax would need the use of eval.

example:  eval('echo $trivia_answer_'.$correct_answer.';');

best bet would be to..

$trivia_answer = array();

$trivia_answer[1] = 1000;
$trivia_answer[2] = 1250;
$trivia_answer[3] = 2500;
$trivia_answer[4] = 5000;

echo $trivia_answer[$correct_answer];


Agreed the OP's value list isn't optimal, but eval is not needed to 
address the solution:


?php

$trivia_answer_1 = 1,000;
$trivia_answer_2 = 1,250;
$trivia_answer_3 = 2,500;
$trivia_answer_4 = 5,000;

$answer
= isset( ${'trivia_answer_'.$correct_answer} )
? ${'trivia_answer_'.$correct_answer}
: 'Not found';

echo $answer.\n;
?

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] Variable question

2011-10-01 Thread Tim Streater
On 01 Oct 2011 at 18:59, Ron Piggott ron@actsministries.org wrote: 

 If $correct_answer has a value of 3 what is the correct syntax needed to use
 echo to display the value of $trivia_answer_3?

 I know this is incorrect, but along the lines of what I am wanting to do:

 echo $trivia_answer_$correct_answer;

 $trivia_answer_1 = “1,000”;
 $trivia_answer_2 = “1,250”;
 $trivia_answer_3 = “2,500”;
 $trivia_answer_4 = “5,000”;

Not completely obvious to me what you're trying to do but I assume its:

echo '\$trivia_answer_' . $correct_answer .  = \ . $somevalue . \;; 

--
Cheers  --  Tim

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

Re: [PHP] Variable question

2011-10-01 Thread Geoff Shang

On Sat, 1 Oct 2011, Mike Mackintosh wrote:

Best bet would to toss this into either an object or array for 
simplification, otherwise that type of syntax would need the use of 
eval.



example:  eval('echo $trivia_answer_'.$correct_answer.';');


You could do:

$var = trivia_answer_.$correct_answer;
echo $$var;

But I agree that an array would be simpler.


best bet would be to..

$trivia_answer = array();

$trivia_answer[1] = 1000;
$trivia_answer[2] = 1250;
$trivia_answer[3] = 2500;
$trivia_answer[4] = 5000;

echo $trivia_answer[$correct_answer];


You can define this a bit more simply:

$trivia_answer = array (
  1 = 1000,
  2 = 1250,
  3 = 2500,
  4 = 5000
);

You can do it even more simply by just giving the values, but indexes wil 
start at 0:


?php
$trivia_answer = array (1000, 1250, 2500, 5000);
print_r ($trivia_answer);
?

Array
(
[0] = 1000
[1] = 1250
[2] = 2500
[3] = 5000
)

While manually defining an array like this is only slightly less tedius 
than using 4 numbered variables, it's a lot easier to do if you're getting 
data from somewhere else (e.g. a database of trivia questions).  To use 
the original way proposed, you'd have to keep constructing variable names, 
which arrays avoid quite nicely.


In my opinion, the only real usefulness for a syntax like $$var (above) is 
if you want to do something with a bunch of variables in one go.  For 
example:


foreach (array (title, artist, album, label) as $field)
  echo ucwords($field) . ': ' . $$field . 'BR';

The above comes from a function which manages only a single record, so no 
real need to use an array.  I could of course, e.g. record['title'] etc, 
but I don't see much could be gained unless I needed to be able to manage 
an entire record as a single unit.


Geoff.

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



RE: [PHP] Newbie question. What is the best structure of a php-app?

2011-08-16 Thread Dajka Tamás
Hi,

Surely there's a wiki/doc somewhere :)

But for the start:

1) plan what exactly you want to accomplish ( functionality )
2) complexity
- if simple, just throw it in one php ( like index.php )
- if more complex, you can separate the pages and/or use classes
3) based on 2), plan the structure ( I'm using mostly one entry point - 
index.php - with classes, templates, files included, since I like things 
separated )

Some thing you should not forget:
- whole webapp thing is event based ( client will do something - press a link - 
and the server will react ) - the connection is not maintained all the time
- PHP is server side (harder to debug), you cannot do anything on client side ( 
just push what to display ) ( JS is client side )
- you can start the session whenever you want ( it's nearly the first line of 
my app ), but you should control the access with variables, like if ( 
$_SESSION['uid'] ) or if ( $_SESSION['loggedin'] )
- most webservers interprets things between ?php ? even if the file name ends 
with .htm or .html
- for JS and connection related things FireBug for FireFox is a good idea ( you 
can track, what's submitted, etc )

What I'm liking:

- one entry point ( index.php )
- sub-pages, are separate php/template pairs BUT are included from index.php ( 
after access verification, etc )
- nearly all the functions are put in separate classes ( like user.class.php 
for user related things - login,logout, etc )
- using a template engine is not a very bad idea ( like Smarty ), you can 
separate the real code from html, which make debugging easier - at least for me 
:)

BTW, take a look on some free stuff. You can always learn from others. There 
are some good ideas in open CMS systems, like Joomla.


Cheers,

Tom

-Original Message-
From: Andreas [mailto:maps...@gmx.net] 
Sent: Tuesday, August 16, 2011 12:39 AM
To: php-general@lists.php.net
Subject: [PHP] Newbie question. What is the best structure of a php-app?

Hi,
I'm fairly new to PHP but not to programming as such. Currently I sat up 
XAMPP with xdebug, Netbeans and Eclipse to get a feeling.
I can write and run php-files but I am wondering how I should construct 
a more complex application that runs over several pages between a login 
and a logout.

How would I structure such an application so that it is possible to run 
it in the debugger from the beginning?
E.g. as a simple example I may build an index.html that has a menue with 
links to 3 php-files.
1)   login.php
2)   enter_data.php
3)   list_data.php
as html-links within an ul-list.

The user should at first click on login where user/password gets entered 
an a session starts.
Then the application comes back to index.html.
Now he might click 2) ...

Is it possible to run the whole application from the start on?
index.html is no php so xdebug won't process it and therefore the IDEs 
may start index.html but can't show the stage where the page is just 
waiting e.g. for a click on login and later branch for the other options.

Even if I write an index.php that shows the menue eventually the script 
just dumps the html that'll wait for the following clicks.
Those following steps are far more likely in need to be debugged.

Is it neccessary to debug those subpages separately even though they 
need prior steps like login.php that store some infos in a session or 
cookie that later scripts need to rely on?
Can I somehow watch what is going on from the index.html on?

Until now I just found documentation that explains the php language. 
Thats good too but I'd need to get an idea about the web-app-thinking 
that consist of just pages where the designer has to hope that the user 
stays within the applicationflow instead of clicking unexpectedly on the 
back-button or just jumping off to some other site if he likes to.

In contrast to this desktop-apps seem to be less demanding because I 
know where a user can navigate from a certain stage within the app and I 
could step from program start to stop with the debugger if I feel the 
need to.

Is there a tutorial that explains how to build consistent web-apps 
beyond the details of php language?


regards...

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



  1   2   3   4   5   6   7   8   9   10   >