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 |
<?php |
||||
include '../session_restraintes.php'; |
include '../session_restraintes.php'; |
||||
|
?> |
||||
|
|
||||
$bdd = new PDO('mysql:host=localhost;dbname=ticket;charset:utf8', 'root', ''); |
<!DOCTYPE html> |
||||
$reponse = $bdd->query("SELECT DISTINCT * FROM `pannes`"); |
<html lang="fr"> |
||||
$stream = fopen('export/ticket.csv', 'w'); |
<head> |
||||
|
<?php include 'include/menu.html'; ?> |
||||
|
</head> |
||||
|
|
||||
while($line = $reponse->fetch()) { |
<body> |
||||
print_r($line); |
<?php include 'include/nav.php'?> |
||||
echo '<br>'; |
<form id='form' action="cible/export.php" method="post"> |
||||
fputcsv( |
<div class="container-champ"> |
||||
$stream, // file |
<p>Type:</p> |
||||
$line, // arr |
<div class="champ"> |
||||
); |
<select class="entry" name="type"> |
||||
} |
<option value="csv">CSV</option> |
||||
$reponse->closeCursor(); |
<!-- <option value="sql">SQL</option> --> |
||||
fclose($stream); |
</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 |
<?php |
||||
echo '<tr> |
if (isset($line)) { |
||||
<td class=', $class , ' style="font-weight: bold;" >',$class,'</td> |
echo '<tr> |
||||
<td class=', $class , '>',$line[1],'</td> |
<td class=', $class , ' style="font-weight: bold;" >',$class,'</td> |
||||
<td class=', $class , '>',$line[2],'</td> |
<td class=', $class , '>',$line[1],'</td> |
||||
<td class=', $class , '>',$line[3],'</td> |
<td class=', $class , '>',$line[2],'</td> |
||||
<td class=', $class , '>',$line[4],'</td> |
<td class=', $class , '>',$line[3],'</td> |
||||
<td class=', $class , '>',$line[5],'</td> |
<td class=', $class , '>',$line[4],'</td> |
||||
<td class=', $class , '>',$line[6],'</td> |
<td class=', $class , '>',$line[5],'</td> |
||||
<td class=', $class , '>',$line[7],'</td> |
<td class=', $class , '>',$line[6],'</td> |
||||
<td class=', $class , '>',$line[8],'</td> |
<td class=', $class , '>',$line[7],'</td> |
||||
<td class=', $class , '>',$line[9],'</td> |
<td class=', $class , '>',$line[8],'</td> |
||||
<td class=', $class , '>',$line[10],'</td> |
<td class=', $class , '>',$line[9],'</td> |
||||
<td class=', $class , '>',$line[11],'</td> |
<td class=', $class , '>',$line[10],'</td>'; |
||||
<td class=', $class , '> |
|
||||
<label class="switch"> |
if ($line[11] == 1) { |
||||
<input class="checkbox" type="checkbox" onchange="Slider(\'',$class,'\')"> |
echo '<td class=', $class , '><img src="../img/check.png" width="50%"></td>'; |
||||
<span class="slider"></span> |
} |
||||
</label> |
else { |
||||
</td> |
echo '<td class=', $class , '><img src="../img/excla.png" width="50%"></td>'; |
||||
<td class=',$class,'><input class="edit" type="button" value="edit" onclick="Edit(\'',$class,'\')"></td> |
} |
||||
</tr>'; |
|
||||
|
|
||||
|
|
||||
|
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