보안(security) Sample

<?php
/**
 * Security helper
 *
 * Created on 2011. 11. 18.
 * @author 불의회상 <hoksi2k@hanmail.net>
 * @package helper
 * @subpackage controllers
 * @version 1.0
 */
class Xss_hlp extends CI_Controller {
	function __construct()
	{
		parent::__construct();
		
		$this->load->helper('security');
	}
	
	function index() {
		$data['xss_clean'] = xss_clean('<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><IMG SRC=javascript:alert("XSS")></span>');
		$data['sanitize_filename'] = sanitize_filename('file/in/some/approved/folder.txt');
		$data['do_hash_sha1'] = do_hash('abcdefg');
		$data['do_hash_md5'] = do_hash('abcdefg', 'md5');
		$data['strip_image_tags'] = strip_image_tags('abcdefg <img src="a.jpg" />');
		$data['encode_php_tags'] = encode_php_tags("<?php echo 'abde';?> adsfasdf <?='1234'?>");
		
		$this->load->view('xss_hlp_sample', $data);
	}
}
<?php $this->load->view('inc/header')?>

<table class="tablesorter" border="0" cellpadding="0" cellspacing="1">
<thead>
<tr>
  <th style="text-align:center" width="20%">구분</th>
  <th width="80%">결과</th>
</tr>
</thead>
<tr>
	<td>xss_clean()</td>
	<td><xmp><?php echo $xss_clean?></xmp></td>
</tr>
<tr>
	<td>sanitize_filename()</td>
	<td><?php echo $sanitize_filename?></td>
</tr>
<tr>
	<td>do_hash()</td>
	<td><?php echo $do_hash_sha1?></td>
</tr>
<tr>
	<td>do_hash($str, 'md5')</td>
	<td><?php echo $do_hash_md5?></td>
</tr>
<tr>
	<td>strip_image_tags()</td>
	<td><?php echo $strip_image_tags?></td>
</tr>
<tr>
	<td>encode_php_tags()</td>
	<td><?php echo $encode_php_tags?></td>
</tr>
</table>

<?php $this->load->view('inc/footer')?>

© Copyright by hoksi(Page rendered in 0.0652 seconds)