This repository was archived by the owner on Jan 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodificar_datos_ong.php
More file actions
130 lines (100 loc) · 5.54 KB
/
modificar_datos_ong.php
File metadata and controls
130 lines (100 loc) · 5.54 KB
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
<?php
include_once ('session.php');
include_once ('../../database_conn.php');
if(!isset($_SESSION['user'])) {
header('location : login.php');
}
if($_SESSION['user']['categoryName'] != 'ONG') {
header('location : perfil.php');
}
if (isset($_POST['submit'])) {
$conexion = conexion();
///////////
$file = $_FILES['archivo']['tmp_name'];
$filename = $_FILES['archivo']['name'];
//parse Binary
///// Me refiero como $file
if ($file != NULL) {
$file=mysqli_real_escape_string($conexion, file_get_contents($_FILES['archivo']['tmp_name']));
$query = "update ONG set name='".$_POST['nombre']."', password='".$_POST['password']."', description='".$_POST['descripcion']."', ubication='".$_POST['ubicacion']."', website='".$_POST['contacto']."', picture='".$file."' where email='".$_SESSION['user']['userEmail']."'";
} else {
$query = "update ONG set name='".$_POST['nombre']."', password='".$_POST['password']."', description='".$_POST['descripcion']."', ubication='".$_POST['ubicacion']."', website='".$_POST['contacto']."' where email='".$_SESSION['user']['userEmail']."'";
}
//INTENTO PEDRO
//$foto = addslashes(file_get_contents($_FILES['foto']['tmp_name']));
//$foto = base64_encode($foto);
//////
mysqli_query($conexion, $query);
header('location: principal_ong.php');
}
?>
<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>AccionSocialMed</title>
<link rel="stylesheet" href="assetsModificarDatosONG/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="assetsModificarDatosONG/css/Custom-File-Upload.css">
<link rel="stylesheet" href="assetsModificarDatosONG/css/Navegacin-APS.css">
<link rel="stylesheet" href="assetsModificarDatosONG/css/styles.css">
</head>
<body>
<?php include '_navbar.php'; ?>
<div style="padding: 100;"><label></label></div>
<div class="container">
<div class="row">
<div class="col-md-4 text-center">
<?php
$conexion = conexion();
$query = "select name, email, password, description, ubication, website, picture from ONG where email='".$_SESSION['user']['userEmail']."'";
if ($resultado = mysqli_query($conexion, $query)) {
$datos = mysqli_fetch_assoc($resultado);
echo "<form method='post' id ='formulario' enctype='multipart/form-data'> ";
echo "<div class='form-group'>
<img src='data:image/jpg; base64, " . base64_encode ($datos['picture'])."' style='width: 250px;height: 250px;' >
</div>";
echo "<div class='form-group'>
<input type='file'accept='image/*' name='archivo' style='margin: 6px;width: 310px;'>
</div>";
echo "</div>";
echo "<div class='col-md-4'>";
echo "<div class='form-group'>
<label>Correo Electrónico</label>
<input class='form-control' type='text' id='email' name='email'value='".$datos['email']."' disabled>
</div>";
echo "<div class='form-group'>
<label>Nombre:</label>
<input class='form-control' type='text' id='nombre' name='nombre'value='".$datos['name']."'>
</div>";
echo "<div class='form-group'>
<label>Contraseña:</label>
<input class='form-control' type='password' id='password' name='password' value='".$datos['password']."'>
</div>";
echo "<div class='form-group'>
<label>Ubicación:</label>
<input class='form-control' type='text' id='ubicacion' name='ubicacion'value='" . $datos['ubication'] . "'>
</div>";
echo "<div class='form-group'>
<label>Contacto:</label>
<input class='form-control' type='text' id='contacto' name='contacto'value='" . $datos['website'] . "'>
</div>";
echo "</div>";
echo "<div class='col-md-4'>";
echo "<div class='form-group' style='height: 100%;'>
<label>Descripción:</label>
<textarea style='height: 90%; resize: none;'class='form-control' id='descripcion' name='descripcion'>" . $datos['description'] . "</textarea>
</div>";
} else {
echo "error en la consulta";
}
?>
</div>
<button class="btn btn-primary btn-block" style="margin-left: 34%; width: 66%;background-color: #103567; border: none" type="submit" name="submit">Guardar</button>
</form>
</div>
</div>
<script src="assetsModificarDatosONG/js/jquery.min.js"></script>
<script src="assetsModificarDatosONG/bootstrap/js/bootstrap.min.js"></script>
<script src="assetsModificarDatosONG/js/Custom-File-Upload.js"></script>
</body>
</html>