I've searched to find a resolution to problem, but the results were too complex, or too simple.
I have a basic login box to my site. I have an LDAP server that I query, to pull in the username's information, i.e. positiontitle.
I have a table named group_id, with a column named title. I want to query the column to find a match of the user's positiontitle from LDAP, in the DB. So, the query will need to include a variable. If there is a match, the user will be directed to a certain page on my site. If no match, go somewhere else. Any suggestions?
This pulls in the info from LDAP
function getEmpInfo(){
<?php
$ldap = new WIN_LDAP('DEV');
$empNum = $_REQUEST['employeeNumber'];
$empResults = @$ldap->getEmpInfo($empNum);
$results = $empResults->positiontitle;
?>
}
This will query the DB for a match to direct to the correct page
$query = "Select title FROM group_id WHERE title = '$results' ";
$posResult = mysql_query($query);
if ($results === $posResult){
setcookie( md5("name"), md5($_REQUEST['enumber']), time()+3600, "/","", 0);
header('location: /admin.php');
} else {
setcookie( md5("general"), md5($_REQUEST['enumber']), false, "/","", 0);
header('Location: /general.php');
}
I know the code above does not work, but, it will give you an idea of what I'm trying to do