Cookies

  • Dan030981
  • Novice
  • Novice
  • User avatar
  • Joined: Oct 16, 2011
  • Posts: 18
  • Loc: Mass
  • Status: Offline

Post October 29th, 2011, 4:14 pm

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
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post October 29th, 2011, 4:14 pm

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8925
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post October 31st, 2011, 1:11 pm

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!
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Dan030981
  • Novice
  • Novice
  • User avatar
  • Joined: Oct 16, 2011
  • Posts: 18
  • Loc: Mass
  • Status: Offline

Post November 7th, 2011, 7:15 am

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
  • Joined: Dec 20, 2002
  • Posts: 8925
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post November 9th, 2011, 6:35 am

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.
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Dan030981
  • Novice
  • Novice
  • User avatar
  • Joined: Oct 16, 2011
  • Posts: 18
  • Loc: Mass
  • Status: Offline

Post August 25th, 2012, 3:58 pm

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
  • Joined: Apr 15, 2011
  • Posts: 1195
  • Loc: Sydney
  • Status: Offline

Post August 26th, 2012, 2:03 am

Image

:P

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: ScottG and 231 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
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.