呵呵,研究discuz的,第一段是获取客户ip,第二段是将上传的文件,放到变量里面

解决方案 »

  1.   

    if(getenv('HTTP_CLIENT_IP')) {
    $onlineip = getenv('HTTP_CLIENT_IP');//'HTTP_CLIENT_IP'很奇怪,没见过
    } elseif(getenv('HTTP_X_FORWARDED_FOR')) {
    $onlineip = getenv('HTTP_X_FORWARDED_FOR');//透过网关(代理)取得客户端IP
    } elseif(getenv('REMOTE_ADDR')) {
    $onlineip = getenv('REMOTE_ADDR');//取得客户端IP,与上边那句有区别
    } else {
    $onlineip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
    }第二段的意思不很明了,比如像daddslashes()这些函数究竟是自定义的函数还是笔误?
    这儿无法判断……
    不过最后几句的意思是遍历数组,将上传的文件的临时文件名、文件名、大小等放到数组里
      

  2.   

    if(getenv('HTTP_CLIENT_IP')) {//如果得到客户端的ip 就把客户端的ip付给$onlineid
    $onlineip = getenv('HTTP_CLIENT_IP');
    } elseif(getenv('HTTP_X_FORWARDED_FOR')) {//如果透过网关(代理)取得客户端IP $onlineip = getenv('HTTP_X_FORWARDED_FOR');
    } elseif(getenv('REMOTE_ADDR')) {//如果取得游览当前页面的用户计算机的ip地址 $onlineip = getenv('REMOTE_ADDR');
    } else {//其它的话就是由HTTP服务器传递给当前脚本的变量所含的(也就是默认的ip)付给他
    $onlineip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
    }if(!$register_globals || !$magic_quotes_gpc) {//如果两者都有的话
    @extract(daddslashes($HTTP_POST_VARS), EXTR_SKIP);//daddslashes()应该写错了吧,是addslashes(),其详细意思见最后
    @extract(daddslashes($HTTP_GET_VARS), EXTR_SKIP);//对取得的变量的转义字符进行处理
    if(!$register_globals) {//遍历数组,将上传的文件的临时文件名、文件名、大小等放到数组里 foreach($HTTP_POST_FILES as $key => $val) {
    $$key = $val['tmp_name'];
    ${$key.'_name'} = $val['name'];
    ${$key.'_size'} = $val['size'];
    ${$key.'_type'} = $val['type'];
    }
    }
    }
    addslashes(),其详细意思
    string addslashes ( string str)
    Returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte). An example use of addslashes() is when you're entering data into a database. For example, to insert the name O'reilly into a database, you will need to escape it. Most databases do this with a \ which would mean O\'reilly. This would only be to get the data into the database, the extra \ will not be inserted. Having the PHP directive magic_quotes_sybase set to on will mean ' is instead escaped with another '. The PHP directive magic_quotes_gpc is on by default, and it essentially runs addslashes() on all GET, POST, and COOKIE data. Do not use addslashes() on strings that have already been escaped with magic_quotes_gpc as you'll then do double escaping. The function get_magic_quotes_gpc() may come in handy for checking this. 例子 1. An addslashes() example<?php
    $str = "Is your name O'reilly?";// Outputs: Is your name O\'reilly?
    echo addslashes($str);
    ?>