Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("../common/reconnect.php");
- include("../common/functions.inc");
- include("../common/db_connect_pdo.php");
- if(!HaveAccess(50))
- echo "<script type='text/javascript'>document.location.replace('../menu.php');</script>";
- if(isset($_POST['InputTarget']) && isset($_POST['InputPower']) && isset($_POST['InputType']) && isset($_POST['InputFinal']))
- {
- echo "good";
- // if(empty($_POST['InputName']))
- // echo "<script type='text/javascript'>document.location.replace(addTarget.php');</script>";
- // else
- // {
- // $name = mysqli_real_escape_string($db, $_POST['InputName']);
- // // Checking if target is already registered
- // $query = "SELECT COUNT(id) as total FROM cibles WHERE name = '".$name."' ";
- // $result = mysqli_query($db, $query);
- // $data = mysqli_fetch_assoc($result);
- // if( $data['total'] == 0) // If == 0, then can register
- // {
- // // Registering target
- // $query = "INSERT INTO cibles(name) VALUES('".$name."')";
- // $result = mysqli_query($db, $query);
- // echo "<script type='text/javascript'>document.location.replace('../menu.php');</script>";
- // }
- // }
- }
- else
- {
- echo "<p style='color:white;'>";
- echo isset($_POST['InputTarget'])." * ".isset($_POST['InputPower'])." - ".isset($_POST['InputType'])." + ".isset($_POST['InputFinal']);
- echo "<br>todo";
- echo "</p>";
- }
- ?>
- <!DOCTYPE html>
- <head>
- <meta charset="UTF-8">
- <link rel="stylesheet" href="../css/bootstrap.min.css">
- <link rel="stylesheet" href="../css/custom.css">
- <title>Add Informations</title>
- <link rel="icon" href="pics/favicon.ico" type="image/x-icon">
- </head>
- <body class="fbi_background">
- </br></br></br>
- <div class="col-md-4 offset-md-4">
- <form action="addInformations.php" method="post">
- <!-- First step -->
- <div class="form-group" id="firstStep">
- <label for="InputTarget">Choose a target</label>
- <select name="InputTarget" size="1" class="form-control" onchange="secondStep()" id="firstStepInput" required>
- <?php
- $reponse = $bddPDO->prepare('SELECT id, name FROM cibles');
- $reponse->execute();
- while ($donnees = $reponse->fetch())
- {
- echo '<option>'.$donnees['name'].'</option>';
- }
- ?>
- </select>
- <small id="targetHelp" class="form-text text-muted">Choose a target</small>
- </div>
- <!-- Second step -->
- <div class="form-group" id="secondStep">
- <label for="InputPower">Power needed to access this information</label>
- <input type="number" name="InputPower" class="form-control" placeholder="50" autocomplete="off" onchange="thirdStep()" id="secondStepInput" required>
- </div>
- <!-- Third step -->
- <div class="form-group" id="thirdStep">
- <label for="InputType">Choose a type of information</label>
- <select name="InputType" size="1" class="form-control" onchange="fourthStep()" id="thirdStepInput" required>
- <?php
- $reponse = $bddPDO->prepare('SELECT id, libelle FROM type');
- $reponse->execute();
- while ($donnees = $reponse->fetch())
- {
- echo '<option>'.$donnees['libelle'].'</option>';
- }
- ?>
- </select>
- <small id="typeHelp" class="form-text text-muted">Choose a type of information</small>
- </div>
- <!-- Fourth step -->
- <div class="form-group" id="fourthStepText">
- <label for="InputFinal">Enter the information</label>
- <input type="text" name="InputFinal" class="form-control" placeholder="50" autocomplete="off" onchange="lastStep()" id="fourthStepTextInput">
- <small id="finalHelp" class="form-text text-muted">Fill it with the information you wish</small>
- </div>
- <div class="form-group" id="fourthStepImage">
- <label for="InputFinal">Choose an image/label>
- <input type="file" name="InputFinal" class="form-control" accept="image/png, image/jpeg, image/jpg" id="fourthStepImageInput">
- <small id="finalHelp" class="form-text text-muted">Choose the image you wish</small>
- </div>
- <button type="submit" class="btn btn-primary" id="buttonValidate">Click to add Information</button>
- </form>
- </div>
- <script type="text/javascript">
- var secondStepDone = false;
- var thirdStepDone = false;
- document.getElementById('secondStep').style.display = "none";
- document.getElementById('thirdStep').style.display = "none";
- document.getElementById('fourthStepText').style.display = "none";
- document.getElementById('fourthStepImage').style.display = "none";
- document.getElementById('buttonValidate').style.display = "none";
- document.getElementById('fourthStepImageInput').addEventListener('load', lastStep, false);
- function secondStep(){
- if(!secondStepDone){
- secondStepDone = true;
- //document.getElementById('firstStepInput').disabled = true;
- document.getElementById('secondStep').style.display = "block";
- }
- }
- function thirdStep(){
- if(!thirdStepDone){
- thirdStepDone = true;
- //document.getElementById('secondStepInput').disabled = true;
- document.getElementById('thirdStep').style.display = "block";
- }
- }
- function fourthStep(){
- document.getElementById('thirdStepInput').disabled = true;
- if(document.getElementById('thirdStepInput').value == "Image") {
- document.getElementById('fourthStepImage').style.display = "block";
- }
- else {
- document.getElementById('fourthStepText').style.display = "block";
- }
- document.getElementById('buttonValidate').style.display = "block";
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement