Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Delete non-activated users script

Asked Modified Viewed 1,934 times
J
jannik
J
jannik 10
  • Member, joined since
  • Contributed 80 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions
asked
Member

Hi.
Could someone help me with some code
So when I see the site It will delete all users who are not activated yet. from the database?

I have 40 users to delete now and, it is a borring job to delete them manually because it doesnt stay on the page when you delete one.

Thanks alot in advance.


Regards

jannik
0 replies

7 posts

R
Rolf Mayer
R
Ex
  • Senior Member, joined since
  • Contributed 391 posts on the community forums.
  • Started 7 threads in the forums
answered
Senior Member

A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
answered
Veteran Member

I think that you are asking to Delete which Members are not Activated their Accounts through E-Mails. Am I right ?

This is a Simple Script.

But, Please Don't make it Public ! Its for personal use only... Delete after Use or make password protection

Save this file as a PHP file(whatever name) and run it in browser :

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
if($_POST['areyousure'] == 'yes' || $_POST['areyousure'] == 'YES' || $_POST['areyousure'] == 'Yes'wink
{
require_once "maincore.php";
$deleteall = dbquery("DELETE FROM ".DB_NEW_USERS.""wink;
echo "<h2>All Non Activated Members Deleted Successfully smile</h2>";
}
else
{
require_once "maincore.php";
$result = dbquery("SELECT * FROM ".DB_NEW_USERS.""wink;
echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>
<h2>Do you really want to Delete All UnActivated Members ? :-o</h2>
For Security Check, Please Enter Yes in the Box : <input type='text' name='areyousure' />
</form>";
echo "<b>Members E-Mail which are Currently Not Activated</b><br />";
while($data = dbarray($result))
{
echo "<u>";
echo $data['user_email'];
echo "</u><br />";
}
}
?>[/syntaxhighlighter]
0 replies
M
MarcusG
M
Ex Senior Dev.
  • Member, joined since
  • Contributed 182 posts on the community forums.
  • Started 5 threads in the forums
answered
Member

You can simply truncate the database table PREFIX_new_users...
0 replies
J
jannik
J
jannik 10
  • Member, joined since
  • Contributed 80 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions
answered
Member

Hi again.
I have no data in new_users.

I want do delete all users where user_status = 2

Can someone change the code from Akur so it fits my needs :-)

Thanks alot for your help
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
answered
Veteran Member

Quote

MarcusG wrote:
You can simply truncate the database table PREFIX_new_users...


Yeah !

@jannik : The script is doing what Marcus said....

Quote

jannik wrote:
I want do delete all users where user_status = 2

Can someone change the code from Akur so it fits my needs :-)


Ok ! But when you will use this Code first time, please check whether the E-Mails showing below are correect/Non-Activated?
Because I've tested the script given on above post, but not this one I am giving... So Please Be Sure to use this script
cool as I don't want anyone to loose their data wink

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
if($_POST['areyousure'] == 'yes' || $_POST['areyousure'] == 'YES' || $_POST['areyousure'] == 'Yes'wink
{
require_once "maincore.php";
$deleteall = dbquery("DELETE FROM ".DB_USERS." WHERE user_status='2'"wink;
echo "<h2>All Non Activated Members Deleted Successfully smile</h2>";
}
else
{
require_once "maincore.php";
$result = dbquery("SELECT user_email FROM ".DB_USERS." WHERE user_status='2'"wink;
echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>
<h2>Do you really want to Delete All UnActivated Members ? :-o</h2>
For Security Check, Please Enter Yes in the Box : <input type='text' name='areyousure' />
</form>";
echo "<b>Members E-Mail which are Currently Not Activated</b>";
while($data = dbarray($result))
{
echo "<u>";
echo $data['user_email'];
echo "</u>";
}
}
?>[/syntaxhighlighter]
0 replies
— 1 month later —
J
jannik
J
jannik 10
  • Member, joined since
  • Contributed 80 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions
answered
Member

Hi Ankur. Thanks for your script, and sorry for my late respons.

When I write Yes I just is sent to index.php and nothing is being deleted from the DB, so all the members is still there...

do you know what is wrong?

regards
Jannik
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
answered
Veteran Member

How are you using this file ? In a different php file ? or added as a custom page ?

I've tested the same code 2 times and it worked fine for me ! There doesn't seem to be a logical r syntax error from my side ! you may Try again B) !
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 7 posts
  • Votes 0 votes
  • Topic users 4 members

4 participants

J
J
jannik 10
  • Member, joined since
  • Contributed 80 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions
M
M
Ex Senior Dev.
  • Member, joined since
  • Contributed 182 posts on the community forums.
  • Started 5 threads in the forums
R
R
Ex
  • Senior Member, joined since
  • Contributed 391 posts on the community forums.
  • Started 7 threads in the forums
A
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet