Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/php
- <?php
- //Print "Hello how are you";
- //die();
- $opt = getopt("u:m:");
- $u = $opt['u'];
- $m = $opt['m'];
- if ( strlen($u) < 4 || strlen($m) < 4 )
- {
- Print "Syntax: adduser.php -u<username> -m<email@example.com>\n";
- die();
- }
- $pn = "parentname";
- $pw = randpw();
- $rp = "free___client-parentname";
- $addcmd = "/usr/bin/sudo /script/add --type=add --parent-class=client --class=client --send_welcome_f=on --v-type=customer ";
- $addcmd .="--parent-name=".$pn." --nname=".$u." --v-password=".$pw." --contactemail=".$m." --v-plan_name=".$rp;
- Print "\n".$addcmd."\n";
- $output = "";
- $returncode = 0;
- exec($addcmd, $output, $returncode);
- Print "\nOutput of add user:\n";
- Print_r($output);
- Print "\nReturn Code of add user: ".$returncode;
- function randpw()
- {
- $chars = "abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- $i = 0;
- $pw = '';
- while ($i <= 10) {
- $pw = $pw . substr($chars, rand(0,strlen($chars)-1), 1);
- $i++;
- }
- return $pw;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement