function edit($id,$q,$col) {
global $db,$ar;
$sql = "select * from `cp_filephp` where id=".$id;
$res = mysqli_query($db, $sql);
//echo $sql;
$rw = mysqli_fetch_assoc($res);
$php_file=$ar['path_core'].''.$rw['folder'].''.$rw['slug'].'.php';
if (file_exists($php_file)) {
$filecontent=file_get_contents($php_file);
} else {
$filecontent="<?php
?>";
}
?>
<div class="row">
<div class="col-7">
<?=form_edit($rw,$filecontent,$q,$col);?>
</div>
<div class="col-5">
<div class="card">
<div class="card-body">
<?=$ar['path_core'];?>
<h5 class="card-title"><?=$rw['folder'];?><?=$rw['slug'];?>.php</h5>
<form method="post" action="index.php?op=filephp&op2=php_save&q=<?=$q;?>&col=folder">
<input type="hidden" name="file_name" value="<?=$php_file;?>">
<input type="hidden" name="id" value="<?=$id;?>">
<textarea class="form-control" rows="20" name="content"><?=htmlspecialchars($filecontent);?></textarea>
<input type="submit" name="submit" class="btn btn-sm btn-success mt-2">
</form>
</div>
</div>
</div>
</div>
<?php
//echo "<pre>"; print_r($rw); echo "</pre>";
}