View Single Post
  #18  
Old 9th December 2011, 01:30
Typhon Typhon is offline
Member
 
Join Date: Dec 2011
Posts: 78
Thanks: 27
Thanked 4 Times in 3 Posts
Default

Quote:
Dude, you haven't told us anything about what you're attempting to do relative to "creating a user" or where you're doing it. Are you modifying the ISPConfig code? Are you attempting to create your own plug-in/module? It's hard for us to help when you're so vague.
No, i have created a DB user who have access to ISPC database, i create a query who permit me to add client, the complete page :

PHP Code:
<?php
// PDO con….

function crypt_password($cleartext_password) {
        
$salt="$1$";
        
$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
        for (
$n=0;$n<8;$n++) {
            
$salt.=$base64_alphabet[mt_rand(0,63)];
        }
        
$salt.="$";
        return 
crypt($cleartext_password,$salt);
    }
if(isset(
$_POST['flag']))
{

        
$username $_POST['username'];
        
$password crypt_password($_POST['password']);
        
        
$query=$db->prepare('INSERT INTO  client(username, password)
        VALUES (:username, :password)'
);
        
$query->bindValue(':username'$usernamePDO::PARAM_STR);
        
$query->bindValue(':password'$passwordPDO::PARAM_STR);
        if(
$query->execute()){echo 'yes';}
        
$query->CloseCursor();
}
else
{
?>

        <h6 class="commentsTitle"><span>Add client</span></h6>
        <form class="addComment" action="" method="post">
            <input type="text" name="username" class="" value="client..." title="client..." />
            <input type="password" name="password" title="password..." />
            <input type="submit" name="flag" class="submit" value="Add !" />
        </form>
        </div>
<?php
}
?>
Quote:
Till built ISPConfig; he's qualified to address your questions. He also gave you a code-snippet that is copy-paste-ready and demonstrates the procedure for creating a password with the crypt-md5 algorithm.
yeah i know but it's doesn't work, Im don't qualified
Quote:
Also, you do realize that the entire ISPConfig code-base is available to the public, right
That's why i choose it ;o)

Quote:
Finally, ISPConfig has a complete API for doing things like creating new users. The newest version is very well-documented. Research it.
For the moment, the API can create only FTP users…but not client ?
Thank you very much Till and cbj4074

Last edited by Typhon; 9th December 2011 at 01:34.
Reply With Quote