Jump to content

Script needed - inactive to active


wc_r

Recommended Posts

Apparently the inactive status for clients is if they have never logged in. Well, I have over 1200 clients listed as inactive, but some of them have active hosting or domain accounts. They were imported from WHM, but they never have needed to log in.

 

I need a little script written ( will pay), unless one exists, that does this -

 

From tblclients, check all users marked as status inactive against tbldomains and tblhosting. For tbldomains, see if they have a domain marked 'active' or 'pending' in the 'status' and in tblhosting check if they have 'active' or 'pending' in 'domainstatus' column.

 

If any of the inactive accounts have active or pending domains or hosting, mark the client 'active' in tblclients.

 

Wish my mysql knowledge was better!

Link to comment
Share on other sites

or do it with 3 simple lines of sql ...

 

update tblclients set =inactive where =active

update tblclients set =active where id in (select id from tbdomains where status=active)

update tblclients set =active where id in (select id from tbhosting where domainstatus=active)

 

:D

Link to comment
Share on other sites

I'm trying to accomplish the opposite: I want to set domains and hosting accounts to cancelled where clients = Closed.

 

I'm doing this for tbldomains but I'm getting a syntax error:

 

update tbdomains set = Cancelled where id in (select id from tblclients where status = Closed);

What's wrong here?

TIA :)

Link to comment
Share on other sites

set = Cancelled needs to be set <fieldname>="Cancelled"

 

although that wont actually cancel their hosting - you'd be better just getting the list of the clients where status ="Closed" and manually killing all their products ...

Thank you. That's what I ended up doing.

Link to comment
Share on other sites

Also let me know how it works out for you and please backup your database, as It is not extensively tested.

 

Well, I uploaded it and tried it, but it didn't work. This is the output -

 

Changed 0 clients to Active of the 2 clients that were Inactive.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated