Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.60 KB | None | 0 0
  1. function showpicturedelete()
  2. {
  3. if (isset($_POST['submit'])) {
  4.  
  5. echo $default = $_POST['default'];
  6. $picture = $_POST['picture'];
  7. $id = $_POST['id'];
  8. $this->connect();
  9.  
  10.  
  11. $result = mysql_query("UPDATE `profilepicture` SET `default` ='0' WHERE `id` !='$id'");
  12.  
  13.  
  14. $result = mysql_query("UPDATE `profilepicture` SET `default` ='1' WHERE `id` ='$id'");
  15.  
  16. $this->close();
  17. }
  18. if(isset($_SESSION['userName']))
  19.     {
  20.         $this->connect();
  21.         $username = $_SESSION['userName'];
  22.         $result = mysql_query("SELECT * FROM `profilepicture` WHERE `username` = '$username'");
  23.     while($row = mysql_fetch_array($result))
  24.         {
  25.         $id = row['id'];
  26.         $picture = $row['big'];
  27.         $picturethumb = $row['small']; 
  28.         $default = $row['default'];
  29. ?>
  30. <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
  31. <?php
  32. echo '<a class="thumb" name="thumb" href="' .$picture. '" title="Title #0">';
  33. echo '<img src="' .$picturethumb. '" alt="Title #0" /></a>';
  34. ?>
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. <?php if ($row['default'] == '1') { ?><input name="default" type="radio" value="<?php echo $id; ?>" checked="checked" />
  43.               <br /><?php } else { ?><label><input name="default" type="radio"  value="<?php echo $id; ?>" />
  44.              <br /><?php }
  45.            
  46.            
  47.  
  48.  
  49.  
  50. }
  51.  
  52. echo '<input type="submit" name="submit" value="submit"/></form>';
  53.  
  54. ?>
  55. <script>
  56. function confirmDelete(delUrl) {
  57.   if (confirm("Are you sure you want to delete")) {
  58.    document.location = delUrl;
  59.   }
  60. }
  61. </script>
  62. <input type=button value="Delete" onClick="javascript:confirmDelete('delete.php?big=<?php echo $picture;?>&small=<?php echo $picturethumb;?>')">
  63. <?php
  64. $this->close();
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement