Ver Mensaje Individual
  #17 (permalink)  
Antiguo 24/08/2015, 17:14
Avatar de NSD
NSD
Colaborador
 
Fecha de Ingreso: mayo-2012
Ubicación: Somewhere
Mensajes: 1.332
Antigüedad: 11 años, 11 meses
Puntos: 320
Respuesta: Generar archivo sql en PHP

Las primeras 33 lineas... Horribles.
Código PHP:
Ver original
  1. <?php
  2.     if($_SERVER['REQUEST_METHOD'] == "POST") {
  3.    
  4.         $template = "INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `dmgschool`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `DamageModifier`, `ExperienceModifier`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES('[entry]', '0', '0', '0', '0', '0', '[modelo1]', '[modelo2]', '[modelo3]', '[modelo4]', '[nombre]', '[subnombre]', NULL, '[menu_id]', '[minlevel]', '[maxlevel]', '0', '[faccion]', '[npcflag]', '0.91', '1.14286', '[escala]', '[rango]', '0', '2000', '2000', '[damage1]', '[damage2]', '[unit_class]', '0', '0', '0', '[familia]', '0', '0', '0', '0', '[tipo]', '0', '0', '0', '0', '[resistencia1]', '[resistencia2]', '[resistencia3]', '[resistencia4]', '[resistencia5]', '[resistencia6]', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '[mingold]', '[maxgold]', '', '0', '3', '1', '[vida]', '[mana]', '[armadura]', '1', '1', '0', '0', '0', '0', '0', '0', '[regenvida]', '0', '1', '', '0', '', '0');";
  5.        
  6.         foreach($_POST as $key => $value)
  7.             $template = str_replace("[$key]", $value, $template);
  8.        
  9.         header("Content-type: application/octet-stream");
  10.         header("Content-Disposition: attachment; filename=\"codigo.sql\"\n");
  11.         echo $template;
  12.        
  13.     }
__________________
Maratón de desafíos PHP Junio - Agosto 2015 en FDW | Reglamento - Desafios