php-general Digest 2 Dec 2010 03:44:30 -0000 Issue 7065

2010-12-01 Thread php-general-digest-help

php-general Digest 2 Dec 2010 03:44:30 - Issue 7065

Topics (messages 309787 through 309808):

Re: $_POST issues
309787 by: Richard Quadling
309788 by: Daniel P. Brown
309789 by: Bundhoo M Nadim
309790 by: Jay Blanchard
309791 by: Marc Guay
309792 by: Richard Quadling
309793 by: Bundhoo M Nadim
309794 by: Marc Guay
309795 by: Richard Quadling
309796 by: Jay Blanchard
309798 by: Marc Guay
309799 by: Steve Staples
309800 by: Bundhoo M Nadim
309801 by: Bundhoo M Nadim
309802 by: Daniel P. Brown
309803 by: Bundhoo M Nadim
309804 by: Daniel P. Brown
309805 by: Bundhoo M Nadim
309806 by: Daniel P. Brown

Re: code quest
309797 by: Jim Lucas
309808 by: Kirk Bailey

Re: LDAP, Active Directory, and permissions
309807 by: Tommy Pham

Administrivia:

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

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

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


--
---BeginMessage---
On 1 December 2010 14:50, Bundhoo M Nadim na...@alienworkers.com wrote:
 Hello,

 Can someone explain me what this piece of code basically does ?

 ?php
    header(Expires:  . gmdate(D, d M Y H:i:s, time() + (0*60)) . GMT);
    header(Pragma: no-cache);
    print REDIRECT=http://www.domaine.com/page.php?;;
    $param = http_build_query($_POST);
    print $param;
    exit(0);
 ?

 Well, the code is redirecting to some page with query string constructed
 using the $_POST data.

 My problem is not the redirection; but all I want is to get the data in
 $_POST

 If I just put only this piece of code:

 ?php
    var_dump($_POST);
 ?

 i get nothing. But the above codes is successfully redirecting me to
 page.php with a properly constructed query string - which means that $_POST
 was never empty. So why var_dump($_POST) is returning just array(0) { } ???

 nadim attari
 alienworkers.com


Under normal circumstances, $_POST will only be populated from a
form with a method=post.

So, loading a URL to a PHP script containing just the var_dump() will
never output anything for $_POST as the URL wasn't the result of a
POST'd form.

You can also use cURL or stream_contexts to construct the data for
POST-ing and your script would receive these correctly.




-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
---End Message---
---BeginMessage---
On Wed, Dec 1, 2010 at 09:50, Bundhoo M Nadim na...@alienworkers.com wrote:

 If I just put only this piece of code:

 ?php
    var_dump($_POST);
 ?

 i get nothing. But the above codes is successfully redirecting me to
 page.php with a properly constructed query string - which means that $_POST
 was never empty. So why var_dump($_POST) is returning just array(0) { } ???

Are you actually posting data to it?

-- 
/Daniel P. Brown
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/
---End Message---
---BeginMessage---

On 01/12/2010 19:01, Daniel P. Brown wrote:

On Wed, Dec 1, 2010 at 09:50, Bundhoo M Nadimna...@alienworkers.com  wrote:

If I just put only this piece of code:

?php
var_dump($_POST);
?

i get nothing. But the above codes is successfully redirecting me to
page.php with a properly constructed query string -  which means that $_POST
was never empty. So why var_dump($_POST) is returning just array(0) { } ???

 Are you actually posting data to it?



Actually this is the response page, i.e. a payment gateway is sending 
the result of a transaction to this page. Normally I expect to catch the 
data sent by the payment gateway using the $_POST array, i.e. $result = 
$_POST['result'], etc.


So i wanted to check the data sent by the payment gateway using 
var_dump($_POST); --- this gives me array(0) { }


But if I put the other codes (lemme quote again here):

filename: response.php

?php

 header(Expires:  . gmdate(D, d M Y H:i:s, time() + (0*60)) . GMT);
 header(Pragma: no-cache);
 print REDIRECT=http://www.domaine.com/page.php?;;
 $param = http_build_query($_POST);
 print $param;
 exit(0);
 ?



It successfully redirects me to page.php + the properly constructed query string
e.g.: http://www.domain.com/page.php?var1=val1var2=val2 ... etc

That's baffling me. Why can't I catch the $_POST data in this response.php but 
I get them in page.php ??

Something weird.

nadim attari
alienworkers.com








---End Message---
---BeginMessage---
[snip]
 If I just put only this piece of code:

 ?php
 var_dump($_POST);
 ?

 i get nothing.
[/snip]

Where are you putting this var_dump?








---End Message---
---BeginMessage---
 ?php
    var_dump($_POST);
 ?

Where exactly are you putting this line?
---End 

RE: [PHP] LDAP, Active Directory, and permissions

2010-12-01 Thread Bob McConnell
From: Chris Knipe

 I've found various sources and are successfully manipulating Active
 Directory from PHP on our Domain Controller - frankly, things works
much
 better than I expected :)
 
 I have now reached the point where I need to set permissions on
objects in
 Active Directory, i.e. to restrict read permissions to certain OUs and
 objects within the directory (mainly related to Exchange stuff).
 
 Is there anything in PHP which can be used to set permissions on AD
 objects?  I haven't found any reference to doing this anywhere, so I
thought
 I'd give it a chance here... If not, then I suppose I'll have to code
some
 ..NET application to act as a gateway between the PHP interface and
Active
 Directory, but naturally I would like to do as much as possible from
within
 PHP itself.

I don't know about your IT group, but around here and at any of our
clients, they will never allow anyone outside their office modify access
rights, or add users. It takes a written request by a manager or above
to get them to make any changes, and each request must include the
reasons for the change.

No we cannot use the master LDAP server for testing. We have a couple of
OpenLDAP servers isolated on our test networks for that. But even those
have to be managed directly. No application is allowed to do more than
retrieve data.

Bob McConnell

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



[PHP] $_POST issues

2010-12-01 Thread Bundhoo M Nadim

Hello,

Can someone explain me what this piece of code basically does ?

?php
header(Expires:  . gmdate(D, d M Y H:i:s, time() + (0*60)) . 
GMT);

header(Pragma: no-cache);
print REDIRECT=http://www.domaine.com/page.php?;;
$param = http_build_query($_POST);
print $param;
exit(0);
?

Well, the code is redirecting to some page with query string constructed 
using the $_POST data.


My problem is not the redirection; but all I want is to get the data in 
$_POST


If I just put only this piece of code:

?php
var_dump($_POST);
?

i get nothing. But the above codes is successfully redirecting me to 
page.php with a properly constructed query string - which means that 
$_POST was never empty. So why var_dump($_POST) is returning just 
array(0) { } ???


nadim attari
alienworkers.com


Re: [PHP] $_POST issues

2010-12-01 Thread Richard Quadling
On 1 December 2010 14:50, Bundhoo M Nadim na...@alienworkers.com wrote:
 Hello,

 Can someone explain me what this piece of code basically does ?

 ?php
    header(Expires:  . gmdate(D, d M Y H:i:s, time() + (0*60)) . GMT);
    header(Pragma: no-cache);
    print REDIRECT=http://www.domaine.com/page.php?;;
    $param = http_build_query($_POST);
    print $param;
    exit(0);
 ?

 Well, the code is redirecting to some page with query string constructed
 using the $_POST data.

 My problem is not the redirection; but all I want is to get the data in
 $_POST

 If I just put only this piece of code:

 ?php
    var_dump($_POST);
 ?

 i get nothing. But the above codes is successfully redirecting me to
 page.php with a properly constructed query string - which means that $_POST
 was never empty. So why var_dump($_POST) is returning just array(0) { } ???

 nadim attari
 alienworkers.com


Under normal circumstances, $_POST will only be populated from a
form with a method=post.

So, loading a URL to a PHP script containing just the var_dump() will
never output anything for $_POST as the URL wasn't the result of a
POST'd form.

You can also use cURL or stream_contexts to construct the data for
POST-ing and your script would receive these correctly.




-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] $_POST issues

2010-12-01 Thread Daniel P. Brown
On Wed, Dec 1, 2010 at 09:50, Bundhoo M Nadim na...@alienworkers.com wrote:

 If I just put only this piece of code:

 ?php
    var_dump($_POST);
 ?

 i get nothing. But the above codes is successfully redirecting me to
 page.php with a properly constructed query string - which means that $_POST
 was never empty. So why var_dump($_POST) is returning just array(0) { } ???

Are you actually posting data to it?

-- 
/Daniel P. Brown
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

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



Re: [PHP] $_POST issues

2010-12-01 Thread Bundhoo M Nadim

On 01/12/2010 19:01, Daniel P. Brown wrote:

On Wed, Dec 1, 2010 at 09:50, Bundhoo M Nadimna...@alienworkers.com  wrote:

If I just put only this piece of code:

?php
var_dump($_POST);
?

i get nothing. But the above codes is successfully redirecting me to
page.php with a properly constructed query string -  which means that $_POST
was never empty. So why var_dump($_POST) is returning just array(0) { } ???

 Are you actually posting data to it?



Actually this is the response page, i.e. a payment gateway is sending 
the result of a transaction to this page. Normally I expect to catch the 
data sent by the payment gateway using the $_POST array, i.e. $result = 
$_POST['result'], etc.


So i wanted to check the data sent by the payment gateway using 
var_dump($_POST); --- this gives me array(0) { }


But if I put the other codes (lemme quote again here):

filename: response.php

?php

 header(Expires:  . gmdate(D, d M Y H:i:s, time() + (0*60)) . GMT);
 header(Pragma: no-cache);
 print REDIRECT=http://www.domaine.com/page.php?;;
 $param = http_build_query($_POST);
 print $param;
 exit(0);
 ?



It successfully redirects me to page.php + the properly constructed query string
e.g.: http://www.domain.com/page.php?var1=val1var2=val2 ... etc

That's baffling me. Why can't I catch the $_POST data in this response.php but 
I get them in page.php ??

Something weird.

nadim attari
alienworkers.com










Re: [PHP] $_POST issues

2010-12-01 Thread Marc Guay
 ?php
    var_dump($_POST);
 ?

Where exactly are you putting this line?

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



RE: [PHP] $_POST issues

2010-12-01 Thread Jay Blanchard
[snip]
 If I just put only this piece of code:

 ?php
 var_dump($_POST);
 ?

 i get nothing.
[/snip]

Where are you putting this var_dump?









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



Re: [PHP] $_POST issues

2010-12-01 Thread Richard Quadling
On 1 December 2010 15:18, Marc Guay marc.g...@gmail.com wrote:
 ?php
    var_dump($_POST);
 ?

 Where exactly are you putting this line?

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



If a script is ran via a url like ...

http://www.site.com/script.php?var1=val1var2=val2

then $_GET will contain the result.

The same $_GET would hold the values from a form method=get

$_POST is for POST-d data (either via form method=post or cURL/Streams).



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] $_POST issues

2010-12-01 Thread Nadim Attari

On 12/01/2010 07:18 PM, Jay Blanchard wrote:

[snip]

If I just put only this piece of code:

?php
 var_dump($_POST);
?

i get nothing.

[/snip]

Where are you putting this var_dump?




That's the only code on the page. Otherwise, the other codes - header(), 
print, etc. are on the page.


nadim

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



Re: [PHP] $_POST issues

2010-12-01 Thread Marc Guay
The function http_build_query() is turning your $_POST array into a
query string ($_GET), so the answer to this really depends where
you're trying to dump the array.

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



Re: [PHP] $_POST issues

2010-12-01 Thread Richard Quadling
On 1 December 2010 14:50, Bundhoo M Nadim na...@alienworkers.com wrote:
 Hello,

 Can someone explain me what this piece of code basically does ?

 ?php
    header(Expires:  . gmdate(D, d M Y H:i:s, time() + (0*60)) . GMT);
    header(Pragma: no-cache);
    print REDIRECT=http://www.domaine.com/page.php?;;
    $param = http_build_query($_POST);
    print $param;
    exit(0);
 ?

 Well, the code is redirecting to some page with query string constructed
 using the $_POST data.

 My problem is not the redirection; but all I want is to get the data in
 $_POST

 If I just put only this piece of code:

 ?php
    var_dump($_POST);
 ?

 i get nothing. But the above codes is successfully redirecting me to
 page.php with a properly constructed query string - which means that $_POST
 was never empty. So why var_dump($_POST) is returning just array(0) { } ???

 nadim attari
 alienworkers.com


I'd start reading http://docs.php.net/manual/en/reserved.variables.php

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



RE: [PHP] $_POST issues

2010-12-01 Thread Jay Blanchard
[snip]
 Where are you putting this var_dump?



That's the only code on the page. Otherwise, the other codes - header(),

print, etc. are on the page.
[/snip]

var_dumping the POST on the same page from which the data originates
will not yield anything.

Page A - contains data to be posted.
Page B - receives posted data (do var_dump here)

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



Re: [PHP] code quest

2010-12-01 Thread Jim Lucas
On 11/26/2010 4:03 PM, Kirk Bailey wrote:
 Hello all, my name is Kirk Bailey, and I am new to php, so please be 
 forbearing.
 I code in python, and am trying to learn this language as our new client runs 
 a
 web business based in it.
 
 I need a routine that will return a list of every directory immediately under
 the current directory- but nothing else, just a list of directories, 1 level
 deep, NO FILES, no listing of current dir or prior dir either.
 
 Now in python, I would use os.walk, and use the list of dirs and throw the 
 other
 2 lists away, but this ain't Kansas anymore. Does php even DO lists?
 
 Um, a list is a 1 dimenional array, if have a list ALIST and you plug in 3, 
 you
 get back the contents of cell 3 in the list, whaqtever that content is. so if
 cell 3 in a 6 celled list was Ruby then ALIST[3] would return the string 
 ruby.
 
 It's easy to iterate lists. For instance:
 
print 'ul'
for dir in ALIST:
print 'lia href=\/dir,dir,'/a
print '/ul
 
 This would let me produce an ordered list of directories, each a link to that
 directory.
 This way, when a client installs a new product, the home page area listing
 products offered automatically updates.
 
 Further embellishment would let me replace the dir name with a BRIEF 
 description
 from a descriptor file read from that dir. Now how to do this in php?
 

This should do.

The only problem that I foresee would be an empty ul/ul if you have no
directories returned by glob().

print('ul');
foreach ( glob('./*', GLOB_ONLYDIR) AS $dir )
  print('lia href=\'.$dir.'\'.$dir.'/a/li');
print('/ul');


Jim Lucas

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



Re: [PHP] $_POST issues

2010-12-01 Thread Marc Guay
This thread is a really good example of how difficult it can be to
both explain and understand a problem.  The original poster might want
to restate the question from scratch with a more explicit and complete
example.

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



Re: [PHP] $_POST issues

2010-12-01 Thread Steve Staples
On Wed, 2010-12-01 at 20:18 +0400, Nadim Attari wrote:
 On 12/01/2010 07:18 PM, Jay Blanchard wrote:
  [snip]
  If I just put only this piece of code:
 
  ?php
   var_dump($_POST);
  ?
 
  i get nothing.
  [/snip]
 
  Where are you putting this var_dump?
 
 
 
 That's the only code on the page. Otherwise, the other codes - header(), 
 print, etc. are on the page.
 
 nadim
 

if i follow correctly, your form submits via:
form method=post action=response.php

then you redirect to the page.php, and it puts the $_POST variables into
the url string... and that works fine.

and now, you're trying to get the variables from the page.php, using the
$_POST method?   wouldn't you want to be checking the $_GET on this
page, as they would be coming in from the url string?


Steve


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



[PHP] Re: $_POST issues

2010-12-01 Thread Nadim Attari

On 12/01/2010 08:56 PM, Nadim Attari wrote:

On 12/01/2010 06:50 PM, Bundhoo M Nadim wrote:

Hello,

Can someone explain me what this piece of code basically does ?

?php
header(Expires:  . gmdate(D, d M Y H:i:s, time() + (0*60)) . GMT);
header(Pragma: no-cache);
print REDIRECT=http://www.domaine.com/page.php?;;
$param = http_build_query($_POST);
print $param;
exit(0);
?

Well, the code is redirecting to some page with query string constructed
using the $_POST data.

My problem is not the redirection; but all I want is to get the data in
$_POST

If I just put only this piece of code:

?php
var_dump($_POST);
?

i get nothing. But the above codes is successfully redirecting me to
page.php with a properly constructed query string - which means that
$_POST was never empty. So why var_dump($_POST) is returning just
array(0) { } ???

nadim attari
alienworkers.com




Hello all,

Perhaps I am not being able to explain you my problem correctly (sorry
my poor English)

Here is the tests i'm doing:
http://www.yulounge.com/_sbm/servlet/send_transaction.php

And you can get the codes here:
http://www.yulounge.com/_sbm/servlet/servlet.zip

I've got these codes from them at SBM. I'm asking myself this question:

Why can't I get the values of $_POST (response.php in the example) but
the page is able to http_build_query() using the same $_POST ??

To demonstrate what I am trying to figure out, please try this one also:

http://www.yulounge.com/_sbm/example2/send_transaction.php
Codes: http://www.yulounge.com/_sbm/example2/var_dump.zip

In this example2, only the page response.php has been changed.

Thx in advance,

Nadim Attari
Alienworkers.com




Sorry If you already done tests or downloaded example2. I made a mistake 
specifying the response and error urls. I've corrected it on the server.


You can test / download example 2.

nadim attari
alienworkers.com

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



Re: [PHP] Re: $_POST issues

2010-12-01 Thread Nadim Attari

On 12/01/2010 10:08 PM, Daniel P. Brown wrote:

On Wed, Dec 1, 2010 at 12:15, Nadim Attarina...@alienworkers.com  wrote:


where does receipt.php gets the $_GET data ? Isn't it from response.php
where the $_POST data are being http_build_query()'ed ??

$param = http_build_query($_POST);-


 According to cURL, it's never even hitting response.php to
redirect.  It's going straight to receipt.php with $_GET data.  (THERE
IS NO $_POST DATA.)

 Besides, you kept stating that the 'redirect' was working fine,
which is technically incorrect: there's absolutely zero chance that
works as you presented it.  You can't just throw in some text to tell
the browser to redirect to a page.  You'd have to do a
header(Location: ); call, a meta refresh, a JavaScript
window.location() call or something similar.  Thus that indicates that
the text from response.php is interpreted as a direction by the
processing gateway's API when it calls out to your server.

 Knowing this, I see the $_POST data expected here.  This wasn't in
question, as it's obviously building the query string.  We now know
that it feeds this data in plain text back to the remote server for
further processing, which then directs the browser to receipt.php ---
with $_GET data (id est - THERE IS NO $_POST DATA).

 Your browser is never hitting response.php.  Only the remote
server is doing that.  If you want to get the data as sent by the
remote server to your server in response.php, you'll either need to
write that to a file like I did:

 file_put_contents('output.nadim.log',$param);

 Or you'll need to consult the processing gateway's API
documentation to learn how to avoid requiring this seemingly
unnecessary step.




Thank you Daniel for this detailed post of yours. Really appreciated.


Saving the $_POST data (in response.php) in a file will serve nothing. - 
And you said this was an unnecessary step from the payment gateway - All 
i need is the result of the transaction, which I'll get in receipt.php 
thr' $_GET.


All I can say is that I do not have any control on the payment gateway 
(you may realise it has been badly implemented - if it is not too harsh 
to say like that)


Another unnecessary step occurs in send_transaction.php - you have seen 
that once the XML data is sent to the payment gateway (well SBM asked me 
to send like that - i mean no declaration, just the tags), the gateway 
sends back paymentid and paymentpageurl and i have to redirect my 
browser to that page, concatenating the paymentid in the query string. 
--- this should have been done automatically by the payment gateway 
itself. Really baffling.



I think I'll report this to my boss, who shall contact the client (YU 
Lounge). Now up to the client to decide whether they'll be doing 
business with SBM payment gateway solution or not.


BTW, would you recommend someone to use this payment gateway ? What are 
your comments on such payment gateway implementation ?


Anyway thanks again for your time and help Daniel.

Best regards,

Nadim Attari
Alienworkers.com

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



Re: [PHP] Re: $_POST issues

2010-12-01 Thread Daniel P. Brown
On Wed, Dec 1, 2010 at 16:32, Nadim Attari na...@alienworkers.com wrote:

 Thank you Daniel for this detailed post of yours. Really appreciated.

Quite welcome.

 Saving the $_POST data (in response.php) in a file will serve nothing. - And
 you said this was an unnecessary step from the payment gateway - All i need
 is the result of the transaction, which I'll get in receipt.php thr' $_GET.

 All I can say is that I do not have any control on the payment gateway (you
 may realise it has been badly implemented - if it is not too harsh to say
 like that)

Not too harsh at all.  If anything, you're being too kind.  ;-P

 Another unnecessary step occurs in send_transaction.php - you have seen that
 once the XML data is sent to the payment gateway (well SBM asked me to send
 like that - i mean no declaration, just the tags), the gateway sends back
 paymentid and paymentpageurl and i have to redirect my browser to that
 page, concatenating the paymentid in the query string. --- this should have
 been done automatically by the payment gateway itself. Really baffling.

I agree.  It seems as though it's a very clunky setup, unless
there's a different way it's supposed to be done that their API docs
explain.

 I think I'll report this to my boss, who shall contact the client (YU
 Lounge). Now up to the client to decide whether they'll be doing business
 with SBM payment gateway solution or not.

 BTW, would you recommend someone to use this payment gateway ? What are your
 comments on such payment gateway implementation ?

I'd honestly never heard of this service until you submitted the
original post in this thread.  However, knowing what we've already
ascertained in this short time, as well as other things I've noticed,
I would highly advise against using the service.  Three key issues I
see are: (1) unnecessary processes and slow response times; (2)
insecurities, including data disclosure and plain-text GET/POST calls;
(3) poor data validation and error handling.  If the client would
permit the use of another service, I'd recommend researching some of
the alternatives.

 Anyway thanks again for your time and help Daniel.

My pleasure.

-- 
/Daniel P. Brown
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

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



RE: [PHP] LDAP, Active Directory, and permissions

2010-12-01 Thread Tommy Pham
 -Original Message-
 From: Bob McConnell [mailto:r...@cbord.com]
 Sent: Wednesday, December 01, 2010 5:23 AM
 To: Chris Knipe; php-general@lists.php.net
 Subject: RE: [PHP] LDAP, Active Directory, and permissions
 
 From: Chris Knipe
 
  I've found various sources and are successfully manipulating Active
  Directory from PHP on our Domain Controller - frankly, things works
 much
  better than I expected :)
 
  I have now reached the point where I need to set permissions on
 objects in
  Active Directory, i.e. to restrict read permissions to certain OUs and
  objects within the directory (mainly related to Exchange stuff).
 
  Is there anything in PHP which can be used to set permissions on AD
  objects?  I haven't found any reference to doing this anywhere, so I
 thought
  I'd give it a chance here... If not, then I suppose I'll have to code
 some
  ..NET application to act as a gateway between the PHP interface and
 Active
  Directory, but naturally I would like to do as much as possible from
 within
  PHP itself.
 
 I don't know about your IT group, but around here and at any of our
clients,
 they will never allow anyone outside their office modify access rights, or
 add users. It takes a written request by a manager or above to get them to
 make any changes, and each request must include the reasons for the
 change.
 
 No we cannot use the master LDAP server for testing. We have a couple of
 OpenLDAP servers isolated on our test networks for that. But even those
 have to be managed directly. No application is allowed to do more than
 retrieve data.
 
 Bob McConnell
 

It's the same with my past work environments.  All changes (except password)
must be requested prior and is recorded.  It seems that Chris' environment
is too wide open and easily hackable.  Chris, just an FYI, the majority of
the hacks are done from the inside of the network.

Regards,
Tommy


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



Re: [PHP] code quest

2010-12-01 Thread Kirk Bailey
Daniel, this is so close to bang on it's unbelivable. Only prob is my 
host provided me with this $^@%^^$! dir which is named .smileys, which 
holds icons for use in the control panel. It should NOT list it, nor 
list the /cgi-bin, nor /images. Can it somehow exclude those 3, or maybe 
a list of things not to notice?


Also, how compatible is it with SSI includes? If part of the echo is an 
ssi include statement, will it work right? Hmmm...




Daniel P. Brown wrote:

On Fri, Nov 26, 2010 at 19:03, Kirk Bailey kbai...@howlermonkey.net wrote:
  

I need a routine that will return a list of every directory immediately
under the current directory- but nothing else, just a list of directories, 1
level deep, NO FILES, no listing of current dir or prior dir either.



Simple:

?php

$ls = scandir(dirname(__FILE__));

foreach ($ls as $d) {
if (is_dir($d)  $d != '.'  $d != '..') {
echo 'a href='.$d.''.$d.'/abr/'.PHP_EOL;
}
}
?

   If you want something more powerful - and often quicker - check
into SPL: specifically FilesystemIterator[1], DirectoryIterator[2],
and RecursiveDirectoryIterator[3].  A quick example to link all child
files and directories with relative linking:

?php

$path = dirname(__FILE__);
$list = new RecursiveIteratorIterator(new
RecursiveDirectoryIterator($path));

foreach ($list as $k = $v) {
if (!preg_match('/\./',$v)) {
$v = str_replace($path.'/',null,$v); // We only want
relative linking
echo 'a href='.$v.''.$v.'/abr/'.PHP_EOL;
}
}
?

  


--
end

Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



Re: [PHP] code quest

2010-12-01 Thread Kirk Bailey
OK, answered my own question; no, an ssi statement inside a php echo 
statement is simply sent out as is, unparxsed. But if it is external to 
the php area, it works fine, so we have to include a function in there 
that will read anything I want to spew- like the 1 line contents of a 
desciptor file in a particular directory.


The idea is to create a directory lister which reads a descriptor for 
that folder and uses it as the text for the link.



Daniel P. Brown wrote:

On Sat, Nov 27, 2010 at 12:36, Daniel P. Brown
daniel.br...@parasane.net wrote:
  

  If you want something more powerful - and often quicker - check
into SPL: specifically FilesystemIterator[1], DirectoryIterator[2],
and RecursiveDirectoryIterator[3].  A quick example to link all child
files and directories with relative linking:



Might help to provide the key as well, eh?  Sorry

^1: http://php.net/filesystemiterator
^2: http://php.net/directoryiterator
^3: http://php.net/recursivedirectoryiterator

  


--
end

Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



Re: [PHP] code quest

2010-12-01 Thread Kirk Bailey

OK, the quest thus far:
html
head
TITLEphp experimental page/TITLE
style TYPE=text/css
body { margin-left: 5%; margin-right: 5%; }
A:link, A:visited,  A:active { text-decoration:none; }
A:hover { text-decoration:underline; }
/style
/head
BODY text=00 bgcolor=FF
h2 align=centerSubdirectory listing experimental menuing page/h1P
ul
?php
$ls = scandir(dirname(__FILE__));
foreach ($ls as $d) {
   if (is_dir($d)  $d != '.'  $d != '..') {
   echo 'lia href='.$d.''.$d.'/abr/'.PHP_EOL;
   }
}
?
/ul
P
nbsp;
/body
/html
The results may be seen on this page:
   http://www.howlermonkey.net/dirlisting.php
Can this be improved to exclude anything with a '.' or a '-' in it's 
name? This will exclude the smileys and cgi-bin and such. If it can be 
persuaded to read a 1 line description from each subdirectory it could 
then use THAT as the text in the link, instead of the name. This could 
be useful in many settings.


Daniel P. Brown wrote:

On Fri, Nov 26, 2010 at 19:03, Kirk Bailey kbai...@howlermonkey.net wrote:
  

I need a routine that will return a list of every directory immediately
under the current directory- but nothing else, just a list of directories, 1
lev


Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



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