php-general Digest 15 Apr 2009 16:09:29 -0000 Issue 6069

2009-04-15 Thread php-general-digest-help

php-general Digest 15 Apr 2009 16:09:29 - Issue 6069

Topics (messages 291517 through 291526):

Re: https and Credit Cards
291517 by: Richard Heyes

alt() - unknown function?
291518 by: Tom Calpin
291519 by: Thodoris
291520 by: George Larson
291521 by: Bastien Koert
291522 by: Thodoris
291523 by: Richard Heyes

Re: PDO fetch_obj - question
291524 by: Thodoris

cURL - Error 400
291525 by: David

header() and passing sessions
291526 by: Adam Williams

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
Hi,

 To add to what others have said: CC processors with which I have worked will
 audit your site *before* certifying your site to accept CC information. In
 other words, if you don't do SSL, you won't be *allowed* to process cards.

FWIW, companies exist that will host your buy page(s), so  you don't
end up with the hassle of buying and installing your own SSL
certificate.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated April 11th)
---End Message---
---BeginMessage---
Hi all,

I've just started looking at the code of an e-commerce site we are taking
over the development of, that another company has previously developed .
Coupled with the difficulty of taking over development of someone else's
code (also poorly commented), I've been stumped by a fatal error on a
function call alt() which is dotted everywhere in the main templating script
(sample below):

// Get/Set a specific property of a page
function getPageProp($prop,$id=) { return
$this-PAGES[alt($id,$this-getPageID())][$prop]; }
function setPageProp($prop,$val,$id=) {
$this-PAGES[alt($id,$this-getPageID())][$prop]=$val; }

It looks to be defining properties for a list of pages, with each page
providing its own PageID. 

I've never seen this function before, nor can I find any definition of it in
the site code, I was wondering if anyone recognises this, is it from a
thirdparty templating tool at all?

Thanks

-Tom

---End Message---
---BeginMessage---



Hi all,

I've just started looking at the code of an e-commerce site we are taking
over the development of, that another company has previously developed .
Coupled with the difficulty of taking over development of someone else's
code (also poorly commented), I've been stumped by a fatal error on a
function call alt() which is dotted everywhere in the main templating script
(sample below):

// Get/Set a specific property of a page
function getPageProp($prop,$id=) { return
$this-PAGES[alt($id,$this-getPageID())][$prop]; }
function setPageProp($prop,$val,$id=) {
$this-PAGES[alt($id,$this-getPageID())][$prop]=$val; }

It looks to be defining properties for a list of pages, with each page
providing its own PageID. 


I've never seen this function before, nor can I find any definition of it in
the site code, I was wondering if anyone recognises this, is it from a
thirdparty templating tool at all?

Thanks

-Tom


  



I think that you should check the included files (require, require_once, 
include, include_once) in case it is defined somewhere in there. Another 
possibility I can think of is to be defined in a framework that you use.


You can check the user and internal functions using the 
get_defined_fumctions():


http://us.php.net/manual/en/function.get-defined-functions.php

--
Thodoris

---End Message---
---BeginMessage---
This is someplace where NetBeans really benefits me.  You can hit CTRL-B, or
right-click, to take you to a definition.  Holding CTRL turns darned-near
everything into a hyperlink, doing the same thing.

Lastly, CTRL-SHIFT-F lets you search through every file in the project for
your string.

Finding nothing with those, I'd grep the whole stinkin' drive and go grab a
coffee.  :)

On Wed, Apr 15, 2009 at 10:39 AM, Thodoris t...@kinetix.gr wrote:


  Hi all,

 I've just started looking at the code of an e-commerce site we are taking
 over the development of, that another company has previously developed .
 Coupled with the difficulty of taking over development of someone else's
 code (also poorly commented), I've been stumped by a fatal error on a
 function call alt() which is dotted everywhere in the main templating
 script
 (sample below):

 // Get/Set a specific property of a page
 function getPageProp($prop,$id=) { return
 $this-PAGES[alt($id,$this-getPageID())][$prop]; }
 function setPageProp($prop,$val,$id=) {
 $this-PAGES[alt($id,$this-getPageID())][$prop]=$val; }

 It looks to be defining properties for a list of pages, with each page
 providing its own PageID.
 I've never seen this function before, nor can I find any definition of it
 

Re: [PHP] https and Credit Cards

2009-04-15 Thread Richard Heyes
Hi,

 To add to what others have said: CC processors with which I have worked will
 audit your site *before* certifying your site to accept CC information. In
 other words, if you don't do SSL, you won't be *allowed* to process cards.

FWIW, companies exist that will host your buy page(s), so  you don't
end up with the hassle of buying and installing your own SSL
certificate.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated April 11th)

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



[PHP] alt() - unknown function?

2009-04-15 Thread Tom Calpin
Hi all,

I've just started looking at the code of an e-commerce site we are taking
over the development of, that another company has previously developed .
Coupled with the difficulty of taking over development of someone else's
code (also poorly commented), I've been stumped by a fatal error on a
function call alt() which is dotted everywhere in the main templating script
(sample below):

// Get/Set a specific property of a page
function getPageProp($prop,$id=) { return
$this-PAGES[alt($id,$this-getPageID())][$prop]; }
function setPageProp($prop,$val,$id=) {
$this-PAGES[alt($id,$this-getPageID())][$prop]=$val; }

It looks to be defining properties for a list of pages, with each page
providing its own PageID. 

I've never seen this function before, nor can I find any definition of it in
the site code, I was wondering if anyone recognises this, is it from a
thirdparty templating tool at all?

Thanks

-Tom


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



Re: [PHP] alt() - unknown function?

2009-04-15 Thread Thodoris



Hi all,

I've just started looking at the code of an e-commerce site we are taking
over the development of, that another company has previously developed .
Coupled with the difficulty of taking over development of someone else's
code (also poorly commented), I've been stumped by a fatal error on a
function call alt() which is dotted everywhere in the main templating script
(sample below):

// Get/Set a specific property of a page
function getPageProp($prop,$id=) { return
$this-PAGES[alt($id,$this-getPageID())][$prop]; }
function setPageProp($prop,$val,$id=) {
$this-PAGES[alt($id,$this-getPageID())][$prop]=$val; }

It looks to be defining properties for a list of pages, with each page
providing its own PageID. 


I've never seen this function before, nor can I find any definition of it in
the site code, I was wondering if anyone recognises this, is it from a
thirdparty templating tool at all?

Thanks

-Tom


  



I think that you should check the included files (require, require_once, 
include, include_once) in case it is defined somewhere in there. Another 
possibility I can think of is to be defined in a framework that you use.


You can check the user and internal functions using the 
get_defined_fumctions():


http://us.php.net/manual/en/function.get-defined-functions.php

--
Thodoris


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



Re: [PHP] alt() - unknown function?

2009-04-15 Thread George Larson
This is someplace where NetBeans really benefits me.  You can hit CTRL-B, or
right-click, to take you to a definition.  Holding CTRL turns darned-near
everything into a hyperlink, doing the same thing.

Lastly, CTRL-SHIFT-F lets you search through every file in the project for
your string.

Finding nothing with those, I'd grep the whole stinkin' drive and go grab a
coffee.  :)

On Wed, Apr 15, 2009 at 10:39 AM, Thodoris t...@kinetix.gr wrote:


  Hi all,

 I've just started looking at the code of an e-commerce site we are taking
 over the development of, that another company has previously developed .
 Coupled with the difficulty of taking over development of someone else's
 code (also poorly commented), I've been stumped by a fatal error on a
 function call alt() which is dotted everywhere in the main templating
 script
 (sample below):

 // Get/Set a specific property of a page
 function getPageProp($prop,$id=) { return
 $this-PAGES[alt($id,$this-getPageID())][$prop]; }
 function setPageProp($prop,$val,$id=) {
 $this-PAGES[alt($id,$this-getPageID())][$prop]=$val; }

 It looks to be defining properties for a list of pages, with each page
 providing its own PageID.
 I've never seen this function before, nor can I find any definition of it
 in
 the site code, I was wondering if anyone recognises this, is it from a
 thirdparty templating tool at all?

 Thanks

 -Tom






 I think that you should check the included files (require, require_once,
 include, include_once) in case it is defined somewhere in there. Another
 possibility I can think of is to be defined in a framework that you use.

 You can check the user and internal functions using the
 get_defined_fumctions():

 http://us.php.net/manual/en/function.get-defined-functions.php

 --
 Thodoris



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




Re: [PHP] alt() - unknown function?

2009-04-15 Thread Bastien Koert
On Wed, Apr 15, 2009 at 10:58 AM, George Larson
george.g.lar...@gmail.comwrote:

 This is someplace where NetBeans really benefits me.  You can hit CTRL-B,
 or
 right-click, to take you to a definition.  Holding CTRL turns darned-near
 everything into a hyperlink, doing the same thing.

 Lastly, CTRL-SHIFT-F lets you search through every file in the project for
 your string.

 Finding nothing with those, I'd grep the whole stinkin' drive and go grab a
 coffee.  :)

 On Wed, Apr 15, 2009 at 10:39 AM, Thodoris t...@kinetix.gr wrote:

 
   Hi all,
 
  I've just started looking at the code of an e-commerce site we are
 taking
  over the development of, that another company has previously developed .
  Coupled with the difficulty of taking over development of someone else's
  code (also poorly commented), I've been stumped by a fatal error on a
  function call alt() which is dotted everywhere in the main templating
  script
  (sample below):
 
  // Get/Set a specific property of a page
  function getPageProp($prop,$id=) { return
  $this-PAGES[alt($id,$this-getPageID())][$prop]; }
  function setPageProp($prop,$val,$id=) {
  $this-PAGES[alt($id,$this-getPageID())][$prop]=$val; }
 
  It looks to be defining properties for a list of pages, with each page
  providing its own PageID.
  I've never seen this function before, nor can I find any definition of
 it
  in
  the site code, I was wondering if anyone recognises this, is it from a
  thirdparty templating tool at all?
 
  Thanks
 
  -Tom
 
 
 
 
 
 
  I think that you should check the included files (require, require_once,
  include, include_once) in case it is defined somewhere in there. Another
  possibility I can think of is to be defined in a framework that you use.
 
  You can check the user and internal functions using the
  get_defined_fumctions():
 
  http://us.php.net/manual/en/function.get-defined-functions.php
 
  --
  Thodoris
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


grep gets my vote, since i don't use netbeans

-- 

Bastien

Cat, the other other white meat


Re: [PHP] alt() - unknown function?

2009-04-15 Thread Thodoris



This is someplace where NetBeans really benefits me.  You can hit CTRL-B, or
right-click, to take you to a definition.  Holding CTRL turns darned-near
everything into a hyperlink, doing the same thing.

Lastly, CTRL-SHIFT-F lets you search through every file in the project for
your string.

Finding nothing with those, I'd grep the whole stinkin' drive and go grab a
coffee.  :)

On Wed, Apr 15, 2009 at 10:39 AM, Thodoris t...@kinetix.gr wrote:

  

 Hi all,


I've just started looking at the code of an e-commerce site we are taking
over the development of, that another company has previously developed .
Coupled with the difficulty of taking over development of someone else's
code (also poorly commented), I've been stumped by a fatal error on a
function call alt() which is dotted everywhere in the main templating
script
(sample below):

// Get/Set a specific property of a page
function getPageProp($prop,$id=) { return
$this-PAGES[alt($id,$this-getPageID())][$prop]; }
function setPageProp($prop,$val,$id=) {
$this-PAGES[alt($id,$this-getPageID())][$prop]=$val; }

It looks to be defining properties for a list of pages, with each page
providing its own PageID.
I've never seen this function before, nor can I find any definition of it
in
the site code, I was wondering if anyone recognises this, is it from a
thirdparty templating tool at all?

Thanks

-Tom




  

I think that you should check the included files (require, require_once,
include, include_once) in case it is defined somewhere in there. Another
possibility I can think of is to be defined in a framework that you use.

You can check the user and internal functions using the
get_defined_fumctions():

http://us.php.net/manual/en/function.get-defined-functions.php

--
Thodoris



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





  


What if it is not defined in your project but somewhere in your include 
path? You could I suppose grep the whole drive if you have time to waste :)


--
Thodoris



Re: [PHP] alt() - unknown function?

2009-04-15 Thread Richard Heyes
 grep gets my vote, since i don't use netbeans

I'd go for grep too (unix or Win32):

grep -rin function alt *

What's the exact error?

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated April 11th)

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



Re: [PHP] PDO fetch_obj - question

2009-04-15 Thread Thodoris


Hi there, 
 
I’ve made a fetch_obj and, as stated on some sites, it returns a anonymous
object where the properties will have the name of our columns database. 
 
However, when I do this, I notice that instead of giving me the column names

as they are typed on the DB I get them uppercase. So, when my database field
is “id_dog” to retrieve the property properly I have to search for “ID_DOG”
 
Why is this? Is this a normal behavior?
 
 
Thanks a lot,

Márcio

  
I have just dumped an object using var_dump retrieved with pdo fetch 
object method:


object(stdClass)#3 (4) {
 [id]=
 string(1) 1
 [cat]=
 string(1) 1
 [cod_sin]=
 string(6) 120014
 [cod_uis]=
 string(2) 26
}


and it seems quite normal to me. Try to see your table info using:

describe `tablename`;

To see what are your table's fields .

Try to include more info about your system, php version etc in case you 
reply. It will help us to help you.


--
Thodoris


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



[PHP] cURL - Error 400

2009-04-15 Thread David
Hi

I was wondering if anyone could please help me with this cURL script since I
keep getting error 400 from the web server:

http://pastebin.ca/1392840


It worked until around a month ago which is when they presumably made
changes to the site. Except I can't figure out what configuration option in
the cURL PHP script needs to be changed. I can visit the site perfectly in
Lynx, Firefox and IE.




Thanks


[PHP] header() and passing sessions

2009-04-15 Thread Adam Williams
I need some help passing a session variable with a header() function.  
According to www.php.net/header, the documentation states:


*Note*: Session ID is not passed with Location header even if 
session.use_trans_sid 
session.configuration.php#ini.session.use-trans-sid is enabled. It 
must by passed manually using *SID* constant.


so, I'm trying to manually pass the SID, but not having any luck.  Here 
is a snippet of my code:


There is a file login.php which has session_start(); and sets 
$_SESSION[username] with the username you logged in with from 
index.php and has a form to click View Pending Requests which has the 
action of option.php.


-- option.php --
?php
session_start();
if ($_POST[option] == View Pending Requests)
   {
   header('Location: 
http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.session_id());

   }
?

--viewpending.php --
?php
session_start();
if (!$_SESSION[username])
   {
   echo You have not logged in;
   exit;
   }
?

so you click on View Pending Requests, and the URL in your browser is:

http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID=du75p41hel9k1vpuah799l2ce7

but viewpending.php says You have not logged in.  Why is that?



RE: [PHP] header() and passing sessions

2009-04-15 Thread abdulazeez alugo


 

 Date: Wed, 15 Apr 2009 11:09:19 -0500
 From: awill...@mdah.state.ms.us
 To: php-general@lists.php.net
 Subject: [PHP] header() and passing sessions
 
 I need some help passing a session variable with a header() function. 
 According to www.php.net/header, the documentation states:
 
 *Note*: Session ID is not passed with Location header even if 
 session.use_trans_sid 
 session.configuration.php#ini.session.use-trans-sid is enabled. It 
 must by passed manually using *SID* constant.
 
 so, I'm trying to manually pass the SID, but not having any luck. Here 
 is a snippet of my code:
 
 There is a file login.php which has session_start(); and sets 
 $_SESSION[username] with the username you logged in with from 
 index.php and has a form to click View Pending Requests which has the 
 action of option.php.
 
 -- option.php --
 ?php
 session_start();
 if ($_POST[option] == View Pending Requests)
 {
 header('Location: 
 http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.session_id());
 }
 ?
 
 --viewpending.php --
 ?php
 session_start();
 if (!$_SESSION[username])
 {
 echo You have not logged in;
 exit;
 }
 ?
 
 so you click on View Pending Requests, and the URL in your browser is:
 
 http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID=du75p41hel9k1vpuah799l2ce7
 
 but viewpending.php says You have not logged in. Why is that?

 

Hi,

Well I'ld say the reason is quite obvious. You have simply not set 
$_session[username] . I'ld have done something like:

 

-- option.php --
?php
 session_start();
 if ($_POST[option] == View Pending Requests)
{

$_session[username]= true;  //sets the session
 header('Location: 
 http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.SID);// 
I'ld use SID
 } 
 ?


 

--viewpending.php -
 ?php
 session_start();
 if ($_SESSION[username] !=true)
 {
 echo You have not logged in;
 exit;
 }
 ?

 

I hope this helps. try it.

Cheers

Alugo Abdulazeez



_
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx

Re: [PHP] redirect to a page the fist time a site is accessed

2009-04-15 Thread Andrew Ballard
On Tue, Apr 14, 2009 at 10:30 PM, Jason Pruim ja...@jasonpruim.com wrote:


 On Apr 14, 2009, at 10:11 PM, Don d...@program-it.ca wrote:

 Hi,

 I have some code in my index.php file that check the user agent and
 redirects to a warning page if IE 6 or less is encountered.

 1. I'm using a framework and so calls to all pages go through index.php
 2. The code that checks for IE 6 or less and redirects is in index.php

 I know how to redirect the users but what I want to do is redirect a user
 ONLY the first time the web site is accessed regardless of what page they
 first access.  I would like to minimize overhead (no database).  Can this
 be
 done?

 Thanks,
 Don



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


 Probably the best way I could think of would be to set a cookie on their
 computer that you check for when they come and redirect based on that
 cookie.

 It's not completely fail proof because all they have to do is clear cookies
 and they will see it again but it should work for most people.

Well, there is that ... and if the browser does not accept your
cookie, it will be trapped in an infinte redirection cycle.

Andrew

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



Re: [PHP] header() and passing sessions

2009-04-15 Thread Adam Williams

abdulazeez alugo wrote:


Hi,
Well I'ld say the reason is quite obvious. You have simply not set 
$_session[username] . I'ld have done something like:
 
-- option.php --

?php
 session_start();
 if ($_POST[option] == View Pending Requests)
{
$_session[username]= true;  //sets the session
 header('Location: 
http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.SID);
// 
http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID=%27.SID%29;%A0%A0%A0+// 
I'ld use SID

 }
 ?

 
--viewpending.php -

 ?php
 session_start();
 if ($_SESSION[username] !=true)
 {
 echo You have not logged in;
 exit;
 }
 ?
 
I hope this helps. try it.

Cheers
Alugo Abdulazeez




Well the thing is, $_SESSION[username] is set.  If I change option.php to:

?php
session_start();
echo session username is .$_SESSION[username];
/*if ($_POST[option] == View Pending Requests)
   {
   header('Location: 
http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.session_id());

   }
*/
?

and click on View Pending Requests, it prints:

session username is awilliam




Re: [PHP] PDO fetch_obj - question

2009-04-15 Thread talofo talofo
Thanks. I will see. The script for my database was been generated so, I will
doublecheck this uppercase issue...

Regards,
Márcio

2009/4/15 Thodoris t...@kinetix.gr


  Hi there,  I’ve made a fetch_obj and, as stated on some sites, it returns
 a anonymous
 object where the properties will have the name of our columns database.
  However, when I do this, I notice that instead of giving me the column
 names
 as they are typed on the DB I get them uppercase. So, when my database
 field
 is “id_dog” to retrieve the property properly I have to search for
 “ID_DOG”
  Why is this? Is this a normal behavior?
   Thanks a lot,
 Márcio



 I have just dumped an object using var_dump retrieved with pdo fetch object
 method:

 object(stdClass)#3 (4) {
  [id]=
  string(1) 1
  [cat]=
  string(1) 1
  [cod_sin]=
  string(6) 120014
  [cod_uis]=
  string(2) 26
 }


 and it seems quite normal to me. Try to see your table info using:

 describe `tablename`;

 To see what are your table's fields .

 Try to include more info about your system, php version etc in case you
 reply. It will help us to help you.

 --
 Thodoris




Re: [PHP] https and Credit Cards

2009-04-15 Thread דניאל דנון
You are right - Decline the job, you don't want any credit-card stealing on
your head

On Wed, Apr 15, 2009 at 1:10 PM, Richard Heyes rich...@php.net wrote:

 Hi,

  To add to what others have said: CC processors with which I have worked
 will
  audit your site *before* certifying your site to accept CC information.
 In
  other words, if you don't do SSL, you won't be *allowed* to process
 cards.

 FWIW, companies exist that will host your buy page(s), so  you don't
 end up with the hassle of buying and installing your own SSL
 certificate.

 --
 Richard Heyes

 HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
 http://www.rgraph.net (Updated April 11th)

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




[PHP] Re: header() and passing sessions

2009-04-15 Thread Shawn McKenzie
Adam Williams wrote:
 I need some help passing a session variable with a header() function. 
 According to www.php.net/header, the documentation states:
 
 *Note*: Session ID is not passed with Location header even if
 session.use_trans_sid
 session.configuration.php#ini.session.use-trans-sid is enabled. It
 must by passed manually using *SID* constant.
 
 so, I'm trying to manually pass the SID, but not having any luck.  Here
 is a snippet of my code:
 
 There is a file login.php which has session_start(); and sets
 $_SESSION[username] with the username you logged in with from
 index.php and has a form to click View Pending Requests which has the
 action of option.php.
 
 -- option.php --
 ?php
 session_start();
 if ($_POST[option] == View Pending Requests)
{
header('Location:
 http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.session_id());
 
}
 ?
 
 --viewpending.php --
 ?php
 session_start();
 if (!$_SESSION[username])
{
echo You have not logged in;
exit;
}
 ?
 
 so you click on View Pending Requests, and the URL in your browser is:
 
 http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID=du75p41hel9k1vpuah799l2ce7
 
 
 but viewpending.php says You have not logged in.  Why is that?
 
 

What does this display:  echo session_name();

-- 
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] bug or expected, mbstring.func_overload not changeable by .htaccess 5.2.8/5.2.9

2009-04-15 Thread Thodoris



Hello,

following in my .htaccess works with php 5.2.6 (mod_php)

php_value mbstring.func_overload 2

Seems that since (5.2.7?) 5.2.8/5.2.9 this value is not any more 
accepted by php in .htaccess.
mbstring.func_overload should be changeable by PHP_INI_PERDIR which 
includes .htaccess
Other values are changeable by .htaccess so it should not be a general 
problem on my side.

Please someone could check this?

Thanks,
Andre




Besides the .htaccess which might be an apache configuration problem if 
you use ini_set(mbstring.func_overload,2) in a script of this 
directory does it work?


In addition to this heck your apache configuration to see if you allow 
.htaccess to be parsed.


--
Thodoris


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



Re: [PHP] cURL - Error 400

2009-04-15 Thread haliphax
On Wed, Apr 15, 2009 at 10:36 AM, David quick.webmas...@gmail.com wrote:
 I was wondering if anyone could please help me with this cURL script since I
 keep getting error 400 from the web server:

 http://pastebin.ca/1392840

 It worked until around a month ago which is when they presumably made
 changes to the site. Except I can't figure out what configuration option in
 the cURL PHP script needs to be changed. I can visit the site perfectly in
 Lynx, Firefox and IE.

Are you just trying to get the contents of the page, or is there
something special you're doing? If it's just the contents you're
after, try file_get_contents() if allow_url_fopen is set to TRUE for
your PHP installation.

http://php.net/file_get_contents
http://php.net/allow_url_fopen

Hope this helps,


-- 
// Todd

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



[PHP] GIS with PHP tutorial

2009-04-15 Thread Diptanjan

Hi Gurus,

I was just wondering if there is any good tutorial on GIS with PHP ?

Tried googling but did'nt find anything real good. 
Any help will be appreciated.

Regards

Diptanjan
-- 
View this message in context: 
http://www.nabble.com/GIS-with-PHP-tutorial-tp23065797p23065797.html
Sent from the PHP - General mailing list archive at Nabble.com.


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



[PHP] help with statement

2009-04-15 Thread Terion Miller
I'm trying to take a paragraph then break it into linebreaks and grab each
line separately but it's not working, I can get the paragraph but my lines
are not I get the object id #6 or #7 everytime
Here's my code

// grab all the paragraphs on the page
$xpath = new DOMXPath($dom);
//$graphs = $xpath-evaluate(/html/body//p);
$graphs=$dom-getElementsByTagName(p);
$lines=$dom-getElementsByTagName(br);
// Set $i =5 because first 5 paragraphs are not inspections
for ($i = 5; $i+1  $graphs-length; $i++) {
$paragraph = $graphs-item($i);


$text = $dom-saveXML($paragraph);
$text = trim($text);

/*
//my experiment for getting line br
for ($b = 1; $b+1  $lines-length; $b++) {*/
$title = $lines-item($i);
$addie= $lines-item($i);



if($TESTING)
echo br /$i Graph:  . $text . br /;
echo br /$line:  . $title . br /;
echo br/$line: . $addie . br/;
// }
}


?



Thanks
Terion

Happy Freecycling
Free the List !!
www.freecycle.org
Over Moderation of Freecycle List Prevents Post Timeliness.
Report Moderator Abuse Here:
http://www.freecycle.org/faq/faq/contact-info
Or Email Your Complaint to:
f...@freecycle.org or i...@freecycle.org

Twitter?
http://twitter.com/terionmiller

Facebook:
a href=http://www.facebook.com/people/Terion-Miller/1542024891;
title=Terion Miller's Facebook profile target=_TOPimg src=
http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
alt=Terion Miller's Facebook profile/a


Re: [PHP] GIS with PHP tutorial

2009-04-15 Thread Adam Williams

have you looked into this? http://postgis.refractions.net/


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



Re: [PHP] alt() - unknown function?

2009-04-15 Thread Paul M Foster
On Wed, Apr 15, 2009 at 03:23:19PM +0100, Tom Calpin wrote:

 Hi all,
 
 I've just started looking at the code of an e-commerce site we are taking
 over the development of, that another company has previously developed .
 Coupled with the difficulty of taking over development of someone else's
 code (also poorly commented), I've been stumped by a fatal error on a
 function call alt() which is dotted everywhere in the main templating script
 (sample below):
 
 // Get/Set a specific property of a page
 function getPageProp($prop,$id=) { return
 $this-PAGES[alt($id,$this-getPageID())][$prop]; }
 function setPageProp($prop,$val,$id=) {
 $this-PAGES[alt($id,$this-getPageID())][$prop]=$val; }
 
 It looks to be defining properties for a list of pages, with each page
 providing its own PageID.
 
 I've never seen this function before, nor can I find any definition of it in
 the site code, I was wondering if anyone recognises this, is it from a
 thirdparty templating tool at all?

It's been suggested you do a thorough search for this function, but the
fact that PHP isn't finding it in the first place leads me to believe it
isn't there. If that's the case, I'd suggest you make up your own alt()
function that does what you think this one is doing (maybe just return
the passed variable). You'll have to decide where to put it that's
visible in all the places where it's called.

Paul

-- 
Paul M. Foster

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



Re: [PHP] redirect to a page the fist time a site is accessed

2009-04-15 Thread Don

Andrew Ballard aball...@gmail.com wrote in message 
news:b6023aa40904150926g3e6fb478s36b18b6a53ec3...@mail.gmail.com...
On Tue, Apr 14, 2009 at 10:30 PM, Jason Pruim ja...@jasonpruim.com wrote:


 On Apr 14, 2009, at 10:11 PM, Don d...@program-it.ca wrote:

 Hi,

 I have some code in my index.php file that check the user agent and
 redirects to a warning page if IE 6 or less is encountered.

 1. I'm using a framework and so calls to all pages go through index.php
 2. The code that checks for IE 6 or less and redirects is in index.php

 I know how to redirect the users but what I want to do is redirect a user
 ONLY the first time the web site is accessed regardless of what page they
 first access. I would like to minimize overhead (no database). Can this
 be
 done?

 Thanks,
 Don



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


 Probably the best way I could think of would be to set a cookie on their
 computer that you check for when they come and redirect based on that
 cookie.

 It's not completely fail proof because all they have to do is clear 
 cookies
 and they will see it again but it should work for most people.

 Well, there is that ... and if the browser does not accept your
 cookie, it will be trapped in an infinte redirection cycle.

 Andrew

Yes and from php.net,

Cookies will not become visible until the next loading of a page that the 
cookie should be visible for.

So there's no PHP solution for my problem?  I think I need to use unreliable 
JavaScript. 



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



[PHP] Re: try - catch is not so clear to me...

2009-04-15 Thread Al



Lamp Lists wrote:

hi to all!

actually, the statement in the Subject line is not 100% correct. I understand 
the purpose and how it works (at least I think I understand :-)) but to me it's 
so complicated way?

let's take a look in example from php.net(http://us3.php.net/try)


?php
function inverse($x) {
if (!$x) {
throw new Exception('Division by zero.');
}
else return 1/$x;
}

try {
echo inverse(5) . \n;
echo inverse(0) . \n;
} catch (Exception $e) {
echo 'Caught exception: ',  $e-getMessage(), \n;
}

// Continue execution
echo 'Hello World';
?  
I would do the same thing, I think, less complicated:


?php
function inverse($x)
{
if (!$x) {
echo 'Division by zero';
}
else return 1/$x;

}

echo inverse(5);
echo inverse(0);

// Continue execution
echo 'Hello world';
?

I know this is too simple, maybe not the best example, but can somebody please explain 
the purpose of try/catch?

Thanks.

-LL



Here is a practical example that may help you.

Each of the functions can throw an exception, which causes 
the flow to jump to the catch block.


try
{
$checksOK = true;
checkEmailAddr($userSubmitedDataArray[EMAIL_ADDR_FIELD]);
checkPhoneDigits($userSubmitedDataArray[PHONE_NUM_FIELD],'phone'); 


checkNotes($userSubmitedDataArray, $sizesArray);
}
catch (Exception $e)
{
//Message text in check functions
$userErrorMsg = $e-getMessage();
}

Here is one of the functions:

function checkEmailAddr($emailAddr)
{
if(empty($emailAddr))
{
throw new Exception(No email address provided);
}

if(!preg_match(%...@%, $emailAddr))
{
throw new Exception(Email address missing mailbox 
name.);

}

if(!filter_var($emailAddr, FILTER_VALIDATE_EMAIL))
{
throw new Exception(Email address error. Syntax is 
wrong. );

}

$domain = substr(strchr($emailAddr, '@'), 1);
if(!checkdnsrr($domain))
{
throw new Exception(Email address warning. 
Specified domain \$domain\ appears to be invalid. Check 
carefully.);

}
return true;
}

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



Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

2009-04-15 Thread Raymond Irving


Thanks for your feedback.

__
Raymond Irving

--- On Tue, 4/14/09, Michael A. Peters mpet...@mac.com wrote:

 From: Michael A. Peters mpet...@mac.com
 Subject: Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument
 To: Raymond Irving xwis...@yahoo.com
 Cc: php-general@lists.php.net
 Date: Tuesday, April 14, 2009, 8:09 PM
 Raymond Irving wrote:
  Hi,
  
  I'm thinking about using the html5 doctype for all
 html documents since it's supported by all the popular
 browsers available today. 
  Two Quick questions... 
  Why do we need to send XHTML code to a web browser
 when standard html code (with html 5 doctype) will do just
 fine?
 
 In most cases we don't.
 However if we want to include extensions (such as MathML
 etc.) then xhtml is the only way to do it.
 
 My own reason for sending xhtml is because I believe it to
 be a superior specification and would like to see html
 (where not all tags need to be closed) go away.
 
 Having valid x(ht)ml output also means that other software
 that uses your web page as a source for data can just parse
 it as xml to get the data it needs.
 
 Be careful with html 5 - use the fallbacks (IE embed or
 object for video as a fallback to the video tag), because
 not everyone uses the latest browsers.
 
  
  Is there any advantage of using xhtml in the web
 browser over html for normal web application development?
  
 
 In most cases, not a display advantage.
 
 HTML 1.1 supports the ruby tags/attribute, html 4 does not,
 but with html 5 / xhtml 5 - they are supposedly identical in
 spec with the only difference being the markup semantics of
 xhtml 5 conform to xml standards. I suspect html 5
 elements/attributes are case insensitive (like they are for
 previous html) but I haven't checked - xhtml tags/attributes
 need to be lower case.
 
 But if your page can be properly displayed with valid html
 then the only technical advantage I can think of for using
 xhtml is for apps that use your page as a data source (so
 they don't have to convert it to xml).
 
 I personally will send xhtml most of the time when I can
 because I want HTML to go away, and as soon as 97% of
 browsers properly support xhtml, I may stop sending html all
 together. Since IE 8 still does not (not will correct mime
 type anyway) it will be years before that happens.
 
 Oh - another advantage to xhtml - it's easy to extend for
 your own use.
 For example, you can add a custom attribute for your own
 use (IE as hooks for other web apps on other sites to use
 when grabbing data from your site, or whatever) and it will
 validate as long as you properly declare it. With html, I
 believe adding an attribute is not allowed unless you create
 a whole new DTD.
 

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



Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

2009-04-15 Thread Raymond Irving

Thanks for the feedback.

I too like xhtml but I think I like the option of serving both. My only concern 
is that a proxy server might cache an xhtml page and then serve it to a 
non-xhtml browser.

Do you think it's possible that a proxy might serve the xhtml source to the 
wrong browser?

__
Raymond Irving


--- On Tue, 4/14/09, Michael Shadle mike...@gmail.com wrote:

From: Michael Shadle mike...@gmail.com
Subject: Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument
To: Raymond Irving xwis...@yahoo.com
Cc: php-general@lists.php.net php-general@lists.php.net
Date: Tuesday, April 14, 2009, 8:26 PM

As michael said my main reason is strictness. It's much easier to parse a 
document when an XML parser can read it. I like the idea of closing tags etc.

On Apr 14, 2009, at 4:38 PM, Raymond Irving xwis...@yahoo.com wrote:

 
 Hi,
 
 I'm thinking about using the html5 doctype for all html documents since it's 
 supported by all the popular browsers available today.
 
 Two Quick questions...
 
 Why do we need to send XHTML code to a web browser when standard html code 
 (with html 5 doctype) will do just fine?
 
 Is there any advantage of using xhtml in the web browser over html for normal 
 web application development?
 
 
 __
 Raymond Irving
 
 --- On Tue, 4/14/09, Peter Ford p...@justcroft.com wrote:
 
 From: Peter Ford p...@justcroft.com
 Subject: Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument
 To: php-general@lists.php.net
 Date: Tuesday, April 14, 2009, 5:05 AM
 Michael Shadle wrote:
 On Mon, Apr 13, 2009 at 2:19 AM, Michael A. Peters
 mpet...@mac.com
 wrote:
 
 The problem is that validating xhtml does not
 necessarily render properly in
 some browsers *cough*IE*cough*
 
 I've never had problems and my work is primarily
 around IE6 / our
 corporate standards. Hell, even without a script type
 it still works
 :)
 
 Would this function work for sending html and
 solve the utf8 problem?
 
 function makeHTML($document) {
    $buffer =
 $document-saveHTML();
    $output =
 html_entity_decode($buffer,ENT_QUOTES,UTF-8);
    return $output;
    }
 
 I'll try it and see what it does.
 
 this was the only workaround I received for the
 moment, and I was a
 bit afraid it would not process the full range of
 utf-8; it appeared
 on a quick check to work but I wanted to run it on our
 entire database
 and then ask the native geo folks to examine it for
 correctness.
 
 I find that IE7 (at least) is pretty reliable as long as I
 use strict XHTML and
 send a DOCTYPE header to that effect at the top - that
 seems to trigger a
 standard-compliant mode in IE7.
 At least then I only have to worry about the JavaScript
 incompatibilities, and
 the table model, and the event model, and 
 
 --Peter Ford
 
 phone: 01580 89
 Developer
 
    fax:   01580 893399
 Justcroft International Ltd., Staplehurst, Kent
 
 --PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


[PHP] ftp_put issues

2009-04-15 Thread James
Hi, I'm trying to upload a pdf file from a local drive to the server using a 
php routine. I've done it server to server before with no issues but this 
just keeps failing on me.

This is the function I'm calling, it connects and logs in just fine, but it 
will not upload the file. The file I'm sending is just a 100k pdf file. I 
have php set up with:

max_execution_time = 30
max_input_time = 60
memory_limit = 20M
file_uploads = On
upload_max_filesize = 8M

ftpData($fileField, /var/www/html/Docs/DU/DU1.pdf)

with $filefield just being a local path taken from a filebrowser in a html 
form. I've also tried using ftp_chdir to change the destination path and 
when calling ftp_pwd is shows the current directory has changed to the 
correct one but it still won't write anything down.

any ideas?

James

function ftpData($Source, $Dest){
 // set up basic connection
 $success = 1;
 $ftp_server = blahblahbla.com;
 $ftp_user_name = dummy;
 $ftp_user_pass = dammy;

 $destination_file = $Dest;
 $source_file = $Source;

 $conn_id = ftp_connect($ftp_server);

 // login with username and password
 $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

 // check connection
 if ((!$conn_id) || (!$login_result)) {
echo FTP connection has failed!br;
echo Attempted to connect to $ftp_server for user 
$ftp_user_namebr;
$success = 0;
exit;
   } else {
echo Connected to $ftp_server, for user $ftp_user_namebr;
   }

 // upload the file
 $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);

 // check upload status
 if (!$upload) {
echo FTP upload has failed!br;
$success = 0;
   } else {
echo Uploaded $source_file to $ftp_server as 
$destination_filebr;
   }

 // close the FTP stream
 ftp_close($conn_id);
 return($success);
} 



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



Re: [PHP] ftp_put issues

2009-04-15 Thread Chris

James wrote:
Hi, I'm trying to upload a pdf file from a local drive to the server using a 
php routine. I've done it server to server before with no issues but this 
just keeps failing on me.


This is the function I'm calling, it connects and logs in just fine, but it 
will not upload the file. The file I'm sending is just a 100k pdf file.


If you do it manually does it work? Maybe the account is over quota.

--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] cURL - Error 400

2009-04-15 Thread David
Except I also need to POST data to the server to login. After I've logged
in, I then need to use cookies to maintain a session.

Doing that via file_get_contents() just isn't possible.


Thanks

On Thu, Apr 16, 2009 at 2:30 AM, haliphax halip...@gmail.com wrote:

  On Wed, Apr 15, 2009 at 10:36 AM, David quick.webmas...@gmail.com
 wrote:
  I was wondering if anyone could please help me with this cURL script
 since I
  keep getting error 400 from the web server:
 
  http://pastebin.ca/1392840
 
  It worked until around a month ago which is when they presumably made
  changes to the site. Except I can't figure out what configuration option
 in
  the cURL PHP script needs to be changed. I can visit the site perfectly
 in
  Lynx, Firefox and IE.

 Are you just trying to get the contents of the page, or is there
 something special you're doing? If it's just the contents you're
 after, try file_get_contents() if allow_url_fopen is set to TRUE for
 your PHP installation.

 http://php.net/file_get_contents
 http://php.net/allow_url_fopen

 Hope this helps,


 --
 // Todd





Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument

2009-04-15 Thread Michael Shadle
I use XHTML 1.0 transitional and I've yet to have anyone tell me my  
sites don't work. Mobile and desktop browsers too. So I'm not sure  
that's an issue at all (?)


On Apr 15, 2009, at 6:31 PM, Raymond Irving xwis...@yahoo.com wrote:



Thanks for the feedback.

I too like xhtml but I think I like the option of serving both. My  
only concern is that a proxy server might cache an xhtml page and  
then serve it to a non-xhtml browser.


Do you think it's possible that a proxy might serve the xhtml source  
to the wrong browser?


__
Raymond Irving


--- On Tue, 4/14/09, Michael Shadle mike...@gmail.com wrote:

From: Michael Shadle mike...@gmail.com
Subject: Re: [PHP] Generate XHTML (HTML compatible) Code using  
DOMDocument

To: Raymond Irving xwis...@yahoo.com
Cc: php-general@lists.php.net php-general@lists.php.net
Date: Tuesday, April 14, 2009, 8:26 PM

As michael said my main reason is strictness. It's much easier to  
parse a document when an XML parser can read it. I like the idea of  
closing tags etc.


On Apr 14, 2009, at 4:38 PM, Raymond Irving xwis...@yahoo.com wrote:



Hi,

I'm thinking about using the html5 doctype for all html documents  
since it's supported by all the popular browsers available today.


Two Quick questions...

Why do we need to send XHTML code to a web browser when standard  
html code (with html 5 doctype) will do just fine?


Is there any advantage of using xhtml in the web browser over html  
for normal web application development?



__
Raymond Irving

--- On Tue, 4/14/09, Peter Ford p...@justcroft.com wrote:


From: Peter Ford p...@justcroft.com
Subject: Re: [PHP] Generate XHTML (HTML compatible) Code using  
DOMDocument

To: php-general@lists.php.net
Date: Tuesday, April 14, 2009, 5:05 AM
Michael Shadle wrote:

On Mon, Apr 13, 2009 at 2:19 AM, Michael A. Peters

mpet...@mac.com
wrote:



The problem is that validating xhtml does not

necessarily render properly in

some browsers *cough*IE*cough*


I've never had problems and my work is primarily

around IE6 / our

corporate standards. Hell, even without a script type

it still works

:)


Would this function work for sending html and

solve the utf8 problem?


function makeHTML($document) {
$buffer =

$document-saveHTML();

$output =

html_entity_decode($buffer,ENT_QUOTES,UTF-8);

return $output;
}

I'll try it and see what it does.


this was the only workaround I received for the

moment, and I was a

bit afraid it would not process the full range of

utf-8; it appeared

on a quick check to work but I wanted to run it on our

entire database

and then ask the native geo folks to examine it for

correctness.

I find that IE7 (at least) is pretty reliable as long as I
use strict XHTML and
send a DOCTYPE header to that effect at the top - that
seems to trigger a
standard-compliant mode in IE7.
At least then I only have to worry about the JavaScript
incompatibilities, and
the table model, and the event model, and 

--Peter Ford

phone: 01580 89
Developer

fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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




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



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