My Assistant
Logged in as: OPPZeroCool ( Log Out )
My Controls · View New Posts · My Assistant · My Friends · 1 New Messages
If you would like to advertise your Hosting, Services or Products on Filesoup, please contact Geeker for a quote.
|
Problem in admin/delete.php, T-xore
modified |
May 20 2007, 11:55 PM
Post #1
| |
Spam Soup Group: Contributor Posts: 117 Joined: 22-September 05 Member No.: 313,949 |
When deleting a torrent from
registered users, the script doesn't update the database on 'uploads' and
'comments' table for each user. If a user have 10 torrents uploaded, when
I run the script, the 'uploads' table is updated to 0 and 'comments' stay
the same. Anybody knows how to do this works fine? Here the code that I'm using. here you find my script = http://teste.dannlopes.cjb.net/ CODE
$result = mysql_query("SELECT * FROM torrents LEFT JOIN users ON
torrents.posted_by = users.username WHERE id = '$id' LIMIT 1") or die
(mysql_error()); if (!$posted_by == 0){ // if user is registered, because guest users are set to 0 while ($row = mysql_fetch_array($result)){ extract($row); mysql_query("UPDATE categories SET torrents = 'torrents-1' WHERE subid = '$subcat' LIMIT 1") or die (mysql_error()); mysql_query("DELETE FROM comments WHERE id = '$id' LIMIT 1") or die (mysql_error()); mysql_query("DELETE FROM description WHERE id = '$id' LIMIT 1") or die (mysql_error()); mysql_query("DELETE FROM torrents WHERE id = '$id' LIMIT 1") or die (mysql_error()); //the line below I'm trying to use but didn't work, a try to use this line after 'while' but didn't work again mysql_query("UPDATE users SET uploads = 'uploads-1' WHERE username = '$posted_by' LIMIT 1") or die (mysql_error()); @unlink('.'.$btdir.'/'.$hash.'.bogtor'); } } else{ // if guest user while ($row = mysql_fetch_array($result)){ extract($row); mysql_query("UPDATE categories SET torrents = 'torrents-1' WHERE subid = '$subcat' LIMIT 1") or die (mysql_error()); mysql_query("DELETE FROM comments WHERE id = '$id' LIMIT 1") or die (mysql_error()); mysql_query("DELETE FROM description WHERE id = '$id' LIMIT 1") or die (mysql_error()); mysql_query("DELETE FROM torrents WHERE id = '$id' LIMIT 1") or die (mysql_error()); @unlink('.'.$btdir.'/'.$hash.'.bogtor'); } } -------------------- GIGANOVA.org T-Xore Mods in Test http://teste.dannlopes.cjb.net/ |
| |
May 21 2007, 11:30 PM
Post #2
| |
Spam Soup Group: Contributor Posts: 117 Joined: 22-September 05 Member No.: 313,949 |
Complete Code in
admin/delete.php CODE
<? require_once '../config.php'; require_once '../admin/secure.php'; connect ($dbhost, $dbuser, $dbpass, $database); $id = $_GET['id']; $result = mysql_query("SELECT * FROM torrents WHERE id = '$id' LIMIT 1"); if (mysql_num_rows($result) == 0){ die ('Torrent não encontrado'); } $result = mysql_query("SELECT * FROM torrents LEFT JOIN users ON torrents.posted_by = users.username WHERE id = '$id' LIMIT 1") or die (mysql_error()); if (!$posted_by == 0){ while ($row = mysql_fetch_array($result)){ extract($row); mysql_query("UPDATE categories SET torrents = 'torrents-1' WHERE subid = '$subcat' LIMIT 1") or die (mysql_error()); mysql_query("DELETE FROM comments WHERE id = '$id' LIMIT 1") or die (mysql_error()); mysql_query("DELETE FROM description WHERE id = '$id' LIMIT 1") or die (mysql_error()); mysql_query("DELETE FROM torrents WHERE id = '$id' LIMIT 1") or die (mysql_error()); mysql_query("UPDATE users SET uploads = 'uploads-1' WHERE username = '$posted_by' LIMIT 1") or die (mysql_error()); @unlink('.'.$btdir.'/'.$hash.'.bogtor'); } } else{ while ($row = mysql_fetch_array($result)){ extract($row); mysql_query("UPDATE categories SET torrents = 'torrents-1' WHERE subid = '$subcat' LIMIT 1") or die (mysql_error()); mysql_query("DELETE FROM comments WHERE id = '$id' LIMIT 1") or die (mysql_error()); mysql_query("DELETE FROM description WHERE id = '$id' LIMIT 1") or die (mysql_error()); mysql_query("DELETE FROM torrents WHERE id = '$id' LIMIT 1") or die (mysql_error()); @unlink('.'.$btdir.'/'.$hash.'.bogtor'); } } ?> Help ME |
| |
Lo-Fi Version | 0.1177 sec -- 12 queries
GZIP Enabled Time is now: 23rd May 2007 - 01:49 PM |