Advertisement
Guest User

Untitled

a guest
Jun 15th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. $host = "localhost";
  2. $user = "root";
  3. $password = "";
  4. $db = "demo";
  5. session_start();
  6. $connect = mysqli_connect($host, $user, $password, $db);
  7.  
  8. if(isset($_POST['up'])){
  9. move_uploaded_file($_FILES['file']['tmp_name'],"Imagini/".$_FILES['file']['name']);
  10. $con = mysqli_connect("localhost","root","","demo");
  11. $q = mysqli_query($con,"UPDATE users SET Imag = '".$_FILES['file']['name']."' WHERE User = '".$_SESSION['myusername']."'");
  12. }
  13. $title="Acasa";
  14. $content=
  15. <div id='content_area' align='center'>
  16. <img src='Imagini/user.png' alt='Avatar' class='avatar' width='250' height='250'/><br>
  17. <b><font size='5'> ID: ".$_SESSION["myusername"]."</font></b><br><br>
  18. <form method='post' action='#'>
  19. <input type='submit' name='up' value='Schimbă Avatarul'/>
  20. </form>
  21.  
  22. <form action='#' method='post' enctype='multipart/form-data'>
  23. <input type='file' name='file'>
  24. <input type='submit' name='submit'>
  25. </form>
  26. $que='SELECT * FROM loginform';
  27. $q = mysqli_query($connect,$que);
  28. while($row = mysqli_fetch_assoc($q)){
  29. echo $row['User'];
  30. if($row['Img'] == ""){
  31. echo "<img width='100' height='100' src='Imagini/user.png' alt='Default Profile Pic'>";
  32. } else {
  33. echo "<img width='100' height='100' src='Imagini/".$row['image']."' alt='Profile Pic'>";
  34. }
  35.  
  36. }
  37.  
  38. <br>
  39. <if<br>rame width='560' height='315' src='https://www.youtube.com/embed/zDHieyjwi7g' frameborder='0' allow='autoplay; encrypted-media' allowfullscreen></iframe>
  40. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement