-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit-perfil.php
130 lines (112 loc) · 7.38 KB
/
edit-perfil.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
<?php
session_start();
require_once("connection.php");
$userId=$_SESSION['user']['user-id'];
$errorOld = isset($_GET['errorOld']) ? intval($_GET['errorOld']) : null;
$errorName=isset($_GET['errorName']) ? intval($_GET['errorName']) : null;
$errorMail=isset($_GET['errorMail']) ? intval($_GET['errorMail']) : null;
$errorPassword=isset($_GET['errorPassword']) ? intval($_GET['errorPassword']) : null;
$errorRpassword=isset($_GET['errorRpassword']) ? intval($_GET['errorRpassword']) : null;
$sql="SELECT * FROM usuarios WHERE id = ?";
$sql=$mysqli->prepare($sql);
$sql->bind_param("i", $userId);
$sql->execute();
$result=$sql->get_result();
$sql->close();
$mysqli->close();
$user=mysqli_fetch_assoc($result);
$userName=$user['nombre'];
$password=$user['password_hash'];
$email=$user['email'];
$user=$_SESSION['user'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="google" content="notranslate">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AustrianEconomicsForum</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" href="img/icon.png">
<script src="php/icon-proxy.php?url=https://kit.fontawesome.com/b685f735ab.js" crossorigin="anonymous"></script>
</head>
<body>
<div class="container-all-index">
<div class="menu">
<a href="index.php"><img src="img/logo-dark-menu.png" class="menu_logo"></a>
<nav class="navbar">
<a href="index.php" ><div class="menu_item">
<i class="fa-solid fa-house fa-lg" style="color: #ffffff;"></i><p>Inicio</p>
</div></a>
<div class="menu_item" id="search-button">
<i class="fa-solid fa-magnifying-glass fa-lg" style="color: #ffffff;"></i><p>Buscar</p>
</div>
<a href="explore.php" ><div class="menu_item">
<i class="fa-solid fa-compass fa-lg" style="color: #ffffff;"></i><p>Explorar</p>
</div></a>
<a href="publicar.php" ><div class="menu_item">
<i class="fa-solid fa-plus fa-lg" style="color: #ffffff;"></i><p>Publicar</p>
</div></a>
<a href="noticias.php" ><div class="menu_item">
<i class="fa-sharp fa-solid fa-newspaper"></i><p>Noticias</p>
</div></a>
<div class="menu_item " id="notificacion">
<i class="fa-solid fa-bell" style="color: #f2f2f2;"></i><p>Notificaciones</p>
<div id="noti-ball"></div>
</div>
<div class="lista-peticiones" id="lista-peticiones"><p style="text-align:center;">No tienes notificaciones pendientes.</p></div>
<a <?php $id=$user['user-id']; echo "href='perfil.php?id=$id'"?> ><div class="menu_item">
<img src="img/icon.png" class="index-perfil-img"><p ><?php echo $user['username']; ?></p>
</div></a>
</nav>
<div class='options-container'>
<form class='closed-options' id='options-form' methos='POST' action='session-destroy.php'>
<ul class='closed-options'id='options-container'>
<li class='options-item'><button type='submit' class='options-button'>Cerrar sesión</button></li>
<li class='options-item'>Modo Día</li>
</ul>
</form>
<div class='menu_item options' id='options-button'><i id='bars' class="fa-sharp fa-solid fa-bars fa-lg"></i><p>Opciones</p></div>
</div>
</div>
<div class="search-bar-container" id="search-bar-container">
<form action="searching.php" method="POST">
<input autocomplete="off" placeholder="Search..." class="search-bar" id='search-bar' name='search-bar' type="text"></input>
<button class='search-button normal_button' id='search-button2' type="submit">Buscar</button>
</form>
</div>
<div id='result'></div>
<div class='perfil-header'>
<div><img class='perfil-photo' src='img/icon.png'></div>
<div class='perfil-data'>
<div class='perfil-name'>
<p class="userName" style='color:white; '><?php echo $userName; ?></p>
</div>
</div>
</div>
<div class="content-container" id='posts'>
<form class="edit-container" method="POST" action="php/edicion-perfil.php">
<div class="edit-data"><label for="email">Nuevo E-mail: </label><input disabled <?php echo "value='". $email ."'" ?> placeholder="Nuevo E-mail" type="email" name="email" id="email" ><i class="fa-solid fa-pen-to-square" style="color: #d6d6d6;"></i></div>
<?php if($errorMail){echo "<p style='text-align:center; border:1px solid red; padding:10px; width:20%; margin:0 auto; color:red; border-radius:5%; margin-bottom:30px;'>El email introducido no es válido</p>";} ?>
<div class="edit-data"><label for="username">Nuevo nombre de usuario: </label><input disabled <?php echo "value='". $userName ."'" ?> placeholder="Nuevo nombre de usuario" type="text" name="username" id="username"></div>
<?php if($errorName){echo "<p style='text-align:center; border:1px solid red; padding:10px; width:20%; margin:0 auto; color:red; border-radius:5%; margin-bottom:30px;'>El nombre de usuario introducido no es válido</p>";} ?>
<div class="edit-data"><label for="password">Nueva contraseña: </label><input disabled placeholder="Nueva contraseña" type="password" name="password" id="password"></div>
<?php if($errorPassword){echo "<p style='text-align:center; border:1px solid red; padding:10px; width:20%; margin:0 auto; color:red; border-radius:5%; margin-bottom:30px;'>La nueva contraseña introducida no es válida</p>";} ?>
<div class="edit-data"><label for="password">Repite la nueva contraseña: </label><input disabled placeholder="Repetir nueva contraseña" type="password" name="Rpassword" id="Rpassword"></div>
<?php if($errorRpassword){echo "<p style='text-align:center; border:1px solid red; padding:10px; width:20%; margin:0 auto; color:red; border-radius:5%; margin-bottom:30px;'>Las nuevas contraseñas deben ser iguales entre ellas</p>";} ?>
<div class="edit-data"><label for="old-password">Antigua contraseña: </label><input disabled placeholder="Antigua contraseña" type="password" name="old-password" id="old-password"></div>
<?php if($errorOld){echo "<p style='text-align:center; border:1px solid red; padding:10px; width:20%; color:red; margin:0 auto; border-radius:5%; margin-bottom:30px;'>Tu antigua contraseña no es correcta</p>";} ?>
<div class=editButton-container><button class="editButton" type="submit">Editar</button></div>
</form>
<a href='php/delete-user.php'><button class="deleteButton">Borrar perfil</button></a>
</div>
</div>
<script src='js/options.js'></script>
<script src='js/peticiones-amistad.js'></script>
<script src="js/search.js"></script>
<script src="js/edit.js"></script>
</body>
</html>