PageSourceSearch

https://ppsn.org.ng/support/validate-login.js

js ppsn.org.ng collected 2026-10-03 02:55:20 UTC 5,647 bytes, 207 lines download raw bytes

1jQuery(document).ready(function($) {
2  "use strict";
3
4  //Contact
5  $('form.php-email-form').submit(function() {
6   
7    var f = $(this).find('.form-group'),
8      ferror = false,
9      emailExp = /^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i;
10
11    f.children('input').each(function() { // run all inputs
12     
13      var i = $(this); // current input
14      var rule = i.attr('data-rule');
15
16      if (rule !== undefined) {
17        var ierror = false; // error flag for current input
18        var pos = rule.indexOf(':', 0);
19        if (pos >= 0) {
20          var exp = rule.substr(pos + 1, rule.length);
21          rule = rule.substr(0, pos);
22        } else {
23          rule = rule.substr(pos + 1, rule.length);
24        }
25
26        switch (rule) {
27          case 'required':
28            if (i.val() === '') {
29              ferror = ierror = true;
30            }
31            break;
32
33          case 'minlen':
34            if (i.val().length < parseInt(exp)) {
35              ferror = ierror = true;
36            }
37            break;
38
39          case 'email':
40            if (!emailExp.test(i.val())) {
41              ferror = ierror = true;
42            }
43            break;
44
45          case 'checked':
46            if (! i.is(':checked')) {
47              ferror = ierror = true;
48            }
49            break;
50
51          case 'regexp':
52            exp = new RegExp(exp);
53            if (!exp.test(i.val())) {
54              ferror = ierror = true;
55            }
56            break;
57        }
58        i.next('.validate').html((ierror ? (i.attr('data-msg') !== undefined ? i.attr('data-msg') : 'wrong Input') : '')).show('blind');
59      }
60    });
61    f.children('textarea').each(function() { // run all inputs
62
63      var i = $(this); // current input
64      var rule = i.attr('data-rule');
65
66      if (rule !== undefined) {
67        var ierror = false; // error flag for current input
68        var pos = rule.indexOf(':', 0);
69        if (pos >= 0) {
70          var exp = rule.substr(pos + 1, rule.length);
71          rule = rule.substr(0, pos);
72        } else {
73          rule = rule.substr(pos + 1, rule.length);
74        }
75
76        switch (rule) {
77          case 'required':
78            if (i.val() === '') {
79              ferror = ierror = true;
80            }
81            break;
82
83          case 'minlen':
84            if (i.val().length < parseInt(exp)) {
85              ferror = ierror = true;
86            }
87            break;
88        }
89        i.next('.validate').html((ierror ? (i.attr('data-msg') != undefined ? i.attr('data-msg') : 'wrong Input') : '')).show('blind');
90      }
91    });
92    if (ferror) return false;
93    else var str = $(this).serialize();
94	
95//alert( str );
96	
97    var this_form = $(this);
98    var action = $(this).attr('action');
99	
100    if( ! action ) {
101      this_form.find('.loading').slideUp();
102      this_form.find('.error-message').slideDown().html('The form action property is not set!');
103      return false;
104    }
105    
106    this_form.find('.sent-message').slideUp();
107    this_form.find('.error-message').slideUp();
108    this_form.find('.loading').slideDown();
109	
110	//alert('action1: '+action+' dat1: '+str);
111
112		var chk = '';
113		/*my better ajax call begins*/								
114		var $requestAJAX =  $.ajax({
115			method: "post",
116			url: action,
117			data: str,
118			dataType: 'text'
119		});
120		
121		//alert($id);
122		$requestAJAX.done(function( msg ) {
123					   
124			var msg = msg.toString().trim();
125			//alert('string-TRIM-msg-DONE: '+msg);
126			/**/
127			if (msg == 'CONTACTOK') 
128			{
129			  //process contact message sent
130			  this_form.find('.loading').slideUp();
131			  this_form.find('.sent-message').slideDown();
132			  this_form.find("input:not(input[type=submit]), textarea").val('');
133			}
134			else  if (msg == 'LOGINOK') 
135			{
136			  this_form.find('.loading').slideUp();
137			  this_form.find('.sent-message').slideDown();
138			  setTimeout( window.open('home.php','_self'),55000 );
139			}
140			else if (msg == 'LOGOUTOK') 
141			{
142			  this_form.find('.loading').slideUp();
143			  this_form.find('.sent-message').slideDown();
144			  setTimeout( window.open('home.php','_self'),55000 );
145			}
146			else {
147			  //check_login( 'support/forms-login-check.php' );
148			  //this_form.find('.loading').slideUp();
149			  //this_form.find('.error-message').slideDown().html(msg);
150			  this_form.find('.loading').slideUp();
151			  this_form.find('.sent-message').slideDown();
152			  setTimeout( window.open('home.php','_self'),55000 );
153			}
154			/**/
155			
156		});
157
158		$requestAJAX.fail(function( jqXHR, textStatus, errorThrown ) {
159			//alert( 'ajaxERROR: '+ errorThrown );
160			//xhr.statusText
161			////textStatus
162			//error
163		});
164		/*my better ajax call ends*/
165		
166    return false;
167  });
168
169});
170
171/*my cozy ajax call starts*/		
172function check_login(chk) {
173	//alert('returnSET '+chk);
174	$.ajax({
175		type: "POST",
176		url: chk,
177		data: 'hello',
178		dataType:'text', //or HTML, JSON, etc.
179		success: function(response){
180			//alert(response);
181			msg = response.toString.trim();
182			//echo what the server sent back...
183			/**/
184			if (msg == 'LOGINOK') 
185			{
186			  this_form.find('.loading').slideUp();
187			  this_form.find('.sent-message').slideDown();
188			  setTimeout( window.open('home.php','_self'),55000 );
189			}
190			else if (msg == 'LOGOUTOK') 
191			{
192			  this_form.find('.loading').slideUp();
193			  this_form.find('.sent-message').slideDown();
194			  setTimeout( window.open('home.php','_self'),55000 );
195			}
196			else {
197			  this_form.find('.loading').slideUp();
198			  //this_form.find('.error-message').slideDown().html(msg);
199			  //instead just reload since there was an unknown
200			  this_form.find('.sent-message').slideDown();
201			  setTimeout( window.open('login.php','_self'),10000 );
202			}
203			/**/
204		}
205	});
206}
207/*my cozy ajax call ends*/

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.