Save info   Get password
Home Submit your blog Edit Account Rules RSS-Archive Contact


SQL Injection Attack - Examples and Preventions in PHP
2007-12-18 12:41:00
What is SQL injection?It is a basically a trick to inject SQL command or query as a input mainly in the form of the POST or GET method in the web pages. Most of the websites takes parameter from the form and make SQL query to the database. For a example, in a product detail page of php, it basically takes a parameter product_id from a GET method and get the detail from database using SQL query. With SQL injection attack, a intruder can send a crafted SQL query from the URL of the product detail page and that could possibly do lots of damage to the database. And even in worse scenario, it could even drop the database as well.Examples :Let's look at the usual query for user login in PHP,$sql="SELECT * FROM tbl_user WHERE username= '".$_POST['username']."' AND password= '".$_POST['password']."'";$result=mysql_query($sql);Well, lots of people thinks that only the valid user can log in inside the system but that's not true.Well anybody can log in to that website with a simple tr
Read more: Injection

A simple Class to export data to excel using PHP
2007-12-16 12:21:00
While generating a report in your project, you might have to download the data into excel file using PHP. In most scenario, you have to display the report in a page and create a link to download the report in the excel file. Well in that scenario, i think i can help you with a simplified class and code of PHP.I've created three files in my example.1) class.export _excel.php - This file contains the code to export data in excel.2) export_excel.php - This file contains the code to assign values of the excel header and excel data. The header is one-dimentional array. And the other one is the values to be exported and this one is two-dimentional array. And this file also contain the "fn" named get method ($_GET) varible , which is the name of the file to be generated. If a file called "daily_report.xls" is to be generated then this file can be called as "export_excel.php?fn=daily_report".3) test.php - This file contains the data to be displayed in the web page and the same one will be


Password protect a page using HTTP Authentication in PHP
2007-12-15 00:52:00
Have ever been thorough cpanel ? when you open the link of cpanel, you can see a pop up which ask for entering user name and password for login. Well in my article I'm going to show you how you can build the same kind of page protecting mechanism using http authentication in php.Somebody might say that I can also protect the page by making a login page to access the protected page. Well dude!! you are right, you can do that but the main benefits of this method is "you don't have to create the login page at all".Let's Start, First of all store the user name and password in the variables$auth_user="urusername";$auth_pwd="urpassword";For better security, please store these values in database and authenticate from database.Now let's create the http authentication function called authenticate() using header() function available in PHP.function authenticate(){header('WWW-Authenticate: Basic realm="Enter Your Login detail to add money"');header('HTTP/1.0 401 Unauthorized');echo "You m
Read more: Password , Authentication

Change dropdown list (Options) values from database with ajax and php
2007-12-13 11:58:00
I'm going to show you a example in php and ajax to change the values of the dropdown's options without refreshing the page. The values (options) of the dropdown are fetched from the database and the certain portion of the web pages is only refreshed without need to refresh the whole page.Lets's start with creating the two tables country and city and insert some dataCREATE TABLE country(id tinyint(4) NOT NULL auto_increment,country varchar(20) NOT NULL default '',PRIMARY KEY (id)) TYPE=MyISAM;CREATE TABLE city(id tinyint(4) NOT NULL auto_increment,city varchar(50) default NULL,countryid tinyint(4) default NULL,PRIMARY KEY (id)) TYPE=MyISAM;Now let's look at the html code, let's look at the code of the form and its elements<form method="post" action="" name="form1">Country : <select name="country" onChange ="getCity('findcity.php?country='+this.value)"> <option value="">Select Country</option> <option value="1">USA</option> <option value="
Read more: Options

Clean and efficient coding technique in PHP
2007-12-13 01:02:00
Well there are lots of discussion regarding what the actual "clean code" is. At the end of the day you can find there are mainly two criterion for clean code:1. Efficiency: Does the code run as quickly and efficient ly as possible? Does the code make the most of it's objects and variables with maximum reuse and minimal waste?2. Maintainability: Is the code easy to understand for other developers? Is it well planned, logical, well documented, and easy to update?Let's discuss the various elements comprising these two broad points regarding clean code, and example in PHP.One way or another, all pseudo code is eventually converted to machine code. This code will occupy some finite amount of memory. Some languages, such as Java and the .NET Framework first product IL (Intermediary Language) code before producing machine code. In PHP, there are a few key ways to minimize the amount of memory and machine code overhead generated by your application. The best place to start the discussion is
Read more: Clean

PHP - a bad programming language - Dark side of PHP
2007-12-10 00:49:00
I'm a web developer by profession and have been involved in PHP development for last three years. PHP is very easy to learn and program in. But what i think, PHP is a incomplete programming language as well as a bad programming language which gives bad practise for the programmers.I can point out why a most popular programming language used in Internet sucks and have a lots of dark side...1) No need to define and declare variable - In most of the programming language, you have to declare the the type of variable and define it before to be used in the code but in php you don't have declare the type of variable before using.Although, it make easy for the programmer but ita bad practice at all for a genuine programming concept.2) No Strict data conversion - Well as you see in java, if you try to con cat a integer variable with a string variable you've to convert it into string variable before con cating with string otherwise compiler throws exception. But, in php if you've to do so


Cross-site scripting ( xss ) attack by example and prevention in PHP
2007-12-07 11:58:00
What are cross-site scripting (XSS ) Attacks?Cross -site scripting attack s are attacks that target the end user instead of your actual site. Vulnerable web applications that don't check or validate properly incoming data let arbitrary code to run on a client computer (such as Javascript). The end result can be anything from stealing cookie data or redirecting to a different site, to embedding a browser exploit on a page. Anything that can be done with Javascript (a lot!).Example :Let us suppose that there is a comment form in the Michael's website of a section like photo gallary or article. He created a feature that let his viewers to comment on his photos or article by submitting a form. And he doesnot have much validation in this comment form.Now Sam (inturder) visits the Michael's website and he's jealous of Michael's website traffic and wants to steal some of his website's traffic. Then he can insert the follow code to his comment form Hi Michael, very gud job, keep it up! <
Read more: prevention

Why php is more popular in the web
2007-12-06 11:37:00
PHP is popular because it's relatively easy to learn and relatively cheap to develop web projects.And in the other side, its a open source technology and development cost is lower than the other technologies like java and dot net.PHP's three key advantages over competing technologies:1. Designed for the Web - PHP has built-in features to handle heavily trafficked sites and to simplify common Web programming tasks.2. Ease of Use - Companies gain enhanced productivity of development teams and significantly reduced time-to-market of mission critical web applications.3. Open Source - Collaborative development leads to rapid technology advancement, superior code quality, a massive library of prewritten code, and comprehensive developer support and documentation.You can view the popularity of PHP from here - Popularity of PHP.According to a Netcraft survey published in April 2002, PHP is now being used by over 24% of the sites on the Internet out of the 37.6 million web sites reported worl


Is google Invading privacy
2007-12-06 02:38:00
Google, the world's largest Internet search engine, is on several fronts a danger that has to be stopped, a study released by Austria's Graz University claims.A research team led by Prof Hermann Maurer, chairman of Graz University's Institute for Information Systems and Computer Media, argues that Google is creating unacceptable monopolies in many areas of the worldwide web.According to his research, around 61 billion Internet searches are conducted each month. In the US, on average 57 per cent of searches are conducted with Google, and up to 95 per cent of Internet users use Google at least sometimes."Google is massively invading privacy," the study said with the company knowing more than any other organisation about individuals and companies, but not bound by national data protection laws.The study argues that Google is influencing economies in the way advertisements and documents are ranked.The other form of Google's invasion is the Google Maps. There are lots of importan


A ajax tutorial for beginners
2007-12-05 12:26:00
What is ajax ?AJAX is an acronym for Asynchronous JavaScript And XML. AJAX is not a programming language. but simply a development technique for creating interactive web applications.A traditional web application will submit input (using an HTML form) to a web server. After the web server has processed the data, it will return a completely new web page to the user.Because the server returns a new web page each time the user submits input, traditional web applications often run slowly and tend to be less user friendly.With AJAX, web applications can send and retrieve data, without reloading the whole web page. This is done by sending HTTP Request to the server, and by modifying only parts of the web page using JavaScript.AJAX is based on the following open standards:JavaScript XML HTML CSS Ajax Example : Create a file called test.php and put the following codes.<html><head><script src="http://php-ajax-guru.blogspot.com//hint.js"></script></head><body>


A php tutorial for beginners
2007-12-05 00:03:00
Taken directly from PHP's home, PHP.net, "PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly." This is generally a good definition of PHP. However, it does contain a lot of terms you may not be used to. Another way to think of PHP is a powerful, behind the scenes scripting language that your visitors won't see! When someone visits your PHP webpage, your web server processes the PHP code. It then sees which parts it needs to show to visitors(content and pictures) and hides the other stuff(file operations, math calculations, etc.) then translates your PHP into HTML. After the translation into HTML, it sends the webpage to your visitor's web browser. Creating first php enabled page Create a file named hello.php and put it in your web server's root directory (usually www


Sending e-mail from localhost in PHP in Windows Environment
2007-12-26 11:22:00
Have you ever been frustrating, why e-mail is not going from the localhost while using xampp or wamp or any other PHP servers in windows environment? well in that situation i think i can help you.In this article i am goin to tell you how to send e-mail from localhost in PHP.1) Open the "php.ini". You should know where it is located because it depends upon the particular server you're running.2) Search for the attribute called "SMTP" in the php.ini file.Generally you can find the line "SMTP=localhost". change the localhost to the smtp server name of your ISP. And, there is another attribute called "smtp_port" which should be set to 25.I've set the following values in my php.ini file.SMTP = smtp.wlink.com.npsmtp_port = 253) Restart the apache server so that PHP modules and attributes will be reloaded.4) Now try to send the mail using the mail() function ,mail("you@yourdomain.com","test subject","test body");you might get the warning like this,Warning: mail() [function.mail]: "sendmail_
Read more: Windows , Environment , Sending

Date or Time Comparision in PHP
2007-12-25 12:16:00
If you've to compare the difference between two dates or times values. How you're going to accomplish it in PHP ? If you don't know how to do it, then here is simple fuction for you to compare the date (as well as time) in PHP.function greaterDate($start_date,$end_date){$start = strtotime($start_date);$end = strtotime($end_date);if ($start-$end > 0)return 1;elsereturn 0;}so if there two date or time values stored in $date1 and $data2 variables then you can call that function in the following way$date1='2007-10-10';$date1='2007-10-11';if(greaterDate($date1,$date2))echo "First parameter is greater";elseecho "Second parameter is greater";well you can guess the result, it prints out "Second parameter is greater"and if you call the same function with these different values$date1='2007-10-10 12:15:27';$date1='2007-10-10 11:17:37';The result will be "First parameter is greater" 


5 useful url rewriting examples using .htaccess
2008-03-10 23:10:43
If you are looking for the examples of URL rewriting then this post might be useful for you. In this post, I’ve given five useful examples of URL rewriting using .htacess. If you don’t know something about url rewriting then please check my older post about url rewriting using .htaccess .


Prevent Directory Listing using .htaccess
2008-03-08 23:39:54
What is directory listing ? As we know, most of the website contains “images” folder inside the root folder. If we type “www.somesite.com/images” in the browser and it shows the listing of the files in the browser like the picture below which means that directory listing is allowed on that web server.
Read more: htaccess , Directory

Solving ‘Warning: Cannot add header information’ in PHP
2008-03-07 09:29:53
While using PHP, you might have faced the following warning while using the header functions like header(), setcookie(). Warning: Cannot add header information - headers already sent by (output started at file.php:[line_number])


I’m Sorry !!! But Thank you for the achievement
2008-03-06 12:41:50
I’m really sorry that I’ve not been posting in this blog from last few days. Well, I’m moving the hosting of this blog and the electricity problem which I’ve mentioned before are the reason behind my irregular posting. I’m also disappointed with drop in PR of this blog.
Read more: Thank

How to know the feedcount of the feedburner’s user?
2008-03-01 09:10:47
If you are a blogger then you must know about feedcount. Feedcount refers to the no of subscribes of the rss feed of that blog or website which is powered by Feedburner. You can look at the example below.


Google Updated the PR - I’m disappointed
2008-02-29 04:26:10
It seems that google has updated it’s PR yesterday and I got big fat zero this time. I don’t know what is the reason behind this. Previously I’d PR1 for this blog and in next update I was hoping of PR3 but got a huge “0″ this time.
Read more: Google , disappointed

7 Useful SEO tips for Wordpress Blog
2008-02-28 12:08:44
Yesterday Luqmaan of computer-realm.net emailed me and asked about the secret of traffic of my blog. I’m very happy with the way traffic is growing in this blog. I’ve started this blog in this domain from 4th of Jan 2008. All the other old posts are imported from my old blog to few [...]
Read more: Useful , SEO , Wordpress

Need help to sell your software or product
2008-02-26 13:45:16
Do you have your own IT company? You’ve produced some softwares and need the best way to promote your software in market and earn the best from it. Then why don’t you check They are best in sales lead management . They will provide the best outcome from your product with their expertise to [...]


Custom Error Page with .htaccess
2008-02-22 09:46:13
In my last post of Hiding .php file extension with .htaccess Michael has mentioned that you can create your own custom page for the the 404(not found) error in server. And alex wanted to know that tip as well.Alex here is the post for you rather than replying your comment.


Need loans for your IT Company??
2008-02-22 09:45:15
Do you want to open your own IT company? Is your IT company suffering from financial crisis? Then I would recommend to check EZUnsecured.com . They basically provide Business Loans. And why they’re better than the other?? There is an easy process to get loans from EZUnsecured.com . Furthermore, they provide the excellent service and [...]


Email Validation in PHP
2008-02-17 13:00:05
Well you’ve been asking why this person has posted the same stuff which you can find easily in google. Ya you are right you can get lots of scripts but many of them are not useful for me so far. They just validate the email like “info@yahoo.com” but they didn’t validate the email address [...]
Read more: Email , Validation

Blogrush is Racist - It sucks
2008-02-15 11:40:45
I’ve seen that many of my blogger friend are using Blogrush widget in their blog so i wanted to give a try with this widget and i signed up for this website www.blogrush.com.
Read more: Racist , sucks

Get Bucks for your hobby
2008-02-15 11:35:28
Everybody has different type of hobby. My hobby includes traveling, listing to music and obviously the most is blogging. Writing about Php, Ajax, Javascript, web 2.0 and my personal interest has been my passion nowadays. And what do you need extra if you can earn money from blogging. Well, everybody wants to make money from [...]


Hide .php extension with url rewriting using .htaccess
2008-02-13 06:12:44
Last time I’ve written an article about hiding php file extension where I’ve showed you how you can use .html or .asp extension of file instead of .php extension. But there was one flaw in that technique you have had to change the file extension explicitly but in this post I’m going to show you [...]
Read more: htaccess

Php function to validate two decimal places of a number
2008-02-10 04:24:48
If you are looking for the validation of a number which contains only two decimal places. Means you want to accept the values like 0.21 or 1.34 or 12.55 or 445.66 as a input and throw an error when somebody enters the number like 0.2 or 4.678 from a text box. Here is a simple [...]
Read more: function

Jquery : Benefits, Examples and Free Ebook
2008-03-13 06:18:54
What is jQuery? Directly taken from the website of jQuery -” jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages”.It is basically a JavaScript framework for writing huge task of JavaScript with few lines of code.
Read more: Benefits , Examples

Image hover effect using jQuery
2008-03-15 11:53:52
In this post, I’ll show you how to make a image hover effect using “div” in jquery.Take a look at a telebid.com if you put the mouse over the bid button it will be changed to login and afterwards it become bid button.
Read more: Image

Page 1 of 3 « < 1 2 3 > »
eXTReMe Tracker