Please help me with anyone that I am searching for a month every month, which is not doing anything . P>
This will create the script FTP account below, but it defines in the line how to add "FTP account" as a test directory, how can I connect this script to HTML form so that it The script works through that HTML form. Thank you for a FTP account
& lt ;? Php $ conn = array ('host' = & gt; 'domain name', 'port' = & gt; '2083', 'user' = & gt; 'no no', 'pass' => No '); Function cpanel_api ($ conn, $ type, $ user, $ pass, $ domain) {if ($ conn ['port'] == '2087' || $ conn ['port'] == '2083' || $ Conn ['port'] == '443') {$ site = 'https: //' $ Conn ['host'] ':'. $ Conn ['port']; } And {$ site = 'http: //' $ Conn ['host'] ':'. $ Conn ['port']; } Switch ($ type) {case 'add_ftp': $ xmlin = '& lt; Cpanelaction & gt; & Lt; Module & gt; FTP & lt; / Module & gt; & Lt; Func & gt; ADFTP & lt; / Func & gt; & Lt; Apverion & gt; 1 & lt; / Apverion & gt; & Lt; Args & gt; '. $ User '& lt; / Arg & gt; & Lt; Arg & gt; . $ Pass' & lt; / Args & gt; & Lt; Args & gt; / '$ User' & lt; / Arg & gt; & Lt; Arg & gt; 20 & lt; / Arg & gt; & Lt; / Cpanelaction & gt; ; break ; Case 'del_ftp': $ xmlin = '& lt; Cpanelaction & gt; & Lt; Module & gt; FTP & lt; / Module & gt; & Lt; Func & gt; Delftp & lt; / Func & gt; & Lt; Apverion & gt; 1 & lt; / Apverion & gt; & Lt; Args & gt; . $ User '& lt; / Arg & gt; & Lt; Arg & gt; 1 & lt; / Arg & gt; & Lt; / Cpanelaction & gt; ; break ; Case 'add_subdomain': $ xmlin = '& lt; Cpanelaction & gt; & Lt; Module & gt; Subdomain & lt; / Module & gt; & Lt; Func & gt; Junk Baiden & lt; / Func & gt; & Lt; Apverion & gt; 1 & lt; / Apverion & gt; & Lt; Args & gt; . $ User '& lt; / Arg & gt; & Lt; Arg & gt; . $ Domain & lt; / Args & gt; & Lt; Args & gt; 0 & lt; / Args & gt; & Lt; Args & gt; 0 & lt; / Args & gt; & Lt; Args & gt; / '$ User' & lt; / Arg & gt; & Lt; / Cpanelaction & gt; ; break ; Case 'del_subdomain': $ xmlin = '& lt; Cpanelaction & gt; & Lt; Module & gt; Subdomain & lt; / Module & gt; & Lt; Func & gt; Dellsbomman & lt; / Func & gt; & Lt; Apverion & gt; 2 & lt; / Apverion & gt; & Lt; Args & gt; & Lt; Domain & gt; . $ User $ domain '& lt; / Domain & gt; & Lt; / Arg & gt; & Lt; / Cpanelaction & gt; ; break ; Default: echo 'type error'; } If ($ type == 'add_ftp' || $ type == 'del_ftp' || $ type == 'add_subdomain' || $ type == 'del_subdomain') {$ query = '/ xml-api / cpanel? User = '$ Conn [' user ']' & Amp; Xmlin = '$ Xmlin; $ Curl = curl_init (); Curl_setopt ($ curl, CURLOPT_SSL_VERIFYPEER, 0); Curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, 1); Curl_setopt ($ curl, CURLOPT_SSL_VERIFYHOST, 0); Curl_setopt ($ curl, CURLOPT_USERPWD, $ conn ['user']. ':'. $ Conn ['pass']); Curl_setopt ($ curl, CURLOPT_HEADER, 0); Curl_setopt ($ curl, CURLOPT_URL, $ site. $ Query); $ Result = curl_xax ($ curl); Curl_close ($ curl); }} / ***** Add subdomain and FTP account ***** / cpanel_api ($ conn, 'add_subdomain', 'test', '0123456789', '.domain.com'); Cpanel_api ($ conn, 'add_ftp', 'test', '0123456789', '.domain.com'); / ***** DEL subdomain and FTP account ***** // // cpanel_api ($ conn, 'del_subdomain', 'test', '0123456789', '.domain.com'); // cpanel_api ($ conn, 'del_ftp', 'test', '0123456789', '.domain.com'); ? & Gt;
How to create a FTP account in CPL:
& Lt;? $ User = $ cpenal_user; // Cranial root username $ pass = $ cpenal_pass; // cpanel root password $ domain = $ site_domain; // cpanel root domain $ fquota = $ drive_space; // FTP Disk Space MB (for new FTP account) $ skin = 'x3'; // cpnel version $ fuser = // new username for the FTP account $ fpass = / default password for default password $ uri = '/ directiry /'; // Internal URL for FTP home folder / directory / if (MKDIR ($ Yuri, 0777)) // T VP directory $ F directory = '/ directory /'; // $ Fusion = $ feed user; $ Fhomedir = '/ public_html /' $ FDirectory; $ Url = "https: // $ user: $ pass @ $ domain: 2083 / frontend / $ skin / FTP / ddpp.hmm?"; $ Url = $ url "Login = $ fuser & password = $ fpass & homedir = $ fhomedir & quotas = $ fquota"; $ Result = @ file_gate_content ($ url); If (preg_match ('/ (account is created successfully) /', $ result)) {// new directory created with FTP}}? & Gt;
No comments:
Post a Comment