![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Pear Pear programming, this is a very complex subject as with using pear with php can be a difficult task for some, so lets talk pear. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Hi, For a system I'm building I would like to use the PEAR AUTH package to authenticate users against a Novell directory server. Since I didn't know anything about LDAP, I first created this PHP script for testing: <?php if ($HTTP_POST_VARS[trylogin]) { $ldapserver = 'ldap_servername'; $ldaprdn = "cn=" . $HTTP_POST_VARS[username] . ",ou=Org_location,o=org_name"; $ldappass = $HTTP_POST_VARS[password]; $ldapconn = ldap_connect($ldapserver); $ldapbind = ldap_bind($ldapconn,$ldaprdn,$ldappass); if ($ldapbind) {echo "login succesfull";} else { echo "login failed"; } } echo "<form method='post' action='$PHP_SELF'>"; ?> <h4 class='sidebar'>Sign in / Info</h4> <small><b>User Name:</b></small><br> <input type=text name='username' size=20 maxlength=254><br> <small><b>Password:</b></small><br> <input type=password name='password' size=20 maxlength=254><br> <input type='Submit' border='0' name='trylogin' value='Login'> </form> That test script worked great, so I thought it would be easy to build the same thing with PEAR:AUTH This is what I created: <?php require_once "Auth/Auth.php"; function loginFunction(){ echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">"; echo "user<input type=\"text\" name=\"username\"><br />"; echo "pass<input type=\"password\" name=\"password\"><br />"; echo "<input type=\"submit\">"; echo "</form>"; } $params = array( "host" => "ldap_servername", "port" => "389", "basedn" => "ou=org_location,o=org_name", "userdn" => "cn", "binddn" => $HTTP_POST_VARS[username] , "bindpw" => $HTTP_POST_VARS[password] , "debug" => true ); $a = new Auth("LDAP", $params, "loginFunction"); $a->start(); if ($a->getAuth()) { echo "<br/><b>User authenticated!</b>"; } else { echo "<br/><b>User not authenticated!</b>"; } ?> The problem is that whatever I do, I only get the script to say "User not authenticated!", so I think I did something wrong creating this script, I can't however find out what's wrong. Any idea's? Regards, Erik This message has been scanned for malware by SurfControl plc. www.surfcontrol.com | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: auth, ldap, problems |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| big pc problems | shug176 | Computer Systems | 11 | 01-18-2008 10:32 AM |
| Downloading problems | Mattster | Windows | 5 | 01-23-2007 9:42 AM |
| dvi on sony pcv 406 problems | moodygit41 | Video Cards and Monitors | 4 | 07-25-2006 12:48 AM |
| Signature problems | MadKad | Community Chat | 2 | 05-22-2006 6:33 PM |
| Any Problems | MADMAX | The Games | 0 | 03-24-2006 12:00 AM |
| Featured Websites | ||||
|