-
Notifications
You must be signed in to change notification settings - Fork 0
/
read.php
21 lines (20 loc) · 1022 Bytes
/
read.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
global $wpdb; // On récupère l'e-mail demandé
$reponse = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}messagerie WHERE id = %d", $_GET['mail']));
if(empty($reponse))
{
echo '<meta http-equiv="refresh" content="0;URL=?page=messagerie"/>';
}
else
{
// On update la table pour dire que l'email n'est plus non-lu
$wpdb->update('wp_messagerie', array('unread' => '0'), array('id' => $_GET['mail']), array('%d'), array('%d'));
}
?>
<!-- On affiche le mail -->
<table id="inbox">
<tr><td><?php _e('De :', 'messagerie');?></td> <td><?php echo get_user_by('id', $reponse->sender)->display_name; ?></td></tr>
<tr><td><?php _e('À :', 'messagerie'); ?></td> <td><?php echo get_user_by('id', $reponse->receiver)->display_name; ?></td></tr>
<tr><td><?php _e('Objet :', 'messagerie');?></td><td><?php echo $reponse->objet; ?></td></tr>
<tr><td><?php _e('Message :', 'messagerie');?></td> <td><textarea id="test2"><?php echo $reponse->message; ?></textarea></td></tr>
</table>