Guest User

samlple.php

a guest
Feb 11th, 2016
74
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. require('config.php');
  3. session_start();
  4. if(isset($_POST['submit'])){
  5. move_uploaded_file($_FILES['file']['tmp_name'],"pictures/".$_FILES['file']['name']);
  6. mysqli_query($new,"UPDATE users SET picture = '".$_FILES['file']['name']."' WHERE uname = '".$_SESSION['uname']."'");
  7. }
  8. if($_SESSION['picture'] == ""){
  9. echo "<img width='100' height='100' src='pictures/bot.png' alt='Default profile pic'>";
  10. }else{
  11. echo "<img width='100' height='100' src='pictures/".$_SESSION['picture']."'>";
  12. }
  13. ?>
  14. <form action="profile.php" method="post" enctype="multipart/form-data">
  15. <input type="file" name="file"> <button type="submit" name="submit">submit</button>
  16. </form>
RAW Paste Data