Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Elizandro Tavares

[Resolvido] PHP+SQL Injeção

Recommended Posts

Depois que finalizei tudo que tinha para fazer fui testar o site usando um scanner de vulnerabilidade de sql e para estragar tudo o programa pegou tudo do banco de dados, todas as tabelas e informações nelas contidas...

 

Preciso de ajuda para tornar este código abaixo que é o responsável pelas buscas e resultados protegido contra SQL Injection.

 

Agradeço pela atenção e colaboração.

 

<?php if(!defined('EFFICIENT_ROOT')) exit;

function SEARCH_ITEMS($get, $dbstruct) {

 $idbs = $dbstruct['item_src'];

 // Import active GET data

 $getVariables = array(
 'cid',
 'ccsrc',
 'cname',
 'cweight',
 'oweight',
 'ctype',
 'cprice',
 'oprice',
 'cdesc',
 'cdisplayorder',
 'id',
 'name',
 'desc',
 'weight',
 'type',
 'price',
 'displayorder'
 );

 foreach($get as $getKey => $getData) {
   if(in_array($getKey, $getVariables)) {
   ${$getKey} = $getData;
   }
 }

 // Check if ID, WEIGHT, ITEM TYPE, DISPLAYORDER and PRICE are numeric values

  if(isset($id) && isset($cid)) {
   if(!intval($id)){
   unset($cid);
   }
  }

  if(isset($weight) && isset($cweight)) {
   if(!intval($weight)){
   unset($cweight);
   }
  }

  if(isset($type) && isset($ctype)) {
   if(!intval($type)){
   unset($ctype);
   }
  }

  if(isset($price) && isset($cprice)) {
   if(!intval($price)){
   unset($cprice);
   }
  }

  if(isset($displayorder)) {
   if(!intval($displayorder)){
   unset($cdisplayorder);
   }
  }

 // Build QUERY

 $continue=0;

 $ITEM_SEARCH = "SELECT * FROM " . $dbstruct['tables']['item_src'];

 /*

 // View custom items
 if(isset($ccsrc)) {
 $customItems = explode(" ", CUSTOM_ITEM);
   $g=0;
   foreach($customItems as $customItem) {
     if($g == FALSE) {
     $ITEM_SEARCH .= " WHERE";
     }
     else {
     $ITEM_SEARCH .= " OR";
     }
   $ITEM_SEARCH .= " " . COL_IID . "='$customItem'";
   $g++;
   }
 }

 */

// Note: if item ID is set the DB will not check any other values
 // in-game id

 if(isset($cid))
   $ITEM_SEARCH .= " WHERE " . $idbs['id'] . "='$id'"; 

 // in case no item id is set search the other values
 else {

   // name (displayed)
   if(!empty($cname))   { $ITEM_SEARCH .= " WHERE " . $idbs['name1'] . " LIKE '%" . addslashes($name) . "%'"; $continue = 1; 
   }


   // function for adding weight and price search to query
   function query_add($query,$value,$checkbox,$limiter,$isearch_value,&$continue) {

     if(!empty($checkbox)) {
       switch($limiter) {
           case 1:   $bind  = ">"; break;
           case 2:   $bind  = "<"; break;
           default:  $bind  = "="; 
           }

     $query .= " " . bindQuery($continue) . " " . $isearch_value . $bind . $value;
     $continue = 1;
     }

     return $query;

   }

   if(isset($cweight)) 
   $ITEM_SEARCH = query_add($ITEM_SEARCH,$weight*10,$cweight,$oweight,$idbs['weight'],$continue);    

   if(isset($cprice))  
   $ITEM_SEARCH  = query_add($ITEM_SEARCH,$price,$cprice,$oprice,$idbs['value_b'],$continue);

   // item type
   if(isset($ctype))   {
       if($type == 13) {
       $ITEM_SEARCH  .= " ". bindQuery($continue) ." " . $idbs['type'] . "='2' OR " . $idbs['type'] . "='11'";
       }
       else {
       $ITEM_SEARCH  .= " ". bindQuery($continue) ." " . $idbs['type'] . "=$type";
       }
   $continue = 1; 
   }

   // Description search

   if(isset($cdesc)) {
     $desc = split(',',preg_replace("/ /","",$desc));

     foreach($desc as $ea_desc) {

     $LINKER = ($continue == 1) ? "AND" : "WHERE";

       if(strlen($ea_desc) < 3) { 
       continue; 
       }

       else { 

         if(substr($ea_desc, 0, 1) == " ") {
         $ea_desc = substr($ea_desc, 1);
         }

       $ITEM_SEARCH  .= " $LINKER " . $idbs['desc'] . " LIKE '%" . addslashes($ea_desc) . "%'";
       $continue = 1;

       }

     }

   }

 }

 // Display order

 if(isset($cdisplayorder) && isset($displayorder)) {
   switch($displayorder) {
     case 100: $ORDERTYPE = $idbs['name1'];           break;
     case 200: $ORDERTYPE = $idbs['name1'] . " DESC"; break;
     default:  $ORDERTYPE = $idbs['id'];
   }
   $ITEM_SEARCH  .= " ORDER BY " . $ORDERTYPE;
 }

 // Debug: display query

   if(DEBUG == TRUE)
     debugHandler("Current query is <code>" . $ITEM_SEARCH . "</code>");

 // Query the database

   return $ITEM_SEARCH;

}

?>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Se não estiver trabalhando com PDO, você pode tentar o seguinte

 

//PREVINIR SQL INJECTIOn
function safeSQL($string)  
   {         
       if(get_magic_quotes_gpc()) 
       { 
           $string = stripslashes($string);  
       } 
       elseif(!get_magic_quotes_gpc())  
       { 
           $string = addslashes($string);  
       } 

       $string = mysql_real_escape_string($string);  
       return $string; 
   } 

 

Ai no caso chama os "$_GET" e "$_POST" dentro da função.

 

safeSQL($_GET['string']);

 

Que vai adicionar as coisas para evitar o SQL Injection =D

Compartilhar este post


Link para o post
Compartilhar em outros sites

Vou tentar, obrigado pela atenção....

 

Se não estiver trabalhando com PDO, você pode tentar o seguinte

 

//PREVINIR SQL INJECTIOn
function safeSQL($string)  
   {         
       if(get_magic_quotes_gpc()) 
       { 
           $string = stripslashes($string);  
       } 
       elseif(!get_magic_quotes_gpc())  
       { 
           $string = addslashes($string);  
       } 

       $string = mysql_real_escape_string($string);  
       return $string; 
   } 

 

Ai no caso chama os "$_GET" e "$_POST" dentro da função.

 

safeSQL($_GET['string']);

 

Que vai adicionar as coisas para evitar o SQL Injection =D

 

Poderias me dar uma ajuda de como usar neste código?

 

<?php if(!defined('EFFICIENT_ROOT')) exit;

 class ItemController extends Controller {

 public $result, $droprate, $fileViewID, $itemDisplayType;

 public function __construct($droprates, $db_struct, $res_paths, $file_ext) {
   $this->droprate = $droprates;
   $this->dbstruct = $db_struct;
   $this->respaths = $res_paths;
   $this->mediaext = $file_ext;
 }

 public function prepareView() {

     // Set master type

     $this->resultDisplayType = $this->getAttr('type');

     // Exception for cards (use ID 4000 for item view)

     $viewID = $this->getAttr('id');
     $this->fileViewID = ($viewID > 4000 && $viewID < 4700) ? 4001 : $viewID;

     // Set image resource paths

     $this->fItem       = $this->respaths['item'] . "/{$this->fileViewID}." . $this->mediaext['item'];
     $this->fCard       = $this->respaths['card'] . '/' . $this->getAttr('id') . '.' . $this->mediaext['card'];
     $this->fCollection = $this->respaths['collection'] . "/" . $this->fileViewID . "." . $this->mediaext['collection'];

     // Name

     $this->setAttr('name1', str_replace("%_%"," ",$this->getAttr('name1'))); // we wouldn't want our name to contain underscores :(

     // Zeny

     $value_b = $this->getAttr('value_b');
     $value_s = $this->getAttr('value_s');

       if(!ctype_digit($value_B) && ctype_digit($value_s)) {
         $value_n = ($value_s*2);
       } elseif(ctype_digit($value_B)) {
         $value_n = $value_b;
       } elseif(!ctype_digit($value_B) && !ctype_digit($value_s)) {
         $value_n = 20;
       }

     $this->setAttr('value_b', (($value_n) . "z / " . ($value_n/2) . "z"));



     // Quick fix for random underlines in descriptions
     $this->setAttr('desc', str_replace("_"," ",$this->getAttr('desc')));

     // Monster which drops current item
     // Note: This uses base item type and need to be set before switching it

     $mobList = unserialize($this->getAttr('droppers'));

     $alice=(string)'';

     if(is_array($mobList)) {

       foreach($mobList as $g => $monster) {

         // The following keys in $monster are the values set in the array when importing the droppers
         // not the table column names... (yeah, it's ugly none the less)

         $m['name']    = $monster['iName'];
         $m['id']      = $monster['id'];
         $m['itype']   = $monster['type'];
         $m['dropper'] = number_format($monster['dropChance']/100, 2, '.', '');

           // Adjust drop% for alternate rates
           if($m['itype'] == 2) $m['dropper'] *= $this->droprate['item_rate_mvp'];
           else {
             switch($m['itype']) {
               case 0:   $m['dropper'] *= $this->droprate['item_rate_heal'];   break; // Healing item
               case 2:   $m['dropper'] *= $this->droprate['item_rate_use'];    break; // Usable item
               case 11:  $m['dropper'] *= $this->droprate['item_rate_use'];    break; // Delayed usable item
               case 3:   $m['dropper'] *= $this->droprate['item_rate_common']; break; // Misc
               case 4:   $m['dropper'] *= $this->droprate['item_rate_equip'];  break; // Weap
               case 5:   $m['dropper'] *= $this->droprate['item_rate_equip'];  break; // Equip
               case 6:   $m['dropper'] *= $this->droprate['item_rate_card'];   break; // Card
               case 7:   $m['dropper'] *= $this->droprate['item_rate_use'];    break; // Pet egg
               case 8:   $m['dropper'] *= $this->droprate['item_rate_use'];    break; // Pet equip
               case 10:  $m['dropper'] *= $this->droprate['item_rate_use'];    break; // Ammo
               default:  $m['dropper'] *= $this->droprate['item_rate_common'];        // Default
             }
           }

           if($m['dropper'] > 100) $m['dropper'] = 100;

         $mBind = ($m['itype'] == 2) ? " [<span class=\"alertMVP\">" . message('db_bossmob') . "!</span>]" : '';
         //$alice .= "<a href=\"http://" . CAILL_PATH . "/mobsrc/?cid=on&id=". $m['id'] ."\">". $m['name'] ."</a>$mBind (". $m['dropper'] ."%), "; 
         $alice .= "<a onclick=\"setDisplay('smokescreen');showprop('ajaxFrame','{$m['id']}', 'mobsearch');\">". $m['name'] ."</a>$mBind (". $m['dropper'] ."%), "; 
       }

     }

     $alice = (strlen($alice) == 0) ? message('db_item_nodrops') : substr_replace($alice,"",-2);

     $this->setAttr('droppers', $alice);

     // Item type

     $item_types = array(
       0 => message('db_item_0'),
       2 => message('db_item_2'),
       3 => message('db_item_3'),
       4 => message('db_item_4'),
       5 => message('db_item_5'),
       6 => message('db_item_6'),
       7 => message('db_item_7'),
       8 => message('db_item_8'),
       10 => message('db_item_10'),
       11 => message('db_item_11'),
       -1 => message('db_item_01'),
     );

     $type = $this->getAttr('type');
     $this->setAttr('type',  (isset($item_types[$type]) ? $item_types[$type] : $item_types[-1]));

     // Equip location

     $loc_types = array(
       1 =>   message('db_iloc_1'),
       2 =>   message('db_iloc_2'),
       4 =>   message('db_iloc_4'),
       8 =>   message('db_iloc_8'),
       16 =>  message('db_iloc_16'),
       32 =>  message('db_iloc_32'),
       34 =>  message('db_iloc_34'),
       64 =>  message('db_iloc_64'),
       128 => message('db_iloc_128'),
       136 => message('db_iloc_136'),
       256 => message('db_iloc_256'),
       512 => message('db_iloc_512'),
       768 => message('db_iloc_768'),
       769 => message('db_iloc_769'),
       -1  => message('db_iloc_01'),
     );

     $loc = $this->getAttr('e_loc');
     $this->setAttr('e_loc', (isset($loc_types[$loc]) ? $loc_types[$loc] : $loc_types[-1]));

   }

   public function output($res, $resLim, $resOffset) {

     $e = 0;
     $i = 0;
     $output = (string)"";

     while($result = mysql_fetch_array($res)) {

       $e++;

       if($i >= $resLim) {
       break;
       } 

       if($e <= $resOffset) {
       continue;
       }

       $this->result = $result;
       $this->prepareView();

         // This switch selects the layout file to use for current item

         switch($this->resultDisplayType) {

           // Weapons and equipment
           case 4: 
           case 5: include('layout/item/item_form_equip.php'); break;
           // Cards
           case 6: include('layout/item/item_form_card.php'); break;
           // Default
           default: include('layout/item/item_form_default.php');

         }

       $i++;

     }

     return $output;

   }

 }

?>

Compartilhar este post


Link para o post
Compartilhar em outros sites

strip_tags(addslashes(striplashes(mysql_real_escape_string($string)))); 

Vê esse kkkkk

 

Usa esse

mysql_real_escape_string($string); 

Compartilhar este post


Link para o post
Compartilhar em outros sites

Você chama a função na hora do recebimento dos dados:

 

// Por recebimento via post
$nome = safeSQL($_POST['nome']);
// Por recebimento via get
$nome = safeSQL($_GET['nome']);
// Por recebimento via string
$nome = safeSQL("Esta é a string");

Compartilhar este post


Link para o post
Compartilhar em outros sites

Você chama a função na hora do recebimento dos dados:

 

// Por recebimento via post
$nome = safeSQL($_POST['nome']);
// Por recebimento via get
$nome = safeSQL($_GET['nome']);
// Por recebimento via string
$nome = safeSQL("Esta é a string");

 

Vou tentar novamente... desculpem minha falta de conhecimento...

 

Como saberei se deu certo? O programa não conseguira pegar as informações?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ele vai te dar uma reposta, por exemplo "A função funcionou" ou "A função não funcionou", isso ele faz tudo escondido, o usuário não precisa saber o funcionamento, mas assim ele vai dar certo sim, se não funcionar, será retornado um erro, se funcionar, o script segue em andamento.

 

Abraço!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Eu testei a função safeSQL coloquei em várias partes para testar mas não consegui saber o local correto...

 

Dai eu fiz dar um erro e o programa não pegou os dados: (fiz dar o erro para ter certeza do arquivo que gerava os resultados.

 

Web Server: Apache Can not find keyword but let me do a try! I guess injection type is Integer?! If injection failed, retry with a manual keyword. Can't find db server type! But maybe there be some chances! [-o< Trying again to find columns count with string type(MySQL,MsSQL 2005): 24 Cannot find column count! Testing for MySQL error based injection method MySQL error based injection method cant be used! MsSQL time based injection method can't be used MySQL time based injection method can be used (203ms delay) Finding current data base Cannot get current db name!

 

 

Alguém poderia me dar um luz de onde devo chamar a função safeSQL? Abaixo o código.

 

<?php if(!defined('EFFICIENT_ROOT')) exit;

 class ItemController extends Controller {

 public $result, $droprate, $fileViewID, $itemDisplayType;

 public function __construct($droprates, $db_struct, $res_paths, $file_ext) {
   $this->droprate = $droprates;
   $this->dbstruct = $db_struct;
   $this->respaths = $res_paths;
   $this->mediaext = $file_ext;
 }

 public function prepareView() {

     // Set master type

     $this->resultDisplayType = $this->getAttr('type');

     // Exception for cards (use ID 4000 for item view)

     $viewID = $this->getAttr('id');
     $this->fileViewID = ($viewID > 4000 && $viewID < 4700) ? 4001 : $viewID;

     // Set image resource paths

     $this->fItem       = $this->respaths['item'] . "/{$this->fileViewID}." . $this->mediaext['item'];
     $this->fCard       = $this->respaths['card'] . '/' . $this->getAttr('id') . '.' . $this->mediaext['card'];
     $this->fCollection = $this->respaths['collection'] . "/" . $this->fileViewID . "." . $this->mediaext['collection'];

     // Name

     $this->setAttr('name1', str_replace("%_%"," ",$this->getAttr('name1'))); // we wouldn't want our name to contain underscores :(

     // Zeny

     $value_b = $this->getAttr('value_b');
     $value_s = $this->getAttr('value_s');

       if(!ctype_digit($value_B) && ctype_digit($value_s)) {
         $value_n = ($value_s*2);
       } elseif(ctype_digit($value_B)) {
         $value_n = $value_b;
       } elseif(!ctype_digit($value_B) && !ctype_digit($value_s)) {
         $value_n = 20;
       }

     $this->setAttr('value_b', (($value_n) . "z / " . ($value_n/2) . "z"));



     // Quick fix for random underlines in descriptions
     $this->setAttr('desc', str_replace("_"," ",$this->getAttr('desc')));

     // Monster which drops current item
     // Note: This uses base item type and need to be set before switching it

     $mobList = unserialize($this->getAttr('droppers'));

     $alice=(string)'';

     if(is_array($mobList)) {

       foreach($mobList as $g => $monster) {

         // The following keys in $monster are the values set in the array when importing the droppers
         // not the table column names... (yeah, it's ugly none the less)

         $m['name']    = $monster['iName'];
         $m['id']      = $monster['id'];
         $m['itype']   = $monster['type'];
         $m['dropper'] = number_format($monster['dropChance']/100, 2, '.', '');

           // Adjust drop% for alternate rates
           if($m['itype'] == 2) $m['dropper'] *= $this->droprate['item_rate_mvp'];
           else {
             switch($m['itype']) {
               case 0:   $m['dropper'] *= $this->droprate['item_rate_heal'];   break; // Healing item
               case 2:   $m['dropper'] *= $this->droprate['item_rate_use'];    break; // Usable item
               case 11:  $m['dropper'] *= $this->droprate['item_rate_use'];    break; // Delayed usable item
               case 3:   $m['dropper'] *= $this->droprate['item_rate_common']; break; // Misc
               case 4:   $m['dropper'] *= $this->droprate['item_rate_equip'];  break; // Weap
               case 5:   $m['dropper'] *= $this->droprate['item_rate_equip'];  break; // Equip
               case 6:   $m['dropper'] *= $this->droprate['item_rate_card'];   break; // Card
               case 7:   $m['dropper'] *= $this->droprate['item_rate_use'];    break; // Pet egg
               case 8:   $m['dropper'] *= $this->droprate['item_rate_use'];    break; // Pet equip
               case 10:  $m['dropper'] *= $this->droprate['item_rate_use'];    break; // Ammo
               default:  $m['dropper'] *= $this->droprate['item_rate_common'];        // Default
             }
           }

           if($m['dropper'] > 100) $m['dropper'] = 100;

         $mBind = ($m['itype'] == 2) ? " [<span class=\"alertMVP\">" . message('db_bossmob') . "!</span>]" : '';
         //$alice .= "<a href=\"http://" . CAILL_PATH . "/mobsrc/?cid=on&id=". $m['id'] ."\">". $m['name'] ."</a>$mBind (". $m['dropper'] ."%), "; 
         $alice .= "<a onclick=\"setDisplay('smokescreen');showprop('ajaxFrame','{$m['id']}', 'mobsearch');\">". $m['name'] ."</a>$mBind (". $m['dropper'] ."%), "; 
       }

     }

     $alice = (strlen($alice) == 0) ? message('db_item_nodrops') : substr_replace($alice,"",-2);

     $this->setAttr('droppers', $alice);

     // Item type

     $item_types = array(
       0 => message('db_item_0'),
       2 => message('db_item_2'),
       3 => message('db_item_3'),
       4 => message('db_item_4'),
       5 => message('db_item_5'),
       6 => message('db_item_6'),
       7 => message('db_item_7'),
       8 => message('db_item_8'),
       10 => message('db_item_10'),
       11 => message('db_item_11'),
       -1 => message('db_item_01'),
     );

     $type = $this->getAttr('type');
     $this->setAttr('type',  (isset($item_types[$type]) ? $item_types[$type] : $item_types[-1]));

     // Equip location

     $loc_types = array(
       1 =>   message('db_iloc_1'),
       2 =>   message('db_iloc_2'),
       4 =>   message('db_iloc_4'),
       8 =>   message('db_iloc_8'),
       16 =>  message('db_iloc_16'),
       32 =>  message('db_iloc_32'),
       34 =>  message('db_iloc_34'),
       64 =>  message('db_iloc_64'),
       128 => message('db_iloc_128'),
       136 => message('db_iloc_136'),
       256 => message('db_iloc_256'),
       512 => message('db_iloc_512'),
       768 => message('db_iloc_768'),
       769 => message('db_iloc_769'),
       -1  => message('db_iloc_01'),
     );

     $loc = $this->getAttr('e_loc');
     $this->setAttr('e_loc', (isset($loc_types[$loc]) ? $loc_types[$loc] : $loc_types[-1]));

   }

   public function output($res, $resLim, $resOffset) {

     $e = 0;
     $i = 0;
     $output = (string)"";

     while($result = mysql_fetch_array($res)) {

       $e++;

       if($i >= $resLim) {
       break;
       } 

       if($e <= $resOffset) {
       continue;
       }

       $this->result = $result;
       $this->prepareView();

         // This switch selects the layout file to use for current item

         switch($this->resultDisplayType) {

           // Weapons and equipment
           case 4: 
           case 5: include('layout/item/item_form_equip.php'); break;
           // Cards
           case 6: include('layout/item/item_form_card.php'); break;
           // Default
           default: include('layout/item/item_form_default.php');

         }

       $i++;

     }

     return $output;

   }

 }

?>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Você não vai usar a função, ai, é mais ou menos assim:

 

<?php
// Primeiro, você vai verificar se o form foi submetido, via POST, se for GET, use GET
if ($_SERVER['REQUEST_METHOD'] == "POST") {
   function safeSQL($string)  
   {         
       if(get_magic_quotes_gpc()) 
       { 
           $string = stripslashes($string);  
       } 
       elseif(!get_magic_quotes_gpc())  
       { 
           $string = addslashes($string);  
       } 

       $string = mysql_real_escape_string($string);  
       return $string; 
   }
   $nome  = safeSQL($_POST['nome']);
   $email = safeSQL($_POST['email']);

   $class = new Class();
   $class->insert($dados);
   // E assim vai, isso aqui, vai ser no formulário cara, quando você receber os dados
}
?>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Você não vai usar a função, ai, é mais ou menos assim:

 

<?php
// Primeiro, você vai verificar se o form foi submetido, via POST, se for GET, use GET
if ($_SERVER['REQUEST_METHOD'] == "POST") {
   function safeSQL($string)  
   {         
       if(get_magic_quotes_gpc()) 
       { 
           $string = stripslashes($string);  
       } 
       elseif(!get_magic_quotes_gpc())  
       { 
           $string = addslashes($string);  
       } 

       $string = mysql_real_escape_string($string);  
       return $string; 
   }
   $nome  = safeSQL($_POST['nome']);
   $email = safeSQL($_POST['email']);

   $class = new Class();
   $class->insert($dados);
   // E assim vai, isso aqui, vai ser no formulário cara, quando você receber os dados
}
?>

 

No caso isso ficaria aqui nesta parte onde tem os forms:

<?php if(!defined('EFFICIENT_ROOT')) exit; ?>


<div align="center" style="text-align: left;">
	<table border="0" width="85%" cellspacing="0" cellpadding="0">
		<tr>
			<td width="77" align="left" >
               <img border="0" src="../../media/collection/699.gif"></td>
			<td align="left">
			<p style="margin-top: 0; margin-bottom: 10px">
			<font face="Trebuchet MS" size="5" color="#808080">Ragnarok DB - 
               Buscar Itens</font></p>
			<p style="margin-top: 0; margin-bottom: 5px" text-align: left;">
			<font face="Trebuchet MS"><font color="#808080">Caso não 
			encontre o item desejado utilizando o sistema de busca 
			simples, use nosso </font><font color="#336699">
			<a href="http://ragdb.com/?act=item" style="text-decoration: none">
			<span style="font-weight:700"><font color="#336699">SISTEMA DE BUSCA AVANÇADO</font></span></a><b>.</b></font></font></td>
		</tr>
	</table>
	<hr>
</div>



   </div>
<div align="center">
<table border="0" width="851" cellspacing="0" cellpadding="0">
<tr>
	<td height="127" width="929">



   <div style="margin-left: 0px; width: 506px;height:172px" align="left" >

        <form method="get" action="" name="monster_search">

           </form>

           <input type="hidden" name="act" value="itemsearch" />
           <input type="hidden" name="cname" value="1" />

           <table width="506" height="125">

             <tr>
               <td rowspan="7" style="padding-right: 20px; width: 80px; text-align: center;">
                 <div class="rounded">
                   <img src="media/collection/14566.gif" alt="Item search" />               
               </td>
             </tr>

             <tr>
               <td style="line-height: 1em;" width="395" align="left" colspan="2">
                 <span class="ffruit"><?php echo message('src_item_title'); ?></span></td>
             </tr>

             <tr>
               <td style="line-height: 1em;" width="395" height="29" align="left" colspan="2">
                 <p>
				<font class="btext" size="2" face="Trebuchet MS" color="#808080">
				<b>Selecione um item da lista:</b></font>	

                 </p>

                 <p>
					<select name="all_mob_select" onchange="location.href = this.options[this.selectedIndex].value">
					<option selected="selected" value="#"> -- Selecione um 
					Item -- </option>	

<option value="http://ragdb.com/?act=itemsearch&cid=on&id=6239">+11 Armor 
Refine Ticket - (6239)</option>
<option value="http://ragdb.com/?act=itemsearch&cid=on&id=6238">+11 Weapon 
Refine Ticket - (6238)</option>
<option value="http://ragdb.com/?act=itemsearch&cid=on&id=13634">1 Hour 
Package Vol 1 - (13634)</option>


</select>
                 </td>
             </tr>

             <tr>
               <td style="line-height: 1em;" width="395" height="29" align="left" colspan="2">

<span id="sName1">
				<p style="margin-top: 0; margin-bottom: 0"><?php echo message('src_item_prompt'); ?></span>                  </td>
             </tr>



             <tr>
               <td style="line-height: 1em;" width="380" height="29" align="left" valign="bottom">
                 <div>
                   <p style="margin-top: 0; margin-bottom: 0"><input type="text" id="name" name="name" class="gsrcsimple" style="width: 280px" tabindex="1" autocomplete="off" onkeyup="getSuggest(this.value,'sName1', 'item');" size="20" /></div>
				<table border="0" width="100%">
				</table>
                 </td>
               <td style="line-height: 1em;" width="37" height="29" align="left" valign="baseline">
                  </td>
             </tr>



             <tr>
               <td style="line-height: 1em;" width="380" height="29" align="left" valign="bottom">
                 <input type="submit" class="ssubmit" value="" /></td>
               <td style="line-height: 1em;" width="37" height="29" align="left" valign="baseline">
                  </td>
             </tr>

           </table>

         </form>

   </div></td>
</tr>
<form method="get" action="">

           <input type="hidden" name="act" value="itemsearch" />
           <input type="hidden" name="ctype" value="on" />
           <input type="hidden" name="type" value="5" />
           <input type="hidden" name="cmax_page" value="on" />
           <input type="hidden" name="max_page" value="40" />
           <input type="hidden" name="cdisplayorder" value="on" />
           <input type="hidden" name="displayorder" value="100" />
<form method="get" action="">

           <input type="hidden" name="act" value="itemsearch" />
           <input type="hidden" name="cmvp" value="1" />
	</table>

   <table border="0" width="100%">
	<tr>
		<td> </td>
	</tr>
</table>

   </div>
			<hr>
		<p style="margin-top: 0; margin-bottom: 0" align="center">
		<img border="0" src="../banner.png" width="897" height="159"></p>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Uma outra curiosidade saberias me dizer porque em um Host o programa pega os dados do DB e em outro naum... no ipage não pega no uolhost pega. O projeto é exatamente o mesmo...

 

eu coloco no ipage...

http://db.dbbb.net/?act=itemsearch&cid=on&id=11534' --> Não dá erro e não injeta.

 

no uolhost:

http://db.dbbb.net/?act=itemsearch&cid=on&id=11534' --> Dá o erro que mostra que é possível injetar.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Não sei te dizer não cara, os dois servidores possuem um servidor `linux`? Pois PHP não irá rodar em servidor `windows`

 

Sim os 2 linux um Debian e outro Red Hat

 

O fato de um host não aceitar injeção sql e o outro sim pode ter algo haver com o magic_quotes ativado ou naum?

 

Poderiam me ensinar a usar PDO?

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.