Re: [PHP] Lucene library

2012-12-11 Thread Louis Huppenbauer
There's Zend_Search_Lucene, part of the Zend framework. I think it should
be possible to use it without the whole framework though.

http://framework.zend.com/manual/1.12/de/zend.search.lucene.html


2012/12/12 Larry Garfield la...@garfieldtech.com

 Yes, I've worked with Apache Solr quite a bit.  It's a separate server,
 however, and I'm looking for something with smaller requirements for a
 concept I want to try. I'd consider SQLite, but I really need something
 schema-free and PHP-native/easily-installable.

 --Larry Garfield


 On 12/11/2012 07:20 PM, israele...@gmail.com wrote:

 Check out apache solr.

 The php implementation of Lucene was very slow and had a lot of
 perfomance issues the last time I tried it
 --Original Message--
 From: Larry Garfield
 To: php-general@lists.php.net
 Subject: [PHP] Lucene library
 Sent: Dec 11, 2012 5:41 PM

 Hi all.

 I recall hearing about there being a PHP port of the Lucene library some
 years ago, but I don't recall whence it came.  It was a stand-alone PHP
 lib, which needed some integration to be viable as an actual search
 engine but worked up to a point by storing data straight on disk as
 files.  That meant it didn't scale beyond a few tens of thousands of
 records, but that's still a decent number.

 Does that ring a bell for anyone?  Anyone know if it still exists, and
 if so where?  I didn't find it in https://packagist.org/ , which is
 where I figured it would be if it were still maintained.

 I may have a use for it if it still exists.

 --Larry Garfield



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




Re: [PHP] templeting

2012-09-04 Thread Louis Huppenbauer
2012/9/4 tamouse mailing lists tamouse.li...@gmail.com

 On Mon, Sep 3, 2012 at 8:49 PM, David McGlone da...@dmcentral.net wrote:
  On Monday, September 03, 2012 09:45:23 PM David OBrien wrote:
  On Sep 3, 2012 9:15 PM, David McGlone da...@dmcentral.net wrote:
   Does anyone use any templeting system for any projects? If so what
 would
   anyone recommend? I looked at Code Ignitor, but it seems the
 templeting
 
  system is optional and left out by default.
 
  I use smarty
 
  I've used smarty in the past and was thinking about that, but PEAR is
 absolete
  anymore and I don't really know of a good replacement. :-/

 I use Smarty as well, but I've never used it from PEAR. I just use the
 version downloadable from http://www.smarty.net

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


I'm mostly working with twig, a symfony2 framework component.
I especially like it's template inheritance and the (in my opinion) very
clear syntax.

http://twig.sensiolabs.org/


Re: [PHP] Re: How to use wsdl files?

2012-08-31 Thread Louis Huppenbauer
Hi there

2012/8/31 Michelle Konzack linux4miche...@tamay-dogan.net

 Hello Matijn Woudt,

 Am 2012-08-30 16:44:53, hacktest Du folgendes herunter:
  You could start by looking at the PHP SoapClient [1], which takes a
  URI to a WSDL descriptor as argument. You can enter the URL to the
  WSDL file there, like this:
  $client = new SoapClient(
 http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl;);
 
  Now you need to know which function you want to call, let's say it's
  called SomeFunction, then you can do:
  $client-SomeFunction($paramA, $paramB);
 
  Hope this gets you started.

 Ah thanks...  Interesting how it works.

 However, I have found wsdl2php and converted the wsdl file  to  a  PHP
 class, but I hate classes...  Never used it in 12 years.  :-D

 --8
 ?php

 class checkVat{
   var $countryCode; //string
   var $vatNumber;   //string
 }

 class checkVatResponse{
   var $countryCode; //string
   var $vatNumber;   //string
   var $requestDate; //date
   var $valid;   //boolean
   var $name;//string
   var $address; //string
 }

 class checkVatApprox{
   var $countryCode; //string
   var $vatNumber;   //string
   var $traderName;  //string
   var $traderCompanyType;   //companyTypeCode
   var $traderStreet;//string
   var $traderPostcode;  //string
   var $traderCity;  //string
   var $requesterCountryCode;//string
   var $requesterVatNumber;  //string
 }

 class checkVatApproxResponse{
   var $countryCode; //string
   var $vatNumber;   //string
   var $requestDate; //date
   var $valid;   //boolean
   var $traderName;  //string
   var $traderCompanyType;   //companyTypeCode
   var $traderAddress;   //string
   var $traderStreet;//string
   var $traderPostcode;  //string
   var $traderCity;  //string
   var $traderNameMatch; //matchCode
   var $traderCompanyTypeMatch;  //matchCode
   var $traderStreetMatch;   //matchCode
   var $traderPostcodeMatch; //matchCode
   var $traderCityMatch; //matchCode
   var $requestIdentifier;   //string
 }

 class checkVatService{
   var $soapClient;

   private static $classmap = array('checkVat' = 'checkVat'
   ,'checkVatResponse' = 'checkVatResponse'
   ,'checkVatApprox' = 'checkVatApprox'
   ,'checkVatApproxResponse' =
 'checkVatApproxResponse');

   function __construct($url='
 http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl')
   {
 $this-soapClient = new SoapClient($url,array(classmap =
 self::$classmap,
   trace = true,
   exceptions = true));
   }

   function checkVat(checkVat $checkVat)
   {
 $checkVatResponse = $this-soapClient-checkVat($checkVat);
 return $checkVatResponse;
   }

   function checkVatApprox(checkVatApprox $checkVatApprox)
   {
 $checkVatApproxResponse =
 $this-soapClient-checkVatApprox($checkVatApprox);
 return $checkVatApproxResponse;
   }
 }

 ?
 --8

 OK, tried

 $VALS = new checkVat;

 $VALS-countryCode = 'DE';
 $VALS-vatNumber   = '278049239';

 $OBJECT = new checkVatService;
 $OBJECT-checkVat;

 and up the here I have no error.  But How do I get the answer now?

 $ANS = $OBJECT-checkVat;
 or
 $ANS = $OBJECT-checkVat();

 do not seem to work

 print_r($ANS);

 Also

 $RET = new checkVatResponse;
 print_r($RET);

 seems not to work

 What I am missing?

 Thanks, Greetings and nice Day/Evening
 Michelle Konzack



The method checkVatService::checkVat is expecting an object of type
checkVat to work.
So you'll have to use something like this:

$VALS = new checkVat();

$VALS-countryCode = 'DE';
$VALS-vatNumber   = '278049239';

$OBJECT = new checkVatService();
$ANS = $OBJECT-checkVat($VALS);

Sincerely
Louis H.


Re: [PHP] Searching IDE.

2012-06-13 Thread Louis Huppenbauer
Hi there,

2012/6/13 David Arroyo darr...@gmail.com

 Hi Folks,

 I am searching an IDE for php and web development, my options are
 Aptana or Eclipse+PDT.
 What is your opinion?

 Thanks.
 Regards.


notepad++ or netbeans.
And although I haven't tried it yet, I heard the the Sublime Text Editor 2
is great.

Sincerely
Louis H.


Re: [PHP] Flat PHP projects and Firebug

2012-04-12 Thread Louis Huppenbauer
2012/4/12 Mihamina Rakotomandimby miham...@rktmb.org

 Hi all,

 For flat PHP projects (I mean without framework such as Jelix or
 Symfony), what Firebug logging tooldo you recommend to use?
 - FirePHP?
 - in-the-code Javascript console.log() generation?
 - other tools?


 These are for training project, not really real-world ones, in order to
 train juniors/newcomers to our team.

 I missed the name of a PHP class or library that allowed to use
 breakpoints and so with Firebug... or some similar things...



 --
 RMA.

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


Hi there

I think that firephp could do the trick for you.

http://www.firephp.org/

Sincerely
Louis


Re: [PHP] syntax question

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

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

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

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

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



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

 This query works!!



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

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



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

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












Re: [PHP] Re: Preferred Syntax

2011-12-15 Thread Louis Huppenbauer
Another nice way would be sprintf. So your string really is just a string
and nothing more.
I don't know how it would affect performance, but just for the eye I find
it much simpler.

echo sprintf(a style='text-align:left;size:**14;font-weight:bold'
href='/mypage.php/%d'%s/abr, $page_id, $page_name);

2011/12/15 Robert Cummings rob...@interjinn.com

 On 11-12-15 02:50 AM, Ross McKay wrote:

 On Wed, 14 Dec 2011 07:59:46 -0500, Rick Dwyer wrote:

  Can someone tell me which of the following is preferred and why?

  echo a style='text-align:left;size:**14;font-weight:bold' href='/
 mypage.php/$page_id'$page_**name/abr;

  echo a style='text-align:left;size:**14;font-weight:bold' href='/
 mypage.php/.$page_id.'.$**page_name./abr;
 [...]


 Just to throw in yet another possibility:

 echoHTML
 a style=text-align:left;size:**14;font-weight:bold
href=/mypage.php/$page_id$**page_name/abr
 HTML;

 I love HEREDOC for slabs of HTML, sometimes SQL, email bodies, etc.
 because they allow you to drop your variables into the output text
 without crufting up the formatting with string concatenation, AND they
 allow you to use double quotes which can be important for HTML
 attributes that may contain single quotes.

 So whilst either above option is fine for the specific context, I prefer
 HEREDOC when there's attributes like href.

 But what is preferred is rather dependent on the preferrer.


 Heredoc and Nowdoc are nice but I hate the way they muck up my indentation
 aesthetics. As such when I use them I use as minimalist a terminator as
 possible:

 ?php

echo _
a href=foo.htmlBlah blah blah/a
 _;

 ?


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

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




[PHP] Novice: PHP array by reference question (by C++ programmer)

2011-10-31 Thread Louis Huppenbauer
-- Forwarded message --
From: Louis Huppenbauer louis.huppenba...@gmail.com
Date: 2011/10/31
Subject: Re: [PHP] Novice: PHP array by reference question (by C++
programmer)
To: Manish Gupta gman...@gmail.com


You have to assign the value by reference too

public function  __construct( $bar)
  {
  $this-_bar = $bar;
  }


2011/10/31 Manish Gupta gman...@gmail.com

  I have a class that takes as input, an array by reference and stores it
 in a
 member variable. A method in this class later modifies the member variable
 (which contains reference to the array). When I access the local variable
 that was passed by reference to the constructor of this class object, I see
 the local variable hasn't changed at all. I think code will describe what
 words may not have:

 ?php

 class foo
 {
   public $_bar;
   public function  __construct( $bar)
   {
   $this-_bar = $bar;
   }

   function do_your_thing()
   {
   $temp = array(
   'One' = 1,
   'Two' = 2
   );

   $this-_bar[] = $temp;

   echo('from Do_your_thing: ');
   print_r($this-_bar);   //  [1]
   }
 }

 $abc = array();
 $var = new foo($abc);
 $var-do_your_thing();

 echo('from main [local variable]: ');
 print_r($abc);   //  [2]

 echo('from main: [object member variable] ');
 print_r($var-_bar);//  [3]
 ?

 I expected the output from [1], [2] and [3] to be the same. But instead I
 get the following:

 from Do_your_thing: Array
 (
   [0] = Array
   (
   [One] = 1
   [Two] = 2
   )

 )
 from main [local variable]: Array
 (
 )
 from main: [object member variable] Array
 (
   [0] = Array
   (
   [One] = 1
   [Two] = 2
   )

 )

 What am I missing? Please help, I'm new to PHP and this is really blocking
 me.

 Thanks
 M@nish


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




Re: [PHP] PHP/ Soap issue

2011-09-01 Thread Louis Huppenbauer
I think it would be best if you could provide us with the .wsdl (and
possibly with the server-code).

2011/9/1 richard gray r...@richgray.com

 I am hoping there's a SOAP expert on the list as this is driving me mad and
 Google doesn't come up with much help ...

 I am trying to build a fairly simple web service in SOAP -- the client
 sends a string SKU to query a product catalogue database and receives
 product pricing data - I am using a WSDL file which validates OK ... anyway
 I keep getting this error:-

 SOAP-ERROR: Encoding: object has no 'name' property

 The PHP code is below:-

 $client = new 
 SoapClient('http://example.**com/catalogue.wsdlhttp://example.com/catalogue.wsdl
 ',array('**trace' =  1,'exceptions' =  0));
 $sku = '12345';
 $client-getProduct($sku);

 I can post the wsdl file contents if necessary.

 Hoping someone can help point me in the right direction!
 TIA
 Rich

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




Re: [PHP] Re: mysqli sql question

2011-08-31 Thread Louis Huppenbauer
Hi there Richard

It's part of the prepared statements
http://php.net/manual/de/pdo.prepared-statements.php
;)

2011/8/31 Richard Riley rile...@googlemail.com

 Jen Rasmussen j...@cetaceasound.com writes:

  Peet,
 
  Could you do something like this instead? This is using named
 placeholders
  and a separate line for your statement
  but I was able to get it to echo the statement in this manner.
 
  $sql = UPDATE table SET field1=:field1, field2=:field2 WHERE id=:id;
$sth = $dbh-prepare($sql);
$sth-execute(array(:field1=$field1,
   : field2=$ field2,
   : id=$id));

 Hi Jen, could you point me to a document/man page for PHP which explains
 that : notation in $sql= line please. I'm sure its common to everyone
 here but, well, I never saw it before ;(


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




Re: [PHP] correct character decoding

2011-08-30 Thread Louis Huppenbauer
Why don't you just check if the string is utf8 or not, and change convert it
accordingly?

$out = trim((mb_detect_encoding($input, 'UTF-8', 'ISO-8859-1') == 'UTF-8' ?
$input : utf8_encode($input)));

It may not be the most elegant version, but I can't think of anything
simpler right now.

sincerely
louis


2011/8/30 Merlin Morgenstern merlin.morgenst...@googlemail.com

 Hi there,

 I am trying to find a solution for decoding the same string from 2
 different character sets (UTF-8, Latin-1)

 Looks like in the case of latin-1 I need to add utf8_encode before to get
 the same results. Here is an example

 // utf-8
 $input = urldecode('%20%C3%**9Cbersetzung%20franz');
 $output = trim(($input));
 $output2 = urlencode($output);
 echo $input.'br'.$output.'br'.$**output2;
 echo 'a href='.$output2.'output 2/a';

 echo 'hr';
 // latin 1
 $input = urldecode('%DCbersetzung+**franz');
 $out = trim(utf8_encode($input));
 $out2 = urlencode($out);
 echo $input.'br'.$out.'br'.$**out2;
 echo 'a href='.$out2.'output 2/a';


 The latin-1 seems to need the utf8-encode to get the same result. Has
 anybody an idea on how to solve this? I need a function that works for
 latin-1 and UTF-8.

 Thank you in advance for any help,

 Merlin

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




Re: [PHP] Fwd: ezmlm warning

2011-07-20 Thread Louis Huppenbauer
got the same problem today
mayhabs gmail had a small problem... who knows ;)

2011/7/20 Lester Caine les...@lsces.co.uk

 Tamara Temple wrote:

 Um... what's going on here? Why would google mail be bouncing??

 Happens quite often ... just means that an email server has hickupped
 somewhere so an email addressed to you has not got through '76.75.200.58'
 which I think is the same machine address on the message a deleted this
 morning for my email address

 --
 Lester Caine - G8HFL
 -
 Contact - 
 http://lsces.co.uk/wiki/?page=**contacthttp://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//
 Firebird - 
 http://www.firebirdsql.org/**index.phphttp://www.firebirdsql.org/index.php


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




Re: [PHP] Foreach question

2011-07-05 Thread Louis Huppenbauer
Hi there

I think that foreach in your first example just knowns that this
should be the last loop (as the array only contains 1 element at
start) and so stops there.
In your 2nd example however the first loop isn't the last, so the
array get's checked again, and now there's another element, so...

I think that's more or less normal behaviour.

Sincerely yours
Louis

2011/7/5 Dajka Tamas vi...@vipernet.hu:
 Hi all,



 I've bumped into an interesting thing with foreach. I really don't know, if
 this is normal working, or why it is, so I got curious.



 The script:



 foreach ( $cats as $c ) {

               echo $c['id'];

               if ( $c['id']  5 ) {

                              $c['id']++;

                              $cats[] = $c;

               }

 }



 Input 1:



 $cats = array( array( 'id' = 1 ) );



 Output 1:



 1



 Input 2:



 $cats = array( array( 'id' = 1 ), array( 'id' = 2 ) );



 Output 2:



 122334455





 Why is this? Is this normal behaviour?





 Thanks,



               Tamas



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



Re: [PHP] Foreach question

2011-07-05 Thread Louis Huppenbauer
Or maybe he tried to do the following?

?php
foreach ( $cats as$c ) {
   echo $c['id'];
   if ($c['id']  5) {
  $cats[] = array('id' = ($c['id'] + 1));
   }
}
?

2011/7/5 Robert Cummings rob...@interjinn.com:

 On 11-07-05 09:40 AM, Dajka Tamas wrote:

 Hi all,



 I've bumped into an interesting thing with foreach. I really don't know,
 if
 this is normal working, or why it is, so I got curious.



 The script:



 foreach ( $cats as$c ) {

                echo $c['id'];

                if ( $c['id']  5 ) {

                               $c['id']++;

                               $cats[] = $c;

                }

 }

 That's a bizarre loop... you're feeding references to elements of the array
 back into the array over which the loop is iterating. If you REALLY want to
 do what you are doing, then do the following:

 ?php

 foreach( array_keys( $cats ) as $key )
 {
    $c = $cats[$key];

    echo $c['id'];

    if( $c['id']  5 )
    {
        $c['id']++;
        $cats[] = $c;
    }
 }

 ?

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

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



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



Re: [PHP] Foreach question

2011-07-05 Thread Louis Huppenbauer
I don't think that it does this:

if ( count($elements) == 1 ) then loop 1;
else loop normally;

It's probably more something like that:

$i=count($elements);
loop:
$i--;
if($i == 0)
$last_loop = true;
else
$last_loop = false

if($last_loop)
   exit;
else
   goto loop;



But aside from that, I would propose you the same thing Robert already
did - Just use while or some other loop (for maybe?).

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




Re: [PHP] Foreach question

2011-07-05 Thread Louis Huppenbauer
Just use count($arr) in your for-header, as it get's executed again
for each loop.

?php
   $arr = array(array('id'=1), array('id'=2));
for($i=0;$icount($arr);$i++) {
echo $arr[$i]['id'];
if($i  6) {
$arr[] = array('id' = $arr[$i]['id']+1);
}
}
?

2011/7/5 Robert Cummings rob...@interjinn.com:
 On 11-07-05 10:48 AM, Dajka Tamás wrote:

 Thanks, that was interesting :) I think I got one step further in
 understanding PHP :)

 BTW, I've changed the loop to 'for' and it's working well :)

 Can you show us your for loop? I'm not immediately sure how you use a for
 loop to traverse a growing number of entries in an array without either
 updating the extents of the traversal or using for( ; ; ) which is the same
 as while( 1 ). Or are you now using the low level array traversal functions
 like reset() and next()?

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

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



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



[PHP] Manipulate Request Headers after Redirect

2011-06-24 Thread Louis Huppenbauer
Hi there!

I just have a small question concerning the http-protocol and php (and
in specific the header-function, i think).
Is it possible to manipulate the headers for the request which is sent
after a 302-header?


eg:

Response:
header('Referer: example.com');
header('Location: example.net');

Request (for the 302):
header('Referer: example.net');
header('Cache: max-age=0);


I think I need that for a login to a tomcat app from an external
php-form. As of now the Login works fine, I just have to reload the
page to actually be logged in (and that is quite a bother).


Sincerely yours
Louis

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



Re: [PHP] Manipulate Request Headers after Redirect

2011-06-24 Thread Louis Huppenbauer
Thanks for your response, but I don't think that will do.

First - SERVER_PORT is the port the apache/iis/whatever server is
working with (usually 80 or 443)
Second - That would still be manipulating the headers for the response
(As php mostly just generates the response, and not the request).

I'm thinking more and more that this is not really a php-question (as
it is server-side), but more of a js-question (client-side).

thanks anyway!
louis
2011/6/24  ad...@buskirkgraphics.com:
 Try


 If($_SERVER['SERVER_PORT'] == 302)
 {
 header('Referer: example.net');
 }


 Richard L. Buskirk

 -Original Message-
 From: Louis Huppenbauer [mailto:louis.huppenba...@gmail.com]
 Sent: Friday, June 24, 2011 3:05 AM
 To: php-general@lists.php.net
 Subject: [PHP] Manipulate Request Headers after Redirect

 Hi there!

 I just have a small question concerning the http-protocol and php (and
 in specific the header-function, i think).
 Is it possible to manipulate the headers for the request which is sent
 after a 302-header?


 eg:

 Response:
 header('Referer: example.com');
 header('Location: example.net');

 Request (for the 302):
 header('Referer: example.net');
 header('Cache: max-age=0);


 I think I need that for a login to a tomcat app from an external
 php-form. As of now the Login works fine, I just have to reload the
 page to actually be logged in (and that is quite a bother).


 Sincerely yours
 Louis

 --
 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] Manipulate Request Headers after Redirect

2011-06-24 Thread Louis Huppenbauer
Thank you for your answer!

You are more or less correct - And as I saw it to be too much work (or
just more or less impossible) I changed my approach to the problem.

I am now sending several separated request with JavaScript (jQuery to
be exact) without a 302, since I know in advance where I'll have to go
anyway.

So this issue can be considered closed!

Sincerely yours
Louis

2011/6/24 Arthur Moczulski arthur.moczul...@gmail.com:
 Hey,
 this is what I understand: you want to manipulate headers of the request
 sent by the client directly after receiving a 302 response?
 If that's the case, than read further ;)
 Any client goes through the following process while communicating with a
 web-server:
 1. get IP address from the domain (achieved thanks to DNSs)
 2. create an IP socket connection with the obtained IP address
 3. write an HTTP request through the socket
 4. receive an HTTP response from the web-server. the answer will include
 status compatible with the HTTP protocol.
 In your example this process is repeated twice:
 1. get ip of domain using dns
 2. open a connection
 3. write an http request to the socket
 4. receive http with 302 status
 (the client as an http protocol compliant software continues with the
 alternative url provided by the 302 response)
 5. get ip of domain specified as alternative url in received 302 using dns
 6. open a new connection
 7. write an http request to the newly opened socket
 8. receive http response from web-server
 Your problem is exactly between point 4 and 5. Unfortunately for you that's
 client software's work to determine what will be done next. HTTP compliant
 software (which every browser is) will follow the redirection. So, unless a
 client provides you with some way of manipulating this behaviour, which is
 quite unlikely, this can't be done.
 Javascript won't be too much help in here as js scripts loaded into the
 browser live only in the lifetime of displaying the specific response. As
 302 responses can't include any content like javascript code which can live
 in the lifetime of processing the response, so you can't control what's
 going on in here.
 The only way that comes my mind is to check if 302 response can hold any
 force behaviour sort of information which is taken under consideration by
 the client. Unfortunately, I don't think HTTP protocol specification defines
 anything like that (however something definitely worth checking).
 What you can try though is extending whole the communication between client
 and web-server. So:
 1. send the original request
 2. receive the 302 response
 3. send the request for alternative url
 4. web-server checks the referrer of the request received and sends an
 answer needed, so you receive a response which guides your client
 To achieve that you need an access to the server-side application.
 Let me know if that's any help.
 On 24 June 2011 08:37, Louis Huppenbauer louis.huppenba...@gmail.com
 wrote:

 Thanks for your response, but I don't think that will do.

 First - SERVER_PORT is the port the apache/iis/whatever server is
 working with (usually 80 or 443)
 Second - That would still be manipulating the headers for the response
 (As php mostly just generates the response, and not the request).

 I'm thinking more and more that this is not really a php-question (as
 it is server-side), but more of a js-question (client-side).

 thanks anyway!
 louis
 2011/6/24  ad...@buskirkgraphics.com:
  Try
 
 
  If($_SERVER['SERVER_PORT'] == 302)
  {
  header('Referer: example.net');
  }
 
 
  Richard L. Buskirk
 
  -Original Message-
  From: Louis Huppenbauer [mailto:louis.huppenba...@gmail.com]
  Sent: Friday, June 24, 2011 3:05 AM
  To: php-general@lists.php.net
  Subject: [PHP] Manipulate Request Headers after Redirect
 
  Hi there!
 
  I just have a small question concerning the http-protocol and php (and
  in specific the header-function, i think).
  Is it possible to manipulate the headers for the request which is sent
  after a 302-header?
 
 
  eg:
 
  Response:
  header('Referer: example.com');
  header('Location: example.net');
 
  Request (for the 302):
  header('Referer: example.net');
  header('Cache: max-age=0);
 
 
  I think I need that for a login to a tomcat app from an external
  php-form. As of now the Login works fine, I just have to reload the
  page to actually be logged in (and that is quite a bother).
 
 
  Sincerely yours
  Louis
 
  --
  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] Re: File Upload Problem

2011-04-11 Thread Louis Huppenbauer
Is there already a file with the same name?
Apparently copy won't overwrite a file on windows if it already exists.

Maybe you have the same problem ffproberen2 at dodgeit dot com had on
the php.net/move_uploaded_file manpage?

2011/4/10 tedd tedd.sperl...@gmail.com:
 At 7:15 AM +0200 4/7/11, Wojciech Kupiec wrote:

 On 06/04/11 19:10, tedd wrote:

 -snip-
 What could be wrong? What should I be looking for?

 If you really want to get help, publish your code.

 I don't think that's true. I should be able to ask a technical question with
 observations and inquire as to What's wrong? After all, what's the point
 of showing code that works on two servers, but fails on a third? Really,
 what is that going to tell you?

 As for the uploaded file exceeding max file size and file_uploads
 enabled, those are obvious and I did that investigation before I posted the
 question. They are NOT the problem.

 I also checked all the servers involved for safe_mode and open_basedir
 settings and they are set the same. Additionally, the upload_max_filesize
 and upload_tmp_dir are also set exactly the same. As such, I don't know
 what else to look for -- hence my question.

 As I said, the script works on two servers, but fails on a third.

 This is what I've learned in addition to the above:

 The script does successfully upload the file to the server in question. For
 example, I receive truth from:

 if(is_uploaded_file($_FILES['userfile']['tmp_name']))
   {
   echo('true');
   }

 I can even get the contents of the uploaded file by:

 $contents = file_get_contents($_FILES['userfile']['tmp_name']);
 echo($contents);

 -- and the contents are displayed.

 So, the file is indeed uploaded!

 What I cannot do is move the file to another location using:

 $result = move_uploaded_file($_FILES['userfile']['tmp_name'], $path . '/' .
 $_FILES['userfile']['name']);

 (Yes, all possible file paths have been investigated)

 Nor, can I copy the file by:

 $result = copy($_FILES['userfile']['tmp_name'], $path . '/' .
 $_FILES['userfile']['name']);

 The only difference I see is the server causing problems is Windows NT
 whereas the others are Linux.

 So, knowing this  -- does anyone have any idea as to what is wrong?

 Cheers,

 tedd

 --
 ---
 http://sperling.com/

 --
 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] Please help with glob

2011-04-05 Thread Louis Huppenbauer
Hi there

Since glob is actually a part of the core - Are you absolutely sure
that you're running PHP  4.3

2011/4/5 Al Mangkok almang...@gmail.com:
 Hi everyone,
 I am very new to PHP and trying to learn the glob() function. I copied
 the example on php.net :

 ?php
 foreach (glob(*.txt) as $filename) {
    echo $filename size  . filesize($filename) . \n;
 }
 ?

 When I ran the script, I got this error message:
 Fatal error: Call to undefined function  glob() in
 /usr/local/apache2/htdocs/hrms/globtest.php on line 2

 I am running PHP 5.2.17 on CentOS 4.8 . How do I compile PHP to get
 the glob function in ?
 Please help.


 --
 al

 --
 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] File locking with PHP functions

2011-04-04 Thread Louis Huppenbauer
It may not be a direct answer to your question, but...
You could just use flock() to lock the file while accessing it.

louis

2011/4/4 Paul M Foster pa...@quillandmouse.com:
 I'd like to know (from someone who knows the internals more than I do)
 whether the following functions lock files and to what extent:

 fopen($filename, 'w');

 Does this function lock the file from writes until fclose()?
 Does it lock from reads as well?

 fopen($filename, 'r+');

 Does this function lock the file from writes until fclose()?
 Does it lock the file from reads as well?

 file($filename);

 Does this function lock the file from writes until finished?
 Does it lock the file from reads as well?

 All this is in the context of a Linux/Unix web server.

 Paul

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

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



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



Re: [PHP] date problem

2011-04-02 Thread Louis Huppenbauer
Just try of March. Worked for me.


print first: .date(d-m-Y H:i:s,strtotime('first Tuesday of March
2011')).\n;
print second: .date(d-m-Y H:i:s,strtotime('second Tuesday of March
2011')).\n;
print third: .date(d-m-Y H:i:s,strtotime('third Tuesday of March
2011')).\n;
print fourth: .date(d-m-Y H:i:s,strtotime('fourth Tuesday of March
2011')).\n;
print fifth: .date(d-m-Y H:i:s,strtotime('fifth Tuesday of March
2011')).\n;


2011/4/2 Dan Dan dani.mani...@gmail.com:
 I removed the day (1 before the March), but its still giving the same
 result, i.e. different days of month with and without the 'first'. Any
 further help ?

 print first Tuesday :.date(d-m-Y H:i:s,strtotime('March 2011
 Tuesday')).\n;
 print first: .date(d-m-Y H:i:s,strtotime('March 2011 first
 Tuesday')).\n;
 print second: .date(d-m-Y H:i:s,strtotime('March 2011 second
 Tuesday')).\n;
 print third: .date(d-m-Y H:i:s,strtotime('March 2011 third
 Tuesday')).\n;
 print fourth: .date(d-m-Y H:i:s,strtotime('March 2011 fourth
 Tuesday')).\n;

 first Tuesday :01-03-2011 00:00:00
 first: 08-03-2011 00:00:00
 second: 15-03-2011 00:00:00
 third: 22-03-2011 00:00:00
 fourth: 29-03-2011 00:00:00

 Thanks
 -dani



 On Fri, Apr 1, 2011 at 9:37 AM, Daniel Brown danbr...@php.net wrote:

 On Fri, Apr 1, 2011 at 12:35, Dan Dan dani.mani...@gmail.com wrote:
  Hi Folks,
 
  I am trying to get the day of month for a particular day of week (e.g.
  Tuesday) for the first, second, third, fourth week in a month. The code i
  have seems issues in March, but works e.g. in April:
 
  print date(d-m-Y H:i:s,strtotime('1 March 2011 Tuesday'));
  01-03-2011 00:00:00
 
  print date(d-m-Y H:i:s,strtotime('1 March 2011 first Tuesday'));
  08-03-2011 00:00:00
 
  While in April, I have
 
  print date(d-m-Y H:i:s,strtotime('1 April 2011 Tuesday'));
  05-04-2011 00:00:00
 
  print date(d-m-Y H:i:s,strtotime('1 April 2011 first Tuesday'));
  05-04-2011 00:00:00
 
  Could someone help whats wrong with the technique i am trying to find
 that
  day of month. Is there any better way ?

     Because you're combining the date with the day of the week.  It so
 happens that 1 March was a Tuesday, but today - 1 April - is a Friday.
  Pick one or the other, not both.

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



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



Re: [PHP] How to check if remote machines are running using PHP and Eclipse-Require Urgent Help

2011-04-01 Thread Louis Huppenbauer
You could just periodically ping those remote machines with a
system()-call, and then write the result to a file.

2011/4/1 Santosh gunat santoshgu...@gmail.com:
 Hi,

 I am in a big problem,

 My manager gave a task,
 He want a PHP scrip which will check if the remote machines are Powered on
 and are running.
 He want this to be done using eclipse.

 He also want a log in a HTML or text file that which remote machine is
 running and which remote machine is down/powered off for each machine

 Can you help me.

 If there is another way ,to check automatically that will also be fine.But
 we want a automatic script checking and saving logs for the same.

 Thanks in advance ,

 Santosh Gunat


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



Re: [PHP] Issue with Quick Email validation

2011-03-10 Thread Louis Huppenbauer
try != instead of ==, that should do the trick.

2011/3/10  rob...@myself.com:
 Hi,
 I'm newbie to PHP and this list, possible not a new question so forgive me if 
 it's a repeat
 I have a form where I want the submitter Email ID to only be from one domain

 Here's the part I'm having issues with

                                        $domain = explode( @, $who);
                        if ( $domain[1] == company.com) {
                                        echo $domain[1];
                                        echo(h3Email invalid./h3);
                                        exit;
                                        }

 First Echo is just for me to check
 I type in a correct Email ID, say m...@company.com

 The return of this is:

 company.com
 Email invalid.


 As far as I can see this if statement should not fall in, what am I missing?