add supresion source

master
Bastien OLLIER 3 years ago
parent 4c20650a4d
commit bb66d7af18

@ -84,9 +84,9 @@ class ControllerAdmin {
function supprimerSource() {
global $dsn,$user,$pass,$vues;
if(isset($_REQUEST["idSource"])) {
if(isset($_REQUEST["source"])) {
$gate = new GatewaySources(new Connection($dsn, $user, $pass));
$gate->deleteSources($_REQUEST["idSource"]);
$gate->deleteSources($_REQUEST["source"]);
}
header("location: index.php?action=goToAdministration");
}

@ -15,10 +15,10 @@ class GatewaySources
);
}
public function deleteSources($idSource)
public function deleteSources($link)
{
$query = "delete from sources where link = :idsource;";
$this->con->executeQuery($query, array(':idsource' => array($idSource, PDO::PARAM_INT)
$query = "delete from sources where link = :link;";
$this->con->executeQuery($query, array(':link' => array($link, PDO::PARAM_STR)
)
);
}

@ -8,8 +8,9 @@
</html>
<?php
foreach ($listeSources as $n){
echo '<form action="index.php?action=supprimerSource&idSource='.$n->getlink().'">';
if(!is_null($listeSources)) {
foreach ($listeSources as $n) {
echo '<form action="index.php?action=supprimerSource&source=' . $n->getlink() . '" method="POST">';
echo "<div class=source>";
echo "<p id=link>";
echo $n->getlink();
@ -18,6 +19,7 @@
echo "</div>";
echo "</form>";
}
}
?>
<form action="index.php">

Loading…
Cancel
Save