BARRAUX Arthur
3 years ago
15 changed files with 155 additions and 141 deletions
@ -0,0 +1,16 @@ |
|||
<?php |
|||
|
|||
$connect = mysqli_connect("localhost", "root", "", "ticket"); |
|||
$query = "SELECT * FROM `" .$_POST['bdd'] ."`"; |
|||
$title = array_keys(mysqli_fetch_assoc(mysqli_query($connect, $query))); |
|||
|
|||
header('Content-Type: text/csv; charset=utf-8'); |
|||
header('Content-Disposition: attachment; filename=' .$_POST['bdd'] .'.csv'); |
|||
$output = fopen("php://output", "w"); |
|||
fputcsv($output, $title); |
|||
$result = mysqli_query($connect, $query); |
|||
while($row = mysqli_fetch_assoc($result)) { |
|||
fputcsv($output, $row); |
|||
} |
|||
fclose($output); |
|||
?> |
@ -1,18 +1,39 @@ |
|||
<?php |
|||
include '../session_restraintes.php'; |
|||
?> |
|||
|
|||
$bdd = new PDO('mysql:host=localhost;dbname=ticket;charset:utf8', 'root', ''); |
|||
$reponse = $bdd->query("SELECT DISTINCT * FROM `pannes`"); |
|||
$stream = fopen('export/ticket.csv', 'w'); |
|||
<!DOCTYPE html> |
|||
<html lang="fr"> |
|||
<head> |
|||
<?php include 'include/menu.html'; ?> |
|||
</head> |
|||
|
|||
while($line = $reponse->fetch()) { |
|||
print_r($line); |
|||
echo '<br>'; |
|||
fputcsv( |
|||
$stream, // file |
|||
$line, // arr |
|||
); |
|||
} |
|||
$reponse->closeCursor(); |
|||
fclose($stream); |
|||
?> |
|||
<body> |
|||
<?php include 'include/nav.php'?> |
|||
<form id='form' action="cible/export.php" method="post"> |
|||
<div class="container-champ"> |
|||
<p>Type:</p> |
|||
<div class="champ"> |
|||
<select class="entry" name="type"> |
|||
<option value="csv">CSV</option> |
|||
<!-- <option value="sql">SQL</option> --> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="container-champ"> |
|||
<p>Base:</p> |
|||
<div class="champ"> |
|||
<select class="entry" name="bdd"> |
|||
<option value="pannes">pannes</option> |
|||
<option value="logins">logins</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="container-champ"> |
|||
<div class="submit"> |
|||
<input class="entry" type="submit" value="Download"> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</body> |
|||
</html> |
|||
|
|
@ -1,23 +1,57 @@ |
|||
<?php |
|||
echo '<tr> |
|||
<td class=', $class , ' style="font-weight: bold;" >',$class,'</td> |
|||
<td class=', $class , '>',$line[1],'</td> |
|||
<td class=', $class , '>',$line[2],'</td> |
|||
<td class=', $class , '>',$line[3],'</td> |
|||
<td class=', $class , '>',$line[4],'</td> |
|||
<td class=', $class , '>',$line[5],'</td> |
|||
<td class=', $class , '>',$line[6],'</td> |
|||
<td class=', $class , '>',$line[7],'</td> |
|||
<td class=', $class , '>',$line[8],'</td> |
|||
<td class=', $class , '>',$line[9],'</td> |
|||
<td class=', $class , '>',$line[10],'</td> |
|||
<td class=', $class , '>',$line[11],'</td> |
|||
<td class=', $class , '> |
|||
<label class="switch"> |
|||
<input class="checkbox" type="checkbox" onchange="Slider(\'',$class,'\')"> |
|||
<span class="slider"></span> |
|||
</label> |
|||
</td> |
|||
<td class=',$class,'><input class="edit" type="button" value="edit" onclick="Edit(\'',$class,'\')"></td> |
|||
</tr>'; |
|||
if (isset($line)) { |
|||
echo '<tr> |
|||
<td class=', $class , ' style="font-weight: bold;" >',$class,'</td> |
|||
<td class=', $class , '>',$line[1],'</td> |
|||
<td class=', $class , '>',$line[2],'</td> |
|||
<td class=', $class , '>',$line[3],'</td> |
|||
<td class=', $class , '>',$line[4],'</td> |
|||
<td class=', $class , '>',$line[5],'</td> |
|||
<td class=', $class , '>',$line[6],'</td> |
|||
<td class=', $class , '>',$line[7],'</td> |
|||
<td class=', $class , '>',$line[8],'</td> |
|||
<td class=', $class , '>',$line[9],'</td> |
|||
<td class=', $class , '>',$line[10],'</td>'; |
|||
|
|||
if ($line[11] == 1) { |
|||
echo '<td class=', $class , '><img src="../img/check.png" width="50%"></td>'; |
|||
} |
|||
else { |
|||
echo '<td class=', $class , '><img src="../img/excla.png" width="50%"></td>'; |
|||
} |
|||
|
|||
|
|||
|
|||
echo ' <td class=', $class , '> |
|||
<label class="switch"> |
|||
<input class="checkbox" type="checkbox" onchange="Slider(\'',$class,'\')"> |
|||
<span class="slider"></span> |
|||
</label> |
|||
</td> |
|||
<td class=',$class,'><input class="edit" type="button" value="edit" onclick="Edit(\'',$class,'\')"></td> |
|||
</tr>'; |
|||
} |
|||
else { |
|||
echo '<tr> |
|||
<td class=', $class , ' style="font-weight: bold;" ></td> |
|||
<td class=', $class , '></td> |
|||
<td class=', $class , '></td> |
|||
<td class=', $class , '></td> |
|||
<td class=', $class , '></td> |
|||
<td class=', $class , '></td> |
|||
<td class=', $class , '></td> |
|||
<td class=', $class , '></td> |
|||
<td class=', $class , '></td> |
|||
<td class=', $class , '></td> |
|||
<td class=', $class , '></td> |
|||
<td class=', $class , '><img src="../img/check.png" width="50%"></td> |
|||
<td class=', $class , '> |
|||
<label class="switch"> |
|||
<input class="checkbox" type="checkbox" onchange="Slider(\'',$class,'\')"> |
|||
<span class="slider"></span> |
|||
</label> |
|||
</td> |
|||
<td class=',$class,'><input class="edit" type="button" value="edit" onclick="Edit(\'',$class,'\')"></td> |
|||
</tr>'; |
|||
} |
|||
?> |
Loading…
Reference in new issue