-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUsuarios.php
115 lines (102 loc) · 2.35 KB
/
Usuarios.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
<html>
<body>
<form>
<table>
<tr>
<td> <div class="form-group">
<label for="Nombre">Nombre:</label></td>
<td> Pauli</td>
<td> <input type="text" name="nombreact" class="form-control"/>
</div></td>
<td></td>
</tr>
<tr>
<td> <div class="form-group">
<label for="Apellido">Apellido:</label></td>
<td> Escobar</td>
<td> <input type="text" name="apellidoact" class="form-control"/>
</div></td>
<td></td>
</tr>
<tr>
<td> <div class="form-group">
<label for="email">Email:</label></td>
<td> [email protected]</td>
<td> <input type="text" name="emailact" class="form-control"/>
</div></td>
<td></td>
</tr>
<tr>
<td> <div class="form-group">
<label for="avatar">Avatar:</label></td>
<td> foto</td>
<td> <input type="file" name="avataract"/>
</div></td>
<td></td>
</tr>
<tr>
<td> <div class="form-group">
<label for="username">Username:</label></td>
<td> paulie</td>
<td> <input type="text" name="usernameact"/>
</div></td>
<td></td>
</tr>
<tr>
<td> <div class="form-group">
<label for="pwd">Password:</label></td>
<td> eeee</td>
<td> <input type="password" name="pwdact"/>
</div></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td><div class="form-group">
<button class="btn btn-default" type="submit">Enviar</button>
</div></td>
</tr>
</table>
</form>
</body>
</html>
<?php
session_start();
$servername = "root";
$username = "username";
$password = "password";
$dbname = "pablore";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
function Update(a, b, c, d, e, f){
if(a!='' || a!='$_SESSION['username']'){
$sql = "UPDATE Users SET nombre='a' WHERE username=$_SESSION['username']";
}
if(b!=''){
$sql = "UPDATE Users SET apellido='b' WHERE username=$_SESSION['username']";
}
if(c!=''){
$sql = "UPDATE Users SET avatar='c' WHERE username=$_SESSION['username']";
}
if(d!=''){
$sql = "UPDATE Users SET email='d' WHERE username=$_SESSION['username']";
}
if(e!=''){
$sql = "UPDATE Users SET username='e' WHERE username=$_SESSION['username']";
}
if(f!=''){
$sql = "UPDATE Users SET password='f' WHERE username=$_SESSION['username']";
}
if ($conn->query($sql) === TRUE) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . $conn->error;
}
}
$conn->close();
?>