Results 1 to 2 of 2

Thread: header redirect issue (probably simple?)

  1. #1
    Join Date
    Jun 2008
    Posts
    53
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default header redirect issue (probably simple?)

    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:

    Code:
    <?php
    require("ndinf.php");
    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);
    		$dn=$info[0]["dn"];
    		
    		if(ldap_bind($connect, $dn, $password)) { return true; } else { return false; }
    		ldap_close($connect);
    	}
    }
    
    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_start();
    		$_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>";
    		//loadInfo($NetID);
    	}
    	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?

  2. #2
    Join Date
    Jun 2008
    Posts
    53
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    Problem resolved, Im a tool lol. One of my included files had 2 carriage returns.
    Thanks to anyone who looked at my code.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •