View Full Version : default_user_size


tomgreen
04-25-2005, 03:45 PM
After reading several posts about this here is a php script that will change the default_user_size for all accounts..just save this code to a text file and rename it however you wish with a .php extension substituting the proper vaules for your server. this isn't much but it's useful:
**below has been corrected to allow for specification of database suffix**


<?PHP
function refresh(){
echo "<META HTTP-EQUIV='refresh' CONTENT='3; URL=$_SERVER[PHP_SELF]'>";
}
ob_start();
//connect to database
$dname=" "; //database name
$dhost=" "; //database host or ip address
$duser=" "; //database username
$dpass=" "; //database password
$dbsuff=" "; //change to your database suffix such as mess_ which is the default
mysql_connect("$dhost", "$duser", "$dpass") or die(mysql_error());
mysql_select_db("$dname") or die(mysql_error());
if ($_POST['size']=="" and $_POST['submit']){
echo "you must enter a value...redirecting";
refresh();
exit;
} elseif ($_POST['size']<="10000" and $_POST['submit']){
echo "the value entered is 10,000 or less. please increase this value...redirecting";
refresh();
exit;
}

if ($_POST['submit']){
$table = $dbsuff."registration";
$size = $_POST['size'];
$insert=mysql_db_query($dname,"UPDATE $table SET `max_mailbox`='$size'");
echo "settings changed to ".$size." Bytes...redirecting";
refresh();
exit;
}
ob_end_flush();

?>
<form method="POST" action="<?PHP $_SERVER['SELF']?>">
<p>size: <input type="text" name="size" size="20"></p>
<p><input type="submit" value="Submit" name="submit"><input type="reset" value="Reset" name="B2"></p>
</form>

Jafo
04-25-2005, 04:34 PM
This hack assumes that the dbprefix is mess_. :)

Jafo
04-25-2005, 04:41 PM
You could also just hack the script like so:

Find the sub Proc_Change_Settings and find these lines:

@setup_split = split(/ /, $_, 2);
$setup_split[0] = Strip_Returns($setup_split[0]);
$setup_split[1] = $form{$setup_split[0]};
$_ = "$setup_split[0] $setup_split[1]\n";
}

ADD these lines:

if($form{'default_user_size'} != $settings{'default_user_size'}) {
my $db = &dbconnect;
my $stp = $db->prepare("UPDATE " . $settings{"dbsuff"} . "registration SET max_mailbox = '$form{'default_user_size'}' WHERE id != '0'") or &oops("$! DBI: $DBI::errstr ");
$stp->execute() or &oops("$! DBI: $DBI::errstr");
}

tomgreen
04-25-2005, 05:41 PM
This hack assumes that the dbprefix is mess_. :)


ahh, let me fix that :)
here you go:

<?PHP
function refresh(){
echo "<META HTTP-EQUIV='refresh' CONTENT='3; URL=$_SERVER[PHP_SELF]'>";
}
ob_start();
//connect to database
$dname=" "; //database name
$dhost=" "; //database host or ip address
$duser=" "; //database username
$dpass=" "; //database password
$dbsuff=" "; //change to your database suffix such as mess_ which is the default
mysql_connect("$dhost", "$duser", "$dpass") or die(mysql_error());
mysql_select_db("$dname") or die(mysql_error());
if ($_POST['size']=="" and $_POST['submit']){
echo "you must enter a value...redirecting";
refresh();
exit;
} elseif ($_POST['size']<="10000" and $_POST['submit']){
echo "the value entered is 10,000 or less. please increase this value...redirecting";
refresh();
exit;
}
if ($_POST['submit']){
$table = $dbsuff."registration";
$size = $_POST['size'];
$insert=mysql_db_query($dname,"UPDATE $table SET `max_mailbox`='$size'");
echo "settings changed to ".$size." Bytes...redirecting";
refresh();
exit;
}
ob_end_flush();

?>
<form method="POST" action="<?PHP $_SERVER['SELF']?>">
<p>size: <input type="text" name="size" size="20"></p>
<p><input type="submit" value="Submit" name="submit"><input type="reset" value="Reset" name="B2"></p>
</form>

Jafo
04-25-2005, 05:43 PM
had to edit out your IP and pass :P

tomgreen
04-25-2005, 05:49 PM
had to edit out your IP and pass :P

LOL..yea i saw that actually. i saw you edited it; i was gonna edit it out and i was like, "hey where did it go!! " hehe.
actually it wouldn't matter...i have 3306 firewalled out and host settings so that the server can only query itself...thanks though. hopefully i won't submit that again! lol