SIMON Master Console Rebuild
True command center for SIMON + WEB360
This rebuild gives you a cleaner production spine: interactive tree, live viewer, guarded editor, dynamic graphics, architecture map, and note storage. It is designed to sit beside your existing
console.php
and become the stronger replacement path.
Dashboard
Tree
Viewer
System Map
File Registry
Notes
Files
15,282
Folders
407
Scanned Size
3.84 GB
PHP Files
876
Editable Text Files
12,545
File viewer
guarded to /htdocs
/connlink/api/ftp.php
<?php declare(strict_types=1); header('Content-Type: application/json; charset=utf-8'); $raw=json_decode(file_get_contents('php://input')?:'{}',true)?:[]; $action=(string)($raw['action']??''); $dir=dirname(__DIR__).'/data'; if(!is_dir($dir)) mkdir($dir,0755,true); $file=$dir.'/ftp.php'; function respond($ok,$arr=[]){echo json_encode(['ok'=>$ok]+$arr);exit;} if($action==='save'){ $cfg=['host'=>trim((string)($raw['host']??'')),'port'=>(int)($raw['port']??21),'user'=>trim((string)($raw['user']??'')),'pass'=>(string)($raw['pass']??''),'path'=>trim((string)($raw['path']??'/')),'protocol'=>trim((string)($raw['protocol']??'ftp')),'updated'=>date('c')]; if($cfg['host']===''||$cfg['user']===''){http_response_code(400);respond(false,['error'=>'FTP host and username are required']);} file_put_contents($file,"<?php\nreturn ".var_export($cfg,true).";\n",LOCK_EX); @chmod($file,0600); respond(true,['message'=>'FTP login saved']); } $cfg=is_file($file)?(include $file):[]; if(!$cfg){http_response_code(400);respond(false,['error'=>'No FTP login saved']);} if(($cfg['protocol']??'ftp')==='sftp'){http_response_code(400);respond(false,['error'=>'SFTP requires SSH2 extension setup on server. Save works; live SFTP test is not enabled in this PHP build.']);} if(!function_exists('ftp_connect')){http_response_code(500);respond(false,['error'=>'PHP FTP extension is not enabled on this server']);} $conn=@ftp_connect((string)$cfg['host'],(int)($cfg['port']?:21),15); if(!$conn){http_response_code(500);respond(false,['error'=>'Could not connect to FTP host']);} $login=@ftp_login($conn,(string)$cfg['user'],(string)$cfg['pass']); if(!$login){@ftp_close($conn);http_response_code(500);respond(false,['error'=>'FTP login failed']);} @ftp_pasv($conn,true); if($action==='test'){@ftp_close($conn);respond(true,['message'=>'FTP login connected successfully']);} if($action==='publish'){ $content=(string)($raw['content']??''); if($content===''){http_response_code(400);respond(false,['error'=>'No generated web builder code to publish']);} $target=basename(parse_url((string)($raw['target']??'index.html'),PHP_URL_PATH)?:'index.html'); if(!preg_match('/\.(html|php|txt|css|js)$/i',$target))$target.='.html'; $tmp=tempnam(sys_get_temp_dir(),'connlink_'); file_put_contents($tmp,$content); $remote=rtrim((string)($cfg['path']??'/'),'/').'/'.$target; $ok=@ftp_put($conn,$remote,$tmp,FTP_ASCII); @unlink($tmp); @ftp_close($conn); if(!$ok){http_response_code(500);respond(false,['error'=>'FTP upload failed to '.$remote]);} respond(true,['message'=>'Published to '.$remote]); } http_response_code(400);respond(false,['error'=>'Unknown FTP action']);
Save file
Quick jump
open a path
Open