View Full Version : cPanel Scripts = Impossible?
DarktidesNET
04-30-03, 06:40 AM
So here I am wanting to tweak cPanel up a bit, because it lacks so much (you'd think common features) and gives you a lot of useless ones instead.
So here I go, I wake up at 6 am on the dot, fix some breakfast and get ready for an exciting day of work/code. I had an idea for cPanel and got all the back end done and it came to the point of the front end ... sure not a problem, except cPanel doesn't seem to like PHP?
I've been stuck for 1 hr trying to get a variable to work in my .php file, let a lone forms....
Any idea on what's up? Quite annoying if you ask me!
your trying to include php within the cpanel code? :confused:
kunal
DarktidesNET
04-30-03, 08:40 AM
No, I have an entirely differente page (whatever.php) that's called within the frame.
Oh ok, so what are you trying to do?
kunal
DarktidesNET
04-30-03, 09:07 AM
I'm making something that cPanel lacks for our customers, which will let them do something WHM does inside of cPanel itself by giving them a script that reads cPanel user files and re-writes them.
I don't want to disclose the exact functions until it's done. I have an idea on how I might be able to get it to work I'm going to try.
Allright... fair enough. :) just thought I could help, since I have hacked up cpanel before.
kunal
DarktidesNET
04-30-03, 10:24 AM
Finally got it to work how I want except now it won't let me write to /var/cpanel/users/ ... piece of junk :P
Did you know that when you upgrade, all tweak/changes get erased?
DarktidesNET
04-30-03, 01:50 PM
I'm not messing with that at all. I'm referring to user records that store account information.
I don't know why it won't let me write to the file. I chown/chgrp'd the file to root and chmod'd it ...
The file that is trying to write the cpanel files, is run by apache? or how?
kunal
are you making it so users can upgrade their accounts from in cpanel?
DarktidesNET
05-01-03, 08:45 AM
No, I was making it where they can change their cPanel skin.
StLHosting
05-01-03, 08:59 PM
i would think that would pose as a security problem since those files are owned by root|cpanel
DarktidesNET
05-02-03, 04:21 AM
and the security problem would be ....?
StLHosting
05-02-03, 08:04 AM
n/m i take that back, im thinking of something else lol
max.hedrom
07-15-04, 08:04 PM
I don't know if this is on the same lines of what you're doing, but I'm interested in working with the email accounts from an outside script. Basically I want to kind of make my own GUI for my own control panel, but it does limited things.. like for one, creating and deleting email accounts, and changing passwords for one already there.
Any help on where to begin? I was working with php's IMAP functions, but my host doesn't have the library installed yet to deal with it. There has to be another way though, right?
The files are owned by? Have you tried root:wheel?
max.hedrom
07-15-04, 08:36 PM
I don't know what root:wheel is, so no.
I know that cPanel doesn't use a mySQL database for its accounts. Does it use a flat file for these? If so, I am not sure who owns those files as of right now.
Like I said, I'm just getting started on this, so I may need to learn some new things.
alex042
07-16-04, 03:52 AM
I believe cpanel runs on it's own copy of php so it may be useless to makes changes in your regular php.ini file if you want to use it in cpanel itself. Do a search on php.ini and you can make your changes in the one in the cpanel directory. Btw, if i remember correctly, it's running php4.2?
max.hedrom
07-16-04, 08:03 AM
I am trying to run it from outside cPanel itself.
For instance, there are some scripts in this forum that use fopen and cron jobs to run a backup on a cPanel account. I am hoping to do something similar, but be able to access the account's email addresses and display them for starters.
alex042
07-16-04, 08:28 AM
I'm not sure exactly what you're trying to do but sounds like something their webmail programs do already?
You may want to check on cpanel's site for some instructions on tapping into their code. They have certain query strings you can use to call certain functions. That how a lot of these billing programs auto-create accounts, etc.
max.hedrom
07-16-04, 02:11 PM
their webmail programs don't allow you to add/change/delete the email addresses themselves, they just allow you access to the mail. But, yea, somewhere along the line they do have to access a particular account. I'm just not sure how they're doing it.
I poked around on cpanel's online documentation but came up short. I've exhausted my resources, which is why I'm asking if anyone else has ever done anything like this.
Try looking at this plugin for squirrelmail. http://squirrelmail.org/plugin_view.php?id=204
You could, if you have root access, load your own squirrelmail with this mod to the server and change the httpd.conf so that it's a serverwide address like http://yoursite.tld/mywebmail. Or you could add this mod to the existing version of squirrelmail that cpanel uses, of course it may be deleted with updates.
Update: I've verified that the plugin works as described with the latest cPanel and can be incorporated in SquirrelMail (loaded to your site, not the cpanel version) without shell access. This plugin will update the users password using cPanel, so there doesn't appear to be any compatabilty problems.
Why would you allow them to change skins? In order to change there skins you have to have it so root logs in, then you are exploiding your password. Why? Why?
Dras You somewhat correct, to do any of this you must use either the cPanel or WHM (depending on what you are changing) user name and password or equivalent. This is very common though, in fact if your using any of the billing/account creation scripts that interface with WHM your using your remote access key.
It wouldn't be necessary to use the root password or key for this function, since they're only changing to available skins.
vBulletin v3.5.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.