Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
account-delete
You don't have permission for this action!
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2021-10-29 17:57:11
Hello, can you help me to make the delete account work for v3

url link of the code >>> https://torrenttrader.uk/topic?topicid=413


I created the file account-delete.php and test and it does not work when you enter your username and password and you click below the page of the file "delete account" the account is not deleted, here is the code delete account below and thank you in advance for your help ??



account-delete.php:

<?
require "backend/functions.php";

//require_once("backend/phpbb2Bridge.php");

dbconn();

if ($HTTP_SERVER_VARS["REQUEST_METHOD"] == "POST")

{

$username = trim($_POST["username"]);

$password = trim($_POST["password"]);

if (!$username || !$password)

bark("Couldn't delete account", "Please fill out the form correctly.");

$password = md5($password);

$res = mysql_query("SELECT * FROM users WHERE username=" . sqlesc($username) . " && password=" .

sqlesc($password)) or sqlerr();

if (mysql_num_rows($res) != 1)

bark("Couldn't delete account", "Bad user name or password. Please verify that all entered information is correct.");

$arr = mysql_fetch_assoc($res);

//if ($arr["status"] == "confirmed")

//bark("Couldn't delete account", "Sorry, you can not delete a confirmed account.");

$id = $arr['id'];

$res = mysql_query("DELETE FROM users WHERE id=$id") or sqlerr();

if (mysql_affected_rows() != 1)

bark("Couldn't delete account", "Unable to delete the account.");

if ($CURUSER)

$x = $CURUSER['username'];

else

$x = "an anonymous user";

delete_phpBB2user ($username, $password);

bark("Success", "The account <b>$username</b> were deleted.", Success);

}

stdhead("Delete account");

begin_frame("Delete Account");

?>

Thanks for using <b><?=$SITENAME?></b>. If you are no longer in need of your account you can delete it using the form below. All your account details will be deleted but any .torrents which you uploaded will remian in place until all users have finished downloading from them.

Please be aware that deleted accounts cannot be recovered and that any priviledges accumulated on one account cannot be transferred if you choose to sign up again.<br /><br />

<table border=0 cellspacing=0 cellpadding=5>

<form method=post action=account-delete.php>

<tr><td class=rowhead><b>Username:</b></td><td><input size=40 name=username></td></tr>

<tr><td class=rowhead><b>Password:</b></td><td><input type=password size=40 name=password></td></tr>

<tr><td colspan=2 align="right"><input type=submit value='Delete Account'></td></tr>

</table>

</form>

<?

end_frame();

stdfoot();

?>



2021-10-29 21:09:36
here is mine if this helps. I assume you are using mysqli
<?php

require_once "backend/functions.php";
dbconn();

if (get_user_class() >= 5) {
   show_error_msg(T_("ERROR"), T_("NO_DELETED_USER"), 1);
}

if ($_SERVER["REQUEST_METHOD"] == "POST") {
   $username = trim($_POST["username"]);
   $password = trim($_POST["password"]);

   if (!$username || !$password) {
       show_error_msg("Couldn't delete account", "Please fill out the form correctly.", 1);
   }

   $password = passhash($_POST["password"]);
   $res = SQL_Query_exec("SELECT id, status FROM users WHERE username=" . sqlesc($username) . " AND password =" . sqlesc($password));
   if (mysqli_num_rows($res) != 1) {
       show_error_msg(T_("COULDN_T_DELETE"), T_("UNABLE_TO_DELETE_PASSWORLD_NAME"), 1);
   }

   $arr = mysqli_fetch_assoc($res);

// Uncomment this if you don't want to be able to delete confirmed accounts.
/*
if ($arr["status"] == "confirmed")
show_error_msg("Couldn't delete account", "Sorry, you can not delete a confirmed account.",1);
*/

   deleteaccount($arr['id']);
   header("Refresh: 5 ;url=index.php");
   show_error_msg(T_("THE_ACCOUNT"), T_("WILL_REDIRECT"), 1);
}

stdhead("Delete account");
begin_frame("<font color=2fdceb>" . T_("DELETE_ACCOUNT") . "</font>");
?>
<?php echo T_("THANKS_FOR_USING"); ?> <b><?=$site_config['SITENAME']?></b>. <?php echo T_("DELETE_USER_INFO"); ?><br /><br />
<table border='0' cellspacing='0' cellpadding='5'><form method=post action=account-delete.php>
<tr><td><b><?php echo T_("USERNAME"); ?> :</b></td><td align='left'><input type=text size=40 name=username></td></tr>
<tr><td><b><?php echo T_("PASSWORD"); ?> :</b></td><td align='left'><input type=password size=40 name=password></td></tr>
<tr><td colspan='2' align='center'><input type='submit' value='Delete Account'></td></tr>
</table>
</form>

<?php
end_frame();
stdfoot();
?>

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-10-29 21:23:23
hello MicroMonkey and yes I use mysqli and a big thank you for your help it works very well now  :thumb  :bigsmile
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 2
  • Members: 0
  • Guests online: 2
  • Comments: 3
  • Messages: 1,728