Re: [PHP] Looking for complete entered URL

2013-04-20 Thread Tom Rogers
Hello Angela,

Sunday, April 21, 2013, 4:51:37 AM, you wrote:

> I've written a script that logs all visits to a web site,
> complete with referrer and IP address.  It also logs all 4xx errors.
> What I'd like to add to this is, if someone adds extra code after
> the page_name.php, to be able to capture any extra code and log that.

> I've tried:

> $_SERVER['QUERY_STRING']
> $_SERVER['REDIRECT_QUERY_STRING']
> $_SERVER['REDIRECT_URL']

> but nothing seems to get logged.

> Is there a way, when either a false url is entered and a
> 404 is generated, or just when someone tacks on extra code to the
> URL, that I can grab that extra info?  I'm looking for the complete
> URL that was entered by the user, not anything returned by the server.

> I've created my own 4xx_error.php files which calls my
> tracking script, along with creating the proper ErrorDocument lines in the 
> main .htaccess file.

> There are a lot of pages that have come up in my search,
> but nothing seems to pertain to what I'm trying to do.

> Thank you,
> Angela

> BTW, I know about Piwik and I use that, as well.  This is something I'm doing 
> on my own.


You  can put this in the page and email your self the information that
is available:

mailto:trog...@kwikin.com


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



Re: [PHP] PHP 5.4 Help

2013-03-06 Thread Tom Rogers
Hello LLC,

Thursday, March 7, 2013, 2:41:43 AM, you wrote:



> I need help from someone knowledgeable about PHP and I hope I am
> seeking it in the right place.  I beg your forgiveness if this is not the 
> right place.
>  
> I purchased a software (1-2-3 Music) a few years ago and have used
> parts of it on my website so people can buy and download MP3 songs.
> I have tried to contact the company I purchased the program from but
> they seem to be out of business.  Have also tried contacting the
> main developer but am not able to make contact…my emails to him are rejected 
> by his mail box).
>  
> Beginning on April 1, 2013 my Web Hosting company will no longer
> support PHP programs less than Version 5.4...Register_Globals will
> be turned off.  I have tested my software with the new upcoming
> restrictions and find none of my song downloads will function with the PHP 
> 5.4 version.
>  
> Will someone tell me if the small module included on the bottom of
> this note will function properly under PHP 5.4? (Register_Globals
> turned off).  If it does not function properly with Register_Globals
> turned off, is there a way to make changes  to the module so it does
> function properly with Register-Globals turned off?
>  
> Thank you very much
> Floyd J. Badeaux   
> -
> Module:
>  define ("DOCMA_HOME",
> "/homepages/37/d48651986/htdocs/htdocs/1-2-3-music-store/docma_08306s");
> ini_set("display_errors", "0");
> require_once (DOCMA_HOME."/system/prepend.inc");
>  
> define ("DOCUMENT_ROOT", preg_replace("/()+/", "/", realpath(".")));
> session_start();
>  
> $processName = $_REQUEST["pname"];
> $process =& process_get_process($processName);
$process->>execute();
>  
?>>
> ---
>  

You will probably need to remove the '&' from this line:
$process =& process_get_process($processName);

All  objects  are  passed  around as a reference now so the '&' is not
needed and may cause troubles.

Tom

-- 
Best regards,
 Tommailto:trog...@kwikin.com


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



Re: [PHP] SNMP via PHP

2012-10-15 Thread Tom Rogers
Hello Lester,

Monday, October 15, 2012, 9:09:13 PM, you wrote:

> OK I've spent the last two hours going through pages of crap generated by
> google, and that includes google crap created by searches on sites like
> http://www.phpbuilder.com - cause mainly of cause by php pages on sites
> supporting other languages :(
> Certainly it seems that PHP is preferred even to website java and ruby ...

> I had some problems over the weekend with the network here and decided it was
> time to get some monitoring in place locally. cacti simply loaded up and I 
> have
> working system, but now I'm having trouble getting SNMP sorted on the target
> machines. So I started looking for an editor to handle the MIB data and keep
> hitting one dead end after another.

> I'm sure there must be something out there using php-snmp for a browser?

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


Did you see this: http://www.php.net/manual/en/book.snmp.php

-- 
Best regards,
 Tommailto:trog...@kwikin.com


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



[PHP] relative url and path_info

2012-09-30 Thread Tom Sparks
 I have created a php script that use $_SERVER['PATH_INFO'], for the different 
sub-sections
the links now looks like this 
http://localhost/collection/popups.php/models/bttf/car01/

 
 my web browser cant load my images/javascripts/etc because it is trying to use 
 relative url from http://localhost/collection/popups.php/models/bttf/car01/* 
 witch is incorrect, but the browser gets a 200 (ok) message from the server

my images/javascripst/etc is relative to http://localhost/collection/* 
but my requirement dictate relative url only because I may move the folder  
later to a new location

what are my options?

 ---
tom_a_sparks "It's a nerdy thing I like to do"


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



[PHP] Re: php batch/queue framwork

2012-06-29 Thread Tom Sparks
>Forwarded Message: php-general_318334.ezm
>Re: php batch/queue framwork
>Friday, 29 June, 2012 6:30 AM
>From:
>"Shailesh N. Humbad" 
>To:
>php-general@lists.php.net
>On 6/28/2012 11:58 AM, Tom Sparks wrote:
> I am looking for a batch/queue framework that is database-centric?
> I could write my own, but I want one that is mature
>
> tom_a_sparks
> "It's a nerdy thing I like to do"
>
>
>You could try Amazon Simple Queue Service: http://aws.amazon.com/sqs/
>Use the PHP SDK: http://aws.amazon.com/sdkforphp/

I was hoping for something that I could run local on my host

tom

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



[PHP] php batch/queue framwork

2012-06-28 Thread Tom Sparks
I am looking for a batch/queue framework that is database-centric?
I could write my own, but I want one that is mature

tom_a_sparks
"It's a nerdy thing I like to do"



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



Re: [PHP] Variables via url

2012-05-12 Thread Tom Rogers
Hello Ashley,

Saturday, May 12, 2012, 9:15:23 AM, you wrote:


>  Can someone point me at examples or directions on how I can pass a
> variable via a URL in the following way:

>  http://server.domain.com//script///variable/

>  I will only be passing one single /variable/.  And I want the 
> /script/ to use that.

>  I don't want to see what the script is, for example I don't want it
> to say 'script.php' or 'script.html' ...

>  Is this possible through PHP only, or do I have to write a rewrite
> directive in Apache to accomplish this?

You can add this to apache conf:


ForceType application/x-httpd-php


Then make a file called phpscript without extension and drop it in the
web root.

http://server.domain.com/phpscript/variable1/variable2


-- 
Best regards,
 Tom


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



Re: [PHP] mysql list to two-column list

2012-03-19 Thread Tom Sparks
please delete me
---
tom_a_sparks "It's a nerdy thing I like to do"
Please use ISO approved file formats excluding Office Open XML - 
http://www.gnu.org/philosophy/no-word-attachments.html
Ubuntu wiki page https://wiki.ubuntu.com/tomsparks
3 x (x)Ubuntu 10.04, Amiga A1200 WB 3.1, UAE AF 2006 Premium Edition, AF 2012 
Plus Edition, Sam440 AOS 4.1.2, Roland DXY-1300 pen plotter, Cutok DC330 
cutter/pen plotter
Wanted: RiscOS system, GEOS system (C64/C128), Atari ST, Apple Macintosh 
(6502/68k/PPC only)


--- On Tue, 20/3/12, Tom Sparks  wrote:

> From: Tom Sparks 
> Subject: Re: [PHP] mysql list to two-column list
> To: a...@ashleysheridan.co.uk
> Cc: "php-general" 
> Received: Tuesday, 20 March, 2012, 10:41 AM
> --- On Tue, 20/3/12, Ashley Sheridan
> 
> wrote:
> 
> From: Ashley Sheridan 
> Subject: Re: [PHP] mysql list to two-column list
> To: "Tom Sparks" 
> Cc: "php-general" 
> Received: Tuesday, 20 March, 2012, 10:15 AM
> 
> 
> 
> 
>   
>   
> 
> 
> On Mon, 2012-03-19 at 16:09 -0700, Tom Sparks wrote:
> 
> --- On Tue, 20/3/12, Ashley Sheridan 
> wrote:
> 
> On Mon, 2012-03-19 at 15:43 -0700, Tom Sparks wrote:
> 
> >>I have a members list witch I print out once a
> week,
> >>I would like to make the list into two-column list,
> but I dont know >>where to start looking to change the
> code?
> 
> >>here is the code
> >>"
> >>$result = mysql_query("SELECT * FROM customers ORDER
> BY LastName");
> 
> >>while($row = mysql_fetch_array($result))
> >>  {
> >>  echo $row['LastName'];
> >>  echo " " . $row['FirstName'];
> >>  echo " " . $row['CustomNo'];
> >>  echo "";
> >>  }
> >>"
> 
> >>example output:
> 
> >>Bond James 007
> >>Quagmire Glenn 101
> >>Griffin Peter 102
> >>etc
> 
> >>---
> >>tom_a_sparks "It's a nerdy thing I like to do"
> >>Please use ISO approved file formats excluding
> Office Open XML - >>http://www.gnu.org/philosophy/no-word-attachments.html
> >>Ubuntu wiki page https://wiki.ubuntu.com/tomsparks
> 
> 
> >How do you mean?
> my goal is to do something phonebook like
> > In your example, it's a 3-column list (surname, 
> >forename, customer number) although you've added a
> 'cute' field to the >first entry for giggles. It's a
> simple thing to join the first two >fields, but what do
> you determine to be a single column?
> 
> 
> 
> Your reply of 9 words adds no extra information. Rather than
> have us all guess what you want, try and tell us
> specifically what it is that you want.
> 
> 
> 
> 
>     Cleveland Brown      | Griffin
> family
>     Cleveland Brown, Jr.  |  Brian
> Griffin
>     
> 
>

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



Re: [PHP] mysql list to two-column list

2012-03-19 Thread Tom Sparks
--- On Tue, 20/3/12, Ashley Sheridan  wrote:

From: Ashley Sheridan 
Subject: Re: [PHP] mysql list to two-column list
To: "Tom Sparks" 
Cc: "php-general" 
Received: Tuesday, 20 March, 2012, 10:15 AM




  
  


On Mon, 2012-03-19 at 16:09 -0700, Tom Sparks wrote:

--- On Tue, 20/3/12, Ashley Sheridan  wrote:

On Mon, 2012-03-19 at 15:43 -0700, Tom Sparks wrote:

>>I have a members list witch I print out once a week,
>>I would like to make the list into two-column list, but I dont know >>where 
>>to start looking to change the code?

>>here is the code
>>"
>>$result = mysql_query("SELECT * FROM customers ORDER BY LastName");

>>while($row = mysql_fetch_array($result))
>>  {
>>  echo $row['LastName'];
>>  echo " " . $row['FirstName'];
>>  echo " " . $row['CustomNo'];
>>  echo "";
>>  }
>>"

>>example output:

>>Bond James 007
>>Quagmire Glenn 101
>>Griffin Peter 102
>>etc

>>---
>>tom_a_sparks "It's a nerdy thing I like to do"
>>Please use ISO approved file formats excluding Office Open XML - 
>>>>http://www.gnu.org/philosophy/no-word-attachments.html
>>Ubuntu wiki page https://wiki.ubuntu.com/tomsparks


>How do you mean?
my goal is to do something phonebook like
> In your example, it's a 3-column list (surname, 
>forename, customer number) although you've added a 'cute' field to the >first 
>entry for giggles. It's a simple thing to join the first two >fields, but what 
>do you determine to be a single column?



Your reply of 9 words adds no extra information. Rather than have us all guess 
what you want, try and tell us specifically what it is that you want.




Cleveland Brown  | Griffin family
Cleveland Brown, Jr.  |  Brian Griffin



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



Re: [PHP] mysql list to two-column list

2012-03-19 Thread Tom Sparks
--- On Tue, 20/3/12, Ashley Sheridan  wrote:

On Mon, 2012-03-19 at 15:43 -0700, Tom Sparks wrote:

>>I have a members list witch I print out once a week,
>>I would like to make the list into two-column list, but I dont know >>where 
>>to start looking to change the code?

>>here is the code
>>"
>>$result = mysql_query("SELECT * FROM customers ORDER BY LastName");

>>while($row = mysql_fetch_array($result))
>>  {
>>  echo $row['LastName'];
>>  echo " " . $row['FirstName'];
>>  echo " " . $row['CustomNo'];
>>  echo "";
>>  }
>>"

>>example output:

>>Bond James 007
>>Quagmire Glenn 101
>>Griffin Peter 102
>>etc

>>---
>>tom_a_sparks "It's a nerdy thing I like to do"
>>Please use ISO approved file formats excluding Office Open XML - 
>>>>http://www.gnu.org/philosophy/no-word-attachments.html
>>Ubuntu wiki page https://wiki.ubuntu.com/tomsparks


>How do you mean?
my goal is to do something phonebook like
> In your example, it's a 3-column list (surname, 
>forename, customer number) although you've added a 'cute' field to the >first 
>entry for giggles. It's a simple thing to join the first two >fields, but what 
>do you determine to be a single column?







-- 












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



[PHP] mysql list to two-column list

2012-03-19 Thread Tom Sparks
I have a members list witch I print out once a week,
I would like to make the list into two-column list, but I dont know where to 
start looking to change the code?

here is the code
"
$result = mysql_query("SELECT * FROM customers ORDER BY LastName");

while($row = mysql_fetch_array($result))
  {
  echo $row['LastName'];
  echo " " . $row['FirstName'];
  echo " " . $row['CustomNo'];
  echo "";
  }
"

example output:

Bond James Bond 007
Quagmire Glenn 101
Griffin Peter 102
etc

---
tom_a_sparks "It's a nerdy thing I like to do"
Please use ISO approved file formats excluding Office Open XML - 
http://www.gnu.org/philosophy/no-word-attachments.html
Ubuntu wiki page https://wiki.ubuntu.com/tomsparks
3 x (x)Ubuntu 10.04, Amiga A1200 WB 3.1, UAE AF 2006 Premium Edition, AF 2012 
Plus Edition, Sam440 AOS 4.1.2, Roland DXY-1300 pen plotter, Cutok DC330 
cutter/pen plotter
Wanted: RiscOS system, GEOS system (C64/C128), Atari ST, Apple Macintosh 
(6502/68k/PPC only)

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



[PHP] ext/mbstring compile time dependency

2012-01-04 Thread Tom Worster
What does this mean in the PHP Change Log:

  "Removed compile time dependency from ext/mbstring (Dmitry)"


Does it mean that mbstring is available by default in PHP 5.4?



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



Re: [PHP] PHP4 vs PHP5 overrides

2011-03-16 Thread Tom Robinson
It's funny how talking or writing about something uncovers things you
didn't see before.

In an effort to tidy up the code I heeded the original implementors
comments and made the methods private (they were previously undeclared).
Making them public seems to have fixed the problem.

On 17/03/11 13:20, Tom Robinson wrote:
> My apologies. I've not seen something I should have earlier. Also the
> instance that is behind all of this is and instance of
> ActiveRecordFormClass.
>
> So, in PHP4, the correct overridden method is called:
> ActiveRecordFormClass::_dispatchSave().
> In PHP5, the FormClass::_dispatchSave() is called...???
>
> BTW I'm tracing this though with xdebug.
>
> Regards,
>
> Tom
>
> Tom Robinson
> System Administrator
> On 17/03/11 13:06, Tom Robinson wrote:
>> Hi,
>>
>> I'm trying to decipher inherited code (I did not write this) and I'm
>> having great difficulty understanding the override of a method in PHP4
>> vs PHP5
>>
>> Here's the code:
>>
>> form.php
>> 22 class FormClass
>> 23 {
>> ...
>> /* some method calls to _dispatchSave() */
>> 572 if($this->_dispatchSave($key) === FALSE)
>> 573 {
>> 574 return FALSE;
>> 575 }
>> ...
>> /* _dispatchSave is defined */
>> 692 function _dispatchSave($key)
>> 693 {
>>
>> arform.php
>> 17 class ActiveRecordFormClass extends FormClass
>> 18 {
>> ...
>> /* _dispatchSave is defined */
>> 84 function _dispatchSave(&$key)
>> 85 {
>>
>> In PHP 4.3.9:
>>
>> The arform.php implementation of _dispatchSave is called
>> (i.e.ActiveRecordFormClass::_dispatchSave())in preference to the one
>> defined in it's own class. This is the desired call BTW but why does
>> this happening? I would expect the parent implementation to be called,
>> not a child implementation???
>>
>> In PHP 5.1.6:
>>
>> I get the warning:
>>
>> "PHP Strict Standards:  Declaration of
>> ActiveRecordFormClass::_dispatchSave() should be compatible with that of
>> FormClass::_dispatchSave() in ..."
>>
>> which is expected since the parameters are defined differently. As I
>> expected, the FormClass::_dispatchSave() implementation is called in
>> PHP5. This implementation does not have the desired effect (the
>> application crashes).
>>
>> What is happening? Maybe I'm not seeing something simple. I look forward
>> to any responses.
>>
>> Regards,
>>
>> Tom
>>
>>
>>
>>


signature.asc
Description: OpenPGP digital signature


Re: [PHP] PHP4 vs PHP5 overrides

2011-03-16 Thread Tom Robinson
My apologies. I've not seen something I should have earlier. Also the
instance that is behind all of this is and instance of
ActiveRecordFormClass.

So, in PHP4, the correct overridden method is called:
ActiveRecordFormClass::_dispatchSave().
In PHP5, the FormClass::_dispatchSave() is called...???

BTW I'm tracing this though with xdebug.

Regards,

Tom

Tom Robinson
System Administrator

On 17/03/11 13:06, Tom Robinson wrote:
> Hi,
>
> I'm trying to decipher inherited code (I did not write this) and I'm
> having great difficulty understanding the override of a method in PHP4
> vs PHP5
>
> Here's the code:
>
> form.php
> 22 class FormClass
> 23 {
> ...
> /* some method calls to _dispatchSave() */
> 572 if($this->_dispatchSave($key) === FALSE)
> 573 {
> 574 return FALSE;
> 575 }
> ...
> /* _dispatchSave is defined */
> 692 function _dispatchSave($key)
> 693 {
>
> arform.php
> 17 class ActiveRecordFormClass extends FormClass
> 18 {
> ...
> /* _dispatchSave is defined */
> 84 function _dispatchSave(&$key)
> 85 {
>
> In PHP 4.3.9:
>
> The arform.php implementation of _dispatchSave is called
> (i.e.ActiveRecordFormClass::_dispatchSave())in preference to the one
> defined in it's own class. This is the desired call BTW but why does
> this happening? I would expect the parent implementation to be called,
> not a child implementation???
>
> In PHP 5.1.6:
>
> I get the warning:
>
> "PHP Strict Standards:  Declaration of
> ActiveRecordFormClass::_dispatchSave() should be compatible with that of
> FormClass::_dispatchSave() in ..."
>
> which is expected since the parameters are defined differently. As I
> expected, the FormClass::_dispatchSave() implementation is called in
> PHP5. This implementation does not have the desired effect (the
> application crashes).
>
> What is happening? Maybe I'm not seeing something simple. I look forward
> to any responses.
>
> Regards,
>
> Tom
>
>
>
>


signature.asc
Description: OpenPGP digital signature


[PHP] PHP4 vs PHP5 overrides

2011-03-16 Thread Tom Robinson
Hi,

I'm trying to decipher inherited code (I did not write this) and I'm
having great difficulty understanding the override of a method in PHP4
vs PHP5

Here's the code:

form.php
22 class FormClass
23 {
...
/* some method calls to _dispatchSave() */
572 if($this->_dispatchSave($key) === FALSE)
573 {
574 return FALSE;
575 }
...
/* _dispatchSave is defined */
692 function _dispatchSave($key)
693 {

arform.php
17 class ActiveRecordFormClass extends FormClass
18 {
...
/* _dispatchSave is defined */
84 function _dispatchSave(&$key)
85 {

In PHP 4.3.9:

The arform.php implementation of _dispatchSave is called
(i.e.ActiveRecordFormClass::_dispatchSave())in preference to the one
defined in it's own class. This is the desired call BTW but why does
this happening? I would expect the parent implementation to be called,
not a child implementation???

In PHP 5.1.6:

I get the warning:

"PHP Strict Standards:  Declaration of
ActiveRecordFormClass::_dispatchSave() should be compatible with that of
FormClass::_dispatchSave() in ..."

which is expected since the parameters are defined differently. As I
expected, the FormClass::_dispatchSave() implementation is called in
PHP5. This implementation does not have the desired effect (the
application crashes).

What is happening? Maybe I'm not seeing something simple. I look forward
to any responses.

Regards,

Tom






signature.asc
Description: OpenPGP digital signature


Re: [PHP] Deleting elements from the middle of an array

2011-03-16 Thread Tom Barrett
http://en.wikipedia.org/wiki/Two_Little_Dickie_Birds


[PHP] Bar Charts in PDFs

2011-02-11 Thread Tom Barrett
Hi

I need to generate some PDF reports (1000s). Part of the report is a set of
bar charts (the results of a questionnaire). Each question has the same 5
answers (v.bad, bad, ok ,good, v.good) and the chart is the % distribution
of the answers.

My plan is to create a HTML version, using "some graph drawing"* (saving a
copy of the HTML to disk), creating a PDF version using html2pdf (saving a
copy to disk and emailing to the recipient).

I think html2pdf can handle this. But I have not had much success finding
something to draw my graphs. Any (free) simple libraries out there I could
be pointed towards?

Thanks!
Tom


Re: [PHP] Mysql search query ignoring dots

2011-01-24 Thread Tom Rogers
Hi,

Monday, January 24, 2011, 10:50:41 PM, you wrote:
BP> Hi all,

BP> I have to perform a mysql query in a table with millions of records.
BP> I've full-text indexed my search field and I'm searching with MATCH AGAINST.
BP> But there is a problem. In this field there are company names that 
BP> contain dots, for istance I've "PO.SE. srl" and I want to find it if 
BP> the user search for: "POSE" or "PO.SE" or "P.O.S.E." etc.
BP> I googled in the web but I don't find any solution. I don't want to 
BP> add a new field with the cleaned version of my string because I would 
BP> like to solve with the query and I prefer that the mysql table not 
BP> become too big. But if I will not find a different solution, I will 
BP> use this escamotage.
BP> I've find a post that is similar but the solution don't seem to solve 
BP> my situation.
BP> You can see it at the url:
BP> http://forums.mysql.com/read.php?10,395557,395584#msg-395584
BP> In my case replace(email, '.', '') = replace(theSearchValue, '.', '');
BP> is indifferent and don't change my results.

BP> My query, searching "POSE", is:

BP> select aziende.* from aziende where 1>0 AND 
BP> (MATCH(aziende.ragione_sociale) AGAINST('+POSE' IN BOOLEAN MODE) OR 
BP> (replace(aziende.ragione_sociale, '.', '') = replace('POSE', '.', 
BP> '')) order by aziende.ragione_sociale limit 0, 10

BP> The alternative choice could be REGEXP but I've red that it make my 
BP> query slow in a table of millions of records and I don't know how to 
BP> exclude dots in the regular expression.

BP> Can anyone help me?

BP> Thanks in advance.
BP> Barbara

BP> -- 
BP> 
BP> Barbara Picci
BP> Micro srl
BP> viale Marconi 222, 09131 Cagliari  - tel. (+39) 070400240
BP> http://www.microsrl.com


In  the interest of speed it may be worth creating a table with just a
link id and the text to search which you can cleanup before inserting.
It will probably save you a headache in the future and will be quicker
than complicated queries.

The list of possible ids can then be tested against the full table for
any other criteria which if the table is indexed properly will be fast
too.

-- 
regards,
Tom


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



Re: [PHP] PHP4 to PHP5 migration with E_STRICT

2010-12-07 Thread Tom Robinson
Thanks David.

If my understanding is correct, then:

SPControlPanel::getContentTypes($db);

is a reference to a static instantiation of the class. If so, then it
must be syntactically something like when using 'new' (which returns a
reference) so there's no need to apply the & operator. Am I on the right
track?

I have some more PHP4 code in the application which caused: "PHP
Notice:  Only variable references should be returned by reference". I
have fixed it like this:

<   function & _getTable($cached=true)
<   {
<   return new TableClass($this->_getTableName());
---
>   function & _getTable($cached=true) {
>   $temp = new TableClass($this->_getTableName());
>   return $temp;

Is this acceptable?

I'll have to come back to the $db issue - it's not issuing a warning so
I'll leave it alone until I've tidied up all the other issues.

Regards,

Tom

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



[PHP] PHP4 to PHP5 migration with E_STRICT

2010-12-07 Thread Tom Robinson
Hi,

I'm migrating a web application written for PHP4 to PHP5. I've turned on
E_STRICT to have a detailed look at all the code thoroughly. I have a
number of 'Notices' and 'Strict Standards' messages appearing now.

I don't consider myself a PHP guru by any means so I'm seeking help with
understanding these messages and how to fix the code.

One of the messages is:

"PHP Strict Standards:  Only variables should be assigned by reference in"

This is for a class SPControlPanel with a method

function getContentTypes(&$db)
{
$tabledata = array();

$sql = "select
contenttype.*
from
contenttype";

return $db->queryAll($sql, true);
}

The warning is for this segment of code below which is another method in
the same class (marked with comment // this line):

function getCategoryTypes(&$db) {
$tabledata = array();

$myContentTypes = &SPControlPanel::getContentTypes($db); // this
line
foreach ($myContentTypes as $key => $data) {
if ($data['iscategory']) $tabledata[] = $data['contenttype'];
}

return $tabledata;
}

There are many more methods making assignments in a similar way in this
class and in other classes throughout the code.

I'm not sure of the best way to re-code this to resolve the E_STRICT
warning.

Any help is much appreciated.

Regards,

Tom


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



Re: [PHP] Possible issue in mail() function?

2010-11-27 Thread Tom Hendrikx
On 26/11/10 16:54, Richard Quadling wrote:
> On 26 November 2010 15:12, Tom Hendrikx  wrote:
>> On 26/11/10 15:54, Richard Quadling wrote:
>>> On 25 November 2010 21:30, Tom Hendrikx  wrote:
>>>> Hi,
>>>>
>>>> I noticed that the mail() function in php 5.3.3 on gentoo linux triggers
>>>> a warning when used. A simple debug script with the contents:
>>>>
>>>> >>> // recipient, subject, body
>>>> mail("s...@example.com", "mail() test", "This is a test");
>>>> ?>
>>>>
>>>> does send mail, but it also raises a warning:
>>>>
>>>> Warning: mail(1): failed to open stream: Permission denied in
>>>> /var/www/www.example.com/htdocs/test-mail/index.php on line 5
>>>>
>>>> After some googling [1] and fiddling with permissions, the message
>>>> disappears when php has write permissions to the file
>>>> /var/www/www.example.com/htdocs/test-mail/1 , in which it writes the
>>>> following data:
>>>
>>> Are you logging your emails via the ini setting mail.log? Maybe this
>>> is the issue.
>>>
>>
>> Erh, actually, yes I am. Documentation of the setting is rather sparse,
>> but I enabled it some time ago, expecting it to send the data to the
>> logging facility (syslog in my case), after which I forgot to check if
>> that actually happens. The current implementation is rather useless (to
>> me), so I turned it off again.
>>
>> Thanks for the tip, but I think that this is actually a bug? Current way
>> of logging is not very useful, since the file '1' is overwritten (in
>> stead of appended to) with new data at every run of the mail() function.
>>
>> --
>> Regards,
>>Tom
>>
>>
> 
> I'm on windows and my mail.log shows me all the mail I've sent using
> the mail() command since I turned it on.
> 
> But according to
> http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/ext/standard/mail.c?view=markup#l227,
> the mail.log file is opened in append mode.
> 
> I'm guessing PHP isn't responsible here.
> 

Actually, now I understand. I set mail.log to '1', enabling it as a
boolean and expecting it to send the output to whatever error_log points
to. In stead, mail.log expects a string, the path where to log to.

Documentation of the setting is quite sparse, and I failed to notice
that the config option wants a string and no boolean. Mystery solved :)

--
Regards,
Tom

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



Re: [PHP] Possible issue in mail() function?

2010-11-26 Thread Tom Hendrikx
On 26/11/10 15:54, Richard Quadling wrote:
> On 25 November 2010 21:30, Tom Hendrikx  wrote:
>> Hi,
>>
>> I noticed that the mail() function in php 5.3.3 on gentoo linux triggers
>> a warning when used. A simple debug script with the contents:
>>
>> > // recipient, subject, body
>> mail("s...@example.com", "mail() test", "This is a test");
>> ?>
>>
>> does send mail, but it also raises a warning:
>>
>> Warning: mail(1): failed to open stream: Permission denied in
>> /var/www/www.example.com/htdocs/test-mail/index.php on line 5
>>
>> After some googling [1] and fiddling with permissions, the message
>> disappears when php has write permissions to the file
>> /var/www/www.example.com/htdocs/test-mail/1 , in which it writes the
>> following data:
>>
>> ==8<==
>> mail() on [/var/www/www.example.com/htdocs/test-mail/index.php:5]: To:
>> s...@example.com -- Headers:
>> ==8<==
>>
>> Is this some debug output that someone forgot to remove?
>>
>> When relevant, the sendmail_path used is "/usr/sbin/sendmail -t -i",
>> which is a regular Postfix sendmail.
>>
>> [1] http://stackoverflow.com/questions/1906403
>>
>> --
>> Kind regards,
>>Tom Hendrikx
> 
> Are you logging your emails via the ini setting mail.log? Maybe this
> is the issue.
> 
> 

Erh, actually, yes I am. Documentation of the setting is rather sparse,
but I enabled it some time ago, expecting it to send the data to the
logging facility (syslog in my case), after which I forgot to check if
that actually happens. The current implementation is rather useless (to
me), so I turned it off again.

Thanks for the tip, but I think that this is actually a bug? Current way
of logging is not very useful, since the file '1' is overwritten (in
stead of appended to) with new data at every run of the mail() function.

--
Regards,
Tom



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



Re: [PHP] Possible issue in mail() function?

2010-11-26 Thread Tom Hendrikx
On 26/11/10 15:54, Richard Quadling wrote:
> On 25 November 2010 21:30, Tom Hendrikx  wrote:
>> Hi,
>>
>> I noticed that the mail() function in php 5.3.3 on gentoo linux triggers
>> a warning when used. A simple debug script with the contents:
>>
>> > // recipient, subject, body
>> mail("s...@example.com", "mail() test", "This is a test");
>> ?>
>>
>> does send mail, but it also raises a warning:
>>
>> Warning: mail(1): failed to open stream: Permission denied in
>> /var/www/www.example.com/htdocs/test-mail/index.php on line 5
>>
>> After some googling [1] and fiddling with permissions, the message
>> disappears when php has write permissions to the file
>> /var/www/www.example.com/htdocs/test-mail/1 , in which it writes the
>> following data:
> 
> Are you logging your emails via the ini setting mail.log? Maybe this
> is the issue.
> 

Erh, actually, yes I am. Documentation of the setting is rather sparse,
but I enabled it some time ago, expecting it to send the data to the
logging facility (syslog in my case), after which I forgot to check if
that actually happens. The current implementation is rather useless (to
me), so I turned it off again.

Thanks for the tip, but I think that this is actually a bug? Current way
of logging is not very useful, since the file '1' is overwritten (in
stead of appended to) with new data at every run of the mail() function.

--
Regards,
Tom



signature.asc
Description: OpenPGP digital signature


[PHP] Possible issue in mail() function?

2010-11-25 Thread Tom Hendrikx
Hi,

I noticed that the mail() function in php 5.3.3 on gentoo linux triggers
a warning when used. A simple debug script with the contents:



does send mail, but it also raises a warning:

Warning: mail(1): failed to open stream: Permission denied in
/var/www/www.example.com/htdocs/test-mail/index.php on line 5

After some googling [1] and fiddling with permissions, the message
disappears when php has write permissions to the file
/var/www/www.example.com/htdocs/test-mail/1 , in which it writes the
following data:

==8<==
mail() on [/var/www/www.example.com/htdocs/test-mail/index.php:5]: To:
s...@example.com -- Headers:
==8<==

Is this some debug output that someone forgot to remove?

When relevant, the sendmail_path used is "/usr/sbin/sendmail -t -i",
which is a regular Postfix sendmail.

[1] http://stackoverflow.com/questions/1906403

--
Kind regards,
Tom Hendrikx

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



RE: [PHP] simple photo gallery

2010-11-08 Thread Tom Sparks
--- On Mon, 8/11/10, Tommy Pham  wrote:

> From: Tommy Pham 
> Subject: RE: [PHP] simple photo gallery
> To: a...@ashleysheridan.co.uk, "'Tom Sparks'" 
> Cc: php-general@lists.php.net
> Received: Monday, 8 November, 2010, 11:11 PM
> > -Original Message-
> > From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
> > Sent: Sunday, November 07, 2010 2:55 AM
> > To: Tom Sparks
> > Cc: php-general@lists.php.net
> > Subject: Re: [PHP] simple photo gallery
> > 
> > On Sun, 2010-11-07 at 02:31 -0800, Tom Sparks wrote:
> > 
> > > I am looking for a simple photo gallery like
> this
> > http://www.lavrsen.dk/webcam/cam1/movecam.php
> > >
> > > I want to use it in place of apache autoindex
> > >
> > >
> > > tom_a_sparks
> > > "It's a nerdy thing I like to do"
> > >
> > >
> > >
> > >
> > 
> > Erm, is there a question in there?
> > 
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> > 
> 
> I think Tom is look a very basic photo gallery like the
> link.  However, the link just shows updated pictures
> from a webcam.  Tom, is that you want?

not the webcamera part, the gallery layout well be following the Design rule 
for Camera File system, and it well be run on a network camera (with hard drive)

> Looking
> for something that will get pictures periodically from your
> cam (either web or cctv) and post online?

no

>  Or looking
> for a more useful (read robust) photo gallery where you can
> have multiple albums - the albums can be protected via
> invite only - or the have ability to send the digital copy
> to a photo studio for a hard copy?  The photo gallery
> can have other features such as slideshow, purchase &
> download, etc...  And the gallery can also take
> pictures from your web cam also...?

I am going to be using gallery2 for my website, but this is for my custom made 
elphel camera

> 
> Regards,
> Tommy

tom_a_sparks
"It's a nerdy thing I like to do"




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



[PHP] simple photo gallery

2010-11-07 Thread Tom Sparks
I am looking for a simple photo gallery like this 
http://www.lavrsen.dk/webcam/cam1/movecam.php

I want to use it in place of apache autoindex


tom_a_sparks
"It's a nerdy thing I like to do"




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



[PHP] PHP Unconference Europe

2010-10-06 Thread Tom Calpin
I'm not affiliated with the PHP Unconference in any way but saw this on another 
mailing list, so just passing it on here in case anyone is interested.

 

-Tom

 

 

 

 

 

We are delighted to announce that PHP Unconference Europe will take place on:

 

19th & 20th February 2011

in:

Manchester, UK.

 

The venue will be in a central location, very accessible from all

three train stations in Manchester city center.

 

Learn more at:

 

http://www.phpuceu.org/2010/10/03/save-the-date-feb-19-20-2011/

 

As PHP Unconference Europe is an international event, admission

tickets will go on sale in two currencies.

 

They will cost £ 40.00 or € 46.00.

 

We expect to announce the exact venue and put the entry tickets up for

sale very shortly.

 

PHP Unconference Europe is organized by group of volunteers, based

throughout Europe and is non-commercial. The goal of the unconference

is the exchange of information about PHP and related topics, not to

make a profit - ticket sales and sponsor funding just cover our costs.

 

We really need your help in spreading the word and to make the

unconference a success. Here is how you can help:

 

1. If you have a blog about PHP or related web technologies, please

post a short message, announcing PHP Unconference Europe.

 

2. Tweet about the unconference. The official hash tag is #phpuceu .

 

3. Tell all your friends and colleagues, who are interested in PHP and

related web technologies about the unconference.

 

The organizers look forward to seeing many of you at the event.



Re: [PHP] Database Administration

2010-09-30 Thread Tom Barrett
Thanks for the replies, they have been most enlightening. :)


Re: [PHP] Database Administration

2010-09-24 Thread Tom Barrett
On 22 September 2010 21:40, Bastien Koert  wrote:

> Not at all. What I would suggest is that you create a separate mysql
> user that is used exclusively by the script to do the create stuff.
> The regular application user account should not have those privileges
> at all.
>

I'm not actually that familiar with DB admin to that extent. I have either
app users with lock+crud on specific databases, or root. As a an aside,
would you know if there is a level of permissions for a user between app and
root that would be 'sensibly secure' (it will be MySQL 5)?


> Another option, if immediate response is not required, is to save this
> data into the system for a cron script with another user account to
> run.
>

This was sort of my first instinct. I ponder writing a small daemon/cron
that queries a database table (client list) and does all the 'build' bits.
The main issue with cron is that the users would want a fairly immediate
response. Seconds is acceptable, but a 5 minute cron might be too slow.


> Is there a reason for you not to place all the data in one DB and just
> separate them out based on user id, to ensure they only see their own
> data
>

For legal reasons. Each client must have separate data. I need to be able to
box up all the client data (containing multiple app instances) and be 100%
sure that I am giving them all their data and nobody else's.

On 23 September 2010 18:04, tedd  wrote:

> No, but from what you've said, I don't think the end user must have
> privileges and the ability to create a database and tables. It sounds more
> like allowing the user to set up his own admin for acceptable users --
> there's a big difference.
>
> So, what you need to define is what the client and his users want to do.
> From that, we can determine what they need.


Depending on what you mean by 'the client', all the client side things are
fine :)
The web front-end I am working on here is for internal use only. To allow
non-technical people to set up clients and their apps.

The more I look into this, the more I am leaning towards some shell scripts
for client management, invoking them by cron. Then if an immediate response
is needed someone technical will have to manually run the cron job. It looks
like the law of diminishing returns for me to build something really usable.


Re: [PHP] Database Administration

2010-09-22 Thread Tom Barrett
Hmm..

I am familiar with PMA. I would for the purpose of this project consider it
too technical for the target user base. The point is to create a GUI layer
that would manage these things.

For example, the 'add client' screen would ask for four things; name,
description, username and password. Then behind the scenes a database would
be created, the user created, permissions granted and a pre-configure set of
tables built (and populated).

My reservations come from security issues (which, as an aside, are also
discussed about PMA), allowing a normal user account CREATE and GRANT on the
database.

Maybe I'm being too fuddy-duddy cautious.


[PHP] Database Administration

2010-09-21 Thread Tom Barrett
Hi

I need to build a custom client management app, which will build and manage
a database per client. This means that on top of the usual sql crud, it
needs to be able to create databases, add/edit/delete database users, create
tables.

Is there a way for me to do this nicely as PHP solution? am I better off
incorporating non PHP pieces into this (e.g. shell)? or should I leave the
admin tasks (e.g. database creation) as a 'normal' administrative task
(commandline/webmin/watever)?


Re: [PHP] New to PHP and the list

2010-09-11 Thread Tom Sparks
--- On Sun, 12/9/10, MikeB  wrote:

> From: MikeB 
> Subject: [PHP] New to PHP and the list
> To: php-general@lists.php.net
> Received: Sunday, 12 September, 2010, 9:37 AM
> Hello, I'm new to PHP and also new to
> using newsgroups/mailing lists directly. So if I make a
> mistake, please forgive me this once and I'll try to do
> better in the future.
> 
> Please help me understand, my head is absolutely spinning
> and I can't
> get my mind around this.
> 
> In the php.net site there is an example on uploading a file
> via a
> form. http://www.php.net/manual/en/features.file-upload.post-method.php
>
start off simpler with this version 
http://www.w3schools.com/php/php_file_upload.asp

tom





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



Re: [PHP] Filestat.c erorrs when building php-5.3.3 on solaris

2010-09-09 Thread Tom Rogers
Hi,

Friday, September 10, 2010, 2:49:36 AM, you wrote:
SVCD> Ok, I tried removing the --disable-posix and adding --with-tsrm-pthreads
SVCD> to the configure options. 
SVCD> The resulting configure looks like this:

SVCD> CC='/usr/local/bin/gcc' \
SVCD> './configure' \
SVCD> '--prefix=/app/php533' \
SVCD> '--enable-shared' \
SVCD> '--with-tsrm-pthreads' \
SVCD> '--with-gnu-ld' \
SVCD> '--with-apxs2=/app/apache2216/bin/apxs' \
SVCD> '--with-zlib' \
SVCD> '--with-zlib-dir=/usr/lib' \
SVCD> '--with-png-dir=/usr/include/libpng' \
SVCD> '--with-openssl=/shared_ro/openssl_098' \
SVCD> '--with-oci8=/shared_ro/users.oracle/11.1.0'

SVCD> Now I get this:

SVCD> /users/0/php-5.3.3/ext/posix/posix.c: In function
SVCD> `zif_posix_getgrnam':
SVCD> /users/0/php-5.3.3/ext/posix/posix.c:1017: error: too many arguments
SVCD> to function `getgrnam_r'
SVCD> /users/0/php-5.3.3/ext/posix/posix.c: In function
SVCD> `zif_posix_getgrgid':
SVCD> /users/0/php-5.3.3/ext/posix/posix.c:1067: error: too many arguments
SVCD> to function `getgrgid_r'
SVCD> /users/0/php-5.3.3/ext/posix/posix.c:1067: warning: assignment makes
SVCD> integer from pointer without a cast
SVCD> /users/0/php-5.3.3/ext/posix/posix.c: In function
SVCD> `zif_posix_getpwnam':
SVCD> /users/0/php-5.3.3/ext/posix/posix.c:1136: error: too many arguments
SVCD> to function `getpwnam_r'
SVCD> /users/0/php-5.3.3/ext/posix/posix.c: In function
SVCD> `zif_posix_getpwuid':
SVCD> /users/0/php-5.3.3/ext/posix/posix.c:1184: error: too many arguments
SVCD> to function `getpwuid_r'
SVCD> /users/0/php-5.3.3/ext/posix/posix.c:1184: warning: assignment makes
SVCD> integer from pointer without a cast
SVCD> gmake: *** [ext/posix/posix.lo] Error 1

SVCD> Do I need to add the -D_POSIX_PTHREAD_SEMANTICS in the makefile or
SVCD> configure.in somewhere? Can you point me in the right direction?

SVCD>   -Vicki Stanfield, RHCE, CISSP

SVCD> -Original Message-
SVCD> From: Tom Rogers [mailto:trog...@kwikin.com] 
SVCD> Sent: Wednesday, September 08, 2010 10:06 PM
SVCD> To: Tom Rogers
SVCD> Cc: php-general@lists.php.net
SVCD> Subject: Re: [PHP] Filestat.c erorrs when building php-5.3.3 on solaris

SVCD> Hi,

SVCD> Thursday, September 9, 2010, 11:31:06 AM, you wrote:
TR>> Hi,

TR>> Thursday, September 9, 2010, 2:07:50 AM, you wrote:
SVCD>>> I am trying to build php-5.3.3 and getting the following error: 

SVCD>>> /users/0/php-5.3.3/TSRM -I/users/0/php-5.3.3/Zend
SVCD>>> -I/usr/local/include -g -O2 -DZTS   -c
SVCD>>> /users/0/php-5.3.3/ext/standard/filestat.c -o
SVCD>>> ext/standard/filestat.lo 
SVCD>>> /users/0/php-5.3.3/ext/standard/filestat.c: In function
SVCD>>> `php_do_chgrp':
SVCD>>> /users/0/php-5.3.3/ext/standard/filestat.c:416: error: too
SVCD> many
SVCD>>> arguments to function `getgrnam_r'
SVCD>>> /users/0/php-5.3.3/ext/standard/filestat.c: In function
SVCD>>> `php_do_chown':
SVCD>>> /users/0/php-5.3.3/ext/standard/filestat.c:517: error: too
SVCD> many
SVCD>>> arguments to function `getpwnam_r'
SVCD>>> make: *** [ext/standard/filestat.lo] Error 1

SVCD>>> I have set my ORACLE_HOME, my PATH, and my LD_LIBRARY_PATH
SVCD>>> And used the following configure command:

SVCD>>> ./configure --prefix=/app/php533
SVCD> --with-apxs2=/app/apache2215/bin/apxs
SVCD>>> --with-zlib --with-zlib-dir=/usr/lib
SVCD>>> --with-png-dir=/usr/include/libpng
SVCD>>> --with-openssl=/shared_ro/openssl_098
SVCD>>> --with-oci8=/shared_ro/users.oracle/11.1.0

SVCD>>> I am using gmake 3.80. Can anyone give me a hint as to what I am
SVCD> doing
SVCD>>> wrong in this build?

SVCD>>>   -Vicki Stanfield, RHCE, CISSP


TR>> From   the   error  message  it  would  seem  the  operating
SVCD> system's
TR>> getpwnam_r() function is not POSIX compatible.
TR>> What system are you compiling on?

TR>> -- 
TR>> regards,
TR>> Tom



SVCD> It  would  seem  you  need to add -D_POSIX_PTHREAD_SEMANTICS to the cc
SVCD> flags to get the right function.

SVCD> -- 
SVCD> regards,
SVCD> Tom



That  should  get  added  automatically  when  you run configure if it
recognizes that the system is solaris.

Try adding --host=solaris to configure and see if that helps

-- 
regards,
Tom


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



Re: [PHP] Filestat.c erorrs when building php-5.3.3 on solaris

2010-09-08 Thread Tom Rogers
Hi,

Thursday, September 9, 2010, 11:31:06 AM, you wrote:
TR> Hi,

TR> Thursday, September 9, 2010, 2:07:50 AM, you wrote:
SVCD>> I am trying to build php-5.3.3 and getting the following error: 

SVCD>> /users/0/php-5.3.3/TSRM -I/users/0/php-5.3.3/Zend
SVCD>> -I/usr/local/include -g -O2 -DZTS   -c
SVCD>> /users/0/php-5.3.3/ext/standard/filestat.c -o
SVCD>> ext/standard/filestat.lo 
SVCD>> /users/0/php-5.3.3/ext/standard/filestat.c: In function
SVCD>> `php_do_chgrp':
SVCD>> /users/0/php-5.3.3/ext/standard/filestat.c:416: error: too many
SVCD>> arguments to function `getgrnam_r'
SVCD>> /users/0/php-5.3.3/ext/standard/filestat.c: In function
SVCD>> `php_do_chown':
SVCD>> /users/0/php-5.3.3/ext/standard/filestat.c:517: error: too many
SVCD>> arguments to function `getpwnam_r'
SVCD>> make: *** [ext/standard/filestat.lo] Error 1

SVCD>> I have set my ORACLE_HOME, my PATH, and my LD_LIBRARY_PATH
SVCD>> And used the following configure command:

SVCD>> ./configure --prefix=/app/php533 --with-apxs2=/app/apache2215/bin/apxs
SVCD>> --with-zlib --with-zlib-dir=/usr/lib
SVCD>> --with-png-dir=/usr/include/libpng
SVCD>> --with-openssl=/shared_ro/openssl_098
SVCD>> --with-oci8=/shared_ro/users.oracle/11.1.0

SVCD>> I am using gmake 3.80. Can anyone give me a hint as to what I am doing
SVCD>> wrong in this build?

SVCD>>   -Vicki Stanfield, RHCE, CISSP


TR> From   the   error  message  it  would  seem  the  operating  system's
TR> getpwnam_r() function is not POSIX compatible.
TR> What system are you compiling on?

TR> -- 
TR> regards,
TR> Tom



It  would  seem  you  need to add -D_POSIX_PTHREAD_SEMANTICS to the cc
flags to get the right function.

-- 
regards,
Tom


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



Re: [PHP] Filestat.c erorrs when building php-5.3.3 on solaris

2010-09-08 Thread Tom Rogers
Hi,

Thursday, September 9, 2010, 2:07:50 AM, you wrote:
SVCD> I am trying to build php-5.3.3 and getting the following error: 

SVCD> /users/0/php-5.3.3/TSRM -I/users/0/php-5.3.3/Zend
SVCD> -I/usr/local/include -g -O2 -DZTS   -c
SVCD> /users/0/php-5.3.3/ext/standard/filestat.c -o
SVCD> ext/standard/filestat.lo 
SVCD> /users/0/php-5.3.3/ext/standard/filestat.c: In function
SVCD> `php_do_chgrp':
SVCD> /users/0/php-5.3.3/ext/standard/filestat.c:416: error: too many
SVCD> arguments to function `getgrnam_r'
SVCD> /users/0/php-5.3.3/ext/standard/filestat.c: In function
SVCD> `php_do_chown':
SVCD> /users/0/php-5.3.3/ext/standard/filestat.c:517: error: too many
SVCD> arguments to function `getpwnam_r'
SVCD> make: *** [ext/standard/filestat.lo] Error 1

SVCD> I have set my ORACLE_HOME, my PATH, and my LD_LIBRARY_PATH
SVCD> And used the following configure command:

SVCD> ./configure --prefix=/app/php533 --with-apxs2=/app/apache2215/bin/apxs
SVCD> --with-zlib --with-zlib-dir=/usr/lib
SVCD> --with-png-dir=/usr/include/libpng
SVCD> --with-openssl=/shared_ro/openssl_098
SVCD> --with-oci8=/shared_ro/users.oracle/11.1.0

SVCD> I am using gmake 3.80. Can anyone give me a hint as to what I am doing
SVCD> wrong in this build?

SVCD>   -Vicki Stanfield, RHCE, CISSP


From   the   error  message  it  would  seem  the  operating  system's
getpwnam_r() function is not POSIX compatible.
What system are you compiling on?

-- 
regards,
Tom


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



[PHP] xml/cap problems

2010-08-21 Thread Tom Shaw
I am trying to decode and encode nws compatible cap xml. An example 
is at the bottom of this post. simplexml_load_file works fine if 
"cap:" is removed before processing. However, if it is not 
simplexml_load_file does not parse the file at all and 
libxml_get_errors returns no errors.


Any and all help is appreciated.

Tom



NOAA-NWS-ALERTS National 
2010-08-21T13:26:34-04:00

w-nws.webmas...@noaa.gov
2010-08-21T13:26:34-04:00
Actual
Alert
Public

Current Watches, Warnings and Advisories for the United States Issued 
by the National Weather Service


http://www.weather.gov/alerts/us.html

Met
na
Unknown
Unknown
Unknown

Current Watches, Warnings and Advisories for Alaska Issued by the 
National Weather Service


http://www.weather.gov/alerts/us.html#ak




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



Re: [PHP] exec output to mySQL, How?

2010-07-21 Thread Tom Sparks
--- On Wed, 21/7/10, Nilesh Govindarajan  wrote:
> On Wed, Jul 21, 2010 at 8:49 AM, Tom
> Sparks 
> wrote:
> > How do I take the output from a command line program
> and update a MYSQL database with it?
> >
> > tom_a_sparks
> > Light travels faster then sound, which is why some
> people appear bright, until you hear them speak
> >
> 
> $cmdop=shell_exec('cmd');
> $con=new mysqli(...);
> // Check connection error
> // Refer to php.net/mysqli
> $con->multi_query($cmdop);
ok, thanks the program I am using reports a estimated time to completion, I 
understand I need a loop, but I cant work out how I would do this

run program
while program is running {
sleep 60 seconds
update mySQL with ET from program
}

tom


  

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



[PHP] exec output to mySQL, How?

2010-07-20 Thread Tom Sparks
How do I take the output from a command line program and update a MYSQL 
database with it?

tom_a_sparks
Light travels faster then sound, which is why some people appear bright, until 
you hear them speak




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



[PHP] integrating lib (C++) into php

2010-07-15 Thread Tom Sparks
I have found lib that looks like it dose what i need
How do I integrating this lib into php?
dose php support C++ libs?

http://libnoise.sourceforge.net/tutorials/tutorial1.html#gcc


tom_a_sparks
Light travels faster then sound, which is why some people appear bright, until 
you hear them speak




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



RE: [PHP] Beginner's question: How to run a PHP web application locally?

2010-04-08 Thread Tom Calpin
>> Hi List,

>> 

>> The other day, I read an article that mentioned about a tool that would

>> permit to simulate a web environment for PHP, so that testing could be
made

>> before uploading the page on the server. Unfortunately, I don't seem to
find

>> the article again.

>> 

>> So here am I with this question: What should I need to set my test

>> environment? I'm working on Windows, but I'm all ears for solution on
Linux

>> systems.

>> 

>> Best Regards,

>> Bastien

 

 

A couple of IDEs have web servers built in (NuSphere PhpED is the only one I
can remember at the moment) which can generally be used to preview your
applications offline, although you might struggle to get it running if it
requires a database connection, depending on your hosting config (my hosting
will only allow local connections to the DB). 

 

Alternatively, something like EasyPHP http://www.easyphp.org/ makes it very
easy to get a LAMP server set-up going on your machine, so you could drop
your app into the www folder and navigate to localhost on your web browser
to view it. Stick some dummy data in the db and you have a fully functional
version of your app running on your machine.



[PHP] XSLTProcessor issue

2010-03-21 Thread Tom
I have located what appears to me to be bug in the XSLTProcessor in
PHP5.2.13 but want to insure that I am not overlooking something before
reporting it. Any advice will be appreciated.

The issue is apparent discrepancies in output sort order in an XSLTProcessor
generated list. Following is a detailed description.

Scenario: Disk resident xml file with a top level "Places" element and a
list of subordinate "Place" elements. Each "Place" element has a "fullName"
attribute with self explanatory value. Place heirarchy is indicated by comma
separated fields in the attribute value, e.g. Accomac Co., Virginia, USA.
Also, a disk resident xsl file whose purpose is to transform the xml file
into a html file with the "Place" element collection sorted and rewritten as
a list of full place names. When the xsl translation is invoked by assigning
the xsl to the xml file and accessing the xml file in IE8, the displayed
output appears exactly as expected, e.g.

Accomack Co., VA, USA
Adams Co., PA, USA
Ahoskie Twp., Hertford Co., NC, USA
Ahoskie, Hertford Co., NC, USA
AK, USA
AL, USA
Alachua Co., FL, USA
Alamance Co., NC, USA
Alameda Co., CA, USA
Alameda, Alameda Co., CA, USA

However, when invoked via the following php script, using PHP5.2.13 -

$xml = new DOMDocument();
$xml->load("F:\Places.xml");
$xsl = new DOMDocument();
$xsl->load("F:\Places.xsl");
$xslt = new XSLTProcessor();
$xslt->importStylesheet($xsl);
echo $xslt1->transformToXML($xml);

some sort order discrepancies appear in the output, e.g.

AK, USA
AL, USA
Accomack Co., VA, USA
Adams Co., PA, USA
Ahoskie Twp., Hertford Co., NC, USA
Ahoskie, Hertford Co., NC, USA
Alachua Co., FL, USA
Alamance Co., NC, USA
Alameda Co., CA, USA
Alameda, Alameda Co., CA, USA

Note that the state records, which have upper case second character,
incorrectly appear ahead of other places. This behavior appears even if the
"case-order='lower-first'" attribute is included in the  element
in the xsl stylesheet.

Question: Is this a bug or am I overlooking something? 



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



Re: [PHP] Revision control?

2010-03-09 Thread Tom Sparks
--- On Wed, 10/3/10, James McLean  wrote:
> On Wed, Mar 10, 2010 at 11:14 AM, Tom
> Sparks 
> wrote:
> > --- On Wed, 10/3/10, Phpster 
> wrote:
> >
> >> I believe pear has some stuff for subversion.
> >
> > Don't want to use subversion or any third-party app
> 
> Why re-invent the wheel? Just use SVN, existing libraries
> out there,
> easy to use, easy to access and portable.

I just to be able to use a LAMPP setup
I think I may have found something like what I was looking for @ 
http://asvcs.com/

tom




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



Re: [PHP] Revision control?

2010-03-09 Thread Tom Sparks
--- On Wed, 10/3/10, Phpster  wrote:

> I believe pear has some stuff for
> subversion.

Don't want to use subversion or any third-party app

I forgot to say needs to support media files (images/sounds/etc) as well as 
text based files.
I don't care if it flat-file based or database based 

tom

> 
> Bastien
> 
> Sent from my iPod
> 
> On Mar 9, 2010, at 7:21 PM, Tom Sparks  
> 
> wrote:
> 
> > Is there a Revision control class that I can use in a
> php program?
> >
> > tom_a_sparks
> >
> >
> >
> >
> > --
> > 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] Revision control?

2010-03-09 Thread Tom Sparks
Is there a Revision control class that I can use in a php program?

tom_a_sparks




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



Re: [PHP] Do you use a public framework or roll your own?

2010-01-29 Thread Tom Sparks
--- On Fri, 29/1/10, Michael A. Peters  wrote:
> Michael A. Peters wrote:
> > Daevid Vincent wrote:
> >>  I'm not looking to start a holy war here or
> re-hash the tired debate. I just want some hard cold numbers
> to look at.
> >> 
> >> "Do you use a public framework or roll your own?"
> >> http://www.rapidpoll.net/8opnt1e
> >> 
> >> 
> >> And for those interested, here are the results of
> the last poll:
> >> 
> >> "To add the final ?> in PHP or not..."
> >> http://www.rapidpoll.net/show.aspx?id=arc1opy

I have looked at a few open source frameworks, I have found them too hard to 
hack/edit/modify or incapable of doing what I need
so it looks like I need write my own :(

ts



  
__
Yahoo!7: Catch-up on your favourite Channel 7 TV shows easily, legally, and for 
free at PLUS7. www.tv.yahoo.com.au/plus7

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



[PHP] RE: I have not seen any messages for a couple of days...

2009-12-10 Thread Tom Calpin
Yep, although Christmas shopping seems to be higher on the agenda than PHP

Wait till a week before Christmas and we'll have a slew of messages from
desperate developers trying to complete to a client deadline :)


-Original Message-
From: Jay Blanchard [mailto:jblanch...@pocket.com] 
Subject: I have not seen any messages for a couple of days...

...is this thing on?


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



Re: [PHP] What PHP version are you using?

2009-10-29 Thread Tom Barrett
2009/10/29 Israel Ekpo 

> Hi Guys,
>
> I just want to conduct a quick survey to find out what version of PHP
> people
> are using in their production environments.
>
> I have a PHP extension for Solr that I have set the minimum required
> version
> as 5.2.11.
>
[snip]

> I cannot go below 5.2.0 though but I am thinking about starting at 5.2.4
> and
> newer.
>
> I would really appreciate some feedback as it will be useful in helping me
> determine which PHP version numbers to do my regression tests against.
>

> cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.3 (Tikanga)

> php -v
PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

> yum list php
Loaded plugins: downloadonly, rhnplugin, security
Excluding Packages in global exclude list
Finished
Installed Packages
php.x86_64
5.1.6-23.2.el5_3
installed

I wouldn't have thought this to be too uncommon.

HTH


Re: [PHP] Re: Converting tables into forms

2009-10-29 Thread Tom Barrett
Apologies for semi-hijacking, but I am confused.

What are aiming to do that something like PHPMyAdmin doesn't do?

2009/10/28 ben...@gmail.com 

> Jay,
>
> What function do you have?  Thanks to everyone for their feedback.
>
> Best,
>
> Ben
>
> On Wed, Oct 28, 2009 at 9:17 AM, Jay Blanchard  >wrote:
>
> > [snip]If your solution requires you to create hundreds of forms, which
> > could
> > take months to code, you need to take another look at the problem. I
> > don't believe you have thought it through very well.[/snip]
> >
> > Actually you could use the function I provided to do this on the fly or
> > have the function write out a file for each table involved.
> >
>


[PHP] RE: Netbeans IDE 6.5

2009-10-28 Thread Tom Calpin
If you go Tools>Options> Keymap tab, you can click the 'Import' button at
the bottom. It just imports the zip file.
I'm new to Netbeans myself and decided to install this colour scheme,
however I can't get it to display correctly.


I'm also missing word wrap and a more simple one-click FTP upload interface,
so I'm still in half a mind as to whether I abandon NuSphere (which we sort
of grew up with) just yet.
Unless anyone out there knows any plugins that add the functionality to
Netbeans?



-Original Message-
From: Skip Evans [mailto:s...@bigskypenguin.com] 
Sent: 28 October 2009 00:50
To: php-general@lists.php.net
Subject: Netbeans IDE 6.5

Hey all,

I just downloaded the Netbeans 6.5 IDE to use as a code 
editor, installed the PHP plugin for syntax highlighting and 
it didn't look so good, so I find on the forum a guy who has 
made a collection of files, starting in a directory called 
config, that will apparently change the highlighting more in 
line to what I'm used to.

But he gave no instructions how this is to be installed and I 
can't find anywhere in the documentation how to install this 
stuff.

Any Netbeaners out there know how to install syntax 
highlighting stuff?

I found it here.

http://forums.netbeans.org/post-46850.html

Downloaded and unzipped the archive and then I stopped like 
the robot on Lost in Space when they pulled out his power pack.

Any help would be great!

Thanks,
Skip
-- 

Skip Evans
PenguinSites.com, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://penguinsites.com

Those of you who believe in
telekinesis, raise my hand.
  -- Kurt Vonnegut


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



Re: [PHP] (nginx) fcgi+PHP+memcache on RedHat: Class 'Memcache' not found...

2009-10-26 Thread Tom Barrett
2009/10/26 Eddie Drapkin :
> On Mon, Oct 26, 2009 at 11:59 AM, Tom Barrett  wrote:
>> 2009/10/26 Eddie Drapkin :
>>> On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett  wrote:
>>>> Hello
>>>>
>>>> I have installed:
>>>>  - libevent
>>>>  - libmemcached (http://tangent.org/552/libmemcached.html)
>>>>  - Done a PECL installation (pecl download memcached, phpize &&
>>>> ./configure && make)
>>>>  - memcached
>>>>
>>>>> cat /etc/php.d/memcached.ini
>>>> ; Memcached default settings
>>>> extension=memcache.so
>>>>
>>>>> ls -1  /usr/lib64/php/modules/memcache*
>>>> /usr/lib64/php/modules/memcached.so
>>>> /usr/lib64/php/modules/memcache.so
>>>>
>>>>> memcached -h
>>>> memcached 1.2.6
>>>> ...
>>>>
>>>>> php -v
>>>> PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
>>>> Copyright (c) 1997-2006 The PHP Group
>>>> Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
>>>>
>>>>
>>>> /var/www/php_fcgi_memcache> cat memcache.php
>>>> >>> $memcache = new Memcache;
>>>> print_r($memcache);
>>>> ?>
>>>>
>>>> /var/www/php_fcgi_memcache> php memcache.php
>>>> PHP Fatal error:  Class 'Memcache' not found in
>>>> /var/www/php_fcgi_memcache/memcache.php on line 2
>>>>
>>>> Memcached is working fine (being use by Perl quite happily).
>>>>
>>>> PHP/FCGI is working OK and phpinfo() shows:
>>>> memcached support enabled
>>>> Version 1.0.0
>>>> libmemcached version 0.34
>>>> Session support yes
>>>>
>>>> Any pointers in the right direction would so very much appreciated.
>>>>
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>>
>>> Try instantiating a Memcached instance, not a Memcache instance.
>>> They're two different PECL extensions!
>>
>> Hi
>>
>> That just auto-instantiates an empty object?
>>
>>> cat memcached.php
>> > $memcache = new Memcached;
>> print_r($memcache);
>> ?>
>>
>>> php memcached.php
>> Memcached Object
>> (
>> )
>>
>> I have used the $m=new Memcache; syntax on another server, which works fine.
>>
>> Or have I mixed up my libraries somehow?
>>
>
> They're actually two different classes from two different PECL
> extensions.  Memcached is the newer (imo better) extension written by
> Andrei (at digg) to use libmemcached.  Memcache is the older, entirely
> custom (no external deps) PECL extension that's been around forever.
> So, I'm guessing you have Memcache on one machine and Memcached on
> another.  They have slightly different APIs, so I'd make sure you're
> aware of which one you're using.  :)

Thanks

Any chance you could show me the way?

This is how I installed the PECL extension:

> pecl download memcached
> tar zxf memcached-1.0.0.tgz
> cd memcached-1.0.0
> phpize
> ./configure
> make
> make install

Does that look like the right one? Did I miss something?

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



Re: [PHP] (nginx) fcgi+PHP+memcache on RedHat: Class 'Memcache' not found...

2009-10-26 Thread Tom Barrett
2009/10/26 Eddie Drapkin :
> On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett  wrote:
>> Hello
>>
>> I have installed:
>>  - libevent
>>  - libmemcached (http://tangent.org/552/libmemcached.html)
>>  - Done a PECL installation (pecl download memcached, phpize &&
>> ./configure && make)
>>  - memcached
>>
>>> cat /etc/php.d/memcached.ini
>> ; Memcached default settings
>> extension=memcache.so
>>
>>> ls -1  /usr/lib64/php/modules/memcache*
>> /usr/lib64/php/modules/memcached.so
>> /usr/lib64/php/modules/memcache.so
>>
>>> memcached -h
>> memcached 1.2.6
>> ...
>>
>>> php -v
>> PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
>> Copyright (c) 1997-2006 The PHP Group
>> Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
>>
>>
>> /var/www/php_fcgi_memcache> cat memcache.php
>> > $memcache = new Memcache;
>> print_r($memcache);
>> ?>
>>
>> /var/www/php_fcgi_memcache> php memcache.php
>> PHP Fatal error:  Class 'Memcache' not found in
>> /var/www/php_fcgi_memcache/memcache.php on line 2
>>
>> Memcached is working fine (being use by Perl quite happily).
>>
>> PHP/FCGI is working OK and phpinfo() shows:
>> memcached support enabled
>> Version 1.0.0
>> libmemcached version 0.34
>> Session support yes
>>
>> Any pointers in the right direction would so very much appreciated.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> Try instantiating a Memcached instance, not a Memcache instance.
> They're two different PECL extensions!

Hi

That just auto-instantiates an empty object?

> cat memcached.php


> php memcached.php
Memcached Object
(
)

I have used the $m=new Memcache; syntax on another server, which works fine.

Or have I mixed up my libraries somehow?

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



[PHP] (nginx) fcgi+PHP+memcache on RedHat: Class 'Memcache' not found...

2009-10-26 Thread Tom Barrett
Hello

I have installed:
 - libevent
 - libmemcached (http://tangent.org/552/libmemcached.html)
 - Done a PECL installation (pecl download memcached, phpize &&
./configure && make)
 - memcached

> cat /etc/php.d/memcached.ini
; Memcached default settings
extension=memcache.so

> ls -1  /usr/lib64/php/modules/memcache*
/usr/lib64/php/modules/memcached.so
/usr/lib64/php/modules/memcache.so

> memcached -h
memcached 1.2.6
...

> php -v
PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies


/var/www/php_fcgi_memcache> cat memcache.php


/var/www/php_fcgi_memcache> php memcache.php
PHP Fatal error:  Class 'Memcache' not found in
/var/www/php_fcgi_memcache/memcache.php on line 2

Memcached is working fine (being use by Perl quite happily).

PHP/FCGI is working OK and phpinfo() shows:
memcached support enabled
Version 1.0.0
libmemcached version 0.34
Session support yes

Any pointers in the right direction would so very much appreciated.

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



Re: [PHP] PHP broadcast mailer

2009-10-20 Thread Tom Chubb
2009/10/18 Paul M Foster 

> On Sat, Oct 17, 2009 at 01:41:03AM -0400, Brian Hazelton wrote:
>
> > I am in charge of an email newsletter list and making sure it gets sent
> > out in time. My problem is I have never done broadcast emailing and
> > right now we have 400 subscribers but want to build a system that can
> > scale well regardless of the number of subscribers. Right now I use
> > mysql to store the email and use phpmailer in a loop to send an email to
> > each of the emails in the db, it is already slow with just 400(takes
> > around 10 min (i think that's slow isnt it?). Has anyone built a
> > broadcast email script and willing to help me?
> >
>
> Use PHPList. It's free.
>
> Paul
>
>
I second that and make sure you add an SPF Key to your domain:
http://old.openspf.org/wizard.html
You should be able to get the SMTP limits from your host and these can be
configured in PHPlist.
The bounce handling takes away a lot of admin work once your list starts
getting larger and people's email addresses change/stop working.

Tom


Re: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread Tom Worster
On 10/7/09 6:04 AM, "Ashley Sheridan"  wrote:

> On Wed, 2009-10-07 at 10:57 +0100, MEM wrote:
>> Hello all,
>> 
>> 
>> I'm having this strange behavior, and I do not understanding why...
>> 
>> When I use FILTER_VALIDATE_INT I'm unable to get, on my input box, values
>> starting with 0(zero), or values that are greater (in length) then 10
>> digits.
>> 
>> I was expecting to be able to input the all range of integers.
>> 
>> 
>> I've tried this:
>> 
>> if (!filter_var($telefone, FILTER_VALIDATE_INT))
>> {
>>$erros['telefone'] = 'Invalid Teléfono - Only Numbers Allowed.';
>> }
>> 
>> And this:
>> if (!filter_var($telefone, FILTER_VALIDATE_INT, array("options" =>
>> array("min_range"=>-1, "max_range"=>9
>> {
>>   $erros['telefone'] = 'Invalid Teléfono - Only Numbers Allowed.';
>> }
>> 
>> And this:
>> if (filter_var($telefone, FILTER_VALIDATE_INT, array("options" =>
>> array("min_range"=>0, "max_range"=>9))) == false )
>> {
>>   $erros['telefone'] = 'Invalid Teléfono - Only Numbers Allowed.';
>> }
>> 
>> No success. :s
>> 
>> What am I not getting?
>> 
>> 
>> Thanks,
>> Márcio
>> 
>> 
>> Ps- Anyone knows where can we grab a good source information about
>> FILTER_VALIDATE_INT specifically?
>> 
>> 
> 
> Well, at a guess, if a number is 0, PHP see's that as equivalent to a
> false. Also, numbers over 10 digits may be going over the limit for your
> PHP install, assuming PHP actually attempts to convert the string to a
> real integer for the purpose of the filter.

isn't a numeric string starting with 0 taken as octal? if so then 8 and 9
might cause validation errors.


> For things this simple, I've always tended to go with something like
> this:
> 
> if(!preg_match('^[0-9 \+]$', $telefone))
> {
>   $erros['telefone'] = 'Invalid Teléfono - Only Numbers Allowed.';
> }
> 
> Which will check for all common types of phone numbers, including those
> where the user has put spaces in to separate groups of digits, and those
> that contain the + for country codes.

right. phone numbers are not integers. people also often use parentheses,
hyphens or dots in them.



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



Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Tom Worster
just yesterday i was reading through this wonderful and very funny
presentation:

http://talks.php.net/show/froscon08/0

for me it really drove home the message (among others) that it makes sense
to find out where the real gains can be made before investing your efforts
in optimization.



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



Re: [PHP] Re: ternary operator sintax help

2009-10-06 Thread Tom Worster
just as ashley said it.


On 10/6/09 3:26 PM, "MEM"  wrote:

> Sorry all,
> It's ok. The sintax:
> 
>  class="mensagemErro">'.$erros['anexo'].'' :''); ?>
> 
> Was right all the time.
> 
> Anyway, I've learn something new: having a var with '' is not the same thing
> as not been unset. So we must pay attention on what cases we use isset, or
> !empty.
> 
> 
> Thanks a lot,
> Márcio
> 
>> -Original Message-
>> From: João Cândido de Souza Neto [mailto:j...@consultorweb.cnt.br]
>> Sent: terça-feira, 6 de Outubro de 2009 19:53
>> To: php-general@lists.php.net
>> Subject: [PHP] Re: ternary operator sintax help
>> 
>> > class="mensagemErro">'.$erros['anexo'].'' :''); ?>
>> 
>> ""MEM""  escreveu na mensagem
>> news:002401ca46b4$ed6ad6a0$c84083...@com...
>> Hello all,
>> 
>> I'm trying to display a div, only when some php value is set.
>> Since this will be near html, I'd like to keep it on one line. So, I'd
>> love
>> to use shortcuts and a ternary operator for the effect.
>> 
>> I'm having something like this right now, but the div still appears
>> even if
>> the error is NOT set.
>> 
>> '
>> .$erros['anexo'].'' :''; ?>
>> 
>> :(
>> 
>> Can I have your help with the right syntax ?
>> 
>> 
>> Regards,
>> The newbie on a Humpty Dumpty wall,
>> Márcio
>> 
>> 
>> 
>> --
>> 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



Re: [Fwd: [PHP] Sessions in databases]

2009-10-06 Thread Tom Worster
On 10/6/09 10:26 AM, "Il pinguino volante"  wrote:

> I have to realize an authentication system for a lot of users.
> 
> I heard that someone uses to store session states (?) into a database. I'd
> like to know how and, expecially, WHY to do it and what's would be better
> (considering that I CANNOT -d'oh!- edit the php.ini file).

i think you can modify the PHP session handler without touching php.ini:
http://www.php.net/manual/en/function.session-set-save-handler.php

i've read a lot on the web about this in recent weeks. different people
offer their own justifications for the various approaches to session
handling: PHP's file handler, user DB methods for the PHP session handler,
PHP's memcache handler, zend session clustering, or do it yourself and don't
use PHP sessions at all.

there's a lot of controversy on the topic because different people have
different requirements and preferences. so your question WHY? is quite
complex.

my motivation for considering user DB back-end to the PHP session handler
was that it would replicate the session data over the DB cluster. retaining
the PHP session front-end means less code rework and you keep its session
locking. but it adds DB load, and the DB is often an app's bottleneck.
whether or not that's ok depends on app specifics.

i looked at memcache but i have two problems with it. one is that it is a
cache system so it's not designed to be reliable: if it runs out of memory,
restarts or crashes, the sessions are gone. the other is that the PHP
session implementation is barely documented. i couldn't figure out how it
implements the clustering (does it?) so i couldn't see how i would implement
failover, recovery and maintenance procedures.
http://phpslacker.com/2009/03/02/php-session-clustering-with-memcache/

one class i saw used memcached combined with DB in case of cache miss. it
speeds up the reads but every write goes to both cache and DB.

one thing that obviously helps is don't write the session to the DB if it
hasn't changed. i'm not sure how best to do that yet. and you can optimize
the writing of the session timestamp to the DB too.

then there's the question of whether or not to use one DB connection for
both session handling and the main app or use two connections. the latter is
easier to code.

row locking in the session table would be preferable to table locking.

maybe we should work together on the code for all this?

there's a webinar on zend platform session clustering that discusses various
issues, bearing in mind it's a technical sales pitch. i don't think it's
entirely fair to the DB methods.



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



Re: [PHP] Time Problem: always ten past xx

2009-10-06 Thread Tom Worster
On 10/6/09 4:16 AM, "Mert Oztekin"  wrote:

> My mistake,
> 
> I thought it was date() now strftime()
> Sorry
> 
> (why do php developers create two different standarts for such similiar
> functions???☺ )
> 

it's traditional to do so. it reminds me of the bit about subtly
incompatible shells in unix from "Real Programmers Don't Use Pascal":

"Even Unix might not be as bad on Real Programmers as it once was. The
latest release of Unix has the potential of an operating system worthy of
any Real Programmer-- two different and subtly incompatible user interfaces,
an arcane and complicated teletype driver, virtual memory. If you ignore the
fact that it's "structured", even 'C' programming can be appreciated by the
Real Programmer: after all, there's no type checking, variable names are
seven (ten? eight?) characters long, and the added bonus of the Pointer data
type is thrown in-- like having the best parts of Fortran and assembly
language in one place. (Not to mention some of the more creative uses for
#define.)"

we could collect a list:

gnu make vs bsd make
how many subtly different versions of grep are there?


but i'm, sure it's been done already and i guess it's off topic.



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



Re: [PHP] Self-Process php forms or not?

2009-10-04 Thread Tom Worster
On 10/4/09 10:55 AM, "tedd"  wrote:

> At 3:39 PM +0100 10/4/09, MEM wrote:
>>> i don't think so. if the user requests the page "a_form.php" then the
>>>  server
>>>  will normally execute the a_form.php script regardless whether the form
>>>  was
>>>  submitted or not.
>>> 
>>>  to display a blank form, the user probably requests a_form.php with the
>>>  GET
>>>  method and probably without any GET parameters. the script will run but
>>>  $_POST['submit'] is not set. so the script you show above will echo
>>>  "Sorry,
>>>  couldn't process the form". that will likely confuse the user.
>>> 
>> 
>> 
>> Ok... but please have a look here, I've uploaded and tested that code, and I
>> can assure you that the message doesn't appear when the form first load:
>> 
>> http://pastebin.com/m21078fe3
>> Note: if you use: "copy to clipboard" option the numbers will gone.
>> 
>> 
>> 
>> Regards,
>> Márcio
> 
> The problem, as I see it, is that you are not
> willing to write a simple example and get that to
> work. Instead, you complicate things beyond your
> ability to understand.
> 
> My advice, step back -- write a simple example
> that does what you want and then expand it.

i agree that it does seem a bit as though Márcio is in such a hurry to make
something work that the tasks of learning and understanding the fundamentals
are being left aside. while that's maybe understandable, it's a bit
frustrating when we're trying to explain the fundamentals.



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



Re: [PHP] Self-Process php forms or not?

2009-10-04 Thread Tom Worster
On 10/4/09 10:39 AM, "MEM"  wrote:

>> i don't think so. if the user requests the page "a_form.php" then the
>> server
>> will normally execute the a_form.php script regardless whether the form
>> was
>> submitted or not.
>> 
>> to display a blank form, the user probably requests a_form.php with the
>> GET
>> method and probably without any GET parameters. the script will run but
>> $_POST['submit'] is not set. so the script you show above will echo
>> "Sorry,
>> couldn't process the form". that will likely confuse the user.
>> 
> 
> 
> Ok... but please have a look here, I've uploaded and tested that code, and I
> can assure you that the message doesn't appear when the form first load:
> 
> http://pastebin.com/m21078fe3
> Note: if you use: "copy to clipboard" option the numbers will gone.

this has a different structure from what you showed us in your email earlier
today (Sunday, October 4, 2009 9:25 AM). this script has the structure:



as i said before, a script will execute regardless. but this new script
fragment does nothing except initialize $erros if $_POST['submit'] is not
set (e.g. if the user requests the page without POSTing the form). i don't
see a problem. this script also has the three cases i described clearly
separated.

now, what was your question?



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



Re: [PHP] class to generate Javascript Object ??

2009-10-04 Thread Tom Worster
On 10/4/09 9:39 AM, "Michael A. Peters"  wrote:

> I wrote a php class to generate flowplayer/html5 media code for my site:
> 
> http://www.shastaherps.org/xml_MMmediaClass.phps
> 
> The "buildFlashvars()" function in it is really ugly and will be a pain
> to update as I modify the class in the future.
> 
> What it does is generate a JavaScript object string, as described here:
> 
> http://flowplayer.org/tools/flashembed.html
> 
> I'm thinking (hoping) there is already a php class somewhere for
> generating JavaScript object strings that I can instead of my ugly
> easily breakable way of doing it.
> 
> Anyone know of one?

would json_encode() work for you... ?

http://www.php.net/manual/en/function.json-encode.php



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



Re: [PHP] Self-Process php forms or not?

2009-10-04 Thread Tom Worster
On 10/4/09 9:25 AM, "MEM"  wrote:

> Thanks a lot. To all.
> For the moment, I'm with the redirect solution that others have pointed.
> 
> But after seen tedd example and watch Manuel videos, I'm starting to
> understand how the hidden field solution work as well. Well... I'm
> *starting* to understand I've not fully understand it yet, despite all your
> great examples. 
> 
> Because the structure of the code with hidden fields, seems quite different
> from the structure I have right now and I'm unable to make the switch.
> 
> Here is the actual structure:
> 
> if (isset($_POST['submit']))
> {
> 
>   //declare variables
>   $var = $_POST['var']; etc...
> 
>   //validate
> 
>   //process the form
>   (send e-mail or save to database etc...)
> 
>   //redirect to success page.
> } 
> else 
> {
> Echo "Sorry, couldn't process the form";
> }
> 
> 
> 
> I suppose that the echo message telling "we couldn't process the form" does
> not appear when the form first loads, because the server side script is not
> requested on load, it is requested when the form submits to the php code
> presented on that same page (self). Tom Worster, is this precise?

i don't think so. if the user requests the page "a_form.php" then the server
will normally execute the a_form.php script regardless whether the form was
submitted or not. 

to display a blank form, the user probably requests a_form.php with the GET
method and probably without any GET parameters. the script will run but
$_POST['submit'] is not set. so the script you show above will echo "Sorry,
couldn't process the form". that will likely confuse the user.

in your structure you branch only two ways. i think you need three ways:

1 - the user simply arrived at the form. there is no POST data. the form was
not submitted.

2 - there is POST data. the form was submitted.

  2a - the POST data is unacceptable.

  2b - the POST data is good.


in branches 1 and 2a you send the form.

in 2b, you send some other page or a redirect.

in 1 you send the form blank.

in 2a you might fill some form elements with data from POST and add some
annotations to the form so the user knows what she or he did wrong.

> In the future, I will print tedd example, and Manuel scheme, and try to
> change the code above to accommodate hidden fields, because I still prefer
> having only one file.

one can learn a lot reading other people's code. 



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



Re: [PHP] A really wacky design decision

2009-10-04 Thread Tom Worster
On 10/4/09 6:36 AM, "clanc...@cybec.com.au"  wrote:

>> i might think it ok for (2260 == '226E1') to be true since php would be
>> doing type juggling in a logical left-to-right manner: we start with an
>> integer 2260, next is the juggling comparison operator, then a string, so it
>> might reasonably try to convert the string to an integer and then compare.
>> 
>> but with ('2260' == '226E1'), where both lhs and rhs are already of the same
>> time, it seems elliptical, to say the least, that php should search the
>> types to which it can convert the strings looking for one in which they are
>> equal.
> 
> The order doesn't matter; 2260 == 226e1, and 226e1==2260.

in those two cases, all four operands are integer literals. no juggling is
involved.

and i would have expected the same for ('2260' == '226e1') and ('226e1' ==
'2260') since all operands are string literals and i'd be wrong. (evidently
i'm not alone in making this mistake.)

i get confused reading the manual:

  http://www.php.net/manual/en/language.types.type-juggling.php

says that the context determines if the expression is converted. the example
being the + operator. by definition, it's operands are numeric contexts so
strings are converted. fair enough.

now what about the == operator?

  http://www.php.net/manual/en/language.operators.comparison.php

that page contradicts the previous one because it says that, when an operand
is a string, the determination to convert an operand depends not on the
context but on the specific data _of_ the operand.

i think robert captured the essence of this confusion nicely with:

> 
> On 10/3/09 1:53 PM, "Robert Cummings"  wrote:
> 
>> Numeric strings are special :)
>>



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



Re: [PHP] A really wacky design decision

2009-10-03 Thread Tom Worster
On 10/3/09 12:25 PM, "Ashley Sheridan"  wrote:

> On Sat, 2009-10-03 at 11:57 -0400, Tom Worster wrote:
> 
>> On 10/3/09 7:21 AM, "clanc...@cybec.com.au"  wrote:
>> 
>>> However there is one feature of PHP which, to my mind, is really bad design.
>>> How many of
>>> you can see anything wrong with the following procedure to search a list of
>>> names for a
>>> particular name?
>>> 
>>> $i = 0; $j = count ($names); while ($i < $j)
>>> { if ($names[$i] == $target) { break; }
>>> ++$i;
>>> }
>>> 
>>> As long as the names are conventional names, this procedure is probably safe
>>> to use.
>>> However if you allow the names to be general alphanumeric strings, it is not
>>> reliable. One
>>> of my programs recently broke down in one particular case, and when I
>>> eventually isolated
>>> the bug I discovered that it was matching '2260' to '226E1'. (The logic of
>>> this is: 226E1
>>> = 226*10^1 = 2260).
>>> 
>>> I agree that I was well aware of this trap, and that I should not have used
>>> a
>>> simple
>>> comparison, but it seems to me to be a bizarre design decision to assume
>>> that
>>> anything
>>> which can be converted to an integer, using any of the available notations,
>>> is
>>> in fact an
>>> integer, rather than making the default to simply treat it as a string.
>> 
>> this is odd.
>> 
>> i might think it ok for (2260 == '226E1') to be true since php would be
>> doing type juggling in a logical left-to-right manner: we start with an
>> integer 2260, next is the juggling comparison operator, then a string, so it
>> might reasonably try to convert the string to an integer and then compare.
>> 
>> but with ('2260' == '226E1'), where both lhs and rhs are already of the same
>> time, it seems elliptical, to say the least, that php should search the
>> types to which it can convert the strings looking for one in which they are
>> equal.
>> 
> 
> I don't know what you mean by elliptical, but I'd expect and certainly
> hope that PHP wouldn't try to convert both strings to something which
> would mean they had the same value. Also, afaik, if the variables types
> are exactly the same, PHP won't try to convert either of them for a
> comparison

i once had such hope too.

$ php -r "var_dump('2260' == '226E1');"
bool(true)


elliptical: tending to be ambiguous, cryptic, or obscure: an elliptical
prose that is difficult to translate.
(http://dictionary.reference.com/browse/elliptical)



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



Re: [PHP] A really wacky design decision

2009-10-03 Thread Tom Worster
On 10/3/09 7:21 AM, "clanc...@cybec.com.au"  wrote:

> However there is one feature of PHP which, to my mind, is really bad design.
> How many of
> you can see anything wrong with the following procedure to search a list of
> names for a
> particular name?
> 
> $i = 0; $j = count ($names); while ($i < $j)
> { if ($names[$i] == $target) { break; }
> ++$i;
> }
> 
> As long as the names are conventional names, this procedure is probably safe
> to use.
> However if you allow the names to be general alphanumeric strings, it is not
> reliable. One
> of my programs recently broke down in one particular case, and when I
> eventually isolated
> the bug I discovered that it was matching '2260' to '226E1'. (The logic of
> this is: 226E1
> = 226*10^1 = 2260).
> 
> I agree that I was well aware of this trap, and that I should not have used a
> simple
> comparison, but it seems to me to be a bizarre design decision to assume that
> anything
> which can be converted to an integer, using any of the available notations, is
> in fact an
> integer, rather than making the default to simply treat it as a string.

this is odd.

i might think it ok for (2260 == '226E1') to be true since php would be
doing type juggling in a logical left-to-right manner: we start with an
integer 2260, next is the juggling comparison operator, then a string, so it
might reasonably try to convert the string to an integer and then compare.

but with ('2260' == '226E1'), where both lhs and rhs are already of the same
time, it seems elliptical, to say the least, that php should search the
types to which it can convert the strings looking for one in which they are
equal.



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



Re: [PHP] Re: A really wacky design decision

2009-10-03 Thread Tom Worster
On 10/3/09 9:53 AM, "Ralph Deffke"  wrote:

> this is a clear sign that somebody is on a sin TRAIL, I would not even spend
> the time on  what sin collections this guy got

i see it more as ignorance than sin.

to misunderstand the difference between $n++ and ++$n is a beginner error.

as k&r made very clear with their sequences of lessons in the original book,
without actually saying so, becoming "an experienced programming" is like
becoming a zen master. it is a progression to sophistication, the exemplars
of which can be found here:

http://www1.us.ioccc.org/years-spoiler.html

i particularly recommend herrmann2 from 2001. masterful and dumbfounding.
read the .hint file.




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



Re: [PHP] Self-Process php forms or not?

2009-10-03 Thread Tom Worster
On 10/2/09 10:06 AM, "MEM"  wrote:

> I'm now understanding that even if the form is submitted to self, we can
> still use a redirect to a "success_message_page.php". However, we must do
> this redirect, AFTER the form has submitted to himself. It's the only thing
> that we have to pay attention here, correct?
> 
> Since we are not dealing with a confirmation page, or a multi-step form, the
> hidden field isn't necessary.
> 
> It's this correct assumptions?

the server script that runs in response to an http request for uri X can
determine if "conditions of success" are met only after the server receives
the request for X. so, if i understand your question, yes.

i think your terminology is confusing you, e.g.: "AFTER the form has
submitted to himself". a form doesn't submit to itself. a form and a script
that processes it are SEPARATE THINGS.

it's better to think in terms of a user agent and a server communicating
with http requests and responses. the UA sends http requests for uris X, Y,
Z, etc. (with or without accompanying form data). the forms are part of html
pages the server sends to the UA in http responses. a user drives the UA.
PHP scripts are involved in the server's generation of responses. (a diagram
might help.)

now to your queston:

if a UA has an html page that it got in a response for uri X; and if the
page has a form; and if the form has no action attribute (or action=X); and
if the user submits the form; then the UA will send the server an http
request for X.

next the server receives the request for X and the server runs a certain
script, the php script you are coding.

now i'm assuming these are your requirements: if that script determines
failure, the user says at X and is asked to resubmit the form. if the script
determines success, the user will wind up at a new uri: Y. further, you want
to send the user over to Y by sending her UA an http response with
Location=Y redirection.

in these terms, the answer to your question should be pretty clear. your
script has to receive and process requests for X before it can decide if
it's going to respond to the UA with a Location=Y redirection or an html
page with a form and an error message.



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



Re: [PHP] Self-Process php forms or not?

2009-10-03 Thread Tom Worster
On 10/2/09 10:24 AM, "tedd"  wrote:

> At 1:55 PM +0530 10/2/09, kranthi wrote:
>> and yes i forgot to mention... i avoid hidden form elements because
>> they can be modified very easily and hence pose a security threat.
> 
> That depends upon how sloppy you are in coding.
> 
> NONE of my hidden variables pose any security problems whatsoever.

...because one always assumes that data supplied in an http request is
tainted. hence arguments about which exploit is more likely is rather
pointless. 

a hidden input is really no different from any other form field. kranthi's
argument would be consistent if he felt that all form inputs should be
avoided because they are so easily modified as to pose a security threat.



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



Re: [PHP] Self-Process php forms or not?

2009-10-01 Thread Tom Worster
On 10/1/09 10:13 AM, "tedd"  wrote:

> At 1:00 PM +0100 10/1/09, MEM wrote:
>> One last question about this:
>> 
>> I've done a self submit form, after hearing all the advantages expressed
>> here.
>> But how could we relate, without using javascript, a self submit form with a
>> "success page" or a "confirmation page" that doesn't show the form?
>> 
>> Can please someone throw me some infos about this please?
> 
> 
> MEM:
> 
> Here's what I do -- it's pretty simple.
> 
> I use a hidden input variable I call "step" and monitor it as the
> user clicks whatever form submit they are on -- it works like so:
> 
> $step = isset($_POST['step']) ? $_POST['step'] : 0;
> 
> switch ($step)
> {
>case 0: // present the first form to the user
>// collect data
>// you can enhance the user experience by using javascript here.
>// 
> break;
> 
>case 1: // present second form to the user
>// clean data
>// if data OK then record data in db 
>// if data not OK then send user back 
> break;
> 
>case 2: //present the third form to the user
>// success, or confirmation, or thank you page
> break;
> }
> 
> Now, to make things easier for the user, be sure to set session
> variables for all the data collected in the first form so that IF you
> send the user back to the first form, the user doesn't have to
> reenter everything.

i do pretty much the same thing. each form in my html template files has a
form name tucked away in a hidden input element. the only difference from
your method is that the names are unique across the application.



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



Re: [PHP] Self-Process php forms or not?

2009-10-01 Thread Tom Worster
On 10/1/09 8:00 AM, "MEM"  wrote:

> One last question about this:
> 
> I've done a self submit form, after hearing all the advantages expressed
> here. 
> But how could we relate, without using javascript, a self submit form with a
> "success page" or a "confirmation page" that doesn't show the form?
> 
> Can please someone throw me some infos about this please?

i use one php script that knows how to deliver more than one html page
depending on the outcome of processing of form input and the rest.

i'm sure there are other ways.



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



Re: [PHP] intl extension on os x

2009-09-29 Thread Tom Worster
On 9/28/09 1:40 PM, "Tom Worster"  wrote:

> anyway, in the cli the command collator_create( 'en_US' ); did not provoke
> an error, so maybe that works.
> 
> but if i add extension=intl.so to php.ini and restart apache, php says: PHP
> Warning:  PHP Startup: Unable to load dynamic library
> '/usr/lib/php/extensions/no-debug-non-zts-20060613/intl.so'
> 
> so we're not done yet. if i get it done, maybe i'll blog my recipe.

i should have remembered this. the default config of apache22 on os x is a
64 bit binary. so if php is using apxs then php is also 64 bit. so loadable
modules need to be compiled for 64 bit.

i think the recipe below easily generalizes to other pecl extensions:

cd extname
phpize
MACOSX_DEPLOYMENT_TARGET=10.5 \
CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp" \
CCFLAGS="-arch x86_64 -g -Os -pipe" \
CXXFLAGS="-arch x86_64 -g -Os -pipe" \
LDFLAGS="-arch x86_64 -bind_at_load" \
./configure --with-icu-dir=/sw
make
make install

the --with-icu-dir=/sw flag is because i used fink libicu36-dev to install
icu headers and it puts them under /sw. see:
http://pdb.finkproject.org/pdb/package.php/libicu36-dev

i haven't done much with it yet but the example here worked for me:
http://www.php.net/manual/en/collator.sort.php

i'm still unsure how to check the version of the ICU headers fink installed
vs the version of the ICU library that comes unsupported with os x.



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



Re: [PHP] intl extension on os x

2009-09-28 Thread Tom Worster
On 9/28/09 2:41 AM, "Tommy Pham"  wrote:

> - Original Message ----
>> From: Tom Worster 
>> To: PHP General List 
>> Sent: Sunday, September 27, 2009 5:34:45 PM
>> Subject: [PHP] intl extension on os x
>> 
>> does anyone know how to install intl on os x 10.5?
>> 
>> it seems a libicu binary is included in os x but not with headers. fink has
>> a package for installing the headers. maybe that would allow pecl to install
>> the intl extension.
>> 
>> has anyone done this successfully? or know any other way to get intl running
>> on 10.5?
>> 
>> 
>> 
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> When Apple made the big change of OS a few years back, they switch to *BSD
> based OS, with the GUI from NeXT, which Apple bought. You should be able to
> compile most linux/unix codes on Mac though.  Have you looked at Apple's
> developer's resources/documentation?

yes indeed. often you can successfully compile and install on os x things
that run on freebsd or linux. but port configuration is often substantially
different and not entirely handled by autoconf. (even compiling php requires
some tricks.) in these cases i refer to google because people smarter than
me (one assumes, everything you read on the internet being true, of course)
often blog their recipe if the find one. but i found nothing for this
problem. that's why i asked here.

at this stage, i installed the fink package libicu36-dev-3.6.0-5, supposedly
libicu headers and it seems to have done something, i'm not entirely sure
exactly what. and i'm not convinced that the headers are for the same libicu
version that's in /usr/lib.

but somehow, though i'm not clear how one configures pecl source, i managed
to get pecl to compile and install the extension.

anyway, in the cli the command collator_create( 'en_US' ); did not provoke
an error, so maybe that works.

but if i add extension=intl.so to php.ini and restart apache, php says: PHP
Warning:  PHP Startup: Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20060613/intl.so'

so we're not done yet. if i get it done, maybe i'll blog my recipe.

freebsd, otoh, has a port for pecl-intl so it was trivial to install. 



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



Re: [PHP] Text similarity

2009-09-28 Thread Tom Worster
On 9/28/09 7:07 AM, "Merlin Morgenstern"  wrote:

> 
> 
> Ashley Sheridan wrote:
>> On Mon, 2009-09-28 at 12:27 +0200, Merlin Morgenstern wrote:
>>> Hi there,
>>> 
>>> I am trying to find out similarity between 2 strings. Somehow the
>>> similar_text function returns 33% similarity on strings that are not
>>> even close and on the other hand it returns 21% on strings that have a
>>> matching word.
>>> 
>>> E.G:
>>> 
>>> 'gemütliche sofas'
>>> 
>>> Wohngemeinschaften - similarity: 33.
>>> Sofas & Sessel - similarity: 31.25
>>> 
>>> I am using this code:
>>> similar_text($data[txt], $categories[$i], $similarity);
>>> 
>>> Does anybody have an idea why it gives back 33% similarity on the first
>>> string?
>>> 
>>> Thank you for any help,
>>> 
>>> Merlin
>>> 
>> 
>> If you think about it, it makes sense.
>> 
>> Taking your three sentences above, 'Wohngemeinschaften' has more
>> characters similar towards the start of the string (you only have to go
>> 4 characters in to start a match) whereas 'sofas' won't match the source
>> string until the 12th string in. Also, both test strings have the same
>> number of characters that match in order, although the ones that match
>> in 'Wohngemeinschaften' are separated by characters that do not match,
>> so I'm not sure what bearing this will have.
>> 
>> As noted on the manual page for this function, the similar_text()
>> function compares without regard to string length, and tends to only
>> really be accurate enough for larger excerpts of text.
>> 
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>> 
>> 
>> 
> 
> Sounds logical. Is there another function you suggest? I guess this is a
> standard problem I am having here. I tried it with levenstein, but
> similar results.
> 
> e.g levenstein (smaller = better):
> Search for : Stellplatz fÃ1Ž4r Wohnwagen gesucht
> Stereoanlagen : 23
> Wohnwagen, -mobile : 24
> Sonstiges fÃ1Ž4r Baby & Kind - : 25
> Steuer & Finanzen - :25
> 
> How come stereoanlagen and the others shows up here?
> 
> Any idea how I could make this more accurate?
> 
> Thank you for any help, Merlin

as ashley pointed out, it's not a trivial problem.

if you are performing the tests against strings in a db table then a full
text index might help. see, e.g.:
http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html

you could also check out the php sphinx client
http://us3.php.net/manual/en/book.sphinx.php

if you are writing your own solutions and using utf8, take care with
similar_text() or levenshtein(). i don't think they are designed for
multibyte strings. so if you are using utf8 they will probably report bigger
differences that you might expect. i wrote my own limited
damerau-levenshtein function for utf8.

even if you're using a single byte encoding, i would guess they ignore a
locale's collation. so say you set a german locale, ü will be regarded as
different from both u and ue. again, if you are searching against against
strings in a db table, the dbms may understand collations properly.



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



[PHP] intl extension on os x

2009-09-27 Thread Tom Worster
does anyone know how to install intl on os x 10.5?

it seems a libicu binary is included in os x but not with headers. fink has
a package for installing the headers. maybe that would allow pecl to install
the intl extension.

has anyone done this successfully? or know any other way to get intl running
on 10.5?



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



Re: [PHP] catch an iconv E_NOTICE

2009-09-24 Thread Tom Worster
On 9/24/09 10:30 AM, "David Otton"  wrote:

> 2009/9/24 Tom Worster :
> 
>> but i'd like proceed with default error handling in the branch with the
>> question marks. how can i do that?
> 
> An error handler that passes through to the previous error handler:
> 
>  error_reporting(E_ALL);
> 
> function my_error_handler($errno, $errstr, $errfile, $errline) {
> restore_error_handler();
> trigger_error($errstr, $errno);
> }
> 
> set_error_handler('my_error_handler', E_ALL);
> 
> trigger_error('TEST', E_USER_ERROR);
> 
> You'll lose the file and line, though, because you're actually raising
> another error with the same message at a new point in the code.

and i'd need to set my error handler back again to catch the next iconv
error:

function my_err_handler($errno, $errstr, $errfile, $errline) {
if ( preg_match('/iconv/', $errstr) ) {
throw new Exception('iconv error');
} else {
restore_error_handler();
trigger_error($errstr, $errno);
set_error_handler('my_error_handler', E_ALL);
}
}
set_error_handler('my_error_handler', E_ALL);

not lovely. as it stands, my own code writes the error message to the log
file in that place. i'm not sure this is an improvement.



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



[PHP] catch an iconv E_NOTICE

2009-09-24 Thread Tom Worster
i have this hack that works up to a point...

function my_err_handler($errno, $errstr, $errfile, $errline) {
if ( preg_match('/iconv/', $errstr) ) {
throw new Exception('iconv error');
} else {
// ? how to invoke default error handler ?
}
}
set_error_handler("my_err_handler", E_NOTICE);

try {
$s = iconv($enc1, $enc2, $s);
} catch (Exception $e) {
// deal with the failed conversion
}

but i'd like proceed with default error handling in the branch with the
question marks. how can i do that?



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



Re: [PHP] Re: session.gc_maxlifetime

2009-09-24 Thread Tom Worster
it could be ip address changes. interesting thought.

i think i should add some special logging.

it's a dedicated freebsd server with one app.


On 9/23/09 6:43 PM, "Ralph Deffke"  wrote:

> finaly we went with a custom cooky handling, however the customers
> requirements where two days.
> 
> if u are shure that the server is still the same hardware like it has been 6
> years ago then it might be some client stuff, however if there are other
> applications, pages running (virtual servers) then it would still be to
> consider. mamory and resource management is deep os. again I wouldn't trust
> for that amount of session livetime.
> 
> I dont think, putting it down to three hours would help much.
> 
> and of course, it could be client side also. Can't you figure out the
> clients?
> and keep in mind that a lot of people connect to UMTS rigzt now, these
> systems deconnect on idle lines and reconect without the users even know it.
> Also a lot of lines change IP address at midnihgt.
> 
> cheers
> ralph_def...@yahoo.de
> 
> "Tom Worster"  wrote in message
> news:c6e00521.12d98%...@thefsb.org...
>> there's a need for long timeouts in this app but could perhaps be reduced
>> from 6 to 3 hours.
>> 
>> the sessions are cookie based using php's 'file' handler and
>> session.cookie_lifetime=0. the server appears to have plenty of free
> memory
>> and appears not to have swapped in nearly a year of uptime. load averages
>> indicate a pretty quiet server. there are currently 170 kbyte total in 90
>> serialized session files which is typical and not a memory load. the
>> distribution of modification times doesn't indicate heavy activity: ~20
>> files in the last 15 minutes and 35 in the last hour.
>> 
>> so i think the os can handle this. plus the app ran for 6 years before
>> anyone reported being prematurely logged off. i'm looking for other
>> possibilities: odd browser behavior, network trouble, ...
>> 
>> 
>> are there any browsers that have configurable cookie handling policy such
>> that they time out a cookie?
>> 
>> one web site i use displays this curious message: "For your protection,
>> sessions are open for a limited period of time on our website. Please
>> sign-on again. NOTE: Your browser may also limit secure connection time,
> and
>> automatically log you out independent of our timeout procedure."
>> 
>> that could be referring to browsers timing out an ssl connection. or
> perhaps
>> the cookie?
>> 
>> 
>> btw: when you said in your email you wouldn't trust a long gc_maxlifetime,
>> and you would only use a cookie-based solution for long session. did you
>> mean that you wouldn't trust php's cookie-based session handler? and you
>> would use a custom handler instead?
>> 
>> 
>> On 9/22/09 4:46 PM, "Ralph Deffke"  wrote:
>> 
>>> Hi Tom,
>>> 
>>> in sometimes 2001 I did have incidences with those things, and as I
> remember
>>> over the past years there where some trouble with operating systems and
>>> stuff. This part is very deep inside the os. I would expect that this is
>>> still to consider. I also would check, if this occurs on very busy/low
>>> memory server.
>>> 
>>> If I would programm the garbage collection clean up part, and if the
> server
>>> is about to run out of memory, I would kill sessions being longer time
> idle
>>> even when they are not yet as old as it is set in the gc_maxlifetime.
> This
>>> would be far better then shutting down the whole server just because
> there a
>>> 100 of idle sessions waiting to get used again.
>>> 
>>> as u mention a maxlivetime of 6h I would bet, that this is the problem.
> I
>>> would not trust such a long lifetime at all.
>>> 
>>> If sessions have to be active such a long time, I would see only cooky
> based
>>> solutions
>>> 
>>> let me know, what u did investigate on this.
>>> 
>>> ralph_def...@yahoo.de
>>> 
>>> 
>>> "Tom Worster"  wrote in message
>>> news:c6deae55.12cae%...@thefsb.org...
>>>> thank you, Ralph!
>>>> 
>>>> i'm going to be bold and assume that tom at punkave dot com is right
>>> despite
>>>> that the report was discarded.
>>>> 
>>>> i got a complaint from a client about some users reporting being logged
>>> out
>>>> with rather short periods of inactivity. but session

Re: [PHP] Re: session.gc_maxlifetime

2009-09-23 Thread Tom Worster
there's a need for long timeouts in this app but could perhaps be reduced
from 6 to 3 hours.

the sessions are cookie based using php's 'file' handler and
session.cookie_lifetime=0. the server appears to have plenty of free memory
and appears not to have swapped in nearly a year of uptime. load averages
indicate a pretty quiet server. there are currently 170 kbyte total in 90
serialized session files which is typical and not a memory load. the
distribution of modification times doesn't indicate heavy activity: ~20
files in the last 15 minutes and 35 in the last hour.

so i think the os can handle this. plus the app ran for 6 years before
anyone reported being prematurely logged off. i'm looking for other
possibilities: odd browser behavior, network trouble, ...


are there any browsers that have configurable cookie handling policy such
that they time out a cookie?

one web site i use displays this curious message: "For your protection,
sessions are open for a limited period of time on our website. Please
sign-on again. NOTE: Your browser may also limit secure connection time, and
automatically log you out independent of our timeout procedure."

that could be referring to browsers timing out an ssl connection. or perhaps
the cookie?


btw: when you said in your email you wouldn't trust a long gc_maxlifetime,
and you would only use a cookie-based solution for long session. did you
mean that you wouldn't trust php's cookie-based session handler? and you
would use a custom handler instead?


On 9/22/09 4:46 PM, "Ralph Deffke"  wrote:

> Hi Tom,
> 
> in sometimes 2001 I did have incidences with those things, and as I remember
> over the past years there where some trouble with operating systems and
> stuff. This part is very deep inside the os. I would expect that this is
> still to consider. I also would check, if this occurs on very busy/low
> memory server.
> 
> If I would programm the garbage collection clean up part, and if the server
> is about to run out of memory, I would kill sessions being longer time idle
> even when they are not yet as old as it is set in the gc_maxlifetime. This
> would be far better then shutting down the whole server just because there a
> 100 of idle sessions waiting to get used again.
> 
> as u mention a maxlivetime of 6h I would bet, that this is the problem. I
> would not trust such a long lifetime at all.
> 
> If sessions have to be active such a long time, I would see only cooky based
> solutions
> 
> let me know, what u did investigate on this.
> 
> ralph_def...@yahoo.de
> 
> 
> "Tom Worster"  wrote in message
> news:c6deae55.12cae%...@thefsb.org...
>> thank you, Ralph!
>> 
>> i'm going to be bold and assume that tom at punkave dot com is right
> despite
>> that the report was discarded.
>> 
>> i got a complaint from a client about some users reporting being logged
> out
>> with rather short periods of inactivity. but session.gc_maxlifetime is set
>> to 6 hours so i don't think that's the source of the problem.
>> 
>> 
>> On 9/22/09 4:17 PM, "Ralph Deffke"  wrote:
>> 
>>> Hi Tom,
>>> 
>>> i did find this in the bug reports, its pretty new and should be an
> answer.
>>> 
>>> http://news.php.net/php.doc.bugs/2653
>>> 
>>> ralph_def...@yahoo.de
>>> 
>>> 
>>> "Tom Worster"  wrote in message
>>> news:c6de9eee.12c8d%...@thefsb.org...
>>>> i'm not 100% sure what the manual means when it says...
>>>> 
>>>> session.gc_maxlifetime integer
>>>> session.gc_maxlifetime specifies the number of seconds after which data
>>> will
>>>> be seen as 'garbage' and cleaned up. Garbage collection occurs during
>>>> session start.
>>>> 
>>>> what event exactly does the "after which" here refer to?
>>>> 
>>>> i'd like to think that it means that a session is eligible for gc no
>>> sooner
>>>> than session.gc_maxlifetime seconds after the most recent access (read
> or
>>>> write) to that session. but it seems dangerously presumptuous to assume
>>> that
>>>> this is the case.
>>>> 
>>>> what do you take it to mean?
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 



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



Re: [PHP] Re: session.gc_maxlifetime

2009-09-22 Thread Tom Worster
thank you, Ralph!

i'm going to be bold and assume that tom at punkave dot com is right despite
that the report was discarded.

i got a complaint from a client about some users reporting being logged out
with rather short periods of inactivity. but session.gc_maxlifetime is set
to 6 hours so i don't think that's the source of the problem.


On 9/22/09 4:17 PM, "Ralph Deffke"  wrote:

> Hi Tom,
> 
> i did find this in the bug reports, its pretty new and should be an answer.
> 
> http://news.php.net/php.doc.bugs/2653
> 
> ralph_def...@yahoo.de
> 
> 
> "Tom Worster"  wrote in message
> news:c6de9eee.12c8d%...@thefsb.org...
>> i'm not 100% sure what the manual means when it says...
>> 
>> session.gc_maxlifetime integer
>> session.gc_maxlifetime specifies the number of seconds after which data
> will
>> be seen as 'garbage' and cleaned up. Garbage collection occurs during
>> session start.
>> 
>> what event exactly does the "after which" here refer to?
>> 
>> i'd like to think that it means that a session is eligible for gc no
> sooner
>> than session.gc_maxlifetime seconds after the most recent access (read or
>> write) to that session. but it seems dangerously presumptuous to assume
> that
>> this is the case.
>> 
>> what do you take it to mean?
>> 
>> 
> 
> 



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



[PHP] session.gc_maxlifetime

2009-09-22 Thread Tom Worster
i'm not 100% sure what the manual means when it says...

session.gc_maxlifetime integer
session.gc_maxlifetime specifies the number of seconds after which data will
be seen as 'garbage' and cleaned up. Garbage collection occurs during
session start.

what event exactly does the "after which" here refer to?

i'd like to think that it means that a session is eligible for gc no sooner
than session.gc_maxlifetime seconds after the most recent access (read or
write) to that session. but it seems dangerously presumptuous to assume that
this is the case.

what do you take it to mean?



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



Re: [PHP] moving to quad core

2009-09-15 Thread Tom Worster
On 9/15/09 10:54 AM, "Andres Gonzalez"  wrote:

> I have an application developed that uses alot of PHP. Currently, it is
> running on a Ubuntu 8.04 , single core CPU host.  We are moving to a
> quad core host for this application.
> 
> Is there anything special that I need to do to configure PHP to run on a
> quad core host? I noticed that my current single core system has PHP
> configured with Thread Safety disabled (as reported from phpinfo()).
> Does that need to be enabled to run in a multi-core environment?
> 
> Any other suggestions for configuring PHP for multi-core use?

interesting question.

i never paid any attention to the possibility of needing to make config
changes when moving from single to multi-core computers. i'm using apxs2 and
just assumed that there's no threading within each httpd process. in other
words, i assumed it's up to the os' scheduler to make something of the
hardware.

i'm curious to hear more on the topic.



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



Re: [PHP] server name that the user agent used

2009-09-14 Thread Tom Worster
On 9/14/09 2:11 PM, "Lars Torben Wilson"  wrote:

> Tom Worster wrote:
>> On 9/13/09 10:24 PM, "Tommy Pham"  wrote:
>> 
>>> --- On Sun, 9/13/09, Tom Worster  wrote:
>>> 
>>>> From: Tom Worster 
>>>> Subject: [PHP] server name that the user agent used
>>>> To: "PHP General List" 
>>>> Date: Sunday, September 13, 2009, 8:21 PM
>>>> when using apache with one vhost that
>>>> responds to a few different hostnames,
>>>> e.g. domain.org, y.domain.org, x.domain.org, let's say the
>>>> vhost's server
>>>> name is y.domain.org and the other two are aliases, is
>>>> there a way in php to
>>>> know which of these was used by the user agent to address
>>>> the server?
>>>> 
>>> Did you see what comes up with php_info() for
>>> $_SERVER["SERVER_NAME"] or $_SERVER["HTTP_HOST"] ?
>> 
>> SERVER_NAME returns whatever apache has as the vhost's configured server
>> name.
>> 
>> the php manual says of HTTP_HOST: "Contents of the Host: header from the
>> current request, if there is one." in which the last 4 words are a little
>> off-putting. but:
>> 
>> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23
>> 
>> i much more encouraging. the field is mandatory and should have what i'm
>> looking for. it's absence is cause for a 400. casual testing (with a modern
>> non-ie browser) seems to bear this out.
>> 
>> so i'll try using that with fallback to my current techniques if i don't
>> find a good value in HTTP_HOST.
> 
> The reason that it might not be available is that PHP is not always
> running in a web context. $_SERVER['HOST_NAME'] would have no meaning,
> for instance, in the CLI SAPI.
> 
> However, if running under a web SAPI, and if the web server provides the
> info, PHP will pass it on to its scripts.

and, for the record, in the web environment there's cause for caution using
either HTTP_HOST or, if UseCanonicalName is off or you can't be sure of its
value, SERVER_NAME:

  http://shiflett.org/blog/2006/mar/server-name-versus-http-host

in my current app, i should be able to match for acceptable values and fall
back to defaults on failure.



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



Re: [PHP] server name that the user agent used

2009-09-14 Thread Tom Worster
On 9/14/09 9:03 AM, "Tom Worster"  wrote:

> On 9/13/09 10:24 PM, "Tommy Pham"  wrote:
> 
>> --- On Sun, 9/13/09, Tom Worster  wrote:
>> 
>>> From: Tom Worster 
>>> Subject: [PHP] server name that the user agent used
>>> To: "PHP General List" 
>>> Date: Sunday, September 13, 2009, 8:21 PM
>>> when using apache with one vhost that
>>> responds to a few different hostnames,
>>> e.g. domain.org, y.domain.org, x.domain.org, let's say the
>>> vhost's server
>>> name is y.domain.org and the other two are aliases, is
>>> there a way in php to
>>> know which of these was used by the user agent to address
>>> the server?
>>> 
>> 
>> Did you see what comes up with php_info() for
>> $_SERVER["SERVER_NAME"] or $_SERVER["HTTP_HOST"] ?
> 
> SERVER_NAME returns whatever apache has as the vhost's configured server
> name.
> 
> the php manual says of HTTP_HOST: "Contents of the Host: header from the
> current request, if there is one." in which the last 4 words are a little
> off-putting. but:
> 
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23
> 
> i much more encouraging. the field is mandatory and should have what i'm
> looking for. it's absence is cause for a 400. casual testing (with a modern
> non-ie browser) seems to bear this out.
> 
> so i'll try using that with fallback to my current techniques if i don't
> find a good value in HTTP_HOST.
>

extra info: the Host: header isn't in HTTP/1.0, hence those off-putting 4
words, i guess.



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



Re: [PHP] APC - Upload progress problem. apc

2009-09-14 Thread Tom Worster
On 9/14/09 5:39 AM, "Phred White"  wrote:

> 
> On Sep 13, 2009, at 8:50 PM, Eddie Drapkin wrote:
> 
>> On Sun, Sep 13, 2009 at 9:38 PM, Phred White
>>  wrote:
>>> 
>>> On Sep 13, 2009, at 7:34 PM, Eddie Drapkin wrote:
>>> 
 On Sun, Sep 13, 2009 at 8:29 PM, Phred White  
 wrote:
> 
> On Sep 11, 2009, at 1:17 PM, Eddie Drapkin wrote:
> 
>> On Fri, Sep 11, 2009 at 1:02 PM, Phred White >> 
>> wrote:
>>> 
>>> Hey folks..
>>> 
>>> Anybody ever use APC to show upload progress?
>>> 
>>> It sounds really cool, but apc_fetch always returns false a
>>> value for
>>> uploads. I can apc_add something and fetch it, but not for
>>> uploads : (
>>> (set-up: php-apc 3.0.19, Apache2, php 5.2.10, no suhosin patch)
>>> 
>>> There is little info to google on this, and I've been through it.
>>> 
>>> I was hoping some hard core, tireless, php programmer just knew
>>> the
>>> answer.
>>> 
>>> With high anxiety, Phred
>>> 
>>> 
>>> 
>>> 
>> 
>> I recently had to do roughly the same thing (visual upload
>> progress)
>> and I had done some research into APC.  What I learned was that
>> the
>> upload tracking didn't work with FastCGI (which would have
>> prevented
>> our switch to nginx, but not a deal breaker) and what broke the
>> deal,
>> though, was the fact that APC's upload progress is apparently not
>> thread safe, so if person A is uploading a file and person B
>> starts an
>> upload, you get a silent failure.  Which brings me to another
>> point,
>> it seems to silently fail.
>> 
>> Ultimately, I went with a flash based solution because the APC
>> solution had way too many problems to be really useful.  It's a
>> nice
>> thought, but I wouldn't recommend it.  I know this isn't exactly
>> what
>> you wanted, but I had a similar experience and thought I would
>> share
>> :)
> 
> Dang! You are exactly right - that isn't what I wanted to hear! : (
> But better to know now, then when my timeline is already used up.
> 
> Did you write your own flash based solution, or use an canned one?
> 
> Thanks, Phred
> 
> 
 
 I actually wound up using swfupload because of a friend's
 recommendation and also because there's a nifty jQuery plugin for
 it.
 
 The project's main site: http://swfupload.org
 The jQuery plugin I'm using:
 http://blogs.bigfish.tv/adam/2009/06/14/swfupload-jquery-plugin/
 
 The *only* issue I could find with a flash based uploader (I don't
 regard flash installation as an issue because we're a video based
 site
 and well, if you're using our site to watch videos...) was there's
 an
 as-of-yet unresolved bug in linux flash clients that locks a browser
 until upload is completed.  Adobe's bug tracker seems to be down for
 me at the moment, but if you really want the bug, let me know
 offlist
 and I'll supply it later. :)
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
>>> Hey Eddie:
>>> 
>>> One more question...
>>> I have an existing form that provides other data that need to be
>>> linked to
>>> the file upload. It looks like swfupload, just uploads all by its
>>> lonesome.
>>> I also need the javascript form validator to be triggered before any
>>> uploading occurs. Is this possible? You don't have to tell me how
>>> (though I
>>> wouldn't mind a few clues). I just want to know if it will meet my
>>> needs
>>> once i dig in.
>>> 
>>> Thanks
>>> 
>>> 
>> 
>> That should all be possible.  I'd take a look at
>> http://demo.swfupload.org/v220/featuresdemo/index.php as that has most
>> of that happening on the page and you can bootleg some of their
>> example code :)
>> 
> Bummer... It looked so promising, but on Macs, Flash has to load the
> entire file into memory to upload! R. So, it isn't viable for
> big files (Gig +) if you need it to be cross platform.
> 
> So now I am looking at perl of all things! If you have any ideas let
> me know. thanks for all your help so far.

with files that big, perhaps could write client js that polls a script on
the server that simply returns the file size(s)? if you want a thermometer,
use the number to resize a colored div.



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



Re: [PHP] server name that the user agent used

2009-09-14 Thread Tom Worster
On 9/13/09 10:24 PM, "Tommy Pham"  wrote:

> --- On Sun, 9/13/09, Tom Worster  wrote:
> 
>> From: Tom Worster 
>> Subject: [PHP] server name that the user agent used
>> To: "PHP General List" 
>> Date: Sunday, September 13, 2009, 8:21 PM
>> when using apache with one vhost that
>> responds to a few different hostnames,
>> e.g. domain.org, y.domain.org, x.domain.org, let's say the
>> vhost's server
>> name is y.domain.org and the other two are aliases, is
>> there a way in php to
>> know which of these was used by the user agent to address
>> the server?
>> 
> 
> Did you see what comes up with php_info() for
> $_SERVER["SERVER_NAME"] or $_SERVER["HTTP_HOST"] ?

SERVER_NAME returns whatever apache has as the vhost's configured server
name.

the php manual says of HTTP_HOST: "Contents of the Host: header from the
current request, if there is one." in which the last 4 words are a little
off-putting. but:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23

i much more encouraging. the field is mandatory and should have what i'm
looking for. it's absence is cause for a 400. casual testing (with a modern
non-ie browser) seems to bear this out.

so i'll try using that with fallback to my current techniques if i don't
find a good value in HTTP_HOST.



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



Re: [PHP] get an object property

2009-09-13 Thread Tom Worster
On 9/13/09 3:21 AM, "Lars Torben Wilson"  wrote:

>> On 9/12/09 9:50 AM, "Tom Worster"  wrote:
>>
>> but let me give you a more different example:
>> 
>> $a and $b are normally both objects, each with various members including a
>> prop q, but sometimes $a is false. i want the q of $a if $a isn't false,
>> otherwise that of $b.
>> 
>> ($a ? $a : $b)->q   // is not php, afaik
>> 
>> before you suggest one, i know there are simple workarounds.
>>   
> You're right, that isn't PHP syntax. One workaround that came to mind
> which does
> a similar thing (although using a different mechanism) is this:
> 
>   ${$a ? 'a' : 'b'}->q

i would not have thought of that. interesting...


>> and while i'm at it, and using my original error, how come...
>> 
>> function o() { return (object) array('q'=>7); }
>> echo o()->q;  // is ok syntax, but
>> 
>> function a() { return array('q'=>5); }
>> echo a()['q'];  // isn't?
>>   
> I'm afraid I can't answer that right now--it does perhaps seem
> inconsistent at first glance,
> although I can't say I've ever missed it or felt that using syntax like
> that would make my
> life any better. Maybe it would. Then again, I can also see an argument
> being made for
> allowing the object syntax but not the array syntax: in the case of
> objects, you can have
> a clean class declaration which is pretty much self-documenting, and
> later users of the
> class can have a clear idea of which properties are available and which
> are not, and they
> can thus be sure that o()->q will not result in uninitialized property
> problems. Using the
> array syntax you could never be sure that the index requested actually
> exists.
> 
> Of course, this holds true only for people like me who don't really like
> the idea of creating
> objects on the fly in PHP unless there's a very good reason to. Usually
> in PHP such tasks
> are better handled by arrays anyway.

the dbms abstraction library i use delivers rows, by default, as objects. so
i commonly handle dynamically generated data in the form of objects, though
it's not my code generating those objects. i think that's one reasons why i
often find i would use objects as data structures. and because i find the
dynamic objects in js convenient.

but i think you're preference reflects more closely was probably the concept
of php's version of oop: an object is an instances of a static class.

in any case, now that i've confirmed that i'm not merely unaware of the
features i was hunting for, and that they don't exist by design, i can
perhaps move on.

on a related note, way back when xml was ascendant as "the most exciting new
technology to hit the net since java", i was not impressed. what a horrid
syntax for specifying and communicating data, i would argue. why not use the
syntax from some sensible programming language instead? js, for example?
easy to parse, less overhead, human readable (i find xml hard to read), etc.
then eventually json happened, without all the hype and fanfare, just doing
the job very conveniently. i love it.

and to make that comment vaguely php related, i now use json to encode
structured data that i want to write to the php error log.



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



[PHP] server name that the user agent used

2009-09-13 Thread Tom Worster
when using apache with one vhost that responds to a few different hostnames,
e.g. domain.org, y.domain.org, x.domain.org, let's say the vhost's server
name is y.domain.org and the other two are aliases, is there a way in php to
know which of these was used by the user agent to address the server?



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



Re: [PHP] get an object property

2009-09-12 Thread Tom Worster
On 9/12/09 9:50 AM, "Tom Worster"  wrote:

> On 9/12/09 1:32 AM, "Lars Torben Wilson"  wrote:
> 
>> Tom Worster wrote:
>>> if i have an expression that evaluates to an object, the return value from a
>>> function, say, and i only want the value of one of the objects properties,
>>> is there a tidy way to get it without setting another variable?
>>> 
>>> to illustrate, here's something that doesn't work, but it would be
>>> convenient if it did:
>>> 
>>> $o = array( (object) array('a'=>1), (object) array('a'=>2) );
>>> 
>>> if ( end($o)->a > 1 ) {  // can't use -> like this!
>>> ...
>>> }
>> 
>> What version of PHP are you using? Your example should work.
>> 
>> Torben
> 
> 5.2.9.
> 
> what version does it work in?

i shamefully beg your pardon, lars. i was sure i tested the example but it's
clear to me now i either didn't or i made a mistake. end($o)->a IS php
syntax! so -> may follow a function (or method, i guess) call.

but let me give you a more different example:

$a and $b are normally both objects, each with various members including a
prop q, but sometimes $a is false. i want the q of $a if $a isn't false,
otherwise that of $b.

($a ? $a : $b)->q   // is not php, afaik

before you suggest one, i know there are simple workarounds.

but mine is a theoretical question about syntax, not a practical one. i'm
exploring php's syntactic constraints on the -> operator in contrast to,
say, the + or . operators. and in contrast to other languages.

for example, the . in js seems more generally allowed than -> (or, for that
matter, []) in php. programmers (especially using jquery) are familiar with
using . after an expression that evaluates to an object, e.g.


My x class number is



document.getElementById('num').innerText =
  ( ( document.getElementById('optional')
  || document.getElementById('mandatory')
).appendChild(document.getElementById('thepara'))
.className.match(/x(\d+)/) || [0,'absent']
  )[1]



which shows . after objects, method calls and expressions (as well as the []
operator applied to an expression).

do we just live without in phpville or am i missing something?


and while i'm at it, and using my original error, how come...

function o() { return (object) array('q'=>7); }
echo o()->q;  // is ok syntax, but

function a() { return array('q'=>5); }
echo a()['q'];  // isn't?




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



Re: [PHP] get an object property

2009-09-12 Thread Tom Worster
On 9/12/09 1:32 AM, "Lars Torben Wilson"  wrote:

> Tom Worster wrote:
>> if i have an expression that evaluates to an object, the return value from a
>> function, say, and i only want the value of one of the objects properties,
>> is there a tidy way to get it without setting another variable?
>> 
>> to illustrate, here's something that doesn't work, but it would be
>> convenient if it did:
>> 
>> $o = array( (object) array('a'=>1), (object) array('a'=>2) );
>> 
>> if ( end($o)->a > 1 ) {  // can't use -> like this!
>> ...
>> }
> 
> What version of PHP are you using? Your example should work.
> 
> Torben

5.2.9.

what version does it work in?



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



Re: [PHP] get an object property

2009-09-12 Thread Tom Worster
On 9/12/09 12:31 AM, "Paul M Foster"  wrote:

> On Fri, Sep 11, 2009 at 07:31:01PM -0400, Tom Worster wrote:
> 
>> if i have an expression that evaluates to an object, the return value from a
>> function, say, and i only want the value of one of the objects properties,
>> is there a tidy way to get it without setting another variable?
>> 
>> to illustrate, here's something that doesn't work, but it would be
>> convenient if it did:
>> 
>> $o = array( (object) array('a'=>1), (object) array('a'=>2) );
>> 
>> if ( end($o)->a > 1 ) {  // can't use -> like this!
>> ...
>> }
>> 
> 
> You should use print_r() or var_dump() to investigate what happens when
> you try to cast an array into an object. I myself don't know what would
> happen. Also, what's allowed and what effects are produced could depend
> heavily on the version of PHP you're running. Version 4 != 5 != 5.3 in
> this respect.

i did that long ago when i was looking for php's object literal syntax. i
didn't find one. we discussed it here more recently and consensus appeared
to be that casting an array was the most convenient workaround.



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



[PHP] get an object property

2009-09-11 Thread Tom Worster
if i have an expression that evaluates to an object, the return value from a
function, say, and i only want the value of one of the objects properties,
is there a tidy way to get it without setting another variable?

to illustrate, here's something that doesn't work, but it would be
convenient if it did:

$o = array( (object) array('a'=>1), (object) array('a'=>2) );

if ( end($o)->a > 1 ) {  // can't use -> like this!
...
}




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



Re: [PHP] String scrambling

2009-09-11 Thread Tom Chubb
!niBgo


/*
$str = "Bingo!";
str_shuffle($str);
*/



:)


Re: [PHP] mysql user session handler

2009-09-09 Thread Tom Worster
good point, gabriel.

i really need to stop procrastinating with the whole memcache project.
perhaps i ought to postpone consideration of the session handler until i've
learned something about memcache, which i need to do anyway.


On 9/8/09 10:06 PM, "Gabriel Sosa"  wrote:

> I'm our case we opt for memcache to store the sessions
> Mmc its soo much faster and you will have less net overhead because
> the simple protocol
> Also the configuration its easier. If you see in the php manual you
> only need to touch two lines in the php.ini
> 
> On 9/8/09, Tom Worster  wrote:
>> thanks, Devendra, that's pretty much the same as my handler. (though i can't
>> figure Rich Smith's $sess_save_path global. do you know what is for?)
>> 
>> but what i'm really interested in is people's experience in switching over
>> to and using this kind of handler: pitfalls, gotchas, etc. or is it really
>> as easy and simple as all these online articles i've read about it claim?
>> 
>> or is that experience so hard won that people aren't keen to share it?
>> 
>> -tom
>> 
>> On 9/8/09 2:23 PM, "Devendra Jadhav"  wrote:
>> 
>>> http://www.devshed.com/c/a/PHP/Storing-PHP-Sessions-in-a-Database/
>>> 
>>> 
>>> On Tue, Sep 8, 2009 at 10:53 PM, Tom Worster  wrote:
>>> 
>>>> questions for those of you with a user session handler using mysql:
>>>> 
>>>> did you write your own handler, write one based off some other you found
>>>> (if
>>>> so, which?), or are you using some available library (if so, which?)?
>>>> 
>>>> and how do you feel about your implementation? satisfied? or are there
>>>> improvements you'd like to have?
>>>> 
>>>> and what serializer do you use?
>>>> 
>>>> i have my own set of handler functions (less than 70 loc) which seem to
>>>> work
>>>> in simple testing. but, while i'd really like to have the sessions in the
>>>> db
>>>> for redundancy, i haven't had the courage to deploy it yet. i derived the
>>>> code from something i found on the web. i trust everything i read on the
>>>> internet ;-)
>>>> 
>>>> -tom
>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> 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



Re: [PHP] Renaming a Directory

2009-09-09 Thread Tom Worster
On 9/9/09 12:08 AM, "Paul M Foster"  wrote:

> On Tue, Sep 08, 2009 at 05:39:43PM -0400, Floyd Resler wrote:
> 
>> How can I rename a directory with files in it?  The rename function
>> gives me a "directory not empty" error.  I know I could do it be
>> creating the directory, moving the files, and then deleting the old
>> one.  Is there an easier way?
> 
> It sounds like, underneath, rename() is creating a new directory and
> then attempting to delete the old one, ignoring the files in the
> original directory.

really?

the test below seems to show that php rename() is happy to rename
directories that are not empty. it even renames ones that contain files that
it neither owns nor has any permissions for. that suggests it is just
changing the name of the directory.

so the error message floyd reported is still a mystery to me, assuming
/bin/mv worked for the same old and new directories where php rename()
failed.

$ mkdir wwwdir
$ sudo chown www:www wwwdir
$ cd wwwdir
$ sudo -u www mkdir testdir
$ sudo -u www touch testdir/foo testdir/bar
$ sudo -u www php -r "echo rename('testdir','dirtest');"
1$ ls -la dirtest
total 0
drwxr-xr-x  4 _www  _www  136 Sep  9 09:57 .
drwxr-xr-x  3 _www  _www  102 Sep  9 09:57 ..
-rw-r--r--  1 _www  _www0 Sep  9 09:57 bar
-rw-r--r--  1 _www  _www0 Sep  9 09:57 foo
$ sudo -u www chmod 000 dirtest/foo
$ sudo -u www php -r "echo rename('dirtest','testdir');"
1$ ls -la testdir
total 0
drwxr-xr-x  4 _www  _www  136 Sep  9 09:57 .
drwxr-xr-x  3 _www  _www  102 Sep  9 09:57 ..
-rw-r--r--  1 _www  _www0 Sep  9 09:57 bar
--  1 _www  _www0 Sep  9 09:57 foo
$ sudo chown root:wheel testdir/foo
$ sudo -u www -u www php -r "echo rename('testdir','dirtest');"
1$ ls -la dirtest
total 0
drwxr-xr-x  4 _www  _www   136 Sep  9 09:57 .
drwxr-xr-x  3 _www  _www   102 Sep  9 09:57 ..
-rw-r--r--  1 _www  _www 0 Sep  9 09:57 bar
--  1 root  wheel0 Sep  9 09:57 foo
$ php -v
PHP 5.2.8 (cli) (built: Feb  5 2009 21:21:13)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
$ uname -v
Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009;
root:xnu-1228.15.4~1/RELEASE_I386
$ 



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



Re: [PHP] mysql user session handler

2009-09-09 Thread Tom Worster
On 9/9/09 4:16 AM, "Ford, Mike"  wrote:

>> -Original Message-----
>> From: Tom Worster [mailto:f...@thefsb.org]
>> Sent: 09 September 2009 02:29
>> 
>> thanks, Devendra, that's pretty much the same as my handler. (though
>> i can't
>> figure Rich Smith's $sess_save_path global. do you know what is
>> for?)
> 
> I think if you look at the comments on that article, he's agreed that's an
> error and shouldn't be there.

i didn't read any of the comments, thanks for pointing it out.

while we're looking at mr. smith's article...

"Depending on how your code is structured, PHP does not always automatically
save any session data.  To be certain you are retaining your session data
all the time, be sure to call the session_write_close() function at the end
of each page."

what are the specific conditions under which php _does_not_ write session
data when a script terminate?

according to the php manual,
http://www.php.net/manual/en/function.session-write-close.php
session_write_close() allows a script to release its lock on the session
allowing other scripts to use it. it implies you wouldn't "usually" use it
otherwise.


>> but what i'm really interested in is people's experience in
>> switching over
>> to and using this kind of handler: pitfalls, gotchas, etc. or is it
>> really
>> as easy and simple as all these online articles i've read about it
>> claim?
> 
> I moved from a single server to a load-balanced setup with 2 back-end servers.
> I switched to a database-based session handler very similar to the one under
> discussion (just tailored to my house style, really) and it just worked.  Been
> running happily in production for about 6 months now.

thanks for the info.



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



Re: [PHP] mysql user session handler

2009-09-08 Thread Tom Worster
thanks, Devendra, that's pretty much the same as my handler. (though i can't
figure Rich Smith's $sess_save_path global. do you know what is for?)

but what i'm really interested in is people's experience in switching over
to and using this kind of handler: pitfalls, gotchas, etc. or is it really
as easy and simple as all these online articles i've read about it claim?

or is that experience so hard won that people aren't keen to share it?

-tom

On 9/8/09 2:23 PM, "Devendra Jadhav"  wrote:

> http://www.devshed.com/c/a/PHP/Storing-PHP-Sessions-in-a-Database/
> 
> 
> On Tue, Sep 8, 2009 at 10:53 PM, Tom Worster  wrote:
> 
>> questions for those of you with a user session handler using mysql:
>> 
>> did you write your own handler, write one based off some other you found
>> (if
>> so, which?), or are you using some available library (if so, which?)?
>> 
>> and how do you feel about your implementation? satisfied? or are there
>> improvements you'd like to have?
>> 
>> and what serializer do you use?
>> 
>> i have my own set of handler functions (less than 70 loc) which seem to
>> work
>> in simple testing. but, while i'd really like to have the sessions in the
>> db
>> for redundancy, i haven't had the courage to deploy it yet. i derived the
>> code from something i found on the web. i trust everything i read on the
>> internet ;-)
>> 
>> -tom
>> 
>> 
>> 
>> 
>> --
>> 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] mysql user session handler

2009-09-08 Thread Tom Worster
questions for those of you with a user session handler using mysql:

did you write your own handler, write one based off some other you found (if
so, which?), or are you using some available library (if so, which?)?

and how do you feel about your implementation? satisfied? or are there
improvements you'd like to have?

and what serializer do you use?

i have my own set of handler functions (less than 70 loc) which seem to work
in simple testing. but, while i'd really like to have the sessions in the db
for redundancy, i haven't had the courage to deploy it yet. i derived the
code from something i found on the web. i trust everything i read on the
internet ;-)

-tom




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



Re: [PHP] Converting URL's to hyperlinks.

2009-09-04 Thread Tom Chubb
2009/9/4 Daevid Vincent 

>
>
> > -Original Message-
> > From: Lupus Michaelis 
> > [mailto:mickael+...@lupusmic.org
> ]
> > Sent: Friday, September 04, 2009 7:46 AM
> > To: php-general@lists.php.net
> > Subject: Re: [PHP] Converting URL's to hyperlinks.
> >
> > Daevid Vincent a écrit :
> > > Maybe I misunderstood the OP,
> >OP ?
>
> Original Poster
>
> > > but wouldn't this (or something like it) be
>
> Note the "something like it". I didn't write his app, just provided a
> starting point.
>
> > > $url = preg_replace("/(\...@\w+\.[a-za-z]{2,3})/i", " > > href='mailto:$1'>$1", $url);
> >This violate the numerous RFC about mail addresses, and some other
> > stuffs.
>
> Blah blah blah.
> I've used this code for about 6 years now and have yet to find emails that
> it didn't work for. If someone has some funky (whacky) RFC extremity, then
> so be it. That's their problem. Most people have NORMAL emails that follow
> the above.
>
> But you are correct, I have revised it to be a little more forgiving of
> some
> allowed characters...
>
> preg_replace("/([\w\.\-...@[\w\.\-_]+\.\w{2,6})/i",
>
> > >
> > > $url =
> > preg_replace("/\s(http:\/\/)?(\w*\.?\w*\.[a-zA-Z]{2,3}.*?\s)/i", "  > > href='http://$2' target='_blank'>$2", $url);
> >
> >Same as previously. What about .info, .museum and so on tld ?
>
> What about them? It's going to depend on how/where you use this. In my
> case,
> 2 and 3 letter domains are all I encounter. It's trivial to make it {2,6}
> if
> you really are going to encounter a .museum domain. DOUBTFUL, but sure,
> I'll
> concede the three extra letters. ;-)
>
> However, you point out a few edge cases and so I optimized mine and now use
> this one:
> http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/
>
> > > Oh, and your regex isn't
> > smart (you use the case insensitivity flag, but seek A-Z
> > characters...) :D
>
> Noted. Thanks for the optimization.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Thanks for posting that! Will be really handy for me!


Re: [PHP] Re: Best way to test for form submission?

2009-08-29 Thread Tom Worster
On 8/29/09 9:29 AM, "tedd"  wrote:

> At 1:18 AM -0700 8/29/09, Warren Vail wrote:
>> To test a form I usually send the form contents to a php file that contains
>> the following;
>> 
>> foreach($_POST as $nm => $val) echo "_POST[".$nm."] [".$val."]";
>> foreach($_GET as $nm => $val) echo "_GET[".$nm."] [".$val."]";
>> 
>> Checkboxes and radio buttons only send their value if the control is
>> "checked".
>> 
> 
> That's correct, here's the way I solve both types:
> 
> http://php1.net/b/form-radio
> http://php1.net/b/form-radio1
> http://php1.net/b/form-checkbox/
> http://php1.net/b/form-checkbox1/

warren's test script above doesn't work so well with tedd's scheme for
naming radios & checkboxs. tedd uses name="option[]" in the markup so in
warren's script, when $nm is 'option', $val will be an array so it won't
convert to a string in ".$val.".



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



[PHP] Why aren't you rich? (was Re: unset() something that doesn't exist)

2009-08-26 Thread Tom Worster
On 8/26/09 10:08 AM, "tedd"  wrote:

> I had a client say to me once "If you're so smart, then why aren't
> you rich?"

how about: "i'm smart enough that i know not to waste my allotted time on
this planet amassing riches."

i know plenty of rich people, many of whom earned their wealth. i envy the
financial security but little else of that their wealth has done to their
lives. time is really what i want more of. some wealthy trust fund types
have wealth and time but they have other problems i'm glad i don't. 



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