PageSourceSearch

https://afsanalytics.com/js26/loginbox.js

js afsanalytics.com collected 2026-10-01 09:24:40 UTC 18,993 bytes, 787 lines download raw bytes

1/* 
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5
6function logRedir()
7{
8  loadBox();
9    if(typeof G_redir === 'undefined')  
10    {
11    var loc = window.location;
12    var i = loc.href.indexOf('?accesskey');
13    if (i == -1) loc.reload();
14    else loc.href = loc.href.substring(0, i);   
15    window.location.reload(true);
16    }
17else window.location.href=G_redir;
18
19}
20
21function logOut()
22{
23  G_alert=1;
24  setCookieAll("upass","",-30);
25  setCookieAll("stayconnected","",-30);
26  setCookieAll("uid","",-30);
27  setCookieAll("usiteid","",-30); 
28  
29  alertBox(G_lan.loggedout, G_lan.loggedout1)
30  
31  setTimeout(function(){G_alert=0}, 5000);
32  
33  
34                    var myVar = setInterval(function () {
35                    if (G_alert==0) {clearInterval(myVar);window.location.href="https://www.afsanalytics.com";}   
36                    }, 100);               
37                    
38  
39  
40    
41    
42}
43
44
45
46
47function lostError()
48{
49 $("#wronglost").text(G_lan.errorusername);
50 $("#wronglost").css('display','block');   
51}
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70/*
71function checkLost($form)
72{
73    var $query="";
74    
75    loginbox.startload();
76    $query=$form.serializeArray();
77    
78    $.ajax({
79        
80        url: $form.attr('action'),
81        type: $form.attr('method'),
82        dataType: "json",
83        data: $query,
84        cache: false,
85        success: function(json)
86        {
87            loginbox.endload();         
88            if (json.state==0) 
89            {
90                loginbox.close();
91                alertBox($lan.lostoktitle,$lan.lostok);
92            }
93            else
94            {
95                
96                if (json.hasOwnProperty('afserror')) 
97                {
98                    loginbox.endload();
99                    loginbox.close();
100                    alertBox (json.afserror);
101                }
102                else if (json.authfail==1) lostError();
103                
104            } 
105 
106        
107        },
108        error: function( request, error ) 
109        {
110            loginbox.endload();
111            loginbox.close();
112            alertBox ("Server unreachable!","Our team has been notified and will investigate as soon as possible...");
113        }
114    
115    });
116}
117*/
118
119
120
121
122function checkLost($form)
123{
124    var $query="";
125    
126    loginbox.startload();
127    $query=$form.serializeArray();
128    
129    $.ajax({
130        url: $form.attr('action'),
131        type: $form.attr('method'),
132        dataType: "json",
133        data: $query,
134        cache: false,
135        success: function(json)
136        {
137        
138        
139         
140         
141         loginbox.endload();         
142            if (json.state==0) 
143            {
144                loginbox.close();
145                alertBox($lan.lostoktitle,$lan.lostok);
146           
147       
148   }
149            else
150            {
151                
152                if (json.hasOwnProperty('mysql')) 
153                {
154                    loginbox.endload();
155                    loginbox.close();
156                    alertBox (G_lan.ermysql,json.mysql);
157                }  
158                
159                if (json.hasOwnProperty('afserror')) 
160                {
161                    loginbox.endload();
162                    loginbox.close();
163                    alertBox (G_lan.errorp5,json.afserror);
164                }
165                else if (json.authfail==1) lostError();
166                
167            } 
168 
169        
170        },
171        error: function( request, error ) 
172        {
173            loginbox.endload();
174            loginbox.close();
175            alertBox (G_lan.errorserver,G_lan.teamalert);
176        }
177    
178    });
179}
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199function checkLogin($form,$type)
200{
201    var $query="";
202    G_alert=0;    
203    var username; 
204
205
206if ($type==="post")
207{
208  $('#login-uname').val($('#login-uname').val().trim());
209  $('#login-upass').val($('#login-upass').val().trim());
210  username= $('#login-uname').val();
211    
212  /*
213   if (!isValidEmailAddress(username))
214    {
215        if (!isValidAccount(username))
216        {
217            loginError();
218            return;
219        }
220        
221    }
222   */
223}
224
225
226
227    if ($type=="post")
228    {
229        loginbox.startload();
230        $query=$form.serializeArray();
231        //console.log(JSON.stringify($query));
232        $query.push({
233            name:'type',
234            value:$type
235        });
236    }
237    else
238    {
239        $query={
240            type:$type
241        };
242    }
243
244    var action=G_SITEBASE+'/veriflogin.php';
245   // console.log(action);
246    
247    $.ajax({
248       
249        url: action,
250        xhrFields: {withCredentials: true},
251        type: "POST",
252        dataType: "json",
253        data: $query,
254        cache: false,
255               
256        success: function(json)
257        {
258        //  console.log(JSON.stringify(json));
259                 /*
260          if (json.hasOwnProperty('afslogin')) 
261                {
262                    loginbox.endload();
263                    loginbox.close();
264                    alertBox ("AFS Login",json.afslogin);
265                }  
266          */
267          
268          
269          
270          if ($type=="post") loginbox.endload();
271                 
272           
273            if (json.state==0) 
274            {
275                if ($type=="post")  loginbox.close();
276                //alertBox("connected",json.uid +" "+ json.account);
277                
278                if (json.oldlogin==1)
279                {
280                  alertBox(G_lan.oldlogin, G_lan.oldlogin1+" ("+json.username+") "+G_lan.oldlogin2);
281                    
282                }
283                
284                   
285         
286            }
287               
288            else
289            {
290           
291                if (json.hasOwnProperty('afserror')) 
292                {
293             
294                    if ($type=="post") 
295                    {
296                        loginbox.endload();
297                        loginbox.close();
298                    }
299                    alertBox (G_lan.error,json.afserror);
300                           
301                }
302                else
303                {
304           
305                    if (json.authfail==1) 
306                    {
307                       // alertBox("Authorisation failed");    
308                        if ($type=="post") 
309                        {    
310                            loginError();
311                            loginbox.endload();
312                        }
313                        else loginBox({});
314           
315                    }
316                } 
317            }   
318        
319           if (json.hasOwnProperty('redir') )
320               {
321                   if ( json.state==0)
322                   {
323                   var go=json.redir+"()";
324                    if (G_alert==0) eval(go);
325                    else
326                    {    
327                    var myVar = setInterval(function () {
328                    if (G_alert==0) {clearInterval(myVar);eval(go);}   
329                    }, 500);               
330                    }
331                   }               
332               }
333               else if (json.state==0) logRedir();      
334        
335        },
336        error: function( request, error ) 
337        {
338           //alert(error);
339           //alert (request)
340           
341           
342           if ($type=="post")
343            {
344                loginbox.endload();
345                loginbox.close();
346            }
347           alertBox (G_lan.errorserver,G_lan.teamalert);
348           // alertBox ("Server unreachable!","Our team has been notified and will investigate as soon as possible...");
349        }
350     
351    });
352}
353
354
355
356function quickLogin()
357{
358autoLogin();
359}
360
361
362
363function autoLogin()
364{
365 
366 var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0)
367 //console.log(w);
368 
369 if (getCookie('stayconnected')!="")
370 {
371  $stayconnected=decodeURIComponent(getCookie('stayconnected'));   
372  if ($stayconnected=="1") 
373  {
374   checkLogin("null","auto");
375  }
376  else 
377  {
378     if (w>400) loginBox({redir:"logRedir", stayconnected:"1"});
379     else window.location.href="login_mobile.html";
380  }
381 
382 }   
383 else 
384 {
385     if (w>400) loginBox({redir:"logRedir", stayconnected:"1"});
386     else window.location.href="login_mobile.html";
387 }    
388    
389  
390
391}
392
393function loginError()
394{
395 $("#wronglogin").text(G_lan.wronglogin);
396 $("#wronglogin").css('display','block');   
397}
398
399function loginBox(settings)
400{
401   //on check url, user, pass    
402 
403    
404var $username="";
405var $userpass="";
406var $userid=0;
407var $stayconnected=0;
408//cookies
409        
410        
411         var mobile=0;
412        if (settings.hasOwnProperty('mobile')) mobile = settings.mobile; 
413   
414        
415        if (typeof loadbox!="undefined") loadbox.close();
416   
417        if (settings.hasOwnProperty('username')) $username = settings.username;
418        if (settings.hasOwnProperty('userid')) $userid = settings.userid;
419        if (settings.hasOwnProperty('userpass')) $userpass = settings.userpass;
420        if (settings.hasOwnProperty('stayconnected')) $stayconnected=settings.stayconnected;
421        
422         
423          
424          
425        if ($username=="") $username=decodeURIComponent(getCookie('uname'));
426        if ($userpass=="") $userpass=decodeURIComponent(getCookie('upass'));
427        if ($userid=="") $userid=decodeURIComponent(getCookie('uid'));
428        if ($stayconnected=="") $stayconnected=decodeURIComponent(getCookie('stayconnected'));
429               
430        if ($username=="") $username=decodeURIComponent(getQuery('usr'));          
431        $username.trim();
432        $userpass.trim();
433                    
434        
435        
436        if (mobile==0)
437        {
438        text='<div class="dialog-basic">';
439        }
440        else
441        {
442        text='<div class="dialog-basic" style="width:inherit;height:inherit">';
443        }
444        
445        
446        text +='<div class="dialog-title styleColor" style="padding-top:15px">'+$lan.login+'</div>';
447        text +='<form id="loginForm" action="'+G_SITEBASE+'/veriflogin.php" method="post">';
448        if (settings.hasOwnProperty('redir')) 
449        text +='<input type="hidden" id="redir" name="redir" value="'+ settings.redir+'">';
450 
451        if (mobile==0) text +='<div id="input-box" style="padding-left: 20px">';
452        else text +='<div id="input-box" style="text-align:center;magin-left: auto;margin-right-auto">';
453       
454       text +='<label>'+$lan.oldlogin_l+':</label>';
455      // text +='<input type="email" required  tabindex="1" id="login-uname" name="uname" value='+$username+' maxlength="60" class="inp enter-key"  placeholder=" '+$lan.luser_p+'">'; 
456       text +='<input type="text"  autocomplete required  tabindex="1" id="login-uname" name="uname" value="'+$username+'" maxlength="60" class="inp enter-key"  placeholder=" '+$lan.oldlogin_p+'">'; 
457    
458       
459       
460       text +='<label>'+$lan.lpass_l+':</label>';
461       text +='<input type="password"  autocomplete="current-password" required tabindex="2" id="login-upass" name="upass" maxlength="60"  class="inp enter-key" placeholder=" '+$lan.lpass_p+'">'; 
462       text +='<span id="wronglogin" class="errormess hideit ">'+G_lan.wronglogin+'!</span>';    
463          
464       
465       text +='<div id="connected">';
466       if ($stayconnected==1) text +='<input type="checkbox" tabindex="3" checked class="checkbox_pos" name="stayconnected" id="login-connected">';
467       else text +='<input type="checkbox" tabindex="3" class="checkbox_pos" name="stayconnected" id="login-connected">';
468       
469       
470       text +=$lan.stayconnected;
471       text +='</div>';
472        
473    
474       if (mobile==0)
475       {
476        text +='<div class="forgot">';
477        text +='<a href="javascript:lostBox()"  tabindex="4">'+$lan.forgot+'</a>';
478        text +='</div>';
479       }
480     
481       
482       
483    if (mobile==0) text +='<div class="buttoncenter" >';     
484    else text +='<div id="buttons" class="buttoncenter" style="margin:5px" >';     
485    text +='  <input type ="submit" tabindex="5" class="btn_pub" value="'+$lan.login+'"> '; 
486     /*   text +='  <input type="button" class="btn  btn-cancel" value="'+$lan.cancel+'" onClick="javascript:signbox.close()">';  */
487     text +=' </div>';
488       
489        if (mobile==1)
490       {
491        text +='<div class="forgot" style="text-align:center;margin:10px">';
492        text +='<a href="javascript:lostBox()"  tabindex="4">'+$lan.forgot+'</a>';
493        text +='</div>';
494       }
495       
496       
497      
498       text +=' </form> ';  
499         text +=' </div>';
500   
501   
502              
503        text +='</div>'; 
504       
505       
506     var $height=340;  
507         
508    
509    if (mobile==0)
510    {
511    
512   loginbox.open({
513            content: text, 
514            width: 365, 
515            height: $height,
516            zindex: 3,
517            y:-50     
518            
519            });
520        
521    }   
522    else 
523    {
524       $( "#login_mobile" ).empty(); 
525       $( "#login_mobile" ).append(text); 
526    }
527    
528        
529      //submit form
530        $('#loginForm').on('submit', function(e) {
531        e.preventDefault();
532        checkLogin($("#loginForm"),"post");
533        });
534        
535   
536    
537    
538    
539    
540}
541
542
543
544
545
546function lostBox()
547{
548        loginbox.close();
549        $username=decodeURIComponent(getCookie('uname'));
550        $username.trim();
551        //$userid=decodeURIComponent(getCookie('uid'));
552 
553        text='<div class="dialog-basic">';
554        text +='<div class="dialog-title styleColor">'+$lan.lostpass+'</div>';
555        text +='<form id="lostForm" action="'+G_SITEBASE+'/veriflost.php" method="post">';
556        text +='<div id="input-box" style="padding-left: 20px">';
557                    
558        text +='<label>'+$lan.lostpass2+':</label>';
559        text +='<input type="text" required autocomplete  tabindex="1" id="lost-uname" name="uname" value="'+$username+'" maxlength="60" class="inp enter-key"  placeholder=" '+$lan.lostpass2+'">'; 
560        text +='<span id="wronglost" class="errormess hideit">'+$lan.losterror+'</span>';    
561        
562        text +='</div>';
563           
564       
565    text +='<div id="buttons" class="buttoncenter" >';     
566        text +='  <input type ="submit" class="btn_pub" value="'+$lan.lostbutton+'"> '; 
567     /*   text +='  <input type="button" class="btn  btn-cancel" value="'+$lan.cancel+'" onClick="javascript:signbox.close()">';  */
568        text +=' </div>';
569    
570       text +=' </form> ';  
571        text +=' </div>';
572                
573        text +='</div>'; 
574       
575       
576     var $height=230;  
577          
578   loginbox.open({
579            content: text, 
580            width: 370, 
581            height: $height,
582            zindex: 3
583            });
584        
585        
586      //submit form
587        $('#lostForm').on('submit', function(e) {
588        e.preventDefault();
589        checkLost($("#lostForm"),"post");
590        });
591        
592 
593}
594
595
596
597
598
599
600function FacebookLogin(response)
601{
602  
603  var gender=0;
604  if (response.gender=="female") gender=2; 
605  if (response.gender=="male") gender=1; 
606  var $verified;
607  $verified=0;
608  if (response.verified==true) $verified=1;
609   
610 var redir=$('#loginForm #redir').val();
611
612 //console.log(response);
613
614  loginbox.startload();
615   
616 var query={    
617 fbookid: response.id,
618 email: response.email,
619 fbookgender: gender,
620 fbooktm: response.timezone,
621 fbookverified: $verified,
622 fbooklocale: response.locale,
623 redir: redir,
624 keyid: G_KEYID,
625 keyauth: G_KEYAUTH
626 };
627        
628        var action=G_SITEBASE+'/fblogin.php'; 
629        
630        $.ajax({
631                
632        url: action,
633        xhrFields: {withCredentials: true},
634        type: "POST",
635        dataType: "json",
636        data: query,
637        cache: false,
638        success: function(json)
639        {
640            loginbox.endload();
641                      
642            if (json.state==0) 
643            {
644               loginbox.close();
645             //  alertBox ("redir",json.redir);
646               
647            }
648              
649            else
650            {
651           
652                if (json.hasOwnProperty('afserror')) 
653                {
654                       loginbox.endload();
655                       loginbox.close();
656                       alertBox (G_lan.error,json.afserror);
657                           
658                }
659             }   
660        
661           if (json.hasOwnProperty('redir') && json.state==0)
662               {
663                    var go=json.redir+"()";
664                    
665                    if (G_alert==0) eval(go);
666                    else
667                    {    
668                    var myVar = setInterval(function () {
669                    if (G_alert==0) {clearInterval(myVar);eval(go);}   
670                    }, 50);               
671                    }
672                                   
673               }
674               else if (json.state==0) logRedir();      
675        
676        },
677        error: function( request, error ) 
678        {
679             loginbox.endload();
680             loginbox.close();
681            alertBox (G_lan.errorserver,G_lan.teamalert);
682        }
683     
684    });
685 
686}
687
688
689
690
691
692function GplusLogin(response)
693{
694  
695  var gender=0;
696  if (response.gender=="female") gender=2; 
697  if (response.gender=="male") gender=1; 
698  var $verified=0;
699  if (response.verified_email==true) $verified=1;
700  var redir=$('#loginForm #redir').val();
701
702  loginbox.startload();
703 
704  
705 var query={    
706 gplusid: response.id,
707 email: response.email,
708 gplusgender: gender,
709 gplusverified: $verified,
710 gpluslocale: response.locale,
711 redir: redir,
712 keyid: G_KEYID,
713 keyauth: G_KEYAUTH
714 };
715        
716        var action=G_SITEBASE+'/gplogin.php'; 
717        $.ajax({
718                
719        url: action,
720        xhrFields: {withCredentials: true},
721        type: "POST",
722        dataType: "json",
723        data: query,
724        cache: false,
725        success: function(json)
726        {
727            loginbox.endload();
728                      
729            if (json.state==0) 
730            {
731               loginbox.close();
732             //  alertBox ("redir",json.redir);
733               
734            }
735              
736            else
737            {
738           
739                if (json.hasOwnProperty('afserror')) 
740                {
741                       loginbox.endload();
742                       loginbox.close();
743                       alertBox (G_lan.error,json.afserror);
744                           
745                }
746             }   
747        
748           if (json.hasOwnProperty('redir') && json.state==0)
749               {
750                    var go=json.redir+"()";
751                    
752                    if (G_alert==0) eval(go);
753                    else
754                    {    
755                    var myVar = setInterval(function () {
756                    if (G_alert==0) {clearInterval(myVar);eval(go);}   
757                    }, 50);               
758                    }
759                                   
760               }
761               else if (json.state==0) logRedir();      
762        
763        },
764        error: function( request, error ) 
765        {
766             loginbox.endload();
767             loginbox.close();
768             alertBox (G_lan.errorserver,G_lan.teamalert);
769             
770        }
771     
772    });
773 
774}
775
776
777
778
779
780
781
782
783
784
785
786
787

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.