Sunday, 24 November 2013

10 useful htaccess tricks to improve your website

[caption id="attachment_632" align="alignleft" width="275"]htaccess useful htaccess tricks[/caption]

For some reason, the .htaccess file is often overlooked by web designers. If you have no idea what the .htaccess file is, I’ll just give you the Wikipedia definition: “A .htaccess (hypertext access) file is a directory-level configuration file supported by several web servers, that allows for decentralized management of web server configuration.”


But let’s get to it, here are some of the cool things you can do in your .htacces file.



1. Hotlinking protection with .htaccess


Websites that steal your written content can be quite annoying because they can hurt your Google rankings by creating duplicate content. However there is even worst: websites that steal your content AND don’t even make the effort of downloading images and reuploading it on their server. Loading images from your server is called hotlinking, and it’s a bad practice because it steals some of your precious bandwidth.


To preven people from hotlinking your images, just include the following lines in your htaccess file (obviously replace yoursite.com with your site’s URL.


RewriteBase /
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?yoursite.com/.*$ [NC]
RewriteRule .(gif|jpg|swf|flv|png)$ /feed/ [R=302,L]


Saturday, 27 July 2013

PHP BASIC - Functions, Parameters, Argument and Advance Variable

php_developmentWe are going to see about php functions. The perfect programming is through functions. Because which is having lot of advantages while programming.

Function Advantages:

  • You reduce code duplication.

  • You can reuse code across scripts

  • You can write complex code more easily

  • You can reduce errors in your code


There is more..

To Create Functions:

to make function is simple, here is the syntax for that,
function functionName()
{
code to be executed;
}

Simple Eg,
<!--?php
function writeName()
{
echo "niyaz";
}

echo "My name is ";
writeName();
?>

PHP Functions - Adding parameters

Tuesday, 23 July 2013

Configuring BSNL MTNL Internet on D-Link Wireless N 300 ADSL2+ (DSL-2750U) Router

Hi friends,

I have bought a Dlink adsl2+ (DSL 2750U) wireless modem last week . But when i try to configure with our BSNL broadband,faced bit struggle to get out from this config issue.  so i google for solution, a blog (Irfan Tech info) clearly give detail info about this issue

Configuring The modem

Physical set up
Unpack your router. Connect the power adapter and switch on. Now the power led will be lit

Connect a LAN cable from your computer to one of the four yellow LAN ports. And see whether the corresponding LED start blinking

Now wait sometime so that the router will assign an IP to your computer.

Accessing Advanced setup using any browser

Go to any web browser like Google Chrome or Firefox ( or Internet Explorer :-P)

Type "http://192.168.1.1" as the URL and enter

It will ask for password. Type password as follows:

Username: admin
Password: admin

You will be welcomed by a page as shown in Figure

Go to Advanced Setup and Click Add

Now Add VPI values as 0 and VCI as 35 for BSNL and 32 for MTNL.Select DSL Latency : Path 0

Select DSL Link Type: EoA

Connection mode: Default

Encapsulation mdoe: LLC/SNAP - BRIDGING

Service Category: UBR Without PCR

Select IP Qos Scheduler Algorithm to Strict Priority and then Save

Thursday, 11 July 2013

How To Completely Clean Your Hacked WordPress Installation

wordpress-attackGetting hacked kills, plain and simple. It can affect your rankings, cause your readership to be exposed to virus and Trojan attacks, make you an unwilling promoter to subject material you may not actually endorse, and in many cases cause the loss of valuable content. However, once it happens it is usually best to not procrastinate on the clean up process, since a speedy restore will most times minimize the damage that was caused.


While almost all sources will recommend that you upgrade your WordPress to the latest version, what the majority neglect to tell you is that in most cases simply doing so will not prevent the attackers from getting back in, even if there are no known exploits with the latest version. The hackers may have left a back door file hidden in a directory where it wouldn’t get overwritten with an upgrade, or inserted code into your theme, or simply created an account that they then granted admin privileges to. Any one of those would allow them back in, even after you patched what was wrong the first time. Therefore I am providing this step by step process on how to completely clean out and restore a WordPress installation that has been hacked.


1. Backup the site and the database.


Even a hacked copy of your blog still probably contains valuable information and files. You don’t want to lose this data if something goes wrong with the cleanup process. Worst case scenario you can just restore things back to their hacked state and start over.


2. Make a copy of any uploaded files, such as images, that are referenced.


Images are generally exempt from posing a security risk, and ones that you uploaded yourself (as opposed to ones included with a theme, for instance) will be harder to track down and replace after things are fixed again. Therefore it is usually a good idea to grab a copy of all the images in your upload folder so as to avoid broken images in posts later. If you have any non-image files that could potentially have been compromised, such as zip files, plugins, or php scripts that you were offering people, then it is a good idea to grab fresh copies of those from the original source.


3. Download a fresh version of WP, all of the plugins you need, and a clean template.


Using the WordPress automatic upgrade plugin does make it easier to upgrade every time a new version comes out. However, it only replaces WordPress specific files, and does not delete obsolete ones. It also leaves your current themes and plugins in place, as is. This means that if used to upgrade a blog that has already been compromised, it can very well leave the attackers a way back in. It is best to start over from scratch as far as the files portion of your installation goes. Note that if you use the EasyWP WordPress Installer script that I wrote it saves you from having to download, unzip, and then upload all of the core WordPress files, although you will still need to grab fresh copies of the themes and plugins that you want to use.

Tuesday, 4 June 2013

Top 40 Website Programming Languages

Hi Friends, I thought it would be interesting to see if I could find out what programming languages the most popular websites use.

Obviously This is not easy to find out any websites or software tools, because the developers usually they don't want to publish their programming code to the people. So it is very tough task to figure out.

I got some information from other reference sources in searching and then i have made some list here..

This results are in no way definitive and may even be wrong, but the results are from HTTP Header information, Request for file types (.php for example), Searches on forums, presentations and Google Educated guesses ;)

It is purly the programming languages that are serving through HTML.

Results

-- Website -- Programming Language Used
-------------------------------------------------------------

Google - C, C++, PHP*, Ajax

facebook.com -- PHP

youtube.com -- Python

yahoo.com -- PHP*

Monday, 3 June 2013

Scroll to Top - using jQuery

Hi friends, Now we are going to look about how to using scroll to top(images) by using jQuery. If the website has lot of contents in a single page which is useful and easy for users to scroll up to the top page by using some smooth effects. Lets start our code.

First of all we create a image icon and fixed it in bottom right corner of the page.

First put the following html code in your footer area.

<a href="#" class="scrollup">Scroll</a>


Then we link up with the css.



.scrollup{

    width:40px;

    height:40px;

    opacity:0.3;

    position:fixed;

    bottom:50px;

    right:100px;

    display:none;

    text-indent:-9999px;

    background: url('icon_top.png') no-repeat;

}


You can see in the above css that we fixed icon at the bottom.


Now do some jquery functions on your head area of the html.



$(window).scroll(function(){

        if ($(this).scrollTop() > 100) {

            $('.scrollup').fadeIn();

        } else {

            $('.scrollup').fadeOut();

        }

    });


The next step is for scrolling to the top smoothly, if the button is clicked. We can do use the click function for that.



$('.scrollup').click(function(){

    $("html, body").animate({ scrollTop: 0 }, 600);

    return false;

    });


Thats is it, You can test this code in your localhost.


This is complete jQuery code :



<script type="text/javascript">

    $(document).ready(function(){


        $(window).scroll(function(){

            if ($(this).scrollTop() > 100) {

                $('.scrollup').fadeIn();

            } else {

                $('.scrollup').fadeOut();

            }

        });


        $('.scrollup').click(function(){

            $("html, body").animate({ scrollTop: 0 }, 600);

            return false;

        });


    });

</script>



For Icon Image Download : Click here


Notes :


Don't forget to add the following code in your head tag or else it does not work.


<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>



Thanks for reading.


Updating Sources : gazpo blog.









Tuesday, 28 May 2013

How to Increase the Maximum File Upload Size in WordPress

[caption id="attachment_595" align="alignleft" width="300"]mediafilesize Increase the Maximum File Upload Size[/caption]

By default the WordPress gives the uploading limit around 2 mp size. This does not nowadays, because even a minute movie with HD takes much heavy size file. In this post, I will give you some tricks to increase the maximum file upload size in WordPress.

Step 1: Take your theme functions.php file

Just add the following code into that,
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );

Step 2: Create or Edit php.ini settings

In your root folder, create (If you do not have) a new file called php.ini, add the following code
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

Step 3: Do some in .htaccess

add the following in your root .htaccess file
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

Notes:-

If you are in a shared hosting this techniques will not work, In that case you would have to contact your hosting provider to increase the size limit.

Thanks for reading.

 

Sunday, 12 May 2013

Setting Up Apache Server Virtual Host In Your Windows OS

imagesFor Coders, This Virtual Host option is flexible in project making. There is lot of 3rd party tools available in the market like Xampp, Wamp, but those are set to be in proper directories or else it wont work.


If you are a php developer and need to organized your website projects on certain folder with each individual host address e.g. "test1.web", "test2.web", you can use any name for virtual host but don't use ".com" extension as this will tell the browser to look the website on the internet and not on your local pc.


This procedure assume that you have already installed the apache for windows, php module for apache


Step -1 :-


open the apache configuration file, note that better to install the apache on the root of drive C:


(c:/apache/) to make it compatible for short naming folder, ok so assume your apache was installed on the root drive c:


so open the configuration file on c:/apache/conf/httpd.conf and enable the virtual host module, scroll down to near end of configuration and you will find this



# Virtual hosts
# Include conf/extra/httpd-vhosts.conf

uncomment the vhost module by removing the hash character on fron of it so it will look like this



# Virtual hosts
Include conf/extra/httpd-vhosts.conf

ok save the file.

Tuesday, 7 May 2013

PHP Tutorials for beginners – Variables

php variableHi Friends, Hope you are doing well. I believe that you have gone through our previous PHP tutorials and get some ideas. That is fine. Today we are going to talk about PHP Variables.

PHP variables as containers for storing data.

Rules for PHP variables:

  • A variable starts with the $ sign, followed by the name of the variable.

  • A variable name must begin with a letter or the underscore character.

  • A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ).

  • A variable name should not contain spaces.

  • Variable names are case sensitive ($y and $Y are two different variables).


OK. Do not get sleepy, If you go for example you can easily understand what is variable.

For eg 1:
<?php
$a = "Hello, ";
echo $a;
?>

Check this output in your localhost, it will show Hello. 

This is it, Here $a is a variable, which contains hello value into that. Like that way we have to use php variables.

Eg 2:
<?php
       $v = 2500;
       $x = 7500;
       $y = 5000;
       $z = $v+$x+$y;
       echo $z;
?>

Do this practice in your localhost. Now you can get clear view about these variables.

Notes:

We do not initiate data type in PHP variables. It automatically converts the variable to the correct data type, depending on its value.

If you use alphabets, make double codes (in between that). for example ( $name = "hello word, how are you"; ) and should end with semi colon.

PHP has four different variable scopes. We will see about those in next tuto's.

Thanks for reading. Post your comments.

Saturday, 4 May 2013

Dual-Booting Ubuntu Linux and Windows.

Dual-Booting Ubuntu Linux and Windows 7/Windows Vista (with the Windows bootloader)

Ubuntu is one of the most popular Linux Operating System (for free, of course) , and has gained most of its popularity due to its ease-of-use and its appeal to people who don't like to wage war against their PC to make it work for them.

Step-by-Step Ubuntu, Vista Dual-Boot Pictorial

Installing Ubuntu...

These steps assume that you have Windows already installed and are installing Ubuntu to some free space on the drive. If that's not the case, you'll have to follow the steps a little more loosely than they're written.

Step One

Insert your Ubuntu CD or DVD in the drive, and boot from it to begin setup. You can usually do this by either pressing F8/F12 to select the boot device or by changing the order of boot devices in the BIOS, depending on your motherboard manufacturer:

1

Wednesday, 1 May 2013

PHP Tutorials for beginners – 2

Hi Guys, Hope you guys have successfully installed xampp server or wamp server in your computer. That's is fine, Still If you have confusion go back to our previous tutorial or put your queries

in comments section, I will try to update you. As I told you earlier PHP is a server-side scripting language designed for web development. It is influenced by C, C++, Perl and Java. For this PHP implementation you must know basic programming about C language coding. If you are good in C or Java, Which is very easy to implement. PHP commands can be embedded directly into an HTML source document rather than calling an external file to process data. You can make a full php code to output. Like that way we are going to develop.

PHP codes must start with <? and ends with ?>. In between these we should put our code.

OK let us start our first php program here. Open any editor like notepad, notepad++, intype etc. which is your favorite in your system, do write following eg codes.

Eg 1:

Assume we should display Hi everyone, This is a beautiful world with beautiful people. we are going to display this sentence through PHP.

Thursday, 25 April 2013

PHP Tutorials for beginners - 1

php-logoHi Friends, There are billions of websites and applications are available on the web. Lot of programming languages to be used to develop web like Html,  PHP, ASP, JSP etc. Nowadays PHP is a very powerful and familiar web programming language even though which is open source. We can do anything through PHP on the web. I would tell you very familiar web giants Yahoo, Facebook, YouTube etc.... are using PHP. Why I am telling this is, from this post on wards I am going to write about some PHP programming language based tutorials. I believe that coming tutorials would be helpful for freshers, web developers and the people who are wanted to learn about PHP web programming simply. In coming sections we gonna discuss about web designs, developments and practical projects and so on.


Why PHP?




  • Which is an open source server side programming language available at free of cost.

  • Very efficient on multi-platforms like Windows, Linux, and UNIX etc..

  • Suitable for developing dynamic web pages

  • We can develop from small websites to giant business and organizational websites, informative forums, chatting platforms, CRM solutions, e-commerce shopping carts, community websites, e-business, shopping carts and gigantic database driven sites. Moreover, data handing has also been pretty handy in PHP in which the programmers can easily store data, serialize, creating cookies, calculating viewers by cookies and sessions and excellent file management system.

  • Flexible for the clients in terms of Budget and all.

  • 40% of websites are running through PHP programming.

  • Familiar faces using PHP is Facebook, Yahoo, YouTube, WordPress etc.


Ok enough about PHP stories. Lets start our practical appliance,


How to install PHP on your local PC?


Monday, 1 April 2013

Image source effects on mouse over

Hi Friends, You could see some hover effects for social icons  in many of websites,  which is quite to easy to implement it. Nowadays there is lot of ways to implement it. i am going to show the basic one which is easy for all.

For eg.

Take 2 image icons as you want to make hover effects,  I would recommend the images extension to be in png or gif.

        icon-fbicon-fb-hover


I take these images 2 above images.
<div>
<a href="https://www.facebook.com/niyaz.prec" target="_blank"><img src="icon-fb.png" alt="Facebook" onmouseover="this.src='icon-fb-hover.png';" onmouseout="this.src='icon-fb.png';" /></a>
</div>

If it is helpful, update your comments. Thanks for reading my blog.

Sunday, 31 March 2013

How to get full url link in PHP?

$_SERVER['HTTP_HOST']  = This will return server name from the URL.

$_SERVER['REQUEST_URI'] = This will return the full path of your directory.

The following example will give you clear idea,
<?php
$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo $url;
?>

Monday, 25 March 2013

How to customize WordPress login page

Hi friends, certainly you have felt when you make WordPress kind web development, WordPress login page can be better if we can customize with our logo and css. Yes, we could customize the wp whatever you like without any plugins.

Today i am gonna show you how to change default wp logo and some css in login page.

If you go to http://YOUR WP PATH/wp-login, by default the page shows like this, to change this read below..


wordpress-default-login-screen

Ok, First we can change logo, by doing that, open your functions.php in your activated theme by using any editor like notepad, notepad++, etc. whatever you use.

Saturday, 23 March 2013

Wordpress - How to customize your wordpress admin dashboard.

Customize WordPress Dashboard according to your needs.


Hi friends, Here I am going to talk about how to customize WordPress dashboard because many of the client does not like to see some blah blah things on his administrator page. so we need some concentration to get that.

WordPress has beautiful structures for developers to do something on specific areas. Let's move on to do that.

First, have a look about WP dashboard page something like this below image,

wordpress-dashboard

In this see lot of information there like Plugins, right now, incoming links, WordPress development blog etc. we do not want all these bunch info.

Sunday, 13 January 2013

PHP-MYSQL JOIN (INNER,LEFT,RIGHT) discussion

Hi friends, in this tutorial we are going to talk about MySQL JOINS, which is very very useful in the application development. often it would be trouble for developer for applying it in applications. let us begin with small example so that we could understand how it is flowing in the applications.


First we need to create 2 tables in your db as given in below,


Table 1 : posts


create fields for posts ->