Welcome to PCCS-Linux.COM Hello, and welcome to the PCCS-Linux Home Page.
Your last visit was !!!
Your Browser is running on Other
 
Functions I hacked
<?php
/*
** These are some functions that I hacked together
** from various code snippets
** Feel free to use as you wish, however I can't
** say they'll work for you..
** Even though they worked for me
**
** Chauncey Thorn cthorn
** http://PCCS-Linux.COM
*/ 
$conn = mysql_pconnect("localhost","root","");
if(!$conn) 
   { 
       print "ERROR: MySQL Said " . mysql_error();
    exit;
   } else {
     mysql_select_db("root") or die("Failed Database Connection");
   }      

/*
** Function: siteHeader()
** Input: Title yes or no to cache page
** Output: Std HTML 
** Description: HTML header for all pages
**
**
*/
function siteHeader($title,$cache="")
{
 global $bgcolor, $bgtext, $link;
    if($cache == "on") {
         $LastModified = filemtime(__FILE__) + date("Z");
        header("Last-Modified: " . 
        gmdate("D, d M Y H:i:s", $LastModified) . " GMT");
    
        //set expiration time 24 hours (86400 seconds) from now
        $Expires = time() + 86400;
        header("Expires: " . 
        gmdate("D, d M Y H:i:s", $Expires) . " GMT");

        //tell cache to let page age for 24 hours (86400 seconds)
        header("Cache-Control: max-age=86400");
    } elseif ($cache == "off") {
        // Don't allow page to be cached
        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
        header("Expires: " . gmdate("D, d M Y H:i:s") . " GMT");
        header("Cache-Control: no-cache, must-revalidate");
        header("Pragma: no-cache");
    } else {
        // Do nothing
    }


    print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n";

    print "<HTML>\n";
    print "<HEAD>\n";
    print "<TITLE>$title</TITLE>\n";
    print "</HEAD>\n";

      print "<BODY BGCOLOR= \"#$bgcolor\" 
            TEXT=\"#$bgtext\"
            LINK=\"#$link\"
            VLINK=\"#$link\"
            ALINK=\"#ffffff\">";

}


/*
** Function: siteFooter()
** Input:  
** Output: Std HTML 
** Description: HTML footer for all pages
**
**
*/
function siteFooter() 
{
    print "</BODY>\n";
    print "</HTML>\n";
}


/*
** Function: displayImage()
** Input: pathto/filename.xxx ALT text 
** Output: Std HTML 
** Description: Display image and alt string
**
**
*/
function displayImage($image, $text="")
{
    print "\n<IMG SRC=$image BORDER=0 ALT=\"$text\">\n";
}


/*
** Function: htmlHeader()
** Input: Text Alignment and size 
** Output: Std HTML 
** Description: <H3>this is a htmlHeader</H3>
**
**
*/
function htmlHeader($text, $align="left", $size=3)
{
    print "\n<H".$size. " align=".$align.">" .$text."</H".$size.">\n";
}


/*
** Function: pageTop()
** Input: Text String, links, pageurl width 
** Output: Std HTML 
** Description: Top table of web site
**
**
*/
function pageTop($text_str, $width="500") 
{
 global $fcolor, $tcolor, $ttext, $ftext;

print "
    <center>


      <table border=0 cellpadding=10 cellspacing=0 width=$width>

        <tr bgcolor=#$tcolor>  
          <td>
            <font color=#$ttext size=4><center><b>
         $text_str
         <br>
            </b></font>
          </td>
        </tr>

        <tr bgcolor=#$fcolor>
          <td>
            <font color=#$ftext>
";

}


/*
** Function: pageBottom(http://www.pccs-linux.com/spacer.gif)
** Input:  
** Output: Std HTML 
** Description: bottom table of web site
**
**
*/
function pageBottom(http://www.pccs-linux.com/spacer.gif)
{

    print "
            </font>
          </td>
        </tr>

      </table>

    </center>
  ";
}


/*
** Function: navBar(http://www.pccs-linux.com/spacer.gif)
** Input: an array of links 
** Output: Std HTML 
** Description: display navigational links
** e.g  $link_array = array (
**      "About" => "about.php",
**     "Who We Are" =>"whoweare.php",
**     "What We Do" =>"whatwedo.php");
**
*/
function navBar($link_array,$page_dir=".")
{
   reset(http://www.pccs-linux.com/spacer.gif);
   echo "<TABLE BORDER='0'><TR>\n";
   while (list($key, $val) = each(http://www.pccs-linux.com/spacer.gif)) {
      $label = ucfirst(http://www.pccs-linux.com/spacer.gif);
      $link = $page_dir . "/$val";
         echo "<TD align='CENTER'><A HREF=$link>";
         echo "<FONT SIZE='1' FACE='Arial'>$label</FONT></TD>\n";
   }
   echo "</TR></TABLE>\n";
}


/*
** Function: printBoldtxt(http://www.pccs-linux.com/spacer.gif)
** Input: test string 
** Output: Std HTML 
** Description: display text bolded
**
**
*/
function printBoldtxt(http://www.pccs-linux.com/spacer.gif)
{
   print "<B>" . $text . "</B>";
}


/*
** Function: printColoredtxt(http://www.pccs-linux.com/spacer.gif)
** Input: color of text and text string 
** Output: Std HTML 
** Description: bottom table of web site
**
**
*/
function printColoredtxt($color="black", $text)
{
   print "<FONT COLOR=\"$color\">" . $text . "</FONT>";
}


/*
** Function: printPage(http://www.pccs-linux.com/spacer.gif)
** Input:  
** Output: Std HTML 
** Description: display <P>
**
**
*/   
function printPage(http://www.pccs-linux.com/spacer.gif)
{
   print "<P>\n";
}    


/*
** Function: makeList(http://www.pccs-linux.com/spacer.gif)
** Input:  variable defined in page 
** Output: Std HTML 
** Description: display html list
**
**
*/   
function makeList(http://www.pccs-linux.com/spacer.gif)
{
 global $listType;
 
  print "<".$listType.">";
  
  for($i=0; $i < func_num_args(http://www.pccs-linux.com/spacer.gif); $i++)
  {
      print "<LI>" . func_get_arg(http://www.pccs-linux.com/spacer.gif) . "\n";
  }
  print "</".$listType.">";  
       
}


/*
** Function: siteTheme(http://www.pccs-linux.com/spacer.gif)
** Input:  
** Output: Std HTML 
** Description: background text, link color template
**
**
*/   
function siteTheme($scheme="smoke")
{
       include("http://www.pccs-linux.com/spacer.gif"); 
       return;
}


function displayButtons($type, $button_array, $buttonvalue="") 
{

   reset(http://www.pccs-linux.com/spacer.gif);
    for($i=0; $i < count(http://www.pccs-linux.com/spacer.gif); $i++) {
      $question = $button_array[$i];
      $q_id = $buttonvalue;
      if($type == "radio") {
      print "<input type=\"$type\" name=\"$q_id\" value=\"$q_id\" > $question <br>\n";
      } else {
      print "<input type=\"$type\" name=\"tt_id[]\" value=\"$question\"> $question <br>\n";
      }
   }
   
   
}   

?>


>> Comments/FeedBack


Page hits 51 last request on :11:31



This web site is prepared and maintained by Chauncey Thorn.
The information contained in this site was valid at the time of posting.
Chauncey Thorn, assumes no liability for damages incurred directly or indirectly as a result of errors, omissions or discrepancies.

Remember most of the content here are my notes...

All logos and trademarks in this site are property of their respective owner. All the rest © by PCCS-Linux.COM

PCCS-Linux.COM ::ource Advocate Articles catalogue
2000 2002