rendered paste body<?
if (isset($_POST['stats'])) {
$text = $_POST['stats'];
$userid=$_SESSION['user_id'];
//split the data into lines to be processed one by one
$line=explode("\n", "$text");
mysql_query("TRUNCATE TABLE `subh_sstats`");
//work through each line of data
foreach($line as $value){
$info=explode("\t", "$value");
if (empty($info[14])) {
mysql_query("INSERT INTO `subh_sstats` ( `ship_id` , `name` , `class` , `target` , `type` , `init` , `guns` , `armor` , `damage` , `empres` , `metal` , `crystal` , `eonium` , `ac` , `dc` , `race` ) VALUES (NULL, 'Roids', 'RO', 'NA', 'N', '0', '0', '50', '0', '0', '10000', '5000', '5000', '0', '0', 'All')");
mysql_query("INSERT INTO `subh_sstats` ( `ship_id` , `name` , `class` , `target` , `type` , `init` , `guns` , `armor` , `damage` , `empres` , `metal` , `crystal` , `eonium` , `ac` , `dc` , `race` ) VALUES (NULL, 'Struc', 'ST', 'NA', 'N', '0', '0', '500', '0', '0', '50000', '50000', '50000', '0', '0', 'All')");
exit;
}
$race=substr($info[14], 0, 3);
$type=$info[3]; if ($type == "Norm") {$type="N";} elseif ($type == "Emp") {$type="E";} elseif ($type == "Cloak") {$type="C";} elseif ($type == "Steal") {$type="S";} elseif ($type == "Pod") {$type="P";} elseif ($type == "Struc") {$type="K";}
//Harpy Fighter Frigate Norm 7 1 23 17 85 140 110 110 638 472 Ter
mysql_query("INSERT INTO `subh_sstats` ( `ship_id` , `name` , `class` , `target` , `type` , `init` , `guns` , `armor` , `damage` , `empres` , `metal` , `crystal` , `eonium` , `ac` , `dc` , `race` )
VALUES (NULL, '".$info[0]."', '".$info[1]."', '".$info[2]."', '".$type."', '".$info[4]."', '".$info[5]."', '".$info[6]."', '".$info[7]."', '".$info[8]."', '".$info[9]."', '".$info[10]."', '".$info[11]."', '".$info[12]."', '".$info[13]."', '".$race."')");
}
}
?>