PHP Classes

File: wordcounter.php

Recommend this page to a friend!
  Classes of Parminder Singh   Words counter   wordcounter.php   Download  
File: wordcounter.php
Role: Example script
Content type: text/plain
Description: words counter
Class: Words counter
Search and count words in a file
Author: By
Last change: $file=$_FILES["filename"]["temp_name"]; is change with $file=$_FILES["filename"]["name"];
Date: 14 years ago
Size: 1,724 bytes


Class file image Download
ini_set('display_errors', 0);
<script type="text/javascript" language="javascript">
function validate()
document.getElementById('result').innerHTML='File Is Required';
 return false;


<h1>Words Counter</h1>
<form action='' method=post enctype='multipart/form-data' onSubmit="return validate()" >
File to Upload <input type='file' name='filename' id="filename"><div id="result" style=" float:left; color:#CC0000; font-weight:bold"></div>
<input type='hidden' name='action' value='upload'>
<br/>Search any word <input type="text" name="search" /><br/>
<input type="radio" value=0 name="casecheck" />Case Senstive <input type="radio" value=1 name="casecheck" checked="checked" />Non Case Senstive
Show List <input type="checkbox" name="list" /> <input type="radio" value=0 name="orderby" checked="checked" />Ascending <input type="radio" value=1 name="orderby" />Descending
<input type='submit' value='Upload File' name="submit">


if ($_FILES["filename"]["size"] ) ;
copy($_FILES["filename"]["tmp_name"],"./".$_FILES["filename"]["name"]) or die("<b>File Required!</b>");
"<b>File Uploaded.</b>"; // for debug --> $filename --> ".$destination."/".$filename_name."</h2>";

$wc = new WordCounter($file,$casecheck);