Location: PHPKode > scripts > cPanel Account Creator > cpanel-account-creattor/settings.php
<?php
/*---------------------------------------------------+
| cpanel creator
+----------------------------------------------------+
| Copyright 2009 - Neil Taylor
| http://studyhost.co.uk
+----------------------------------------------------+
| This program is free software: you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation, either version 3 of the License, or
| (at your option) any later version.
|
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
| GNU General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with this program.  If not, see <http://www.gnu.org/licenses/>
+----------------------------------------------------*/ 
session_start();
if(!$_SESSION['myusername']) {
header("Location:login.php");
}


else { 


$myusername = $_SESSION["myusername"];
$mypassword = $_SESSION["mypassword"];
$myemail = $_SESSION["email"]; 

  
// ----------------------------------------------------------------------
//   Function    : edituser()
//   Description : Edits the users details
// ----------------------------------------------------------------------
function edituser($user_edit, $new_user, $new_password, $new_email) {
$open_users_file = "users.ini";
$newuser_array =(parse_ini_file("$open_users_file",true));   


foreach($newuser_array as $key => $value)
{
		
if ($key == $user_edit) {

if ($new_password) {$newuser_array[$key][password] = $new_password;}
if ($new_email) {$newuser_array[$key][email] = $new_email;} 
if ($new_user) {
$password =  $newuser_array[$key][password];
$email =  $newuser_array[$key][email];
$accesslevel = $newuser_array[$key][accesslevel];  
$newuser_array[$new_user] = array("password" => $password, "email" => $email, "accesslevel" => $accesslevel);
unset($newuser_array[$key]);
$_SESSION["myusername"] = $new_user;
}    
	       }
}
      

          

  foreach ($newuser_array as $key  => $value) 
        {
          $newarray .= "[".$key."]\n";
            foreach ($value as $test => $answer) 
              {
                $newarray .= $test." = ".$newuser_array[$key][$test]."\n";
              }$newarray .= "\n";
        }                     
        unset($newuser_array[$user_edit]);
        file_put_contents($open_users_file,$newarray);   
        $message = "<p>User ".$key." Altered";
        //$myusername =   $new_user;
}
//   calling    : edituser() function
   
if(isset($_POST['Change'])) {
	$user_edit = $myusername;
	$new_user = $_POST['newusername'];
	$new_password = $_POST['newpassword'];
	$new_email = $_POST['newemail'];
  edituser($user_edit, $new_user, $new_password, $new_email ); 
}
   




if($_GET['logout'] == "yes") {
session_destroy();
header("Location: login.php");
} 

require('_adminbar.php');

?>



<html>  
  <head>    
    <title>Update details page                    
    </title>                   
    <link rel="stylesheet" href="formstyle.css" type="text/css" media="screen" />             
  </head>   
  <body>  
  <div id="controlbar">         
      <?php adminbar(); ?>     
    </div>  
    <fieldset>        
      <legend>Add User Account       
      </legend>        
      <?php echo($message); ?>       
      <form name="form2" method="post" action="<?php echo $PHP_SELF;?>" autocomplete="off">           
        <input type="hidden" name="submitcheck" value="1">           
        
                     
          <div>            
            <label>Username:<span>Please enter a username</span></label><input type="text" name="newusername" />                 
            <label>Password:<span>Please enter a password</span></label><input type="text" name="newpassword" />                 
            <label>Email:<span>Please enter a email address</span></label><input type="text" name="newemail" />                 
                        
          </div>             
          <input name="Change" type="submit" value="Change" style="margin-left :165px; margin-bottom:0px;">           
           
      </form>      
      </fieldset>        
      <div class="company">        
        <a href="#">&copy company</a>      
      </div>  
  </body>
</html>
<?php 
}
?>
Return current item: cPanel Account Creator