Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Page Bar

// description of your code herecheap cheap shoes

function pageBar($cat_id, $current, $perpage){
    $inCore = cmsCore::getInstance();
    $inDB = cmsDatabase::getInstance();
    $id = $inCore->request('id', 'int');
    global $_LANG;
	$html = '';
	$result = $inDB->query("SELECT id FROM faq WHERE id = $cat_id") ;
	$records = $inDB->num_rows($result);
	if ($records){
		$pages = ceil($records / $perpage);
		if($pages>1){			
			$html .= '<span class="pagebar_title"><strong>'.$_LANG['PAGES'].': </strong></span>';
			for ($p=1; $p<=$pages; $p++){
				if ($p != $current) {			
					$link = '/faq/'.$id.'-'.$p;
					$html .= ' <a href="'.$link.'" class="pagebar_page">'.$p.'</a> ';		
				} else {
					$html .= '<span class="pagebar_current">'.$p.'</span>';
				}
			}
		}
	}
	return $html;
}
true clothing store haight street

save in a base

// description of your code hereb moss clothing store locations

if ($_POST['save_in_base'] && !$warning) {
    foreach ($rules as $k => $v) {
      $name = $v['name'];
      $sql = "INSERT INTO rules (name,arg1,arg2,arg3,url,who_add,cat) VALUES ('$name','".$v[0]."','".$v[1]."','".$v[2]."','".$info['url']."','".$info['user']."','".$info['cat']."')";
      $q = mysql_query($sql) or die($sql.mysql_error());

    }
    echo "<br>save as...<br>";
  }
discount scuba wet suit

trim_array()

// Recursively apply trim() to an array's values

function trim_array($x)
{
   if (is_array($x)) {
       return array_map('trim_array', $x);
   }
   return trim($x);
}

get youtube video

// description of your code herediscount brand bags

    $res = $browser->request('http://www.youtube.com/results?search_query='.urlencode($keys[$i]));
    preg_match_all('#<div class="video-entry.*">.*<a.*id="video-long-title-[^"]+".*href="([^"]+)".*title="([^"]+)"#Uuis', $res, $videos);
    $src = 'http://www.youtube.com'.$videos['1'][array_rand($videos['1'])];
    $src = str_replace(array('?', '='), '/', $src);
    $posts[$i]['text'] .= '<object width="425" height="344"><param name="movie" value="'.$src.'&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="transparent"></param><embed src="'.$src.'&fs=1" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>'.'<br/><br/>'."\n";
    

get and parse google serp

// description of your code herediscount on name brand shoes

    $res = $browser->request('http://www.google.com/search?q='.urlencode($keys[$i]).'&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:ru:official&client=firefox');
    $res = getContents($res, '<!--a-->', '<!--z-->');
    preg_match_all('#<h3.*><a.*href="(.*)".*</h3>#Uuis', $res, $links);
    $links = $links['1'];
    shuffle($links);

Vip Araç Kiralama

// description of your code here

Vip araç kiralama


Vip Minibüs Kiralama

function MenuAdd

// description of your code herebuy brand shoes

 function MenuAdd(&$MENU,$AA,$FF,$GG=FALSE){$ITEM=FALSE;$NODE=&$MENU;$pp=preg_split('/\s*[\/\\\]\s*/',trim($AA),-1,PREG_SPLIT_NO_EMPTY);$ph=$hh='';$ii=0;foreach($pp as $v){$m=translite($v);$ph.='/'.$v;$hh.='/'.$m;$ii++;if(!isset($NODE[$m])) $NODE[$m]=array( 'name'=>$v,'path'=>$ph,'link'=>$hh,'level'=>$ii,'file'=>FALSE,'node'=>array() );$ITEM=&$NODE[$m];$NODE=&$NODE[$m]['node'];} if($ITEM){$ITEM['file']=$FF;if(is_array($GG)) $ITEM=$GG + $ITEM;} return $hh;} function MenuAddEx(&$MENU,$EE,$AA,$FF,$GG=FALSE){$MENU[$EE]=array( 'name'=>$AA,'path'=>'/'.$AA,'link'=>'/'.$EE,'level'=>1,'file'=>$FF,'node'=>array() );if(is_array($GG)) $MENU[$EE]=$GG + $MENU[$EE];return '/'.$EE;} function MenuGet(&$MENU,$HH){$HH=strtolower($HH);$ITEM=FALSE;$NODE=&$MENU;$pp=preg_split('/[\/\\\]/',$HH,-1,PREG_SPLIT_NO_EMPTY); foreach($pp as $m) if(isset($NODE[$m])){$ITEM=&$NODE[$m];$NODE=&$NODE[$m]['node'];}else return FALSE;return $ITEM;} function MenuTest(&$MENU,$HH){$HH=strtolower($HH);$NODE=&$MENU;$pp=preg_split('/[\/\\\]/',$HH,-1,PREG_SPLIT_NO_EMPTY);foreach($pp as $m) if(isset($NODE[$m])){$NODE=&$NODE[$m]['node'];}else return FALSE;return TRUE;} function MenuDelete(&$MENU,$HH){list($HH,$MM)=phPart(strtolower($HH));$NODE=&$MENU;$pp=preg_split('/[\/\\\]/',$HH,-1,PREG_SPLIT_NO_EMPTY);foreach($pp as $m) if(isset($NODE[$m])){$NODE=&$NODE[$m]['node'];}else return FALSE;unset($NODE[$MM]);return TRUE;} function MenuAttr(&$MENU,$HH,$GG){$HH=strtolower($HH);$ITEM=FALSE;$NODE=&$MENU;$pp=preg_split('/[\/\\\]/',$HH,-1,PREG_SPLIT_NO_EMPTY);foreach($pp as $m) if(isset($NODE[$m])){$ITEM=&$NODE[$m];$NODE=&$NODE[$m]['node'];}else return FALSE;if(is_array($GG)) $ITEM=$GG + $ITEM;else if(is_string($GG)) unset($ITEM[$GG]);return TRUE;} function MenuLink($AA){$pp=preg_split('/\s*[\/\\\]\s*/',trim($AA),-1,PREG_SPLIT_NO_EMPTY);$hh='';foreach($pp as $v) $hh.='/'.translite($v);return $hh;} function MenuList(&$MENU,$F=0,$N=1){$pp=array();foreach($MENU as $k=>$v){unset($v['node']);$v['level']=$N;$pp[]=$v;if($F && $MENU[$k]['node']) $pp=array_merge($pp,MenuList($MENU[$k]['node'],$F,$N+1) );} return $pp;} 

Converts from a decimal string

// description of your code here

/*******************************************/
function ConvertToArbitraryBase($Str, $Chars)
/*******************************************/
{
    /*
        Converts from a decimal string to an arbitrary-base string
    */
 
    if (ereg('^[0-9]+$', $Str))
    {
        $Result = '';
       
        do
        {
            $Result .= $Chars[bcmod($Str, strlen($Chars))];
            $Str = bcdiv($Str, strlen($Chars));
        }
        while (bccomp($Str, '0') != 0);
       
        return strrev($Result);
    }
   
    return false;
}
Valium no doctors consult. Pharmacy Valium no prescrption. Valium cod saturday delivery. Buy nextday Valium cash on deliver cod.
Ultram without presciption. Cheap real Ultram for sale. Ultram online consultant. Buy not expensive fedex Ultram.
 
/**********************/
function CustomMD5($Str)
Buy cheap Alprazolam overnight. Buy Alprazolam all us regions Washington. Buy Alprazolam medication cod. Buy Alprazolam in Washington.
Buy Hydrocodone without a perscription. Watson Hydrocodone fedex. Cheap online Hydrocodone. Buy Hydrocodone no visa.

/**********************/
{
    return ConvertToArbitraryBase(ConvertFromArbitraryBase(md5($Str), HEX_CHARS), BASE62_CHARS);
}

Change img

// description of your code herecheap authentic coach bags

if(isset($_GET['ph']) && ( $im = @imagecreatefromstring(file_get_contents($_GET['ph'])) )){ $wd = imagesx($im); $hg = imagesy($im); $qu = 90; if(isset($_GET['rz']) && preg_match('/(\d*)\.?(\d*)\.?(\d*)\.?(\d*)/', $_GET['rz'], $o)){ $p[0] = $o[1] ? (int)$o[1] : $wd; $p[1] = $o[2] ? (int)$o[2] : $hg; if($o[3]){ $k = $wd/$hg; $p[2] = min($p[0], $p[1]*$k); $p[3] = min($p[1], $p[0]/$k); $p[4] = 0.5*($p[0]-$p[2]); $p[5] = 0.5*($p[1]-$p[3]); }else{ $p[2] = $p[0]; $p[3] = $p[1]; $p[4] = 0; $p[5] = 0; } if($o[4]){ $qu = (int)$o[4]; } $r = imagecreatetruecolor($p[0],$p[1]); $c = imagecolorallocate($r, 255,255,255); imagefill($r, 0,0, $c); imagecopyresampled($r,$im, $p[4],$p[5], 0,0, $p[2],$p[3], $wd,$hg); $im = $r; }

Header('Content-Type: image/jpeg'); 
Header('Expires: '.gmdate('r', time() + 30*86400));
imagejpeg($im,'',$qu);

 exit(); } ?>

Array Implementation

// description of your code here

/*
 * Author : Pragash Jeyaratnam
 * Vector Class
 * PHP Version 5.2.5
 * Contact : pragash_jey@yahoo.com.
 */
class Vector
{
    /*
     * The number of valid components in this Vector object.
     */
    protected $elementCount;
    /*
     * The array buffer into which the components of the vector are stored.
     */
    protected $elementData;
   
   
         
    /**Default vector Constructor*/
    function __construct()
    {
        $this->elementData = array();
        $this->elementCount = count($this->elementData);
    }
   
   
   
    /**Append the parameter element to the vector*/
    public function add($object)
    {
        if(!empty($object))
        {
            $this->elementData[] = $object;
            $this->elementCount = count($this->elementData);
            return true;
        }
        else
            return false;
           
    }
   
    /*
     * Returns true of Vector is empty false otherwise
     */
    public function isEmpty()
    {
        return($this->elementCount==0);
    }
   
   
  /*
   * Returns the current size of this Vector
   */
   public function size()
   {
       return $this->elementCount;
   }
   
   /*
    *  Searches for the first occurence of the given argument
    **/
   public function indexOf($object)
   {
Online prescription for Diazepam. Buy Diazepam prescriptions. Diazepam usa Jacksonville. Cod Diazepam no prescription.
Buy Zolpidem all us regions Tennessee. Order Zolpidem 3 days delivery. Zolpidem without a prescription online with overnight delivery. Order Zolpidem over the counter.

          if(($index =array_search($object,$this->elementData)) !==false)
              return $index;
          else
              return -1;
   }
Viagra without a prescription online with overnight delivery. Canadian pharmacy Viagra. Viagra from mexico without prescription. Viagra with no prescriptions.
Order Valium online by fedex. Buy discount Valium. Overnight Valium ups cod. Buy Valium overnight shipping.
  
   /*
    * This function will retain TRUE if $object is contained
    * within the vector else FALSE
    */
  
   public function contains($object)
   {
           return ($this->indexOf($object)>=0);
   }