En este fichero esta incluido todo el código del proyecto, excepto los ficheros
xml que la aplicación genera durante su ejecución.
Para ver la utilidad de cada fichero leer el fichero readme.txt.
#############################################################################################
Espectaculos-Venta de Entradas
Esta página usa marcos, pero su explorador no los admite.
#############################################################################################
Enlaces
##############################################################################################
Principal
UNIVERSIDAD POLITECNICA DE MADRID
F.I. FACULTAD DE INFORMATICA
Asignatura: Diseño de Aplicaciones Web
Curso: 2003-2004
Grupo: 21
Autor: Roberto MARTINEZ SECO
Registrarse
Ver Compras
Realizadas
######################################################################################################
Acceso de Usuarios
Registrarse
#####################################################################################
Compra-Realizada
SU COMPRA A SIDO
REALIZADA CORRECTAMENTE
FINALIZAR
##################################################################################################
Conciertos
LISTADO DE LOS
CONCIERTOS
\n";
$tofile2 .= "<" . "!" . "DOCTYPE LISTA SYSTEM \"conciertos_solicitados.dtd\"" . ">" . "\n";
$tofile2 .= "\n";
$link = mysql_connect('localhost','Servicio Web','******') or die(mysql_error());
$db = mysql_select_db('ventas_web') or die(mysql_error());
$tofile2 .= "\n";
$sql = "SELECT * FROM conciertos";
$res=mysql_query($sql) or die (mysql_error());
while($row= mysql_fetch_array($res))
{
$tofile2 .= "\t\n";
while (list($key,$value)=each($row))
{
if (is_string($key))
{
if (($key != "Vendidas")&& ($key != "Codigo") && ($key != "Fich_Concierto")&& ($key != "Cod_Escenario"))
{
$tofile2 .= "\t\t<";
$tofile2 .= $key;
$tofile2 .= ">" . $value;
$tofile2 .= "" . $key . ">\n";
}
}
}
$tofile2 .= "\t\n";
}
$tofile2 .= "\n";
//Escribimos el string en nuestro archivo y cerramos el manipulador
fwrite($handle2,$tofile2);
fclose($handle2);
$sql = "SELECT * FROM conciertos";
$res=mysql_query($sql) or die (mysql_error());
while($row= mysql_fetch_array($res))
{
while (list($key,$value)=each($row))
{
if (is_string($key))
{
if ($key == "Interprete")
{
$Interprete=$value;
}
if ($key == "Tipo_Musica")
{
$Tipo_Musica=$value;
}
if ($key == "Codigo")
{
$Cod=$value;
}
if ($key == "Cod_Escenario")
{
?>
()
Obtener
fichero XML con todos los conciertos
Obtener
DTD del fichero XML
####################################################################################################
Corridas de Toros
LISTADO DE LAS
CORRIDAS DE TOROS
\n";
$tofile2 .= "<" . "!" . "DOCTYPE LISTA SYSTEM \"corridas_solicitadas.dtd\"" . ">" . "\n";
$tofile2 .= "\n";
$link = mysql_connect('localhost','Servicio Web','******') or die(mysql_error());
$db = mysql_select_db('ventas_web') or die(mysql_error());
$tofile2 .= "\n";
$sql = "SELECT * FROM corridas_de_toros";
$res=mysql_query($sql) or die (mysql_error());
while($row= mysql_fetch_array($res))
{
$tofile2 .= "\t\n";
while (list($key,$value)=each($row))
{
if (is_string($key))
{
if (($key != "Vendidas")&& ($key != "Codigo") && ($key != "Fich_Corrida")&& ($key != "Cod_Escenario"))
{
$tofile2 .= "\t\t<";
$tofile2 .= $key;
$tofile2 .= ">" . $value;
$tofile2 .= "" . $key . ">\n";
}
}
}
$tofile2 .= "\t\n";
}
$tofile2 .= "\n";
//Escribimos el string en nuestro archivo y cerramos el manipulador
fwrite($handle2,$tofile2);
fclose($handle2);
$sql = "SELECT * FROM corridas_de_toros";
$res=mysql_query($sql) or die (mysql_error());
while($row= mysql_fetch_array($res))
{
while (list($key,$value)=each($row))
{
if (is_string($key))
{
if ($key == "Torero1")
{
$Torero1=$value;
}
if ($key == "Torero2")
{
$Torero2=$value;
}
if ($key == "Torero3")
{
$Torero3=$value;
}
if ($key == "Codigo")
{
$Cod=$value;
}
if ($key == "Cod_Escenario")
{
?>
Obtener fichero XML con
todos las corridas de toros
Obtener DTD del fichero XML
##############################################################################################
= 6) && (substr_count($email,"@") == 1) && (substr($email,0,1) != "@") && (substr($email,strlen($email)-1,1) != "@")){
if ((!strstr($email,"'")) && (!strstr($email,"\"")) && (!strstr($email,"\\")) && (!strstr($email,"\$")) && (!strstr($email," "))) {
//miro si tiene caracter .
if (substr_count($email,".")>= 1){
//obtengo la terminacion del dominio
$term_dom = substr(strrchr ($email, '.'),1);
//compruebo que la terminación del dominio sea correcta
if (strlen($term_dom)>1 && strlen($term_dom)<5 && (!strstr($term_dom,"@")) ){
//compruebo que lo de antes del dominio sea correcto
$antes_dom = substr($email,0,strlen($email) - strlen($term_dom) - 1);
$caracter_ult = substr($antes_dom,strlen($antes_dom)-1,1);
if ($caracter_ult != "@" && $caracter_ult != "."){
$mail_correcto = 1;
}
}
}
}
}
if ($mail_correcto)
return 1;
else
return 0;
}
$nombre=$_POST[nombre];
$dni=$_POST[DNI];
$apellido1=$_POST[apellido1];
$apellido2=$_POST[apellido2];
$calle=$_POST[calle];
$numero=$_POST[numero];
$piso=$_POST[piso];
$letra=$_POST[letra];
$poblacion=$_POST[poblacion];
$provincia=$_POST[provincia];
$cp=$_POST[cp];
$mail=$_POST[mail];
$telefono=$_POST[telefono];
$numtarjeta=$_POST[numtarjeta];
$dia=$_POST[dia];
$mes=$_POST[mes];
$anno=$_POST[anno];
$usuario=$_POST[usuario];
$password=$_POST[password];
$parametro=0;
if (($dni=="") || ($nombre=="") || ($apellido1=="") || ($calle=="") || ($numero=="") ||($poblacion=="") ||
($provincia=="") || ($cp=="") || ($mail=="") || ($numtarjeta=="") || ($dia=="") ||($mes=="") ||
($anno=="") || ($usuario=="") || ($password==""))
{
$parametro=1;
header("Location: no_registrado.php?parametro=1");
}
else
{
if (comprobar_email($mail)== 0)
{
$parametro=0;
header("Location: no_registrado.php?parametro=0");
}
else
{
$fecha = time();
$dia1=date("d", $fecha);
$mes1=date("m", $fecha);
$anno1=date("Y", $fecha);
if (($anno < $anno1) ||(($anno == $anno1)&&($mes < $mes1)) || (($anno == $anno1) && ($mes == $mes1) &&($dia < $dia1)))
{
$parametro=5;
header("Location: no_registrado.php?parametro=5");
}
else
{
$link = mysql_connect('localhost','Servicio Web','******') or die(mysql_error());
$db = mysql_select_db('ventas_web') or die(mysql_error());
$sql = "SELECT * FROM datos_persona WHERE DNI='$dni' ";
$sql2 = "SELECT * FROM clientes WHERE Usuario='$usuario' ";
$res=mysql_query($sql) or die (mysql_error());
$res2=mysql_query($sql2) or die (mysql_error());
if ((mysql_num_rows($res)!=0) && (mysql_num_rows($res2)==0))
{
$parametro=2;
header("Location: no_registrado.php?parametro=2");
}
if ((mysql_num_rows($res)==0) && (mysql_num_rows($res2)!=0))
{
$parametro=3;
header("Location: no_registrado.php?parametro=3");
}
if ((mysql_num_rows($res)!=0) && (mysql_num_rows($res2)!=0))
{
$parametro=4;
header("Location: no_registrado.php?parametro=4");
}
if ((mysql_num_rows($res)==0) && (mysql_num_rows($res2)==0))
{
$sql3 = "INSERT INTO datos_persona VALUES(" . "'" . $dni . "'" . "," ."'" . $nombre ."'" . "," ."'" . $apellido1 ."'" . ","."'" . $apellido2 . "'" . "," .
"'" . $telefono ."'" . "," ."'" . $mail ."'" . "," ."'" . $calle ."'" . "," ."'" . $numero ."'" . "," .
"'" . $piso ."'" . "," ."'" . $letra ."'" . "," ."'" . $poblacion ."'" . "," ."'" . $provincia ."'" . "," .
"'" . $cp ."'" . ")";
$sql4 = "INSERT INTO clientes VALUES(" . "'" . $usuario . "'" . "," ."'" . md5($password) ."'" . "," ."'" . $numtarjeta ."'" . ","."'" . $anno . "-" . $mes . "-" . $dia . "'" . "," .
"'" . $dni . "'" . ")";
$res3=mysql_query($sql3) or die (mysql_error());
$res4=mysql_query($sql4) or die (mysql_error());
header("Location: registrado.php");
}
}
mysql_free_result($res3);
mysql_free_result($res4);
mysql_free_result($res);
mysql_free_result($res2);
mysql_close($link);
}
}
?>
##########################################################################################
Datos Concierto
DATOS DEL CONCIERTO
\n";
$tofile2 .= "<" . "!" . "DOCTYPE CONCIERTO SYSTEM \"concierto_solicitado.dtd\"" . ">" . "\n";
$tofile2 .= "\n";
$link = mysql_connect('localhost','Servicio Web','******') or die(mysql_error());
$db = mysql_select_db('ventas_web') or die(mysql_error());
$cod = $HTTP_GET_VARS[param1];
$sql = "SELECT * FROM conciertos WHERE Codigo=" . $cod;
$res=mysql_query($sql) or die (mysql_error());
while($row= mysql_fetch_array($res))
{
$tofile2 .= "\n";
while (list($key,$value)=each($row))
{
if (is_string($key))
{
if (($key != "Vendidas")&& ($key != "Codigo") && ($key != "Fich_Concierto")&& ($key != "Cod_Escenario"))
{
$tofile2 .= "\t\t<";
$tofile2 .= $key;
$tofile2 .= ">" . $value;
$tofile2 .= "" . $key . ">\n";
}
}
}
$tofile2 .= "\n";
}
//Escribimos el string en nuestro archivo y cerramos el manipulador
fwrite($handle2,$tofile2);
fclose($handle2);
//Finalmente redireccinamos al nuevo archivo creado partidos.xml
$sql = "SELECT * FROM conciertos WHERE Codigo=" . $cod;
$res=mysql_query($sql) or die (mysql_error());
while($row= mysql_fetch_array($res))
{
while (list($key,$value)=each($row))
{
if (is_string($key))
{
if ($key == "Interprete")
{
$in=$value;
}
if ($key == "Tipo_Musica")
{
$tm=$value;
}
if ($key == "Fecha")
{
$f=$value;
}
if ($key == "Hora")
{
$h=$value;
}
if ($key == "Precio")
{
$p=$value;
}
if ($key == "A_la_Venta")
{
$alv=$value;
}
if ($key == "Cod_Escenario")
{
$ce=$value;
}
if ($key == "Vendidas")
{
$ven=$value;
}
}
}
}
?>
|
|
|
INTERPRETE |
|
| TIPO DE MUSICA |
|
|
FECHA |
|
|
HORA |
|
|
PRECIO |
|
| ENTRADAS A LA VENTA |
|
VER ESCENARIO
VOLVER A CONCIERTOS
Obtener fichero XML del concierto seleccionado
Obtener DTD del fichero XML
###########################################################################################
Datos de Corrida de Toros
DATOS DE LA CORRIDA DE TOROS
\n";
$tofile2 .= "<" . "!" . "DOCTYPE CORRIDA SYSTEM \"corrida_solicitada.dtd\"" . ">" . "\n";
$tofile2 .= "\n";
$link = mysql_connect('localhost','Servicio Web','******') or die(mysql_error());
$db = mysql_select_db('ventas_web') or die(mysql_error());
$cod = $HTTP_GET_VARS[param1];
$sql = "SELECT * FROM corridas_de_toros WHERE Codigo=" . $cod;
$res=mysql_query($sql) or die (mysql_error());
while($row= mysql_fetch_array($res))
{
$tofile2 .= "\n";
while (list($key,$value)=each($row))
{
if (is_string($key))
{
if (($key != "Vendidas")&& ($key != "Codigo") && ($key != "Fich_Corrida")&& ($key != "Cod_Escenario"))
{
$tofile2 .= "\t\t<";
$tofile2 .= $key;
$tofile2 .= ">" . $value;
$tofile2 .= "" . $key . ">\n";
}
}
}
$tofile2 .= "\n";
}
//Escribimos el string en nuestro archivo y cerramos el manipulador
fwrite($handle2,$tofile2);
fclose($handle2);
//Finalmente redireccinamos al nuevo archivo creado partidos.xml
$sql = "SELECT * FROM corridas_de_toros WHERE Codigo=" . $cod;
$res=mysql_query($sql) or die (mysql_error());
while($row= mysql_fetch_array($res))
{
while (list($key,$value)=each($row))
{
if (is_string($key))
{
if ($key == "Torero1")
{
$t1=$value;
}
if ($key == "Torero2")
{
$t2=$value;
}
if ($key == "Torero3")
{
$t3=$value;
}
if ($key == "Fecha")
{
$f=$value;
}
if ($key == "Hora")
{
$h=$value;
}
if ($key == "Precio")
{
$p=$value;
}
if ($key == "A_la_Venta")
{
$alv=$value;
}
if ($key == "Cod_Escenario")
{
$ce=$value;
}
if ($key == "Vendidas")
{
$ven=$value;
}
}
}
}
?>
|
|
| TORERO 1 |
|
| TORERO 2 |
|
| TORERO 3 |
|
|
FECHA |
|
| HORA |
|
|
PRECIO |
|
| ENTRADAS A LA VENTA |
|
VER ESCENARIO
VOLVER A CORRIDAS DE TOROS
Obtener fichero XML de la corrida de toros seleccionada
Obtener DTD del fichero XML
####################################################################################
Datos Partido
DATOS DEL PARTIDO
\n";
$tofile2 .= "<" . "!" . "DOCTYPE PARTIDO SYSTEM \"partido_solicitado.dtd\"" . ">" . "\n";
$tofile2 .= "\n";
$link = mysql_connect('localhost','Servicio Web','******') or die(mysql_error());
$db = mysql_select_db('ventas_web') or die(mysql_error());
$cod = $HTTP_GET_VARS[param1];
$sql = "SELECT * FROM partidos WHERE Codigo=" . $cod;
$res=mysql_query($sql) or die (mysql_error());
while($row= mysql_fetch_array($res))
{
$tofile2 .= "\n";
while (list($key,$value)=each($row))
{
if (is_string($key))
{
if (($key != "Vendidas")&& ($key != "Codigo") && ($key != "Fich_Partido")&& ($key != "Cod_Escenario"))
{
$tofile2 .= "\t\t<";
$tofile2 .= $key;
$tofile2 .= ">" . $value;
$tofile2 .= "" . $key . ">\n";
}
}
}
$tofile2 .= "\n";
}
//Escribimos el string en nuestro archivo y cerramos el manipulador
fwrite($handle2,$tofile2);
fclose($handle2);
//Finalmente redireccinamos al nuevo archivo creado partidos.xml
$sql = "SELECT * FROM partidos WHERE Codigo=" . $cod;
$res=mysql_query($sql) or die (mysql_error());
while($row= mysql_fetch_array($res))
{
while (list($key,$value)=each($row))
{
if (is_string($key))
{
if ($key == "Equipo_Casa")
{
$ec=$value;
}
if ($key == "Equipo_Visitante")
{
$ev=$value;
}
if ($key == "Deporte")
{
$d=$value;
}
if ($key == "Competicion")
{
$c=$value;
}
if ($key == "Fecha")
{
$f=$value;
}
if ($key == "Hora")
{
$h=$value;
}
if ($key == "Precio")
{
$p=$value;
}
if ($key == "A_la_Venta")
{
$alv=$value;
}
if ($key == "Cod_Escenario")
{
$ce=$value;
}
if ($key == "Vendidas")
{
$ven=$value;
}
}
}
}
?>
|
|
|
DEPORTE |
|
| EQUIPO CASA |
|
| EQUIPO VISITANTE |
|
| COMPETICION |
|
|
FECHA |
|
|
HORA |
|
|
PRECIO |
|
| ENTRADAS A LA VENTA |
|
VER ESCENARIO
VOLVER A PARTIDOS
Obtener fichero XML del partido seleccionado
Obtener DTD del fichero XML
#################################################################################################
Untitled Document
DATOS DEL ESCENARIO
\n";
$tofile2 .= "<" . "!" . "DOCTYPE ESCENARIO SYSTEM \"escenario_solicitado.dtd\"" . ">" . "\n";
$tofile2 .= "\n";
$link = mysql_connect('localhost','Servicio Web','******') or die(mysql_error());
$db = mysql_select_db('ventas_web') or die(mysql_error());
$cod = $_GET[cod];
$cod_espectaculo = $_GET[cod_espectaculo];
$tipo = $_GET[tipo];
$sql = "SELECT * FROM escenario WHERE Codigo=" . $cod;
$res=mysql_query($sql) or die (mysql_error());
while($row= mysql_fetch_array($res))
{
$tofile2 .= "\n";
while (list($key,$value)=each($row))
{
if (is_string($key))
{
if (($key != "Codigo") && ($key != "Foto"))
{
$tofile2 .= "\t<";
$tofile2 .= $key;
$tofile2 .= ">" . $value;
$tofile2 .= "" . $key . ">\n";
}
}
}
$tofile2 .= "\n";
}
//Escribimos el string en nuestro archivo y cerramos el manipulador
fwrite($handle2,$tofile2);
fclose($handle2);
//Finalmente redireccinamos al nuevo archivo creado partidos.xml
$sql = "SELECT * FROM escenario WHERE Codigo=" . $cod;
$res=mysql_query($sql) or die (mysql_error());
while($row= mysql_fetch_array($res))
{
while (list($key,$value)=each($row))
{
if (is_string($key))
{
if ($key == "Nombre")
{
$n=$value;
}
if ($key == "Capacidad")
{
$c=$value;
}
if ($key == "Calle")
{
$ca=$value;
}
if ($key == "Numero")
{
$nu=$value;
}
if ($key == "Poblacion")
{
$p=$value;
}
if ($key == "Provincia")
{
$pr=$value;
}
if ($key == "Codigo_Postal")
{
$cp=$value;
}
if ($key == "Telefono")
{
$t=$value;
}
if ($key == "Mail")
{
$m=$value;
}
if ($key == "Foto")
{
$foto=$value;
}
}
}
}
?>
|
|
| NOMBRE |
|
| CAPACIDAD |
|
|
CALLE |
|
| NUMERO |
|
| POBLACION |
|
|
PROVINCIA |
|
| CODIGO POSTAL |
|
|
TELEFONO |
|
| MAIL |
|
VER FOTO
Obtener fichero XML del escenario solicitado
Obtener DTD del fichero XML
VOLVER AL PARTIDO
VOLVER AL CONCIERTO
VOLVER A LA CORRIDA DE TOROS
Untitled Document
VOLVER
AL ESCENARIO
###########################################################################################
$valor){
$_GET[$variable] = str_replace("'", "\'", $_GET[$variable]);
}
// Modificamos las variables de formularios
foreach($_POST as $variable=>$valor){
$_POST[$variable] = str_replace("'", "\'", $_POST[$variable]);
}
?>
#############################################################################################
No Registrado
IMPOSIBLE
REGISTRARSE
CON LOS DATOS
QUE HA INTRODUCIDO
El mail introducido no es correcto
registrarse
IMPOSIBLE
REGISTRARSE
CON LOS DATOS
QUE HA INTRODUCIDO
Debe rellenar los campos en negrita
registrarse
IMPOSIBLE
REGISTRARSE
CON LOS DATOS
QUE HA INTRODUCIDO
Ya existe un usuario con ese DNI
registrado
registrarse
IMPOSIBLE
REGISTRARSE
CON LOS DATOS
QUE HA INTRODUCIDO
El nombre de usuario introducido
ya existe
registrarse
IMPOSIBLE
REGISTRARSE
CON LOS DATOS
QUE HA INTRODUCIDO
Ya existe un usuario con ese DNI registrado
El nombre de usuario introducido
ya existe
registrarse
IMPOSIBLE
REGISTRARSE
CON LOS DATOS
QUE HA INTRODUCIDO
La tarjeta esta caducada
registrarse
###############################################################################################
Partidos
LISTADO DE LOS
PARTIDOS
\n";
$tofile2 .= "<" . "!" . "DOCTYPE LISTA SYSTEM \"partidos_solicitados.dtd\"" . ">" . "\n";
$tofile2 .= "\n";
$link = mysql_connect('localhost','Servicio Web','******') or die(mysql_error());
$db = mysql_select_db('ventas_web') or die(mysql_error());
$tofile2 .= "\n";
$sql = "SELECT * FROM partidos";
$res=mysql_query($sql) or die (mysql_error());
while($row= mysql_fetch_array($res))
{
$tofile2 .= "\t\n";
while (list($key,$value)=each($row))
{
if (is_string($key))
{
if (($key != "Vendidas")&& ($key != "Codigo") && ($key != "Fich_Partido")&& ($key != "Cod_Escenario"))
{
$tofile2 .= "\t\t<";
$tofile2 .= $key;
$tofile2 .= ">" . $value;
$tofile2 .= "" . $key . ">\n";
}
}
}
$tofile2 .= "\t\n";
}
$tofile2 .= "\n";
//Escribimos el string en nuestro archivo y cerramos el manipulador
fwrite($handle2,$tofile2);
fclose($handle2);
?>
BALONCESTO
VS
BALONMANO
VS
FUTBOL
VS
FUTBOL SALA
VS
Obtener fichero XML con todos los partidos
Obtener DTD del fichero XML
################################################################################################
Registrado
SUS DATOS HAN
SIDO
REGISTRADOS CORRECTAMENTE
##################################################################################
REGISTRO DE CLIENTES
REGISTRO DE CLIENTES
#######################################################################################################
Ejemplos Javascript: ejemplo práctico
Volver a la pagina principal
VOLVER
A LA PAGINA PRINCIPAL
########################################################################################
###########################################################################################
Acceso Compras Usuario
Registrarse
##########################################################################################
Compra-Realizada
entradas para
entradas para VS
entradas para
FINALIZAR
####################################################################################################
################################################################################################
###########################################################################################
############################################################################################
########################################################################################
########################################################################################
#########################################################################################
###########################################################################################