PageSourceSearch

https://csanig.hu/js/cookies.js

js csanig.hu collected 2026-10-02 16:54:46 UTC 913 bytes, 33 lines download raw bytes

1function setCookie(cname, cvalue, exdays) {
2    var d = new Date();
3    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
4    var expires = "expires="+d.toUTCString();
5    document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
6}
7
8function getCookie(cname) {
9    var name = cname + "=";
10    var ca = document.cookie.split(';');
11    for(var i = 0; i < ca.length; i++) {
12        var c = ca[i];
13        while (c.charAt(0) == ' ') {
14            c = c.substring(1);
15        }
16        if (c.indexOf(name) == 0) {
17            return c.substring(name.length, c.length);
18        }
19    }
20    return "";
21}
22
23function checkCookie() {
24    var user = getCookie("username");
25    if (user != "") {
26        alert("Welcome again " + user);
27    } else {
28        user = prompt("Please enter your name:", "");
29        if (user != "" && user != null) {
30            setCookie("username", user, 365);
31        }
32    }
33}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.