// JavaScript Document //===== js part // dependance(ajax0) /* ex : code to run a ajax request var tab=new Array(); tab['async']=true; tab['mode']='POST'; tab['filephp']='ajax_test.php'; tab['filetxt']='ajax_test.txt'; tab['cmd']='test'; tab['params']='fname=henry&lname=ford&site='+jskebook; js_turn_on_xhttpr(tab);///true); */ function js_create_xhttpr(){ // http://www.w3schools.com/ajax/ajax_xmlhttprequest_create.asp var xhttpr; if (window.XMLHttpRequest){ xhttpr=new XMLHttpRequest(); } else { // code for IE6, IE5 xhttpr=new ActiveXObject("Microsoft.XMLHTTP"); } return(xhttpr); } function js_debug_process_in_xhttpr_php(tab,test,ajaxresponse){ if(tab['srvie']+tab['cmd']!=test)////'likessite') alert('lj:35 debug ajax in php "'+test+' : '+ajaxresponse); } function js_turn_on_xhttpr(tab){ //c tab[async];tab[filephp];tab[filetxt];tab[cmd];tab[params] var xhttpr=js_create_xhttpr(); var cmdline=tab['cmdline']; if(tab['async']&&tab['async']==true) xhttpr.onreadystatechange=function(){ if (xhttpr.readyState == 4 && xhttpr.status == 200) { ///document.getElementById("demo").innerHTML=xhttp.responseText; /// if(tab['cmd']=='test') var ajaxresponse=xhttpr.responseText; ///if(1|ajaxresponse==''){alert('lj:48 empty(ajaxresponse)==true'+ajaxresponse);return(false);}; if(ajaxresponse==''){/////alert('lj:48 empty(ajaxresponse)==true empty'+ajaxresponse); return(false);} /* lj:48 empty(ajaxresponse)==true 1 :: a.functions.php,,srvie=ip&cmd=count&mode=question_update&cod=&nor=undefined,,code_html,,20160919190151 :: nopwd ::::5,,,,,,,,,,,,127.0.0.3,,,,nopwd,,,,0100 */ var result=xhttpr.responseText.split('::'); /// var strtest=tab['filephp']+',,'+cmdline+',,'+tab['site']+',,'+tab['date']; var strtest=',,'+cmdline+',,'; js_debug_process_in_xhttpr_php(tab,'ipcount',xhttpr.responseText); //c js_debug_process_in_xhttpr_php(tab,'likessite',xhttpr.responseText); var z=result[1].split(strtest); if(z.length==1|xhttpr.responseText==''){ ////if(result[1]!=strtest||xhttpr.responseText==''){ alert('lj:54 test ajax : '+result[1]+' == '+strtest); /* lj:54 test ajax : en php a.functions.php,,srvie=ip&cmd=count&mode=simple&cod=&nor=undefined,,poem,,20160813075156 == ,,srvie=ip&cmd=count&mode=simple&cod=&nor=undefined,, lj:54 test ajax : en html ,,srvie=ip&cmd=count&mode=simple&cod=&nor=undefined,,poem,, == ../../a.functions.php,,srvie=ip&cmd=count&mode=simple&cod=&nor=undefined,,poem,,20160813074101 */ alert('lj:55 - '+cmdline+' - '+cmdline+'- response ajax : '+xhttpr.responseText); } if(result[0]&&z.length>1){///result[1]==strtest){ //c ../../../../images/design/ => ../img/ ///alert('lj:74 ajax0.js.php , result => '+result); //c E:\myproducts_sites\strangers\education\build\jslib\statistics0.js.php //c dependance(statistics0.js.php) var resok=true; resok=do_procedure_likes_with_after_ajax_response(tab,xhttpr.responseText,result,resok); //c dependance(statistics0.js.php) resok=do_procedure_ipcount_with_after_ajax_response(tab,xhttpr.responseText,result,resok); //c dependance(statistics0.js.php) resok=do_procedure_cookiesconsent_with_after_ajax_response(tab,xhttpr.responseText,result,resok); } } }; //!\resolve 18/08/2016 21:30:50 tab['filephp'] doit posséder ../../ xhttpr.open(tab['formmode'],tab['filephp'],true); ///xhttpr.open("POST", "ajax_test.php", true); xhttpr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); ////xhttp.send("site="+ebook+"&"+"date="+"30/07/2016 16:21:34"); ///var params='cmd='+tab['cmd']+'&filetxt='+tab['filetxt']+'&'+tab['params']; xhttpr.send(cmdline+'&p='+tab['p']);//c "fname=henry&lname=ford&site=ebook"); } function js_get_cmdline_xhttpr(tab){ return('srvie='+tab['srvie']+'&cmd='+tab['cmd']+'&mode='+tab['mode']+'&cod='+tab['cod']+'&nor='+tab['nor']); } function js_get_params_xhttpr(tab,filephp,filetxt,strparams){ tab['filephp']=filephp; tab['filetxt']=filetxt; tab['site']=jskebook;tab['thema']=jskebook; //c jsipcounter={delay:$i_delay,id:'$i_id,mode:'$i_mode'}; tab['inc30']=(jsipcounter&&jsipcounter.delay>0?jsipcounter.delay:20); tab['id']=(jsipcounter&&jsipcounter.id!=''?jsipcounter.id:main_counter); var x=jsget_timeNow({m:tab['inc30']}); tab['date']=x.iso; tab['date30']=x.iso30; tab['p']=strparams+';;filephp;'+tab['filephp']+';;filetxt;'+tab['filetxt']+';;date;'+tab['date']; tab['p']+=';;date30;'+tab['date30']+';;inc30;'+tab['inc30']+';;thema;'+jskebook+';;test;'+jscookietest; ///tab['p']+=';;date30;'+tab['date30']+';;inc30;'+tab['inc30']+';;thema;'+tab['thema']; return(tab['p']); } function js_cmd_xhttpr(arr){ //c var arr=new Array('test','ajax',0,'','a.totest.php','ajax_test.txt','fname;henry;;lname;ford',jskebook,ref); //c var arr=new Array('ip','count','simple','','ajax_functions.php','','',jskebook,ref); //c js_cmd_xhttpr(arr); var tab=new Array(); tab['async']=true; tab['formmode']='POST'; //====== cmd tab['srvie']=arr[0];///'test'; tab['cmd']=arr[1];///'ajax'; tab['mode']=arr[2];///0; tab['cod']=arr[3];///''; tab['nor']='undefined';//c lire le input pour envoi //====== command line tab['cmdline']=js_get_cmdline_xhttpr(tab); //====== params ////var arr=js_get_params_xhttpr(tab,'ajax_test.php','ajax_test.txt','fname;henry;;lname;ford;;date;now;;site;'+jskebook); var arr=js_get_params_xhttpr(tab,arr[4],arr[5],arr[6]); js_turn_on_xhttpr(tab);///true); }