php-windows Digest 30 Aug 2007 08:25:26 -0000 Issue 3319
Topics (messages 28409 through 28413):
Re: PHP Windows Installer maintainer finally joins the list
28409 by: Gustav Wiberg
28411 by: awkenney.gmail.com
28412 by: Gustav Wiberg
Re: LDAP and AD
28410 by: Elizabeth Smith
Which function?
28413 by: Gustav Wiberg
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hi there!
Back to my main problem:
I want to achieve this:
I'm about to build an Intranet. The company has Windows Server 2003 and IIS
6 installed. They also have active directory.
I want to them to able to log in without entering username and password,
This can be achieved by not allowing anonymous access. That's not problem.
The issue for me is:
How do I retrieve username of logged in user?
I want to create an explorer-like window with maps and files, but I want the
logged in user to have the same restrictions/access for diffrent folder as
they have in the real explorer.
Is there any way besides ldap I can achieve that? Is LDAP right or wrong way
to go?
/Gustav
----- Original Message -----
From: "Gustav Wiberg" <[EMAIL PROTECTED]>
To: "John Mertic" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, August 27, 2007 9:02 AM
Subject: Re: [PHP-WIN] PHP Windows Installer maintainer finally joins the
list
Hi there!
I tried this...
$ldapuser = "[EMAIL PROTECTED]";
$ldappass = "abcd";
$ad = ldap_connect("ldap://HMNR",389)
or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
$bd = ldap_bind($ad,$ldapuser,$ldappass)
or die("Couldn't bind to AD!");
And I get error:
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
Invalid credentials in C:\www\utveckling\ldap4.php on line 10
Couldn't bind to AD!
I tried this....
$ldapuser = "[EMAIL PROTECTED]";
$ldappass = "abcd";
$ad = ldap_connect("ldap://whatever",389)
or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
$bd = ldap_bind($ad,$ldapuser,$ldappass)
or die("Couldn't bind to AD!");
whatever is NOT a server, and not a computer in the network!
So this means that I find the server, but it seems something wrong with
username and password? (I know the account exists and is active). Should
I type those in another way?
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Can't
contact LDAP server in C:\www\utveckling\ldap4.php on line 10
Couldn't bind to AD!
Invalid credentials seems to be something wrong with username and
password? (after some googling) I
When I don't use username and password I don't recieve any errors.
$ad = ldap_connect(ldap://hmnr,389)
or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
$bd = ldap_bind($ad)
or die("Couldn't bind to AD!");
Why is that?
/Gustav
----- Original Message -----
From: "John Mertic" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, August 25, 2007 9:39 PM
Subject: Re: [PHP-WIN] PHP Windows Installer maintainer finally joins the
list
Here's some code I've used in the past, YMMV:
$ad = ldap_connect("ldap://{$ldapserver}",389)
or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
$bd = ldap_bind($ad,$ldapuser,$ldappass)
or die("Couldn't bind to AD!");
then continue as before
On 8/24/07, Gustav Wiberg <[EMAIL PROTECTED]> wrote:
Hi!
I've created a testaccount. and tested this simple code...
I get error code:
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
Invalid
credentials in C:\www\utveckling\ldap.php on line 14
LDAP bind failed...
The server uses Active Directory. I'm not sure if I'm typing the
username
and password correctly. Is it something you have to in Active Directory
to
activate LDAP-service?
<?php
// using ldap bind
$ldaprdn = '[EMAIL PROTECTED]'; // ldap rdn or dn
$ldappass = 'abcd'; // associated password
// connect to ldap server
$ldapconn = ldap_connect("127.0.0.1")
or die("Could not connect to LDAP server.");
if ($ldapconn) {
// binding to ldap server
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
// verify binding
if ($ldapbind) {
echo "LDAP bind successful...";
} else {
echo "LDAP bind failed...";
}
}
?>
I also tested your code with my info, with a testaccount:
<?php
$ldaprdn = '[EMAIL PROTECTED]';
$ldappass = 'abcd';
$ds = 'hmnr.hmn.se';
$dn = 'dc=hmn,dc=se';
$ldapport = 389;
$ldapconn = ldap_connect($ds, $ldapport)
or die("Could not connect to LDAP server.");
if ($ldapconn)
{
ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION,3);
ldap_set_option($ldapconn, LDAP_OPT_REFERRALS,0);
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
}
?>
Then I get this error:
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
Can't
contact LDAP server in C:\www\utveckling\ldap2.php on line 14
Is there something wrong in my dn ? hmnr is the webbserver
Best regards
/Gustav Wiberg
----- Original Message -----
From: "John Mertic" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, August 24, 2007 9:51 PM
Subject: Re: [PHP-WIN] PHP Windows Installer maintainer finally joins
the
list
> On 8/17/07, Niel Archer <[EMAIL PROTECTED]> wrote:
>
>> My own recommendation is based on the manual, and no reflection of
>> the
>> installer
>>
>> "There are several all-in-one installers over the Internet, but none
>> of
>> those are endorsed by PHP.net, as we believe that the manual
>> installation is the best choice to have your system secure and
>> optimised."
>
> That text has now been changed to:
>
> "There are several all-in-one installers over the Internet, but none
> of those are endorsed by PHP.net, as we believe that using one of the
> official windows packages from » http://www.php.net/downloads.php is
> the best choice to have your system secure and optimised."
>
> Hopefully that helps adoption out.
>
> --
> --
> John Mertic "Explaining a joke
> is like dissecting a frog: you
> [EMAIL PROTECTED] understand it better,
> but the frog dies in the
> process."
>
> -Mark Twain
>
--
--
John Mertic "Explaining a joke
is like dissecting a frog: you
[EMAIL PROTECTED] understand it better,
but the frog dies in the
process."
-Mark Twain
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I agree, the problem seems to be that you are using an invalid username or
password.
Try using an accout with domain administrator rights first. If that doesn't
work, your username may need to be in the form of
[EMAIL PROTECTED]
Or might need to be in the form of the old windows 2000 username
HMN\abcd
I don't know that for sure. It could actually be that the password is not
correct, but those are some ideas. The original format of the username always
worked for me.
Sent via BlackBerry from T-Mobile
-----Original Message-----
From: "Gustav Wiberg" <[EMAIL PROTECTED]>
Date: Mon, 27 Aug 2007 09:02:16
To:"John Mertic" <[EMAIL PROTECTED]>
Cc:<[EMAIL PROTECTED]>
Subject: Re: [PHP-WIN] PHP Windows Installer maintainer finally joins the list
Hi there!
I tried this...
$ldapuser = "[EMAIL PROTECTED]";
$ldappass = "abcd";
$ad = ldap_connect("ldap://HMNR",389)
or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
$bd = ldap_bind($ad,$ldapuser,$ldappass)
or die("Couldn't bind to AD!");
And I get error:
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Invalid
credentials in C:\www\utveckling\ldap4.php on line 10
Couldn't bind to AD!
I tried this....
$ldapuser = "[EMAIL PROTECTED]";
$ldappass = "abcd";
$ad = ldap_connect("ldap://whatever",389)
or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
$bd = ldap_bind($ad,$ldapuser,$ldappass)
or die("Couldn't bind to AD!");
whatever is NOT a server, and not a computer in the network!
So this means that I find the server, but it seems something wrong with
username and password? (I know the account exists and is active). Should I
type those in another way?
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Can't
contact LDAP server in C:\www\utveckling\ldap4.php on line 10
Couldn't bind to AD!
Invalid credentials seems to be something wrong with username and password?
(after some googling) I
When I don't use username and password I don't recieve any errors.
$ad = ldap_connect(ldap://hmnr,389)
or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
$bd = ldap_bind($ad)
or die("Couldn't bind to AD!");
Why is that?
/Gustav
----- Original Message -----
From: "John Mertic" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, August 25, 2007 9:39 PM
Subject: Re: [PHP-WIN] PHP Windows Installer maintainer finally joins the
list
> Here's some code I've used in the past, YMMV:
>
> $ad = ldap_connect("ldap://{$ldapserver}",389)
> or die("Couldn't connect to AD!");
> ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
> ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
> $bd = ldap_bind($ad,$ldapuser,$ldappass)
> or die("Couldn't bind to AD!");
>
> then continue as before
>
> On 8/24/07, Gustav Wiberg <[EMAIL PROTECTED]> wrote:
>> Hi!
>>
>> I've created a testaccount. and tested this simple code...
>>
>> I get error code:
>> Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
>> Invalid
>> credentials in C:\www\utveckling\ldap.php on line 14
>> LDAP bind failed...
>>
>> The server uses Active Directory. I'm not sure if I'm typing the username
>> and password correctly. Is it something you have to in Active Directory
>> to
>> activate LDAP-service?
>>
>>
>> <?php
>>
>> // using ldap bind
>> $ldaprdn = '[EMAIL PROTECTED]'; // ldap rdn or dn
>> $ldappass = 'abcd'; // associated password
>>
>> // connect to ldap server
>> $ldapconn = ldap_connect("127.0.0.1")
>> or die("Could not connect to LDAP server.");
>>
>> if ($ldapconn) {
>>
>> // binding to ldap server
>> $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
>>
>> // verify binding
>> if ($ldapbind) {
>> echo "LDAP bind successful...";
>> } else {
>> echo "LDAP bind failed...";
>> }
>>
>> }
>>
>> ?>
>>
>>
>>
>>
>> I also tested your code with my info, with a testaccount:
>>
>> <?php
>> $ldaprdn = '[EMAIL PROTECTED]';
>> $ldappass = 'abcd';
>> $ds = 'hmnr.hmn.se';
>> $dn = 'dc=hmn,dc=se';
>> $ldapport = 389;
>> $ldapconn = ldap_connect($ds, $ldapport)
>> or die("Could not connect to LDAP server.");
>>
>> if ($ldapconn)
>> {
>> ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION,3);
>> ldap_set_option($ldapconn, LDAP_OPT_REFERRALS,0);
>> $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
>> }
>> ?>
>>
>>
>> Then I get this error:
>> Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
>> Can't
>> contact LDAP server in C:\www\utveckling\ldap2.php on line 14
>>
>>
>> Is there something wrong in my dn ? hmnr is the webbserver
>>
>> Best regards
>> /Gustav Wiberg
>>
>> ----- Original Message -----
>> From: "John Mertic" <[EMAIL PROTECTED]>
>> To: <[EMAIL PROTECTED]>
>> Cc: <[EMAIL PROTECTED]>
>> Sent: Friday, August 24, 2007 9:51 PM
>> Subject: Re: [PHP-WIN] PHP Windows Installer maintainer finally joins the
>> list
>>
>>
>> > On 8/17/07, Niel Archer <[EMAIL PROTECTED]> wrote:
>> >
>> >> My own recommendation is based on the manual, and no reflection of the
>> >> installer
>> >>
>> >> "There are several all-in-one installers over the Internet, but none
>> >> of
>> >> those are endorsed by PHP.net, as we believe that the manual
>> >> installation is the best choice to have your system secure and
>> >> optimised."
>> >
>> > That text has now been changed to:
>> >
>> > "There are several all-in-one installers over the Internet, but none
>> > of those are endorsed by PHP.net, as we believe that using one of the
>> > official windows packages from » http://www.php.net/downloads.php is
>> > the best choice to have your system secure and optimised."
>> >
>> > Hopefully that helps adoption out.
>> >
>> > --
>> > --
>> > John Mertic "Explaining a joke
>> > is like dissecting a frog: you
>> > [EMAIL PROTECTED] understand it better,
>> > but the frog dies in the
>> > process."
>> >
>> > -Mark Twain
>> >
>>
>>
>>
>
>
> --
> --
> John Mertic "Explaining a joke
> is like dissecting a frog: you
> [EMAIL PROTECTED] understand it better,
> but the frog dies in the
> process."
>
> -Mark Twain
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi there!
Aaah. The problem was that I was forced to used HMN\abcd ... Thanx for all
feedback (from all of you!)!
Best regards
/Gustav Wiberg
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 27, 2007 2:07 PM
Subject: Re: [PHP-WIN] PHP Windows Installer maintainer finally joins the
list
I agree, the problem seems to be that you are using an invalid username or
password.
Try using an accout with domain administrator rights first. If that
doesn't work, your username may need to be in the form of
[EMAIL PROTECTED]
Or might need to be in the form of the old windows 2000 username
HMN\abcd
I don't know that for sure. It could actually be that the password is not
correct, but those are some ideas. The original format of the username
always worked for me.
Sent via BlackBerry from T-Mobile
-----Original Message-----
From: "Gustav Wiberg" <[EMAIL PROTECTED]>
Date: Mon, 27 Aug 2007 09:02:16
To:"John Mertic" <[EMAIL PROTECTED]>
Cc:<[EMAIL PROTECTED]>
Subject: Re: [PHP-WIN] PHP Windows Installer maintainer finally joins the
list
Hi there!
I tried this...
$ldapuser = "[EMAIL PROTECTED]";
$ldappass = "abcd";
$ad = ldap_connect("ldap://HMNR",389)
or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
$bd = ldap_bind($ad,$ldapuser,$ldappass)
or die("Couldn't bind to AD!");
And I get error:
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
Invalid
credentials in C:\www\utveckling\ldap4.php on line 10
Couldn't bind to AD!
I tried this....
$ldapuser = "[EMAIL PROTECTED]";
$ldappass = "abcd";
$ad = ldap_connect("ldap://whatever",389)
or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
$bd = ldap_bind($ad,$ldapuser,$ldappass)
or die("Couldn't bind to AD!");
whatever is NOT a server, and not a computer in the network!
So this means that I find the server, but it seems something wrong with
username and password? (I know the account exists and is active). Should
I
type those in another way?
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Can't
contact LDAP server in C:\www\utveckling\ldap4.php on line 10
Couldn't bind to AD!
Invalid credentials seems to be something wrong with username and
password?
(after some googling) I
When I don't use username and password I don't recieve any errors.
$ad = ldap_connect(ldap://hmnr,389)
or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
$bd = ldap_bind($ad)
or die("Couldn't bind to AD!");
Why is that?
/Gustav
----- Original Message -----
From: "John Mertic" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, August 25, 2007 9:39 PM
Subject: Re: [PHP-WIN] PHP Windows Installer maintainer finally joins the
list
Here's some code I've used in the past, YMMV:
$ad = ldap_connect("ldap://{$ldapserver}",389)
or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
$bd = ldap_bind($ad,$ldapuser,$ldappass)
or die("Couldn't bind to AD!");
then continue as before
On 8/24/07, Gustav Wiberg <[EMAIL PROTECTED]> wrote:
Hi!
I've created a testaccount. and tested this simple code...
I get error code:
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
Invalid
credentials in C:\www\utveckling\ldap.php on line 14
LDAP bind failed...
The server uses Active Directory. I'm not sure if I'm typing the
username
and password correctly. Is it something you have to in Active Directory
to
activate LDAP-service?
<?php
// using ldap bind
$ldaprdn = '[EMAIL PROTECTED]'; // ldap rdn or dn
$ldappass = 'abcd'; // associated password
// connect to ldap server
$ldapconn = ldap_connect("127.0.0.1")
or die("Could not connect to LDAP server.");
if ($ldapconn) {
// binding to ldap server
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
// verify binding
if ($ldapbind) {
echo "LDAP bind successful...";
} else {
echo "LDAP bind failed...";
}
}
?>
I also tested your code with my info, with a testaccount:
<?php
$ldaprdn = '[EMAIL PROTECTED]';
$ldappass = 'abcd';
$ds = 'hmnr.hmn.se';
$dn = 'dc=hmn,dc=se';
$ldapport = 389;
$ldapconn = ldap_connect($ds, $ldapport)
or die("Could not connect to LDAP server.");
if ($ldapconn)
{
ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION,3);
ldap_set_option($ldapconn, LDAP_OPT_REFERRALS,0);
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
}
?>
Then I get this error:
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
Can't
contact LDAP server in C:\www\utveckling\ldap2.php on line 14
Is there something wrong in my dn ? hmnr is the webbserver
Best regards
/Gustav Wiberg
----- Original Message -----
From: "John Mertic" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, August 24, 2007 9:51 PM
Subject: Re: [PHP-WIN] PHP Windows Installer maintainer finally joins
the
list
> On 8/17/07, Niel Archer <[EMAIL PROTECTED]> wrote:
>
>> My own recommendation is based on the manual, and no reflection of
>> the
>> installer
>>
>> "There are several all-in-one installers over the Internet, but none
>> of
>> those are endorsed by PHP.net, as we believe that the manual
>> installation is the best choice to have your system secure and
>> optimised."
>
> That text has now been changed to:
>
> "There are several all-in-one installers over the Internet, but none
> of those are endorsed by PHP.net, as we believe that using one of the
> official windows packages from » http://www.php.net/downloads.php is
> the best choice to have your system secure and optimised."
>
> Hopefully that helps adoption out.
>
> --
> --
> John Mertic "Explaining a joke
> is like dissecting a frog: you
> [EMAIL PROTECTED] understand it better,
> but the frog dies in the
> process."
>
> -Mark Twain
>
--
--
John Mertic "Explaining a joke
is like dissecting a frog: you
[EMAIL PROTECTED] understand it better,
but the frog dies in the
process."
-Mark Twain
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Gustav Wiberg wrote:
Hi there!
Back to my main problem:
I want to achieve this:
I'm about to build an Intranet. The company has Windows Server 2003 and
IIS 6 installed. They also have active directory.
I want to them to able to log in without entering username and password,
This can be achieved by not allowing anonymous access. That's not problem.
The issue for me is:
How do I retrieve username of logged in user?
I want to create an explorer-like window with maps and files, but I want
the logged in user to have the same restrictions/access for diffrent
folder as they have in the real explorer.
Is there any way besides ldap I can achieve that? Is LDAP right or wrong
way to go?
/Gustav
Perhaps you need to take a look at http://adldap.sourceforge.net/ -
ready to use code and support for that code. They have information on
how to use information from PHP to "autologin" the user - notice it's
only fully supported with IE transparently, other browsers you'll still
get a popup to enter a username and password.
The error you're getting means your user / password combination is wrong
(invalid credentials)
--- End Message ---
--- Begin Message ---
Hi there!
Is there ant predefined function for doing this?
I want to put text (from a database) inside quotes, like for example
Javascript:window.alert('<?php echo $dbText;?>');
Is there any function in PHP for translating $dbText into something that
Javascript would accept? (something inside quotes)
I tried with http://se.php.net/manual/sv/function.htmlentities.php but that
didn't seem to work
Best regards
/Gustav Wiberg
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.484 / Virus Database: 269.12.12/979 - Release Date: 2007-08-29
20:21
--- End Message ---