View Full Version : Suspension Script Request
matty005
July 9th, 2006, 18:36
I need a script for my hosting website that will make it easier to me to suspend websites on a webpage instead of going to WHM. All i need is to be able to suspend/unsuspend them and a reason box.
I HAVE SEARCHED GOOGLE AND HOTSCRIPTS!!! DONT TELL ME TO SEARCH THEM!!!
PLEASE DONT SUGGEST SOMETHING LIKE WHM AUTO PILOT OR SOMETHING LIKE THAT. ALL I NEED IS A SUSPENSION SCRIPT
I need:
* Be able to suspend/unsuspend websites
* Be able to give a reason for suspension and tell the user that on their website (EX: Your account is suspensed. REASON: Broken Rule #1)
I need this script so when i suspend a script i can just easily tell them why without them emailing me asking why.
Thanks in advance! :-)
krakjoe
July 10th, 2006, 06:26
I'll write this for you, it won't take long at all, please get on MSN msngr and add my username at hotmail dot com to your list, I'm nearly always online...
krakjoe
July 10th, 2006, 07:10
I'm a pretty impatient guy, apparently.....
<?
echo 'look down there';
?>
This will suspend and unsuspend users by name....urm, what are you storing email addresses in, a forum maybe ???
Gimme a way to get email addresses and I'll wack sum sendmail at the bottom somewhere, plenty of room.....
EDIT : I only just read your post properly...so now I'll do as you asked.....gizza little while....
krakjoe
July 10th, 2006, 10:04
actually, no....I can't seem to work out a way to do it, are you root on your server ?
I can think of a way, but it's pretty juicy, would make the script just as juicy...
matty005
July 10th, 2006, 12:29
thanks for the script but i have an error.
Parse error: syntax error, unexpected T_REQUIRE in /home/matty005/public_html/suspend.php on line 11
krakjoe
July 10th, 2006, 13:06
sorry about that, silly mistake
<? // Suspend user script J Watkins
// WHM SETUP
$host = 'localhost';
$user = 'root';
$accesshash = '';
$usessl = '1'; // 1 = true 0 = false, 1 recommended
/* =========================== */
/* DO NOT EDIT BELOW THIS LINE */
/* =========================== */
// Contains cpanel php functions....
require '/usr/local/cpanel/Cpanel/Accounting.php.inc';
$whmsus = suspend ($host,$user,$accesshash,$usessl,$suspenduser);
$whmun = unsuspend ($host,$user,$accesshash,$usessl,$suspenduser);
$susform = '<head><title>Suspend user by Name</title></head><body><form action="" method="post"><input type="hidden" name="op" value="ds"><input type="text" name="suspenduser"><input type="submit" name="submit" value="suspend"></form></body>';
$unform = '<head><title>Unsuspend user by name</title></head><body><form action="" method="post"><input type="hidden" name="op" value="ds"><input type="text" name="suspenduser"><input type="submit" name="submit" value="unsuspend"></form></body>';
if ($_GET['action'] == "unsuspend") {
if ($_POST['op'] != "ds") {
echo $unform;
exit;
} else {
echo '<head><title>Unsuspend results</title></head><body><div align="center"><pre style="text-align:left;">'.$whmun.'</pre></div></body>';
exit;
}
} elseif ($_GET['action'] == "suspend") {
if ($_POST['op'] != "ds") {
echo $susform;
exit;
} else {
echo '<head><title>Suspend results</title></head><body><div align="center"><pre style="text-align:left;">'.$whmsus.'</pre></div></body>';
exit;
}
} else {
echo '<head><title>Choose an action</title></head><body>
<div align="center"><table width="200" border="0">
<tr>
<td width="50%"><div align="center"><a href="?action=suspend">Suspend</a></div></td>
<td><div align="center"><a href="?action=unsuspend">Unsuspend</a></div></td>
</tr>
</table>
</div>
</body>';
exit;
}
?>
matty005
July 10th, 2006, 15:13
it says "access denied to account" and i filled out all the details!
// WHM SETUP
$host = 'localhost';
$user = 'matty005';
$accesshash = '*HIDDEN*This is my "Remote Access Key"';
$usessl = '0'; // 1 = true 0 = false, 1 recommended
is localhost correct?
matty005
July 10th, 2006, 15:36
and also, please can you tell me a script that lists all the suspended accounts on my website. And a script that actually lists every single account selected from WHM.
Firstly though, i need know whats wrong with it. It says access denied!
webadpro
July 10th, 2006, 20:51
If you would like, add me to msn:
webadpro@directws.com
I'm working on a free Account Manager that allows suspending accounts very easily.
I could maybe create a small one, just to do what you need.
Best Regards,
Pat
krakjoe
July 11th, 2006, 02:58
urm, there is some problem with the way whm is setup, it says access denied when you go to suspend/unsuspend an account, and I don't seem to be able to replicate the error on my server...it's very strange......
I added you to msn, I started one of these also....with a built in "cms"...I'd like to chat....
webadpro
July 11th, 2006, 09:56
Alright,
No Problem.
Best Regards,
Pat
matty005
July 11th, 2006, 18:44
is there a way to list suspended accounts and the reason FROM whm?
Tree
July 11th, 2006, 19:15
http://www.example.com:2086/scripts/suspendlist
Might be disabled in your WHM
krakjoe
July 12th, 2006, 07:11
urm the dirtiest way would prolly b
<? // Get reasons and ---- from whm
$user = '';
$pass = '';
// DO NOT EDIT BELOW THIS LINE
$host = $_SERVER['http_host'];
$port = '2086';
$action = '';
$url = 'http://'.$user.':'.$pass.'@'.$host.':'.$port.'/'.$action.'';
if (!isset ($_GET['action'])) {
$action = 'scripts/suspendlist';
}
$file = file_get_contents('http://'.$user.':'.$pass.'@'.$_SERVER['HTTP_HOST'].':'.$port.'/scripts/suspendlist');
$search1 = array ('/<form.*?form>/si'); // remove forms
$replace1 = array ('');
$result1 = preg_replace($search1, $replace1, $file);
$search2 = array ('/<td background.*?td>/si'); // remove header thing (it's crappy)
$replace2 = array ('');
$result2 = preg_replace($search2, $replace2, $result1);
echo $result2;
?>
yeah that works, not v nice to look @, but works
matty005
July 12th, 2006, 10:27
KRAK_JOE that is a very nice script. It might not look nice and you might not be able to change the style, but it looks nice because it shows all the suspended accounts.
thanks alot, and i owe you one.
krakjoe
July 12th, 2006, 11:32
glad I could help :)
krakjoe
July 12th, 2006, 14:58
for those that have the same problem, ie they get Access Denied, here's one for you
<?
$cpuser = '';
$cppass = '';
$host = $_SERVER['http_host'];
$port = '2086';
if (!isset ($_POST['op'])) {
echo '<form action="" method="post" name=fmain><input type="hidden" name="op" value="ds"><label><b>Reason :<b></label><input type=text name=reason size=30><br><label><b>User :<b></label><input type="text" name="user"><br><input type="submit" class=submit value="Suspend" name="suspend-domain"><br><input type="submit" class=submit value="UnSuspend" name="unsuspend-domain"></form>';
} else {
if ($_POST['submit'] == "suspend") {
$file = file_get_contents('http://'.$cpuser.':'.$cppass.'@'.$_SERVER['HTTP_HOST'].':'.$port.'/scripts2/suspendacct?user='.$user.'&suspend-user=Suspend&reason='.$reason.'');
$search1 = array ('/<table.*?table>/si'); // remove top table
$replace1 = '';
$result1 = preg_replace($search1, $replace1, $file);
$search2 = array ('/<img.*?>/si'); // remove top img
$replace2 = '';
$result2 = preg_replace($search2, $replace2, $result1);
$search3 = array ('/<style.*?style>/si'); // remove style
$replace3 = '';
$result3 = preg_replace($search3, $replace3, $result2);
$search4 = array ('/.*Un.*Suspension.*of/si'); // remove other
$replace4 = '';
$result4 = preg_replace($search4, $replace4, $result3);
echo '<body>'.$result4.'</body>';
} else {
$file = file_get_contents('http://'.$cpuser.':'.$cppass.'@'.$_SERVER['HTTP_HOST'].':'.$port.'/scripts2/suspendacct?user='.$user.'&unsuspend-user=UnSuspend');
$search1 = array ('/<table.*?table>/si'); // remove top table
$replace1 = '';
$result1 = preg_replace($search1, $replace1, $file);
$search2 = array ('/<img.*?>/si'); // remove top img
$replace2 = '';
$result2 = preg_replace($search2, $replace2, $result1);
$search3 = array ('/<style.*?style>/si'); // remove style
$replace3 = '';
$result3 = preg_replace($search3, $replace3, $result2);
$search4 = array ('/.*Un.*Suspension.*of/si'); // remove other
$replace4 = '';
$result4 = preg_replace($search4, $replace4, $result3);
echo '<body>'.$result4.'</body>';
}
}
?>
I know all the hardcore php'ers will be going crazy, but hey it works, and that's the point......this is one of those, get it done jobs...and its done... so I'm happy.....
krakjoe
July 12th, 2006, 15:02
apparently this still create access denied errors, so now I give up....
matty005
July 12th, 2006, 15:34
i know, its a bit wierd coz you can list the suspended accounts but you cant suspend someone. We have tested 2 ways but none work.
krakjoe
July 12th, 2006, 15:44
It happens to resellers on my server aswell....I can't find any info on it in google....little confused.....why would the list one work and not the suspend one ??? anybody ????
webadpro
July 13th, 2006, 01:21
I would give it a go with your "Remote Access Key".
I know it's a bit more a pain, but I get everything working perfectly with using that method.
Best Regards,
Pat
krakjoe
July 13th, 2006, 01:32
yeah it works with my remote access key, but not his......thats what is strange....
iBrightDev
July 13th, 2006, 09:49
it should work with his remote access key too. maybe look at how it is incorporated in the script to make sure he is doing it properly. if it isn't entered in correctly, it will not work.
matty005
July 13th, 2006, 11:16
my access key doesnt work, and it doesnt say the whm login page, but it says access denied to the account.
webadpro
July 13th, 2006, 14:46
I've made one for you with the help of KRAK_JOE.
We have one working.
I've PMed it to you.
Best Regards,
Pat
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.