Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. session_start();
  2. require_once('../../includes/connect.php');
  3. require_once('../includes/logged-in.php');
  4.  
  5.  
  6. $img_id = $_POST['img_id'];
  7.  
  8.  
  9.  
  10. $get_info = mysqli_query($con, "SELECT * FROM user_images WHERE record_id='$img_id'") or die(mysqli_query($con));
  11.  
  12. while($row=mysqli_fetch_assoc($get_info)) {
  13. $img_path = $row['img_path'];
  14. $img_url = $row['img_url'];
  15.  
  16. unlink($img_path);
  17. $delete = mysqli_query($con, "DELETE FROM user_images WHERE record_id='$img_id'") or die(mysqli_query($con));
  18.  
  19. $check_profile = mysqli_query($con, "SELECT * FROM users WHERE user_id_number='$logged_in_user_id'") or die(mysqli_error($con));
  20. while($row=mysqli_fetch_assoc($check_profile)) {
  21. $img_check = $row['profile_img_url'];
  22.  
  23. if($img_check==$img_url) {
  24.  
  25. $default_profile_img = $site_url . 'accounts/img/default-user.png';
  26. $update = mysqli_query($con, "UPDATE users SET profile_img_url='$default_profile_img' WHERE user_id_number='$logged_in_user_id'") or die(mysqli_query($con));
  27. }
  28. }
  29.  
  30.  
  31. //THIS SEEMS TO BE WEHRE THE PROBLEM IS, THIS STATEMENT IS DEFINITELY TRUE, THE ACTIVE THEME IS 1
  32. if($active_theme==='1') {
  33. $check_header_bg = mysqli_query($con, "SELECT * FROM theme_1_settings WHERE belongs_to_user_id='$logged_in_user_id'") or die(mysqli_error($con));
  34. while($row = mysqli_fetch_assoc($check_header_bg)) {
  35. $bg_img_check = $row['header_img_url'];
  36.  
  37. if($bg_img_check==$img_url) {
  38. $default_header_img = $site_url . 'accounts/img/themes/basic-1/header-heart-sucker.png';
  39. $update = mysqli_query($con, "UPDATE theme_1_settins SET header_img_url='$default_header_img' WHERE belongs_to_user_id='$logged_in_user_id'") or die(mysqli_error($con));
  40. }
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement