jquery - Php Cookie Ignored -



jquery - Php Cookie Ignored -

i have module should using php create cookie if doesn't exist. if doesn't confirm cookie's existence creates , implements js file, shows overlay. otherwise function should end. problem, js loads on every refresh though shouldn't. please help, highly appreciate it, give thanks you.

cookie php

<?php /** * @file * checks cookie, non-existent: creates cookies + implements js, else * removes specfic content */ /* * implements hook_preprocess_page(). */ function cookie_check_preprocess_page($hook, &$variables) { // check cookie if (!isset($_cookie['firsttime'])) { // set variables setcookie $name = 'firsttime'; $value = 'no'; // 6 months $expire = time()+(15768000); // directory $path = '/~wolfden/'; $domain = 'hitechwolf.com'; // create cookie setcookie($name, $value, $expire, $path, $domain, true, true); // implement js // welcome overlay/button functionality on first time visit $path = drupal_get_path('module', 'cookie_check'); drupal_add_js($path . '/js/welcome_button.js'); } else { homecoming ''; } }

overlay js

/** * @file * appends welcome overlay page, upon button * click closes overlay */ (function ($, drupal){ drupal.behaviors.welcomeoverlay = { attach : function() { $('#block-panels-mini-welcome-overlay').appendto('body'); function clickbutton() { $('.welcome-content').fadeto('500', 0, 'linear', function(){ $('.welcome-overlay').slidetoggle('700', 'linear', function(){ $('#block-panels-mini-welcome-overlay').remove(); }); }); } settimeout(function () { $('.welcome-overlay').slidetoggle('700', 'linear', function(){ $('.welcome-content').fadeto('500', 1, 'linear'); }); }, 1500); $('.w-button').on('click', clickbutton); } } })(jquery, drupal);

site in question

your cookie not setting due 1 reason. wrote code set cookie is

setcookie($name, $value, $expire, $path, $domain, true, true);

last 2 parameters set true. sec lastly true security, indicates cookie should transmitted on secure https connection client. when set true, cookie set if secure connection exists.

your site "http://hitechwolf.com/wolfden/" not https. cookie not setting.

try setting false

setcookie($name, $value, $expire, $path, $domain, false, true);

php jquery cookies drupal

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -