WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : javascript cookie settings
Categories : Java Script, Beginner Guides Click here to Update Your Picture
kanttt tbk
Date : Oct 06th 2009
Grade : Be the 1st to grade this Code Example
Viewed : 1866
File : No file for this code example.
Images : No Images for this code example.
Search : More code by kanttt tbk
Action : Grade This Code Example
Tools : My Examples List

 
Like this code?
Show the author your appreciation.
Submit your own code examples 
 

This codes set and gets cookies and also, if cookies are not set in the browser, it shows a page to warn member.

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());

if (document.cookie.length<=0)
    location="jscookietest.php?cookie=0";
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function issetCookie(c_name)
{
value=getCookie(c_name);
if (value!=null && value!="")
{
    return 1;
}
else
{
    return 0;
}
}

function deleteCookie ( cookie_name )
{
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}



Get your browser details using javascript
Categories : Java Script, Beginner Guides, Browsers
JavaScript dropdown list menu to switch any page.
Categories : Java Script, Beginner Guides, Form Processing
Easy alert box pop-up function
Categories : PHP, Java Script, Beginner Guides
Local Time clock and Server time usign PHP and JavaScript
Categories : PHP, Java Script, Date Time, Beginner Guides
Store, retrieve and delete cookies using JavaScript.
Categories : Java Script, Cookies, Beginner Guides, Cookies
Form Processing : with alert Highlight field name which is not filled by user
Categories : Java Script, Form Processing, Data Validation, Beginner Guides, Web Design
Show hide table rows to make dynamic forms
Categories : Beginner Guides, Java Script, Form Processing, HTTP
Fancy "Quick Access" Navigation Link
Categories : Java Script, Navigation, User Interface, DHTML, Beginner Guides
Show and Hide Tables, Table Rows, Form Elements Etc.
Categories : Java Script, Beginner Guides
Simple Javascript CSS Digital Clock
Categories : Java Script, Date Time, CSS, Beginner Guides, Web Design
Show or Hide your Content using Javascript
Categories : Java Script, HTML, CSS, Beginner Guides
Validating a URL with JavaScript RegExp
Categories : Java Script, Data Validation, Beginner Guides
Newbie Notes #9 - Hyperlinking a post
Categories : PHP, Java Script, HTML and PHP, Beginner Guides
Conditional Check - a script that allows a user to submit a form only if the user check a checkbox.
Categories : HTML, Java Script, Form Processing, Beginner Guides
Changing the Style of form objects using the JavaScript OnClick method.
Categories : Java Script, Form Processing, Beginner Guides, CSS