forked from s4l1h/openex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajaxLOAD.php
59 lines (49 loc) · 1.5 KB
/
ajaxLOAD.php
1
<?phpinclude 'models/config.php';include 'models/chat.config.php';$idaa = $loggedInUser->user_id;$db->query("SELECT * FROM messages WHERE `hidden`='0' ORDER BY (id) ASC LIMIT 100");$data = $db->GET();foreach($data as $key => $value) { if(!isUserMod($idaa) and !isUserAdmin($idaa)) { $color = htmlentities($value['color']); $user = htmlentities($value['username']); $msg = htmlentities($value['message']); echo "<li id='msg_row'><b id='u_name_chat' style='color: ".$color.";'>".$user."</b>: ".$msg."</li>"; }else{ $color = htmlentities($value['color']); $user = htmlentities($value['username']); $msg = htmlentities($value['message']); $todelete = $db->real_escape_string($value['id']); echo "<li id='msg_row'><b id='u_name_chat' style='color: ".$color.";'>".$user."</b>: ".$msg."<a color='blue' href='#' rel=".$todelete." class='delete' onClick='deleteChat(this);'>delete</a></li>"; }}?><script> <?php if(isUserMod($idaa) || isUserAdmin($idaa)) { ?> function deleteChat(t) { console.log("Clicked delete"); var toDEL = $(t).parent(); var id = $(t).attr('rel'); console.log(id); $.post('ajaxDEL.php', {id: id}) .done(function(data) { $(toDEL).hide(); }); } /*$('.delete').click(function() { //console.log("Clicked Delete."); var toDEL = $(this).parent(); var id = $(this).attr('rel'); $.post('ajaxDEL.php', {id: id}); //.done(function(data) { // $(toDEL).hide(); //}); });*/ <?php } ?></script>