Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/indem/
Upload File :
Current File : /var/www/html/mmishra/indem/html.inc

<?
function goodie($title) {
	echo "<table border=0 cellspacing=0 class=black><tr>\n";
	echo "<td><!-- img src='images/goodie2.gif' --></td>\n";
	echo "<td style='font-size:16px;'>$title</td>\n";
	echo "<td><!-- img src='images/goodie.gif' --></td>\n";
	echo "</tr></table>\n";
}

function htmlsafe($str) {
	return trim(htmlspecialchars(stripslashes($str), ENT_QUOTES));
}

function unhtmlentities ($string)
{
    $trans_tbl = get_html_translation_table (HTML_ENTITIES);
    $trans_tbl = array_flip ($trans_tbl);
    return strtr ($string, $trans_tbl);
}


function hilite($body, $text){ 

// If any thing goes wrong, blame Alok Parlikar.

/*Internet stopped working.. So quit halfway */ 

/* Can we make it work also for &amp; kind of stuffs.. */
/* The &amp; etc is also taken care of now. */

$body = unhtmlentities($body);

$new_text = preg_replace("/\040/","+",$text);
$new_text = explode("+",$new_text);
foreach($new_text as $txt)
{
	$txt = trim($txt);
	if(empty($txt)) continue;
	$alpha_text = preg_replace("/\W/","-",$text);
	$strings = explode("-",$alpha_text);
	foreach($strings as $str)
	{
		if(!empty($str))
		$texts[] = $str;
	}
}
//$patterns[$i] = '/'.preg_quote($text[$i], '/').'/i';
$orig_body = $body;
$new_body = "";
foreach($texts as $text)
{
	$text = trim($text);
	if(strlen($text)<=2) continue;
	if($new_body!="") 
	{
		$body=unhtmlentities($new_body);
		$new_body="";
	}
	while ($body!="") { 
	      if (preg_match('{^([^<]*)?(</?[^>]+?>)?(.*)$}s',$body,$matches)) { 
	
		/* this while loop is to preserve case of every match. */
		$new_str = $matches[1];
		while($new_str!="")
		{
			$match_pos = strpos(strtolower($new_str),strtolower($text));
	      		if($match_pos===false){
				$new_body.=htmlentities($new_str);
				$new_str="";
			}
			else
			{
				if($match_pos!=0)
					$new_body.=htmlentities(substr($new_str,0,$match_pos));
	
				$match = substr($new_str,$match_pos,strlen($text));
				$replacement = "<span style=\"background: black; color: white;\">$match</span>";  
				$new_body.= $replacement;
				$new_str = substr($new_str,$match_pos+strlen($text));
			}
			
		}
	        $new_body.= $matches[2];
	        $body = $matches[3];
	    } 
	}
}
if($new_body=="") return $orig_body;
else return $orig_body;
}
?>