Mister Spy Say ="Hello Kids ... :D"
___ ____ _ _____
| \/ (_) | | / ___|
| . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _
| |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | |
| | | | \__ \ || __/ | /\__/ / |_) | |_| |
\_| |_/_|___/\__\___|_| \____/| .__/ \__, |
| | __/ |
|_| |___/
Bot Mister Spy V3
Mister Spy
Mister Spy
<?php
class DB
{
static public function String($string)
{
//return "'".addslashes(toHTML($string))."'";
return "'".addslashes($string)."'";
}
static public function StringUnquoted($string)
{
return addslashes($string);
}
static public function Number($sNumber)
{
return (is_numeric($sNumber) ? $sNumber : 'NULL');
}
static public function ObtenerFecha($Date)
{
$Anio = substr($Date, 0, 4);
$Mes = substr($Date, 4, 2);
$Dia = substr($Date, 6, 2);
return $Dia . '-' .$Mes. '-' .$Anio;
}
static public function Date($date)
{/*
if (($ret = DB::parseDate($date, '%Y-%m-%d %H:%M:%s')) != false)
return "'$ret'";
if (($ret = DB::parseDate($date, '%d/%m/%Y %H:%M:%s')) != false)
return "'$ret'";
if (($ret = DB::parseDate($date, '%d/%m/%Y %H:%M')) != false)
return "'$ret'";
if (($ret = DB::parseDate($date, '%d/%m/%Y %H')) != false)
return "'$ret'";
*/
if (($ret = DB::parseDate($date, '%d/%m/%Y')) != false)
return "'$ret'";
/*
if (($ret = DB::parseDate($date, '%Y-%m-%d %H:%M:%s')) != false)
return "'$ret'";
if (($ret = DB::parseDate($date, '%d-%m-%Y %H:%M:%s')) != false)
return "'$ret'";
if (($ret = DB::parseDate($date, '%d-%m-%Y %H:%M')) != false)
return "'$ret'";
if (($ret = DB::parseDate($date, '%d-%m-%Y %H')) != false)
return "'$ret'";
*/
if (($ret = DB::parseDate($date, '%d-%m-%Y')) != false)
return "'$ret'";
/*
if (($ret = DB::parseDate($date, '%Y-%m-%d %H:%M')) != false)
return "'$ret'";
if (($ret = DB::parseDate($date, '%Y-%m-%d %H')) != false)
return "'$ret'";
if (($ret = DB::parseDate($date, '%Y-%m-%d')) != false)
return "'$ret'";
*/
return 'NULL';
}
static public function Bool($sBool)
{
if ($sBool == true || $sBool == 1)
return '1';
return '0';
}
static private function parseDate( $date, $format )
{
// Builds up date pattern from the given $format, keeping delimiters in place.
if( !preg_match_all( "/%([YmdHMsu])([^%])*/", $format, $formatTokens, PREG_SET_ORDER ) )
return false;
foreach( $formatTokens as $formatToken )
{
$delimiter = preg_quote( $formatToken[2], "/" );
if($formatToken[1] == 'Y')
{
$datePattern .= '(.{1,4})'.$delimiter;
}
elseif($formatToken[1] == 'u')
{
$datePattern .= '(.{1,5})'.$delimiter;
}
else
{
$datePattern .= '(.{1,2})'.$delimiter;
}
}
// Splits up the given $date
if( !preg_match( "/^".$datePattern."/", $date, $dateTokens) )
{
return false;
}
$dateSegments = array();
for($i = 0; $i < count($formatTokens); $i++)
{
$dateSegments[$formatTokens[$i][1]] = $dateTokens[$i+1];
}
// Reformats the given $date into rfc3339
if( $dateSegments["Y"] && $dateSegments["m"] && $dateSegments["d"] )
{
if( ! checkdate ( $dateSegments["m"], $dateSegments["d"], $dateSegments["Y"] ))
{
return false;
}
$dateReformated =
str_pad($dateSegments["Y"], 4, '0', STR_PAD_LEFT)
."-".str_pad($dateSegments["m"], 2, '0', STR_PAD_LEFT)
."-".str_pad($dateSegments["d"], 2, '0', STR_PAD_LEFT);
}
else
{
return false;
}
if( $dateSegments["H"] && $dateSegments["M"] )
{
$dateReformated .=
" ".str_pad($dateSegments["H"], 2, '0', STR_PAD_LEFT)
.':'.str_pad($dateSegments["M"], 2, '0', STR_PAD_LEFT);
if( $dateSegments["s"] )
{
$dateReformated .=
":".str_pad($dateSegments["s"], 2, '0', STR_PAD_LEFT);
if( $dateSegments["u"] )
{
$dateReformated .=
'.'.str_pad($dateSegments["u"], 5, '0', STR_PAD_RIGHT);
}
}
}
return $dateReformated;
}
}
set_time_limit(99999999999);
$hostname_cnx = "localhost";
$Animalbase_cnx = "caballos_bd";
$username_cnx = "caballos_usuario";
$password_cnx = "V4kadl8xLdDR";
$cnx = mysql_pconnect($hostname_cnx, $username_cnx, $password_cnx) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($Animalbase_cnx, $cnx);
$Handle = fopen('accc/PDRE.txt', "r");
$Header = 1;
$Row = 1;
$Id = 1;
$Error = "";
while (($Animal = fgetcsv($Handle, 1000, ";")) !== FALSE)
{
if ($Header != 0)
{
if((trim($Animal[7]) != ""))
{
#Obtengo los datos para agregarlos en la base de datos
$RAZA = $Animal[0];
$RGST = $Animal[1];
$VARI = $Animal[2];
$ASOC = $Animal[3];
$HBAE = $Animal[4];
$DDPX = $Animal[5];
$RPEX = $Animal[6];
$NOMB = $Animal[7];
$CBAJ = $Animal[8];
$OBSI = $Animal[9];
$DADO = $Animal[10];
$PROP = $Animal[11];
$CRIA = $Animal[12];
$TRAN = $Animal[13];
$ANLS = $Animal[14];
$RANA = $Animal[15];
$CALG = $Animal[16];
//$APRB = $Animal[17];//
$SIET = $Animal[17];
$DONA = $Animal[18];
$MELL = $Animal[19];
$TRNS = $Animal[20];
$TSER = $Animal[21];
$EMBA = $Animal[22];
$COLO = $Animal[23];
$RPTI = $Animal[24];
$FNAC = DB::ObtenerFecha($Animal[25]);
$FBAJ = DB::ObtenerFecha($Animal[26]);
$FESB = DB::ObtenerFecha($Animal[27]);
$FOBS = DB::ObtenerFecha($Animal[28]);
$FTRF = DB::ObtenerFecha($Animal[29]);
$FSER = DB::ObtenerFecha($Animal[30]);
$CPEL = $Animal[31];
$CCUE = $Animal[32];
$CCAB = $Animal[33];
$CMIE = $Animal[34];
$RPNU = $Animal[35];
$APDO = $Animal[36];
$PENA = $Animal[37];
$PEDE = $Animal[38];
$PEFI = $Animal[39];
$EPNA = $Animal[40];
$EPDE = $Animal[41];
$EPFI = $Animal[42];
$PURE = $Animal[43];
$TANA = $Animal[44];
$FANA = $Animal[45];
$IdPr = $Animal[46];
$IdPa = $Animal[47];
$IdMa = $Animal[48];
/*$RGSP = $Animal[25];
$VARP = $Animal[26];
$ASOP = $Animal[27];
$HBAP = $Animal[28];
$RPPD = $Animal[29];
$RGSM = $Animal[30];
$VARM = $Animal[31];
$ASOM = $Animal[32];
$HBAM = $Animal[33];
$RPMD = $Animal[34];
$RPTI = '';//$Animal[35];*/
/*$NROC = $Animal[53];
$SIGLA = $Animal[54];
$SIGPA = $Animal[55];
$SIGMA = $Animal[56];*/
/* verificamos si esxiste el registro, entonces utilizamos el Id existente */
$queryAnimal = "SELECT * FROM tblPdre";
$queryAnimal.= " WHERE HBAE = " . DB::Number($HBAE);
$queryAnimal.= " AND RPEX = " . DB::String($RPEX);
//$queryAnimal.= " AND NOMB = " . DB::String($NOMB);
$queryAnimal.= " AND RGST = " . DB::String($RGST);
$sqlAnimal = mysql_query($queryAnimal) or die(mysql_error());
$oAnimal = mysql_fetch_array($sqlAnimal);
if ($oAnimal)
{
$IdPdre = $oAnimal['IdPdre'];
$queryUpdate = "";
$queryUpdate.= "UPDATE tblPdre SET";
$queryUpdate.= " RAZA = " . DB::Number($RAZA) . ", ";
$queryUpdate.= " RGST = " . DB::String($RGST) . ", ";
$queryUpdate.= " VARI = " . DB::String($VARI) . ", ";
$queryUpdate.= " ASOC = " . DB::String($ASOC) . ", ";
$queryUpdate.= " HBAE = " . DB::Number($HBAE) . ", ";
$queryUpdate.= " CDPX = " . DB::String($CDPX) . ", ";
$queryUpdate.= " RPEX = " . DB::String($RPEX) . ", ";
$queryUpdate.= " NOMB = " . DB::String($NOMB) . ", ";
$queryUpdate.= " CBAJ = " . DB::String($CBAJ) . ", ";
$queryUpdate.= " OBSI = " . DB::String($OBSI) . ", ";
$queryUpdate.= " DADO = " . DB::String($DADO) . ", ";
$queryUpdate.= " PROP = " . DB::String($PROP) . ", ";
$queryUpdate.= " CRIA = " . DB::String($CRIA) . ", ";
$queryUpdate.= " TRAN = " . DB::String($TRAN) . ", ";
$queryUpdate.= " ANLS = " . DB::String($ANLS) . ", ";
$queryUpdate.= " RANA = " . DB::String($RANA) . ", ";
$queryUpdate.= " CALG = " . DB::String($CALG) . ", ";
$queryUpdate.= " APRB = " . DB::String($APRB) . ", ";
$queryUpdate.= " SIET = " . DB::String($SIET) . ", ";
$queryUpdate.= " DONA = " . DB::String($DONA) . ", ";
$queryUpdate.= " MELL = " . DB::String($MELL) . ", ";
$queryUpdate.= " TRNS = " . DB::String($TRNS) . ", ";
$queryUpdate.= " TSER = " . DB::String($TSER) . ", ";
$queryUpdate.= " EMBA = " . DB::String($EMBA) . ", ";
$queryUpdate.= " COLO = " . DB::String($COLO) . ", ";
/*$queryUpdate.= " RGSP = " . DB::String($RGSP) . ", ";
$queryUpdate.= " VARP = " . DB::String($VARP) . ", ";
$queryUpdate.= " ASOP = " . DB::String($ASOP) . ", ";
$queryUpdate.= " HBAP = " . DB::Number($HBAP) . ", ";
$queryUpdate.= " RPPD = " . DB::String($RPPD) . ", ";
$queryUpdate.= " RGSM = " . DB::String($RGSM) . ", ";
$queryUpdate.= " VARM = " . DB::String($VARM) . ", ";
$queryUpdate.= " ASOM = " . DB::String($ASOM) . ", ";
$queryUpdate.= " HBAM = " . DB::Number($HBAM) . ", ";
$queryUpdate.= " RPMD = " . DB::String($RPMD) . ", ";*/
$queryUpdate.= " RPTI = " . DB::String($RPTI) . ", ";
if ($FNAC != "" && $FNAC != "NULL")
$queryUpdate.= " FNAC = " . DB::Date($FNAC) . ", ";
$queryUpdate.= " FBAJ = " . DB::Date($FBAJ) . ", ";
$queryUpdate.= " FESB = " . DB::Date($FESB) . ", ";
$queryUpdate.= " FOBS = " . DB::Date($FOBS) . ", ";
$queryUpdate.= " FTRF = " . DB::Date($FTRF) . ", ";
$queryUpdate.= " FSER = " . DB::Date($FSER) . ", ";
$queryUpdate.= " CPEL = " . DB::String($CPEL) . ", ";
$queryUpdate.= " CCUE = " . DB::String($CCUE) . ", ";
$queryUpdate.= " CCAB = " . DB::String($CCAB) . ", ";
$queryUpdate.= " CMIE = " . DB::String($CMIE) . ", ";
$queryUpdate.= " RPNU = " . DB::String($RPNU) . ", ";
$queryUpdate.= " APDO = " . DB::String($APDO) . ", ";
$queryUpdate.= " PENA = " . DB::String($PENA) . ", ";
$queryUpdate.= " PEDE = " . DB::String($PEDE) . ", ";
$queryUpdate.= " PEFI = " . DB::String($PEFI) . ", ";
$queryUpdate.= " EPNA = " . DB::String($EPNA) . ", ";
$queryUpdate.= " EPDE = " . DB::String($EPDE) . ", ";
$queryUpdate.= " EPFI = " . DB::String($EPFI) . ", ";
$queryUpdate.= " NROC = " . DB::String($NROC) . ", ";
$queryUpdate.= " SIGLA = " . DB::String($SIGLA) . ", ";
$queryUpdate.= " SIGPA = " . DB::String($SIGPA) . ", ";
$queryUpdate.= " SIGMA = " . DB::String($SIGMA) . ", ";
$queryUpdate.= " PURE = " . DB::String($PURE) . ", ";
$queryUpdate.= " TANA = " . DB::String($TANA) . ", ";
$queryUpdate.= " IdProd = " . DB::Number($IdPr) . ", ";
$queryUpdate.= " IdPa = " . DB::Number($IdPa) . ", ";
$queryUpdate.= " IdMa = " . DB::Number($IdMa);
$queryUpdate.= " WHERE IdPdre = " . DB::Number($IdPdre);
$sqlUpdate = mysql_query($queryUpdate, $cnx) or die(mysql_error());
}
else
{
$queryInsert = "";
$queryInsert.= "INSERT INTO tblPdre";
$queryInsert.= "(";
$queryInsert.= " RAZA,";
$queryInsert.= " RGST,";
$queryInsert.= " VARI,";
$queryInsert.= " ASOC,";
$queryInsert.= " HBAE,";
$queryInsert.= " CDPX,";
$queryInsert.= " RPEX,";
$queryInsert.= " NOMB,";
$queryInsert.= " CBAJ,";
$queryInsert.= " OBSI,";
$queryInsert.= " DADO,";
$queryInsert.= " PROP,";
$queryInsert.= " CRIA,";
$queryInsert.= " TRAN,";
$queryInsert.= " ANLS,";
$queryInsert.= " RANA,";
$queryInsert.= " CALG,";
$queryInsert.= " APRB,";
$queryInsert.= " SIET,";
$queryInsert.= " DONA,";
$queryInsert.= " MELL,";
$queryInsert.= " TRNS,";
$queryInsert.= " TSER,";
$queryInsert.= " EMBA,";
$queryInsert.= " COLO,";
$queryInsert.= " RGSP,";
$queryInsert.= " VARP,";
$queryInsert.= " ASOP,";
$queryInsert.= " HBAP,";
$queryInsert.= " RPPD,";
$queryInsert.= " RGSM,";
$queryInsert.= " VARM,";
$queryInsert.= " ASOM,";
$queryInsert.= " HBAM,";
$queryInsert.= " RPMD,";
$queryInsert.= " RPTI,";
if ($FNAC != "" && $FNAC != "NULL") $queryInsert.= " FNAC,";
$queryInsert.= " FBAJ,";
$queryInsert.= " FESB,";
$queryInsert.= " FOBS,";
$queryInsert.= " FTRF,";
$queryInsert.= " FSER,";
$queryInsert.= " CPEL,";
$queryInsert.= " CCUE,";
$queryInsert.= " CCAB,";
$queryInsert.= " CMIE,";
$queryInsert.= " RPNU,";
$queryInsert.= " APDO,";
$queryInsert.= " PENA,";
$queryInsert.= " PEDE,";
$queryInsert.= " PEFI,";
$queryInsert.= " EPNA,";
$queryInsert.= " EPDE,";
$queryInsert.= " EPFI,";
$queryInsert.= " NROC,";
$queryInsert.= " SIGLA,";
$queryInsert.= " SIGPA,";
$queryInsert.= " SIGMA,";
$queryInsert.= " PURE,";
$queryInsert.= " TANA,";
$queryInsert.= " IdProd,";
$queryInsert.= " IdPa,";
$queryInsert.= " IdMa";
$queryInsert.= ")";
$queryInsert.= " VALUES ";
$queryInsert.= "(";
$queryInsert.= DB::Number($RAZA) . ", ";
$queryInsert.= DB::String($RGST) . ", ";
$queryInsert.= DB::String($VARI) . ", ";
$queryInsert.= DB::String($ASOC) . ", ";
$queryInsert.= DB::Number($HBAE) . ", ";
$queryInsert.= DB::String($CDPX) . ", ";
$queryInsert.= DB::String($RPEX) . ", ";
$queryInsert.= DB::String($NOMB) . ", ";
$queryInsert.= DB::String($CBAJ) . ", ";
$queryInsert.= DB::String($OBSI) . ", ";
$queryInsert.= DB::String($DADO) . ", ";
$queryInsert.= DB::String($PROP) . ", ";
$queryInsert.= DB::String($CRIA) . ", ";
$queryInsert.= DB::String($TRAN) . ", ";
$queryInsert.= DB::String($ANLS) . ", ";
$queryInsert.= DB::String($RANA) . ", ";
$queryInsert.= DB::String($CALG) . ", ";
$queryInsert.= DB::String($APRB) . ", ";
$queryInsert.= DB::String($SIET) . ", ";
$queryInsert.= DB::String($DONA) . ", ";
$queryInsert.= DB::String($MELL) . ", ";
$queryInsert.= DB::String($TRNS) . ", ";
$queryInsert.= DB::String($TSER) . ", ";
$queryInsert.= DB::String($EMBA) . ", ";
$queryInsert.= DB::String($COLO) . ", ";
$queryInsert.= DB::String($RGSP) . ", ";
$queryInsert.= DB::String($VARP) . ", ";
$queryInsert.= DB::String($ASOP) . ", ";
$queryInsert.= DB::Number($HBAP) . ", ";
$queryInsert.= DB::String($RPPD) . ", ";
$queryInsert.= DB::String($RGSM) . ", ";
$queryInsert.= DB::String($VARM) . ", ";
$queryInsert.= DB::String($ASOM) . ", ";
$queryInsert.= DB::Number($HBAM) . ", ";
$queryInsert.= DB::String($RPMD) . ", ";
$queryInsert.= DB::String($RPTI) . ", ";
if ($FNAC != "" && $FNAC != "NULL") $queryInsert.= DB::Date($FNAC) . ", ";
$queryInsert.= DB::Date($FBAJ) . ", ";
$queryInsert.= DB::Date($FESB) . ", ";
$queryInsert.= DB::Date($FOBS) . ", ";
$queryInsert.= DB::Date($FTRF) . ", ";
$queryInsert.= DB::Date($FSER) . ", ";
$queryInsert.= DB::String($CPEL) . ", ";
$queryInsert.= DB::String($CCUE) . ", ";
$queryInsert.= DB::String($CCAB) . ", ";
$queryInsert.= DB::String($CMIE) . ", ";
$queryInsert.= DB::String($RPNU) . ", ";
$queryInsert.= DB::String($APDO) . ", ";
$queryInsert.= DB::String($PENA) . ", ";
$queryInsert.= DB::String($PEDE) . ", ";
$queryInsert.= DB::String($PEFI) . ", ";
$queryInsert.= DB::String($EPNA) . ", ";
$queryInsert.= DB::String($EPDE) . ", ";
$queryInsert.= DB::String($EPFI) . ", ";
$queryInsert.= DB::String($NROC) . ", ";
$queryInsert.= DB::String($SIGLA) . ", ";
$queryInsert.= DB::String($SIGPA) . ", ";
$queryInsert.= DB::String($SIGMA) . ", ";
$queryInsert.= DB::String($PURE) . ", ";
$queryInsert.= DB::String($TANA) . ", ";
$queryInsert.= DB::Number($IdPr) . ", ";
$queryInsert.= DB::Number($IdPa) . ", ";
$queryInsert.= DB::Number($IdMa);
$queryInsert.= ")";
$sqlInsert = mysql_query($queryInsert, $cnx) or die(mysql_error());
}
/* verificamos si esxiste el registro, entonces utilizamos el Id existente */
$queryAnimal = "SELECT * FROM tblAnimales";
$queryAnimal.= " WHERE IdProd = " . DB::Number($IdPr);
$sqlAnimal = mysql_query($queryAnimal) or die(mysql_error());
$oAnimal = mysql_fetch_array($sqlAnimal);
$queryAnimal2 = "SELECT * FROM tblPdre";
$queryAnimal2.= " WHERE HBAE = " . DB::Number($HBAE);
$queryAnimal2.= " AND RPEX = " . DB::String($RPEX);
//$queryAnimal.= " AND NOMB = " . DB::String($NOMB);
$queryAnimal2.= " AND RGST = " . DB::String($RGST);
$sqlAnimal2 = mysql_query($queryAnimal2) or die(mysql_error());
$oAnimal2 = mysql_fetch_array($sqlAnimal2);
if ($oAnimal)
{
$queryUpdate = "";
$queryUpdate.= "UPDATE tblAnimales SET";
$queryUpdate.= " IdProd = " . DB::Number($IdPr) . ", ";
$queryUpdate.= " IdPa = " . DB::Number($IdPa) . ", ";
$queryUpdate.= " IdMa = " . DB::Number($IdMa) . ", ";
$queryUpdate.= " IdExis = NULL, ";
$queryUpdate.= " IdExtr = NULL, ";
$queryUpdate.= " IdPdre = " . DB::Number($oAnimal2['IdPdre']);
$queryUpdate.= " WHERE IdProd = " . DB::Number($IdPr);
$sqlUpdate = mysql_query($queryUpdate, $cnx) or die(mysql_error());
}
else
{
$queryInsert = "";
$queryInsert.= "INSERT INTO tblAnimales";
$queryInsert.= "(";
$queryInsert.= " IdProd,";
$queryInsert.= " IdPa,";
$queryInsert.= " IdMa,";
$queryInsert.= " IdPdre";
$queryInsert.= ")";
$queryInsert.= " VALUES ";
$queryInsert.= "(";
$queryInsert.= DB::Number($IdPr) . ", ";
$queryInsert.= DB::Number($IdPa) . ", ";
$queryInsert.= DB::Number($IdMa) . ", ";
$queryInsert.= DB::Number($oAnimal2['IdPdre']);
$queryInsert.= ")";
$sqlInsert = mysql_query($queryInsert, $cnx) or die(mysql_error());
}
}
else
{
$registro = $row++;
$mensaje .= "<br> El registro " . $row . " no se ha podido agregar.";
}
}
print_r($Row . ': ' . $NOMB);
print_r('<br>');
$Row++;
$Header++;
}
print_r("Fin 1");
print_r("<br>");
?>
Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat