Archive for June, 2012

author

<?php
include ‘header.php’;
global $prefix;
$contact_firstname =$_GET[‘contact_firstname’];
$contact_lastname  =$_GET[‘contact_lastname’];
$user_price =$_POST[‘user_price’];
$user_expr  =$_POST[‘user_expr’];
//$id = base64_decode($_GET[‘user_email’]);
//$id = mysql_real_escape_string($id);
$id = base64_decode($_GET[‘user_email’]);
$kid =base64_encode(“$id|$user_expr”);
echo ” <div class=\”divct3\”>”;
//echo “<h1>Contact Form Submitted!</h1><br>”;
echo “<h1>Waiting…..</h1><br>”;

//echo “<span>We will be in touch soon.</span>”;

// This sample code requires the mhash library for PHP versions older than
// 5.1.2 – http://hmhash.sourceforge.net/

// the parameters for the payment can be configured here
// the API Login ID and Transaction Key must be replaced with valid values
$loginID        = “8a94AyWrDH7”;
$transactionKey = “2vkd94Fv54y43LK8”;
$amount         = “$user_price”;
$description     = “Transaction”;
$label             = “Submit Payment”; // The is the label on the ‘submit’ button
$testMode        = “false”;
//$testMode        = “true”;
// By default, this sample code is designed to post to our test server for
// developer accounts: https://test.authorize.net/gateway/transact.dll
// for real accounts (even in test mode), please make sure that you are
// posting to: https://secure.authorize.net/gateway/transact.dll
//$url            = “https://test.authorize.net/gateway/transact.dll&#8221;;
$url            = “https://secure.authorize.net/gateway/transact.dll&#8221;;

// If an amount or description were posted to this page, the defaults are overidden
if ($_REQUEST[“amount”])
{ $amount = $_REQUEST[“amount”]; }
if ($_REQUEST[“description”])
{ $description = $_REQUEST[“description”]; }

// an invoice is generated using the date and time
$invoice    = date(YmdHis);
// a sequence number is randomly generated
$sequence    = rand(1, 1000);
//$ID =”CUSID_”.$sequence;
// a timestamp is generated
$timeStamp    = time ();

// The following lines generate the SIM fingerprint.  PHP versions 5.1.2 and
// newer have the necessary hmac function built in.  For older versions, it
// will try to use the mhash library.
if( phpversion() >= ‘5.1.2’ )
{    $fingerprint = hash_hmac(“md5”, $loginID . “^” . $sequence . “^” . $timeStamp . “^” . $amount . “^”, $transactionKey); }
else
{ $fingerprint = bin2hex(mhash(MHASH_MD5, $loginID . “^” . $sequence . “^” . $timeStamp . “^” . $amount . “^”, $transactionKey)); }

// Create the HTML form containing necessary SIM post values
echo “<FORM method=’post’ name=’PayCharge’    action=’$url’ >\n”;
// Additional fields can be added here as outlined in the SIM integration guide
// at: http://developer.authorize.net
echo ”    <INPUT type=’hidden’ name=’x_login’ value=’$loginID’ />”.”\n”;
echo ”    <INPUT type=’hidden’ name=’x_amount’ value=’$amount’ />”.”\n”;
echo ”    <INPUT type=’hidden’ name=’x_description’ value=’$description’ />”.”\n”;
echo ”    <INPUT type=’hidden’ name=’x_invoice_num’ value=’$invoice’ />”.”\n”;
echo ”    <INPUT type=’hidden’ name=’x_fp_sequence’ value=’$sequence’ />”.”\n”;
echo ”    <INPUT type=’hidden’ name=’x_fp_timestamp’ value=’$timeStamp’ />”.”\n”;
echo ”    <INPUT type=’hidden’ name=’x_fp_hash’ value=’$fingerprint’ />”.”\n”;
echo ”    <INPUT type=’hidden’ name=’x_test_request’ value=’$testMode’ />”.”\n”;
echo ”    <INPUT type=’hidden’ name=’x_show_form’ value=’PAYMENT_FORM’ />”.”\n”;
echo ”  <input type=’hidden’ NAME=’x_cust_id’ VALUE=’$sequence’>”;
echo ”  <input type=’hidden’ NAME=’x_invoice_num’ VALUE=’$sequence’ >”;

echo ”  <input type=’hidden’ NAME=’x_email’ VALUE=’$id’ >”;

echo ”    <INPUT type=’hidden’ name=’x_receipt_link_method’ value=’LINK’ />”.”\n”;
echo ”    <INPUT type=’hidden’ name=’x_receipt_link_text’ value=’Click Here To Finish Your Payment’ />”.”\n”;
echo ”    <INPUT type=’hidden’ name=’x_receipt_link_url’ value=’http://www.controlmyfuturetoday.com/thankyou2.php?id=&#8221;.$kid.”‘ />”.”\n”;

echo”<input type=’hidden’  name=’x_first_name’ id=’x_first_name’ value=’$contact_firstname’/>”;
echo”<input type=’hidden’  name=’x_last_name’ id=’x_last_name’  value=’$contact_lastname’/>”;
echo”<input type=’hidden’  name=’x_country’ id=’x_country’ value=’US’ />”;

echo “</FORM>”;
echo”  <script language=\”javascript\”>
document.PayCharge.submit();
</script>”;

echo “</div>”;

include ‘footer.php’;

Cut word from content

function JCutWord($text,$num=20)
{
//  $text = eregi_replace(” +”, ” “,$text);
$text = preg_replace(“/ +/i”, ” “,$text);
$a=explode(” “, $text);

$count = count($a);
if($num > $count)
return $text;

$l=0;
for($i=0;$i<$num;$i++)
{
$l+=strlen($a[$i])+1;

}
return substr($text,0,$l).’…’;
// return substr($text,0,$l);
}

Cut html from content

function JNoHTML($str, $strip=””)
{
global $datafold;

/* The core of this code has been lifted from phpslash */

/* which is licenced under the GPL. */

if ($strip == “nohtml”)

$AllowableHTML=array(”);

$str = stripslashes($str);

//  $str = eregi_replace(“<[[:space:]]*([^>]*)[[:space:]]*>”,'<\\1>’, $str);
$str = preg_replace(“/<[[:space:]]*([^>]*)[[:space:]]*>/i”,'<\\1>’, $str);

// Delete all spaces from html tags .

//  $str = eregi_replace(“<a[^>]*href[[:space:]]*=[[:space:]]*\”?[[:space:]]*([^\” >]*)[[:space:]]*\”?[^>]*>”,'<a href=”\\1″>’, $str);
$str = preg_replace(“/<a[^>]*href[[:space:]]*=[[:space:]]*\”?[[:space:]]*([^\” >]*)[[:space:]]*\”?[^>]*>/i”,'<a href=”\\1″>’, $str);
// Delete all attribs from Anchor, except an href, double quoted.

//  $str = eregi_replace(“<[[:space:]]* img[[:space:]]*([^>]*)[[:space:]]*>”, ”, $str);
$str = preg_replace(“/<[[:space:]]* img[[:space:]]*([^>]*)[[:space:]]*>/i”, ”, $str);

// Delete all img tags

// $str = eregi_replace(“<a[^>]*href[[:space:]]*=[[:space:]]*\”?javascript[[:punct:]]*\”?[^>]*>”, ”, $str);
$str = preg_replace(“/<a[^>]*href[[:space:]]*=[[:space:]]*\”?javascript[[:punct:]]*\”?[^>]*>/i”, ”, $str);

// Delete javascript code from a href tags — Zhen-Xjell @ http://nukecops.com

$tmp = “”;

// repaire this line here
while (@ereg(“<(/?[[:alpha:]]*)[[:space:]]*([^>]*)>”,$str,$reg)) {
//  while (preg_match(“/<(/?[[:alpha:]]*)[[:space:]]*([^>]*)>/”,$str,$reg)) {
$i = strpos($str,$reg[0]);

$l = strlen($reg[0]);

if ($reg[1][0] == “/”) $tag = strtolower(substr($reg[1],1));

else $tag = strtolower($reg[1]);

if ($a = $AllowableHTML[$tag])

if ($reg[1][0] == “/”) $tag = “<$tag>”;

elseif (($a == 1) || ($reg[2] == “”)) $tag = “<$tag>”;

else {

# Place here the double quote fix function.

$attrb_list=delQuotes($reg[2]);

// A VER

$attrb_list = ereg_replace(“&”,”&amp;”,$attrb_list);

$tag = “<$tag” . $attrb_list . “>”;

} # Attribs in tag allowed

else $tag = “”;

$tmp .= substr($str,0,$i) . $tag;

$str = substr($str,$i+$l);

}

$str = $tmp . $str;

return $str;

exit;

/* Squash PHP tags unconditionally */

$str = ereg_replace(“<\?”,””,$str);

return $str;
}

clone send mail phpmailer

           $mail = new PHPMailer();
$mail->SetFrom(‘khanhnam99@gmail.com’, ‘khanhnam99’);
$mail->Subject = ‘test mail’;
$mail->AltBody = “To view the message, please use an HTML compatible email viewer”; // optional, comment out and test

while ($row = mysql_fetch_array ($result)) {
$mail2 = clone $mail;
$mail2->MsgHTML(‘content test mail’);
$mail2->AddAddress($row[“email”], $row[“firstname”]);
$mail2->send();
}

Pay Paypal

<body onload=”document.forms.PayCharge.submit();”>
<form name=”PayCharge” method=”post” action=”https://www.paypal.com/cgi-bin/webscr&#8221; id=”PayCharge”>
<input type=”hidden” name=”cmd” value=”_xclick”>
<input type=”hidden” name=”business” value=”Email saler”>
<input type=”hidden” name=”upload” value=”1″>
<input type=”hidden” name=”return” value=”http://www.tranglinktrave.com/thanks.php?id=$s”&gt;
<input type=”hidden” name=”amount” value=”100.00″>
<input type=”hidden” name=”tax” value=”0″>
<input type=”hidden” name=”shipping” value=”0″>
<input type=”hidden” name=”item_name” value=”Order From: http://www.pennyauctionsoftware.com”&gt;
<input type=”hidden” name=”first_name” value=”Fist Name”>
<input type=”hidden” name=”last_name” value=”Last Nam”>
<input type=”hidden” name=”address1″ id=”address1″ value=”Address”>
<input type=”hidden” name=”city” value=”Grand Rapids”>
<input type=”hidden” name=”state” value=”State”>
<input type=”hidden” name=”zip” value=”Zipcode”>
<input type=”hidden” name=”country” value=”Country”>
<input type=”hidden” name=”email” value=”Email buyer’s”>
<input type=”hidden” name=”charset” value=”utf-8″>
<input type=”hidden” name=”rm” value=”2″>
<input type=”hidden” name=”cbt” value=”TO COMPLETE YOUR PURCHASE, PLEASE CLICK HERE”>
</form>
<script type=”text/javascript” language=”javascript”>
document.PayCharge.submit();
</script>;