Next Step – Wrap your Queries in PHP

If you have a query you run often, wouldn’t it make sense to add them to your TAE Admin NAV menu so you simply have to click them?

Or, if you are not comfortable with editing the Admin NAV menu, just add the command as a browser bookmark.  You just sign in as Admin, and run the php script from the browser address bar or launch the bookmark.

Here is an example of a really great set of SQL commands that I would use over and over to remove ads from deleted members. All I did was create the PHP equivalent, and put the appropriate “includes” for security checks, headers, banners, and NAV menu:

Save this as  “_cleansweep.php” and upload to “/admin/_cleansweep.php”
Change permissions to 644
To run: 
Login to your admin panel
In the address bar, type:
Done
================================
<?php
session_start();
include “../header.php”;
include “../config.php”;
include “../connect.php”;
if( session_is_registered(“alogin”) ) {
?>
     <table>
          <tr>
        <td width=”15%” valign=top><br>
        <? include(“adminnavigation.php”); ?>
        </td>
        <td valign=”top” align=”center”><br><br>
<?
        echo “<font size=2 face=’$fonttype’ color=’$fontcolour’><p><b><center>”;
 
mysql_query(“delete FROM banners WHERE NOT EXISTS (select * from members m Where banners.userid = m.userid”);
mysql_query(” delete FROM buttons WHERE NOT EXISTS (select * from members m Where buttons.userid = m.userid”);
mysql_query(” delete FROM hotlinks WHERE NOT EXISTS (select * from members m Where hotlinks.userid = m.userid” );
mysql_query(” delete FROM loginads WHERE NOT EXISTS (select * from members m Where loginads.userid = m.userid” );
mysql_query(” delete FROM tlinks WHERE NOT EXISTS (select * from members m Where tlinks.userid = m.userid” );
mysql_query(” DELETE FROM banners WHERE EXISTS(SELECT id FROM members WHERE members.lastlogin<‘2016-06-22’ AND members.userid = banners.userid” );
mysql_query(” DELETE FROM buttons WHERE EXISTS(SELECT id FROM members WHERE members.lastlogin<‘2016-06-22’ AND members.userid = buttons.userid” );
mysql_query(” DELETE FROM hotlinks WHERE EXISTS(SELECT id FROM members WHERE members.lastlogin<‘2016-06-22’ AND members.userid = hotlinks.userid” );
mysql_query(” DELETE FROM tlinks WHERE EXISTS(SELECT id FROM members WHERE members.lastlogin<‘2016-06-22’ AND members.userid = tlinks.userid” );
mysql_query(” DELETE FROM loginads WHERE EXISTS(SELECT id FROM members WHERE members.lastlogin<‘2016-06-22’ AND members.userid = loginads.userid” );
Echo “Cleanup Done<br>”;
      } else  {
    echo “Unauthorised Access!”;
    }
include “../footer.php”;
mysql_close($dblink);
?>

Original SQL commands contributed by Dave Mosher.  Check out his flagship site and great SuperNetwork package bargains (that I purchase myself)
>>>>> SimpleTextAdz

Advice to Dave was from Roger Hoover
>>>>> http://hoover-usa.com/

PHP by Rich Moyer
>>>>> http://grabcashtoday.com/13sites