TeCategory:Tetra Clients/Upcctns-lko/php-user-creation-page: Difference between revisions
Appearance
Created page with " == '''UPCCTNS SINGLE USER CREATION LOGIN PAGE''' == <html> <head> <link rel = "stylesheet" type = "text/css" href = "stylesheets/stylesheet.css"> <title>Add ldap user</..." |
|
(No difference)
| |
Revision as of 08:29, 11 April 2014
UPCCTNS SINGLE USER CREATION LOGIN PAGE
<html> <head> <link rel = "stylesheet" type = "text/css" href = "stylesheets/stylesheet.css"> <title>Add ldap user</title> <body>
Add User
<form action = "ldapuseradd.php" method = "post">
<label for="username">Username:</label> <input type="text" class="input" id="username" name="username">
<label for = "firstname">First Name:</label> <input class = "input" type ="text" id = "firstname" name="firstname" >
<label for="lastname">Last Name:</label> <input class="input" type ="text" id = "lastname" name="lastname">
<label> </label><input type="submit" value="submit" class="button">
</form> </body> </head> </html>
<html> <head> <link rel = "stylesheet" type = "text/css" href = "stylesheets/stylesheet.css"> <title>PHP LDAP Add</title> </head? <body>
Adding LDAP User
<?php $cn = htmlspecialchars($_POST['username']); $givenName = htmlspecialchars($_POST['firstname']); $surname = htmlspecialchars($_POST['lastname']); $mail_host = "mail.upcctns.gov.in"; $mailmsgstore = "upcctns.gov.in/$cn"; echo "Adding user: $cn " . '
'; $ds = ldap_connect("localhost") or die ("Could not connect to LDAP Server"); if ($ds) { $r = ldap_bind($ds,"cn=manager,dc=upcctns,dc=gov,dc=in","secret"); $info["cn"] = $cn; $info["uid"] = $cn; $info["givenName"] = $givenName; $info["surname"] = $surname; $info["objectClass"][0] = "inetOrgPerson"; $info['objectClass'][1] = "top"; //$info['objectClass'] = "inetOrgPerson"; $info['objectClass'][2] = "qmailUser"; $info["mail"] = "$cn@upcctns.gov.in"; //$info["mailHost"] = $mail_host; $info["mailMessageStore"] = "upcctns.gov.in/$cn"; $info["userPassword"] = "{SSHA}ge+eLYjTpH+su5WMy0N8PZpvnURYq6kC"; $r = ldap_add($ds,"uid=$cn,ou=upcctns.gov.in,dc=upcctns,dc=gov,dc=in",$info); $sr = ldap_search($ds,"dc=upcctns,dc=gov,dc=in","uid=$cn"); $info = ldap_get_entries($ds,$sr); echo "The user: " . $info[0]["dn"] . " has been created.
"; } ldap_close($ds); ?>
<a href = "ldapuseradd.html">Add another user</a> </body> </html>
http://164.100.181.134/padmin/ldapuseradd.html http://192.168.75.201:8080/ldapuseradd.html User : admin Password : admin@upcctns4321
htaccess base restriction