Jump to content

Search the Community

Showing results for tags 'find cookie'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Thank you for taking the time to help me! My "check for cookie" code doesn't work. It doesnt show any errors or do anything. Can someone help me understand what I am doing wrong. I am trying to create the code to check for a cookie. If it doesn't exist I want it to display a <div>information</div>. My code to check for a cookie is called usercheck_cookie.html Here is my code to check for a username: <script> function getCookie(c_name) { var i,x,y,ARRcookies=document.cookie.split(";"); for (i=0;i<ARRcookies.length;i++) { x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); x=x.replace(/^\s+|\s+$/g,""); if (x==c_name) { return unescape(y); } } } function checkCookie() { var User_ID=getCookie("User_ID"); if (User_ID!=null && User_ID!="") { alert("Welcome again " + username); } else { alert("You are not a user!); echo "<html><div id="Signup" style="position:fixed;width:1000px;height:500px;top:300px;left:50%;background-color:#220916;"> </div></html>"; } } </script> Here is how I set it into my index.shtml: <!DOCTYPE html> <html> <head> <title>Diamond Book Club</title> <!--#include virtual="usercheck_cookie.html" --> </head> <body onload="checkCookie()"> // and the rest of my website is below Sincerely, Brett Hartel
×
×
  • 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.