Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
doffer83
Worker
Worker


Joined: Apr 17, 2011
Posts: 117
Location: Amsterdam

PostPosted: Mon Dec 17, 2012 7:05 pm Reply with quote

In the Netherlands (new rulzz) we must put cookies accept button on the site voor the visitors... I would like to put also on my little 2 sites..

do you have to make such a warning.. you know that the visitor has to accept cookies

kind regards
 
View user's profile Send private message Visit poster's website
nuken
RavenNuke(tm) Development Team


Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Mon Dec 17, 2012 8:58 pm Reply with quote

There are several jquery cookie prompt scripts out there. You could use something like cPrompt Only registered users can see links on this board! Get registered or login! You would just need to add cprompt.min.js to your includes/jquery folder and create a file in includes/addons named head-Cookie_Prompt.php and include the following code in it:

Code:


<?php

if (stristr(htmlentities($_SERVER['PHP_SELF']), 'head-Cookie_Prompt.php')) {
   Header('Location: ../../index.php');
   die();
}
addJSToHead('includes/jquery/jquery.js', 'file');
addJSToHead('includes/jquery/cprompt.min.js', 'file');
$inlineJS = '<script type="text/javascript">
   cPrompt.checkCookie()
cPrompt.hideOnAccept = true;
cPrompt.cookieLink = "modules.php?name=Legal&amp;op=privacy";
</script>'."\n";
addJSToHead($inlineJS,'inline');

_________________
Only registered users can see links on this board! Get registered or login!

Last edited by nuken on Mon Feb 25, 2013 7:06 pm; edited 1 time in total 
View user's profile Send private message Send e-mail Visit poster's website
doffer83
PostPosted: Mon Dec 17, 2012 9:54 pm Reply with quote

nuken, mijn fault sorry I had to write it in my first post.. my little website is an old phpnuke... (long stoy when I discoverd raven my site was already online months ago)

I can put the next code in head.php

echo "<script language=\"javascript\" src=\"includes/cprompt.min.js\" type=\"text/javascript\"></script>";
echo "<script language=\"javascript\" src=\"includes/jquery.js\" type=\"text/javascript\"></script>";

and after that I don't know ... or is that enough?
 
nuken
PostPosted: Mon Dec 17, 2012 10:09 pm Reply with quote

You would need to include jquery first. You would then need to add
Code:



echo  '<script type="text/javascript">
   cPrompt.checkCookie()
cPrompt.hideOnAccept = true;
cPrompt.cookieLink = "link to your privacy policy";
</script>';



Of course "link to your privacy policy" would need to be changed to the actual link to your privacy policy.
 
jane65
Regular
Regular


Joined: Feb 24, 2009
Posts: 81
Location: UK

PostPosted: Mon Feb 25, 2013 6:22 pm Reply with quote

Hi,
I'm trying to add the cprompt cookie warning as described in these posts, so far I've added cprompt.min.js to includes/jquery folder and created a file in includes/addons named head-Cookie_Prompt.php including the code given here for the file but I don't quite understand what code I need to add next and what file I need to add it too to make the cookie prompt visible on my index page. I'm using Ravennuke 2.5.1.

Thank you in advance for any help with this. Smile
 
View user's profile Send private message
nuken
PostPosted: Mon Feb 25, 2013 7:11 pm Reply with quote

There is no next. If you add the cprompt.min.js and created the head-Cookie_Prompt.php with

Code:


<?php

if (stristr(htmlentities($_SERVER['PHP_SELF']), 'head-Cookie_Prompt.php')) {
   Header('Location: ../../index.php');
   die();
}
addJSToHead('includes/jquery/jquery.js', 'file');
addJSToHead('includes/jquery/cprompt.min.js', 'file');
$inlineJS = '<script type="text/javascript">
   cPrompt.checkCookie()
cPrompt.hideOnAccept = true;
cPrompt.cookieLink = "modules.php?name=Legal&amp;op=privacy";
</script>'."\n";
addJSToHead($inlineJS,'inline');


It will show up above your header.
 
jane65
PostPosted: Mon Feb 25, 2013 7:16 pm Reply with quote

I've managed to get it working now. There are two files in cprompt that need to be added to the jquery folder, so apart from the cprompt.min.js file there is another called cprompt.js. Once I added that file to the jquery folder and also included it in the code given by nuken as shown below it worked immediately.

Code:
<?php 


if (stristr(htmlentities($_SERVER['PHP_SELF']), 'head-Cookie_Prompt.php')) {
   Header('Location: ../../index.php');
   die();
}
addJSToHead('includes/jquery/jquery.js', 'file');
addJSToHead('includes/jquery/cprompt.min.js', 'file');
addJSToHead('includes/jquery/cprompt.js', 'file');
$inlineJS = '<script type="text/javascript">
   cPrompt.checkCookie()
cPrompt.hideOnAccept = true;
cPrompt.cookieLink = "modules.php?name=Legal&amp;op=privacy";
</script>'."\n";
addJSToHead($inlineJS,'inline');


Last edited by jane65 on Mon Feb 25, 2013 7:21 pm; edited 1 time in total 
nuken
PostPosted: Mon Feb 25, 2013 7:20 pm Reply with quote

the cprompt.min.js and the cprompt.js are the same exact file only one has all the spaces removed from it, ie minified....
 
jane65
PostPosted: Mon Feb 25, 2013 7:20 pm Reply with quote

Thanks for your reply nuken, I've only just seen your post after posting myself, I did do that but it didn't show up, but it has now after adding the second file in the cprompt folder.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
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 vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©