Current time: 12-22-2024, 04:47 PM Hello There, Guest! (LoginRegister)


Post Reply 
Add EMail when add an User in CMS
Author Message
HellBz Offline


Posts: 2
Joined: Sep 2011
Reputation: 0
Post: #1
Add EMail when add an User in CMS
I have a problem with my CMS.

I've done it's that I do when a user logs on encouraging a page
That automatically creates an e-mail account.

Code:
INSERT INTO `mail_users` (`mail_acc`, `mail_pass`, `mail_forward`, `domain_id`, `mail_type`, `sub_id`, `status`, `mail_auto_respond`, `mail_auto_respond_text`, `quota`, `mail_addr`)
VALUES
('username', 'password', '_no_', 1, 'alssub_mail', 16, 'toadd', 0, '', 10485760, 'hellbz2@sub.domain.eu');


In the Control Panel it displays e-mail address is created.
But it shows on every visit.

I'm missing in my PHP script what?

For your information there is a page that eautomatisch creates an e-mail address
and this site is not integrated in the Control Panel ispCP.
A root mysql access I have.
09-09-2011 11:51 PM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #2
RE: Add EMail when add an User in CMS
Hi HellBz

you need to call "send_request()" which is somewhere in the libraries... (see link below)

This will give the ispcp-request-manager a kick so it integrates the mail address in the system and the status will be "ok"....

http://isp-control.net/ispcp/browser/tru...ns.php#L85

/J
09-10-2011 12:17 AM
Visit this user's website Find all posts by this user Quote this message in a reply
HellBz Offline


Posts: 2
Joined: Sep 2011
Reputation: 0
Post: #3
RE: Add EMail when add an User in CMS
I found it a short time later ...


This for tests, it works Fine
Code:
<?

//Custom IspCP encrypt password
function encrypt_db_password($db_pass) {

$ispcp_db_pass_key = 'My Pass key';

$ispcp_db_pass_iv = 'My Pass IV';

        if (extension_loaded('mcrypt') || @dl('mcrypt.' . PHP_SHLIB_SUFFIX)) {
                $td = @mcrypt_module_open (MCRYPT_BLOWFISH, '', 'cbc', '');
                // Create key
                $key = $ispcp_db_pass_key;
                // Create the IV and determine the keysize length
                $iv = $ispcp_db_pass_iv;

                //compatibility with used perl pads
                $block_size=@mcrypt_enc_get_block_size($td);
                $strlen=strlen($db_pass);

                $pads=$block_size-$strlen % $block_size;

                $db_pass .= str_repeat(' ', $pads);

                // Initialize encryption
                @mcrypt_generic_init ($td, $key, $iv);
                //Encrypt string
                $encrypted = @mcrypt_generic ($td, $db_pass);
                @mcrypt_generic_deinit($td);
                @mcrypt_module_close($td);
                $text = @base64_encode("$encrypted");
                $text=trim($text);
                return $text;
        } else {
                //system_message("ERROR: The php-extension 'mcrypt' not loaded!");
                die("ERROR: The php-extension 'mcrypt' not loaded!");
        }
}

//Send a Request to ISPCP

function send_request() {

    /**
     * @var ispCP_Config_Handler_File $cfg
     */


    $code = 999;
    
  $version ="1.0.7 OMEGA";
  define(AF_INET, '1');
  define(SOCK_STREAM, '2');
  
  
    @$socket = socket_create (AF_INET, SOCK_STREAM, 0);
    if ($socket < 0) {
        $errno = "socket_create() failed.\n";
        return $errno;
    }

    @$result = socket_connect ($socket, '127.0.0.1', 9876);
    if ($result == false) {
        $errno = "socket_connect() failed.\n";
        return $errno;
    }

    // read one line with welcome string
    $out = read_line($socket);

    list($code) = explode(' ', $out);
    if ($code == 999) {
        return $out;
    }
    
  
  
    // send hello query
    $query = "helo  {$version}\r\n";
    socket_write($socket, $query, strlen ($query));

    // read one line with helo answer
    $out = read_line($socket);

    list($code) = explode(' ', $out);
    if ($code == 999) {
        return $out;
    }

    // send reg check query
    $query = "execute query\r\n";
    socket_write ($socket, $query, strlen ($query));
    // read one line key replay
    $execute_reply = read_line($socket);

    list($code) = explode(' ', $execute_reply);
    if ($code == 999) {
        return $out;
    }

    // send quit query
    $quit_query = "bye\r\n";
    socket_write ($socket, $quit_query, strlen($quit_query));
    // read quit answer
    $quit_reply = read_line($socket);

    list($code) = explode(' ', $quit_reply);
    if ($code == 999) {
        return $out;
    }

    list($answer) = explode(' ', $execute_reply);

    socket_close ($socket);

    return $answer;
}

/**
* Reads line from the socket resource
*
* @param resource &$socket
* @return string A line read from the socket resource
*/
function read_line(&$socket) {

    $ch = '';
    $line = '';

    do {
        $ch = socket_read($socket, 1);
        $line = $line . $ch;
    } while ($ch != "\r" && $ch != "\n");

    return $line;
}

$request = send_request();
echo $request;
$pass = "Password";
echo encrypt_db_password($pass);

Now the Mysql Query..

Perfect and Thanks Modi
(This post was last modified: 09-10-2011 01:55 AM by HellBz.)
09-10-2011 01:53 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)