Password change form:

helmetpastoralΛογισμικό & κατασκευή λογ/κού

13 Δεκ 2013 (πριν από 4 χρόνια και 6 μήνες)

113 εμφανίσεις

here is a working example script that will change a user’s password in a domain using perl. Very
basic and no error checking really, but this should give you an idea. As always, make sure this
page is using SSL.

Password change form:


Old password

New password




use CGI 'param', ':standard';

use Win32::NetAdmin;

print header;

print start_html;

if (param()){

$user = param('username');

$oldpassword = param('oldpass');

$newpassword = param('newpass');

if (Win32::Net
Admin::UserChangePassword("sgdomain", $user, $oldpassword,

print "<center><h1>The password for $user was changed</h1></center>";}

else {print "<center><h1>Could not change password. Old password may be


print <<EOF;

<h3 align="left">Password change form:</h3>

<form method="POST" action="chgpass.cgi">

<table border="1" width="35%">


<td width="32%" align="right">

<p align="right">Username</td>

<td width="68%">

<p align="left"><input type="text" name="username" size="20"></td>



<td width="32%" align="right">

<p align="right">Old password</td>

<td width="68%">

<p align="left"><input type="password" name="oldpas
s" size="20"></td>



<td width="32%" align="right">

<p align="left">New password</td>

<td width="68%">

<p align="left"><input type="password" name="newpass" size="20"></td>



<td width="32
%" align="right">&nbsp;</td>

<td width="68%"><input type="submit" value="Submit" name="B1"><input type="reset"
value="Reset" name="B2"></td>







print end_html;