Previous Thread
Next Thread
Print Thread
Rate Thread
#219579 06/22/2002 3:22 AM
Joined: Jan 2001
Posts: 374
Enthusiast
Enthusiast
Offline
Joined: Jan 2001
Posts: 374
After we obviously often have trouble with users not knowing what cookies are, and so on:
I would, at the time of Login, love a quick test. The cookie variable would be loaded and checked. And there would be a warning that cookies have not been set, if that was the case.

Also, a NOSCRIPT info, telling the user if Javascript has not been activated, would be a nice service.


Last edited by caymuc; 06/22/2002 3:22 AM.
Sponsored Links
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Good idea.

Note that checking that cookies are enabled requires more than simply fetching cookies. A cookie must be set, then a redirect done to a different page (possibly the same page), then the cookie is fetched to verify that it was set. Even this procedure doesn't verify that permanent (non-session) cookies can be set, but I'm not sure whether that's critical.

Maybe HTTP_REFERER should be checked as well, since I think the script depends on that not being blocked. This would probably need to be checked the same way as cookies.

Joined: Jan 2000
Posts: 796
MTO Offline
Addict
Addict
Offline
Joined: Jan 2000
Posts: 796
Very good idea! Very good idea!

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
You could use javascript in the template to set a simple cookie and then retrieve the value and if no value is returned dynamicly print some text saying so. I think using the <noscript> tag to indicate to the viewer that they do not have javascript enabled would suffice.

code:

<script language="javascript" type="text/javascript">
function readCookie(name){
var cname = name + "=";
var dc = document.cookie;
if (dc.length != 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
return unescape(dc.substring(begin, end));
}
}
return null;
}

function putCookie(name, value) {
var expires = new Date();
expires.setTime(expires.getTime() + {$config['cookieexp']});
document.cookie = name + "=" + escape(value) +
((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
"; path={$config['cookiepath']}";
}

putCookie('dough', 1);

var isBaked = readCookie('dough');
if (isBaked == null) {
document.write('There was a problem setting cookies. Please make sure you have cookies enabled. Thanks.<br />');
}
</script>
<noscript>
You do not seem to have javascript enabled. Please correct this now. Thanks.<br />
</noscript>





I think this code will work... lol
I haven't tried it or used it as of yet. Let me know what happens.

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
I have attached a text file that will allow the correct copy/pasting of the code to your template. (or at least I think it will)

I tried to copy/paste from the example I posted and the javascript failed.
Attachments
51406-cookiejavacheck.txt (0 Bytes, 36 downloads)

Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
JAISP
JAISP
PA
Posts: 449
Joined: February 2008
Forum Statistics
Forums63
Topics37,575
Posts293,930
Members13,823
Most Online6,139
Sep 21st, 2024
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2025 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)