Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
:)

Shabbir Bhimani shabbirbhimani

💭
:)
View GitHub Profile
@shabbirbhimani
shabbirbhimani / .htaccess
Created Jun 3, 2020
Redirect old domain to a new domain .htaccess
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^old-domain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.old-domain\.com$
RewriteRule (.*)$ https://www.new-domain.com/$1 [R=301,L]
</IfModule>
@shabbirbhimani
shabbirbhimani / .htaccess
Created Jun 3, 2020
htaccess redirect .php to .html
View .htaccess
# Part of SEO Interview Questions - https://imtips.co/seo-interview-questions.html
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*).php?(.*)$ $1.html?$2 [R,L]
</IfModule>
@shabbirbhimani
shabbirbhimani / functions.php
Created Dec 18, 2019
Add GTM Code to WordPress Blog
View functions.php
<?php
//* Copy the above PHP opening tag if and only if your functions.php has a closing PHP tag
function add_gtm_head() { ?>
<!-- Paste Your GTM Header Code Here -->
<?php } add_action('wp_head','add_gtm_head',10);
@shabbirbhimani
shabbirbhimani / functions.php
Created Dec 15, 2019
Add Google Analytics to WordPress Blog
View functions.php
<?php
//* Copy the above PHP opening tag if and only if your functions.php has a closing PHP tag
function add_google_analytics() { ?>
<!-- Paste Your Google Analytics Code Here -->
<?php } add_action('wp_head','add_google_analytics',10);
View correctImageOrientation.php
<?php
/*
* Source code by WES of Stackoverflow
* https://stackoverflow.com/questions/3657023/how-to-detect-shot-angle-of-photo-and-auto-rotate-for-website-display-like-desk/18919355#18919355
*/
function correctImageOrientation($filename)
{
@shabbirbhimani
shabbirbhimani / cb-thanks.php
Last active Oct 22, 2019
Tracking Clickbank Sales into Google Analytics E-Commerce
View cb-thanks.php
<?php
$cb_item=$_REQUEST['item'];
$cb_affiliate=$_REQUEST['cbaffi'];
$cb_receipt=$_REQUEST['cbreceipt'];
$cb_cname=$_REQUEST['cname'];
$cb_cemail=$_REQUEST['cemail'];
$cb_ccountry=$_REQUEST['ccountry'];
$net_amount = 19.97;
if($cb_affiliate!='0') $net_amount = 0.3*$net_amount;
View vBulletin.php
<?php
require_once(‘./global.php’);
$blogs = $db->query_read_slave(“SELECT blogid FROM ” . TABLE_PREFIX . “blog WHERE state = ‘visible'”);
while ($blog = $db->fetch_array($blogs))
{
if($blog[‘blogid’]==0) continue;
$sql = “INSERT INTO ” . TABLE_PREFIX . “thread (title, forumid, postusername,postuserid,dateline,views) SELECT title, 38, username, userid,dateline,views from “.TABLE_PREFIX.”blog where blogid=$blog[blogid]”;
$db->query_write($sql);
View validate-email.js
<script language="JavaScript">
<!--
function _submit_form(frm)
{
var email = frm.email.value;
var valid_email = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
if( valid_email.test( email ) )
{
document.getElementById('before').style.display = 'none';
document.getElementById('after').style.display = 'block';
View thanks.html
<div id="after" style="width:99%;border:gray 1px solid;display:none;background-color:#ccc;Padding:5px;height:100px;">Thank you</div>
View iframe.html
<iframe id="AweberFormSubmitFrame" style="display: none" name="AweberFormSubmitFrame" src="about:blank"></iframe>
<form id="before" target="AweberFormSubmitFrame" ...
You can’t perform that action at this time.