<?php
include_once("../../corebot/_config_.php");
include_once("../../corebot/errorHandler.php");
$conf = new config();

class getError extends logCoreErrorHandler
{
	public function returnError()
	{
		return new getError();
	}
}

class scp_conn
{


		public function iconf(){
			$conf = new config();
			return $conf->_conni();
		}
}

	function spc_rplc($id)
	{
		$string = trim($id);
		$patterns = "/\s/";
		$replacements = "-";

		return preg_replace($patterns, $replacements, $string);
	}
		
$err = new getError();
//$conf = new config();
$cof = new scp_conn();
if(isset($_GET['content']) && $_GET['content'] != ''){
	$str = strtolower($_GET['content']);
	if(strlen($str) > 1)
	{
		$sel = mysqli_query($cof->iconf(), "SELECT _stor_nam, _str_mgzs FROM copn_storbnk WHERE _stor_nam like '".trim($str)."%'		
		") or die(mysqli_error($cof->iconf()));
		if(mysqli_num_rows($sel))
		{
			echo "<table border =\"0\" width=\"100%\">\n";
			if(mysqli_num_rows($sel))
			{
				echo "<script language=\"javascript\">box('1');</script>";
			
				while($row = mysqli_fetch_array($sel, MYSQLI_ASSOC))
				{
					//$country = str_ireplace($str,"<b>".$str."</b>",($row['_stor_nam']));
					$country = str_ireplace($str,$str,($row['_stor_nam']));
					//$country_scnd = str_ireplace($str,"<b>".$str."</b>",($row[1]));
					
				//	echo "<tr id=\"word".$row['_stor_nam']."\" onmouseover=\"highlight(1,'".$row['_stor_nam']."');\" onmouseout=\"highlight(0,'".$row['_stor_nam']."');\" onClick=\"display('".$row['_stor_nam']."');\" >\n
				//<td>".$country."</td>\n</tr>\n";
				echo "<div class='col-12 bg-none mt-2' style='border-bottom: 1px solid #939397; text-decoration: none;'>";
				echo "<a href='/coupons/".spc_rplc($country)."' style='color:#010101; text-decoration: none;' class='p-4' >".ucfirst($country)."</a></br>";
				echo "</div>";
				} 
			$err->logHandler("( QS[".$country."]: IP: '".$_SERVER['REMOTE_ADDR']."' on ".date("d-m-Y")." ".date("H:i:s",time())." )::","../../mudradm_pcxnl/___scrh.php");
			}
			
			echo "</table>";
		}
	}
	else
	{
		echo "<script language=\"javascript\">box('0');</script>";
		echo "Please Enter 2 Words";
	}
}else{
echo "<p style='font-size: 16px;'>Error: Try Again</p>";
}
//	UNION
//	SELECT rght_cnme, cm_pnabvr FROM cmpn_ytru_alist WHERE rght_cnme LIKE '".trim($str)."%' OR cm_pnabvr like '".trim($str)."%'
?>
