<? // LDAP - PHP interface for Wagtail // v0.2 include("config.php"); include("functions.php"); // Login dn and password set as cookies $login_dn = (isset( $_COOKIE['login_dn'] ) and $_COOKIE['login_dn']!="" )? $_COOKIE['login_dn'] : "anon"; $login_pass = isset( $_COOKIE['login_pass'] ) ? $_COOKIE['login_pass'] : null; $Command=$_REQUEST['Command']; $region=$_REQUEST['region']; // Need to set new cookies before any text sent if($_REQUEST['Command']=='Log In'){ $uid=$_REQUEST['uid']; $ldapuser=getUserFromUID($uid); $login_pass=$_REQUEST['pw']; // See if can bind with those values $ldapConn = ldap_connect($ldapServer); ldap_set_option( $ldapConn, LDAP_OPT_PROTOCOL_VERSION, 3 ); $ldapBind = ldap_bind($ldapConn,$ldapuser,$login_pass); if ($ldapBind){ setcookie('login_dn', $ldapuser); setcookie('login_pass', $login_pass); $login_dn=$ldapuser; $login_pass=$_REQUEST['pw']; } else{ print "Unable to connect to $ldapServer as $ldapuser with that password<p>"; }
<?php if (!defined('includeConst')) { die('Direct access not permitted'); } if (isset($_GET['a']) && $_GET['a'] == "search") { showSearchResults($db, $userName, $group, $role); } else { showSearchForm($userName, $group, $role); } function showSearchForm($userName, $group, $role) { ?> <body> <main class="filters"> <?php include "header.inc"; ?> <div class="two"> <h1>Find A Group</h1> <form id="searchForm" action="?page=groupSearch&a=search" method="POST"> <label for="fieldSelect">Preferred Project Type</label><br> <select name="field" id="fieldSelect"> <option value="">Any</option> <option value="Web Development">Web Development</option> <option value="Programming">Programming</option> <option value="Project Leadership">Design</option> <option value="Business">Business</option> </select> <br><br>
//execute the query $stmt->execute(); //close the cursor $stmt->closeCursor(); // execute the second query to get customer's level $r = $conn->query("SELECT @resID AS ID,@uname AS username")->fetch(PDO::FETCH_ASSOC); if (isset($r['ID'])) { echo $r['ID'], '==>', $r['username'], "<br />\n"; } else { echo "No User found !!!"; } } catch (PDOException $pe) { die("Error occurred:" . $pe->getMessage()); } echo '</div>'; } if (isset($_GET['id'])) { showSearchResults(); //showSearchResultsWithEscapeChars(); //showSearchResultsPreparedStmt(); //showSearchResultStoredProcedure(); } ?> </div> </div> </div> </div> </body> </html>
<?php include_once "header.php"; ?> <?php $numEntries = getIndexNum(); if (!$_GET['pagenum']) { $pagenum = 1; } else { $pagenum = $_GET['pagenum']; } if (!$_GET['search']) { printSearchForm($numEntries, $pagenum); } else { $search = $_GET['search']; showSearchResults($numEntries, $pagenum, $search); $pagenum++; echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?pagenum=" . $pagenum . "&search=" . $search . "\" class=\"box\">next »</a>"; } ?> <?php include_once "footer.php"; ?>