[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] Is a PHP function avalaible ??



Hi there,
Wouldn't life be much easier if customers could figure out themselves if a
specific PHP function is avalaible to them or not ??

Well here's a script that offers this possibilty. It's extremely simpel, and
works very well. In addition to this it allows you to redirect people to the
correct page off the php.net documentation site.
Our PHP questions reduced frmo about 150 per week to 10 per week, and our
customers prefer it this way because they are fixed straight away.

All you need to do is review the graphical aspect, but that should be too
hard.

<?
/*
File:            fonctions_php.php4
Description:    Verify whether or not a php function has been compiled or
not
                and if the function exists provide a link towards online
documentation
Author:            Marco Baurdoux for Infomaniak Network SA
Version:        1.0
Date:            09.06.2001
*/

if(!(isset($step)))
{
    print ("
<HTML>
<HEAD>
<TITLE></TITLE>
<style>

A        {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #FFFFFF;
    text-decoration: none;
        }
A:hover        {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #000000;
    text-decoration: none;
        }
        
.linkwhite    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #FFFFFF;
    text-decoration: none;
        }
.linkwhite:hover    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #000000;
    text-decoration: none;
        }
.textblacksmall    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 10px;
    font-weight: 400;
    font-size: 10px;
    color: #000000;
    text-decoration: none;
        }
.textblacksmallbold    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 10px;
    color: #000000;
    text-decoration: none;
        }
.textblack    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #000000;
    text-decoration: none;
        }
.textblackbold    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #000000;
    text-decoration: none;
        }
.textwhite    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #FFFFFF;
    text-decoration: none;
        }
.textwhitebold    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;a, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #FFFFFF;
    text-decoration: none;
        }
.textorangebold    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #FF9900;
    text-decoration: none;
        }
.textdarkblue    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #330099;
    text-decoration: none;
        }
.textdarkbluebold    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #330099;
    text-decoration: none;
        }
        
.textdarkblue:hover    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #FFFFFF;
    text-decoration: none;
        }

.textobligatory{
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #006600;
    text-decoration: none;
        }

.textblacklink{
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #000000;
    text-decoration: none;
        }
.textblacklink:hover{
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #FF9900;
    text-decoration: none;
        }
.titleblack    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #000000;
    text-decoration: none;
        }
.titlewhite    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #FFFFFF;
    text-decoration: none;
        }
.lightred {
    f: 16px;
    color: #FFFFFF;
    text-decoration: none;
        }
.lightred {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #FFE1D5;
    text-decoration: none;
        }
.lightredbold {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #FFE1D5;
    text-decoration: none;
        }
    
</style>
</HEAD>
<BODY bgcolor=\"336699\"  marginwidth=0 marginheight=0 leftmargin=0
topmargin=0 style=\"margin:0px\">
<TABLE border=0 cellspacing=0 cellpadding=0 width=\"100%\" >

<tr>
    <td bgcolor=\"204060\" colspan=3>
    <script LANGUAGE=\"JavaScript\">
        ImgLogOffOut = new Image()
        ImgLogOffOver = new Image()
        ImgLogOffOverR = new Image()
        ImgLogOffOut.src = \"/base/logoff.gif\"
        ImgLogOffOver.src = \"/base/logoff2.gif\"
        ImgLogOffOverR.src = \"/base/logoff2r.gif\"
    </script>
    <table border=0 cellspacing=0 cellpadding=0 width=\"100%\" >
    <tr> 
          <td rowspan=2 valign=\"TOP\" width=100%><a
href=\"http://www.infomaniak.ch\";><img border=0
src=\"gfx/logo_infomaniak.gif\" width=\"200\" height=\"60\"></a></td>
          <td align=\"center\" valign=\"top\" >&nbsp;</td>
  </tr>

<tr> 
    
          <td align=\"center\" valign=\"bottom\">  </td>
    
    
    
  </tr>

        <TR background=\"gfx/borderemb.gif\">
          <TD colspan=2><img src=\"/base/transp.gif\" width=1px
height=11px></TD>
    </TR>
</table>

    

    </td>

</tr>



<TR>
    <TD><img src=\"/base/transp.gif\" width=1px height=30px></TD>
</TR>
<TR>
<TD align=center>
<TABLE border=0 width = 420 cellspacing=0 cellpadding=2 bgcolor=#000000>
<TR>
    <TD>
            <TABLE border=0  bgcolor=#E0E0E0 width=100% cellspacing=0
cellpadding=0>
              <TR bgcolor=#FF9900>
                <TD colspan=3 bgcolor=#FF9900><img
src=\"gfx/fonction_php.gif\" width=\"339\" height=\"28\"><a
href=\"phpfonctions.php4?step=2\" target=\"blank\" align=right
valign=middle>phpinfo()</a></TD>
              </TR><center><font color=\"#FFFFFFF\"
size=\"3\"><b>$message</b></font></center>
              <TR> 
                <TD colspan=3 bgcolor=#000000><img src=\"/base/transp.gif\"
height=2px width=1px border=0></TD>
              </TR>
              <TR> 
                <TD colspan=3 bgcolor=#E0E0E0><img src=\"/base/transp.gif\"
height=5px width=1px border=0></TD>
              </TR>
              <FORM action=\"phpfonctions.php4?step=1\" method=\"post\"
id=form1>
                <TR>
                  <TD><img src=\"gfx/bord_gris.gif\" height=1 width=1></TD>
                  <TD class=textblack align=Right>Fonction: :</td>
                  <td>
                    <input type=\"text\" name=\"function\" size=25
maxlength=80>
                    <font class=textblack> </font></td>
                </TR>
                <TR>
                  <TD><img src=\"gfx/bord_gris.gif\" height=1 width=1
border=0></TD>
                  <TD class=textblack align = Right>&nbsp;</td>
                  <td>&nbsp;</td>
                </TR>
                <TR>
                  <TD><img src=\"gfx/bord_gris.gif\" height=1 width=1
border=0></TD>
                  <TD colspan=2 align=center>
                    <input type=\"Submit\" value=\"Chercher\">
                    <img src=\"/base/transp.gif\" width=15 height=1>
                    <input type=\"Reset\" value=\"Recommencer\">
                  </td>
                </TR>
                <TR>            <TR>
                  <TD colspan = 3><img src=\"/base/transp.gif\" height=5px
width=1px border=0></TD>
                </TR>
              </FORM>
            </TABLE>
    </TD>
</TR>
</TABLE>
<TR>
    <TD colspan=3 align='right'><img border=0 src='gfx/logo_pi.gif'
width=\"10\" height=\"9\">&nbsp;</TD>
  </TR>
</TABLE>


</BODY>
</HTML>");

}


if($step == "1" && !$function)
{
    header("location:phpfonctions.php4?message=Vous avez oubliÈ de spÈcifier
une fonction!!!");
}

if($step == "1" && $function)
{
    print ("
<HTML>
<HEAD>
<TITLE></TITLE>
<style>

A        {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #000000;
    text-decoration: none;
        }
A:hover        {    text-decoration: none;
        }
A:hover        {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #FF9900;
    text-decoration: none;
        }
        
.linkwhite    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #FFFFFF;
    text-decoration: none;
        }
.linkwhite:hover    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #000000;
    text-decoration: none;
        }
.textblacksmall    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 10px;
    color: #000000;
    text-decoration: none;
        }
.textblacksmallbold    {;
        }
.textblacksmallbold    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 10px;
    color: #000000;
    text-decoration: none;
        }
.textblack    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #000000;
    text-decoration: none;
        }
.textblackbold    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #000000;
    text-decoration: none;
        }
.textwhite    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #FFFFFF;
    text-decoration: none;
        }
.textwhitebold    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #FFFFFF;
    text-decoration: none;
        }FFF;
    text-decoration: none;
        }
.textorangebold    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #FF9900;
    text-decoration: none;
        }
.textdarkblue    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #330099;
    text-decoration: none;
        }
.textdarkbluebold    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #330099;
    text-decoration: none;
        }
        
.textdarkblue:hover    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #FFFFFF;
    text-decoration: none;
        }

.textobligatory{
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #006600;    font-size: 12px;
    color: #006600;
    text-decoration: none;
        }

.textblacklink{
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #000000;
    text-decoration: none;
        }
.textblacklink:hover{
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #FF9900;
    text-decoration: none;
        }
.titleblack    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #000000;
    text-decoration: none;
        }
.titlewhite    {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #FFFFFF;
    text-decoration: none;
        }
.lightred {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    font-size: 12px;ont-weight: 400;
    font-size: 12px;
    color: #FFE1D5;
    text-decoration: none;
        }
.lightredbold {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #FFE1D5;
    text-decoration: none;
        }
    
</style>
</HEAD>
<BODY bgcolor=\"336699\"  marginwidth=0 marginheight=0 leftmargin=0
topmargin=0 style=\"margin:0px\">
<TABLE border=0 cellspacing=0 cellpadding=0 width=\"100%\" >

<tr>
    <td bgcolor=\"204060\" colspan=3>
    <script LANGUAGE=\"JavaScript\">
        ImgLogOffOut = new Image()
        ImgLogOffOver = new Image()
        ImgLogOffOverR = new Image()
        ImgLogOffOut.src = \"/base/logoff.gif\"
        ImgLogOffOver.src = \"/base/logoff2.gif\"
        ImgLogOffOverR.src = \"/base/logoff2r.gif\"
    </script>
    <table border=0 cellspacing=0 cellpadding=0 width=\"100%\" >
    <tr> 
          <td rowspan=2 valign=\"TOP\" width=100%><a
href=\"http://www.infomaniak.ch\";><img border=0
src=\"gfx/logo_infomaniak.gif\" width=\"200\" height=\"60\"></a></td>
          <td align=\"center\" valign=\"top\" >&nbsp;</td>
  </tr>

<tr> 
    
          <td align=\"center\" valign=\"bottom\"> </td>
    
    
    
  </tr>

        <TR background=\"gfx/borderemb.gif\">
          <TD colspan=2><img src=\"/base/transp.gif\" width=1px
height=11px></TD>
    </TR>
</table>

    

    </td>

</tr>



<TR>
    <TD><img src=\"/base/transp.gif\" width=1px height=30px></TD>
</TR>
<TR>
<TD align=center>
<TABLE border=0 width = 420 cellspacing=0 cellpadding=2 bgcolor=#000000>
<TR>
    <TD>
            <TABLE border=0  bgcolor=#E0E0E0 width=100% cellspacing=0
cellpadding=0>
              <TR bgcolor=#FF9900>
                <TD colspan=3 bgcolor=#FF9900><img
src=\"gfx/fonction_php.gif\" width=\"339\" height=\"28\"></TD>
              </TR>
              <TR> 
                <TD colspan=3 bgcolor=#000000><img src=\"/base/transp.gif\"
height=2px width=1px border=0></TD>
              </TR>
              <TR> 
                <TD colspan=3 bgcolor=#E0E0E0><img src=\"/base/transp.gif\"
height=5px width=1px border=0></TD>
              </TR>
              <FORM action=\"fonctions_php.php4?step=1\" method=\"post\"
id=form1>
                <TR>
                  <TD><img src=\"gfx/bord_gris.gif\" height=1 width=1></TD>
                  <TD colspan=\"2\"><font class=textblack
align=Right>Fonction: $function </font></td>
                   
                </TR>
                <TR>
                  <TD><img src=\"gfx/bord_gris.gif\" height=1 width=1
border=0>


</TD>
                  <TD colspan=\"2\"><font class=textblack align = Right>");

if(function_exists($function))
{
    print ("<font class=textblack>Cette fonction a &eacute;t&eacute;
compil&eacutee sur votre serveur<br>");
    print ("Pour trouver de la documentation cliquez sur le lien
ci-dessous</font><br>");
}
else
{
    print ("<font class=textblack>Cette fonction n'a pas &eacute;t&eacute;
compil&eacute;e, pour des raisons qui nous sont propres</font>");
}

print ("</font></td>
                  
                </TR>
                <TR>
                  <TD><img src=\"gfx/bord_gris.gif\" height=1 width=1
border=0></TD>
                  <TD colspan=2>");

if(function_exists($function))
{
    $function_modified = ereg_replace("_", "-", $function);
    print ("<font class=textblack><a
href=\"http://www.php.net/manual/fr/function.$function_modified.php\";
target=\"blank\">- Manuel en fran&ccedil;ais sur php.net</a></font>");

}
                   
    print ("              </td>
                </TR>
                <TR>
                  <TD colspan = 3><img src=\"/base/transp.gif\" height=5px
width=1px border=0></TD>
                </TR>
              </FORM>
            </TABLE>
    </TD>
</TR>
</TABLE>
<TR>
    <TD colspan=3 align='right'><img border=0 src='gfx/logo_pi.gif'
width=\"10\" height=\"9\">&nbsp;</TD>
  </TR>
</TABLE>


</BODY>
</HTML>");

}

if($step == "2")
{
phpinfo();
}
?>


Hope this helps some of you.
=======================================================================

Marco Baurdoux
Unix Administrator
Infomaniak Network SA
Avenue de la Praille 26
1227 Carouge
Switzerland
Tel: +41 (0)22 820 35 41
Fax: +41 (0)22 820 35 46
http://web.infomaniak.ch

Linux/Unix is very user friendly,
it's just very picky about who its friends are !!!

=======================================================================