Jump to content

Dont display again


doddsey_65

Recommended Posts

Ive created a notice system which shows notices to the visitors of my forum. The thing is though I need a system where the logged in user can close the notice and not have it displayed again. What would be the best way to accomplish this? Would cookies be the best idea? Because that would mean setting a cookie for every notice that has been closed.As far as i can think of that's the only way. Any thoughts?

Link to comment
Share on other sites

store it in the database? Have one of two possible options, and in the notice system check whether it's the first or second option. If first option(default), show notices, otherwise if second option don't show them. Atleast then if they access your site from a different computer they won't have to close the notices again.

Link to comment
Share on other sites

You could probably create a table for the notifications and when the user clicks the "close" button it would send the word "hide" or whatever you want to the database so you can use a if statement to hide it.

 

Ex:

<?php

//When person clicks hide button
mysql_query("UPDATE notifications SET notification_type = '$notification_type', user = '$Session_or_Cookie', display = 'hide'") or trigger_error(mysql_error());

//then on the forum
$find = "SELECT notification_type, display FROM notifications WHERE user = '$Session_or_Cookie'";
$run = mysql_fetch_assoc(mysql_query($find)) or trigger_error(mysql_error());

$notification = $run['notification_type'];
$display = $run['display'];

if($display = "hide"){

}else{

echo "
$notification
";

}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.