-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathldap_management.php
136 lines (109 loc) · 4.31 KB
/
ldap_management.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2006 Michael Earls |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| - phpIP - http://www.phpip.net/ |
+-------------------------------------------------------------------------+
*/
ob_start();
// include the layout file
include 'layout.php';
login_check();
admin_check();
switch ($_REQUEST["mode"]) {
case "add":
{
if (isset ($_POST['ldap_server'])) { $ldap_server = strip_tags($_POST['ldap_server']); }
if (isset ($_POST['ldap_port'])) { $ldap_port = strip_tags($_POST['ldap_port']); }
// Use the myheader function from layout.php
myheader("LDAP Management -- Add");
$ldap_add = mysql_query("INSERT INTO `ldap` VALUES
('', '$ldap_server', '$ldap_port')");
// Redirect to ldap_management.php after sql insert
?>
<h2><font color="FF0000">Updating Database, Please wait</font></h4>
<meta http-equiv=Refresh content=1;url="ldap_management.php">
<?php
exit();
} //end
case "delete":
{
// Use the myheader function from layout.php
myheader("LDAP Management -- Delete");
if (isset ($_GET['lid'])) { $lid = strip_tags($_GET['lid']); }
$ldap_delete = mysql_query("DELETE FROM `ldap` WHERE `ldapId` = '$lid'");
// Redirect to ldap_management.php after sql insert
?>
<h2><font color="FF0000">Updating Database, Please wait</font></h4>
<meta http-equiv=Refresh content=1;url="ldap_management.php">
<?php
exit();
} //end
default:
// Use the myheader function from layout.php
myheader("LDAP Management");
$ldap_count = mysql_query("SELECT * FROM `ldap` WHERE `ldapId` != 0");
if ($ldap_count != "0") {
echo "<table class=\"listTable\" style=\"width:100%\" cellpadding=\"0\" cellspacing=\"0\">";
echo "<tr class=\"listCell\"> ";
echo "<td colspan=6 class=\"listCell\">LDAP Management</td>";
echo "<tr class=\"listHeadRow\">";
echo "<td class=\"listCell\"> </td>";
echo "<td class=\"listCell\">DATA SOURCE</td>";
echo "<td class=\"listCell\">PORT</td>";
echo "</tr>";
$ldapl = mysql_query("SELECT * FROM `ldap`");
while ($lrow = mysql_fetch_array($ldapl))
{
if ($RowClass == "listRow2") { $RowClass = "listRow1";
}
else
{ $RowClass = "listRow2";
}
echo "<tr class=\"$RowClass\">";
echo "<td class=\"listCell\"> <a href=\"ldap_management.php?mode=delete&lid=$lrow[ldapId]\">[Delete]</a></td>";
echo "<td class=\"listCell\"> $lrow[ldapConnect]</td>";
echo "<td class=\"listCell\"> $lrow[ldapPort]</td>";
echo "</tr>";
} //end loop
echo "</table>";
echo "</br>";
} // end ldap_count
?>
<FORM action="<?php $PHPSELF;?>?mode=add" method=post name="ldapadd">
<table class="listTable" style="width:100%" cellpadding="0" cellspacing="0">
<TR class="listCell">
<TD class="listCell">Lightweight Directory Access Protocol (LDAP) Management</TD>
</TR>
<tr class="listHeadRow">
<TD class="listCell">ADD</TD>
</TR>
<tr class="listRow2">
<TD class="listCell">Server: <INPUT name="ldap_server" value="server.example.com">
Port: <INPUT name="ldap_port" value="389"></td>
</tr>
</table>
<table>
<tr>
<TD align=right><a href="javascript:document.ldapadd.submit()">[ADD]</TD>
</TR>
</center>
</table>
</FORM>
<?php
// Use the footer function from layout.php
footer();
} // end switch
//------------------------------------------------------------------------------------------
?>