Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="de">
- <head>
- <title>CSV-LOADER</title>
- </head>
- <body>
- <h1>CSV-LOADER</h1>
- </body>
- </html>
- <?php
- if(!file_exists("test.csv")){
- echo"<h1>Error! File 'test.csv' Not Found</h1>";
- exit;
- }
- $b = file('test.csv');
- $einträge = count($b);
- echo '<form acion="?">';
- //DROPDOWN ANZAHL
- If (isset($_GET["ANZAHL"])) {
- $anzahleinträge = $_GET["ANZAHL"];
- } else {
- $anzahleinträge = 1;
- }
- echo '<select name="ANZAHL" onchange="this.form.submit()">';
- for ($i = 1; $i <= $einträge; $i++) {
- if ($i == $anzahleinträge) {
- echo '<option value=' . $i . ' selected="selected">' . $i . '</option>';
- continue;
- }
- echo '<option value=' . $i . '>' . $i . '</option>';
- }
- echo '</select>';
- //DROPDOWN SEITE
- If (isset($_GET["SEITE"])) {
- $seitenzahl = $_GET["SEITE"];
- } else {
- $seitenzahl = 1;
- }
- $seiten = ceil($einträge / $anzahleinträge);
- echo '<style> ul#menu li { display:inline;} </style>';
- echo '<ul id=menu>';
- for ($i = 1; $i <= $seiten; $i++) {
- if ($i == $seitenzahl) {
- echo '<li><input style="color:red" type="submit" name="SEITE" value="'.$i.'"></li>';
- continue;
- }
- echo '<li><input type="submit" name="SEITE" value="'.$i.'"></li>';
- }
- echo '</ul>';
- echo '</form>';
- //NUMMERN
- $totalmin = ($anzahleinträge * ($seitenzahl - 1)) + 1;
- $totalmax = $anzahleinträge * $seitenzahl;
- //CSV AUSGABE
- $zähler = 0;
- $file_handle = fopen("test.csv", 'r');
- echo "<table border='1'>";
- while (($line = fgets($file_handle)) !== false) {
- $zähler++;
- if ($zähler > $totalmax or $zähler < $totalmin) {
- continue;
- }
- echo "<tr>";
- echo "<td>" . $line . "<br>" . "</td>";
- echo "<td>" . '<a style="color:red" href="?DEL=' . $zähler . '">' . $zähler . '</a></td>';
- echo "</tr>";
- }
- echo "</table>";
- fclose($file_handle);
- echo "By Steffan Wolter";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement