<?php require_once 'backend.php'; $backend = new Backend(); $backend->connect('config.ini'); if (!$backend->auth($_POST['username'], $_POST['password'])) { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); header('Status: 403 Forbidden'); exit; } header('Content-Type: application/json'); echo json_encode($backend->search($_GET['query'], $_GET['limit'], $_GET['offset'], 5)) . "\n";
?> " maxlength="40"/> </td> </tr> <tr> <td> </td> <td><input class="submit" type="submit" value="Submit"/></td> </tr> </table> </form> <?php define('REAL_BASE', str_replace('\\', '/', dirname(__FILE__)) . '/'); include "inc/Backend.php"; if ($_POST['inifile']) { $GLOBALS['wwwoutput'] = TRUE; $back = new Backend(false, $_POST['inifile']); $back->search($HTTP_POST_VARS); print "<pre>"; print_r($ldifString); print "</pre>"; } else { ?> <?php } #phpinfo(); ?> </div> </body> </html>
* @package backend * */ // ini file to use $ini = "default.ini"; define('REAL_BASE', str_replace('\\', '/', dirname(__FILE__)) . '/'); include "inc/Backend.php"; # create the logfile handle $loghandle = fopen(REAL_BASE . 'log/shellback.log', 'a') or die("Can not open Logfile!\n"); $GLOBALS['loghandle'] = $loghandle; fwrite($loghandle, "STARTING\n"); # parse stdin to an array and write it to the logfile $request = array(); do { $line = trim(fgets(STDIN)); # old school log fwrite($loghandle, "{$line}\n"); if ($line != "") { $tmpa = split(": ", $line); $request[$tmpa[0]] = $tmpa[1]; fwrite($loghandle, $request[$tmpa[0]] . "\n"); } } while ($line != ""); $back = new Backend(false, $ini); $ldif = $back->search($request); fwrite($loghandle, $ldif); echo $ldif; #echo "dn: dc=ttt,ou=ldap2sparql,dc=localdomain\n". # "dc: ttt\n". # "objectClass: domain\n\n"; fclose($loghandle);