### CyBoard ###
 
 
3.21.244.137
 
¡Ä¡Ä Á¤±¤Ãµ ¡Ä¡Ä
°Ô½ÃÆÇ
 
  01. ±â¼ú¹®¼­  
±Û¾´ÀÌ Á¤±¤Ãµ Á¶È¸¼ö 15478
À̸ÞÀÏ ÀÛ¼ºÀÏ 2013-07-25 10:38:35
Á¦¸ñ [PHP/MySQL] ¹®ÀÚ¿­
# PHP
##########################################################################
 
# ¹®ÀÚ¿­ °¹¼ö üũ
# ¶óÀμö üũ
      $lineCount = substr_count($_desc[content], chr(13).chr(10)) + 1;

 
# fmod
      $i_cnt++;
      if (fmod($i_cnt,2) == 1 or $i_cnt == 1) echo "[tr>";
      echo "[td align=left>[img src=/images/main_icon01.gif>$ls_bub_cd_name_tmp[/td>";
      if (fmod($i_cnt,2) == 0) echo "[/tr>";
 
# insert ÇÔ¼ö
$data = null;
$data[re_no_seq] = $val;
$sql = f_insert_sql("tb_part", $data);
# update ÇÔ¼ö
$data_where = $data = null;
$data_where[seq]         = $_d[i_hp_seq];
$data[name]              = $_d[i_name];
$sql = f_update_sql("tb_hospital", $data_where, $data);
# delete ÇÔ¼ö
$data_where = null;
$data_where[seq]         = $_d[i_hp_seq];
$sql = f_delete_sql("tb_hospital", $data_where);
# $date = date("Y-m-d H:i:s")

# ´ë¼Ò¹®ÀÚ º¯È¯
strtolower
strtoupper
# ¹®ÀÚ¿­ ġȯ
$ls_callback = str_replace("-", "", $i_send_telnum);
      $body        = str_replace("<", "<", $body);
      $body        = str_replace(">", ">", $body);
      $body        = str_replace('"', """, $body);
# ¹®ÀÚ¿­ ġȯ
$trans = array("\"=>"\\", "'"=>"'");
$i_send_message = strtr($i_send_message, $trans);
# ³¡¿¡ ¸î ±ÛÀÚ¸¸ ÀÚ¸£±â
$sql = substr($sql,0,-1);
$sql = substr($sql,0,-3);
# ¹é½½·¡½¬¸¦ Á¦°ÅÇÑ ¹®ÀÚ¿­À» ¹ÝȯÇÕ´Ï´Ù.
$i_send_message = stripslashes($i_send_message);
# Ãß°¡
addslashes()
# ÁöÁ¤ ¹®ÀÚ¸¦ ±âÁØÀ¸·Î ¹®ÀÚ¿­ ºÐÇÒ
$i_receive_telnum_arr = explode("*", $i_receive_telnum);
# HTML ÅÂ±× Á¦°Å
$ls_content = ereg_replace("<[^>]*>","",$iv_row[content]);
$ls_content = strip_tags($ls_content);
# ¹®ÀÚ¿­ °Ë»ö
$pos = strrpos($ls_sang, "¼÷¹Ú½Ã¼³");
if ($pos === false) // ÁÖÀÇ: µîÈ£ 3°³
{
// ¹ß°ßµÇÁö ¾Ê¾Ò½À´Ï´Ù...
}
 
#
# ÆÐÅÏ Ä¡È¯
#
           $pattern = array("/WORD-WRAP: break-word/", "/class=(.*)>/");
           $replace = array("", ">");
          
           $content = preg_replace($pattern, $replace, $content);
 
#
# ÆÐÅÏ °Ë»ö
# http://tolinux.net/cyboard/board.html?id=tolinux&code=com&o_mode=&o_seq=&i_gubun=Áúº´&i_gubun_desc=°£Áúȯ
preg_match_all('|i_gubun=(.*)&i_gubun_desc=(.*)|',$_SERVER["HTTP_REFERER"], $i_gubun);
Array
(
    [0] => Array
        (
            [0] => i_gubun=Áúº´&i_gubun_desc=°£Áúȯ
        )
    [1] => Array
        (
            [0] => Áúº´
        )
    [2] => Array
        (
            [0] => °£Áúȯ
        )
)
preg_match_all('|i_gubun=(.*)&i_gubun_desc=(.*)|Usi',$_SERVER["HTTP_REFERER"], $i_gubun);
Array
(
    [0] => Array
        (
            [0] => i_gubun=Áúº´&i_gubun_desc=
        )
    [1] => Array
        (
            [0] => Áúº´
        )
    [2] => Array
        (
            [0] =>
        )
)
      // from
      if ($sql[pos][where])     $tmp_end = " where";
      elseif ($sql[pos][group]) $tmp_end = " group by";
      elseif ($sql[pos][order]) $tmp_end = " order by";
      else                      $tmp_end = "$";
      preg_match_all("|from (.*)$tmp_end|Usi", $union_sql, $sql[from]);

# ¹®ÀÚ¿­ ȤÀº ¹®ÀÚÀÇ °¹¼ö
if (substr_count($iv_row[re_no], "0") == 2)
 
# ¹è¿­ Áߺ¹ Á¦°Å
$la_doctor_host_id_tmp = array_unique($la_doctor_host_id);
 
# ¹è¿­ ¸Ç ¾Õ Ãß°¡/»èÁ¦
Ãß°¡:array_unshift($la_doctor_host_id, $host_id);
»èÁ¦:array_shift($la_doctor_host_id, $host_id);
 
# ¹è¿­ ¸Ç µÚ Ãß°¡/»èÁ¦
array_push($la_doctor_host_id, $host_id);
array_pop($la_doctor_host_id, $host_id);
# ¹è¿­ ¼ÒÆ®
arsort ($ls_sum_tmp);
reset ($ls_sum_tmp);
while (list ($key, $val) = each ($ls_sum_tmp)) {
echo "n$key = $val";
}
# ¹è¿­ °Ë»ö ÈÄ Å° ¹Ýȯ
if (array_search($key1, $ls_code_arr) === false)
{
$ls_checked = "";
}
else
{
$ls_checked = "checked";
}
# °æ·ÎÁß¿¡¼­ ÆÄÀÏÀ̸§¸¸ ÃßÃâÇس½´Ù.
$path = "/home/httpd/html/index.php";
$file = basename ($path); // $file Àº "index.php" ·Î ¼³Á¤µÈ´Ù
$file = basename ($path,".php"); // $file Àº "index" ·Î ¼³Á¤µÈ´Ù
# °æ·ÎÁß¿¡¼­ µð·ºÅ丮¸¸ ÃßÃâÇس½´Ù.
$path = "/home/httpd/html/index.php";
$dir = dirname($path); // $file ˼ /home/httpd/html
# URL parse
$list_url_1 = parse_url($list_url[1][0]);
print_r($list_url_1);
Array
(
[scheme] => http
[host] => 210.98.146.20
[path] => /main.asp
[query] => bub_cd=000213&sa_no=20050130025021&ord_hoi=1&mae_giil=2006.06.05
)
# ÃÖ±Ù INSERT ÀÛ¾÷À¸·ÎºÎÅÍ »ý¼ºµÈ identifier °ªÀ» ¹Ýȯ auto_increment
mysql_insert_id();

#
# MySQL
##########################################################################
 
# º¯¼ö»ç¿ë
      @mysql_query("set @rowCnt = 0;");
      $sql_ridePlace = "
         select *,
                (@rowCnt := @rowCnt + 10) rowCnt
           from rsv_ride
          where busMgrCode = '$busMgrCode'
       order by rideTime
      ";
 
# Ư¼ö¹®ÀÚ
select seq, man_userid, man_phone, man_email,
hex(man_email)
from tb_cyhuman_relation
where man_email like concat('%', char(13), '%');
 
À̸§ CR
ascii 13
hex 0D
 
À̸§ LF
ascii 10
hex 0A
 
¹®ÀÚ¸¦ ¾Æ½ºÅ°ÄÚµå·Î, ¾Æ½ºÅ°Äڵ带 ¹®ÀÚ·Î
ascii('0') -> 48, char(48) -> 0, char('48') -> 0, char(0x30) -> 0, char('0x30') ´Ù¸¥ °á°ú
ascii('1') -> 49
ascii('A') -> 65
ascii('a') -> 97
 
¹®ÀÚ¸¦ 16Áø¼ö(hex)·Î º¯È¯, 16Áø¼ö¸¦ ¹®ÀÚ·Î
hex('A') -> 41, unhex(41) -> A, char(0x41) -> A
 
¹®ÀÚ¸¦ 16Áø¼ö(hex)·Î º¯È¯, 16Áø¼ö¸¦ ¹®ÀÚ·Î
hex('0') -> 30
hex('1') -> 31
hex('01') -> 3031, unhex(3031) -> 01, char(0x300x31) ¾ÈµÊ ¹®ÀÚ Çϳª¸¸ °¡´É
 
¿£ÅÍÅ°
concat(char(13), char(10))
concat(char(0x0D), char(0x0A))
concat(unhex('0D'), unhex('0A'))
 
# Áֹεî·Ï¹øÈ£¸¦ »ý³â¿ùÀÏ·Î
concat(
 if(left(jumin, 1) = '0', '20', '19'),
 substring(jumin, 1, 2),
 '-',
 substring(jumin, 3, 2),
 '-',
 substring(jumin, 5, 2)
)
 
# ¹®ÀÚ¿­ ÇÕÄ¡±â
concat('19', substring(resident1, 1, 2))
 
# ¹®ÀÚ¿­ ³ª´©±â(ù¹ø°ºÎÅÍ ÇѱÛÀÚ)
Substring(resident2, 1, 1)
 
# ¹®ÀÚ¿­ ġȯÇϱâ
# 5¹ø°ºÎÅÍ µÎ±ÛÀÚ(Çѱ۵µ ÇѱÛÀÚ·Î Ãë±Þ)
select insert(pic_url_1, 5, 2, "") from mj_hh_main limit 1;
 
# ¹®ÀÚ¿­ ġȯÇϱâ
replace(a.mok_addr, ' ', '')
  select distinct name, replace(replace(replace(handphone, "`", ""), " ", ""), "-", "") phone
    from tb_cymember
   where length(replace(replace(replace(handphone, "`", ""), " ", ""), "-", "")) > 9
     and length(replace(replace(replace(handphone, "`", ""), " ", ""), "-", "")) < 12
order by name;
 
# ¹®ÀÚ¿­ ±æÀÌ
length(handphone)
 
# ƯÁ¤ ¹®ÀÚ°¡ Á¸ÀçÇϸé ġȯÇϱâ
select if(instr(pic_url_1, "Ÿ°æ") = 5, insert(pic_url_1, 5, 2, ""), pic_url_1), pic_url_1 from mj_hh_main limit 1;
insert into mj_file
(bub_cd, serial, mul_num, file_type, file_url)
select bub_cd,
serial,
1 mul_num,
pic_gub_10 file_type,
if(
instr(pic_url_10, "Ÿ°æ") = 5,
concat("/data/pic/",
substring(serial, 1, 4),
"/",bub_cd,"/",gae_code,"/",
insert(pic_url_10, 5, 2, "")
),
pic_url_10
) file_url
from mj_hh_main
where pic_url_10 != ''
and pic_url_10 is not null
 
# Äڵ忡 µû¶ó ºÐ±â
SELECT ELT(1, 'ej', 'Heja', 'hej', 'foo');
-> 'ej'
 
# substring_index
# p_code¿¡¼­ _ ¸¦ ±âÁØÀ¸·Î µÚ¿¡¼­ ù¹ø° °ªÀ» °¡Á®¿Í¼­ ÃÖ´ë°ª¿¡ 1À» ´õÇÔ
SELECT max(substring_index(p_code, '_', -1)) + 1 code FROM tb_product
p_code = buzzy_00001
code = 2
 
#
# ƯÁ¤ ¹®ÀÚ »çÀÌ
select
          substring(replace(httpReferer, 'http://', ''), 1, instr(replace(httpReferer, 'http://', ''), '/')-1),
          host
   from cyboardCMSLog
order by visitCode desc limit 10; 
#
# Æ¯Á¤ ¹®ÀÚ »çÀÌ
select visitCode,
         replace(substring_index(httpReferer, '/', 3), 'http://', ''), host from cyboardCMSLog order by visitCode desc limit 10; 
update cyboardCMSLog set host = replace(substring_index(httpReferer, '/', 3), 'http://', '');
 
#
# Visual Basic
##########################################################################
 
#
nPos = InStr(1, WebBrowser1.Document.Body.InnerHTML, "")
If (nPos > 0) Then
   source.Text = Mid(WebBrowser1.Document.Body.InnerHTML, nPos)
End If

IP Address : 210.118.178.154