PageRenderTime 38ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/Quản lý sim số đẹp PHP/adminpc/ajax.js

https://gitlab.com/phamngsinh/baitaplon_sinhvien
JavaScript | 533 lines | 487 code | 24 blank | 22 comment | 87 complexity | 0508c137f596f5b6808be5a930052a39 MD5 | raw file
  1. var xmlHttp=false;
  2. function creatAjaxObject()
  3. {
  4. if (window.XMLHttpRequest)
  5. {
  6. xmlHttp=new XMLHttpRequest()
  7. if (xmlHttp.overrideMimeType)
  8. xmlHttp.overrideMimeType('text/xml')
  9. }
  10. else if (window.ActiveXObject)
  11. {
  12. try
  13. {
  14. xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  15. }
  16. catch (e)
  17. {
  18. try
  19. {
  20. xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  21. }
  22. catch (e)
  23. {
  24. }
  25. }
  26. }
  27. }
  28. function ajaxLoad(url, where){
  29. creatAjaxObject();
  30. var bar = 'Loading...';
  31. document.getElementById(where).innerHTML = bar
  32. window.status="Website đang tải dữ liệu ...";
  33. document.getElementById(where).innerHTML="";
  34. xmlHttp.onreadystatechange= function(){
  35. if(xmlHttp.readyState==4){
  36. document.getElementById(where).innerHTML = xmlHttp.responseText
  37. window.status="*** WWW.NGANHANGSIMSODEP.COM *** Sim số đẹp , Sim vip , Sim taxi , Sim lộc phát ... --- Hotline : 0914.77.9999 ";
  38. }
  39. }
  40. xmlHttp.open("GET", url, true);
  41. xmlHttp.send(null);
  42. }
  43. function ajaxpost(form,fid,url)
  44. {
  45. ob=document.fr;
  46. creatAjaxObject();
  47. xmlHttp.onreadystatechange= function(){
  48. if(xmlHttp.readyState==4 || xmlHttp.readyState == 200){
  49. alert(xmlHttp.responseText);
  50. }
  51. }
  52. xmlHttp.open('POST', url , true);//must be put here
  53. xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  54. xmlHttp.send("data="+document.forms["fr"].elements["f29[]"].value+"");
  55. }
  56. function dangchuyen()
  57. {
  58. oi=document.getElementById('dangchuyen');
  59. oi.className='menucx';
  60. ox=document.getElementById('moi');
  61. ox.className='menuxc';
  62. var dte = new Date();
  63. var hrs = dte.getHours();
  64. var min = dte.getMinutes();
  65. var sec = dte.getSeconds();
  66. ajaxLoad('aindex.php?act=dathangmoi&t=1&sid='+hrs+''+min+''+sec+'','dathang');
  67. }
  68. function moi()
  69. {
  70. oi=document.getElementById('dangchuyen');
  71. oi.className='menuxc';
  72. ox=document.getElementById('moi');
  73. ox.className='menucx';
  74. var dte = new Date();
  75. var hrs = dte.getHours();
  76. var min = dte.getMinutes();
  77. var sec = dte.getSeconds();
  78. ajaxLoad('aindex.php?act=dathangmoi&t=0&sid='+hrs+''+min+''+sec+'','dathang');
  79. }
  80. function wd(url, where)
  81. {
  82. obj=document.getElementById('main');
  83. obj.style.width=400+"px";
  84. obj.style.height=500+"px";
  85. obj.style.top=20;
  86. obj.style.left=(window.screen.width-500)/2;
  87. ajaxLoad(url, where);
  88. }
  89. function wdc(url, where)
  90. {
  91. obj=document.getElementById('main');
  92. obj.style.width=1+"px";
  93. obj.style.height=1+"px";
  94. obj.style.position="absolute";
  95. window.location.href=window.location.href;
  96. }
  97. function GotoPage(id)
  98. {
  99. url=window.location.href;
  100. c_url=url.split('&page');
  101. if(url.indexOf("?")!=-1)
  102. window.location.href=c_url[0]+'&page='+id+'';
  103. else
  104. window.location.href=c_url[0]+'?page='+id+'';
  105. }
  106. function checktext()
  107. {
  108. ob=document.getElementById('text');
  109. if(ob.value=='')
  110. {
  111. alert('Bạn vui lòng viết lý do!');
  112. return false;
  113. }
  114. }
  115. function Load(url){
  116. creatAjaxObject();
  117. xmlHttp.onreadystatechange= function(){
  118. if(xmlHttp.readyState==4){
  119. }
  120. }
  121. xmlHttp.open("GET", url, true);
  122. xmlHttp.send(null);
  123. window.location.href= window.location.href;
  124. }
  125. function Load2(url){
  126. creatAjaxObject();
  127. xmlHttp.onreadystatechange= function(){
  128. if(xmlHttp.readyState==4){
  129. }
  130. alert(xmlHttp.responseText);
  131. }
  132. xmlHttp.open("GET", url, true);
  133. xmlHttp.send(null);
  134. }
  135. function sms(url){
  136. creatAjaxObject();
  137. xmlHttp.onreadystatechange= function(){
  138. if(xmlHttp.readyState==4){
  139. }
  140. }
  141. xmlHttp.open("GET", url, true);
  142. xmlHttp.send(null);
  143. }
  144. function conf(id)
  145. {
  146. a=window.confirm('Bạn muốn xóa '+id+'?');
  147. if(a) return true
  148. else return false
  149. }
  150. function confs(id)
  151. {
  152. var d=document.myfrom.txt.value.length;
  153. if(d > 155)
  154. {
  155. alert('Độ dài tin nhắn vượt quá 155 Ký tự vui lòng xóa bớt');
  156. return false
  157. }
  158. a=window.confirm(id);
  159. if(a) return true
  160. else return false
  161. }
  162. function show(id)
  163. {
  164. ob=document.getElementById(id);
  165. ob.style.display="none";
  166. ob2=document.getElementById(''+id+'an');
  167. ob2.style.display="block";
  168. }
  169. function number(giatri,f)
  170. {
  171. ob=document.getElementsByName(''+f+'');;
  172. alert(ob.value);
  173. }
  174. function checkmobi(field) {
  175. var re = /^[0-9. ,]*$/;
  176. if (!re.test(field.value)) {
  177. field.value = field.value.replace(/[^0-9. ,]/g,"");
  178. }
  179. }
  180. function checka(field) {
  181. var re = /^[<>/:]*$/;
  182. if (re.test(field.value)) {
  183. field.value = field.value.replace(/[<>/:]/g,"");
  184. }
  185. }
  186. function checkmobi2(field) {
  187. var re = /^[0-9]$/;
  188. if (!re.test(field.value)) {
  189. field.value = field.value.replace(/[^0-9]/g,"");
  190. }
  191. }
  192. function checksimdat(field) {
  193. var re = /^[0-9]$/;
  194. if (!re.test(field.value)) {
  195. field.value = field.value.replace(/[^0-9]/g,"");
  196. }
  197. if(field.value.length >= 10)
  198. {
  199. if(field.value.substr(0,2) != '09' && field.value.substr(0,2) != '01')
  200. {
  201. alert('Số điện thoại bạn cần đặt mua không đúng!');
  202. field.focus()
  203. }
  204. if(field.value.length > 11)
  205. {
  206. alert('Số điện thoại bạn cần đặt mua không đúng!');
  207. field.focus()
  208. }
  209. }
  210. if(field.value.length == 10 && field.value.substr(0,2) == '09')
  211. {
  212. Load2('aindex.php?act=action&stv=checkso&sosim='+field.value+'');
  213. }
  214. if(field.value.length == 11 && field.value.substr(0,2) == '01')
  215. {
  216. Load2('aindex.php?act=action&stv=checkso&sosim='+field.value+'');
  217. }
  218. }
  219. function date(v)
  220. {
  221. var currentTime = new Date()
  222. var month = currentTime.getMonth() + 1
  223. var day = currentTime.getDate()
  224. var year = currentTime.getFullYear()
  225. v.value= day+ "/" + month + "/" + year;
  226. }
  227. function select_all(name, value) {
  228. formblock= document.getElementById('form_id');
  229. forminputs = formblock.getElementsByTagName('input');
  230. for (i = 0; i < forminputs.length; i++) {
  231. // regex here to check name attribute
  232. var regex = new RegExp(name, "i");
  233. if (regex.test(forminputs[i].getAttribute('name'))) {
  234. if (value == '1') {
  235. forminputs[i].checked = true;
  236. } else {
  237. forminputs[i].checked = false;
  238. }
  239. }
  240. }
  241. }
  242. function checkdh()
  243. {
  244. field=new Array();
  245. field[0]="họ và tên";
  246. field[1]="địa chỉ";
  247. field[2]="tỉnh thành";
  248. field[3]="số di động";
  249. for(i=0;i<=field.length;i++)
  250. {
  251. ob=document.getElementById('c'+[i]+'');
  252. if(ob.value=="")
  253. {
  254. alert('Bạn quên chưa nhập '+field[i]+'');
  255. ob.focus()
  256. return false;
  257. }
  258. }
  259. obs=document.getElementById('c0');
  260. var re = /^[<>/:]$/;
  261. if (re.test(obs.value)) {
  262. obs.value.value = obs.value.replace(/[<>/:]/g,"");
  263. }
  264. }
  265. function checkus()
  266. {
  267. user=document.getElementById('user');
  268. pass=document.getElementById('pass');
  269. if(user.value=="")
  270. {
  271. alert('Bạn quên chưa nhập username!');
  272. user.focus()
  273. return false;
  274. }
  275. if(pass.value=="")
  276. {
  277. alert('Bạn quên chưa nhập mật khẩu');
  278. pass.focus()
  279. return false;
  280. }
  281. }
  282. function checksearch()
  283. {
  284. ob=document.getElementById('csearch');
  285. g1=document.getElementById('g1');
  286. g2=document.getElementById('g2');
  287. if(ob.value=='' || ob.value=='Nhập số sim bạn cần tìm kiếm!')
  288. {
  289. alert('Bạn hãy nhập số cần tìm! VD: *1986 , 091*6789, *8888, 0123*6666, 09xxxxx768, 09*55x55');
  290. return false;
  291. }
  292. if(g1.value=="" && g2.value!="")
  293. {
  294. g1.value='100,000';
  295. }
  296. if(g1.value < 100000)
  297. {
  298. g1.value='100,000';
  299. }
  300. //oj=document.timkiemsim;
  301. //window.location.href='tim-kiem-sim-so-dep-'+oj.smang.value+'-'+g1.value+'-'+g2.value+'-'+oj.Textsim.value+'-'+oj.tongnut.value+'.html';
  302. return true;
  303. }
  304. function checktai()
  305. {
  306. g1=document.getElementById('gia1');
  307. g2=document.getElementById('gia2');
  308. if(g1.value=='100.000' && g2.value=='20.000.000')
  309. {
  310. g1.value='';
  311. g2.value='';
  312. }
  313. }
  314. function checkmobis(field)
  315. {
  316. var re = /^[0-9.xX*]$/;
  317. if (!re.test(field.value)) {
  318. field.value = field.value.replace(/[^0-9.xX*]/g,"");
  319. }
  320. if(field.value.length >= 4)
  321. {
  322. $("#jasearch").load('aindex.php?act=jasearch&keyword='+field.value+'');
  323. }
  324. }
  325. function checkmobisx(field)
  326. {
  327. var re = /^[0-9.xX*]$/;
  328. if (!re.test(field.value)) {
  329. field.value = field.value.replace(/[^0-9.xX*]/g,"");
  330. }
  331. }
  332. function demsodadang(i)
  333. {
  334. ob=document.getElementById('datang');
  335. ob.value=100;
  336. }
  337. function admds()
  338. {
  339. ob=document.getElementById('select');
  340. if(ob.value==0)
  341. {
  342. alert('Bạn quên chưa chọn đại lý');
  343. ob.focus()
  344. return false;
  345. }
  346. }
  347. function copyToClipBoard(sContents)
  348. {
  349. window.clipboardData.setData("Text", sContents);
  350. }
  351. function loadweb()
  352. {
  353. setTimeout("ajaxLoad('hit.htm','bodem')",1200);
  354. setTimeout("ajaxLoad('yahoo.htm','yahoo')",1400);
  355. }
  356. function loadimg()
  357. {
  358. if(window.screen.width < 1024)
  359. {
  360. //var ob=document.getElementById('s');
  361. //ob.src="images/support2.jpg";
  362. }
  363. else
  364. {
  365. var ob=document.getElementById('xmain');
  366. ob.style.width="95%";
  367. }
  368. }
  369. function checkcod(v)
  370. {
  371. ob=document.Form1;
  372. ob._ctl0_Mae1_txt.value=''+v+'';
  373. ob.submit()
  374. }
  375. function executeComma2(fr) {
  376. temp = fr.value;
  377. /*for (i=0;i<temp.length;i++) {
  378. if (temp.charAt(i) == ',') {
  379. temp.charAt(i) = '';
  380. }
  381. }*/
  382. for (i=0;i<temp.length;i++) {
  383. for (k=i;k<temp.length;k++) {
  384. if (temp.charAt(k) == ',') {
  385. temp = temp.replace(',','');
  386. }
  387. }
  388. }
  389. var j = 0;
  390. var s = "";
  391. var s1 = "";
  392. var s2 = "";
  393. for (i=temp.length-1;i>=0;i--) {
  394. j = j+1;
  395. if (j == 3) {
  396. j = 0;
  397. s1 = temp.substring(0,i);
  398. s2 = temp.substring(i,i+3);
  399. s = "," + s2 + s;
  400. }
  401. }
  402. if (s1.length > 0) {
  403. //alert(s1.length);
  404. s = s1 + s;
  405. fr.value = s;
  406. }else if (s.length > 0 && s2.length > 0){
  407. fr.value = s.substring(1,s.length);
  408. }
  409. }
  410. function executeComma(event,fr) {
  411. //alert(event.keyCode);
  412. if ((event.keyCode >= 96 && event.keyCode <= 105)) {
  413. executeComma2(fr);
  414. }
  415. else if (event.keyCode >= 48 && event.keyCode <= 57) {
  416. executeComma2(fr);
  417. }
  418. else if (event.keyCode == 8 || event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9) {
  419. executeComma2(fr);
  420. }
  421. else {
  422. //alert("Giá trị nhập vào là một số!");
  423. //fr.value = "";
  424. }
  425. }
  426. murl=document.URL;
  427. if(murl.indexOf('dat-mua-sim-')==-1)
  428. {
  429. setTimeout("location.reload(true);",600000);
  430. }
  431. function xbload()
  432. {
  433. document.timkiemsim.Textsim.focus()
  434. }
  435. function cyeucau()
  436. {
  437. field=new Array();
  438. field[0]="Bạn quên chưa nhập số sim yêu cầu! ";
  439. field[1]="Bạn quên chưa lựa chọn ngày chấm dứt yêu cầu!";
  440. field[2]="Bạn quên chưa nhập số điện thoại liên hệ với bạn!";
  441. for(i=0;i<=field.length;i++)
  442. {
  443. ob=document.getElementById('c'+[i]+'');
  444. if(ob.value=="")
  445. {
  446. alert(field[i]);
  447. ob.focus()
  448. return false;
  449. }
  450. }
  451. }
  452. function oshow()
  453. {
  454. $("#soption").show("slow");
  455. $("#soption2").show("fast");
  456. $("#tbt").show("fast");
  457. $("#tnc").hide("fast");
  458. }
  459. function ohide()
  460. {
  461. $("#soption").hide("slow");
  462. $("#soption2").hide("fast");
  463. $("#tbt").hide("fast");
  464. $("#tnc").show("fast");
  465. }
  466. function xacthuc(str1,str2,str3)
  467. {
  468. $.get('aindex.php?act=xacthuc&code1='+str1+'&code2='+str2+'&dhmd5='+str3+'',function(datax)
  469. {
  470. if(datax==0)
  471. alert('Quý khách đã nhập sai mã xác thực vui lòng thử lại!');
  472. else
  473. {
  474. $("#xt").hide("slow");
  475. $("#thank").show("fast");
  476. }
  477. }
  478. );
  479. }
  480. $(document).ready(function(){
  481. /**
  482. var data = "*2x2x2x *77x77x *x88x88 0912* 0913* 0914* 0916* 01234* 091*6868 090*1990 09*1986 1990 1991 1992 1986 1987 1988 1989 1982 1981 1980 *6789 6789 *6868 *8888 *6666 *9999 *1102 09*888 09*666 09*8x8x8x 09*66x88x".split(" ");
  483. $("#csearch").autocomplete(data);
  484. var data = "100,000 200,000 300,000 400,000 500,000 600,000 700,000 800,000 900,000 1,000,000 2,000,000 3,000,000 4,000,000 5,000,000 6,000,000 7,000,000 8,000,000 9,000,000 10,000,000 20,000,000 30,000,000 40,000,000 50,0000,000 60,000,000 70,000,0000 80,000,000 90,000,000 100,000,000 200,000,000 300,000,000 400,000,000 500,000,000 600,000,000 700,000,000 800,000,000 900,000,000 1,000,000,000 2,000,000,000".split(" ");
  485. $("#g1").autocomplete(data);
  486. $("#g2").autocomplete(data);
  487. **/
  488. $("a[rel='example1']").colorbox();
  489. $("a[rel='example2']").colorbox({transition:"fade"});
  490. $("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
  491. $("a[rel='example4']").colorbox({slideshow:true});
  492. $("a[rel='example5']").colorbox({transition:"none", width:"50%", height:"75%"});
  493. $(".example5").colorbox();
  494. $(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
  495. $(".example7").colorbox({width:"80%", height:"80%", iframe:true});
  496. $(".example8").colorbox({width:"50%", inline:true, href:"#inline_example1"});
  497. $(".example9").colorbox({
  498. onOpen:function(){ alert('onOpen: colorbox is about to open'); },
  499. onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
  500. onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
  501. onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
  502. onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
  503. });
  504. //Example of preserving a JavaScript event for inline calls.
  505. $("#click").click(function(){
  506. $('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
  507. return false;
  508. });
  509. });