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
| <?php
session_start();
?>
<link href="css/pagination.css" rel="stylesheet">
<script type="text/javascript">
$(document).ready(function(){
$("#envoyer").click(function(e){
e.preventDefault();
var classi = $('input'). find('[type=checkbox]:checked').attr('value');
var dataString = 'msg='+ classi ;
$.ajax({
type:"post",
url:"delete_msg.php",
data:dataString,
success: function (d) {
alert("message envoyé");
}
});
});
});
</script>
<script type="text/javascript">
// Show loading overlay when ajax request starts
$( document ).ajaxStart(function() {
$('.loading-overlay').show();
});
// Hide loading overlay when ajax request completes
$( document ).ajaxStop(function() {
$('.loading-overlay').hide();
});
</script>
<div class="post-wrapper">
<div class="loading-overlay"><div class="overlay-content">Loading.....</div></div>
<div id="posts_content">
<input type="submit" id="envoyer" value="Supprimer">
<?php
//Include database configuration file
include('dbConfig.php');
//Include Pagination class file
include('Pagination.php');
$limit = 10;
$user = $_SESSION["id_user"];
//Get the total number of rows
$queryNum = $db->query("SELECT COUNT(*) as postNum FROM tchat_live where id_recev = $user");
$resultNum = $queryNum->fetch_assoc();
$rowCount = $resultNum['postNum'];
//Initialize Pagination class and create object
$pagConfig = array('baseURL'=>'getData.php', 'totalRows'=>$rowCount, 'perPage'=>$limit, 'contentDiv'=>'posts_content');
$pagination = new Pagination($pagConfig);
//Get rows
$query = $db->query("SELECT * FROM tchat_live where id_recev = $user ORDER BY dure DESC LIMIT $limit");
if($rowCount > 0){ ?>
<div class="posts_list">
<?php
while($row = $query->fetch_assoc()){
$postID = $row['id'];
$messages = $row['body_box'];
$idsender = $row['id_sender'];
$querys = $db->query("SELECT * FROM membre where id = $idsender");
$rows = $querys->fetch_array();
$pseudo = $rows['pseudo'];
$pseudo = utf8_encode($pseudo);
?>
<li>
<input type="checkbox" name="msg[]" style="float: right;" class="msg[]" id="msg[]" value"<?php echo $postID; ?>"/><a href="?page=answer&idmsg=<?php echo $postID; ?>">
<span class="mail-sender"><?php echo $pseudo; ?></span>
<span class="mail-message-preview"><?php echo $messages; ?></span>
</a>
</li>
<?php } ?>
</div>
<?php echo $pagination->createLinks(); ?>
<?php } ?>
</div>
</div> |
Partager