#!/usr/bin/perl
# addhostsuser.cgi
# ...  Servicios de Tarantella.
# STTA Rev. 1.3 Copyright (c) 2001-2002 Jesús Pérez Lorenzo  --- license GNU GPL 

require './stta-lib.pl';

&headerstta($text{'index_addhostsuser'}, "", "addhostsuser",undef,1,1,$text{headpage_rigth} ); 
print "<hr><p>\n"; 
&foreign_require("proc", "proc-lib.pl");
&ReadParse();

 $type_cmd = $in{ttacmd};
 print "<table width=100% border>\n";
 print "<tr $tb> <td><b>$text{'titidx_adhostsuser'}</b></td> </tr>\n";
 print "<tr $cb> <td><table width=100%>\n";
 print "<center>\n";

 $hostname=$in{hostname};
 $username=$in{username};
 $descrip=$in{descrip};
 $password=$in{password};

 if ($username)  {
    $alias=$username;
    %h_hostsuser=&list_hostsuser();
    if ( $h_hostsuser{$username}->{'username'} eq $username ) {
         $err_msg=$text{'list_err'};
         &footHere;
         exit;
    }
    $organizationname="";
    $dn_hostsuser="";
    $ens_hostsuser="";
           $lin_hostsuser=$username."::".$password."::".$descrip."::";
           &lock_file($config{'hostuser_list'});
	   open(FILEHOSTSUSER, ">>$config{'hostsuser_list'}");
           print FILEHOSTSUSER "$lin_hostsuser\n";
           close (FILEHOSTSUSER);
           &unlock_file($config{'hostuser_list'});
           $str=$text{'user_made'}.$username." ->  ".$in{userhostsuser};
           &additional_log('addhostsuser.cgi', "hostuser", $str);
           &webmin_log($config{'hostuser_list'}, "hostuser", "write",$lin_hostsuser);
           print "<tr><p><b>".$text{'user_made'}.$username." ->  ".$in{userhostsuser}."</b></tr>\n";
           print "<tr></tr>\n";
 }
 print "<tr><tr></table></table><hr><p>\n";
 &footer($config{'back_return'},$text{'index'});
 print "<p><p><p>\n";
 do "footer.pl";
 exit;

