greyimg

Grab title from other website

Posted by guru in September 18th, 2007
Published in PHP

I used this code when programming a web application that needed to fetch the title from user’s website. It uses Ajax to pull and show the title from a website or webpage. I thought this might help some of my readers so, here is the code:

Download the file: Fetch title from other website

Use/Modify/Distribute the code freely, as you want.
If you encounter any bug or problems please report that to me. If you’ve got any suggestions please drop a comment below.


Encrypting a password to store in database (MD5 - SHA 1)

Posted by guru in September 18th, 2007
Published in Java

If you are making a web application that involved handling of several user accounts and your are thinking about storing a plain text password on your database then you should think again.

People tend to use same password while making account on different websites, it simply makes it easier to remember. While making same password in different websites is more secure than making same username and password in different websites, it is still not a very good idea for obvious reasons. But you can’t stop people from doing that, and some of your users may have done the exact same thing in your site.

Now, if an unauthorised person get a direct access to your database, they can easily see the passwords of each and every users registered in your website. If the passwords are not encrypted, some of the ignorant users your site are in a real trouble. Since you are responsible for maintaining the security of your website, you will inevitably get most of the blame for this disaster. You can save yourself from all these unimaginable distress by encrypting the password of your users before storing it to the database.

In this article I’ll show you how to encrypt a password in Java, and explain you about using ’salt’ to make your web application more secure.
Read full article…


Why use CAPTCHA?

Posted by blogmaniac in September 18th, 2007
Published in Quick Info

Should I use CAPTCHA in my registration or contact form? What is CAPTCHA?

“Are you a human?”
This is a line you sometimes see below a CAPTCHA in some websites. And it is quite right to ask that either. CAPTCHAs are simply used to set Human and Computers apart.

For example:
You have a website where users can make a free account through a simple registration form.

A malicious software can make 100’s and 1000’s of accounts with random and unavailing usernames with some automated process in an hour, wasting your internet bandwidth, database quota, as well as rising the CPU load to an extreme. The result will be devastating and cleaning such mess would require days, not to mentions the workload.

Its obvious that you want to prevent this from happening and thats where CAPTCHAs come to rescue. CAPTCHAs are basically a system or a quick hack to keep computers thinking for a change.
We’ll talk about image CAPTCHAs; the concept of sound CAPTCHAs will be obvious.
Read full article…


Making your own reloadable CAPTCHA using PHP

Posted by guru in September 14th, 2007
Published in PHP

Have you ever noticed a security image while signing for an account on sites like Google mail or Windows live mail and thought of it as an useless stuff? Infact it is so vital that thousands of websites are using these images called CAPTCHA for anti-spam.
If you reached this page searching for the simplest way to make a CAPTCHA class using PHP, your are provably familiar with the concept of using CAPTCHA.

For people who don’t know what CAPTCHA does, an article is soon coming for you…
UPDATE: Check out Why use captcha?

In this article I will show you how to implement a CAPTCHA in your web application, using a single PHP function.
Read full article…


Serving files through PHP

Posted by guru in September 12th, 2007
Published in PHP
UPDATE:
- I’d like to thank a friend who detected this bug:
Microsoft Windows users, please change the following line:

if (realpath($allowedfilepath).”/$file” …
to,
if (realpath($allowedfilepath).”\\$file” …
 

Serving files through PHP is basically needed in two cases:
1) When you want to count the number of times it has been downloaded.
2) When you don’t want to give direct access to the file from your server. (Hiding or protecting file path)

-Being able to serve files through PHP can also be useful when you want only specific users to download the files in your server, for example: Only registered users, or users who pays for the file, like online PDF books.
-You can also use it to ban or allow specific files to your users.
It gives you full control over transferring of files in your server.

Here is a code snippet to serve a file using php script.
Read full article…


Storing PHP session to mysql database

Posted by guru in September 8th, 2007
Published in PHP

Possibility, advantages, disadvantages and procedure of storing session data into a database.

If you are a web application developer or have experience in making PHP programs, you are provably familiar with the concept of session system. Normally, PHP would save your session data into a file inside a folder that you specify using php.ini file.

Since, PHP has now added a functionality to allow custom handling of session data, you can store it almost anywhere. Therefore, you can also use a database to store these data.
In this article, we’ll discuss all about storing session data to a database; it’s advantage, disadvantage as well as the coding required to implement this system into your web application.

Read full article…


What’s this blog about?

Posted by fcs in September 7th, 2007
Published in Blog news

Dear users.

We are proud to launch yet another blog, all about programming.

Although, we’ll be posting a lot of useful code snippets through this blog, we also welcome volunteers who wants to post their own source code under this domain name.

To post a source code without having to make an account, send us an email on:
submit[at]freecodesnippet.com, along with the following information:

1) Your pen name (Author of the code).
2) Title of the source code.
3) The source code itself, of course.
4) Source files (if any).

Note: You can either send the source file directly through email attachment by
compressing all the files inside one .zip or .tar file.
Or, you can also send the link to the file, if you have already uploaded it in your website or somewhere else.

Automated version:
If you have signed up on this blog, you can also post your source code here (new): http://post.freecodesnippet.com
(If you don’t have an account already, goto: Signup page).

You source code will be published as soon as practicable.
We will also put a link to your website through your article if you provide the URL along with the source code.

Please be informed that we only accept programming related articles. The article can contain several code snippets, or simply some programming hacks, tips and tricks etc.

And as always, if you have any suggestions, you can always, post a comment to this blog entry
or, email us at feedback[at]freecodesnippet.com.
or, visit: http://feedback.freecodesnippet.com (currently not available)

—freecodesnippet.com team—


« Previous Page

Social Feeds

Topics Search

Main Translator

French

German version

Spanish version

Italian version

Categories

Recent Articles

Recent Posts

Recent Commentes

August 2008
M T W T F S S
« Oct    
 123
45678910
11121314151617
18192021222324
25262728293031

Blogroll

Navigation

Share!

Add to Technorati Favorites
Add to Google Add to Windows Live