Posts marked with "Posts" in posts

Prevent Directory Listing using HTACCESS

If you don’t want your site users to see your directory listing, you can do a simple trick in .htaccess file. Here is a screenshot of a directory listing on Apache Server : Now, to disable directory listing of all types of files, type in the following code in .htaccess : IndexIgnore * This will change the directory listing to this : The empty directory listing looks ugly. To make it beautiful, you can add an index page for all directory listings without adding each index files on each directory.... [READ MORE]

Program to Replace localhost links with website url

If you are working on a project and wants to upload the project to your site, then you have to manually replace all the localhost links with the site url. I created a small Python program that will replace localhost links with your WWW site url. Here is the Python code : #!/usr/bin/python import os indir = ‘/var/www/mysite‘ #!Folder of your localhost site. for root, dirs, filenames in os.walk(indir):  for f in filenames:... [READ MORE]

Cross Origin Communication – window.postMessage

The Window.postMessage helps to make scripts talk over different domain connections. When you call a function on an external iframe from the parent window, Javascript won’t allow it. That’s because of the Cross Domain Policy that makes this not possible. But it’s possible since Javascript introduced postMessage function. Suppose you want to call a function on an cross domain iframe with id monu. Let the function be subins(). Here’s how to do it using postMessage technic.... [READ MORE]

Loading Bar until page loads completely using Javascript

This tutorial was requested by Sumit. In this tutorial I’m going to tell how to put up a loading screen until the page has loaded completely. DEMO Here is the screenshot of loading screen : The loading bar will fade out when loading is completed. This code will work for all sites including Blogger Blogs, WordPress Blogs except Dynamic Views Template of **Blogger **(because it uses ajax loading). You can change the image if you want.... [READ MORE]

Setting Iframe height to its content height using Javascript

While loading an iframe on page the most difficult thing is to set it’s height to the height of the content of the iframe. I looked around the web and got the code. This is pure Javascript, doesn’t contain jQuery or any other libraries. Set these functions : function getDocHeight(doc) {     doc = doc || document;     var body = doc.body, html = doc.documentElement;     var height = Math.... [READ MORE]

Create MySQL Injection free Secure Login System in PHP

There were a lot of people who created tutorials to create a PHP Login System. But they were all vulnerable to MySQL Injection. In this post I’m going to demonstrate a login system free of this vulnerability. It is very secure. There are mysqli and PDO in PHP to escape these injections. We are going to use **PDO ( PHP Data Object **). Download Demo UPDATE – logSys There is a new, free, better Advanced Login System which you can check out here.... [READ MORE]

Better Google Chrome History Page

As you know, Google Chrome‘s Browser History is not efficient. It’s history is not like any other browsers. I think they made the History page in a hurry. If we want to search for a page we visited before, we won’t get it by searching on History page. That’s the main problem. This problem was solved when a lot of users created an alternate History Page extension on Chrome Webstore. In this post I’m gonna tell the most used History Alternate Extension.... [READ MORE]

Setting Infinite Width on an element – HTML

The maximum width we can add on a div is 100%. What if you want more than that ? The solution is not to add more percentage to div but to do something other. Adding white-space property. This will only work on the main parent elements such as elements with display property as follows: block table inline-block So now you know what are the main parent elements. Now back to the point, to add infinite width set the white-space property to the value nowrap.... [READ MORE]

Generating Random String in PHP

In PHP you can generate random number by using rand function, but there is no specific function to generate a random text or string. In this post I’m going to show the function that will generate a random string of length mentioned. Here is the function: function rand_string($length) { $str=""; $chars = "subinsblogabcdefghijklmanopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $size = strlen($chars); for($i = 0;$i < $length;$i++) { $str .= $chars[rand(0,$size-1)]; } return $str; } Usage To generate a random string use rand_string() function with the parameter of length of the to be generated string.... [READ MORE]

Installing Wine 1.6 on Ubuntu 10.04

Wine 1.6 is not latest version for Ubuntu 10.04, but you can install it by compiling the source code and it works perfectly. See demo here. To install Wine 1.6 follow the instructions. Optional : Wine Team recommend you to uninstall previous Wine versions when installing a compiled version. But its optional. If the Wine 1.6 fails you can uninstall 1.6 and use the old version. Steps : Download the Wine 1.6 Source Code from here. Extract the wine- 1.... [READ MORE]

Follow/Subscribe

Telegram 

Mastodon  Twitter

GitHub GitLab

Subdomains

Demos  Lab

Past

This blog was once on WordPress. Now a static site. See source code on

GitLab