-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwatch_share.php
126 lines (85 loc) · 2.73 KB
/
watch_share.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
<?php
/* --- GenderWatchProtocole · new_personne.php ------
Page pour créer une nouvelle personne
---------------------------------------------*/
include("header.php");
include("data_watch.php");
if (isset($_GET["msg"])) {
$msg = (string)$_GET["msg"];
} else {
$msg = NULL;
}
?>
<body>
<h2>Partage d'utilisation</h2>
<?php
//Vérification modification vient de lea créat·eur·ice
if ($user_data["id"] == $watch_data["created_by"]){
// Boutons menu
bouton_lien("Retour", "watch.php");
bouton_lien("Déconnexion", "loggout.php");
?>
</br><p><u>Attention!</u></br>
Partager un watch de cette manière donnera tout droit de</br>
modification, d'utilisation et de partage des résultats du watch.</br>
Pour donner un accès de visualisation, utilisez le lien ou</br>
la clé donnée dans les résultats du watch.</p>
<?php echo "<p>" . $msg . "</p>"; ?>
<!-- Form pour infos -->
<form method="post" action="watch_share_act.php">
<input type="hidden" name="action" value="add"/>
<label for="name">Nom:</label>
<input type="text" name="name"/>
</br></br>
<button method="submit">Partager</button>
</form>
<!--Affichage avec qui déjà partagé -->
</br></br>
<table style="width: 45%;">
<tr>
<th>Retirer l'accès</th>
<th>Nom d'utilisat·eur·rice</th>
</tr>
<?php
// Pour récupérer le nom
$getName = $database->prepare("SELECT user FROM authorized_user WHERE id = ?");
// Récupération accès au watch
$queryShare = $database->query("
SELECT user_access
FROM watch
WHERE id = " . $watch_data["id"]);
$user_access = $queryShare->fetch()["user_access"];
$queryShare->closeCursor();
$user_access = preg_split("#,#", $user_access);
foreach ($user_access as $user) {
if (($user != "") and ($user != "1") and ($user != $watch_data["created_by"])) {
$getName->execute(array($user));
$name = $getName->fetch();
$getName->closeCursor();
?>
<tr>
<td>
<form method="post" action="watch_share_act.php">
<input type="hidden" name="action" value="remove"/>
<input type="hidden" name="id" value="<?php echo $user; ?>"/>
<button action="submit">Supprimer</button>
</form>
</td>
<td>
<?php echo $name["user"]; ?>
</td>
</tr>
<?php
}
}
?>
<?php } else { ?>
<!-- Pas lea créateurice -->
<p>Seul lea créat·eur·rice du watch peut modifier les droits</br>
de partage du watch.</p>
<?php bouton_lien("Retour", "watch.php");
} ?>
<?php
include("footer.php");
?>
</body>