#!/usr/bin/perl -w

do '../web-lib.pl';
$|=1;
&init_config();
%access=&get_module_acl;

&ReadParse();

$domaine=$in{domaine};
&error ("Quel domaine ?") if (!$domaine);

&header("", "", "alias", 0, 0, undef,"Written by<BR><A HREF=mailto:hardware\@ovh.net>OVH</A><BR><A HREF=http://sd.ovh.fr>http://sd.ovh.fr</A>");


use DB_File;
tie %LIST,'DB_File',"/etc/ovhm.db";

print <<FIN;
<hr>
Alias de <b>$domaine</b> (<a href=#ajouter>Ajouter un alias</a>)
<p><table border>
  <tr $tb><td>Nom de domaine</td><td></td></tr>
FIN

foreach my $key (sort keys %LIST){
	$str = $domaine . "_alias_";
	if ($key =~ /$str/) {
	        my $val = $LIST{$key};
        	print "<tr $cb><td>$val</td><td><a href=\"effacer_alias.cgi?domaine=$domaine&alias=$val\">Effacer</a></td></tr>";
	}
}
untie(%LIST);

print <<FIN;
  </table>
</table>

<hr>

<a name=ajouter>
<form action=ajouter_alias.cgi method=POST>
<table border>
  <tr $tb><td>Ajouter un alias</td></tr>
  <tr $cb><td>
  <table>
    <tr><td>
    Nom de domaine :
    </td><td>
    www.<input name=alias size=30>
    <input type=hidden name=domaine value=$domaine>
    </td></tr><tr><td></td><td>
    <div align=right><input type=submit value="Créer"></div>
    </td></tr>
  </table>
</table>

<hr>
FIN

untie(%LIST);

&footer("/ovhm/modifier.cgi?domaine=$domaine", "domaine : $domaine");
