source: trunk/isis/iah2spip/spip.php @ 131

Last change on this file since 131 was 131, checked in by alberto, 15 years ago

ver 0.1 spip.php-guarda termino en spip_monts

File size: 1.9 KB
Line 
1<?
2
3        function Conectarse()
4        {
5           
6           $server="localhost";
7           $usuario="root";
8           $clave="";   
9           $basededatos="spip";   
10           $tabla="";
11             
12           if (!($link=mysql_connect("localhost","root","")))
13           {
14              echo "Error conectando a la base de datos.";
15              exit();
16           }
17           if (!mysql_select_db("spip",$link))
18           {
19              echo "Error seleccionando la base de datos.";
20              exit();
21           }
22           return $link;
23        }
24       
25
26        function seguridad($valor)
27        {
28            $valor = addslashes(trim($valor));
29            $valos = str_replace("%20"," ", $valor);
30
31            return $valor;
32        }       
33         
34
35$termino = seguridad($_GET['term']);   
36       
37print "
38<html> 
39<head> 
40<title>iah2spip</title> 
41<script>
42function exit(){
43window.close()
44return true;
45}
46</script>
47</head>
48<body>
49";
50$link=Conectarse();
51$resulta = mysql_query("SELECT * FROM spip_mots WHERE titre = '$termino'");
52$rows = mysql_fetch_array($resulta);
53if ($rows>0) {
54                print "El término " . $termino . " ya existe";
55                print "<center><a href=\"JavaScript:window.close()\">Cerrar esta ventana</a></center>";
56                //print "<button type=\"submit\" name=\"btnExit\" id=\"btnExit\" onClick=\"return exit();\">Salir</button>";
57                }
58        else
59        {
60          mysql_query("insert into spip_mots (titre,descriptif,texte,id_groupe,type,extra) values ('$termino', 'descriptif', 'texte', '1', 'type', 'extra')",$link); 
61          $resultado2 = mysql_query($sql,$link); 
62          print "Termino " . $termino ." agregado. <br><br>";
63          print "<center><form><input type=button value=\"Cerrar\" onclick=\"cerrar()\"></form></center>";
64        }
65print "</body></html>";
66
67
68/*
69Ahí está dicho todo: no puedes cerrar la ventana madre.
70
71¿Cómo la abres? Si la abres con un <A HREF target="_blank">, quizás lo consigas abriéndola con javascript:window.open(); entonces se dejará cerrar -creo-.
72
73Por otro lado, dentro del onClick el javascript va implícito:
74onClick="javascript:window.close()"
75basta con
76onClick="window.close()
77
78
79
80*/
81?> 
Note: See TracBrowser for help on using the repository browser.