Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PROFILO PHP
- <?php
- include('db_con.php');
- if (isset($_SESSION['username']))
- {$username = isset($_SESSION['username']) ? $_SESSION["username"] : ""; header('Location: main.php?step=profile.php');}
- /*-
- else
- {
- header('Location: main.php?step=sign_up.php');
- }
- -*/
- ?>
- PROFILO HTML
- <!-- INIZO PHP -->
- <?php
- include('navbar.php');
- ?>
- <div class="clearfix card mb-3 cover" >
- <div class="clearfix filter">
- <div class="clearfix scrivere" >
- <div class="clearfix card-body" >
- <!--<div onclick="document.getElementById('file').click(); return false;" id="files" title="Sfondo Profilo">
- <img id="image" title="Sfondo Profilo" style="
- position: center center;
- position: relative;
- display: table;
- display: table-cell;
- vertical-align: middle;
- text-align: center;
- z-index: 1;
- background:#bf4040;
- width: 100%;
- height:100%;
- position: relative;
- z-index: 0;
- opacity: 0.7;">
- </div>
- <input id="file" class="clearfix" type="file" name="file" onchange="showImage.call(this)" style="visibility: hidden;">-->
- </div>
- </div>
- </div>
- </div>
- <br>
- <center class="phpfor"><?php echo $_SESSION['username']; ?></center><br>
- <center>
- <div id="Img" class="imagy" onclick="document.getElementById('file').click(); return false;" class="clearfix btnr" id="files" title="Immagine Profilo">
- <img src="" class="put" id="image">
- </div>
- </center>
- <input id="file" class="clearfix" type="file" name="file" onchange="showImage.call(this)" style="visibility: hidden;">
- <div class="footer "></div>
- <script>
- function showImage(){
- if (this.files && this.files[0]) {
- var obj= new FileReader();
- obj.onload = function(data){
- var image= document.getElementById("image")
- image.src=data.target.result;
- image.style.display="block";
- }
- obj.readAsDataURL(this.files[0]);
- }
- }
- </script>
- ACCESSO PHP
- <?php
- include('db_con.php');
- if (isset($_POST['login']))
- {
- $email = isset($_POST['email']) ? $_POST["email"] : "";
- $password = isset($_POST['password']) ? $_POST["password"] : "";
- if(empty($email) || empty($password))
- {
- header("Location: main.php?step=log_in.php&campiok=4");
- }
- elseif (strlen($password) < 6)
- {
- header("Location: main.php?step=log_in.php&campiok=5");
- }
- else
- {
- $q = $db->prepare("
- SELECT
- *
- FROM
- users
- WHERE
- email = :email
- ");
- $q->execute([
- ":email" => $email,
- ]);
- if(($row = $q->fetch(PDO::FETCH_ASSOC))&& password_verify($password, $row["password"]))
- {
- $_SESSION["username"] = $row["username"];
- $_SESSION["email"] = $email;
- header("Location: main.php?step=profile.php");
- exit();
- }
- else
- {
- header("Location: main.php?step=log_in.php&campiok=6");
- }
- }
- }
- else
- {
- header("Location: main.php?step=log_in.php");
- }
- ?>
- ELIMINAZIONE PHP
- <?php
- include('db_con.php');
- if (isset($_SESSION['username']) && isset($_POST['delete']))
- {
- $username = isset($_SESSION['username']) ? $_SESSION["username"] : "";
- if (empty($_SESSION['username']))
- {
- header('Location: main.php?step=log_in.php');
- }
- else{
- $q = $db->prepare("
- SELECT
- *
- FROM
- users
- WHERE
- username = :username
- ");
- $q->execute([
- ":username" => $username,
- ]);
- if(($row = $q->fetch(PDO::FETCH_ASSOC))) {
- $q = $db->prepare("
- DELETE FROM users WHERE username=:username
- ");
- $q->execute([
- ":username" => $username
- ]); }
- }
- }
- else{ header('Location: main.php?step=delete.php'); }
- /*-
- include('db_con.php');
- $q = $db->prepare("
- DELETE FROM users WHERE username=:username
- ");
- if ($q->execute([":username" => $username]))
- {
- session_destroy() && header('Location: main.php?step=sign_up.php');
- }
- else
- {
- echo "Errore nella query: " . $q->errorInfo();
- }
- -*/
- ?>
- ELIMINAZIONE HTML
- <?php include('navbar.php');
- ?>
- <div class="clearfix card mb-3 cover">
- <div class="clearfix filter">
- <div class="clearfix scrivere">
- <div class="clearfix card-body copy">
- <div class="clearfix card-title scrivere logo font-weight-bold"><br></div>
- </div>
- </div>
- </div>
- </div>
- <center>
- <!--PROBLEMA IN ACTION-->
- <form class="clearfix single form-control" action="" method="POST">
- <center class="phpfor"><?php echo $_SESSION['username']; ?></center><br>
- <p id="emailHelp" class="clearfix form-text text error text-center">Vuoi procedere?</p>
- <div class="clearfix form-group">
- <div class="clearfix col-sm-10">
- <a href="javascript:history.back();" class="clearfix btn clearfix">Annulla</a>
- </div>
- </div>
- <div class="clearfix form-group">
- <div class="clearfix col-sm-10">
- <button type="submit" class="clearfix btn clearfix" name="delete">Elimina</button>
- </div>
- </div>
- </form>
- </center>
- <div class="footer "></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement