Location: PHPKode > scripts > Ramui web hosting directory script > Ramui web hosting directory script/gb/include/functions.php
<?php
/*
Copyright (c) 2011 http://ramui.com. All right reserved.
This product is protected by copyright and distributed under licenses restricting copying, distribution. Permission is granted to the public to download and use this script provided that this Notice and any statement of authorship are reproduced in every page on all copies of the script.
*/
function fw_strip_slashes($str)
{
        if (get_magic_quotes_gpc()){return stripslashes($str);}
        return $str;
}
function fw_total_page($c, $p)
{
        if ($c<1){ return 1;}
        $d=$c;
        for ($i=1; $i<=$c; $i++){
            $d=$d-$p;
            if ($d<=0){ return $i;}
        }
}
function fw_abs_to_url($abs_path)
{
         return 'http://'.str_replace($_SERVER['DOCUMENT_ROOT'], $_SERVER['HTTP_HOST'],$abs_path);
}
function fw_random()
{
		return substr(str_shuffle('abcdefghijklmnopqrstuvwxyz_0123456789'),0,rand(8,16));
}
function fw_get_docroot()
{
		$docroot=str_replace($_SERVER['DOCUMENT_ROOT'],'',str_replace('\\','/',__FILE__));
		return(str_replace('gb/include/functions.php','',$docroot));
}
function fw_validate_user($name,$email)
{
		return ((preg_match('/^([a-zA-Z0-9]){5,16}$/',$name))&&(fw_validate_email($email)));
}
function fw_validate_email($email)
{
		return preg_match('/^([a-zA-Z0-9\-\._@]){7,110}$/',$email);
}
function fw_validate_password($pass)
{
		return preg_match('/^([a-zA-Z0-9\-\:_\?\/\(\)\{\}\[\]]){6,12}$/',$pass);
}
function fw_remove_smarttag($s)
{
         $s=str_replace('%u201C','"',str_replace('%u201D','"',$s));
         $s=str_replace("%u2018","'",str_replace("%u2019","'",$s));
         return str_replace("%u2013","-",$s);
}
function fw_php2javascript($text)
{
		return str_replace("\r",'\r',str_replace("\n",'\n',addslashes($text)));
}
function fw_bb2text($s)
{
		while(fw_bburl2text($s)){}
		$search=array('[b]','[/b]','[u]','[/u]','[i]','[/i]','[s]','[/s]','[sup]','[/sup]','[sub]','[/sub]','[ul]','[/ul]','[ol]','[/ol]','[li]','[/li]','[url]','[/url]');
		return str_replace($search,'',$s);
}
function fw_bburl2text(&$s)
{
		$start=strpos($s,'[url=');
		$end=strpos($s,']',$start);
		if(($start===false)||($end===false)){return false;}
		$url=substr($s,$start+5,($end-$start-5));
		if(strpos($url,'[')!==false){return false;}
		$s=substr($s,0,$start).substr($s,$end+1);
		return true;
}
?>
Return current item: Ramui web hosting directory script