Jump to content

LDAP and session help


nadman123

Recommended Posts

The code is like this

<?php
session_start();  
define("COMPANYX_DIR", "ldap.companyx.com");
    define("COMPANYX_FILTER","o=Company x, c=au");
?>
<html>
<head>
  <title>Login</title>
</head>

<body>

    <form method="post" action="login.php">
      <center>Please log in using your Authcate Details
      </center><p />

      <table border="0" align="center" cellspacing="5">
      <tr>
        <td>Authcate Username</td>
        <td>Authcate Password</td>
      </tr>
      <tr>
        <td><input type="text" name="uname" 
          size="15"></td>
        <td><input type="password" name="pword" 
          size="15"></td>
      </tr>
      </table><p />

      <center>
        <input type="submit" value="Log in">
        <input type="reset" value="Reset">
      </center>
<?php
if(!isset($_POST["uname"]))
  {
header( "Location:login.php" );   

}
  else
  {
    	
    $LDAPconn=@ldap_connect(COMPANYX_DIR);
    if($LDAPconn)
    {
      $LDAPsearch=@ldap_search($LDAPconn,COMPANYX_FILTER,
        "uid=".$_POST["uname"]);

      if($LDAPsearch)
      {
        $LDAPinfo = @ldap_first_entry($LDAPconn,$LDAPsearch);
        if($LDAPinfo)
        {
          $LDAPresult=@ldap_bind($LDAPconn, 
            ldap_get_dn($LDAPconn, $LDAPinfo), $_POST["pword"]);
        }
        else
        {
          $LDAPresult=0;
        }
      }
      else
      {
        $LDAPresult=0;
      }
    }
    else
    {
      $LDAPresult=0;
    }

    if($LDAPresult)
    {
     header( "Location: property.php" ); 
    }
    else
    {
      echo "Invalid User";
    }
  }
?>
</body>
</html>

 

i get this error message

Warning: Cannot modify header information - headers already sent by (output started at e:\inetpub\students\fit2028\21400644\login.php:24) in e:\inetpub\students\fit2028\21400644\login.php on line 76

 

I really dont get it how to do it...the header information??? ??? ??? ??? ??? ???

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.