Directories SQL Query Codes Required for Deleting Listings

Discussion in 'Directories' started by amitpatel_3001, May 6, 2008.

  1. #1
    Hey,
    I have a directory where some spammer has spammed huge number of listings.
    Is it possible to delete from phpmyadmin based on these values.

    URL TLD = .ru , .ua, .by etc

    Example :
    1 http:// 007-shop.ru
    1 http:// 007.in.ua
    1 http:// 00f.net.ru/
    1 http:// 017.by

    Can someone point me to a list of these queries which can help out in removing listings based on other criteria's.

    Regards
     
    amitpatel_3001, May 6, 2008 IP
  2. MeetHere

    MeetHere Prominent Member

    Messages:
    15,399
    Likes Received:
    994
    Best Answers:
    0
    Trophy Points:
    330
    #2
    And I want to remove many spammed .ro submissions ...
     
    MeetHere, May 6, 2008 IP
  3. amitpatel_3001

    amitpatel_3001 Results Follow Patience

    Messages:
    14,074
    Likes Received:
    1,178
    Best Answers:
    0
    Trophy Points:
    430
    #3
    If there is any ready made mod which directly deletes listings, or has a excellent search option please let us know.
     
    amitpatel_3001, May 6, 2008 IP
  4. MeetHere

    MeetHere Prominent Member

    Messages:
    15,399
    Likes Received:
    994
    Best Answers:
    0
    Trophy Points:
    330
    #4
    I found one
    hope it will work :)
     
    MeetHere, May 6, 2008 IP
  5. amitpatel_3001

    amitpatel_3001 Results Follow Patience

    Messages:
    14,074
    Likes Received:
    1,178
    Best Answers:
    0
    Trophy Points:
    430
    #5
    Does that just delete the URL or the whole listing ie description, name, email etc etc?
     
    amitpatel_3001, May 6, 2008 IP
  6. enQuira

    enQuira Peon

    Messages:
    1,584
    Likes Received:
    250
    Best Answers:
    0
    Trophy Points:
    0
    #6
    this one is ok.
    yes it deletes the whole listing.
     
    enQuira, May 6, 2008 IP
  7. amitpatel_3001

    amitpatel_3001 Results Follow Patience

    Messages:
    14,074
    Likes Received:
    1,178
    Best Answers:
    0
    Trophy Points:
    430
    #7
    There are numerous listings from sblog.cz :(
    delete from `PLD_LINK` where `URL` like '%xxx.sblog.cz%' < not working
     
    amitpatel_3001, May 7, 2008 IP
  8. enQuira

    enQuira Peon

    Messages:
    1,584
    Likes Received:
    250
    Best Answers:
    0
    Trophy Points:
    0
    #8
    you don't need the xxx
    put what you are looking for (search query) between the % signs.
    delete from `PLD_LINK` where `URL` like '%sblog.cz%'
     
    enQuira, May 7, 2008 IP
  9. mikey1090

    mikey1090 Moderator Staff

    Messages:
    15,869
    Likes Received:
    1,055
    Best Answers:
    0
    Trophy Points:
    445
    Digital Goods:
    2
    #9
    Amit, the % is used to detect any characters.

    This will delete any record in the links table where the url contains the characters sblog.cz - regardless as to what characters come before or after it.

    EDIT - seems mhamdi posted first :)
     
    mikey1090, May 7, 2008 IP
  10. MeetHere

    MeetHere Prominent Member

    Messages:
    15,399
    Likes Received:
    994
    Best Answers:
    0
    Trophy Points:
    330
    #10
    yes, just put your keyword between the %% stings.
     
    MeetHere, May 7, 2008 IP
  11. amitpatel_3001

    amitpatel_3001 Results Follow Patience

    Messages:
    14,074
    Likes Received:
    1,178
    Best Answers:
    0
    Trophy Points:
    430
    #11

    wow i tried out these options and here are the results.

    delete from `PLD_LINK` where `URL` like '%sblog.cz%'
    Deleted rows: 1275 (Query took 16.9193 sec)

    delete from `PLD_LINK` where `URL` like '%.htm%' [To remove pages submitted with internal links]
    Deleted rows: 1664 (Query took 6.8533 sec)

    delete from `PLD_LINK` where `URL` like '%.net%'
    Deleted rows: 2481 (Query took 2.2557 sec)

    delete from `PLD_LINK` where `URL` like '%.at%'
    Deleted rows: 330 (Query took 0.2747 sec)

    delete from `PLD_LINK` where `URL` like '%.in%'
    Deleted rows: 4566 (Query took 2.5624 sec)

    delete from `PLD_LINK` where `URL` like '%.vn%'
    Deleted rows: 13 (Query took 0.1530 sec)

    delete from `PLD_LINK` where `URL` like '%.ac.uk%'
    Deleted rows: 3 (Query took 0.1312 sec)

    delete from `PLD_LINK` where `URL` like '%com.au%'
    Deleted rows: 238 (Query took 0.2878 sec)

    delete from `PLD_LINK` where `URL` like '%ru%'
    Deleted rows: 4239 (Query took 1.7641 sec)

    delete from `PLD_LINK` where `URL` like '%.cn%'
    Deleted rows: 2420 (Query took 1.1714 sec)

    delete from `PLD_LINK` where `URL` like '%.edu%'
    Deleted rows: 40 (Query took 0.1349 sec)

    delete from `PLD_LINK` where `URL` like '%.eu%'
    Deleted rows: 136 (Query took 0.1974 sec)

    delete from `PLD_LINK` where `URL` like '%.freehostia.com%'
    Deleted rows: 21 (Query took 0.1208 sec)

    delete from `PLD_LINK` where `URL` like '%.blogspot.com%'
    Deleted rows: 563 (Query took 0.5422 sec)

    delete from `PLD_LINK` where `URL` like '%.exploreamericaonline.com%'
    Deleted rows: 8 (Query took 0.1244 sec)

    Wiped off almost 20000 listings :D

    Thanks guys :)
     
    amitpatel_3001, May 7, 2008 IP
  12. amitpatel_3001

    amitpatel_3001 Results Follow Patience

    Messages:
    14,074
    Likes Received:
    1,178
    Best Answers:
    0
    Trophy Points:
    430
    #12
    Any query code where description has
    [ URL = http:// luggageb.isgreat.org/ Backpacks/backpack-high-laptop-sierra.html]backpack high laptop sierra [ /URL]

    DELETE FROM `PLD_LINK` WHERE `DESCRIPTION` LIKE '%[URL=%' << would work?
     
    amitpatel_3001, May 7, 2008 IP
  13. mikey1090

    mikey1090 Moderator Staff

    Messages:
    15,869
    Likes Received:
    1,055
    Best Answers:
    0
    Trophy Points:
    445
    Digital Goods:
    2
    #13
    Yeah Amit, that looks fine. Nice to see you got the hang of it :)
     
    mikey1090, May 7, 2008 IP
  14. amitpatel_3001

    amitpatel_3001 Results Follow Patience

    Messages:
    14,074
    Likes Received:
    1,178
    Best Answers:
    0
    Trophy Points:
    430
    #14
    wow this can make my editors job more easy because he had to manually delete all these spam listings, and finally i had removed around 50% of these spam using the command and now he can visit the other websites and review them manually one by one. May be my mistake i always kept the directory for free @ Worlds Biggest Directory
     
    amitpatel_3001, May 7, 2008 IP
  15. Freewebspace

    Freewebspace Notable Member

    Messages:
    6,213
    Likes Received:
    370
    Best Answers:
    0
    Trophy Points:
    275
    #15
     
    Freewebspace, May 7, 2008 IP
  16. an0n

    an0n Prominent Member

    Messages:
    5,688
    Likes Received:
    915
    Best Answers:
    0
    Trophy Points:
    360
    #16
    Amit, definitely NOT a good thing you've done above.

    you just deleted every .net domain you had in your directory by using the '%.net%' - ex: www . topix . net

    '%ru%' - what if my site was www . rugrats . com ? gone

    %.at%' - www.att.com - gone


    etc etc, I'm sure you get the point.

    back up everything before you run these queries.
     
    an0n, May 7, 2008 IP
  17. amitpatel_3001

    amitpatel_3001 Results Follow Patience

    Messages:
    14,074
    Likes Received:
    1,178
    Best Answers:
    0
    Trophy Points:
    430
    #17
    I had a backup already, because i would not risk something this way :D
    Also i removed those tld URL's which were full of auto spam of porn, casino etc. The left out 15-20k ranged listings will be manually edited now.
     
    amitpatel_3001, May 7, 2008 IP
  18. an0n

    an0n Prominent Member

    Messages:
    5,688
    Likes Received:
    915
    Best Answers:
    0
    Trophy Points:
    360
    #18
    OK, just making sure.
     
    an0n, May 7, 2008 IP
  19. mikey1090

    mikey1090 Moderator Staff

    Messages:
    15,869
    Likes Received:
    1,055
    Best Answers:
    0
    Trophy Points:
    445
    Digital Goods:
    2
    #19
    Amit, how on earth did your directory get to a stage where it had so many pending links? :D
     
    mikey1090, May 7, 2008 IP
  20. amitpatel_3001

    amitpatel_3001 Results Follow Patience

    Messages:
    14,074
    Likes Received:
    1,178
    Best Answers:
    0
    Trophy Points:
    430
    #20
    It got heavily spammed in the last 3 months which is the time i didnt check it out. Captcha was Off :(
     
    amitpatel_3001, May 7, 2008 IP