HTML,group,functions,wrote,didnt,write,things
Quick Search for:  in language:    
HTML,group,functions,wrote,didnt,write,things
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
PHP Stats

 Code: 70,718 lines
 Jobs: 11 postings

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for PHP.
Convert Seconds to Minutes and Seconds
By Dan Green on 8/25


Log your viewers
By JoeyJoey on 8/25


Using HTML Option to Display Current Month
By Patrick Ingle on 8/20


rNews
By Van Baelen Sebastiaan on 8/18


Click here to see a screenshot of this code!phpNN Neural Networks
By Joachim Krebs on 8/17

(Screen Shot)

iif() function
By Martin C. Conniffe on 8/16


Dynamic List of Specified Files
By nothing34543534 on 8/15


Active Users (No MySQL) UPDATED! BETTER!
By Brandon Sachs on 8/15


PassGen v 1 stable
By Bogomil Shopov on 8/15


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

CodeLib

Print
Email
 
VB icon
Submitted on: 12/22/2000 9:27:10 PM
By: Dennis Wrenn  
Level: Beginner
User Rating: By 7 Users
Compatibility:PHP 3.0, PHP 4.0

Users have accessed this code 5805 times.
 

(About the author)
 
     This is a group of functions I wrote so I didn't have to write things over and over in an HTML file..

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    //**************************************
    //     
    // Name: CodeLib
    // Description:This is a group of functi
    //     ons I wrote so I didn't have to write th
    //     ings over and over in an HTML file..
    // By: Dennis Wrenn
    //
    //This code is copyrighted and has    // limited warranties.Please see http://
    //     www.Planet-Source-Code.com/xq/ASP/txtCod
    //     eId.243/lngWId.8/qx/vb/scripts/ShowCode.
    //     htm    //for details.    //**************************************
    //     
    
    <?
    //#############################COUNTER F
    //     UNCTIONS#############################\\
    //create a directory called hits in your
    //     
    //main directory
    function gethits($logpath) {
    	$hits = 0;
    	$logpath = "./hits/".$logpath.".hits";
    	If (file_exists($logpath)) {
    		$filenum = fopen($logpath,"r");
    		if ($filenum > 0) {
    			$filesize = filesize($logpath);
    			$hits = fread($filenum,$filesize+1);
    			fclose($filenum);
    		}
    	} else {
    		$filenum = fopen($logpath,"w");
    		fwrite($filenum,$hits);
    		fclose($filenum);
    	}
    	return $hits;
    }
    function addhit($logpath) {
    	$hits = 0;
    	$logpath = "./hits/".$logpath.".hits";
    	If (file_exists($logpath)) {
    		$filenum = fopen($logpath,"r");
    		if ($filenum > 0) {
    			//Get the current file hit count
    			$filesize = filesize($logpath);
    			$hits = fread($filenum,$filesize);
    			fclose($filenum);
    			//Increment the hit counter
    			$hits++;
    			$filenum = fopen($logpath,"w");
    			fwrite($filenum,$hits);
    			fclose($filenum);
    		}
    	}else{
    		$hits++;
    		$filenum = fopen($logpath,"w");
    		fwrite($filenum,$hits);
    		fclose($filenum);
    	}
    	return;
    }
    //#############################IP FUNCTI
    //     ONS#############################\\
    //logs IP for forums and stuff like that
    //     
    function logip($path) {
    	global $REMOTE_ADDR;
    	writetolog($path, "$REMOTE_ADDR*\n");
    }
    function parseips($ips) {
    	return str_replace("*", "<BR>", $ips);
    }
    //#############################FILE FUNC
    //     TIONS#############################\\
    //for logip functions, and others I will
    //     soon write
    function writetolog($logfile, $texttowrite) {
    	$filenum = fopen($logfile,"a");
    	fwrite($filenum,$texttowrite);
    	fclose($filenum);
    }
    function openfile($path) {
    if(file_exists($path) == 0) {
    return "";
    }
    else
    {
    $thefilesize = filesize($path);
    $filenum = fopen($path,"r");
    $filecontent = fread($filenum, $thefilesize+1);
    fclose($filenum);
    return $filecontent;
    }
    }
    //#############################HEADER AN
    //     D FOOTER#############################\\
    //use like this:
    //showheader("title","path");
    function showheader($title, $path) {
    	$link = ; //link color
    	$alink = ; //active link color
    	$vlink = ; //visited link color
    	$bgcolor = ; // BG color
    	$text = ; // textcolor
    	addhit($path);
    	echo "<HTML>\n";
    	echo "<HEAD>\n";
    	echo "<TITLE>$title</TITLE>\n";
    	echo "<HEAD>\n";
    	echo "<BODY BGCOLOR=$bgcolor TEXT=$text LINK=$link ALINK=$alink VLINK=$vlink>\n";
    	echo "<FONT FACE=\"Arial\" SIZE=2>\n";
    	showsidebar($title);
    	echo "<BR>\n";
    }
    function showfooter($path) {
    	echo "<P>\n";
    	echo "<BR>\n";
    	echo "<CENTER>";
    	echo "<FONT COLOR=\"#0000FF\" SIZE=2>\n";
    	echo "There have been <B>";
    	echo gethits($path);
    	echo "</B> visitors to this page since 12/19/2000 <BR>\n";
    	echo "Copyright © 2000 Your Name ";
    	echo "All rights reserved <BR> \n";
    	echo "</FONT>\n";
    	echo "</TD>\n</TR>\n</TABLE>\n";
    	echo "</CENTER>\n";
    	echo "</FONT>\n";
    	echo "</BODY>\n</HTML>";
    }
    function showsidebar($title) {
    //look at screenshot, and change what yo
    //     u need.
    	echo "<TABLE BORDER=3 BORDERCOLOR=\"#336699\" WIDTH=100% HEIGHT=100% CELLPADDING=\"20\" CELLSPACING=0>\n";
    	echo "<TR>\n<TD WIDTH=15% BGCOLOR=\"#336699\" VALIGN=\"CENTER\" ALIGN=\"CENTER\"><IMG SRC=\"images/dw.gif\"></TD>";
    	echo "<TD WIDTH=85% BGCOLOR=\"#336699\" VALIGN=\"CENTER\" ALIGN=\"CENTER\">";
    	echo "<FONT COLOR=\"#FFFFFF\">\n";
    	showtitle($title);
    	echo "</FONT>\n";
    	echo "<TR>\n<TD WIDTH=15% BGCOLOR=\"#336699\" VALIGN=\"TOP\" ALIGN=\"CENTER\">";
    //create a file called sidebar.txt
    //and put some links in there. It 
    //must be in HTML format.EG:
    //<A HREF="link1.htm">Link1</A&
    //     gt;<BR>
    //<A HREF="link2.htm">link2</A&
    //     gt;<BR>
    //etc
    //be sure to leave a blank line at the t
    //     op of the
    //file.
    	$file = openfile("sidebar.txt");
    	echo "$file";
    	echo "</TD>\n<TD WIDTH=85% VALIGN=\"TOP\" ALIGN=\"LEFT\">";
    }
    function showtitle($title) {
    	echo "\n<H1><CENTER>$title</CENTER></H1>\n";
    }
    function showsubtitle($stitle,$size=2) {
    	echo "<FONT COLOR=\"#0000FF\">\n<H$size><CENTER>$stitle</CENTER></H$size>\n</FONT>";
    }
    ?>


Other 4 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments

 There are no comments on this submission.
 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | PHP Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.