miércoles, 12 de noviembre de 2014

Codigos PHP

Leer Archivo de texto y almacenarlo en un array

<?php
echo '<h1 align=center> Logs de los usuarios de Tacacs+ </h1>';
 

$fileName = "/tmp/backup/logs_tacacs.txt";
$fp = fopen($fileName,"r");
if( $fp == false )
{
  echo ( "Error in opening file" );
  exit();
}

while(!feof($fp))
{
 $a[]=fgets($fp);

}

$count=count($a);
echo '<table border=1>';

for($i=0;$i<$count;$i++)
{
echo '<tr><td>'.$a[$i].'</td></tr>';
}


echo '</table>';

?>



Para ingresar un txt separado por comas y que termine cada linea.

mysql> load data local infile '/tmp/backup/log_tacacs_mod.txt' into table logs fields terminated by ','  lines terminated by '\n' (Dia,Mes,Fecha_dia,Hora,Ano,Ip_dest,Usuario,Vty,Ip_orig,Accion,Id_log,Time,Service,Privilegio,Comando_1,Comando_2);






1 comentario:

  1. The emperor casino - Shootercasino
    The หาเงินออนไลน์ emperor casino. 제왕카지노 The palace casino - poker at any casino. If it wins, then the next draw should be for 카지노사이트 an increase in bet on a particular poker

    ResponderBorrar