fin2@agn
BNI-PT
Man-PT
KasKecil
BCA 671
Man 709
Account Tree
db backup
eBook #1
eBook #2
eBook #3
Tax eBook #4
Color
Logout
Mutasi BNI PT
Mutasi Mandiri PT
Mutasi Mandiri 709
Mutasi Mandiri 202
Mutasi BCA 671
Mutasi BCA 471
Mutasi Jago
Action
Transaction
Journal
Report
FilePHP
Tes cURL [1]
Copy This
Save
folder
slug
param
method
body
remark
php
Copy
/home/u902783705/domains/azkapersada.com/public_html/sub/fin/
inc.filephp.php
<main> <div class="container-fluid"> <div class="row align-items-center justify-content-between pt-2"> <div class="col-auto mb-3"> <h2><b>FilePHP</b></h2> </div> <div class="col-12 col-xl-auto mb-3"> <!--<a class="btn btn-xs btn-success" href="?op=phpfile&op2=add">Add</a>--> </div> </div> <?php switch($op2) { case "php_save"; file_put_contents($_POST['file_name'], $_POST['content']); edit($_POST['id']); break; case "edit"; edit($_GET['id']); break; case "copy"; $sql4 = "select id from `cp_filephp` order by id desc limit 1"; $res4 = mysqli_query($db, $sql4); $rw4 = mysqli_fetch_assoc($res4); $id2=$rw4['id']+1; $sql3 = "select * from `cp_filephp` where id=".$_GET['id']; $res3 = mysqli_query($db, $sql3); $r3 = mysqli_fetch_assoc($res3); $idt=array( 'id'=>$id2, //'modul'=>trim($r3['modul']), 'slug'=>$r3['slug']."-", 'folder'=>trim($r3['folder']), 'param'=>trim($r3['param']), 'method'=>trim($r3['method']), 'php'=>gpc(trim($r3['php'])), 'php_update_at'=>time(), 'body'=>gpc(trim($r3['body'])), ); Insert($db,"cp_filephp",$idt,0); edit($id2); break; case "edit2"; //echo "<pre>"; print_r($_POST); echo "</pre>"; $udt=array( //'modul'=>trim($_POST['modul']), 'slug'=>$_POST['slug'], //'name'=>$_POST['name'], 'param'=>trim($_POST['param']), 'method'=>trim($_POST['method']), 'folder'=>$_POST['folder'], //'file_jsapi'=>$_POST['file_jsapi'], 'remark'=>trim($_POST['remark']), 'php'=>gpc(trim($_POST['php'])), //'js'=>gpc(trim($_POST['js'])), //'js_api'=>gpc(trim($_POST['js_api'])), 'body'=>gpc(trim($_POST['body'])), 'php_update_at'=>time(), //'js_update_at'=>time(), //'jsapi_update_at'=>time(), ); Update($db,"cp_filephp",$udt,"id=".$_POST['id'],0); edit($_POST['id']); break; case "list"; list_filephp($q,$col,$q2,$col2,$q3,$col3); default; } ?> </div> </main> <?php function list_filephp($q,$col,$q2,$col2,$q3,$col3) { global $db,$ar; //print_r($ar); ?> <table class="table table-bordered" id="dataTable_2d" width="100%" cellspacing="0"> <thead> <tr> <th>ID</th> <th>Folder</th> <th>Slug</th> <th>is_api</th> <th>remark</th> <th>PhpAt</th> <th>Menu</th> </tr> </thead> <tbody> <?php $sql = "select * from cp_filephp where id>0 "; if($col!='') { $sql .= " and ".$col."='".$q."' "; } if($col2!='') { $sql .= " and ".$col2."='".$q2."' "; } if($col3!='') { $sql .= " and ".$col3."='".$q3."' "; } //$sql .= " and st=1"; $res = mysqli_query($db, $sql); //echo $sql; while($rw = mysqli_fetch_assoc($res)) { ?> <tr> <td><?=$rw['id'];?></td> <td><?=$rw['folder'];?></td> <td><?=$rw['slug'];?></td> <td><?=$rw['type'];?></td> <td><?=$rw['remark'];?></td> <td class="text-right"><?=date("Y-m-d H:i",$rw['php_update_at']);?></td> <td> <a class="btn btn-xs btn-primary" href="?op=filephp&op2=edit&id=<?=$rw['id'];?>">edit</a> <a href="#" onClick="uCol(<?=$rw['id'];?>,'del',1,'cp_filephp');" class="btn btn-xs btn-color-red">del</a> <a href="#" onClick="uCol(<?=$rw['id'];?>,'type',0,'cp_filephp');" class="btn btn-xs btn-color-green">non-api</a> </td> </tr> <?php } ?> </tbody> </table> <br><?=$sql;?><br> <script> function editRow(editableObj) { $(editableObj).css("background","#e1bee7"); } function saveToDatabase(editableObj,column,id,tbl) { $(editableObj).css("background","#e1bee7 url(storage/image/loaderIcon.gif) no-repeat right"); $.ajax({ url: "ucol.php", type: "POST", data:'tbl='+tbl+'&col='+column+'&val='+$(editableObj).text()+'&wc=id&id='+id, success: function(data){ $(editableObj).css("background","#FDFDFD"); } }); } function selectRecord(id) { //if(confirm("Are you sure you want to delete this row?")) { $.ajax({ url: "ucol.php", type: "POST", data:'tbl=cp_file&col=del&val=1&wc=id&id='+id, success: function(data){ $("#row-"+id).remove(); } }); //} } </script> <?php } function edit($id) { global $db,$ar; $sql = "select * from `cp_filephp` where id=".$id; $res = mysqli_query($db, $sql); //echo $sql; $rw = mysqli_fetch_assoc($res); ?> <div class="row"> <div class="col-8"> <form action="index.php?op=filephp&op2=edit2" method="post"> <input type="hidden" name="id" value="<?=$id;?>"> <div class="row"> <div class="col-6"> </div> <div class="col-6 text-end"> <?php if($rw['type']==1) { ?> <a href="tes_curl.php?id=<?=$id;?>&c=1" target="_blank" class="btn btn-xs btn-info">Tes cURL [1]</a> <?php } ?> <a class="btn cl-dp5 mr-2" href="?op=filephp&op2=copy&id=<?=$id;?>">Copy This</a> <button type="submit" name="submit" class="btn btn-primary">Save</button> </div> </div> <div class="row"> <div class="col-4"> <label for="folder" class="label">folder</label> <input type="text" class="form-control" name="folder" value="<?=$rw['folder'];?>"> <label for="slug" class="label">slug</label> <input type="text" class="form-control" name="slug" value="<?=$rw['slug'];?>"> <label for="param" class="label">param</label> <input type="text" class="form-control" name="param" value="<?=$rw['param'];?>"> <label for="method" class="label">method</label> <input type="text" class="form-control" name="method" value="<?=$rw['method'];?>"> <label for="body" class="label">body</label> <textarea rows="4" id="body" class="form-control" name="body"><?=ugpc($rw['body']);?></textarea> <label for="remark" class="label">remark</label> <textarea rows="4" id="body" class="form-control" name="remark"><?=ugpc($rw['remark']);?></textarea> </div> <div class="col-8"> <label for="php" class="label">php</label> <button onclick="copyContent('php')" class="btn btn-xs cl-bl">Copy</button> <textarea rows="20" id="php" class="form-control" name="php"><?=$rw['php'];?></textarea> <div id="editor-container-1" style="height:300px;"></div> </div> </div> </form> </div> <div class="col-4"> <?php $php_file=$ar['app_path'].''.$rw['folder'].'/'.$rw['slug'].'.php'; if (file_exists($php_file)) { $filecontent=file_get_contents($php_file); } else { $filecontent="<?php ?>"; } ?> <div class="card"> <div class="card-body"> <p><?=$ar['app_path'];?></p> <h5 class="card-title"><?=$rw['folder'];?><?=$rw['slug'];?>.php</h5> <form method="post" action="index.php?op=filephp&op2=php_save"> <input type="hidden" name="file_name" value="<?=$php_file;?>"> <input type="hidden" name="id" value="<?=$rw['id'];?>"> <textarea class="form-control" rows="16" name="content"><?=htmlspecialchars($filecontent);?></textarea> <input type="submit" name="submit" class="btn btn-success mt-2"> </form> </div> </div> </div> </div> <?php //echo "<pre>"; print_r($rw); echo "</pre>"; } ?>