echo '<p style="text-align:right;">'; echo "\n"; echo "Welcome, guest."; echo "</p>\n"; } ?> --> <?php // Check the form was filled in correctly if (!isset($_GET['username'])) { die("No user specified."); } //include ("/export/home/mclaug67/source_html/public_html/awp/PhotoSite/Connect-webuser.php"); //include ("DB_Functions.php"); $dbh = ConnectDB(); $photodata = ListAllPix($dbh, $_GET['username']); $userid = CheckUsername($dbh, $_GET['username']); if ($_SESSION['username'] == 'Admin') { echo '<div style="text-align:center"><input type="button" value="Delete This Account" onclick="adminDeleteAccount(' . $userid . ')"></div>'; } if ($_GET['username'] != null) { echo '<h2 style="text-align:center;"> ' . $_GET['username'] . ' has ' . count($photodata) . ' picture(s) (Note: Some pictures may be hidden).</h2>'; } if (isset($_SESSION['username'])) { echo '<div style="text-align:center"><input type="button" value="Delete Account" onclick="deleteAccount(' . $_SESSION['user_id'] . ')"></div>'; } echo "<dl>\n"; foreach ($photodata as $thisone) { if (htmlspecialchars($thisone->view) == '0' && !isset($_SESSION['username'])) { // Do nothing if the profile is private and the user is a guest
style="width:auto;height:auto;max-width:500px;max-height:500px;"/> </fieldset> </form> <form enctype="multipart/form-data" method="post" action="set_profile.php"> <fieldset> <legend>Update profile pic</legend> <table> <tr> <td> Choose/change your profile picture: </td> <!-- I wanted to have each option selected display a profile picture preview, but I wasn't sure how to do it --> <td> <select name="photo"> <?php $dbh = ConnectDB(); $photodata = ListAllPix($dbh, $_SESSION['username']); foreach ($photodata as $thisone) { echo '<option value="' . $thisone->photo_id . '">' . $thisone->photo_id . '</option>'; } ?> </select> </td> <td><input type="submit" value="Set Profile Picture"/> </td> </tr> <tr> <td> </td> <td> </td> </tr>
<?php // This is used to delete individual user accounts and all associated comments and photos session_name('reglogin'); session_start(); $userid = $_SESSION['user_id']; include "/export/home/mclaug67/source_html/public_html/awp/PhotoSite/Connect-webuser.php"; include "DB_Functions.php"; $dbh = ConnectDB(); $username = GetUsername($dbh, $userid); $baseDir = "/home/mclaug67/public_html/awp/PhotoSite/UPLOADED/archive/" . $username; $photoList = ListAllPix($dbh, $username); foreach ($photoList as $photo) { $targetname = GetPhotoLocation($dbh, $photo->photo_id); if (!file_exists($targetname)) { die("<p>File doesn't exist.</p>"); } else { try { $junk = RemovePicComments($dbh, $photo->photo_id); unlink($targetname); RemovePicture($dbh, $photo->photo_id); } catch (PDOException $e) { die("error deleting photo"); } } } #remove user dir try { rmdir($baseDir); } catch (PDOException $e) { die("error removing user");