Skip to forum content

missing Forum

out of the blue edition

You are not logged in. Please login or register.


Post new reply

missing Forum → Web-Forum → punBB: Deletion Day plugin → Post new reply

Post new reply

Compose and post your new reply

You may use: BBCode Images Smilies

All fields with bold label must be completed before the form is submitted.

Required information for guests


Required information

Topic review (newest first)

3

Ich verstehe ihn. Und auch wenn man keine Programmiersprache kann so kann er trotzdem amüsant sein, sofern man Englisch kann.

/me

2

aha der code is unnötig versteht sowiso nimand ^^

1

AP_Deletion_Day.php

<?php
/***********************************************************************

  (c) 2008 by Michael "Missingno." Hanig

  PunBB is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  PunBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/

// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
    exit;

// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);

// If the "Nuke'em!" button was clicked
if (isset($_POST['dday']))
{
    // period of grace entered?
    if(trim($_POST['days_to_live']) == '') {
        $result = $db->query('DELETE FROM '.$db->prefix.'users WHERE group_id=32000') or error('Unable to delete users', __FILE__, __LINE__, $db->error());
    } else {
        $result = $db->query('DELETE FROM '.$db->prefix.'users WHERE group_id=32000 AND registered<'.(time() - ((int)trim($_POST['days_to_live']) * 24 * 60 * 60))) or error('Unable to delete users', __FILE__, __LINE__, $db->error());
    }
    $result = mysql_affected_rows();

    // Display the admin navigation menu
    generate_admin_menu($plugin);

?>
    <div class="block">
        <h2><span>Deletion-Day plugin</span></h2>
        <div class="box">
            <div class="inbox">
                <?php
                    if($result != 0) {
                ?>
                <p>Killed <?php echo $result; ?> people. Feeling better now?</p>
                <?php
                    } else {
                ?>
                <p>No one died. Boring!</p>
                <?php
                    }
                ?>
                <p><a href="javascript: history.go(-1)">Go back</a></p>
            </div>
        </div>
    </div>
<?php

}
else    // If not, we show the form
{
    // Display the admin navigation menu
    generate_admin_menu($plugin);

?>
    <div id="exampleplugin" class="blockform">
        <h2><span>Deletion-Day plugin</span></h2>
        <div class="box">
            <div class="inbox">
                <p>You can delete registered users who have never logged in with one click.</p>
                <p>To prevent the deletion of newly registered users who have not yet confirmed the registration, it is recommended to delete only entries older than a couple of days.</p>
            </div>
        </div>

        <h2 class="block2"><span>Time for deletion?</span></h2>
        <div class="box">
            <form id="example" method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
                <div class="inform">
                    <fieldset>
                        <legend>When ready, push the button!</legend>
                        <div class="infldset">
                        <table class="aligntop" cellspacing="0">
                            <tr>
                                <th scope="row"><div><input type="submit" name="dday" value="Nuke'em!" tabindex="2" /></div></th>
                                <td>
                                    <input type="text" name="days_to_live" size="25" tabindex="1" />
                                    <span>Enter number of days which must have been passed since registration.</span>
                                </td>
                            </tr>
                        </table>
                        </div>
                    </fieldset>
                </div>
            </form>
        </div>
    </div>
<?php

}

// Note that the script just ends here. The footer will be included by admin_loader.php.

Okay, mir war so langweilig, dass ich das "alle Spam-Anmeldungen löschen" unbedingt automatisieren musste.

missing Forum → Web-Forum → punBB: Deletion Day plugin → Post new reply