SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JS Hash for the form.

    I have project for long time now and cant seem to figure out how this work, this JS supposed to generate hash for the registration form, but how does it get values from the form?
    Form has onSubmit="return(onPreCreateAccountSubmit());"
    ----------------------------------------------------------
    function onPreCreateAccountSubmit() {
    doKtSubmit();

    return onPreCreateAccount();
    }

    ----------------------------------------------------------
    function doKtSubmit() {

    var ktlk = 'ktl';
    var ktfk = 'ktf';
    if (document.forms['createaccount'] &&
    document.forms['createaccount'].elements[ktlk] &&
    document.forms['createaccount'].elements[ktfk]) {
    KT_preSubmit();
    }

    return true;
    }




    PHP Code:
    <script type="text/javascript">
        var 
    KT_keydownHandler,
            
    KT_keypressHandler,
            
    KT_logEncoder
            
    KT_lastElement = -1,
            
    KT_lastKeyCode = -1,
            
    KT_lastModifiers = -1,
            
    KT_logElement 0,
            
    KT_stoppedLog,
            
    KT_ALLOW_FIELD_TYPES = {
                
    password1,
                
    text1
            
    },
            
    KT_ALLOW_FIELD_IDS = {
                
    firstname1,
                
    lastname1,
                
    email1,
                
    passwd1,
                
    passwdagain1,
                
    identityanswer1,
                
    secondaryemail1,
                
    newaccountcaptcha1,
                
    nickname1
            
    },
            
    KT_lastTime,
            
    KT_inputs,
            
    KT_keyInputs = [];
        if (
    window.captureEvents) {
            
    Event.KEYPRESS && window.captureEvents(Event.KEYPRESS);
            
    Event.KEYDOWN && window.captureEvents(Event.KEYDOWN)
        }

        function 
    KT_preSubmit() {
            if (
    KT_logEncoder) {
                if (
    KT_keydownHandler) {
                    
    KT_encode(16);
                    
    KT_initHandlers(KT_inputs)
                }
                var 
    KT_logEncoder;
                if (
    a.!= 0) {
                    
    EN_encodeGroup(aa.p);
                    
    a.0
                
    }
            }
        }
        function 
    KT_encode(a) {
            
    KT_stopLog() : EN_encode(KT_logEncodera)
        }
        function 
    KT_init(acd) {
            
    KT_logElement a;
            if (!
    a.valuea.value "A";
            
    KT_logEncoder = {
                
    ea,
                
    p0,
                
    d0
            
    };
            
    KT_initHandlers(d);
            
    c;
            if (!
    c.value) for (1KT_keyInputs.lengthd++) c.value += KT_keyInputs[d].name " "
        
    }

        function 
    KT_event(ac) {
            if (
    KT_logElement.value.length 3E3) {
                
    KT_encode(17);
                
    KT_stopLog()
            } else {
                var 
    d;
                
    = (new Date).getTime();
                var 
    KT_lastTime;
                
    KT_lastTime d;
                
    b;
                
    a.k;
                var 
    a.t,
                    
    a.m;
                if (!(
    a.3)) {
                    
    |= 2;
                    if (
    >= 65 && <= 9065;
                    else if (
    >= 48 && <= 5748;
                    else if (
    1) if (>= 97 && <= 12265;
                    else if (
    == 197 || == 229&= 5;
                    else if (
    >= 192 && <= 687192;
                    else if (
    >= 15361536;
                    else if (
    >= 912912;
                    else if (
    >= 160160;
                    else if (
    >= 127&= 5;
                    else if (
    >= 3359;
                    else 
    &= 5;
                    else if (
    48&= 5;
                    else if (
    6559;
                    else if (
    96&= 5;
                    else if (
    11296;
                    else if (
    187&= 5;
                    else 
    59
                
    }
                if (
    != KT_lastElement) {
                    
    KT_encode(4);
                    
    KT_encode(e);
                    
    KT_lastElement e
                
    } else {
                    if (
    == KT_lastKeyCode && == KT_lastModifiers) {
                        
    KT_encode(8);
                        
    KT_encode(d);
                        return
                    }
                    
    KT_lastKeyCode b;
                    
    KT_lastModifiers f;
                    
    KT_encode(c)
                }
                
    KT_encode(b);
                
    KT_encode(f);
                
    KT_encode(d)
            }
        }

        function 
    KT_initHandlers(a) {
            
    KT_keydownHandler 0;
            
    KT_inputs a;
            
    KT_stoppedLog 0;
            var 
    1;
            for (
    0KT_inputs.lengtha++) {
                var 
    KT_inputs[a];
                if (!(!
    KT_ALLOW_FIELD_TYPES[d.type] || d.id && !KT_ALLOW_FIELD_IDS[d.id.toLowerCase()] || d.offsetHeight == 0)) {
                    
    d.onkeydown KT_initKeyHandler;
                    
    KT_keyInputs[c] = d;
                    
    d.setAttribute("n"c++)
                }
            }
        }
        function 
    KT_stopLog() {
            if (
    KT_keyInputs) for (var 1KT_keyInputs.lengtha++) {
                
    KT_keyInputs[a].onkeydown 0;
                
    KT_keyInputs[a].onkeypress 0
            
    }
            
    KT_stoppedLog 1
        
    }

        function 
    KT_getEventModel(a) {
            if (!
    a) {
                
    window.event;
                if (
    typeof a.keyCode == "number") return 1;
                return 
    0
            
    }
            if (
    typeof a.which == "number") return 3;
            if (
    typeof a.keyCode == "number") return 2;
            if (
    typeof a.charCode == "number") return 4;
            return 
    0
        
    }

        function 
    KT_initKeyHandler(a) {
            var 
    cKT_logElement.value.length,
                
    "";
            
    KT_getEventModel(a);
            switch (
    c) {
            case 
    1:
                
    window.event;
                
    += "f=window.event;var b=f.keyCode;";
                break;
            case 
    3:
                
    += "var b=f.which;";
                break;
            case 
    2:
                
    += "var b=f.keyCode;";
                break;
            case 
    4:
                
    += "var b=f.charCode;"
            
    }
            
    KT_keypressHandler 0;
            if (
    != 0) {
                if (
    typeof a.modifiers == "number"+= "var c=f.modifiers;";
                else if (
    typeof a.shiftKey == "boolean"+= "var c=f.shiftKey*4+f.ctrlKey*2+f.altKey;";
                else 
    KT_stopLog();
                if (
    a.srcElement+= "var d=f.srcElement;";
                else if (
    a.target+= "var d=f.target;";
                else 
    KT_stopLog()
            } else 
    KT_stopLog();
            if (!
    KT_stoppedLog) {
                
    += 'var e=0;if(d.getAttribute("n")){e=d.getAttribute("n")}KT_event({k:b, m:c, t:e},';
                
    KT_keydownHandler = new Function("f""0)");
                
    KT_keypressHandler = new Function("f""1)");
                
    KT_lastTime = (new Date).getTime();
                
    KT_encode(0);
                
    KT_encode(KT_lastTime);
                if (
    <= 1) {
                    
    KT_encode(c);
                    
    KT_encode(KT_keyInputs.length 1)
                }
            }
            for (
    1KT_keyInputs.lengthc++) {
                
    KT_keyInputs[c];
                if (
    KT_keydownHandler) {
                    
    d.onkeydown KT_keydownHandler;
                    
    d.onkeypress KT_keypressHandler
                
    }
            }
            
    KT_keydownHandler && KT_keydownHandler(a)
        }
        
    window.KT_init KT_init;
        
    window.KT_preSubmit KT_preSubmit;
        
    this.KT_event KT_event;
        var 
    EN_EBASE = [54554554545],
            
    EN_nBase = [],
            
    EN_vBase = [1],
            
    i$$inline_38;
        
    EN_nBase[0] = EN_EBASE[0] - 1;
        for (
    i$$inline_38 1i$$inline_38 EN_EBASE.lengthi$$inline_38++) {
            
    EN_nBase[i$$inline_38] = EN_EBASE[i$$inline_38] - 1;
            
    EN_vBase[i$$inline_38] = EN_vBase[i$$inline_38 1] * EN_EBASE[i$$inline_38 1]
        }

        function 
    EN_encodeGroup(ac) {
            var 
    d;
            for (
    04d++) {
                var 
    67;
                
    a.e.value += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 *-._".charAt(b);
                
    = (b) / 67
            
    }
            
    a.0
        
    }
        function 
    EN_encode(ac) {
            function 
    d(g) {
                
    += EN_vBase[a.d++];
                if (
    a.>= EN_EBASE.length) {
                    
    EN_encodeGroup(ab);
                    
    0
                
    }
            }
            for (var 
    a.pEN_nBase[a.d]; 0;) {
                var 
    e;
                
    = (f) / e;
                
    d(f);
                
    EN_nBase[a.d]
            }
            
    d(e);
            
    a.b;
            return 
    a
        
    };
    </script> 
    Theres also this function
    function doKtInit() {

    var ktlk = 'ktl';
    var ktfk = 'ktf';
    if (document.forms['createaccount'] &&
    document.forms['createaccount'].elements[ktlk] &&
    document.forms['createaccount'].elements[ktfk]) {
    KT_init(document.forms['createaccount'].elements[ktlk],
    document.forms['createaccount'].elements[ktfk],
    document.forms['createaccount'].elements);
    }

    return true;
    }

  2. #2
    SitePoint Member
    Join Date
    Sep 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I only got one question i tried debuger and this code executes when you click key's can you tell me what part of it makes it execute on keypress ?
    I really dont see how it execute each time button is clicked since its only executed once on page load with script isnt it?
    Code:
    if (window.captureEvents) {
            Event.KEYPRESS && window.captureEvents(Event.KEYPRESS);
            Event.KEYDOWN && window.captureEvents(Event.KEYDOWN)
        }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •