Computer Webmaster Gaming Console Graphics Forum

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.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > Pear
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

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.

Google
Reply
 
LinkBack Thread Tools Display Modes
Old 05-20-2007, 5:34 PM   #1
Erik Lemcke
 
Erik Lemcke's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default AUTH with LDAP problems

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

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Featured Websites
Free Space
Free Space
Free Space Free Space
Reply
Tags: , ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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




All times are GMT +1. The time now is 10:54 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98