lammadog

Member
Dec 21, 2002
17
0
151
I've tried so many different syntax variations trying to build my &cpanel& tags with php


eg. echo '&cpanel include=&$path&&';


anyone got this worked out and working?
or is it just that Cpanel parses it's tags before it parses PHP and it won't work right???
 

rbmatt

Well-Known Member
Oct 21, 2002
211
0
166
Well, that seems ok. Does everything else php work? Some boxes have trouble with php in that directory.

http://www.gwsa.net/skinny/vars.phps
 

lammadog

Member
Dec 21, 2002
17
0
151
yeah, everything else in php is working fine,

if your looking at my source, on the very bottom I'm trying make an inc() function, that will build the &cpanel includes& for me.

But when I try to call it, I just get a blank screen where the included stuff should be displayed
 

lammadog

Member
Dec 21, 2002
17
0
151
naw, it's looking like it's not gonna work, even using a regular &cpanel include=&&& and adding a variable to the URL breaks it too. Now, that's easy enough to work around by just using session variables, but it looks like I'm just gonna have to hard code the includes.

for the first level I'll just work them into the .conf file for the icon engine, but I forsee myself spenting bucko hours writing if statments :p
 

lammadog

Member
Dec 21, 2002
17
0
151
I $*@#( HATE CPANEL HAHA



this works...
&cpanel include=&mini.php&&

this don't work...
&?
echo '&cpanel include=&mini.php&&';
?&


I don't really have to hardcode all the navigation do I?????


this works....
&?
if ( $mylink == &mini& )
{ ?& &cpanel include=&mini.php&& &? }
?&

... but that kinda defeats the whole purpose :p




HELP... ANYONE... ?
hehe
 

Juanra

Well-Known Member
Sep 22, 2001
777
0
316
Spain
It's cpanel first and PHP later. Look at /usr/local/cpanel/cpanelphp to see how the PHP wrapper works. Also the PHP version compiled into Cpanel seems to be quite restricted, but still it allows you to do very interesting things.

The main problem I've found with it is that GET parameters are lost because of a bug in cpanelphp. I posted a patch in bugzilla, but it's not available now, and it was a shabby patch anyway. If anyone has come up with something to solve this problem without using another intermediate file, please post it here, thanks.
 

lammadog

Member
Dec 21, 2002
17
0
151
cool thanks Juanra,

I did briefly glance at the cpanelphp file, but I gave it a better look and that answered me alot of questions ;)

I also slept on the problem, and I think I got it figured out, it's kinda a drag that I can't use my php variables in the &cpanel include=&, so I'll have to write a vary long switch statement, but oh well...

And everyone, please forgive last nights rant, I'm sure you've all been there when you got started with Cpanel
 

uch-alex

Registered
Oct 24, 2002
2
0
151
I'm having a different problem. When I renamed changepass.html to changepass.php, it stopped working. Here is the part that worked before:

<cpanel Passwd="change_password($FORM{'oldpass'},$FORM{'newpass'})">

When called from a php file, it no longer sees $FORM{'oldpass'} or $FORM{'newpass'} (or any such variable). I can use $oldpass and $newpass from PHP, but not from a chapel tag.

Any suggestions?
 
Last edited:

rvskin

Well-Known Member
PartnerNOC
Feb 19, 2003
399
1
168
<cpanel Passwd=" change_password($FORM{'oldpass'},$FORM{'newpass'})">

should not have space between =" change


To develope skin using php, don't think you develop php, you have to think you are develop under cpanel-php wrapper as Juanra mention before.
 

uch-alex

Registered
Oct 24, 2002
2
0
151
I don't have the space there. This forum is evil and for some reason put it there. It also wrapped that line somewhat.

Let me try a shorter example:

<cpanel print="$FORM{'domain'}">

This works from an .html file but fails from within a .php file, however the $domain PHP variable does work in that case.

Basically something is preventing cpanel from reading form variables and I suspect cpanelphp to be the problem. Someone mentioned it losing GET variables, but I am using POST. is this also true for POST? Is a patch available?
 
Last edited:

Faldran

Well-Known Member
May 28, 2002
135
0
316
Yeah, I have to... encountered the same problem!

Still waiting on a fix for it!
 

Juanra

Well-Known Member
Sep 22, 2001
777
0
316
Spain
Originally posted by Faldran
So has anyone found a complete fix for this yet?

Or even a good work around?
I have written a new cpanelphp wrapper which only uses one intermediate file (like the original wrapper does) and makes POST and GET vars available to both CPanel and PHP (except that CPanel ignores GET vars when POST vars are passed):

http://html.conclase.net/cp/scripts/cpanelphp.txt

cPanel.net Support Ticket Number: 24008
 

cyon

Well-Known Member
PartnerNOC
Jan 15, 2003
314
0
241
hi,

Juanra, thx for your big work.
Your php wrapper is working on my first box without any problems.

Now i have installed a second box with the same skin and use your wrapper again, but it wont work any more..

this is the code wich causes the problem:
<?php
$pw=<cpanel print="$password">;
?>

its working perfect on server1, but on server2 i get this:

Parse error: parse error in /usr/local/cpanel/base/tmp/username-1069815840-16991 on line 11

any ideas?

thank you very much in advance.
 
Last edited:

equens

Well-Known Member
Feb 8, 2002
283
5
318
Php functions in cpanel

How can I use a php function with cpanel tags? Why this does not work?


conf.php:
PHP:
function ChangePass($email,$password,$quota,$domain) {?>
<cpanel Email="passwdpop($email,$password,$quota,$domain)">
<? } ?>
dopasswdpop.php:
PHP:
<cpanel include="../conf.php">
<? ChangePass(); ?>
 

kosmo

Well-Known Member
Verifed Vendor
Aug 12, 2001
400
0
316
All over Europe
function ChangePass($email,$password,$quota,$domain) {?>
<cpanel Email="passwdpop($email,$password,$quota,$domain)">
<? } ?>
This will produce mismatch and unwanted results. Making PHP and cpanel working together means understanding following:

- CPanel tags will be parsed only when the files are included using cpanel include (not php include) which in your case is true.
- CPanel include work only in one level. A file that is already included can not include more files (parser exits if this is the case)
- CPanel tags will run on file load independent of php statements. Example:

if ($blue) {
<cpanel Email="passwdpop($email,$password,$quota,$domain)">
}

The password will be changed on file load, no matter if blue is true or not. The cpanel parser will then deliver to the PHP parser following code:
if ($blue) {
Password successfully changed!
}

(or similar)

PHP will display a syntax error.

Actually the only way to work around it is: Make a page for new password submission. On "Submit", load a separate file with the proper cpanel commands to modify the password.

kosmo
 

equens

Well-Known Member
Feb 8, 2002
283
5
318
Hello Kosmo and thank you for your reply. Instead of this, I want to change files to php to add custom functions like header(), footer() or menu. I have a conf.php with my functions and I put this code ej:

PHP:
<cpanel include="../conf.php">
<? Header(); Menu(); ?>
html here
<? Footer(); ?>
It works fine but I would to know if this is the correct way to do this.

And about the php functions and who CPanel tags works I think would have to offer support to php functions to do the same with php. Ej. Instead of setdef.html, def.html and dosetdef.html to set default addres, we would only need one def.php file.
Thanks again!