Receiving the following postback (Gateway makes only a single postback, cannot validate the data sent)-- I am trying to tighten the security on postback page.
A) the mysql_real_escape_string -- how might this go, please note the password is alphanumeric:
😎 would it really help to create a class to 'clean' the $_GET
B.1) Is this effective against an attack? Would you create a seperate class file and apply it how here?
$userid = $GET['userid'];
$plan_type = $GET['type'];
$trans_id = $GET['transactionid'];
$trans_status = $GET['transactionstatus'];
$trans_date = $_GET['tansactiondate'];
//2nd - check ip address against 605.42.56.*/35
$ip = $_SERVER['REMOTE_ADDR'];
if ($ip=='605.42.56.*/35') {
$send_email = "admin@mysite.com";
$Server = "aaaa.aaaa.com"; //Server
$DName = "any_any12"; //Database
$Username = "bbbbbbb"; //Username
$Password = "ccccc"; //Password
//make connection
$Connect = @mysql_connect($Server, $Username, $Password)
or die("Couldn't connect to MySQL<br>" . mysql_error() . "<br>" . mysql_errno());
//select database
$Db = @mysql_select_db($DName, $Connect)
or die("Couldn't select database<br>" . mysql_error(). "<br>" . mysql_errno());
if ($trans_status == "approved"){ $firstQuery = "insert into Paymenttable(fk_UserID,TransactionPlan_type,Transaction_id,Transaction_status, Transaction_date)values('".$userid."','".$transplan_type ."','".$trans_id','".$trans_status."','".$trans_date."')";
$result = mysql_query($firstQuery) or die("Default - Paymenttable, not successful:<br>" . mysql_error() . "<br>" . mysql_errno());
mail($send_email, "VERIFIED", "$firstQuery");
}
}