DirectoryInternetBlog Details for "PHP And Ajax Related Useful Resources and Codes"

PHP And Ajax Related Useful Resources and Codes

PHP And Ajax Related Useful Resources and Codes
Useful Tools, Tutorials, Codes , Tips, Tricks and Resources for all Ajax and Php beginners and experts .
Articles: 1, 2, 3, 4, 5

Articles

Getting real IP address in PHP
2007-12-27 18:46:00
Are you using $_SERVER['REMOTE_ADDR'] to find the the client's IP address? Well dude, you might be amazed to know that it may not return the true IP address of the client at all time. If your client is connected to the Internet through Proxy Server then $_SERVER['REMOTE_ADDR'] just returns the the IP address of the proxy server not of the client's machine. So here is a simple function in PHP to find the real IP address of the client's machine. There are extra Server variable which might be available to determine the exact IP address of the client's machine, they are HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR.function getReal IpAddr(){if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet{ $ip=$_SERVER['HTTP_CLIENT_IP'];}elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) )//to check ip is pass from proxy{ $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];}els e{ $ip=$_SERVER['REMOTE_ADDR'];}}In this function, first attempt is to get the direct IP address of client's...
More About: Address
Sending e-mail from localhost in PHP in Windows Environment
2007-12-26 18: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.
More About: Windows , Mail , Environment , E-Mail , Localhost
Sending e-mail from localhost in PHP in Windows Environment
2007-12-26 18: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.
More About: Windows , Mail , Environment , E-Mail , Localhost
Sending e-mail from localhost in PHP in Windows Environment
2007-12-26 18: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.
More About: Windows , Mail , Environment , E-Mail , Localhost
Sending e-mail from localhost in PHP in Windows Environment
2007-12-26 18: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]: "sendma...
More About: Windows , Mail , Environment , E-Mail , Localhost
Date or Time Comparision in PHP
2007-12-25 19: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" 
More About: Time
Date or Time Comparision in PHP
2007-12-25 19: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.
More About: Time
Date or Time Comparision in PHP
2007-12-25 19: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.
More About: Time
Date or Time Comparision in PHP
2007-12-25 19: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.
More About: Time
SQL Injection Attack - Examples and Preventions in PHP
2007-12-18 19: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_q uery($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...
More About: Attack , Injection , Atta
SQL Injection Attack - Examples and Preventions in PHP
2007-12-18 19: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 ...
More About: Examples , Attack , Injection , Atta
SQL Injection Attack - Examples and Preventions in PHP
2007-12-18 19: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 ...
More About: Examples , Attack , Injection , Atta
SQL Injection Attack - Examples and Preventions in PHP
2007-12-18 19: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 ...
More About: Examples , Attack , Injection , Atta
A simple Class to export data to excel using PHP
2007-12-16 19: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...
More About: Data , Simple , Excel , Class , Export
A simple Class to export data to excel using PHP
2007-12-16 19: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 ...
More About: Data , Simple , Excel , Class , Export
A simple Class to export data to excel using PHP
2007-12-16 19: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 ...
More About: Data , Simple , Excel , Class , Export
A simple Class to export data to excel using PHP
2007-12-16 19: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 ...
More About: Data , Simple , Excel , Class , Export
Password protect a page using HTTP Authentication in PHP
2007-12-15 07: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 ...
More About: Page , Password , Http , Authentication , Then
Password protect a page using HTTP Authentication in PHP
2007-12-15 07: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_pw d="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 "Yo...
More About: Page , Password , Http , Authentication , Then
Password protect a page using HTTP Authentication in PHP
2007-12-15 07: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 ...
More About: Page , Password , Http , Authentication , Then
Password protect a page using HTTP Authentication in PHP
2007-12-15 07: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 ...
More About: Page , Password , Http , Authentication , Then
Change dropdown list values from database with ajax and php
2007-12-13 18:58:00
I'm going to show you a example in php and ajax to change the values of the dropdown without refreshing the page. The values 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 insertsome data.CREATE 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="2"&...
More About: List , Database , Ajax , Values
Change dropdown list (Options) values from database with ajax and php
2007-12-13 18: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 ...
More About: Change , List , Database , Options , Ajax
Change dropdown list (options) values from database with ajax and php
2007-12-13 18: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 ...
More About: Change , List , Database , Options , Ajax
Change dropdown list (options) values from database with ajax and php
2007-12-13 18: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 ...
More About: Change , List , Database , Options , Ajax
Clean and efficient coding technique in PHP
2007-12-13 08: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 efficiently as possible? Does the code make the most of it’s objects and variables with maximum reuse ...
More About: Technique , Clean , Coding , Efficient
Clean and efficient coding technique in PHP
2007-12-13 08: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 maily two criterion for clean code:1. Efficiency: Does the code run as quickly and efficiently 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 i...
More About: Technique , Clean , Coding , Efficient
Clean and efficient coding technique in PHP
2007-12-13 08: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 efficiently as possible? Does the code make the most of it’s objects and variables with maximum reuse ...
More About: Technique , Clean , Coding , Efficient
Clean and efficient coding technique in PHP
2007-12-13 08: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 efficiently as possible? Does the code make the most of it’s objects and variables with maximum reuse ...
More About: Technique , Clean , Coding , Efficient
PHP - a bad programming language - Dark side of PHP
2007-12-10 07: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 darkside...1) No need to define and declare varaible - 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 concat a integer variable with a string variable you've to convert it into string variable before concating with string otherwise compiler throws exception. But, in php if you've to do so ...
More About: Programming , Dark , Language , Side , Programming Language
More articles from this author:
1, 2, 3, 4, 5
111755 blogs in the directory.
Statistics resets every week.


Contact | About
© Blog Toplist 2012 - Supported by Web Catalog - SEO by FeWorks
eXTReMe Tracker