Skip to content

Instantly share code, notes, and snippets.

View sanjaybhowmick's full-sized avatar

Sanjay Bhowmick sanjaybhowmick

  • Kolkata, India
  • 02:16 (UTC +05:30)
View GitHub Profile
@sanjaybhowmick
sanjaybhowmick / functions.php
Created September 9, 2015 09:22
Simple WordPress Breadcrumbs
<?php
function wordpress_breadcrumbs() {
$delimiter = '&raquo;';
$name = 'Home'; //text for the 'Home' link
$currentBefore = '<span class="current">';
$currentAfter = '</span>';
if ( !is_home() && !is_front_page() || is_paged() ) {
echo '<div id="crumbs">';
global $post;
$home = get_bloginfo('url');
@sanjaybhowmick
sanjaybhowmick / form.css
Created September 9, 2015 09:06
Style your web form with CSS
label
{
width: 15em;
float: left;
text-align: left;
margin-right: 0.5em;
display: block;
color: #990000;
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif;
@sanjaybhowmick
sanjaybhowmick / download.php
Created September 9, 2015 08:57
Download file script in PHP
<?php
$filename = $_GET['filename'];
// Modify this line to indicate the location of the files you want people to be able to download
// This path must not contain a trailing slash. ie. /temp/files/download
$download_path = "";
// Make sure we can't download files above the current directory location.
if(eregi("..", $filename)) die("I'm sorry, you may not download that file.");
$file = str_replace("..", "", $filename);
// Make sure we can't download .ht control files.
if(eregi(".ht.+", $filename)) die("I'm sorry, you may not download that file.");
@sanjaybhowmick
sanjaybhowmick / db.sql
Created September 9, 2015 08:44
Display data horizontally from MySQL table
DROP TABLE IF EXISTS `member_table`;
CREATE TABLE `member_table` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
`member_name` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of member_table
-- ----------------------------
@sanjaybhowmick
sanjaybhowmick / thumbnail.php
Created September 9, 2015 07:18
Thumbnail Creation with PHP
<?php
// Maximum size of the uploaded image
define('MAX_SIZE','100');
// Width & Height of the thumbnail in pixels
define('WIDTH','150');
define('HEIGHT','100');
// Thumbnail creation function
function makeThumb($img_name,$file_name,$new_width,$new_height)
{
// Get the extension of the image