function get_ip_address() {
if (isset($_SERVER)) {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
} else {
if (getenv('HTTP_X_FORWARDED_FOR')) {
$ip = getenv('HTTP_X_FORWARDED_FOR');
} elseif (getenv('HTTP_CLIENT_IP')) {
$ip = getenv('HTTP_CLIENT_IP');
} else {
$ip = getenv('REMOTE_ADDR');
}
}
return $ip;
}
Showing posts with label Sample php code. Show all posts
Showing posts with label Sample php code. Show all posts
Friday, April 29, 2011
Get IP Address using PHP
Monday, October 27, 2008
Scan a file Line by Line using PHP
/* Scan a file Line by Line using PHP */
/*
Author : evergreenphp
Website : http://evergreenphp.blogspot.com
Website Info : Lots of source code
FREEly available, in PHP, javascript, AJAX,
MySQL etc.,
Description : Scan a file Line by Line using PHP also we can scan any document files using this CODE.
*/
/* Configuration settings start */
$file = '/www/htdocs/evergreenphp/discount.txt';
/* Configuration settings ends */
if (file_exists($file)) {
// put file into an array to be scanned
$lines = file($file);
$cnt_lines = 0;
// loop through the array, show line and line numbers
foreach ($lines as $line_num => $line) {
echo $cnt_lines . " " . htmlspecialchars($line);
echo "
";
$cnt_lines++;
}
}
?>
/*
Author : evergreenphp
Website : http://evergreenphp.blogspot.com
Website Info : Lots of source code
FREEly available, in PHP, javascript, AJAX,
MySQL etc.,
Description : Scan a file Line by Line using PHP also we can scan any document files using this CODE.
*/
/* Configuration settings start */
$file = '/www/htdocs/evergreenphp/discount.txt';
/* Configuration settings ends */
if (file_exists($file)) {
// put file into an array to be scanned
$lines = file($file);
$cnt_lines = 0;
// loop through the array, show line and line numbers
foreach ($lines as $line_num => $line) {
echo $cnt_lines . " " . htmlspecialchars($line);
echo "
";
$cnt_lines++;
}
}
?>
Friday, October 10, 2008
Remove files using file created time using PHP
/*
Author : Evergreenphp
Date : 10-10-2008
Desc : This is will delete all the 'xml' files inside the $path_dir folder
not only that but also this code checks whether the file created before 10 mins
or else that files will not be deleted
h - hour, i - minutes, s - seconds, m - month, d - date of the month, Y - Year
*/
/* Configuration setting starts */
$path_dir = "/www/htdocs/phpdocs/missing_man/general";
$cdate = date("Y-m-d h:i:s",mktime(date("h"), date("i")-10, date("s"), date("m"), date("d"), date("Y")));
$file_type = "txt";
/* Configuration setting ends */
/* Function call */
Delete_file_withtime($path_dir, $cdate, $file_type);
/* Function Definition starts */
function Delete_file_withtime($path_dir, $cdate, $file_type){
$dh = opendir($path_dir);
while (($file = readdir($dh)) !== false) {
$ext_test = explode(".", $file);
echo "
".$date_access = date("Y-m-d h:i:s", fileatime($file));
$stcon_dt = strtotime($date_access);
$encon_dt = strtotime($cdate);
if($file != "." && $file != ".." && $ext_test[1] == $file_type) {
if($encon_dt > $stcon_dt){
//@unlink($file);
echo "success";
}
}
}
}
/* Function Definition ends */
?>
Author : Evergreenphp
Date : 10-10-2008
Desc : This is will delete all the 'xml' files inside the $path_dir folder
not only that but also this code checks whether the file created before 10 mins
or else that files will not be deleted
h - hour, i - minutes, s - seconds, m - month, d - date of the month, Y - Year
*/
/* Configuration setting starts */
$path_dir = "/www/htdocs/phpdocs/missing_man/general";
$cdate = date("Y-m-d h:i:s",mktime(date("h"), date("i")-10, date("s"), date("m"), date("d"), date("Y")));
$file_type = "txt";
/* Configuration setting ends */
/* Function call */
Delete_file_withtime($path_dir, $cdate, $file_type);
/* Function Definition starts */
function Delete_file_withtime($path_dir, $cdate, $file_type){
$dh = opendir($path_dir);
while (($file = readdir($dh)) !== false) {
$ext_test = explode(".", $file);
echo "
".$date_access = date("Y-m-d h:i:s", fileatime($file));
$stcon_dt = strtotime($date_access);
$encon_dt = strtotime($cdate);
if($file != "." && $file != ".." && $ext_test[1] == $file_type) {
if($encon_dt > $stcon_dt){
//@unlink($file);
echo "success";
}
}
}
}
/* Function Definition ends */
?>
Tuesday, September 23, 2008
Search a word, string using php
Note: Pls remove the prefix space on all the HTML tags, before compile this program.
/*
Author : evergreenphp
Website : http://evergreenphp.blogspot.com
Website Info : Lots of source code
FREEly available, in PHP, javascript, AJAX,
MySQL etc.,
Description : This program is used to search a word in entire files in a folder
not only that it will search in all the inner folder file.
*/
/* Configuration settings start */
$path_file = '/www/htdocs/evergreenphp';
/* Configuration settings ends */
$file_folder_list = scan_Dir($path_file);
$Files_list_array = Organize_files($file_folder_list);
$search_word_is = $_POST['search_word'];
/* ---------------------------------------------------------------------------- */
/* List out all files and folders in the Current Directory (Specific Directory) */
function scan_Dir($dir=".") {
$arrfiles = array();
if (is_dir($dir)) {
if ($handle = opendir($dir)) {
chdir($dir);
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($file)) {
//$arrfiles[] = $dir."/".$file;
$arr = scan_Dir($file);
$arrfiles[] = $dir."/".$file;
foreach ($arr as $value) {
$arrfiles[] = $dir."/".$value;
}
} else {
$arrfiles[] = $dir."/".$file;
}
}
}
chdir("../");
}
closedir($handle);
}
return $arrfiles;
}
/* Organize the files list */
function Organize_files($files_folders)
{
$Files_array = array();
for ($i=0; $i< count($files_folders); $i++)
{
$check = explode(".", $files_folders[$i]);
if (count($check) > 1) $Files_array[] = $files_folders[$i];
}
return $Files_array;
}
function Start_search($directory_array, $search_word){
echo '< table border="0" width="100%" cellspacing="2" cellpadding="1" align="center">' . "\n";
echo '< tr class="infoBoxContent">< td class="dataTableHeadingContent">' . ' Searching '.sizeof($directory_array).' files ... for: '.$search_word.'< /td>< /tr>' . "\n\n";
echo '< tr>< td> < /td>< /tr>';
// check all files located
$file_cnt = 0;
$cnt_found=0;
for ($i = 0, $n = sizeof($directory_array); $i < $n; $i++) {
// build file content of matching lines
$file_cnt++;
$file = $directory_array[$i];
//echo 'I SEE ' . $directory_array[$i] . '
';
// clean path name
while (strstr($file, '//')) $file = str_replace('//', '/', $file);
$show_file = '';
if (file_exists($file)) {
$show_file .= "\n" . '< tr>< td class="main">' . "\n";
$show_file .= '< tr class="infoBoxContent">< td class="dataTableHeadingContent">';
$show_file .= '' . $file . '';
$show_file .= '< /td>< /tr>';
$show_file .= '< tr>< td class="main">';
// put file into an array to be scanned
$lines = file($file);
$found_line = 'false';
// loop through the array, show line and line numbers
foreach ($lines as $line_num => $line) {
$cnt_lines++;
if (strstr(strtoupper($line), strtoupper($search_word))) {
$found_line= 'true';
$found = 'true';
$cnt_found++;
$show_file .= "< br />Line #{$line_num} : " ;
$show_file .= htmlspecialchars($line);
$show_file .= "< br />\n";
} else {
if ($cnt_lines >= 5) {
$cnt_lines=0;
}
}
}
}
$show_file .= '< /td>< /tr>' . "\n";
// if there was a match, show lines
if ($found_line == 'true') {
echo $show_file ;
} // show file
}
echo '< tr>< strong>Match Lines found:< /strong>' . $cnt_found . '< /td>< /tr>< /table>';
}
?>
< html>
< body>
< form name="search_form" method="post" action="">
< table border="1">
< tr>
< td>Search Path:< /td>
< td>< /td>
< /tr>
< tr>
< td>Word to Search:< /td>
< td>< input type="text" name="search_word">
< /tr>
< tr>
< td colspan="2">< input type="Submit" name="search_submit" value="Start_search">< /td>
< /tr>
< tr>
< td colspan="2" align="left">
if ($_POST['search_word'] != ""){
Start_search($Files_list_array, $search_word_is);
}
?>
< /td>
< /tr>
< /table>
< /form>
< /body>
< /html>
/*
Author : evergreenphp
Website : http://evergreenphp.blogspot.com
Website Info : Lots of source code
FREEly available, in PHP, javascript, AJAX,
MySQL etc.,
Description : This program is used to search a word in entire files in a folder
not only that it will search in all the inner folder file.
*/
/* Configuration settings start */
$path_file = '/www/htdocs/evergreenphp';
/* Configuration settings ends */
$file_folder_list = scan_Dir($path_file);
$Files_list_array = Organize_files($file_folder_list);
$search_word_is = $_POST['search_word'];
/* ---------------------------------------------------------------------------- */
/* List out all files and folders in the Current Directory (Specific Directory) */
function scan_Dir($dir=".") {
$arrfiles = array();
if (is_dir($dir)) {
if ($handle = opendir($dir)) {
chdir($dir);
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($file)) {
//$arrfiles[] = $dir."/".$file;
$arr = scan_Dir($file);
$arrfiles[] = $dir."/".$file;
foreach ($arr as $value) {
$arrfiles[] = $dir."/".$value;
}
} else {
$arrfiles[] = $dir."/".$file;
}
}
}
chdir("../");
}
closedir($handle);
}
return $arrfiles;
}
/* Organize the files list */
function Organize_files($files_folders)
{
$Files_array = array();
for ($i=0; $i< count($files_folders); $i++)
{
$check = explode(".", $files_folders[$i]);
if (count($check) > 1) $Files_array[] = $files_folders[$i];
}
return $Files_array;
}
function Start_search($directory_array, $search_word){
echo '< table border="0" width="100%" cellspacing="2" cellpadding="1" align="center">' . "\n";
echo '< tr class="infoBoxContent">< td class="dataTableHeadingContent">' . ' Searching '.sizeof($directory_array).' files ... for: '.$search_word.'< /td>< /tr>' . "\n\n";
echo '< tr>< td> < /td>< /tr>';
// check all files located
$file_cnt = 0;
$cnt_found=0;
for ($i = 0, $n = sizeof($directory_array); $i < $n; $i++) {
// build file content of matching lines
$file_cnt++;
$file = $directory_array[$i];
//echo 'I SEE ' . $directory_array[$i] . '
';
// clean path name
while (strstr($file, '//')) $file = str_replace('//', '/', $file);
$show_file = '';
if (file_exists($file)) {
$show_file .= "\n" . '< tr>< td class="main">' . "\n";
$show_file .= '< tr class="infoBoxContent">< td class="dataTableHeadingContent">';
$show_file .= '' . $file . '';
$show_file .= '< /td>< /tr>';
$show_file .= '< tr>< td class="main">';
// put file into an array to be scanned
$lines = file($file);
$found_line = 'false';
// loop through the array, show line and line numbers
foreach ($lines as $line_num => $line) {
$cnt_lines++;
if (strstr(strtoupper($line), strtoupper($search_word))) {
$found_line= 'true';
$found = 'true';
$cnt_found++;
$show_file .= "< br />Line #{$line_num} : " ;
$show_file .= htmlspecialchars($line);
$show_file .= "< br />\n";
} else {
if ($cnt_lines >= 5) {
$cnt_lines=0;
}
}
}
}
$show_file .= '< /td>< /tr>' . "\n";
// if there was a match, show lines
if ($found_line == 'true') {
echo $show_file ;
} // show file
}
echo '< tr>
}
?>
< html>
< body>
< form name="search_form" method="post" action="">
< table border="1">
< tr>
< td>Search Path:< /td>
< td>< /td>
< /tr>
< tr>
< td>Word to Search:< /td>
< td>< input type="text" name="search_word">
< /tr>
< tr>
< td colspan="2">< input type="Submit" name="search_submit" value="Start_search">< /td>
< /tr>
< tr>
< td colspan="2" align="left">
if ($_POST['search_word'] != ""){
Start_search($Files_list_array, $search_word_is);
}
?>
< /td>
< /tr>
< /table>
< /form>
< /body>
< /html>
Labels:
File Search using php,
Sample php code
Remove files, folders nested, PHP
Note: Pls remove the prefix space on all the HTML tags, before compile this program.
/*
Author : evergreenphp
Website : http://evergreenphp.blogspot.com
Website Info : Lots of source code
FREEly available, in PHP, javascript, AJAX,
MySQL etc.,
Note : 1. Before using this program, pls take a backup of your file and folders
2. Give folder and file permission then only this code will work nice..
Description : This program is used to remove all the file and folder in a specified folder
*/
/* Configuration settings start */
$path_file = '/www/htdocs/evergreenphp';
/* 0 - files not deleted, 1 - files will be deleted */
$display_with_destroy_files = 1;
/* 0 - files not deleted, 1 - files will be deleted */
$display_with_destroy_folders = 1;
/* Configuration settings ends */
$file_folder_list = scan_Dir($path_file);
$Files_list_array = Organize_file_list($file_folder_list, $display_with_destroy_files);
$Folders_list_array = Organize_folder_list($file_folder_list, $display_with_destroy_folders);
echo "Current Folder : " . $path_file . "< br>" ;
echo "< br>Files Found : ".count($Files_list_array);
echo "< pre>";
print_r($Files_list_array);
echo "< /pre>";
echo "< br>Folders Found : ".count($Folders_list_array);;
echo "< pre>";
print_r($Folders_list_array);
echo "< /pre>";
/* ---------------------------------------------------------------------------- */
/* List out all files and folders in the Current Directory (Specific Directory) */
function scan_Dir($dir=".") {
$arrfiles = array();
if (is_dir($dir)) {
if ($handle = opendir($dir)) {
chdir($dir);
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($file)) {
//$arrfiles[] = $dir."/".$file;
$arr = scan_Dir($file);
$arrfiles[] = $dir."/".$file;
foreach ($arr as $value) {
$arrfiles[] = $dir."/".$value;
}
} else {
$arrfiles[] = $dir."/".$file;
}
}
}
chdir("../");
}
closedir($handle);
}
return $arrfiles;
}
/* Organize the files list */
function Organize_file_list($files_folders, $delete_status=0)
{
$Files_array = array();
for ($i=0; $i< count($files_folders); $i++)
{
$check = explode(".", $files_folders[$i]);
if (count($check) > 1) {
if($delete_status == 1)
@unlink($files_folders[$i]); /* Removing the files */
else
$Files_array[] = $files_folders[$i];
}
}
return $Files_array;
}
/* Organize the folders list */
function Organize_folder_list($files_folders, $delete_status=0)
{
$Files_array = array();
for ($i=0; $i< count($files_folders); $i++)
{
$check = explode(".", $files_folders[$i]);
if (count($check) == 1){
if($delete_status == 1)
@rmdir($files_folders[$i]); /* Removing the Folder */
else
$Files_array[] = $files_folders[$i];
}
}
return $Files_array;
}
?>
/*
Author : evergreenphp
Website : http://evergreenphp.blogspot.com
Website Info : Lots of source code
FREEly available, in PHP, javascript, AJAX,
MySQL etc.,
Note : 1. Before using this program, pls take a backup of your file and folders
2. Give folder and file permission then only this code will work nice..
Description : This program is used to remove all the file and folder in a specified folder
*/
/* Configuration settings start */
$path_file = '/www/htdocs/evergreenphp';
/* 0 - files not deleted, 1 - files will be deleted */
$display_with_destroy_files = 1;
/* 0 - files not deleted, 1 - files will be deleted */
$display_with_destroy_folders = 1;
/* Configuration settings ends */
$file_folder_list = scan_Dir($path_file);
$Files_list_array = Organize_file_list($file_folder_list, $display_with_destroy_files);
$Folders_list_array = Organize_folder_list($file_folder_list, $display_with_destroy_folders);
echo "Current Folder : " . $path_file . "< br>" ;
echo "< br>Files Found : ".count($Files_list_array);
echo "< pre>";
print_r($Files_list_array);
echo "< /pre>";
echo "< br>Folders Found : ".count($Folders_list_array);;
echo "< pre>";
print_r($Folders_list_array);
echo "< /pre>";
/* ---------------------------------------------------------------------------- */
/* List out all files and folders in the Current Directory (Specific Directory) */
function scan_Dir($dir=".") {
$arrfiles = array();
if (is_dir($dir)) {
if ($handle = opendir($dir)) {
chdir($dir);
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($file)) {
//$arrfiles[] = $dir."/".$file;
$arr = scan_Dir($file);
$arrfiles[] = $dir."/".$file;
foreach ($arr as $value) {
$arrfiles[] = $dir."/".$value;
}
} else {
$arrfiles[] = $dir."/".$file;
}
}
}
chdir("../");
}
closedir($handle);
}
return $arrfiles;
}
/* Organize the files list */
function Organize_file_list($files_folders, $delete_status=0)
{
$Files_array = array();
for ($i=0; $i< count($files_folders); $i++)
{
$check = explode(".", $files_folders[$i]);
if (count($check) > 1) {
if($delete_status == 1)
@unlink($files_folders[$i]); /* Removing the files */
else
$Files_array[] = $files_folders[$i];
}
}
return $Files_array;
}
/* Organize the folders list */
function Organize_folder_list($files_folders, $delete_status=0)
{
$Files_array = array();
for ($i=0; $i< count($files_folders); $i++)
{
$check = explode(".", $files_folders[$i]);
if (count($check) == 1){
if($delete_status == 1)
@rmdir($files_folders[$i]); /* Removing the Folder */
else
$Files_array[] = $files_folders[$i];
}
}
return $Files_array;
}
?>
Sunday, September 21, 2008
Hits count of a site using PHP
Suggestion for Hit count:
1. Create table to store the
hit counts into Database.
2. That table having the fields like
(a.) auto_increment_id (Primary Key)
(b.) file_name
(c.) user_ip_address
(d.) date_time_visit
3. Write an INSERT query to insert a record into the Database
Query: INSERT INTO table_name
SET file_name = 'VALUE1',
user_ip_address = 'VALUE2',
date_time_visit = 'VALUE3'
VALUE1 -- basename($_SERVER['PHP_SELF'])
VALUE2 -- $_SERVER['REMOTE_ADDR']
VALUE3 -- date('Y-m-d H:i:s')
4. VALUE1 is used to store for which filename visited by the user
5. VALUE2 is used to store the IP address of the visited user
6. VALUE3 is used to store the visited time of the user
7. Write the INSERT in (STEP 3) on your common areas
i.e. Header or Footer or leftpanel, or other regions loaded every time on every files in our site
8. If you want Total number of hits of all the files i.e. our entire site ?
Query : SELECT count(auto_increment_id) FROM tablename
this query answers for this question
9. Total number of hits for a particular file i.e. login.php
$current_filename = basename($_SERVER['PHP_SELF']);
Query: SELECT count(auto_increment_id) FROM tablename WHERE filename = '$current_filename';
this query answer for this question
Conclusion:
I hope you got some idea about getting the hit count using PHP..
1. Create table to store the
hit counts into Database.
2. That table having the fields like
(a.) auto_increment_id (Primary Key)
(b.) file_name
(c.) user_ip_address
(d.) date_time_visit
3. Write an INSERT query to insert a record into the Database
Query: INSERT INTO table_name
SET file_name = 'VALUE1',
user_ip_address = 'VALUE2',
date_time_visit = 'VALUE3'
VALUE1 -- basename($_SERVER['PHP_SELF'])
VALUE2 -- $_SERVER['REMOTE_ADDR']
VALUE3 -- date('Y-m-d H:i:s')
4. VALUE1 is used to store for which filename visited by the user
5. VALUE2 is used to store the IP address of the visited user
6. VALUE3 is used to store the visited time of the user
7. Write the INSERT in (STEP 3) on your common areas
i.e. Header or Footer or leftpanel, or other regions loaded every time on every files in our site
8. If you want Total number of hits of all the files i.e. our entire site ?
Query : SELECT count(auto_increment_id) FROM tablename
this query answers for this question
9. Total number of hits for a particular file i.e. login.php
$current_filename = basename($_SERVER['PHP_SELF']);
Query: SELECT count(auto_increment_id) FROM tablename WHERE filename = '$current_filename';
this query answer for this question
Conclusion:
I hope you got some idea about getting the hit count using PHP..
Monday, September 8, 2008
Encrypt vs Decrypt using PHP
md5() - Message Digest Algorithm:
md5 -- Calculate the md5 hash of a string
Calculates the MD5 hash of str using the RSA Data Security, Inc. MD5 Message-Digest Algorithm, and returns that hash. The hash is a 32-character hexadecimal number.
$msg = "Evergreenphp123";
$encrypted_text = md5($msg);
echo "
Plain Text : ";
echo $msg;
echo "
Encrypted Text : ";
echo $encrypted_text;
?>
Note :
Once we encrypted the string using MD5() then we can't able to decrypt, we can again use the encrption of
the given string instead of decryption using below example.
Example :
$str = 'apple';
if (md5($str) === '1f3870be274f6c49b3e31a0c6728957f') {
echo "Valid string";
} else {
echo "Invalid string";
}
?>
Something about MD5:
- MD2 is a cryptographic hash function developed by Ronald Rivest in 1989.
- MD4 is a message digest algorithm (the fourth in a series) designed by Professor Ronald Rivest of MIT in 1990.
- MD4 is also used to compute NT-hash password digests on Microsoft Windows NT, XP and Vista.
- MD4 Weaknesses were demonstrated by Den Boer and Bosselaers in a paper published in 1991.
- MD5 was designed by Ron Rivest in 1991 to replace an earlier hash function, MD4.
Applications of MD5:
1. Encrypting the users password at Registration
2. Administrator itself not able to see the users password
3. Encrypting the users Activation code at the time of Registration
URL Encrypt and Decrypt
urlencode() -- URL-encodes string
urldecode() -- Decodes URL-encoded string
String Encrypt & Decrypt
Encryption
base64_encode -- Encodes data with MIME base64
This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
Example :
/* Encrypt */
$str = 'This is an encoded string';
echo base64_encode($str);
/*
Output :
VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==
*/
?>
Decryption
base64_decode() -- Decodes data encoded with MIME base64
decodes encoded_data and returns the original data or FALSE on failure. The returned data may be binary.
Example :
/* Decrypt */
$str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
echo base64_decode($str);
/*
Output :
This is an encoded string
*/
?>
md5 -- Calculate the md5 hash of a string
Calculates the MD5 hash of str using the RSA Data Security, Inc. MD5 Message-Digest Algorithm, and returns that hash. The hash is a 32-character hexadecimal number.
$msg = "Evergreenphp123";
$encrypted_text = md5($msg);
echo "
Plain Text : ";
echo $msg;
echo "
Encrypted Text : ";
echo $encrypted_text;
?>
Note :
Once we encrypted the string using MD5() then we can't able to decrypt, we can again use the encrption of
the given string instead of decryption using below example.
Example :
$str = 'apple';
if (md5($str) === '1f3870be274f6c49b3e31a0c6728957f') {
echo "Valid string";
} else {
echo "Invalid string";
}
?>
Something about MD5:
- MD2 is a cryptographic hash function developed by Ronald Rivest in 1989.
- MD4 is a message digest algorithm (the fourth in a series) designed by Professor Ronald Rivest of MIT in 1990.
- MD4 is also used to compute NT-hash password digests on Microsoft Windows NT, XP and Vista.
- MD4 Weaknesses were demonstrated by Den Boer and Bosselaers in a paper published in 1991.
- MD5 was designed by Ron Rivest in 1991 to replace an earlier hash function, MD4.
Applications of MD5:
1. Encrypting the users password at Registration
2. Administrator itself not able to see the users password
3. Encrypting the users Activation code at the time of Registration
URL Encrypt and Decrypt
urlencode() -- URL-encodes string
urldecode() -- Decodes URL-encoded string
String Encrypt & Decrypt
Encryption
base64_encode -- Encodes data with MIME base64
This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
Example :
/* Encrypt */
$str = 'This is an encoded string';
echo base64_encode($str);
/*
Output :
VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==
*/
?>
Decryption
base64_decode() -- Decodes data encoded with MIME base64
decodes encoded_data and returns the original data or FALSE on failure. The returned data may be binary.
Example :
/* Decrypt */
$str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
echo base64_decode($str);
/*
Output :
This is an encoded string
*/
?>
Labels:
Encrypt vs Decrypt,
php,
Sample php code
Tuesday, September 2, 2008
Create PDF file using FPDF in php
- Download Script
- Tutorials
- Forum
Example :
require('fpdf.php');
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>
- Demo
- Tutorials
- Forum
Example :
require('fpdf.php');
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>
- Demo
nl2br() in php
What is meant by nl2br()?
- nl2br -- Inserts HTML line breaks before all newlines in a string
- Example :
echo nl2br("foo isn't\n bar");
/*output :
foo isn't
bar
*/
?>
- nl2br -- Inserts HTML line breaks before all newlines in a string
- Example :
echo nl2br("foo isn't\n bar");
/*output :
foo isn't
bar
*/
?>
strstr() and stristr() in php
What is the functionality of the function strstr and stristr?
- strstr -- Find first occurrence of a string
- Example :
$email = 'user@example.com';
$domain = strstr($email, '@');
echo $domain; // prints @example.com
?>
- stristr -- Case-insensitive strstr()
- Example :
$email = 'USER@EXAMPLE.com';
$domain = stristr($email, 'e');
echo $domain;
// outputs ER@EXAMPLE.com
?>
What is meant by nl2br()?
- nl2br -- Inserts HTML line breaks before all newlines in a string
- Example :
echo nl2br("foo isn't\n bar");
/*output :
foo isn't
bar
*/
?>
- strstr -- Find first occurrence of a string
- Example :
$email = 'user@example.com';
$domain = strstr($email, '@');
echo $domain; // prints @example.com
?>
- stristr -- Case-insensitive strstr()
- Example :
$email = 'USER@EXAMPLE.com';
$domain = stristr($email, 'e');
echo $domain;
// outputs ER@EXAMPLE.com
?>
What is meant by nl2br()?
- nl2br -- Inserts HTML line breaks before all newlines in a string
- Example :
echo nl2br("foo isn't\n bar");
/*output :
foo isn't
bar
*/
?>
get image size in php
How can we get the properties (size, type, width, height) of an image using PHP
image functions?
- getimagesize -- Get the size of an image
- Returns an array with 4 elements.
- Index 0 contains the width of the image in pixels.
- Index 1 contains the height.
- Index 2 is a flag indicating the type of the image: 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF, 15 = WBMP, 16 = XBM. These values correspond to the IMAGETYPE constants that were added in PHP 4.3.
- Index 3 is a text string with the correct height="yyy" width="xxx" string that can be used directly in an IMG tag.
- Example:
list($width, $height, $type, $attr) = getimagesize("reset.jpg");
echo "
Width : ".$width;
echo "
Height : ".$height;
echo "
Type : ".$type;
echo "
Attribute : ".$attr;
/* Output :
Width : 53
Height : 22
Type : 2
Attribute : width="53" height="22"
*/
?>
image functions?
- getimagesize -- Get the size of an image
- Returns an array with 4 elements.
- Index 0 contains the width of the image in pixels.
- Index 1 contains the height.
- Index 2 is a flag indicating the type of the image: 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF, 15 = WBMP, 16 = XBM. These values correspond to the IMAGETYPE constants that were added in PHP 4.3.
- Index 3 is a text string with the correct height="yyy" width="xxx" string that can be used directly in an IMG tag.
- Example:
list($width, $height, $type, $attr) = getimagesize("reset.jpg");
echo "
Width : ".$width;
echo "
Height : ".$height;
echo "
Type : ".$type;
echo "
Attribute : ".$attr;
/* Output :
Width : 53
Height : 22
Type : 2
Attribute : width="53" height="22"
*/
?>
Monday, September 1, 2008
Iterative statements (loops concepts) in php
Explain about PHP looping?
Looping statements are used in PHP to execute the code for a developer defined number of times.
PHP has these following looping statements they are
- while() loop,
- do while() loop,
- for() loop and
- foreach() loop
/* Example for while() loop */
echo "Example using while() loop to display 1-4 numbers
";
$i=1;
while($i<5){
echo $i." ";
$i++;
}
echo "
Example using do-while() loop to display 1-4 numbers
";
/* Example for do-while() loop */
$i=1;
do {
echo $i." ";
$i++;
}while($i<5);
echo "
Example using for() loop to display 1-4 numbers
";
/* Example for for() loop */
for($i=1;$i<5;$i++){
echo $i." ";
}
echo "
Example using foreach() loop to display 1-4 numbers
";
/* Example for for() loop */
$a = array(1,2,3,4);
foreach($a as $i){
echo $i." ";
}
?>
Looping statements are used in PHP to execute the code for a developer defined number of times.
PHP has these following looping statements they are
- while() loop,
- do while() loop,
- for() loop and
- foreach() loop
/* Example for while() loop */
echo "Example using while() loop to display 1-4 numbers
";
$i=1;
while($i<5){
echo $i." ";
$i++;
}
echo "
Example using do-while() loop to display 1-4 numbers
";
/* Example for do-while() loop */
$i=1;
do {
echo $i." ";
$i++;
}while($i<5);
echo "
Example using for() loop to display 1-4 numbers
";
/* Example for for() loop */
for($i=1;$i<5;$i++){
echo $i." ";
}
echo "
Example using foreach() loop to display 1-4 numbers
";
/* Example for for() loop */
$a = array(1,2,3,4);
foreach($a as $i){
echo $i." ";
}
?>
Difference between sizeof() and count() in php
- count() -- Count elements in a variable
- syntax for count() [int count ( mixed var [, int mode])]
- If the optional mode parameter is set to COUNT_RECURSIVE (or 1), count() will recursively count the array. This is particularly useful for counting all the elements of a multidimensional array. The default value for mode is 0.
- sizeof() function is an alias of count() function
- Example below:
/* Simple Example */
$a = array(1,2,3,4);
echo "
Example #1";
echo "
Count of A array is :".count($a);
echo "
Size of A array is :".sizeof($a);
echo "
Example #2";
$food = array('fruits' => array('orange', 'banana', 'apple'),
'veggie' => array('carrot', 'collard', 'pea'));
/* recursive count */
/* count($food, COUNT_RECURSIVE) equals to count($food, 1) */
echo "
Count of A array is :".count($food, COUNT_RECURSIVE);
echo "
Size of A array is :".sizeof($food, 1);
/* normal count */
/* count($food, COUNT_RECURSIVE) equals to count($food, 1) */
echo "
Example #3";
echo "
Count of A array is :".count($food, 0);
echo "
Size of A array is :".sizeof($food);
echo "
Conclusion :
The sizeof() function is an alias for count().
";
?>
- syntax for count() [int count ( mixed var [, int mode])]
- If the optional mode parameter is set to COUNT_RECURSIVE (or 1), count() will recursively count the array. This is particularly useful for counting all the elements of a multidimensional array. The default value for mode is 0.
- sizeof() function is an alias of count() function
- Example below:
/* Simple Example */
$a = array(1,2,3,4);
echo "
Example #1";
echo "
Count of A array is :".count($a);
echo "
Size of A array is :".sizeof($a);
echo "
Example #2";
$food = array('fruits' => array('orange', 'banana', 'apple'),
'veggie' => array('carrot', 'collard', 'pea'));
/* recursive count */
/* count($food, COUNT_RECURSIVE) equals to count($food, 1) */
echo "
Count of A array is :".count($food, COUNT_RECURSIVE);
echo "
Size of A array is :".sizeof($food, 1);
/* normal count */
/* count($food, COUNT_RECURSIVE) equals to count($food, 1) */
echo "
Example #3";
echo "
Count of A array is :".count($food, 0);
echo "
Size of A array is :".sizeof($food);
echo "
Conclusion :
The sizeof() function is an alias for count().
";
?>
Thursday, August 28, 2008
Remove files from a folder dynamically using PHP
/* Your file path to remove the files */
$path_file = "/www/htdocs/evergreenphp/samplefile";
$execept_file = "imageshuffle.xml";
/* Caling function : Removing the files */
Remove_unwanted($path_file, $execept_file);
/* Function Definition : Remove unwanted files */
function Remove_unwanted($path, $execept_file){
$path_dir = opendir($path);
while (($files = readdir($path_dir)) !== false) {
$check_file = explode(".", $files);
/*
Here Deletion based on
1. File type is a XML
2. File name not equal to $execept_file
*/
if (($check_file[1] == "xml") && ($files != $execept_file))
{
@unlink($path."/".$files);
}
}
}
?>
Code for collect all image files from a folder dynamically using PHP
/* Your file path to getting all the image */
$path_file = "/www/htdocs/evergreenphp/shuffleimages";
$image_array = Collect_images($path_file);
if (is_array($image_array)){
/* Proceed your image related work.. */
} else {
echo "No image on the Path";
}
/* Collect all the images dynamically from a Folder */
function Collect_images($path){
$image_list = "";
$image_array = array();
$path_dir = opendir($path);
while (($files = readdir($path_dir)) !== false) {
$check_file = explode(".", $files);
if (strlen($check_file[1]) > 2)
$image_array[] = $files;
}
if (count($image_array) > 0) {
return $image_array;
} else {
return 0;
}
}
?>
Monday, August 25, 2008
Extracting text from Word Documents via PHP and COM
$word = new COM("word.application") or die ("Could not initialise MS Word object.");
$word->Documents->Open(realpath("Sample.doc"));
// Extract content.
$content = (string) $word->ActiveDocument->Content;
echo $content;
$word->ActiveDocument->Close(false);
$word->Quit();
$word = null;
unset($word);
$word->Documents->Open(realpath("Sample.doc"));
// Extract content.
$content = (string) $word->ActiveDocument->Content;
echo $content;
$word->ActiveDocument->Close(false);
$word->Quit();
$word = null;
unset($word);
Monday, August 11, 2008
File uploading and send into email using PHP
/*
Program : File Uploading and Mail Sending Process
*/
/*
1. Initially upload the file into "mail_upload" folder
2. So, we must changed the folder permission of "mail_upload" into 777 (write permission)
3. Sending mail with the File Attachment
Note : Change the Below listed variable values.. for your SETTINGS resp.
Line No: 31 ( $whereto )
Line No: 63 ( $mailto )
Line No: 64 ( $from_mail )
Line No: 65 ( $from_name )
Line No: 66 ( $replyto )
Line No: 67 ( $subject )
Line No: 68 ( $message )
*/
$error = ""; // Set a variable that will be used for errors
if(isset($_POST['upload']) && $_POST['upload'] == 'Send into Mail') // Form is submitted
{
$whereto = "/home2/nasc/dev/ingrams/mail_upload"; // Gets post value from select menu
$whatfile = $_FILES['uploadedfile']['name']; // Gets file value from file upload input
if(empty($whereto)) // Checks to see if $whereto is empty, if so echo error
$error = "You need to choose a directory.
";
if($whatfile == NULL) // Checks to see if file input field is empty, if so throw an error
$error .= "You need to choose a file.";
if(!empty($whereto) && $whatfile != NULL) //if no errors so far then continue uploading
{
$target_path = "$whereto/"; // The directory the file will be placed
/* Add the original filename to our target path. Result is "uploads/filename.extension" */
$target_path = $target_path . basename($whatfile);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path))
{
echo "
Uploaded Success : ".basename($whatfile);
$file_name = basename($whatfile);
$file_path = $whereto."/";
mail_attachment ($file_name, $file_path);
}
else /* if there was a problem then throw an error */
$error .= "There was an error uploading the file, please try again!";
}
}
function mail_attachment($filename, $path) {
global $error;
$mailto = "mano_ilayans@yahoo.com";
$from_mail = "manoilayans@gmail.com";
$from_name = "Manokaran";
$replyto = "manoilayans@gmail.com";
$subject = "File Uploading and Mailing Process";
$message = "Message of File Uploading and Mailing Process";
$file = $path.$filename;
$file_size = filesize($file);
$handle = fopen($file, "r");
$content = fread($handle, $file_size);
fclose($handle);
$content = chunk_split(base64_encode($content));
$uid = md5(uniqid(time()));
$name = basename($file);
$header = "From: ".$from_name." <".$from_mail.">\r\n";
$header .= "Reply-To: ".$replyto."\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $message."\r\n\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use diff. tyoes here
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
$header .= $content."\r\n\r\n";
$header .= "--".$uid."--";
if (mail($mailto, $subject, "", $header)) {
echo "
2. Mail send ...
OK
"; // or use booleans here
} else {
$error .= "
Mail send ...
ERROR!";
}
}
?>
Program : File Uploading and Mail Sending Process
*/
/*
1. Initially upload the file into "mail_upload" folder
2. So, we must changed the folder permission of "mail_upload" into 777 (write permission)
3. Sending mail with the File Attachment
Note : Change the Below listed variable values.. for your SETTINGS resp.
Line No: 31 ( $whereto )
Line No: 63 ( $mailto )
Line No: 64 ( $from_mail )
Line No: 65 ( $from_name )
Line No: 66 ( $replyto )
Line No: 67 ( $subject )
Line No: 68 ( $message )
*/
$error = ""; // Set a variable that will be used for errors
if(isset($_POST['upload']) && $_POST['upload'] == 'Send into Mail') // Form is submitted
{
$whereto = "/home2/nasc/dev/ingrams/mail_upload"; // Gets post value from select menu
$whatfile = $_FILES['uploadedfile']['name']; // Gets file value from file upload input
if(empty($whereto)) // Checks to see if $whereto is empty, if so echo error
$error = "You need to choose a directory.
";
if($whatfile == NULL) // Checks to see if file input field is empty, if so throw an error
$error .= "You need to choose a file.";
if(!empty($whereto) && $whatfile != NULL) //if no errors so far then continue uploading
{
$target_path = "$whereto/"; // The directory the file will be placed
/* Add the original filename to our target path. Result is "uploads/filename.extension" */
$target_path = $target_path . basename($whatfile);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path))
{
echo "
Uploaded Success : ".basename($whatfile);
$file_name = basename($whatfile);
$file_path = $whereto."/";
mail_attachment ($file_name, $file_path);
}
else /* if there was a problem then throw an error */
$error .= "There was an error uploading the file, please try again!";
}
}
function mail_attachment($filename, $path) {
global $error;
$mailto = "mano_ilayans@yahoo.com";
$from_mail = "manoilayans@gmail.com";
$from_name = "Manokaran";
$replyto = "manoilayans@gmail.com";
$subject = "File Uploading and Mailing Process";
$message = "Message of File Uploading and Mailing Process";
$file = $path.$filename;
$file_size = filesize($file);
$handle = fopen($file, "r");
$content = fread($handle, $file_size);
fclose($handle);
$content = chunk_split(base64_encode($content));
$uid = md5(uniqid(time()));
$name = basename($file);
$header = "From: ".$from_name." <".$from_mail.">\r\n";
$header .= "Reply-To: ".$replyto."\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $message."\r\n\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use diff. tyoes here
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
$header .= $content."\r\n\r\n";
$header .= "--".$uid."--";
if (mail($mailto, $subject, "", $header)) {
echo "
2. Mail send ...
OK
"; // or use booleans here
} else {
$error .= "
Mail send ...
ERROR!";
}
}
?>

Saturday, August 9, 2008
Export CSV (Excel) format of Data from PHP
require('database_connectivity.php');
Header('Content-type: application/csv');
Header("Content-disposition: attachment; filename=\"Competitions-".date('mdy-Hi').".csv\"");
//Fetching the Question for "exam_question" table
$sql_exam_question = "SELECT user.user_name, user.user_email, user.user_qno, user.optionid, optn.option_text,
user.user_date, ques.ques_text, ques.ques_prize_text
FROM competition_user AS user, exam_question AS ques, competition_options AS optn
WHERE user.user_qno = ques.question_id AND user.user_qno = optn.competition_qno
AND user.optionid = optn.optionid ";
$qry_exam_question = mysql_query($sql_exam_question) or die();
$column_limiter = ",";
$row_limiter = "\n";
//Heading
echo "Name,Email,Question No.,Answer,Question,Prize,Date\n";
while( $fetch_data = mysql_fetch_object($qry_exam_question) ) {
echo $fetch_data->user_name; echo $column_limiter;
echo $fetch_data->user_email; echo $column_limiter;
echo $fetch_data->user_qno; echo $column_limiter;
echo $fetch_data->option_text; echo $column_limiter;
echo $fetch_data->ques_text; echo $column_limiter;
echo $fetch_data->ques_prize_text; echo $column_limiter;
echo $fetch_data->user_date; echo $column_limiter;
echo $row_limiter;
}
?>
Header('Content-type: application/csv');
Header("Content-disposition: attachment; filename=\"Competitions-".date('mdy-Hi').".csv\"");
//Fetching the Question for "exam_question" table
$sql_exam_question = "SELECT user.user_name, user.user_email, user.user_qno, user.optionid, optn.option_text,
user.user_date, ques.ques_text, ques.ques_prize_text
FROM competition_user AS user, exam_question AS ques, competition_options AS optn
WHERE user.user_qno = ques.question_id AND user.user_qno = optn.competition_qno
AND user.optionid = optn.optionid ";
$qry_exam_question = mysql_query($sql_exam_question) or die();
$column_limiter = ",";
$row_limiter = "\n";
//Heading
echo "Name,Email,Question No.,Answer,Question,Prize,Date\n";
while( $fetch_data = mysql_fetch_object($qry_exam_question) ) {
echo $fetch_data->user_name; echo $column_limiter;
echo $fetch_data->user_email; echo $column_limiter;
echo $fetch_data->user_qno; echo $column_limiter;
echo $fetch_data->option_text; echo $column_limiter;
echo $fetch_data->ques_text; echo $column_limiter;
echo $fetch_data->ques_prize_text; echo $column_limiter;
echo $fetch_data->user_date; echo $column_limiter;
echo $row_limiter;
}
?>
Split Long Line in PHP
//Split the Long line
function Long_PadString($String, $max_chars = 12){
$Exploded = explode(" ", $String);
$Max_Parts = count($Exploded);
$CurArray = 0;
$OutString = '';
while($CurArray<=$Max_Parts)
{
$Peice_Size = strlen($Exploded[$CurArray]);
if($Peice_Size>15)
{
$OutString .= chunk_split($Exploded[$CurArray], $max_chars, " ");
$CurArray++;
} else {
$OutString .= " ".$Exploded[$CurArray];
$CurArray++;
}
}
return $OutString;
}
/* Example for Long_PadString */
$text = "dfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsf";
echo Long_PadString($text, 20);
function Long_PadString($String, $max_chars = 12){
$Exploded = explode(" ", $String);
$Max_Parts = count($Exploded);
$CurArray = 0;
$OutString = '';
while($CurArray<=$Max_Parts)
{
$Peice_Size = strlen($Exploded[$CurArray]);
if($Peice_Size>15)
{
$OutString .= chunk_split($Exploded[$CurArray], $max_chars, " ");
$CurArray++;
} else {
$OutString .= " ".$Exploded[$CurArray];
$CurArray++;
}
}
return $OutString;
}
/* Example for Long_PadString */
$text = "dfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsfdfsdfsdfdsf";
echo Long_PadString($text, 20);
Date Difference between two Dates in PHP
/* Date Difference between 2 Dates using PHP program */
$jd1 = gregoriantojd(date('m'), date('d'), date('Y'));
echo $jd1;
$jd2 = gregoriantojd(7, 27, date('Y'));
echo $jd2;
$date_diff = $jd1 - $jd2;
if ($date_diff < 0)
$date_diff *= -1; // abs
$gregorian = jdtogregorian($date_diff);
echo $date_diff;
?>
$jd1 = gregoriantojd(date('m'), date('d'), date('Y'));
echo $jd1;
$jd2 = gregoriantojd(7, 27, date('Y'));
echo $jd2;
$date_diff = $jd1 - $jd2;
if ($date_diff < 0)
$date_diff *= -1; // abs
$gregorian = jdtogregorian($date_diff);
echo $date_diff;
?>
Subscribe to:
Posts (Atom)
Popular Posts
-
1. How old PHP language is? - PHP began in 1994, so 14 years old. 2. What are different names of PHP? - PHP originally stood for Persona...
-
HTML: a. HTML is a markup language that is used to build static (non interactive and nonanimated) webpages. b. HTML is Case-Insensitive. So...
-
A payment gateway is an e-commerce application service provider service that authorizes payments for e-businesses, online retailers, bricks...
-
Note : This is not a perfect sort order, we have just displaying the list of PHP companies. 1. Photon Infotech No. 2/102, Arvind IT Park (N...
-
Hai all, Simple show hide sample using Show/Hide? Simple Show/Hide code
-
- count() -- Count elements in a variable - syntax for count() [int count ( mixed var [, int mode])] - If the optional mode parameter is set...
-
Sharing PHP, MySQL, Javascript, CSS Knowledge, We can share our PHP knowledge on the basis of PHP versioning, Javascript, AJAX, Stylesheet, ...
-
Use the below code and you can get the exact value in php as us saw in browser. Code: $encode_data = iconv('UTF-8', 'windows-125...
-
Download and Enjoy!
-
1. Rasmus Lerdorf Rasmus Lerdorf (born November 22, 1968 in Qeqertarsuaq, Greenland) is a Danish-Greenlandic programmer and is most notable ...