nadman123 Posted September 26, 2008 Share Posted September 26, 2008 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 https://forums.phpfreaks.com/topic/125912-ldap-and-session-help/ Share on other sites More sharing options...
BlueStryke Posted September 26, 2008 Share Posted September 26, 2008 header( "Location:login.php" ); header( "Location: property.php" ); Must come before any HTML. Link to comment https://forums.phpfreaks.com/topic/125912-ldap-and-session-help/#findComment-651104 Share on other sites More sharing options...
nadman123 Posted September 26, 2008 Author Share Posted September 26, 2008 if you put headers before htmls how do you run the script ??? ??? ??? can you be more specify? Link to comment https://forums.phpfreaks.com/topic/125912-ldap-and-session-help/#findComment-651108 Share on other sites More sharing options...
BlueStryke Posted September 26, 2008 Share Posted September 26, 2008 Headers are sent once HTML is produced. If you try to edit headers once HTML is produced, PHP will say "headers already been sent". Thus you have to put your script BEFORE any HTML. I do not know the details about your script, but you have to make it work by putting it above HTML. Link to comment https://forums.phpfreaks.com/topic/125912-ldap-and-session-help/#findComment-651109 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.