Posted on March 24, 2009 by Ramesh Javale
to use external smtp server we need to change some ini setting .
this setting can be chage using following code
ini_set(sendmail_from,”info@domain.com”);
ini_set(SMTP,”New smto host name”);
ini_set(smtp_port,”25″);
using rhis code you can send mail fro the given smtp mail server
Filed under: Php | Tagged: external smtp server, mail, smtp | 1 Comment »
Posted on March 18, 2009 by Ramesh Javale
Use this query
“select * from table_name order by rand() limit 1 “
Filed under: Php, mysql | Tagged: mysql, Php, random query | Leave a Comment »
Posted on December 2, 2008 by Ramesh Javale
//——-curl
$source_file=”example.php”;
$fp = fopen($source_file, “r”);
$url = “ftp://username:password@target_server_url:21 file_path /file_name”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_FTPASCII, 1);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($source_file));
$result = curl_exec($ch);
curl_close($ch);
//———
Filed under: Php | Tagged: copy file, curl ftp, transfer file | 1 Comment »
Posted on November 25, 2008 by Ramesh Javale
<?php
require_once(“conf.php”); // youe database connection file
$result = mysql_query( “SHOW TABLE STATUS” );
$dbsize = 0;
while( $row = mysql_fetch_array( $result ) ) {
$dbsize += $row[ "Data_length" ] + $row[ "Index_length" ];
}
?>
<?php
echo “<p>The size of the database is ” . formatfilesize( $dbsize ) . “</p>”;
?>
Filed under: Php | Tagged: databse size, get database size, mysql, Php | Leave a Comment »
Posted on September 17, 2008 by Ramesh Javale
$url = “http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=Paris%20Hilton”
// sendRequest
// note how referer is set manually
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, “http://www.yousite.com”);
$body = curl_exec($ch);
curl_close($ch);
// following function json_decode is ready avaialable in php 5 >
$json = json_decode($body);
Filed under: Php | Tagged: custom search code, google search, php search | Leave a Comment »
Posted on September 17, 2008 by Ramesh Javale
For some good reasons some server hide php errors , still you want to display it for debugging purpose then use following simple two lines of code in a page where you want to display error
error_reporting(E_ALL);
ini_set(“display_errors”,”1″);
Filed under: Php | Tagged: error report, ini_set, show error | Leave a Comment »
Posted on January 8, 2008 by Ramesh Javale
To avoid the cross side scripting or make site safe from hacker attacks one need to perform data validation before allowed data insertion into database . We can achieve this using php preg_match which check data format to see whether it is in valid state or not. The following code snippet is standard validation example
function [...]
Filed under: Php | Tagged: hackersafe, Php, preg_match | Leave a Comment »
Posted on July 13, 2007 by Ramesh Javale
To avoid the cross side scripting or make site safe from hacker attacks one need to perform data validation before allowed data insertion into database . We can achieve this using php preg_match which check data format to see whether it is in valid state or not. The following code [...]
Filed under: Php | Tagged: php hack, preg match, regular expression, validation | Leave a Comment »
Posted on June 14, 2007 by Ramesh Javale
Hi Guys ,
This is my test blog . To see how it looks .
Filed under: Javascript, Php | Leave a Comment »