i'm working on a project that includes a minimail/chat function that has the option to tick off when u have read the message and flag a user.
The flag and tick off options doesnt work anymore after i eddited something but i cannot find the problem anymore.
The game doesnt support newer versions of PHP for now.
- $m['id']; = 22
- $m['read'] = 0
Query 1 = array(3) { ["id"]=> string(2) "28" ["mark_read_x"]=> string(2) "10" ["mark_read_y"]=> string(2) "10" }
Query 2 = array(3) { ["id"]=> string(2) "28" ["flag_user_x"]=> string(1) "8" ["flag_user_y"]=> string(1) "4" }
<?php
$mid = $m['id'];
if(isset($_POST['mark_read'])){
$mid2 = $_POST['id'];
$query2 = "UPDATE `user_messages` SET `read` = '1' WHERE `read` = '0' AND `user_messages`.`id` = '$mid2'";
mysql_query($query2) or die(mysql_error());
header("Refresh:0");
}
?>
<?php if($m['read'] === '0'){ ?>
<form method="post">
<input type="hidden" name="id" value="<?php echo $mid; ?>">
<input src="tick.png" title="Mark as read" type="image" alt="submit" name="mark_read">
</form>
<?php } else { echo ''; } ?>
<?php
if(isset($_POST['flag_user'])){
$mid2 = $_POST['id'];
$query3 = "UPDATE `user_messages` SET `flagged` = '1' WHERE `flagged` = '0' AND `user_messages`.`id` = '$mid2'";
mysql_query($query3) or die(mysql_error());
header("Refresh:0");
}
?>
<form method="post">
<input type="hidden" name="id" value="<?php echo $mid; ?>">
<input src="exclamation.png" title="Flag message" type="image" alt="submit" name="flag_user">
</form>