View Full Version : Creating new account in WHM
Jan
August 7th, 2007, 05:14
When creating a new account, it says to put your domain name as username right? But it also says you can't use dashes, so what happens when you have a domain with a hyphen in it? :knockedou
Decker
August 7th, 2007, 05:28
When creating a new account, it says to put your domain name as username right? But it also says you can't use dashes, so what happens when you have a domain with a hyphen in it? :knockedou
You don't 'have' to use the domain name as a username Jan or if you must just leave the dash out.
Jan
August 7th, 2007, 05:40
I see what happened now, the domain was required but it auto assigned me a username with a dash. I just removed it and now I'm all set to go :)
Decker
August 7th, 2007, 05:47
It's a bit of a pest when it does that, well suppose it's meant to make it 'easier' :idea: , glad you got sorted out :-)
TSO
August 7th, 2007, 22:05
What? :eek: Jan doesn't know how to use WHM? :p (j/k, of course!)
Jan
August 8th, 2007, 03:58
I'm sure you didn't know once upon a time ;) Unless you were born an expert at everything (seems to be a few of that type around) :p
krakjoe
August 8th, 2007, 06:07
I'm sure you didn't know once upon a time ;)
it came to me in a dream ....
krakjoe
August 8th, 2007, 07:05
whm have made a pretty lazy mistake there ....
<?php
if( $_SERVER['HTTP_HOST'] )
{
die( "Please do not run the script in a browser, you MUST run it as 'root' from a terminal\r\n" );
}
if( !defined( "SCRIPT_NAME" ) ) define( "SCRIPT_NAME", '/usr/local/cpanel/whostmgr/docroot/themes/x/templates/createacct' );
$search = <<<SEARCH
function dologinname() {
var domain = document.mainform.domain.value;
var username = domain.substring(0,8);
var username = username.toLowerCase();
document.mainform.username.value = replaceString(".","",username);
}
SEARCH;
$replace = <<<REPLACE
function dologinname() {
var domain = document.mainform.domain.value.replace( /[^a-zA-Z0-9]/, '' );
var username = domain.substring(0,8);
var username = username.toLowerCase();
document.mainform.username.value = replaceString(".","",username);
}
REPLACE;
if( ( $script = file_get_contents( SCRIPT_NAME ) ) )
{
if( ( $new = str_replace( $search, $replace, $script ) ) )
{
if( $new != $script )
{
printf("updated script, saving ...\r\n");
if( ( $handle = fopen( SCRIPT_NAME, 'w+' ) ) )
{
if( fwrite( $handle, $new, strlen( $new ) ) )
{
printf("%s updated", SCRIPT_NAME );
fclose( $handle );
}
else
{
printf("%s NOT updated", SCRIPT_NAME );
}
}
else printf("%s cannot be opened in write mode\r\n", SCRIPT_NAME );
}
else printf("%s hasn't been changed\r\n", SCRIPT_NAME );
}
else printf( "%s cannot be edited", SCRIPT_NAME );
}
else printf("%s cannot be read\r\n", SCRIPT_NAME );
that'll fix it so that usernames that whm fills in are the first 8 characters and|or numbers from the domain name that was just input ..... you need to be logged in as root to have permission to save this file, do NOT attempt to use this script in a browser, instead upload to somewhere on your server and execute in shell......
Dan
August 9th, 2007, 22:49
(seems to be a few of that type around) :p
Me and Jan think alike on a few things. :P
raversworld
August 13th, 2007, 22:58
make a random domain then just park it on top of it
Decker
August 14th, 2007, 10:11
make a random domain then just park it on top of it
Eh! Lost me on that one.
raversworld
August 18th, 2007, 19:13
sorry put make the domain with out the hyphen then park it so it still points to it :)
serverorigin
August 18th, 2007, 19:20
Wish I could pump all of that programming knowledge into my head from Joe....Nice work! :)
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.