Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
- <title>Пользователи Интернет</title>
- </head>
- <body>
- <?php
- $fp = fopen('/home/andrew/acl_terminet_rules', 'rt');
- echo "<table border = 1>";
- if ($fp)
- {
- while (!feof($fp))
- {
- $mytext = fgets($fp, 999);
- list($ip_addr, $username) = explode("#", $mytext);
- echo "<tr>";
- echo "<td>".$ip_addr."</td>";
- echo "<td>".$username."</td>";
- echo "</tr>";
- }
- }
- else echo "Ошибка при открытии файла";
- fclose($fp);
- ?>
- <form action="/var/www/html/insert.php">
- <p><input type="button" name="press" value=" Синхронизация с БД "></p>
- </form>
- </body>
- </html>
- ########################################## ФАЙЛ 2 ##########################################
- <?php
- $fp = fopen('/home/andrew/acl_terminet_rules', 'rt');
- mysql_connect("localhost", "root", "P@ssw0rd") or die (mysql_error ());
- mysql_select_db("testdb") or die(mysql_error());
- if ($fp)
- {
- while (!feof($fp))
- {
- $mytext = fgets($fp, 999);
- list($ip_addr, $username) = explode("#", $mytext);
- $strSQL = "INSERT INTO acl_terminet_rules(ip_addr,username) VALUES('$ip_addr','$username')";
- mysql_query($strSQL) or die (mysql_error());
- }
- }
- else echo "Ошибка при открытии файла";
- fclose($fp);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement