Cookies

  • Dan030981
  • Novice
  • Novice
  • User avatar
  • Posts: 23
  • Loc: Mass

Post 3+ Months Ago

I do not have much knowledge in this area but I would like to get some help. Can someone help me or direct me on how to properly code cookies to a website page?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9089
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Hi Dan,

What exactly are you wanting to do with the cookies? Do you plan to do this via server side by using a programming language such as PHP, or do you plan to do this client side using JavaScript? Please be very descriptive on what you are trying to achieve so that we can help you. Your current question is vague which is most likely why you have not received any answers. Thanks!
  • Dan030981
  • Novice
  • Novice
  • User avatar
  • Posts: 23
  • Loc: Mass

Post 3+ Months Ago

Yes using it on the server side php language. When I user clicks on the close link there would be a cook created so that when a user return the information will be storage at a fix sort of time,

Sorry for the long reply
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9089
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

If you plan to use PHP, then you would probably use the setcookie function quite a bit. This page:

http://php.net/manual/en/function.setcookie.php

Pretty much explains how to use that function as well as many examples on how to read and write cookies.
  • Dan030981
  • Novice
  • Novice
  • User avatar
  • Posts: 23
  • Loc: Mass

Post 3+ Months Ago

I'm still in the learning process of setting cookies. I want to set a cookie to this code. Whenever a user gets a PM a message box say "You got a new message" will appear. After the user click the close button the message will disappear and will not reappear until the session or until the cookie expire.

Right now the way it is set up is every time a user get a new PM the message box will appear and it keeps on appearing on every page when you refresh it and when you click the close button. How would I set up a cookie that will keep it from reappearing after the close button is click?


PHP Code: [ Select ]
<?php if(isloggedin()){ ?>
 
<!--this is email notification-->  
<?php
 
   //get unread messages
   $num_messages = count_unread_messages();
   if($num_messages){
      $num = $num_messages;
   } else {
      $num = 0;
   }
 
   if($num == 0){
 
?>
 
<?php
    }
?>
    <?php if($num_messages): ?>
        <script type="text/javascript">
          $(function(){
            $.jnotify('Email notification', 'Hi <?php echo $_SESSION['user']->name; ?>, you have <?php echo $num; ?> new messages. Please go to your message inbox to view all messages. <a class= "inside-links" href="">Messages</a> ' , '<?php echo THEME_VENDORS ?>notify/images/email.png', {lifeTime: 5000});
            });
            </script>
    <?php endif; ?>
   
 
<!--end email notification-->
  1. <?php if(isloggedin()){ ?>
  2.  
  3. <!--this is email notification-->  
  4. <?php
  5.  
  6.    //get unread messages
  7.    $num_messages = count_unread_messages();
  8.    if($num_messages){
  9.       $num = $num_messages;
  10.    } else {
  11.       $num = 0;
  12.    }
  13.  
  14.    if($num == 0){
  15.  
  16. ?>
  17.  
  18. <?php
  19.     }
  20. ?>
  21.     <?php if($num_messages): ?>
  22.         <script type="text/javascript">
  23.           $(function(){
  24.             $.jnotify('Email notification', 'Hi <?php echo $_SESSION['user']->name; ?>, you have <?php echo $num; ?> new messages. Please go to your message inbox to view all messages. <a class= "inside-links" href="">Messages</a> ' , '<?php echo THEME_VENDORS ?>notify/images/email.png', {lifeTime: 5000});
  25.             });
  26.             </script>
  27.     <?php endif; ?>
  28.    
  29.  
  30. <!--end email notification-->
  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1244
  • Loc: Sydney

Post 3+ Months Ago

Image

:P

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 146 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.