Commit a9e9bd2bb7bc243096274246687045bb2baa5697
1 parent
d9ea308e
Exists in
master
and in
7 other branches
Alterada a obtenção das variáveis via POST para permitir o uso de POST com o CPAINT
Showing
1 changed file
with
28 additions
and
2 deletions
Show diff stats
classesphp/pega_variaveis.php
| ... | ... | @@ -6,6 +6,15 @@ Processa os array $_GET e $_POST, transformando-as em variáveis conforme as chav |
| 6 | 6 | Deve ser incluído sempre nos programas em PHP, evitando que o parâmetro "REGISTER_GLOBALS" |
| 7 | 7 | do PHP precise ser definido como "On". |
| 8 | 8 | |
| 9 | +No caso do uso de POST do lado cliente com a biblioteca CPAINT, é feito o processamento | |
| 10 | +dos argumentos definidos na chamada call. Para fazer a chamada utilizando-se POST, deve-se seguir o exemplo abaixo: | |
| 11 | + | |
| 12 | + var cp = new cpaint(); | |
| 13 | + cp.set_response_type("JSON"); | |
| 14 | + cp.set_transfer_mode("POST"); | |
| 15 | + var p = g_locaplic+"/classesphp/mapa_controle.php?g_sid="+g_sid; | |
| 16 | + cp.call(p,"criaSHPvazio",ativanovotema,"&funcao=criashpvazio"); | |
| 17 | + | |
| 9 | 18 | About: Licença |
| 10 | 19 | |
| 11 | 20 | I3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet |
| ... | ... | @@ -26,7 +35,7 @@ GNU junto com este programa; se não, escreva para a |
| 26 | 35 | Free Software Foundation, Inc., no endereço |
| 27 | 36 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. |
| 28 | 37 | |
| 29 | -About: Exemplo | |
| 38 | +About: Exemplo | |
| 30 | 39 | |
| 31 | 40 | include("pega_variaveis.php"); |
| 32 | 41 | |
| ... | ... | @@ -46,8 +55,25 @@ if (isset($_POST)) |
| 46 | 55 | { |
| 47 | 56 | foreach(array_keys($_POST) as $k) |
| 48 | 57 | { |
| 49 | - if ($_POST[$k] != "''") | |
| 58 | + if (($_POST[$k] != "''")) | |
| 50 | 59 | eval("\$".$k."='".$_POST[$k]."';"); |
| 60 | + if (($_POST[$k] != "''") && ($k == "cpaint_argument")) | |
| 61 | + { | |
| 62 | + foreach($_POST["cpaint_argument"] as $argumento_) | |
| 63 | + { | |
| 64 | + $argumento_ = str_replace("\\\"","",$argumento_); | |
| 65 | + $parametros_ = explode("&",$argumento_); | |
| 66 | + foreach($parametros_ as $parametro_) | |
| 67 | + { | |
| 68 | + $p_ = explode("=",$parametro_); | |
| 69 | + if($p_[0] != "") | |
| 70 | + eval("\$".$p_[0]."='".$p_[1]."';"); | |
| 71 | + } | |
| 72 | + } | |
| 73 | + | |
| 74 | + } | |
| 75 | + | |
| 51 | 76 | } |
| 77 | + | |
| 52 | 78 | } |
| 53 | 79 | ?> |
| 54 | 80 | \ No newline at end of file | ... | ... |