<?php
$ldapServer="ld ap://192.168.1.211";
$ldapPort="389" ;
$ldapconn=ldap_ connect($ldapSe rver,$ldapPort) ;
$ldaprdn="uid=r oot, ou=People, dc=aitc, dc=com, dc=tw";
$ldappass="abcd ";
if($ldapconn){
echo "connect to ".$ldapServ er." successfully \n<br>";
}else{
echo "can't connect to LDAP server!\n<br>";
}
if ($ldapconn) {
// binding to ldap server to give update access
$ldapbind = ldap_bind($ldap conn, $ldaprdn, $ldappass);
// verify binding
if ($ldapbind) {
echo "LDAP binding successful...\n ";
} else {
echo "LDAP binding failed...\n";
}
}
//data preparation
//I am not very sure what attribute should be filled
$data["uid"]="tester";
$data["cn"]="Tester 1";
$data["objectclas s"][0]="account";
$data["objectclas s"][1]="posixAccount" ;
$data["objectclas s"][2]="top";
$data["userpasswo rd"]="tester";
$data["loginshell "]="/usr/local/bin/bash";
$data["uidnumber"]=3100;
$data["gidnumber"]=3100;
$data["homedirect ory"]="/home/tester";
$data["gecos"]="Tester 1";
// Before ldap_add(), should check the user already exists or not
if(!ldap_add($l dapconn,"uid=te ster, ou=People, dc=aitc, dc=com,
dc=tw", $data)){
echo "There is a problem to create the account\n";
echo "Please contact your administrator!\ n";
exit;
}else{
echo "account creation successfully";
}
ldap_close($lda pconn);
?>
I used ldapbrowser to connect LDAP server(openldap ), and I can see all
the user,but I can not Add Entry,but I can Delete Entry
Then I wrote the php code above to add a new user tester(the
$data fields are all the fields of LDAP, but some fields were filled
by me randomly,like uidnumber和gidnu mber), but if
I do not fill those fields, it will occurs the following warning
message
Warning: ldap_add(): Add: Object class violation in
d:\AppServ\www\ LDAP_test1.ph
p on line 74
There is a problem to create the account
Please contact your administrator!
But I found the biggest problem is : my ldap server can not replace
the login order, i.e, I want to build accounts/passwords in openldap
server, then users can use the account/password in ldap server and
login freebsd server. But when I use the above php code to create a
tester account, the user "tester" still can not use tester/tester to
login freebsd host, why? Could you tell me.
Thanks in advanced.
-jiing- 0 1634 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: MickBim |
last post by:
Hi,
I'm developping a module in PHP to get the users of a LDAP server and
add them in a Postgre database, where normal users are too.
I've managed to do this "easily" but now a new problem shows up.
When a user tries to logon onto the platform, I have to verify whether
he is a normal user or not. If he is a normal user, I check the login
and password basically, with just a select into the database.
|
by: dmcconkey |
last post by:
Hi folks,
I've been searching for a while and haven't found my specific question
anywhere else. If this has already been asked, please accept my
appologies and point me to the appropriate thread.
I'm bidding on a PHP intranet development contract. One of the specific
requirements is that the app interface with the company's existing Open
LDAP server for user authentication.
|
by: mrwoopey |
last post by:
Hi,
I am using the example "Authenticate against the Active Directory by
Using Forms Authentication and Visual Basic .NET":
http://support.microsoft.com/default.aspx?scid=KB;EN-US;326340
But I am having a problem figuring out the LDAP://
The LDAP:// that I pass looks like this (i substitued generic the
|
by: Andrew |
last post by:
Hey all,
Working on revamping our Intranet here and making use of the LDPA, Active
Directory, Directory Services, etc. that .Net provides. I am still fairly
new on this subject, so the problem I have run into I am not sure how to
fix, and really not sure what is causing it.
Here's what is going on (test server - Windows 2003 Server):
I have a page in a folder (under anonymous authentication in IIS6) that has
a link on it that...
|
by: duncan beaumont |
last post by:
Hi,
- SQLserver 2000
- Yellowfin 2.4
- Windows 2003 server
I have been asked to investigate seting up LDAP authentication to
access our
Yellowfin reporting.
| |
by: RJN |
last post by:
Hi
I've written a code that queries Windows LDAP server and works fine, but
the same doesn't work when querying Solaris LDAP server.
DirectoryEntry de = new DirectoryEntry("LDAP://server.com");
DirectorySearcher ds = new DirectorySearcher(de);
de.Username = "xxx";
de.Password = "yyy";
de.AuthenticationType = AuthenticationTypes.Secure;
|
by: jesbuddy07 |
last post by:
Hello,
I'm using IIS 5 and PHP 4.3.5.
I have an html page, page1, that resides at member.company.com server.
It contains a form asking a user to login. I then check the login by
connecting to LDAP.company.com and bind the provided username and
password to the LDAP server. if the user is authenticated by LDAP then
i direct users to a second page, page 2. On page 2, i have a link to a
file that resides in a protected virtual directory....
|
by: MrHelpMe |
last post by:
Sorry everyone,
NOTE: I have posted this question to another site but unfortunately,
am not getting the answers I need only because those helping haven't
worked with ASP.
I am in desperate need of a fix. I am using classic asp and making a
connection to LDAP server using SQL code under IIS 5 on my localhost
and it works great. I have a form and form fields that pull from
active directory. Now, once I get the web team to deploy these...
|
by: Erick Perez - Quadrian Enterprises, S.A. |
last post by:
Hi,
I have a MS Windows AD domain, and have one OU with more tan 1000 users
objects. When I try to read it, I hit the 1000 limit of AD while returning
objects, so I'm asking for advice as to how to read them.
Here is my actual code, it is not the cleanest as I am learning python.
Suggestions are welcomed :)
Runnig this script on RedHat 5.x with "python zimbra2.py" returns:
{'info': '', 'desc': 'Size limit exceeded'}
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |