The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to customize the Servicestatus page ?

Discussion in 'User Experience' started by Radio_Head, Oct 16, 2002.

  1. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    Hello

    I wish to customize the Servicestatus Cpanel page : for example I wish to remove/hide disk partition details . Where is located the html file which generate the Servicestatus page on Cpanel (I cannot find it on my server ) .

    thank you
     
  2. sav

    sav Member

    Joined:
    Oct 15, 2002
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    As I know it is html [b:ebcc45ea63]generated[/b:ebcc45ea63] by CPanel cgi scripts - you cannot change it :(
    But I want to change it too :)
     
  3. Juanra

    Juanra Well-Known Member

    Joined:
    Sep 22, 2001
    Messages:
    777
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Spain
    What would happen if one changed df name to something else (not a suggestion, just a question).
     
  4. sav

    sav Member

    Joined:
    Oct 15, 2002
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    [quote:f8b7ba70e1][i:f8b7ba70e1]Originally posted by Juanra[/i:f8b7ba70e1]

    What would happen if one changed df name to something else (not a suggestion, just a question).[/quote:f8b7ba70e1]
    df? What is it? ;)
     
  5. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    [quote:4a07a5f5a4][i:4a07a5f5a4]Originally posted by sav[/i:4a07a5f5a4]

    As I know it is html [b:4a07a5f5a4]generated[/b:4a07a5f5a4] by CPanel cgi scripts - you cannot change it :(
    But I want to change it too :)[/quote:4a07a5f5a4]

    ok , but where are located these cgi scripts ? They seems generated by a C binary script instead :( .
     
  6. qualitum

    qualitum Member

    Joined:
    Feb 17, 2002
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Easy. Write a PHP script that grabs the output from the servicestatus() function, then filter it and print the results.

    Sample code:

    &?php
    // Swedish translation of returned values
    $table = &&cpanel Serverinfo=&servicestatus()&&&;
    $table = str_replace (&Memory Used&, &Använt minne&, $table );
    $table = str_replace (&Server Load&, &Serverbelastning&, $table );
    $table = str_replace (&Swap&, &Växlingsminne (swap)&, $table );
    $table = str_replace (&mysql&, &MySQL&, $table );
    $disks ='';
    $info = '';

    preg_match_all('|&tr.*tr&|U', $table, $match);

    foreach ($match[0] as $line)
    {
    // Put disks in a separate table
    if (strpos($line, 'Disk'))
    {
    $disks.=$line;
    }
    else
    {
    $info.= $line;
    }
    }
    ?&
    &cpanel setvar=&headerimg=images/home.gif&&
    &cpanel include=&stdheader.html&&
    &br&

    &table align=center border=1 class=tdshade2 cellpadding=9&
    &tr&
    &td valign=top&
    &h2&Serverstatus&/h2&
    &table align=center border=1 class=tdshade2&
    &?php echo $info; ?&
    &/table&
    &/td&

    &td valign=top&
    &h2&Diskstatus&/h2&
    &table align=center border=1 class=tdshade2&
    &?php echo $disks; ?&
    &/table&
    &/td&
    &/tr&
    &/table&

    &br&&br&
    &cpanel include=&stdfooter.html&&
     
  7. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    Uh... , good idea , thank you :) !!

    Just another question . I am having a lot of problem using php and cpanel tag at the same time . Have you tried to insert some php code to control what clients enter on web forms ?

    I tried but I was not able to make it work .

    For example now I am working on a php script which control what is entered on &Update Email contact& web form .

    I written php code to check validity of email entered . If the email is ok I entered this include

    include &saveemail.html?$email&;

    but the cpanel tag on saveemail.html is not able to get the
    $email value sent from php script.

    If you have any idea I can post you in private full check script .

    Bye
     
  8. qualitum

    qualitum Member

    Joined:
    Feb 17, 2002
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Try to redirect your PHP script to the HTML file instead of including it. And use &saveemail.html?email=$email&. You need a variable name AND a value. Your code just passes the value.

    HTH.
     
  9. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    [quote:b244dce9a1][i:b244dce9a1]Originally posted by qualitum[/i:b244dce9a1]

    Try to redirect your PHP script to the HTML file instead of including it. And use &saveemail.html?email=$email&. You need a variable name AND a value. Your code just passes the value.

    HTH.[/quote:b244dce9a1]

    I receive this error

    Warning: Failed opening '/usr/local/cpanel/base/frontend/test/contact/saveemail.html?email=test@test.net' for inclusion (include_path='/usr/local/cpanel/3rdparty/lib/php/')



    I explain better , I have this php script , check.php


    &?php

    if (!ereg ('^([a-zA-Z0-9\-\_]+\.)*[a-zA-Z0-9\-\_]+\@(\[([0-9]{1,3}\.){3,3}[0-9]{1,3}\]|([a-zA-Z0-9\-]+\.)+[a-zA-Z]{2,4})$', ($email)) || strlen ($email) &100 ) {
    $bad4 = &Please verify email&br&&;
    }
    else $bad4=&&;

    if ($bad4!=&&)

    {
    include &/usr/local/cpanel/base/frontend/test/contact/up_email_error.php&;
    }

    else

    {
    include &/usr/local/cpanel/base/frontend/test/contact/saveemail.html?email=$email&;
    }
    ?&


    If I insert a wrong email for example

    http://www.mydomain.com:2082/frontend/test/contact/check.php?email=dflòksdfòksadfò

    it opens up_email_error.php indicating me the error , and it's ok .


    If I insert a good email
    http://www.mydomain.com:2082/frontend/test/contact/check.php?email=test@test.net

    I receive this error

    Warning: Failed opening '/usr/local/cpanel/base/frontend/test/contact/saveemail.html?email=test@test.net' for inclusion (include_path='/usr/local/cpanel/3rdparty/lib/php/')

    I tried to use

    include &/usr/local/cpanel/base/frontend/test/contact/saveemail.html?email=$email&;

    and

    include &/usr/local/cpanel/base/frontend/test/contact/saveemail.html?$email&;

    but it doesn't work .

    I have this problem only inside cpanel , because I use this kind of script very often without problems .
    Do you (or anyone) have any idea ?

    Thank you
     
  10. Juanra

    Juanra Well-Known Member

    Joined:
    Sep 22, 2001
    Messages:
    777
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Spain
    With &include& you're including a piece of code to execute it, not opening a new page. To open a new page you would normally do something like this:

    header(&Location: /test/contact/saveemail.html?email=$email&);
    or
    virtual(&/test/contact/saveemail.html?email=$email&);

    but those don't work from CPanel, so I think the only thing you can do (especially if you are to use the CPanel API) is to generate the output from the PHP script itself:

    if ($wrongmail) {
    echo(&&p&Sorry, the e-mail address you entered seems to be invalid&/p&\n&);
    } else {
    print &&cpanel CustInfo=&saveemail($FORM{'email'})&&\n&;
    echo(&&h1&Thank you, your contact e-mail is now &.$email.&&/h1&&);
    }

    Since CPanel tags are parsed first and then the resulting PHP code is executed, you can't just include another script if it contains calls to the CPanel API, and you can't use PHP variable values as CPanel function arguments.

    At least, that's my experience :)
     
  11. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    [quote:b3ac489881][i:b3ac489881]Originally posted by Juanra[/i:b3ac489881]

    With &include& you're including a piece of code to execute it, not opening a new page. To open a new page you would normally do something like this:

    header(&Location: /test/contact/saveemail.html?email=$email&);
    or
    virtual(&/test/contact/saveemail.html?email=$email&);

    but those don't work from CPanel, so I think the only thing you can do (especially if you are to use the CPanel API) is to generate the output from the PHP script itself:

    if ($wrongmail) {
    echo(&&p&Sorry, the e-mail address you entered seems to be invalid&/p&\n&);
    } else {
    print &&cpanel CustInfo=&saveemail($FORM{'email'})&&\n&;
    echo(&&h1&Thank you, your contact e-mail is now &.$email.&&/h1&&);
    }

    Since CPanel tags are parsed first and then the resulting PHP code is executed, you can't just include another script if it contains calls to the CPanel API, and you can't use PHP variable values as CPanel function arguments.

    At least, that's my experience :)[/quote:b3ac489881]

    Hello

    thank you but header doesn't work (under cpanel) and your 2th solution doesn't work too because cpanel tags doesn't work inside php code (I tried it a lot of times) . The problems with include and header seems to be or is a problem with php cpanel configuration . The problem has been found by Qualitum
    http://216.118.116.105/read.php?TID=5297#23017
    Bugzilla. Bug# 927.

    Thank you!


    [ To solve temporanealy I used this
    echo &&meta http-equiv=\&REFRESH\& content=1;URL=http://www.$domain:2082/frontend/test/contact/saveemail.html?email=$email&&;

    (after passing domain hidden value on web form using the domain cpanel tag) . ]
     
  12. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    I found 4 php.ini on my server

    On
    /usr/local/lib/php.ini

    include path is empty .....

    on
    /usr/local/cpanel/3rdparty/etc/php.ini

    include_path = &/usr/local/cpanel/3rdparty/lib/php/&; )


    on
    /usr/local/cpanel/3rdparty/lib/php.ini
    include path is empty

    on
    /etc/php.ini
    include_path =&.:/php/includes:/usr/share/php&





    perhaps the include path of /usr/local/cpanel/3rdparty/etc/php.ini
    is wrong ?
     
  13. qualitum

    qualitum Member

    Joined:
    Feb 17, 2002
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Well, I have verified a few things:

    1. Header.... you are right. Smells like a bug to me. Looks like Cpanel sent some output before the script runs. I don't know if that has been reported. Shall I do that?

    2. &cpanel include=&something.php&& doesn't really work. The file is included, and CPanel tags may have been parsed (didn't check). The included file is NOT executed as PHP. Didn't expect it to either.

    3. Cpanel tags in PHP _do_ work:
    &?php
    $domain = &&cpanel print=&DOMAIN&&&;
    echo $domain;
    ?&
    This prints my domain name. You must have done something wrong ;)
     
  14. Juanra

    Juanra Well-Known Member

    Joined:
    Sep 22, 2001
    Messages:
    777
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Spain
    [quote:b40b48504e][i:b40b48504e]Originally posted by Radio_Head[/i:b40b48504e]
    your 2th solution doesn't work too because cpanel tags doesn't work inside php code (I tried it a lot of times) .[/quote:b40b48504e]

    I tested it before posting and it does work, really :)
     
  15. qualitum

    qualitum Member

    Joined:
    Feb 17, 2002
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    [quote:11d27e2f83][i:11d27e2f83]Originally posted by Radio_Head[/i:11d27e2f83]

    I found 4 php.ini on my server

    On
    /usr/local/lib/php.ini

    include path is empty .....
    [/quote:11d27e2f83]
    If I'm not mistaken, this is the one used by &normal& PHP scripts, the Apache PHP module.

    [quote:11d27e2f83]
    on
    /usr/local/cpanel/3rdparty/etc/php.ini

    include_path = &/usr/local/cpanel/3rdparty/lib/php/&; )
    [/quote:11d27e2f83]
    This is the one that prevents a normal include statement in a theme.

    [quote:11d27e2f83]
    on
    /usr/local/cpanel/3rdparty/lib/php.ini
    include path is empty

    on
    /etc/php.ini
    include_path =&.:/php/includes:/usr/share/php&

    perhaps the include path of /usr/local/cpanel/3rdparty/etc/php.ini
    is wrong ?[/quote:11d27e2f83]
    Correct.
     
  16. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    [quote:e693260cb8][i:e693260cb8]Originally posted by qualitum[/i:e693260cb8]

    Well, I have verified a few things:

    1. Header.... you are right. Smells like a bug to me. Looks like Cpanel sent some output before the script runs. I don't know if that has been reported. Shall I do that?

    2. &cpanel include=&something.php&& doesn't really work. The file is included, and CPanel tags may have been parsed (didn't check). The included file is NOT executed as PHP. Didn't expect it to either.

    3. Cpanel tags in PHP _do_ work:
    &?php
    $domain = &&cpanel print=&DOMAIN&&&;
    echo $domain;
    ?&
    This prints my domain name. You must have done something wrong ;)
    [/quote:e693260cb8]


    Are you sure this code

    &?php
    $domain = &&cpanel print=&DOMAIN&&&;
    echo $domain;
    ?&

    works fine inside your Cpanel skin ?

    I receive this error

    Parse error: parse error in /tmp/cpanel.host.1034956174.13338 on line 7

    I tried this too

    &?php
    $domain = &&cpanel print=\&DOMAIN\&&&;
    echo $domain;
    ?&

    but it doesn't work ..

    Are you sure ?

    Thank you
     
  17. Juanra

    Juanra Well-Known Member

    Joined:
    Sep 22, 2001
    Messages:
    777
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Spain
    [quote:f34aa27e69][i:f34aa27e69]Originally posted by Radio_Head[/i:f34aa27e69]
    I tried this too

    &?php
    $domain = &&cpanel print=\&DOMAIN\&&&;
    echo $domain;
    ?&

    but it doesn't work ..
    [/quote:f34aa27e69]

    Try this:
    &?php
    $domain = &&cpanel print=&DOMAIN&&&;
    echo $domain;
    ?&
     
  18. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    [quote:3733a9f29b][i:3733a9f29b]Originally posted by Juanra[/i:3733a9f29b]

    [quote:3733a9f29b][i:3733a9f29b]Originally posted by Radio_Head[/i:3733a9f29b]
    I tried this too

    &?php
    $domain = &&cpanel print=\&DOMAIN\&&&;
    echo $domain;
    ?&

    but it doesn't work ..
    [/quote:3733a9f29b]

    Try this:
    &?php
    $domain = &&cpanel print=&DOMAIN&&&;
    echo $domain;
    ?&
    [/quote:3733a9f29b]

    Ok now it works fine (!).
     
  19. qualitum

    qualitum Member

    Joined:
    Feb 17, 2002
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    [quote:f743b791bb][i:f743b791bb]Originally posted by Radio_Head[/i:f743b791bb]

    Are you sure this code

    &?php
    $domain = &&cpanel print=&DOMAIN&&&;
    echo $domain;
    ?&

    works fine inside your Cpanel skin ?
    [/quote:f743b791bb]
    LOL!! Actually it does work in my theme! But that sure is a typo!
    CPanel version =5.0.0-STABLE Build 237
     
  20. a-

    a- Registered

    Joined:
    Oct 3, 2002
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Thank you very much for the customized status page, qualitum!

    Is it possible to switch a red icon with a green one? My server has 2 CPUs and therefore can handle more than a load of 1. I think it will perform well until 3 or 4.
     
Loading...

Share This Page