Jump to content

if (substring exists) not working..


Perad

Recommended Posts

For some reason the if statement keeps coming up as true. This is even if "Call+Out+Fee+for+" isn't in the string being tested.

 

Could someone help me correct this please

 

if (preg_match("Call+Out+Fee+for+", $req)) {
	preg_match('/item_name1[^&]+/', $req, $out);
		$vowels = array("item_name1=", "Call+Out+Fee+for+", "%3A00", "%23");
		$a = str_replace($vowels, "", $out[0]);
		$b = str_replace("%23", "*", $a);
		$c = str_replace("+on+", "*", $b);
		$d = str_replace("+", "*", $c);
		$pieces = explode("*", $d);
	preg_match('/payer_email[^&]+/', $req, $out2);
		$a = str_replace("payer_email=", "", $out2[0]);
		$email = str_replace("%40", "@", $a);
	include 'RCMConnect.php';
	echo $sql;
	$sql = "UPDATE bookings SET confirm='1' WHERE bookingtime='".$pieces[1]."' AND bookingdate='".$pieces[2]."' AND conf='".$pieces[0]."'";
	$result = mysql_query($sql);
} else {
	preg_match('/item_name1[^&]+/', $req, $out);
	$a = str_replace("+for+", "*", $out[0]);
	$b = str_replace("+", " ", $a);
	$pieces = explode("*", $b);
	include 'RCMConnect.php';
	$sql = "UPDATE bookings SET confirm='1' WHERE user='".$pieces[1]."' AND type='".$pieces[0]."'";
	$result = mysql_query($sql);		
}

Link to comment
https://forums.phpfreaks.com/topic/69752-if-substring-exists-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.