Jump to content
Fórum Script Brasil
  • 0

Quero Separar


jhonnywg
 Share

Question

bem eu to querendo ter um arquivo txt so que nesse arquivo tem txt e numeros IP eu quero saber se tem como eu separ os numeros ip dos testa em tabelas diferentes

192.168.9.2 - - [22/Jul/2004:01:37:55 -0300] "OPTIONS / HTTP/1.1" 302 14 "-" "Microsoft-WebDAV-MiniRedir/5.1.2600"

pra que u posa colocar por ordem de ip:??

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

esse e o codigo que eu to usando

<?php
$fp = fopen ("order.txt","r");

if (!$fp)
{
	echo '<p>não esta dando.</strong></p>';
	exit;
}
$tabela ="";
while (!feof($fp))
{
	$order = fgets($fp, 999);
	$tabela .= "\n
  	<tr>
    <td><font size=2>".$order."</font></td>
  	</tr>";
}

	$html = "\n
    <html>
    	<body>
      <table border=3  width=100%>
      	<tr>
        <td></td>
            	
      	</tr>
      	".$tabela."
      </table>
    	</body>
    </html>";
    

print ($html);
?>

Link to comment
Share on other sites

  • 0

para cada linha você explode a linha com separator --

$explode=array();

$ip[$i]=array();

$description=array();

$content=file($arquivo);

for($i=0;$i< count($content);$i++)

{

$explode[$i]=explode("--",$content[$i]);

$ip[$i]=$explode[$i][0];

$description[$i]=$explode[$i][1];

}

array_multisort($ip,SORT_ASC, SORT_STRING,$description);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.7k
    • Total Posts
      648.4k
×
×
  • Create New...