|
||||
|
Quote:
As the PHP will be executing as root, you will be able to access external files as well as store files in frontend/x3/myplugin/ Regarding API1/API2 functions that exist (which would typically be within <cpanel ... > tags), there are very many functions. Take a peak at the source code of the x3 theme for inspiration. If you're looking for a specific API function, please let me know.
__________________
Need technical assistance? You can find your best avenue for support at: http://support.cPanel.net -- cPanel David G., Lead Forum Administrator & cPanel Technical Sales Representative |
|
||||
|
Quote:
If you are incorporating the creation of MySQL databases into a cPanel Plug-in (or a script that uses the XML API), you can use the following API call: Code:
<cpanel Mysql="adddb(DBName)"> To create a database user, you can use this API call: Code:
<cpanel Mysql="adduser(user,pass)"> Code:
<cpanel Mysql="adduserdb(db,user,ALTER, CREATEROUTINE, CREATETEMPORARYTABLES, CREATE, DELETE, DROP, SELECT, INSERT, UPDATE, REFERENCES, INDEX, LOCKTABLES, ALL)"> user = the database user to grant access to this database The upper-case parameters refer to individual permissions to apply, ALL representing all permissions.
__________________
Need technical assistance? You can find your best avenue for support at: http://support.cPanel.net -- cPanel David G., Lead Forum Administrator & cPanel Technical Sales Representative |
|
|||
|
Thanks thats really awesome
But I will have to check whether the user has not crossed the DB limit with MAXSQL right Also I wanted to know how should i store a file in the USERS account X3 is a theme and I wanted to store a file in /home/user/.userplugindata I know i have harassed you a lot! |
|
||||
|
Quote:
http://cpanel.net/plugins/xmlapi/cpanel.html That's not something that is handled via the APIs. Typically, one would have a script running with root privileges handling the storing of files into user accounts, being sure to set ownership and permissions as needed.
__________________
Need technical assistance? You can find your best avenue for support at: http://support.cPanel.net -- cPanel David G., Lead Forum Administrator & cPanel Technical Sales Representative |
|
|||
|
Sorry I forgot to mention that the FILES will be located at:
/usr/local/cpanel/whostmgr/docroot/cgi/plugin/enduser The enduser will be redirected VIA a link file for all situations to: /usr/local/cpanel/whostmgr/docroot/cgi/plugin/enduser In such a situation also the CPANEL parser works but how should I store the file in /home/user/.plugdata this is because the CPAnel parser executes it as some RANDOM file! |
|
|||
|
Pleaaaaaaaaaaaase help me,
I am so close to getting my thing done. I want the following INFO: 1) How to find the available disk space remaining and load it in PHP so that I can check that we dont exceed the space remaining 2) How to know the MYSQL server e.g. localhost or as the case may be! Please help me. I need this info to complete the PLUGIN I make |
|
||||
|
Quote:
2. Offhand, I'm not aware of how to retrieve the MySQL server's location or if it is using a remote MySQL server. Typically, localhost will work. However, this wouldn't work in a setup utilizing remote MySQL.
__________________
Need technical assistance? You can find your best avenue for support at: http://support.cPanel.net -- cPanel David G., Lead Forum Administrator & cPanel Technical Sales Representative |
|
|||
|
1) I am referring to disk space remaining for a cPanel user
Also could you give me a link to a list of PHP cPanel functions that load all the USER DATA in PHP variables. The API and API2 functions need to be called using <?cp ?>. 1) I want a list of functions called via <cpanel PHP="function()"> and if can be called directly via PHP functions then it would be the BEST 2) <cpanel MySQL="adddb('asasaas')"> is not working and no database is created Thanks for the help Last edited by rongup; 01-23-2009 at 08:53 AM. Reason: More info |
|
||||
|
The following URL will provide information about disk space consumed and their allocated disk space. You can write your own code to process this to provide the disk space remaining.
Code:
/xml-api/cpanel?user=username&xmlin=<cpanelaction><module>StatsBar</module><func>stat</func><apiversion>2</apiversion><args><display>diskusage</display></args></cpanelaction> Quote:
If it is an external PHP script, you will need to use the XML-API to interface with API1 as described at: http://cpanel.net/plugins/xmlapi/cpanel.html The <cpanel> and <cp?> tags are for use within the cPanel interface itself. They are not functional outside of the cPanel interface, hence we have the XML API to allow you to work around this limitation of API1 and API2.
__________________
Need technical assistance? You can find your best avenue for support at: http://support.cPanel.net -- cPanel David G., Lead Forum Administrator & cPanel Technical Sales Representative |
|
|||
|
All scripts are within the CPanel theme frontend/x3/plugin
I want the functions that can give me the required data as I posted: 1) I want a list of functions called via <cpanel PHP="function()"> and if can be called directly via PHP functions then it would be the BEST 2) <cpanel MySQL="adddb('asasaas')"> is not working and no database is created The file is for e.g.: http://domain:2082/frontend/x3/plugin/index.php I want to create a Database and check the available space remaining of a ENDUSER in frontend/x3/plugin/index.php I did a research and learnt how to call API and API2 functions that need to be called using <?cp ?> from a PHP File within cPanel interface itself. Using <?cp ?> I get the output in HTML/Text Format. But I couldnt find any way to store the output in PHP Variables Also the function <cpanel MySQL="adddb('asasaas')"> is not working within the cPanel interface itself. Please help. I hope I have clarified the problem and the environment I am working in! |
|
||||
|
Quote:
Quote:
If you're looking to pass the values returned by our APIs to a PHP script, there are various ways of doing so. However, I believe the most elegant way of doing this in PHP would be to use our LivePHP framework, which you can learn about at: http://httpupdate.cpanel.net/cpanels...php/README.TXT
__________________
Need technical assistance? You can find your best avenue for support at: http://support.cPanel.net -- cPanel David G., Lead Forum Administrator & cPanel Technical Sales Representative |
|
|||
|
The <cpanel Mysql="adddb('test')"> is now working (Thanks for correcting the case sensitive mistake)
1) However <cpanelif $CPERROR{'mysql'}> is not working even if the database is not created e.g. There is already an existing database rongup_test. Now I create a database using : <cpanel setvar="dprefix=../"> <cpanel Mysql="adddb('test')"> If there are errors it should be in this variable: <cpanel print="$CPERROR{'mysql'}"> (I got this from the addb.html page) But it prints no errors 2) I checked that Live PHP framework you posted above (even before you posted). But I refrained from using it as IT Had comments that it is going to be changed in the future and IT should be used only with the CPANEL VERSION it came with. Here is the Comments: PHP Code:
Also I will HAVE to RENAME 100's of pages to .LIVE.PHP which will not look so cool! Is there any other way of calling API2 from PHP or LivePHP is the stable one and can be used 3) Also I am having problems that <cpanel Mysql="adddb('.$dbname.')"> is executed before PHP is executed. So the database user_dbname is created instead of the value in $dbname i.e a PHP variable! Last edited by rongup; 01-25-2009 at 11:24 AM. |
|
||||
|
Quote:
The $CPERROR{'mysql'} code you're using, is that within a Live PHP file? As for the message in the file, many of our newer APIs have comments indicating they are for cPanel 12. However, the intent of the message is to not copy this file to another cPanel/WHM server (e.g. a server still running cPanel 10) and expect it to continue functioning properly.
__________________
Need technical assistance? You can find your best avenue for support at: http://support.cPanel.net -- cPanel David G., Lead Forum Administrator & cPanel Technical Sales Representative |
![]() |
| Thread Tools | |
| Display Modes | |
|
|