Hello
Can create a database and add user , Change Permissions to Directories and add Password Protect to Directories by useing php ?
if yes , how ?
Note I am not root user
Hello
Can create a database and add user , Change Permissions to Directories and add Password Protect to Directories by useing php ?
if yes , how ?
Note I am not root user
Last edited by S P E E D; 06-13-2011 at 05:04 AM.
I do not understand very well what you want. But if you are trying to create a db with users on it change perms and set password protected directories you can do it using you panel.
Check the documentation here:
MySQL Databases
File Manager
Password Protect Directories
Hope this info can help you.
Cya.
Hi SPEED,
If you're trying to make an application, script, or web application on your site, you should probably use the PHP XML-API client class to make cPanel API calls (documentation for using the XML/JSON-API interface for cPanel APIs).
If you're writing a cPanel Plugin or an application that lives within a cPanel theme directory, you can use LivePHP to make cPanel API calls
fi77i is referencing the API calls that you will use when requesting cPanel to perform the manipulations that you mention.
There should be plenty of forum threads related to using the XML-API client class for MySQL database management. There's also a blog article that discusses using the XML-API client class in a script (note, the article link to the full example is broke, but you can find the full example it here)
Regards,
-DavidN
David Neimeyer
Integration Developer
sdk.cpanel.net
APIs: XML-API API1 & API2
Check Out: Developer Downloads Integration Blog
Need Support? Support Ticket Developer Forum Feature Request
Yes, you can use the cPanel account password. When authenticating as a cPanel user, you need to use port 2083 (ssl) or 2082 (non-ssl).
Regards,PHP Code:<?php
include "xmlapi.php";
$ip = 'my.domain.com';
$user = 'dave';
$user_pass = 'secret!';
$xmlapi = new xmlapi($ip);
$xmlapi->password_auth($user,$user_pass);
$xmlapi->set_port('2083');
$xmlapi->set_debug(1); //for debugging
$cp_account = $user;
$args = array(
'cptest',
);
/**
* This call will create the 'dave_cptest' database because we're working
* against the 'dave' account.
*/
$result = $xmlapi->api1_query($cp_account, 'Mysql','adddb',$args);
?>
-DavidN
David Neimeyer
Integration Developer
sdk.cpanel.net
APIs: XML-API API1 & API2
Check Out: Developer Downloads Integration Blog
Need Support? Support Ticket Developer Forum Feature Request
nice , but i want add user to db , and i have another Question
can change Permissions to file or folder ?
Yes, you can add a user to a database too. You will first need to create the user with Mysql::adduser. Then you can give that user privileges to the database with Mysql::adduserdb.
You can change file permission with the API2 Fileman::fileop call. This works for files within your home directory. You cannot change file ownership with an API call.
-DavidN
Last edited by cPanelDavidN; 06-16-2011 at 07:13 AM. Reason: typo
David Neimeyer
Integration Developer
sdk.cpanel.net
APIs: XML-API API1 & API2
Check Out: Developer Downloads Integration Blog
Need Support? Support Ticket Developer Forum Feature Request
hi ,
i used this code but see error apper
Warning: file_get_contents() [function.file-get-contents]: SSL: The operation completed successfully. in C:\xampp\htdocs\xmlapi.php on line 737
Warning: file_get_contents() [function.file-get-contents]: SSL: The operation completed successfully. in C:\xampp\htdocs\xmlapi.php on line 737
Warning: file_get_contents() [function.file-get-contents]: SSL: The operation completed successfully. in C:\xampp\htdocs\xmlapi.php on line 737
Warning: file_get_contents() [function.file-get-contents]: SSL: The operation completed successfully. in C:\xampp\htdocs\xmlapi.php on line 737
PHP Code:<?php
/**
* @author PHPDes7
* @copyright 2011
*/
include("xmlapi.php");
$host = "xxx.com";
$cpuser = "cpuser";
$cppass = "cppass";
$db_name ="dbname";
$db_user="dbuser";
$db_pass="dbpassword";
$xmlapi = new xmlapi($host);
$xmlapi->set_port(2083);
$xmlapi->password_auth($cpuser,$cppass);
$xmlapi->set_debug(1);
//create database
print $xmlapi->api1_query($cpuser, "Mysql", "adddb", $db_name);
//create user
print $xmlapi->api1_query($cpuser, "Mysql", "adduser", array('user' => $db_user,'pass'=> $db_pass));
//add user to database
$xmlapi->api1_query($cpuser, "Mysql", "adduserdb", array(
'db' => $db_name,
'user'=> $db_user,
'SELECT INSERT UPDATE CREATE DELETE ALTER DROP'));
?>
Hello,
MY Questions Or Request for Advise:
I am relatively new to using C-panel and WHM (and later soon WHMPHP). I noticed that as a reseller I fet the following warning:
Warning! You are logged in with the reseller or root password.
I am basically wondering what I need to be worried about, naturally I have some ideas. I have logged in a "A Reseller" however I do have some of my own domains and websites to migrate over. I currently have access to a standard reseller, a master reseller and an Alpha reseller.
I imagine that the migration of the websites might be more difficult with the standard reseller, however all the real functions get carried in C-panel it seems. I have set up name servers and and the domains will not be transferred.
The entire tar archive for about 30 or so domains with about 15 small (mostly WordPress) websites is about 3 Gigabyte and then apparently there is another homedir which is about another GB.
Just a simple overview of the migration, and can it be done using file manager or is FTP much better. Is there an order to do things, such as mysql databases 1st then files etc.