BARRAUX Arthur
3 years ago
13 changed files with 68 additions and 128 deletions
Binary file not shown.
@ -1,22 +1,22 @@ |
|||
<?php |
|||
|
|||
$bdd = new PDO('mysql:host=localhost;dbname=ticket;charset:utf8', 'root', ''); |
|||
$bdd = new SQLite3('../../database/ticket_panne.db', SQLITE3_OPEN_READWRITE); |
|||
|
|||
$req = $bdd->prepare('INSERT INTO pannes(dates, details, lieu, salle, pos, materiel, marque, model, nserie, demandeur, traitement) VALUES(:dates, :details, :lieu, :salle, :pos, :materiel, :marque, :model, :nserie, :demandeur, :traitement)'); |
|||
$stmt = $bdd->prepare('INSERT INTO pannes(dates, details, lieu, salle, pos, materiel, marque, model, nserie, demandeur, traitement) VALUES(:dates, :details, :lieu, :salle, :pos, :materiel, :marque, :model, :nserie, :demandeur, :traitement)'); |
|||
|
|||
$req->execute(array( |
|||
'dates' => $_POST['dates'], |
|||
'details' => $_POST['details'], |
|||
'lieu' => $_POST['lieu'], |
|||
'salle' => $_POST['salle'], |
|||
'pos' => $_POST['pos'], |
|||
'materiel' => $_POST['materiel'], |
|||
'marque' => $_POST['marque'], |
|||
'model' => $_POST['model'], |
|||
'nserie' => $_POST['nserie'], |
|||
'demandeur' => $_POST['demandeur'], |
|||
'traitement' => 0 |
|||
)); |
|||
$stmt->bindValue(':dates', $_POST['dates']); |
|||
$stmt->bindValue(':details', $_POST['details']); |
|||
$stmt->bindValue(':lieu', $_POST['lieu']); |
|||
$stmt->bindValue(':salle', $_POST['salle']); |
|||
$stmt->bindValue(':pos', $_POST['pos']); |
|||
$stmt->bindValue(':materiel', $_POST['materiel']); |
|||
$stmt->bindValue(':marque', $_POST['marque']); |
|||
$stmt->bindValue(':model', $_POST['model']); |
|||
$stmt->bindValue(':nserie', $_POST['nserie']); |
|||
$stmt->bindValue(':demandeur', $_POST['demandeur']); |
|||
$stmt->bindValue(':traitement', 0); |
|||
|
|||
$stmt->execute(); |
|||
|
|||
echo 'Votre ticket à bien été pris en compte'; |
|||
?> |
|||
|
@ -1,8 +1,15 @@ |
|||
<?php |
|||
$decode = json_decode($_POST['value'], TRUE); |
|||
$bdd = new PDO('mysql:host=localhost;dbname=ticket;charset:utf8', 'root', ''); |
|||
$update = $bdd->query('UPDATE `logins` SET `pwd` = "' .$decode['pwd'] .'" WHERE `login` = "' .$decode['login'] .'"'); |
|||
$bdd = new SQLite3('../../database/ticket_panne.db', SQLITE3_OPEN_READWRITE); |
|||
|
|||
$traitement = $bdd->query("SELECT * FROM `logins` WHERE `login`= '" .$decode['login'] ."'"); |
|||
print_r(json_encode($traitement->fetch())); |
|||
$stmt = $bdd->prepare('UPDATE `logins` SET `pwd` = :pwd WHERE `login` = :login'); |
|||
$stmt->bindValue(':pwd', $decode['pwd']); |
|||
$stmt->bindValue(':login', $decode['login']); |
|||
|
|||
$stmt->execute(); |
|||
|
|||
$select = $bdd->prepare("SELECT * FROM `logins` WHERE `login` = :login"); |
|||
$select->bindValue(':login', $decode['login']); |
|||
$traitement = $select->execute(); |
|||
print_r(json_encode($traitement->fetchArray())); |
|||
?> |
@ -1,9 +1,9 @@ |
|||
<?php |
|||
$bdd = new PDO('mysql:host=localhost;dbname=ticket;charset:utf8', 'root', ''); |
|||
$bdd = new SQLite3('../../database/ticket_panne.db', SQLITE3_OPEN_READWRITE); |
|||
|
|||
$update = $bdd->query("UPDATE pannes SET traitement = " .$_POST['is_checked'] ." WHERE ID = " .$_POST['id']); |
|||
|
|||
$traitement = $bdd->query("SELECT traitement FROM pannes WHERE ID=" .$_POST['id']); |
|||
$res = $traitement->fetch()['traitement']; |
|||
$res = $traitement->fetchArray()['traitement']; |
|||
echo $res; |
|||
?> |
@ -1,79 +0,0 @@ |
|||
-- phpMyAdmin SQL Dump |
|||
-- version 5.1.1 |
|||
-- https://www.phpmyadmin.net/ |
|||
-- |
|||
-- Host: localhost |
|||
-- Generation Time: Oct 30, 2021 at 07:45 PM |
|||
-- Server version: 10.4.21-MariaDB |
|||
-- PHP Version: 8.0.10 |
|||
|
|||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; |
|||
START TRANSACTION; |
|||
SET time_zone = "+00:00"; |
|||
|
|||
|
|||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; |
|||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; |
|||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; |
|||
/*!40101 SET NAMES utf8mb4 */; |
|||
|
|||
-- |
|||
-- Database: `ticket` |
|||
-- |
|||
|
|||
-- -------------------------------------------------------- |
|||
|
|||
-- |
|||
-- Table structure for table `logins` |
|||
-- |
|||
|
|||
CREATE TABLE `logins` ( |
|||
`login` varchar(255) NOT NULL, |
|||
`pwd` varchar(255) NOT NULL |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
|||
|
|||
-- -------------------------------------------------------- |
|||
|
|||
-- |
|||
-- Table structure for table `pannes` |
|||
-- |
|||
|
|||
CREATE TABLE `pannes` ( |
|||
`ID` int(11) NOT NULL, |
|||
`dates` date NOT NULL, |
|||
`details` text NOT NULL, |
|||
`lieu` text NOT NULL, |
|||
`salle` varchar(255) NOT NULL, |
|||
`pos` text NOT NULL, |
|||
`materiel` varchar(255) NOT NULL, |
|||
`marque` varchar(255) NOT NULL, |
|||
`model` varchar(255) NOT NULL, |
|||
`nserie` text NOT NULL, |
|||
`demandeur` text NOT NULL, |
|||
`traitement` tinyint(1) NOT NULL |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
|||
|
|||
-- |
|||
-- Indexes for dumped tables |
|||
-- |
|||
|
|||
-- |
|||
-- Indexes for table `pannes` |
|||
-- |
|||
ALTER TABLE `pannes` |
|||
ADD PRIMARY KEY (`ID`); |
|||
|
|||
-- |
|||
-- AUTO_INCREMENT for dumped tables |
|||
-- |
|||
|
|||
-- |
|||
-- AUTO_INCREMENT for table `pannes` |
|||
-- |
|||
ALTER TABLE `pannes` |
|||
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; |
|||
COMMIT; |
|||
|
|||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; |
|||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; |
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; |
Loading…
Reference in new issue