NooTheme Premium WordPress Theme › Forums › Jobica › Can you please help us to insert this below php in the specified page?
- This topic has 1 reply, 2 voices, and was last updated 4 years, 10 months ago by Anonymous.
-
AuthorPosts
-
4 years, 10 months ago #1083453
Dear SupportIndeed
Can you help me inserting the following Php Script into the listener page in my website: ethiosomjobs.com/listener/
The php script is:
<?php
$req = "cmd=notify-validate";foreach($_POST as $key => $value)
{
$value = urlencode(stripslashes($value));
$req.= "&$key=$value";
}$url = 'http://sandbox.flocash.com/validateNotify.do';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
$res = curl_exec($ch);if (curl_errno($ch))
{
$log_mess.= "CONN-ERROR:" . curl_error($ch) . "\n";
$fp_file = fopen('flocash.txt', 'a');
fwrite($fp_file, $log_mess);
fclose($fp_file);
exit();
}
else
{
curl_close($ch);
$log.= "\n"."Got-data : " . $req . "\n";
$log.= "Data: ".$res."\n";
$fp = fopen('log.txt', 'a');
fwrite($fp, "$log");
if (strcmp($res, "VERIFIED") == 0)
{
$merchant = $_POST['merchant'];
$trans_id = $_POST['trans_id'];
$fpn_id = $_POST['fpn_id'];
$order_id = $_POST['order_id'];
$customer = $_POST['payer_email'];
$sender_acct = $_POST['sender_acct'];
$item_name = $_POST['item_name'];
$item_price = $_POST['item_price'];
$quantity = $_POST['quantity'];
$amount = $_POST['amount'];
$currency_code = $_POST['currency_code'];
$status = $_POST['status'];
$status_msg = $_POST['status_msg'];
if (!($merchant == '[email protected]'))
{
$log.= "Log: Invalid merchant email. " . $message . "\n";
fwrite($fp, "$log");
fclose($fp);
exit();
}
if (!(strcmp($status, "0000") == 0))
{
fwrite($fp, "Log: Payment not successful"."\n");
fclose($fp);
exit();
}
$con = mysql_connect("localhost", "myfastco_renu", "flocash@123");
if (!$con)
{
fwrite($fp, "FailedtoconnecttoMySQL:".mysql_error());
fclose($fp);
}
else
{
if(mysql_select_db("myfastco_flocash_renu"))
{
$query = "INSERT INTO notify_trans(trans_id, fpn_id, sender_acct, order_id, item_name, item_price, currency_code, quantity, amount,customer, status, status_msg) values('$trans_id', '$fpn_id', '$sender_acct', '$order_id', '$item_name', '$item_price', '$currency_code', '$quantity', '$amount', '$customer', '$status', '$status_msg')";
$result = mysql_query($query);
if($result)
{
if(mysql_insert_id())
{
fwrite($fp, "\n"."inserted successfully");
fclose($fp);}
else
{
fwrite($fp, "\n".$query."\n".mysql_error());
fclose($fp);
}
}
}
mysql_close();
}
}
}
fclose($fp);
?>4 years, 10 months ago #1083511
AnonymousInactiveTopics: 0
Posts: 155Hi,
You cannot insert this code into a listener page, as it will affect all other pages.
Regards.
-
AuthorPosts
You must be logged in and have valid license to reply to this topic.