View Full Version : header redirect issue (probably simple?)

10-07-2008, 09:09 PM
I have a header redirect issue im having right now that I cant get figured out.
Ive used header redirect before so I know the like, simple answers about not having any text or markup before my redirect etc. please let me know if you have any idea why my login redirect doesnt go.

My output here when I enter a valid username password pair is "*correct Netid* has logged into the LDAP sucessfully. weee." Weee is in there just cause I wanted ot make sure my code was actually updating and I wasnt just running old code without knowing it:

include 'conn.php';
error_reporting(0); // Fail silently.

// Function to verify authentication credentials
function checkLogin($NetID,$password) {

if ($NetID != NULL && $password != NULL) {
$connect=ldap_connect("redacted", 636);
$return = array("dn");
$dnQuery = ldap_search( $connect, "redacted", "uid=".$NetID, $return);
$info = ldap_get_entries($connect, $dnQuery);

if(ldap_bind($connect, $dn, $password)) { return true; } else { return false; }

function checkExist($NetID) {
$query = "select *";
$query .= " from volunteer v";
$query .= " where v.netid = '$NetID'";

$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) <= 0) {
return false;
} else {
return true;

// Get passed credentials
$NetID = strtolower(trim( $_POST["NetID"] ));
$password = $_POST["password"];
$goURL = $_POST["goURL"];

// Create session hash
$hash = md5(md5($NetID) . 'redacted');

// Call the checkLogin function
if (checkLogin("$NetID", "$password")) {
// Now check if we are in the best buddies db or not
if (checkExist("$NetID")) {
// If the password clears, then start a session and move on
$_SESSION['name'] = $hash;
$_SESSION['netid'] = $NetID;
//header("Location: ../" . "bb.php" . "?NetID=$NetID");
//header("Location: ../" . "bb.php");
header("Location: testshow.php");
echo "$NetID has logged in to LDAP sucessfully. weee<br>";
else {
// User does not exist in BB database
// Handle this somehow later
echo "User not in best buddies dbase";
} else {
echo "Failure";

The commented lines for the header redirect were lines that also did not work. Any ideas masters out there?

10-08-2008, 04:57 PM
Problem resolved, Im a tool lol. One of my included files had 2 carriage returns.
Thanks to anyone who looked at my code.