<!DOCTYPE html> <head> <meta http-equiv="X-UA-Compatible" content="IE=Edge, chrome=1"/> <meta charset="utf-8"> <meta name='viewport' content='width=device-width, initial-scale=1.0' > <?php require_once "ssession.php"; session_start(); // Check if the user is logged in, if not then redirect him to login page if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){ header("location: welcome.php"); exit; } $id=$_SESSION["uid"] ; $username=$_SESSION["username"]; // $guser=$_SESSION["guser"]; ?> <?php $ownid=$_GET['ownid']; $title=$_GET['title']; $packid=$_GET['packid']; $title=$_GET['title']; $sclink="<a href=zlistscsn.php?userid=".$id."&username=".$row['username']."&guser=".$row['guser']."&packid=".$packid."&title=".urlencode($title).">"; ?> <link rel="stylesheet" type="text/css" href="z0.css"> <link rel="stylesheet" type="text/css" href="z51.css"> <script type="text/javascript" src="z.js"></script> <link rel="stylesheet" type="text/css" href="shirt.css"> <script type="text/javascript" src="shoes.js"></script> <link rel="stylesheet" type="text/css" href="table.css"> <div id="snackbar">Hi.<br></div> <div id="snackbar2">Data Saved <br>message<br>test..</div> <div id="snackbar5" > <span class=close5 onclick=closeme5("snackbar5"); >✕</span><div id=snackbar5cont></div><br></div> <div id="snackbar6" > <span class=close6 onclick=closeme6("snackbar6"); >✕</span><div id=snackbar6cont></div><br></div> <div id="snackbarx" > <span class=closex onclick=closemex("snackbarx"); >✕</span><br> <div id="uupload" style="display:none"> <span id="uuploadid" name="uuploadid">0</span>|Attachment (limit size<1.5Mib<br> <input type="file" name="file" id="file" onchange="preview()"> <img id="frame" src="" max-width="100%" height="32px"/><br> <input type="button" id="btn_uploadfile" value="Upload" onclick="uploadFile(document.getElementById('uuploadid').innerHTML,'<?php echo $id;?>');" > </div> <br> </div> <!--snackend--> <div id="rsslbar" class="rsslbar vrmenu"> <div class=rsslbar_title onclick="rsslbar_off()"><span title="Setting"></span> </div><br><br> <a href="javascript:void(0)" class="closebtnr" onclick="rsslbar_off()">×</a> <a href="#" class="active">Q/A</a> <a href="#">Services</a> <a href="#">Clientss</a> <a href="#">Contact</a> <div class=rsslbar_body> <br> User Name:<?php echo htmlspecialchars($username);?><hr> Current LANG:<span id=lang>en</span> <br><button class="button1 grey" onclick=setlang("th")>TH</button>/<button class="button1 grey" onclick=setlang("en")>EN</button> </div> </div> <div id="lsslbar" class="lsslbar vlmenu" onclick="lsslbar_off()"> <div class=lsslbar_title><></div><br><br> <a href="javascript:void(0)" class="closebtn" onclick="lsslbar_off()">×</a> <a href="#" class="active" >About</a> <a href="#">Services</a> <a href="#">Clients</a> <a href="#">Contact</a> </div> <div id="extbar" class="extbar" onclick="extbar_off()"> <a href="javascript:void(0)" class="closebtn" onclick="extbar_off()">×</a> <br><br><div class=extbar_title >info</div> <div class=extbar_body> <div class=extbar_body_in> iNfO<br> User Name:<?php echo htmlspecialchars($username);?> </div> <button class="button red d-center" onclick="extbar_off()"></span>Close</button> </div> </div> <div id="alertbar" class="alertbar" onclick="alertbar_off()"> <div class=extbar_body_in> info<br> User Name:<?php echo htmlspecialchars($username);?> </div> </div> <div id=maincont> <!--st breadcrumb--> <span class="breadcrumb"> <a href="welcome.php">Home</a> / <a href="kosmo.php" class=active>Dashboard</a> / <a href="logout.php" class="btn btn-danger">Sign Out of Your Account</a> </span> <!--en breadcrumb--> <div id=topbar> <span class=whead>WMenu</span><span class=mhead >⟨</span> <span id="logo" class="icon icon-logo" ></span> <span class=right > <a style="padding-left:1px;" href="#\" onclick="extbar_on();"><span class="icon icon-warning" title="connected"></span></a> <a style="padding-left:1px;" href="#\" onclick="snackbar('user');"><span class="icon icon-user" title="HELLO <?php echo htmlspecialchars($username);?>"></span></a> <a style="padding-left:1px;" href="#\" onclick=reloadme();><span class="icon icon-sync" title="sync data"></span></a> <a style="padding-left:1px;" href="#\" onclick="rsslbar_on();"><span class="icon icon-gear" title="Setting"></span></a> <!-- <a style="padding-left:1px;" href="#" onclick=sbconth2no();><span class="icon icon-menufold" title="LOGOUT"></span></a> --> <a style="padding-left:1px;" href="logout.php" ><span class="icon icon-logout" title="Logout"></span></a> </span> </div> <link rel="stylesheet" type="text/css" href="shirt.css"> <script type="text/javascript" src="shoes.js"></script> <script> p=new makediv ("bottombar"); ebyid ("bottombar").innerHTML='<a id=lang style="margin-right:10px;float:left;" href=# ><?php echo $_SESSION['lang'];?></a><a style="margin-right:10px;float:left;" href=# ></a><span class="ibrinking" style="color:black"; style="margin-left:1%;"><?php echo htmlspecialchars($username);?></span><a style="margin-right:20px;float:right;;" href=#\ onclick="dlmode();return false;">DAK</a><a style="margin-right:10px;float:right;" href=# onclick="blmode();return false;" >BLU</a><a style="margin-right:10px;float:right;" href=# onclick="ormode();return false;" >YEL</a><a style="margin-right:10px;float:right;" href=# onclick="rdmode();return false;" >RED</a><a style="margin-right:10px;float:right;" href=# onclick="grmode();return false;" >GRE</a>'; showd("bottombar"); p=new makediv("snackbar"); ebyid("snackbar").innerHTML="<p>USER</p>"; showd("snackbar"); //active user icon var cols = document.getElementsByClassName('icon-user')[0]; // cols.style.Color = 'black'; cols.style.filter = 'invert(0%)';// cols.style.filter = 'invert(0%)'; //active user icon </script> <script type="text/javascript" src="socks.js"></script> <!--startflexcontainer--> <div class="flex container"> <!--startsection--> <h1><?php echo "Pack Name:".$title." ,PACKID:".$packid ?></h1><?php echo $username;?>-Admin- <a class="button1 blue" style="color:rgba(229,229,229,.99);" href=?packid=<?php echo $packid;?>&ownid=<?php echo $ownid;?>&update=yes>💾UPDATE</a> <button class="button1 red" style="color:white;" onclick=d3o("<?php echo $ownid;?>","<?php echo $packid;?>","<?php echo $title;?>");>✔SUBMIT CHECKLIST</button> <table id=tble style='table-layout:fixed;' ><tr> <th style='width:50%;'>Topic</th><th style='width=10px;'>complete</th><th style='width=10px;'>inprocess</th><th style='width=10px;'>not done</th><th style='width=10px;'>not applicable</th><th style='width=10px;'>-</th><th style='width=10px;'>-</th><th style='width=10px;'>-</th></tr> <?php $packid=$_GET["packid"]; $ownid=$_GET['ownid']; $id=$_GET['id']; // Include config file require_once "configs.php"; // Attempt select query execution //added bug fix on 2021-07-14 SELECT * FROM lisa join fixa on fixa.id=lisa.fixaid and lisa.packid=".$packid $sql = "SELECT * ,attachmentv as attv FROM lisa join fixa on fixa.id=lisa.fixaid and lisa.packid=$packid join (SELECT packid,hid,fixaid, CASE WHEN hid=0 THEN ansa.id ELSE NULL END AS hid0, CASE WHEN hid=0 THEN ibox ELSE NULL END AS bx0 ,CASE WHEN hid=1 THEN hid ELSE NULL END AS hid1 ,CASE WHEN hid=1 THEN ibox ELSE NULL END AS bx1 ,CASE WHEN hid=1 THEN ansa.id ELSE NULL END AS hbx1,CASE WHEN hid=1 THEN wbox ELSE NULL END AS bxw1 ,CASE WHEN hid=1 THEN tbox ELSE NULL END AS tbx1 ,CASE WHEN hid=2 THEN hid ELSE NULL END AS hid2 ,CASE WHEN hid=2 THEN ibox ELSE NULL END AS bx2 ,CASE WHEN hid=2 THEN ansa.id ELSE NULL END AS hbx2,CASE WHEN hid=2 THEN wbox ELSE NULL END AS bxw2 ,CASE WHEN hid=2 THEN tbox ELSE NULL END AS tbx2 ,CASE WHEN hid=3 THEN hid ELSE NULL END AS hid3 ,CASE WHEN hid=3 THEN ibox ELSE NULL END AS bx3 ,CASE WHEN hid=3 THEN ansa.id ELSE NULL END AS hbx3,CASE WHEN hid=3 THEN wbox ELSE NULL END AS bxw3 ,CASE WHEN hid=3 THEN tbox ELSE NULL END AS tbx3 ,CASE WHEN hid=4 THEN hid ELSE NULL END AS hid4 ,CASE WHEN hid=4 THEN ibox ELSE NULL END AS bx4 ,CASE WHEN hid=4 THEN ansa.id ELSE NULL END AS hbx4,CASE WHEN hid=4 THEN wbox ELSE NULL END AS bxw4 ,CASE WHEN hid=4 THEN tbox ELSE NULL END AS tbx4 ,CASE WHEN hid=5 THEN ansa.id ELSE NULL END AS attyn,ansa.id as attacid,attachment FROM ansa where ownansaid=$ownid and ansa.packid=$packid and ansa.status=0 group by packid,fixaid,ownansaid) as b on fixa.id=b.fixaid group by b.fixaid ORDER by lisa.lcode"; $sql = "SELECT * ,attachmentv as attv FROM lisa join fixa on fixa.id=lisa.fixaid and lisa.packid=$packid join (SELECT packid,hid,fixaid, CASE WHEN hid=0 THEN ansa.id ELSE 0 END AS hid0, CASE WHEN hid=0 THEN ibox ELSE 0 END AS bx0 ,CASE WHEN hid=1 THEN hid ELSE 0 END AS hid1 ,CASE WHEN hid=1 THEN ibox ELSE 0 END AS bx1 ,CASE WHEN hid=1 THEN ansa.id ELSE 0 END AS hbx1,CASE WHEN hid=1 THEN wbox ELSE 0 END AS bxw1 ,CASE WHEN hid=1 THEN tbox ELSE 0 END AS tbx1 ,CASE WHEN hid=2 THEN hid ELSE 0 END AS hid2 ,CASE WHEN hid=2 THEN ibox ELSE 0 END AS bx2 ,CASE WHEN hid=2 THEN ansa.id ELSE 0 END AS hbx2,CASE WHEN hid=2 THEN wbox ELSE 0 END AS bxw2 ,CASE WHEN hid=2 THEN tbox ELSE 0 END AS tbx2 ,CASE WHEN hid=3 THEN hid ELSE 0 END AS hid3 ,CASE WHEN hid=3 THEN ibox ELSE 0 END AS bx3 ,CASE WHEN hid=3 THEN ansa.id ELSE 0 END AS hbx3,CASE WHEN hid=3 THEN wbox ELSE 0 END AS bxw3 ,CASE WHEN hid=3 THEN tbox ELSE 0 END AS tbx3 ,CASE WHEN hid=4 THEN hid ELSE 0 END AS hid4 ,CASE WHEN hid=4 THEN ibox ELSE 0 END AS bx4 ,CASE WHEN hid=4 THEN ansa.id ELSE 0 END AS hbx1,CASE WHEN hid=4 THEN wbox ELSE 0 END AS bxw4 ,CASE WHEN hid=4 THEN tbox ELSE 0 END AS tbx4 ,CASE WHEN hid=5 THEN ansa.id ELSE 0 END AS attyn,ansa.id as attacid,attachment FROM ansa where ownansaid=$ownid and ansa.packid=$packid and ansa.status=0 group by packid,fixaid,ownansaid) as b on fixa.id=b.fixaid group by b.fixaid ORDER by lisa.lcode"; $sql = "SELECT * ,attachmentv as attv FROM lisa join fixa on fixa.id=lisa.fixaid and lisa.packid=$packid join (SELECT packid,hid,fixaid, sum(CASE WHEN hid=0 THEN ansa.id ELSE NULL END) AS hid0, sum(CASE WHEN hid=0 THEN ibox ELSE NULL END) AS bx0 ,sum(CASE WHEN hid=1 THEN hid ELSE NULL END) AS hid1 ,sum(CASE WHEN hid=1 THEN ibox ELSE NULL END) AS bx1 ,sum(CASE WHEN hid=1 THEN ansa.id ELSE NULL END) AS hbx1,sum(CASE WHEN hid=1 THEN wbox ELSE NULL END) AS bxw1 ,sum(CASE WHEN hid=1 THEN tbox ELSE NULL END) AS tbx1 ,sum(CASE WHEN hid=2 THEN hid ELSE NULL END) AS hid2 ,sum(CASE WHEN hid=2 THEN ibox ELSE NULL END) AS bx2 ,sum(CASE WHEN hid=2 THEN ansa.id ELSE NULL END) AS hbx2,sum(CASE WHEN hid=2 THEN wbox ELSE NULL END) AS bxw2 ,sum(CASE WHEN hid=2 THEN tbox ELSE NULL END) AS tbx2 ,sum(CASE WHEN hid=3 THEN hid ELSE NULL END) AS hid3 ,sum(CASE WHEN hid=3 THEN ibox ELSE NULL END) AS bx3 ,sum(CASE WHEN hid=3 THEN ansa.id ELSE NULL END) AS hbx3,sum(CASE WHEN hid=3 THEN wbox ELSE NULL END) AS bxw3 ,sum(CASE WHEN hid=3 THEN tbox ELSE NULL END) AS tbx3 ,sum(CASE WHEN hid=4 THEN hid ELSE NULL END) AS hid4 ,sum(CASE WHEN hid=4 THEN ibox ELSE NULL END) AS bx4 ,sum(CASE WHEN hid=4 THEN ansa.id ELSE NULL END) AS hbx4,sum(CASE WHEN hid=4 THEN wbox ELSE NULL END) AS bxw4 ,sum(CASE WHEN hid=4 THEN tbox ELSE NULL END) AS tbx4 ,sum(CASE WHEN hid=5 THEN ansa.id ELSE NULL END) AS attyn,ansa.id as attacid,attachment FROM ansa where ownansaid=$ownid and ansa.packid=$packid and ansa.status=0 group by packid,fixaid,ownansaid) as b on fixa.id=b.fixaid group by b.fixaid ORDER by lisa.lcode"; $res = $db->query($sql); if ($res) { $i=0; while ($row = $res->fetchArray()) { echo "<td>".$row["title"]."</td>"; $scode=$row["scode"]; $lcode=$row["lcode"]; $fbox="=".$row["fbox"]; //added for fbox (fail score) $hbx1=$row['hbx1']; $hbx2=$row['hbx2']; $hbx3=$row['hbx3']; $hbx4=$row['hbx4']; $bx1=$row['bx1']; $bx2=$row['bx2']; $bx3=$row['bx3']; $bx4=$row['bx4']; $bxw1=$row['bxw1']; $bxw2=$row['bxw2']; $bxw3=$row['bxw3']; $bxw4=$row['bxw4']; $tbx1=$row['tbx1']; $tbx2=$row['tbx2']; $tbx3=$row['tbx3']; $tbx4=$row['tbx4']; $ansaid=$row["attacid"]; $attv=$row["attv"]; $attchment=$row['attachment'] ; //change 2021-08-08 $attchmentid=$row['attacid']; $jj1='{"attchmentid":"'.$attchmentid.'","attchment":"'.$attchment.'"}'; $acode=substr($lcode,0,3); $bcode=substr($lcode,0,2); //echo $acode; if ($scode!="q0") { $ar[$acode][1][]=$row["bx1"]; $ar[$acode][2][]=$row["bx2"]; $ar[$acode][3][]=$row["bx3"]; $ar[$acode][4][]=$row["bx4"]; //array to levels $bcode=substr($lcode,0,3); $br[$bcode][]=$row["bx1"]; $br[$bcode][]=$row["bx1"]; $cbr[$bcode][]=$row["bx1"]; $cbr[$bcode][]=$row["bx2"]; $cbr[$bcode][]=$row["bx3"]; $cbr[$bcode][]=$row["bx4"]; $ccode=substr($lcode,0,2); $cr[$ccode][]=$row["bx1"]; $cdr[$ccode][1][]=$row["bx1"]; $cdr[$ccode][2][]=$row["bx2"]; $cdr[$ccode][3][]=$row["bx3"]; $cdr[$ccode][4][]=$row["bx4"]; $dr[$ccode][1][]=$row["bx1"]; $dr[$ccode][2][]=$row["bx2"]; $dr[$ccode][3][]=$row["bx3"]; $dr[$ccode][4][]=$row["bx4"]; } $str= ($row['scode']) ; $hid0= ($row['hid0']) ; $bx0= ($row['bx0']) ; //echo "</td>"; if (substr($str,0,2)=="q0") { //echo $hid0."-".$bx0."*$lcode*"; //this row should show name of q0 and var //I assign name of header to array (2021-07-01-noom) $offlcode= substr($lcode,0,3); $oflcode= substr($lcode,0,2); $oflcode= $oflcode."0"; $level2[$offlcode]=$row["title"]; $level2fixaid[$offlcode]=$row["fixaid"]; $level2f[$offlcode]=$row["fbox"]; //2021-07-06 -added about fbox for fail status // echo $level2[$offlcode].$oflcode; //see to work only this vresion for 2 levels // //header 2 levels box eep ansa.id for each $sq=substr($lcode,0,3); $ssbox[$sq][0]=$hid0; $ssbox[$sq][1]=$hbx1; $ssbox[$sq][2]=$hbx2; $ssbox[$sq][3]=$hbx3; $ssbox[$sq][4]=$hbx4; /* echo "<td><input type=input name=$hbx1 value=$bx1 style='width: 2.7em' maxlength=4 placeholder=$hbx1 disabled></td>"; //disabled echo "<td><input type=input name=$hbx2 value=$bx2 style='width: 2.7em' maxlength=4 placeholder=$hbx2 disabled></td>";//disabled echo "<td><input type=input name=$hbx3 value=$bx3 style='width: 2.7em' maxlength=4 placeholder=$hbx3 disabled></td>";//disabled echo "<td><input type=input name=$hbx4 value=$bx4 style='width: 2.7em' maxlength=4 placeholder=$hbx4 disabled></td>";//disabled */ echo "<td></td><td></td><td></td><td></td>"; //echo c; echo "<td>"; //echo "+"; //echo $hbx3; //echo "*+"; echo "</td>"; //echo "*".$attacid."*"; if ($ssbox[$row['lcode']][0]) $sbox1=$ssbox[$row['lcode']][0]; } if (substr($str,0,2)=="q1") { $ssbox[$sq][0]=$hid0; $sq=substr($row['lcode'],0,3); //echo "+"; //I use this Tehniq to send whole linne to funnction for save //$a='[{"id":"'.$hbx1.'","value":"'.$tbx1.'"}]'; //dont need [] $a='{"id":"'.$hid0.'"}'; $b='{"id":"'.$hbx1.'","tbx":"'.$tbx1.'","bxw":"'.$bxw1.'"}'; $c='{"id":"'.$hbx2.'","tbx":"'.$tbx2.'","bxw":"'.$bxw2.'"}'; $d='{"id":"'.$hbx3.'","tbx":"'.$tbx3.'","bxw":"'.$bxw3.'"}'; $e='{"id":"'.$hbx4.'","tbx":"'.$tbx4.'","bxw":"'.$bxw4.'"}'; $jj='{"tbx0":'.$a.',"tbx1":'.$b.',"tbx2":"'.$b2.'","tbx3":"'.$b3.'","tbx4":"'.$b4.'"}'; //see the diff above no need " before object $jj='{"tbx0":'.$a.',"tbx1":'.$b.',"tbx2":'.$c.',"tbx3":'.$d.',"tbx4":'.$e.'}'; //$myJSON = json_encode($jj); $jcode =base64_encode($jj); //echo "<td>".$hid0."::".$ansaid.":"."</td>"; if ((int)$tbx1>0) $chkk1='checked'; else $chkk1=''; //echo $bx1,$bxw1.$tbx1."-tbx1 $st='myfuncf44("ansarowa55.php?sid='.$hbx1.'","snackbar2","'.$jcode.'"); '; $h1code=' onchange='.$st; echo "<td><input type=checkbox name=$hbx1 value=$tbx1 ".$chkk1.$h1code." ></td>"; if ((int)$tbx2>0) $chkk2='checked'; else $chkk2=''; //echo $bx2.$tbx2.$bxw2."-tbx2 $st2='myfuncf44("ansarowa55.php?sid='.$hbx2.'","snackbar2","'.$jcode.'"); '; $h2code=' onchange='.$st2; echo "<td><input type=checkbox name=$hbx2 value=$tbx2 ".$chkk2.$h2code." ></td>"; if ((int)$tbx3>0) $chkk3='checked'; else $chkk3=''; //echo $bx2.$tbx2.$bxw2."-tbx2 $st3='myfuncf44("ansarowa55.php?sid='.$hbx3.'","snackbar2","'.$jcode.'"); '; $h3code=' onchange='.$st3; echo "<td><input type=checkbox name=$hbx3 value=$tbx3 ".$chkk3.$h3code." ></td>"; if ((int)$tbx4>0) $chkk4='checked'; else $chkk4=''; //echo $bx2.$tbx2.$bxw2."-tbx4 $st4='myfuncf44("ansarowa55.php?sid='.$hbx4.'","snackbar2","'.$jcode.'"); '; $h4code=' onchange='.$st4; echo "<td><input type=checkbox name=$hbx4 value=$tbx4 ".$chkk4.$h4code." ></td>"; //echo "*".$attacid."*"; if ($ssbox[$row['lcode']][0]) $sbox1=$ssbox[$row['lcode']][0]; ?><td> <!-- <input type="checkbox" name="save" id ="myCheck" value="save" onclick=myfuncf4("ansarowa55.php?sid=<?php echo $hbx1;?>","rf2","<?php echo $jcode;?>",this);> <a class="button1 grey" href=#\ onclick=myfuncf44("ansarowa55.php?sid=<?php echo $hbx1;?>","snackbar2","<?php echo $jcode;?>"); style="font-size:12px;color:black;">💾Save</a>--> <?php //end if q1 } if ($attv>0) { //add 2021-08-08 about enable attachmentv ?><td><button class="button1 grey" onclick="hideu2('<?php echo $attchmentid;?>')"; return false;></span>📤</button></td> <!--<td><input type="checkbox" name="save" id ="myCheck" value="save" onclick=myfuncf3("ansarowa.php?sid=<?php echo $attchmentid;?>","rf2","<?php echo $jcode1;?>",this) ></td> --> <?php } //upload box echo "<td>"; if ($attchment!="0") {echo "<a href='$attchment' target='_blank' class='button1 grey' style='font-size:12px;color:red;'>🔗</a>"; // echo "<input type='text' style='width: 5.6em' maxlength=20 name='a$attchmentid' placeholder='$attchment' value='$attchment'>"; } echo "</td>"; // echo "</tr>"; $i++; } //$db->close(); } ?> <hr> </table> <!--endstart--> <?php function upxd($db,$ii,$ow){ echo $ii; $sql="update kepa set ibox=".$ii." where ownkepaid=$ow and packid=3 and fixaid=5"; $ret = $db->exec($sql); } echo "<h3> Analytics</h3>"; $totalsection=0; $sectionprogress=0; foreach ($ar as $key => $value) { $midhead="{$key}"; $bansaid=$ssbox[$midhead][0]; $gsummidhead=0; for ($i=1;$i<5;$i++) { $ansaid=$ssbox[$midhead][$i]; $iibox=array_sum($value[$i]); $gsummidhead=$gsummidhead+$iibox; updtt($db,$ansaid,$iibox); } echo $level2[$midhead]; $failscore=$level2f[$midhead]; //added for fail score updtk($db,$level2fixaid[$midhead],$gsummidhead); //2021-07-12 echo " Score is "; echo $gsummidhead; if ($gsummidhead>=$failscore) $fail="<span style='color:green'>PASSED</span>";else $fail="<span style='color:red'>FAIL</span>"; if ((!$failscore) || ($failscore<=0)) $fail="Failed score NOT Assigned"; echo " :status :$fail ($failscore)"; echo"<br>"; if ($gsummidhead>0) $sectionprogress++; //User version Should Show only progress instead of Nmber and Fail $totalsection++; } $pprogress=floor(($sectionprogress/$totalsection)*100); //finally I got percent (estimate) 2021-07-27 6AM // echo "<hr>"; echo "Estimate Percent Progress about ". $pprogress."%"; // head level with 3dimensions //echo "<hr>Show big header keys+ hide 3 dimensionz<br>"; foreach ($cr as $key => $value) { // $arr[3] will be updated with each value from $arr... // echo "{$key} ". "<br>"; //for ($i=1;$i<4;$i++;) //{ //$scr1=array_sum($cr[$key][$i]); //echo "sum(c) = " . $key . "<br>"; //} } //echo "<hr>Show big A header keys<br>"; $ggs=0; //call too much next version need multi update // update mysql //update ansa set ibox = case when id=2331 then 7 else ibox end //update ansa set ibox = case when id=2331 then 7 when id=2331 then 7 else ibox end foreach ($cdr as $key => $value) { // $arr[3] will be updated with each value from $arr... $bighead="{$key}0"; $bhansaid=$ssbox[$bighead][0]; // echo "$bighead<br>";// => {$value} "; $gsumbighead=0; $ansaid=$ssbox[$bighead][0]; // echo $ansaid."<br>"; //for ($i=1;$i<4;$i++;) //{ for ($i=1;$i<5;$i++) { $ansaid=$ssbox[$bighead][$i]; // echo "form id:".$ansaid; $iibox=array_sum($value[$i]); // echo "SS $i:".$iibox."<br>"; $gsumbighead=$gsumbighead+$iibox; //if ($ansaid) { //updtt($link,$ansaid,$iibox); //} } // echo "go up[date-in ".$bhansaid."<br>"; updtt($db,$bhansaid,$gsumbighead); // echo $bhansaid.":" ; // echo "SUUM:"; // echo $gsumbighead; // echo"<hr>"; $ggs=$ggs+$gsumbighead; //echo "sum(c) = " . $value[0] . "<br>"; //} } echo "<h3>Assessment Score "." is ".$ggs; echo "</h3>"; updyna($db,$ownid,$ggs,$pprogress,$packid); echo "<br><br>"; echo "<i>*Submit Need your profile <br>"; echo "After Submited you will No longer See this form</i>"; ?> <?php function updyna($db,$ownid,$iibox,$pprogress,$packid){ $update=$_GET["update"]; // if ($update=="yes"){ $sql = "update dyna set ibox='".$iibox ."',progress='".$pprogress ."' where ownerid=".$ownid." and packid=".$packid; $ret = $db->exec($sql); // } } function updtt($db,$ansaid,$iibox){ $update=$_GET["update"]; // echo ":::".$update.":::"; // if ($update=="yes"){ $sql = "update ansa set ibox='".$iibox."' where id=".$ansaid; $ret = $db->exec($sql); //} } function updtk($db,$fixaid,$iibox){ //require_once "configs.php"; $update=$_GET["update"]; $ownid =$_GET["ownid"]; $packid=$_GET['packid']; //echo ":::".$update." ib $iibox owid $ownid packid $packid fix $fixaid :::"; // if ($update=="yes"){ $sql = "update kepa set ibox='".$iibox."' where ownkepaid=".$ownid ." and packid=".$packid." and fixaid=".$fixaid; //$sql="update kepa set ibox='19' where ownkepaid=24 and packid=3 and fixaid=5"; $ret = $db->exec($sql); //echo ":::".$update.$iibox.$ownid .$packid.$fixaid.":::"; } ?> <script> function d3o(delid,packid,title){ if (confirm("Confirm to Submit your Form "+title+delid+packid) == true) { userPreference = "Data saved successfully!"; d3lr(delid,packid); } else { userPreference = "Canceled!"; } } function d3lr(delid,packid) { //var x = document.getElementById("iusername"); //var y = document.getElementById("iemail"); //var z = document.getElementById("ipassword"); //alert("delete "+delid); //return; server="zcreate_titan.php"; // snackbar2reload(); // snackbar2; datapack={}; //dont need this -as issue with special charactor // datapack.name=btoa(en1.value); //decode =atob // datapack.x=x.value; // datapack.y=y.value; // datapack.z=z.value; datapack.z=delid; datapack.y=packid; data=JSON.stringify(datapack); params="postdata="+data;//+row2+cmd1+cmd2; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { //document.getElementById(param).innerHTML = this.responseText; // document.getElementById("snackbar2").innerHTML = this.responseText; //reloadme(); if (this.response == "OK") { document.getElementById("snackbar2").innerHTML = this.responseText; snackbar2("<br><br>Your Checklist Submited"); //reloadme(); } else { alert("1"+this.response+"2"); } //closeme6("snackbar6"); // snackbar2reload(); } }; xhttp.open("POST",server, true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send(params); } function myfuncf44(server,param="",rowa) { // alert(rowa); // alert("test"); //exit; // var checkBox = document.getElementById("myCheck"); //var obj = JSON.parse(myJSON); var drow1 = atob(rowa); // var myJSON = JSON.stringify(drow1); //alert("drow1"+drow1); // alert(myJSON.tbx2); var myJSON = JSON.parse(drow1); //alert(myJSON.tbx1[0]+myJSON.tbx1[0]); // alert(document.getElementsByName(myJSON.tbx1.id)[0]); //alert(document.getElementsByName(myJSON.tbx1.id)[0]) ; //alert(myJSON.tbx2.id+myJSON.tbx2.value); //alert(myJSON.hbx1+myJSON.hbx2+myJSON.hbx3); //cmd1=(myJSON.tbx1.id+myJSON.tbx1.value); //if (document.getElementsByName(myJSON.tbx1.id)[0]=='undefined') alert("NO"); else alert("checked"); if (document.getElementsByName(myJSON.tbx1.id)[0].checked) myJSON.tbx1.value=1; else myJSON.tbx1.value=0; if (document.getElementsByName(myJSON.tbx2.id)[0].checked) myJSON.tbx2.value=1; else myJSON.tbx2.value=0; if (document.getElementsByName(myJSON.tbx3.id)[0].checked) myJSON.tbx3.value=1;else myJSON.tbx3.value=0; if (document.getElementsByName(myJSON.tbx4.id)[0].checked) myJSON.tbx4.value=1;else myJSON.tbx4.value=0; datapack={}; //dont need this -as issue with special charactor // datapack.name=btoa(en1.value); //decode =atob datapack.tbx1=(myJSON.tbx1); datapack.tbx2=(myJSON.tbx2); datapack.tbx3=(myJSON.tbx3); datapack.tbx4=(myJSON.tbx4); datapack.bxw1=(myJSON.bxw1); datapack.bxw2=(myJSON.bxw2); datapack.bxw3=(myJSON.bxw3); datapack.bxw4=(myJSON.bxw4); //datapack.hbxv1=(cmd1); //datapack.hbxv2=(cmd2); //datapack.hbxv3=(cmd3); //datapack.hbxv4=(cmd4); //data=datapack; data=JSON.stringify(datapack); // alert(data); //alert(obj.hbx1); //document.getElementById(param).innerHTML =row1; // alert(row1); // rr="row"+row; //if (row) rr=(document.getElementById(row).value); //cmd1=(document.getElementsByName(row1)[0].value); //cmd2=(document.getElementsByName(row2)[0].value); //note 2021-june 7 // SELECT * FROM ansa,fixa where fixa.id=ansa.fixaid and fixa.scode like "q0" and ansa.hid=0 //to see/update score on head // if (el.checked == true){ // alert(el.attributes["name"].value+"+"+drow1); params="postdata="+data;//+row2+cmd1+cmd2; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { // document.getElementById("snackbar2").innerHTML = this.responseText; //snackbar2reload(); // alert("serve4r:"+this.responseText); } }; xhttp.open("POST",server, true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send(params); //} //exit; //alert(el.attributes["name"].value+"+"+row1); } </script> <script> function upsumm(a,b){ x=(document.getElementsByName(a)[0]); // x.value=b; } function preview() { frame.src=URL.createObjectURL(event.target.files[0]); } function hideu2(y){ snackbarx(); var x = document.getElementById("uupload"); //var x = document.getElementById("rf2"); document.getElementById("uuploadid").innerHTML=y; // alert(y); if (x.style.display === "none") { x.style.display = "block"; } } function myfuncf3(server,param="",rowa,el) { var checkBox = document.getElementById("myCheck"); //var obj = JSON.parse(myJSON); var drow2 = atob(rowa); // var myJSON = JSON.stringify(drow1); //alert("drow2"+drow2); var myJSON2 = JSON.parse(drow2); attchmentidb="a"+myJSON2.attchmentid; // alert("J"+myJSON2.attchmentid);//+myJSON.attachment); cmd1=(document.getElementsByName(attchmentidb)[0].value); // alert(cmd1); // cmd2=(document.getElementsByName(myJSON.hbx2)[0].value); // cmd3=(document.getElementsByName(myJSON.hbx3)[0].value); alert(cmd1); datapack={}; //dont need this -as issue with special charactor // datapack.name=btoa(en1.value); //decode =atob datapack.attchmentid=(myJSON2.attchmentid); datapack.attchment=(cmd1); //datapack.hbx3=(myJSON.hbx3); //datapack.hbxv1=(cmd1); //datapack.hbxv2=(cmd2); //datapack.hbxv3=(cmd3); data2=datapack; data2=JSON.stringify(datapack); // alert(data2); //alert(obj.hbx1); //document.getElementById(param).innerHTML =row1; // alert(row1); // rr="row"+row; //if (row) rr=(document.getElementById(row).value); //cmd1=(document.getElementsByName(row1)[0].value); //cmd2=(document.getElementsByName(row2)[0].value); if (el.checked == true){ // alert(el.attributes["name"].value+"+"+drow2); } //exit; //alert(el.attributes["name"].value+"+"+row1); params="postdata="+data2;//+row2+cmd1+cmd2; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { //document.getElementById(param).innerHTML = this.responseText; document.getElementById("snackbar2").innerHTML = this.responseText; //reloadme(); snackbar2reload(); } }; xhttp.open("POST",server, true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send(params); } function preview() { frame.src=URL.createObjectURL(event.target.files[0]); } function myfuncf4(server,param="",rowa,el) { // alert(rowa); // alert("test"); //exit; var checkBox = document.getElementById("myCheck"); //var obj = JSON.parse(myJSON); var drow1 = atob(rowa); // var myJSON = JSON.stringify(drow1); //alert("drow1"+drow1); // alert(myJSON.tbx2); var myJSON = JSON.parse(drow1); //alert(myJSON.tbx1[0].id+myJSON.tbx1[0].value); //alert(myJSON.tbx2.id+myJSON.tbx2.value); //alert(myJSON.hbx1+myJSON.hbx2+myJSON.hbx3); //cmd1=(myJSON.tbx1.id+myJSON.tbx1.value); if (document.getElementsByName(myJSON.tbx1.id)[0].checked) myJSON.tbx1.value=1; else myJSON.tbx1.value=0; if (document.getElementsByName(myJSON.tbx2.id)[0].checked) myJSON.tbx2.value=1; else myJSON.tbx2.value=0; if (document.getElementsByName(myJSON.tbx3.id)[0].checked) myJSON.tbx3.value=1;else myJSON.tbx3.value=0; if (document.getElementsByName(myJSON.tbx4.id)[0].checked) myJSON.tbx4.value=1;else myJSON.tbx4.value=0; datapack={}; //dont need this -as issue with special charactor // datapack.name=btoa(en1.value); //decode =atob datapack.tbx1=(myJSON.tbx1); datapack.tbx2=(myJSON.tbx2); datapack.tbx3=(myJSON.tbx3); datapack.tbx4=(myJSON.tbx4); datapack.bxw1=(myJSON.bxw1); datapack.bxw2=(myJSON.bxw2); datapack.bxw3=(myJSON.bxw3); datapack.bxw4=(myJSON.bxw4); //datapack.hbxv1=(cmd1); //datapack.hbxv2=(cmd2); //datapack.hbxv3=(cmd3); //datapack.hbxv4=(cmd4); //data=datapack; data=JSON.stringify(datapack); // alert(data); //alert(obj.hbx1); //document.getElementById(param).innerHTML =row1; // alert(row1); // rr="row"+row; //if (row) rr=(document.getElementById(row).value); //cmd1=(document.getElementsByName(row1)[0].value); //cmd2=(document.getElementsByName(row2)[0].value); //note 2021-june 7 // SELECT * FROM ansa,fixa where fixa.id=ansa.fixaid and fixa.scode like "q0" and ansa.hid=0 //to see/update score on head if (el.checked == true){ // alert(el.attributes["name"].value+"+"+drow1); params="postdata="+data;//+row2+cmd1+cmd2; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("snackbar2").innerHTML = this.responseText; snackbar2reload(); // alert("serve4r:"+this.responseText); } }; xhttp.open("POST",server, true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send(params); } //exit; //alert(el.attributes["name"].value+"+"+row1); } function uploadFile(id,sdir) { //x=document.getElementById("uuploadid").innerHTML; var files = document.getElementById("file").files; if(files.length > 0 ){ var filess = document.getElementById("file").files[0]; if ( filess .size > 11500000 ) { alert("🖐 Not Allowed : File " + filess .name + " size is >" + (filess .size /1024/1024).toFixed(2) + " Mib");//limit file size return 0; } var formData = new FormData(); formData.append("file", files[0]); formData.append("idx", id); formData.append("sdirx", sdir); var xhttp = new XMLHttpRequest(); // Set POST method and ajax file path xhttp.open("POST", "uln.php?id"+id+sdir, true); // call on request changes state xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var response = this.responseText; // var d = JSON.parse(response); // acode= (response); acode=atob(response); var d = JSON.parse(acode); // alert(d.code); if(d.code == 1){ alert("Upload '"+sdir+":"+files[0].name+"' successfully."); location.reload(); }else{ alert(response+"File not uploaded."); } } }; // Send request with data xhttp.send(formData); }else{ alert("Please select a file"); } } </script>
Edit file:zform55e.php39616