Urlencode issues with ambersand
I cannot get ambersand to get escaped with urlencode
I have the callerid superfecta running.
Customer name has '&' in it. "E&E Engine Machine" by the time the url only the 'E' before the '&' survives as the customer's name.
Here is my popup link declaration.
http://192.168.1.200/callerid/selacct5.php?phone=#{CLIDNUM}&cname=#{CLIDNAME}&exten=AUTO
and the PHP@ that url
<?php
/***************************************************************************
** Php code to insert mysql popup data for gambas to continue
** with building the bridge from freepbx/Fop2 to ASSET SCULPTOR applications
** mainly launching and creating order entry transactions.
** JRM, Halloween 2021
****************************************************************************/
$phone= substr($_GET['phone'],-10);
$cname=urldecode($_GET['cname']);
echo $cname;
echo "<BR>";
$exten=$_GET['exten'];
$cusname="CallerID is ".$phone." ".$cname;
echo "";
echo $cusname;
echo "";
$_cname = str_replace(',', ' ', $cname);
$username = "?????";
$password = "???????";
$database = "?????";
$mysqli = new mysqli("localhost", $username, $password, $database);
/*******************************************************************
** first lets see how many accts tied to the phone number
** query customer to get the acct# where the phone number is
** in the main record cus_acct, then select distinct cus_acct from
** customer where cus_commID=cus_acct
********************************************************************/
$num_accts='0';
$cus_acct='None';
$cus_commID='None';
$query = "select cus_acct from customer where cus_phone='".$phone."'";
echo "$query";
if ($result = $mysqli->query($query)){
$num_accts = mysqli_num_rows($result);
}
echo $num_accts;
while ($row = $result->fetch_assoc()) {
$cus_acct = $row["cus_acct"];
$cus_commID= $row["cus_commID"];
}
echo "deebugcommID=".$cus_commID;
// Now how many Accounts
echo $num_accts;
$query = "insert into cidDelivery (acct,accts,exten,phone_num,cname) values ('".$cus_acct."','".$num_accts."','".$exten."','".$phone."','".$_cname."')";
echo $query;
$result=$mysqli->query($query);
echo "DONE";
?>
Comments
Hi,
I am about to release version 2.31.31 with a fix for that bug. Check the donwload page in the following hours, the command to upgrade your FOP2 installation is:
wget -O - http://download.fop2.com/upgrade_fop2.sh | bash