plz help get delete function working
Posted: Thu Mar 18, 2004 6:07 pm
the issue is that on my server it will remove pictures et al, infact the only thing it doesn't remove is the main user database file. but on the deployment server, the pictures and about half the table entries remain.
in both cases the pics are considered to be part of the server processes. (nobody on the deployment and apache on my server)
i am seeking advice on how to actually get the pictures deleted. i think the tables might be a result of the pictures not deleting
delete function code:thanx in advance for any help
in both cases the pics are considered to be part of the server processes. (nobody on the deployment and apache on my server)
i am seeking advice on how to actually get the pictures deleted. i think the tables might be a result of the pictures not deleting
delete function code:
Code: Select all
function misc(){ # misc controls
include("/home/dcfydllc/includes/fyd.altincs.php"); # includes file (precautionary measure)
$un=$_COOKIE['un']; $pw=$_COOKIE['pw']; # variables to talk to the db
$db=mysql_connect($host, $login3, $pass3) or die("cannot access mysql"); # connect to the db
$fyd=mysql_select_db($dbname, $db) or die("cannot access db"); # get the db
$memfind=mysql_query("SELECT uid FROM users WHERE username='$un' AND password='$pw'", $db);
if(mysql_num_rows($memfind)==0){ # problem
cae(); // call the forum access error page
}else{ # we found the user
$maininf=mysql_fetch_array($memfind); $uid=$maininf['uid']; $worked=0;
$result='<h1 class="require">REPORT ALL ERRORS TO: ADMIN @ FindYourDesire.com</h1>';
if(isset($_POST['act'])&&($_POST['act']=='reset')){ # reset the votes on the user
$rstat=mysql_query("UPDATE stats SET pvt='0', pvc='0' WHERE uid='$uid'", $db);
if(mysql_affected_rows($db)>'-1'){ $worked=1; } // did stats get reset
else{ // there was a problem
$errno=mysql_errno($db); $error=mysql_error($db); $result="<p>stats:$errno: $error";
} // error has been recorded
$rvote=mysql_query("DELETE FROM votes WHERE voteeuid='$uid'", $db);
if((mysql_affected_rows($db)>'-1')&&($worked)){ $result="<p>Your desirability has been reset.</p>"; }
else{ // there was a problem
$errno=mysql_errno($db); $error=mysql_error($db); $result.="<br />votes:$errno: $error</p>";
} // error has been recorded
}elseif(isset($_POST['act'])&&($_POST['act']=='delete')){ // deleting your profile
echo " <p>Deleting $un...\n"; $imgbase=$faup; $npib=$fuup;
foreach($images as $key=>$value){ # for each possible picture
echo " <br />Checking for $value\n"; flush(); $pica=$imgbase.$key.$un.'.jpg';
$picb=$imgbase.'old.'.$key.$un.'.jpg'; $picc=$npib.$key.$un.'.jpg';
/* delete the pics if they exist */
if(is_file($pica)){ unlink($pica); echo " <br />Removing $pica\n"; }
if(is_file($picb)){ unlink($picb); echo " <br />Removing $picb\n"; }
if(is_file($picc)){ unlink($picc); echo " <br />Removing $picc\n"; }
}
echo " <br />Deleting you from table BIO"; flush();
$dfs=mysql_query("DELETE FROM bio WHERE uid='$uid'", $db);
if(mysql_affected_rows($db)==1){ // successful deletion
echo " <br />Removed $un (user # $uid) from table BIO";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db); $delerr=1;
echo "<br />Bio:$errno: $error";
}
echo " <br />Deleting you from table COMMENTS"; flush();
$dfs=mysql_query("DELETE FROM comments WHERE ctuid='$uid'", $db);
if(mysql_affected_rows($db)==1){
echo " <br />Removed $un (user # $uid) from table COMMENTS";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db);
echo "<br />Comments:$errno: $error";
}
echo " <br />Deleting you from table FRIENDS"; flush();
$dfs=mysql_query("DELETE FROM friends WHERE uid='$uid'", $db);
if(mysql_affected_rows($db)==1){
echo " <br />Removed $un (user # $uid) from table FRIENDS";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db);
echo "<br />Friends:$errno: $error";
}
echo " <br />Deleting you from table INTERESTS"; flush();
$dfs=mysql_query("DELETE FROM interests WHERE uid='$uid", $db);
if(mysql_affected_rows($db)==1){
echo " <br />Removed $un (user # $uid) from table INTERESTS";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db); $delerr=1;
echo "<br />Interests:$errno: $error";
}
echo " <br />Deleting you from table MAIL"; flush();
$dfs=mysql_query("DELETE FROM mail WHERE to_id='$uid'", $db);
if(mysql_affected_rows($db)==1){
echo " <br />Removed $un (user # $uid) from table MAIL";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db);
echo "<br />Mail:$errno: $error";
}
echo " <br />Deleting you from table MSGS"; flush();
$dfs=mysql_query("DELETE FROM msgs WHERE to_id='$uid'", $db);
if(mysql_affected_rows($db)==1){
echo " <br />Removed $un (user # $uid) from table MSGS";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db);
echo "<br />Msgs:$errno: $error";
}
echo " <br />Deleting you from table MATCH"; flush();
$dfs=mysql_query("DELETE FROM personality WHERE uid='$uid'", $db);
if(mysql_affected_rows($db)==1){
echo " <br />Removed $un (user # $uid) from table MATCH";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db);
echo "<br />Match:$errno: $error";
}
echo " <br />Deleting you from table PESTS"; flush();
$dfs=mysql_query("DELETE FROM pests WHERE uid='$uid'", $db);
if(mysql_affected_rows($db)==1){
echo " <br />Removed $un (user # $uid) from table PESTS";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db);
echo "<br />Pests:$errno: $error";
}
echo " <br />Deleting you from table PERSONALITY"; flush();
$dfs=mysql_query("DELETE FROM personality WHERE uid='$uid'", $db);
if(mysql_affected_rows($db)==1){
echo " <br />Removed $un (user # $uid) from table PERSONALITY";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db); $delerr=1;
echo "<br />Personality:$errno: $error";
}
echo " <br />Deleting you from table POSTS"; flush();
$dfs=mysql_query("DELETE FROM posts WHERE author='$uid'", $db);
if(mysql_affected_rows($db)==1){
echo " <br />Removed $un (user # $uid) from table POSTS";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db);
echo "<br />Posts:$errno: $error";
}
echo " <br />Deleting you from table STATS"; flush();
$dfs=mysql_query("DELETE FROM stats WHERE uid='$uid'", $db);
if(mysql_affected_rows($db)==1){
echo " <br />Removed $un (user # $uid) from table STATS";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db); $delerr=1;
echo "<br />Stats:$errno: $error";
}
echo " <br />Deleting you from table THREADS"; flush();
$dfs=mysql_query("DELETE FROM threads WHERE thread_auth='$uid'", $db);
if(mysql_affected_rows($db)==1){
echo " <br />Removed $un (user # $uid) from table THREADS";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db);
echo "<br />Threads:$errno: $error";
}
echo " <br />Deleting you from table TOPS"; flush();
$dfs=mysql_query("DELETE FROM tops WHERE memuid='$uid'", $db);
if(mysql_affected_rows($db)==1){
echo " <br />Removed $un (user # $uid) from table TOPS";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db); $delerr=1;
echo "<br />Tops:$errno: $error";
}
echo " <br />Deleting you from table VOTES"; flush();
$dfs=mysql_query("DELETE FROM votes WHERE voteeuid='$uid'", $db); // votes on
if(mysql_affected_rows($db)==1){
echo " <br />Removed $un (user # $uid) from table VOTES";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db);
echo "<br />Votes:$errno: $error";
}
$dfs=mysql_query("DELETE FROM votes WHERE voteruid='$uid'", $db); // votes made this time period
if(mysql_affected_rows($db)==1){
echo " <br />Removed $un (user # $uid) from table VOTES";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db);
echo "<br />Votes:$errno: $error";
}
echo '</p>';
if(!($delerr)){ # stats,bio,interests,personality,tops did not result in an error (may be expanded to more)
echo " <br />Deleting you from table USERS";
$dfs=mysql_query("DELETE FROM users WHERE uid='$uid'", $db);
if(mysql_affected_rows($db)==1){
echo " <br />Deletion complete.</p>\n$errs";
}else{ // error
$errno=mysql_errno($db); $error=mysql_error($db); $delerr=1;
echo "<br />Users:$errno: $error</p>\n$errs";
}
}else{ // something is wrong
echo " <br />Deletion encountered errors. uid=$uid username=$un";
echo " <br />$errs</p>";
}
}
// make the page
echo <<<END
$result
<h2>NOTICE: THE FOLLOWING OPTIONS <strong>CANNOT</strong> BE UNDONE</h2>
<script language="javascript" type="text/javascript">
function doubleCheck(){
var what=document.misc.act.value;
if(what=="reset"){
return confirm("Are you sure you want to reset your score?");
}else if(what=="delete"){
return confirm("Are you sure you want to delete your account? (This cannot be undone)");
}else{
return false;
}
}
</script>
<form action="{$_SERVER['PHP_SELF']}" name="misc" method="POST" onSubmit="return doubleCheck();">
<input id="fn" type="hidden" name="fn" value="misc" />
$tsnw
<tbody>
<tr>
<td class="center">
<select id="act" name="act" size="1">
<option value="">Choose an Option</option>
<option value="reset">Reset Your Score</option>
<option value="delete">Delete Your Profile</option>
</select>
</td>
</tr>
<tr>
<td class="center"><input type="submit" value="Let's Do It!" /></td>
</tr>
</tbody>
</table>
</form>
END;
}
}