PHP

PHP Short Tag Conversion Program

This program changes short tags (<?) in PHP files to long tags (<?php).If the file has been modified, the original file will have a .bak extension added.<?=$hello?> will be changed to <?php echo $hello; ?>.Using the option (-s), <?= will not be changed.Currently, only UTF-8 format is supported. How to Use ConvertShortOpenTag.exe [options] {filename or...

Finding Current Location (PHP)

We can determine the location using the geolocation function. If there are relevant permissions issues or if the browser is not supported, we can use the API provided by Naver to obtain the location via IP address. Before using it, please get your Naver API key at the following address.(https://www.ncloud.com/product/applicationService/geoLocation) <? function makeSignature($secretKey, $method, $baseString,...

Getting Public IP Address from AWS (PHP)

When using Amazon servers, the server IP displayed is typically a private IP. So, I created this script to fetch the public IP address. <? if(in_array(substr($_SERVER['SERVER_ADDR'], 0, 3), array('172'))) if(strrpos(gethostname(), '.compute.internal')!==false) $_SERVER['SERVER_ADDR'] = file_get_contents('http://169.254.169.254/latest/meta-data/public-ipv4'); echo $_SERVER['SERVER_ADDR']; ?>

Morphological Analysis Installation and Usage (PHP)

Installation Environment: CentOS 7 default, PHP 7 yum install gcc-c++ java-1.7.0-openjdk-devel python-devel zlib-devel openssl openssl-devel git -y wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz tar xf Python-3.* cd Python-3.* ./configure make make altinstall pip3.6 install JPype1-py3 pip3.6 install konlpy cd .. wget https://bitbucket.org/eunjeon/mecab-ko/downloads/mecab-0.996-ko-0.9.2.tar.gz tar zxfv mecab-0.996-ko-0.9.2.tar.gz cd mecab-0.996-ko-0.9.2 ./configure make make install cd .. wget https://bitbucket.org/eunjeon/mecab-ko-dic/downloads/mecab-ko-dic-2.0.1-20150920.tar.gz tar zxfv mecab-ko-dic-2.0.1-20150920.tar.gz cd...

PHP Hacking: Risk Code Check Program

This program was created to easily monitor whether malicious PHP has been installed through server hacking and to check for potentially risky code. Upload the following code to your server account. &lt;? /** * Name: Kilho's PHP Diagnosis * Author: Kilho Oh (prince@kilho.net) * Author URI: http://kilho.net/ */ class TDiagnosis { public $dir;public function __construct()...

HTTP Connection Information Logging

This is to check if the connection information is correct for testing when using OpenAPI. Method values, host, POST values upon connection. [PHP] <? $log = $_SERVER['REQUEST_METHOD'].' '.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].' n'; foreach($_SERVER as $k => $v) { if($k=='HTTP_HOST') continue; if(substr($k, 0,5)!='HTTP_') continue; $log .= '$k: $v'." "; } $log .= " "; $post = array_map('urldecode', explode('&', file_get_contents('php://input')));...