-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
173 lines (152 loc) · 6.94 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<?php require_once('Connections/conexion.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO imagenes (imagen_id, strNombre, strDireccion, strDni, strDescripcion, strCodigo) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['imagen_id'], "int"),
GetSQLValueString($_POST['strNombre'], "text"),
GetSQLValueString($_POST['strDireccion'], "text"),
GetSQLValueString($_POST['strDni'], "text"),
GetSQLValueString($_POST['strDescripcion'], "text"),
GetSQLValueString($_POST['strCodigo'], "text"));
mysql_select_db($database_hackaton, $hackaton);
$Result1 = mysql_query($insertSQL, $hackaton) or die(mysql_error());
$insertGoTo = "peticion-enviada.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<html lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Hackaton - Almería">
<meta name="author" content="Grupo 12">
<link rel="shortcut icon" href="files/mini-logo.png">
<title>Inicio</title>
<!--empieza bootstrap-->
<link href="bootstrap/bootstrap.css" rel="stylesheet" type="text/css">
<link href="bootstrap/jumbotron-narrow.css" rel="stylesheet" type="text/css">
<link href="bootstrap/estilo.css" rel="stylesheet" type="text/css">
<!--termina bootstrap-->
<!--empieza effecthover-->
<link href="bootstrap/component.css" rel="stylesheet" type="text/css">
<script src="bootstrap/js/modernizr.custom.js"></script>
<!--termina effecthover-->
<style type="text/css">.jumbotron {background:rgba(252,242,190,0.50);}</style>
</head>
<body>
<div class="container">
<div class="header">
<ul class="nav nav-pills pull-right">
<section class="color-10">
<nav class="cl-effect-10">
<a href="index.php" data-hover="Inicio"><span>Inicio</span></a>
<a href="sugerencias.php" data-hover="Sugerencias"><span>Sugerencias</span></a>
</nav>
</section>
</ul>
<h3 class="text-muted"><img src="img/logociudad3.gif" width="90" height="60"></h3>
</div>
<h2 align="center" class="verde">¿Qué mejora le falta a tu ciudad?</h2>
<div class="jumbotron">
<p class="lead"><form name="form1" method="POST" enctype="multipart/form-data" target="_blank"><textarea name="strDescripcion" class="area" placeholder="Me gustaría..."></textarea></p>
</div>
<div class="row marketing">
<div class="col-lg-12">
<div class="posi">
<input type="text" name="strDireccion" class="doble" placeholder="¿DÓNDE OCURRE?">
<input type="text" name="strCodigo" class="codigo" placeholder="CP">
<input type="text" name="strNombre" class="uno" placeholder="NOMBRE"><br>
<input tabindex="text" name="strDni" class="uno" placeholder="DNI">
<div class="nota"><p>¡No te preocupes tus datos no serán <br>publicados!</p></div>
<div class="thumb"></div>
<div class="camara"><img src="img/camara.png"></div>
<div class="centra"><input type="file" id="files" name="imagen" id="imagen" /></div>
<div class="ayuda"><img src="img/help.png"></div>
<div class="boton"><input type="submit" onclick = "this.form.action = 'recibirFoto.php'" value="Subir foto"></div>
<div class="boton1"><input type="submit" onclick = "this.form.action = '<?php echo $editFormAction; ?>'" class="btn btn-lg btn-success" role="button" value="Enviar sugerencia"></div>
<input type="hidden" name="imagen_id" value="" />
<input type="hidden" name="MM_insert" value="form1" />
</form>
</div>
</div>
</div>
<div class="footer">
<p>© MejoraTuCiudad 2014</p>
</div>
</div> <!-- /container -->
<!--Start of Zopim Live Chat Script-->
<div class="zopim">
<script type="text/javascript">
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute('charset','utf-8');
$.src='//v2.zopim.com/?1VpTg1WyE5n2bDECgP9AJ8BakWgf8iKf';z.t=+new Date;$.
type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script');
</script>
</div>
<!--End of Zopim Live Chat Script-->
<output id="list"></output>
<script>
function archivo(evt) {
var files = evt.target.files; // FileList object
// Obtenemos la imagen del campo "file".
for (var i = 0, f; f = files[i]; i++) {
//Solo admitimos imágenes.
if (!f.type.match('image.*')) {
continue;
}
var reader = new FileReader();
reader.onload = (function(theFile) {
return function(e) {
// Insertamos la imagen
document.getElementById("list").innerHTML = ['<img class="thumb" src="', e.target.result,'" title="', escape(theFile.name), '"/>'].join('');
};
})(f);
reader.readAsDataURL(f);
}
}
document.getElementById('files').addEventListener('change', archivo, false);
</script>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
</body>
</html>