Friday, July 29, 2011

Paypal website integration for Buy Now button


<?php

if(isset($_REQUEST['verify_sign'])){
$paysig=$_REQUEST['verify_sign'];
}
else{
$paysig=$_REQUEST['sig'];
}


if($_SESSION[paypalsig]!=$paysig){

if(isset($_REQUEST['receiver_email'])){
echo $custombid=$_REQUEST['custom'];
echo $business=$_REQUEST['business'];
echo $username=$_REQUEST['item_name'];
echo $pid=$_REQUEST['item_number'];
echo $amount=$_REQUEST['mc_gross'];
echo $paypalemail=$_REQUEST['receiver_email'];
}
else{
echo $pid=$_REQUEST['item_number'];
echo $custombid=$_REQUEST['cm'];
echo $amount=$_REQUEST['amt'];
echo $paypalstatus=$_REQUEST['st'];
echo $paysign=$_REQUEST['sig'];
}

}


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<FORM action="https://www.sandbox.paypal.com/cgi-bin/webscr" method=post name=frm>

<!--Paypal hidden value Start-->                                  
 <INPUT type=hidden value=_xclick name=cmd>
 <INPUT type=hidden value="yourmailid@gmail.com" name=business>
 <INPUT type=hidden value="itemname" name=item_name>
 <INPUT type=hidden value="2345" name=item_number>
 <INPUT type=hidden value=http://www.topcone.com/paypaltest.php name=return>
 <INPUT type=hidden value=1 name=no_note>
 <INPUT type=hidden value=USD name=currency_code>
 <INPUT type=hidden value=http://www.topcone.com/paypaltest.php name=notify_url>
 <INPUT type=hidden value=http://www.topcone.com/paypaltest.php name=cancel_return>
 <input type="hidden" value="1" name="quantity" />
 <input type="hidden" value="itemname" name=custom />
 <input type="hidden" value="20.00" name="amount" />
<input type="image" src="https://www.sandbox.paypal.com/en_GB/i/btn/btn_buynowCC_LG.gif" alt="payment" border="0"/>
</form>
</body>
</html>

Ms Access mdb test file using php


<?php
#
# This is some wired example.
# You cannot use it out of the box.
#
# Use your own mdb filename and
# your own tablename and
# your own fieldnames.
#
# You really need a Windows Server and a mdb file on it to have it work!
# Big chance it does not work with Linux or Unix - but tell me if it does.
#
# This example opens the mdb once and then reads it twice.
# I know about 2 ways to get the values, so I show them all.
# Maybe there is a speed difference.
#
# Works on a Win 2000 server with PHP 4.3.4 and Microsoft-IIS/5.0
#

include 'class_mdb.php';

$mdb = new mdb('eveready.mdb'); // your own mdb filename required
$mdb->execute('select * from MACHINE2'); // your own table in the mdb file

#
# first example: using fieldnames
#

while( !$mdb->eof() )
{
  echo $mdb->fieldvalue('DATE1'); // using your own fields name
  echo ' = ';
  echo $mdb->fieldvalue( 1 ); // using the fields fieldnumber
  echo '<br>';
  $mdb->movenext();
}

echo '<br><hr><br>';

#
# Going back to the first recordset for the second example
#
$mdb->movefirst();

#
# This works, too: Make each Field an object. The values change
# when the data pointer advances with movenext().
#
$url = $mdb->RS->Fields(1);
$bez = $mdb->RS->Fields(2);
$kat = $mdb->RS->Fields(3);

while( !$mdb->eof() )
{
  # works!
  echo $bez->value;
  echo ' = ';
  echo $url->value;
  echo '<br>';
  $mdb->movenext();
}

$mdb->close();

?>

Ms Access Mdb class file


<?php

class mdb
{
  var $RS = 0;
  var $ADODB = 0;
 
  var $RecordsAffected;
 
  var $strProvider = 'Provider=Microsoft.Jet.OLEDB.4.0';
  var $strMode     = 'Mode=ReadWrite';
  var $strPSI      = 'Persist Security Info=False';
  var $strDataSource  = '';
  var $strConn     = '';
  var $strRealPath = '';
 
  var $recordcount = 0;
  var $ok = false;
 
 
  /**
  * Constructor needs path to .mdb file
  *
  * @param string $dsn = path to *.mdb file
  * @return boolean success
  */
  function mdb( $dsn='Please enter DataSource!' )
  {
    $this->strRealPath = realpath( $dsn );
    if( strlen( $this->strRealPath ) > 0 )
    {
      $this->strDataSource = 'Data Source='.$this->strRealPath;
      $result = true;
    }
    else
    {
      echo "<br>mdb::mdb() File not found $dsn<br>";
      $result = false;
    }
   
    $this->RecordsAffected = new VARIANT();
   
    $this->open();
   
  } // eof constructor mdb()
 
 
  function open( )
  {
    if( strlen( $this->strRealPath ) > 0 )
    {
 
      $this->strConn =
        $this->strProvider.';'.
        $this->strDataSource.';'.
        $this->strMode.';'.
        $this->strPSI;
       
      $this->ADODB = new COM( 'ADODB.Connection' );
     
      if( $this->ADODB )
      {
        $this->ADODB->open( $this->strConn );
       
        $result = true;
      }
      else
      {
        echo '<br>mdb::open() ERROR with ADODB.Connection<br>'.$this->strConn;
        $result = false;
      }
    }
   
    $this->ok = $result;
   
    return $result;
  } // eof open()
 
 
  /**
  * Execute SQL-Statement
  * @param string $strSQL = sql statement
  * @param boolean $getrecordcount = true when a record count is wanted
  */
  function execute( $strSQL, $getrecordcount = false )
  {

    $this->RS = $this->ADODB->execute( $strSQL, &$this->RecordsAffected );
   
    if( $getrecordcount == true )
    {

      $this->RS->MoveFirst();
      $this->recordcount = 0;
     
      # brute force loop
      while( $this->RS->EOF == false )
      {
        $this->recordcount++;
        $this->RS->MoveNext();
      }
      $this->RS->MoveFirst();

    }
   
       
  } // eof execute()
 
  function eof()
  {
    return $this->RS->EOF;
  } // eof eof()
 
  function movenext( )
  {
    $this->RS->MoveNext();
  } // eof movenext()
 
  function movefirst()
  {
    $this->RS->MoveFirst();
  } // eof movefirst()
 
  function close()
  {
 
    @$this->RS->Close(); // Generates a warning when without "@"
    $this->RS=null;
 
    @$this->ADODB->Close();
    $this->ADODB=null;
  } // eof close()
 
  function fieldvalue( $fieldname )
  {
    return $this->RS->Fields[$fieldname]->value;
  } // eof fieldvalue()
 
  function fieldname( $fieldnumber )
  {
    return $this->RS->Fields[$fieldnumber]->name;
  } // eof fieldname()
 
  function fieldcount( )
  {
    return $this->RS->Fields->Count;
  } // eof fieldcount()
 
} // eoc mdb
?>

Thursday, July 28, 2011

PHP MS access Connect using ADODB OR ADO Connection

http://phplens.com/lens/adodb/docs-adodb.htm

http://www.geekinterview.com/talk/8645-connecting-to-ms-access-with-php.html

include("adodb.inc.php"); 
$db = newadoconnection('access'); 
$db->connect("localhost", "root", "password", "my_access_db"); 



(OR)



$db =& ADONewConnection('access');

         $dsn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=d:\\northwind.mdb;Uid=Admin;Pwd=;";
         $db->Connect($dsn);



(OR)


http://www.phpclasses.org/browse/package/1700.html?download=targz

Wednesday, July 27, 2011

Rounded Corner for all browsers

http://jonraasch.com/blog/css-rounded-corners-in-all-browsers

For Others

.rounded-corners {
     -moz-border-radius: 20px;
    -webkit-border-radius: 20px;
    -khtml-border-radius: 20px;
    border-radius: 20px;
}

For IE

.rounded-corners {
    behavior: url(/css/border-radius.htc);
    border-radius: 20px;
}


IE supported file
http://code.google.com/p/curved-corner/downloads/detail?name=border-radius-demo.zip&can=2&q=

Thursday, July 21, 2011

Link Master --> Word Press home page only


<?php if(is_home() && $post==$posts[0] && !is_paged()) { ?>
     PLACE ADVERTISEMENT HERE.
<?php } ?>



<?php query_posts('cat=3&showposts=1'); ?>
<?php while (have_posts()) : the_post(); ?>
<h1>Featured Topic</h1>
<Strong><?php the_title(); ?></strong>
<p><?php the_content_limit(500,""); ?></p>
<a href="<?php the_permalink() ?>">Click to learn more</a>
<?php endwhile;?>

Wednesday, July 6, 2011

Joomla front page conditions

<?php $menu = &JSite::getMenu(); ?>
<?php if ($menu->getActive() == $menu->getDefault()) { ?>
<p>this will show on main</p>
<?php } else { ?>
</>This will show on all other pages</p>
<?php } ?>