<html>
<head><title>afrique? </title></head>
<body>
<h1> Init : bonjour <br></h1>

<? // $tout_est_ok="yes";
 if (isset($tout_est_ok))
{        
        foreach($HTTP_GET_VARS as $keys=>$value)
        {
        if($keys=="pays")
        {        $pays=str_replace("+"," ",$value);
                print "$pays <br>";
                $lien=mysql_connect("localhost","root");
                if(!$lien)die ("relancez mysqld-nt -u root sous le repertoire c:/chou/mysql/bin/ ");
                 $db=mysql_select_db("pays",$lien);
                if(!$db)die ("impossible de se connecter à la db pays");
                $result=mysql_query("select * from continents where '$pays'=nom",$lien);
                $mon_pays=mysql_fetch_row($result);
        }
        }
        mysql_close($lien);
        $file="admin.map";
        $desc=fopen($file,'w');
        fwrite($desc,"NAME EXEMPLE2\n\nSTATUS ON\nSIZE 300 300\n");
        fwrite($desc,"EXTENT $mon_pays[1] $mon_pays[2] $mon_pays[3] $mon_pays[4]\n");
        fwrite($desc,"UNITS DD\n#SHAPEPATH \"c:\Program Files\Apache Group\Apache\htdocs\chou\mes_fichiers\data\"\nIMAGECOLOR 0 255 0\n#MARKERSET symbols/marker.sym\n#LINESET symbols/line.sym\nSYMBOLSET \"c:\Program Files\Apache Group\Apache\htdocs\chou\mes_fichiers\symbols\symbol.sym\"\n\n");

        fwrite($desc,"WEB\nLOG \"erreurs.log\"\nTEMPLATE \"gestion_pays.html\"\nIMAGEPATH \"c:\\program Files\\Apache Group\\Apache\\htdocs\\chou\\tmp\\\"\nMINSCALE 1000\nMAXSCALE 155000000\n");
        fwrite($desc,"IMAGEURL \"http://localhost/chou/tmp/\"\nEND\n\n");




        fwrite($desc,"SCALEBAR\n\tIMAGECOLOR 0 255 0\n\tSTATUS ON\n\tINTERVALS 4\n\tSIZE 275 2\n\tCOLOR 0 0 0\n\tOUTLINECOLOR 0 0 0 \n\tUNITS kilometers\n\tLABEL\n\t\tCOLOR 0 0 0\n\t\tSIZE small\n\tEND\nEND\n");

        fwrite($desc,"LAYER\n\tNAME \"pays\"\n\tTYPE POLYGON\n\tSTATUS ON\n\tCONNECTIONTYPE OGR\n");
        fwrite($desc,"CONNECTION \"c:/chou/données/données/$mon_pays[0]/fond cartographique/pays/politique.TAB\"\nCLASS\n\tCOLOR 255 0 0\n\tOUTLINECOLOR 100 100 100\n\tEND\nEND\n\n\n");
        fwrite($desc,"LAYER\n\tNAME \"routes\"\n\tTYPE LINE\n\tSTATUS ON\n\tCONNECTIONTYPE OGR\n");
        fwrite($desc,"CONNECTION \"c:/chou/données/données/$mon_pays[0]/donnees spatiales/reseau routier/reseau_routier.TAB\"\nCLASS\n\tCOLOR 255 255 255\n\tOUTLINECOLOR 100 100 100\n\tEND\nEND\n\n\n");
        fwrite($desc,"LAYER\n\tNAME \"hydrographique\"\n\tTYPE LINE\n\tSTATUS ON\n\tCONNECTIONTYPE OGR\n");
        fwrite($desc,"CONNECTION \"c:/chou/données/données/$mon_pays[0]/donnees spatiales/reseau hydrographique/drainage.TAB\"\nCLASS\n\tCOLOR 0 0 255\n\tOUTLINECOLOR 100 100 100\n\tEND\nEND\n\n\n");
        fwrite($desc,"LAYER\n\tNAME \"reseau ferre\"\n\tTYPE LINE\n\tSTATUS ON\n\tCONNECTIONTYPE OGR\n");
        fwrite($desc,"CONNECTION \"c:/chou/données/données/$mon_pays[0]/donnees spatiales/reseau ferre/réseau_ferré.TAB\"\nCLASS\n\tCOLOR 0 255 255\n\tOUTLINECOLOR 100 100 100\n\tEND\nEND\n\nEND\n");


        fwrite($desc,"LEGEND\n\tKEYSIZE 18 12\n\tLABEL\n\t\tTYPE BITMAP\n\t\tSIZE MEDIUM\n\t\tCOLOR 0 0 89\n\tEND\n\tSTATUS ON\nEND\n\n");


        fclose($desc);
        if($tout_est_ok=="yes") { ?>

<form method="get" action="/cgi-bin/mapserv.exe">
<input type="hidden" name="map" value="c:\Program Files\Apache Group\Apache\htdocs\chou\mes_fichiers\admin.map" />
<input type="hidden" name="zoom" value=10 />
<input type="hidden" name="layer" value="pays" />
<input type="hidden" name="continent" value=<? print $mon_pays[0]?> />
<center>
<br>

youpie!
<input type=submit value="visualiser la carte" /></center>
</form>
<? }}
else
{ ?>
<form method="get" action="<? print $PHP_SELF; ?>"> 
<? $tout_est_ok="yes" ; ?>
<br><b>choisissez le continent à visualiser</b><br>
<input type="hidden" name="tout_est_ok" value="<? print $tout_est_ok; ?>" />
<input type="radio" name="pays" value="afrique" checked />afrique<br>
<input type="radio" name="pays" value="europe" />europe<br>
<input type="radio" name="pays" value="amerique_du_nord" />amerique du nord,centrale,caraibes<br>
<input type="radio" name="pays" value="amerique_du_sud" />amerique du sud<br>
<input type="radio" name="pays" value="asie" />asie<br>
<input type="radio" name="pays" value="australie" />australie<br>
<input type="radio" name="pays" value="oceanie" />oceanie<br>
<!-- input type="radio" name="pays" value="monde" />indicateurs mondiaux<br -->
<br>
<input type=submit value="creer le mapfile" /></center>
</form>
<? } ?>
</body>
</html>