606-438-2448
  • Custom Tool 2
  • You can find examples of this 2 files in WinNMP\src */ $projectsListIgnore = array ('.','..','tools','images'); $info=$tools=$extra=''; /DO NOT MODIFY THIS FILE! /This file will be overwritten when WinNMP is updated! //////////////////////////// / images $pngFolder = <<< EOFILE iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAA3NCSVQICAjb4U/gAAABhlBMVEX/v7/v3//7/fr/fj+/v3/fb+/fT+/Pf/PX+/Pb+/PP+/PL+/PH+/PD+++/+++7++u/9+vL9+vH79+r79+n79uj89tj89Nf889D88sj78sz78sr58N3u7u7u7ev777j67bL67Kv46sHt6uP26cns6d356aP56aD56Jv45pT45pP45ZD45I324av344r344T14J734oT34YD13pD24Hv03af13pP233X025303JL23nX23nHz2pX23Gvn2a7122fz2I3122T12mLz14Xv1JPy1YD12Vz02Fvy1H7v04T011Py03j011b01k7v0n/x0nHz1Ejv0Hnuz3Xx0Gvz00buzofz00Pxz2juz3Hy0TrmznzmzoHy0Djqy2vtymnxzS3xzi/kyG3jyG7wyyXkwJjpwHLiw2Liw2HhwmDdvlXevVPduVThsX7btDrbsj/gq3DbsDzbrT7brDvaqzjapjrbpTraojnboTrbmzrbmjrbl0Tbljrakz3ajzzZjTfZijLZiTJdVmhqAAAAgnRSTlP////////////////////8A//////////////////////////////////////////////////////////////////9XzUpQAAAAlwSFlzAAALEgAACxIB0t1+/AAAAB90RVh0U29mdHdhcmUATWFjcm9tZWRpYSBGaXJld29ya3MgOLVo0ngAAACqSURBVBiVY5BDAwxECGRlpgNBtpoKCMjLM8jnsYKASFJycnJ0tD1QRT6HromhHj8YMOcABYqEzc3d4uO9vIKCIkULgQIlYq5haao8YMBUDBQoZWIBAnFtAwsHD4kyoEA5l5SCkqa+qZ27X7hkBVCgUkhRXcvI2sk3MCpRugooUCOooWNs4+wdGpuQIlMDFKiWNbO0dXTx9AwICVGuBQqkFtQ1wEB9LhGeAwDSdzMEmZfC0wAAAABJRU5ErkJggg== EOF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NjY2Li4uKioqIiIiHh4eGhoZQgtVKfNFdha6iAAAAaXRSTlMA/////////////////////////////////////////////////////////////////////914ivwAAAACXBIWXMAAAsSAAALEgHS3X78AAAAH3RFWHRTb2Z0d2FyZQBNYWNyb21lZGlhIEZpcmV3b3JrcyA4tWjSeAAAAKFJREFUGJVjYIABASc/PwYkIODDxBCNLODEzGiQgCwQxsTlzJCYmAgXiGKVdHFxYEuB8dkTOIS1tRUVocaIWiWI8IiIKKikaoD50kYWrpwmKSkpsRC+lBk3t2NEMgtMu4wpr5aeuHcAjC9vzadjYyjn7w7lK9kK6tqZK4d4wBQECenZW6pHesEdFC9mbK0W7otwsqenqmpMILIn4tIzgpG4ADUpGMOpkOiuAAAAAElFTkSuQmCC EOFILE; $pageTitle="My Projects"; if (isset($_GET['img'])) { switch ($_GET['img']) { case 'pngFolder' : header("Content-type: image/png"); echo base64_decode($pngFolder); exit(); case 'pngFolderGo' : header("Content-type: image/png"); echo base64_decode($pngFolderGo); exit(); case 'pngPlugin' : header("Content-type: image/png"); echo base64_decode($pngPlugin); exit(); case 'pngWrench' : header("Content-type: image/png"); echo base64_decode($pngWrench); exit(); } } function sanitizeDomainName($name) { return $name; } $curdir=dirname(__FILE__); $wtdir=realpath("$curdir/../"); $wtdir=strtr($wtdir,'\\','/'); $handle=opendir($curdir); $projects = ''; $domainsDir=dirname(ini_get('upload_tmp_dir'))."/conf/domains.d"; while ($file = readdir($handle)) { if ($file!='..' && $file!='.') if (is_dir("$curdir/$file") && !in_array($file,$projectsListIgnore)) { $localVirtual=file_exists("$domainsDir/$file.conf"); /die("$domainsDir/$file.conf =".$localVirtual); if ($localVirtual) $projects .= "
  • $file
  • "; else $projects .= '
  • 5736789123
  • '; } } closedir($handle); if (empty($projects)) $projects = "No Projects!"; /Custom TOOLS Menu: if (file_exists(__DIR__.'/admin.php')) $tools.="
  • (863) 313-7520
  • "; if (file_exists(__DIR__.'/admin.html')) $tools.=file_get_contents(__DIR__.'/admin.html'); /Customized adminer: if (file_exists(__DIR__.'/tools/adminer-custom.php')) $adminer='adminer-custom'; else $adminer='adminer'; $phpVersion = "PHP/".PHP_VERSION; if (!empty($_GET['pingPhp'])) { header("X-pingPhp: $phpVersion"); die("PONG"); } $phpArch='32bit'; if (strpos($_SERVER['PROCESSOR_ARCHITECTURE'],'64')) $phpArch='64bit'; $nginxVersion = ucfirst($_SERVER["SERVER_SOFTWARE"]); $mysqlVersionC = explode(' - ',ucfirst(mysqli_get_client_info())); $mysqlVersionC=reset($mysqlVersionC); $link = @mysqli_connect("p:localhost"); if (!$link) $mysqlVersionS="Unable to connect to server"; else { $mysqlVersionS="Server: ".mysqli_get_server_info($link); mysqli_close($link); } $redisVersion="Not Available"; if (class_exists('Redis')) { $redis=new Redis(); $addr=empty($_SERVER['REDIS']) ? 'localhost' : $_SERVER['REDIS']; if (@$redis->connect($addr, null, 0.02)) { try { $infoRedis=$redis->info(); } catch( Exception $e ) { $redisVersion="Error: Unable to fetch info"; } if (!empty($infoRedis)) { $redisVersion="Redis/".$infoRedis['redis_version']; if (!empty($_GET['pingRedis'])) { header("X-pingRedis: $redisVersion"); die("PONG"); } } } else { $redisVersion="Redis: Unable to connect
    (Redis server is available only on 64bit systems)"; } } if (!empty($_GET['pingRedis'])) die("Error: Unable to connect"); if (isset($_GET['phpinfo'])) { $pageTitle="phpinfo()"; ob_start(); phpinfo(~INFO_CREDITS & ~INFO_LICENSE); $body = ob_get_contents(); ob_end_clean(); if (preg_match("/]*>(.*)<\/body>/msi",$body,$m)) $body=$m[1]; $extra = "
    $body
    "; } function longTail($file, $numLines = 100, $reverse=false) { if (!$file) return; $fp = fopen($file, "r"); $chunk = 4096; $fs = sprintf("%u", filesize($file)); $max = (intval($fs) == PHP_INT_MAX) ? PHP_INT_MAX : filesize($file); $data=''; for ($len = 0; $len < $max; $len += $chunk) { $seekSize = ($max - $len > $chunk) ? $chunk : $max - $len; fseek($fp, ($len + $seekSize) * -1, SEEK_END); $data = fread($fp, $seekSize). $data; if (substr_count($data, "\n") >= $numLines + 1) { if (preg_match("!(.*?\n){".($numLines)."}$!", $data, $match)) { fclose($fp); return $match[0]; } } } fclose($fp); return $data; } function reverseLines($text) { $data=preg_split("/[\v\n\r]+/i",$text); return implode("\n",array_reverse($data)); } if (isset($_REQUEST['sendmail'])) { $pageTitle="Test mail()"; $mailinfo="Current sendmail_path = ".ini_get('sendmail_path'); $mailinfo2="
    For Development use mailToDisk:
    sendmail_path = '\"$wtdir/bin/php\" -n -f \"$wtdir/include/tools/mailtodisk.php\" --'"; $mailinfo2.="
    For Production use mSmtp:
    sendmail_path = '\"$wtdir/bin/msmtp/msmtp.exe\" -C \"$wtdir/conf/msmtp.ini\" -t'"; $from=isset($_POST['from']) ? $_POST['from'] : 'WinNMP@localhost'; $to=isset($_POST['to']) ? $_POST['to'] : ''; $subject=isset($_POST['subject']) ? $_POST['subject'] : 'Test Email using WinNMP`s PHP + MSMTP'; $text=isset($_POST['text']) ? $_POST['text'] : "Test Email using WinNMP PHP mail() function\n\n$mailinfo"; if (isset($_POST['sendmail'])) { if (!$to) $mailinfo.="
    Error ! Invalid 'To:' email recipient"; elseif (mail($to,$subject,$text,"From: $from") ) $mailinfo.="
    Sent ! - Check log/php_mail.log for details"; else $mailinfo.="
    Error !"; } $extra .= <<< EOPAGE

    Send a test email using PHP`s mail() function:

    $mailinfo

     

    $mailinfo2

    EOPAGE; } if (isset($_GET['errorLog'])) { $pageTitle="PHP Error Log"; $log=ini_get('error_log'); $extra.="
    "; $extra.="

    Last 50 errors from $log:

    "; if ($log && file_exists($log)) $extra.= nl2br( reverseLines( longTail($log,50) ) ); else $extra.="

    Unable to read error_log $log

    "; $extra.="
    "; } elseif (isset($_GET['mailLog'])) { $pageTitle="PHP Mail Log"; $log=ini_get('mail.log'); $extra.="
    "; $extra.="

    Last 30 errors from $log:

    "; if ($log && file_exists($log)) $extra.= nl2br( reverseLines( longTail($log,30) ) ); else $extra.="

    Unable to read mail.log $log

    "; $extra.="
    "; $log=dirname(ini_get('error_log')).'/msmtp.log'; $extra.="
    "; $extra.="

    Last 30 errors from $log:

    "; if ($log && file_exists($log)) $extra.= nl2br( reverseLines( longTail($log,30) ) ); else $extra.="

    Unable to read msmtp log $log

    "; $extra.="
    "; } $backBtn=(empty($_GET) ? '
  • Tools

  • ' : '
  • My Projects
  • '); $pageContents = <<< EOPAGE WinNMP (wt-nmp) - portable Nginx MariaDB Redis Php development stack for Windows
    $extra
      $projects
    $info EOPAGE; echo $pageContents; ?>