<? include ("../settings.php"); ?>
<? include ("session.php"); ?>
<?

	function url_get_contents ($Url) {
		if (!function_exists('curl_init')){ 
			die('CURL is not installed!');
		}
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $Url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		$output = curl_exec($ch);
		curl_close($ch);
		return $output;
	}


    if (isset($_REQUEST['registrant_id']) && $_REQUEST['registrant_id']>0){

        $bind = array (":search1"=>$_REQUEST['registrant_id']);
        $results = $db->select("tbl_registrant","registrant_id=:search1",$bind);
        $deresult =$results[0];
        
		if ($deresult['registrant_dinner_attend']==1)
			$extra1 = "Dinner";
		else
			$extra1 = "";
        if ($deresult['registrant_salutation']=="Prof" || $deresult['registrant_salutation']=="A/Prof" || $deresult['registrant_salutation']=="Dr")
			$fullname = $deresult['registrant_salutation']." ".$deresult['registrant_fullname'];        
        else
        	$fullname = $deresult['registrant_fullname'];
        $var = "user_name=sp&user_password=spspsp&name=".urlencode($fullname)."&sn=".urlencode($deresult['registrant_sn'])."&company=".urlencode($deresult['registrant_organisation'])."&extra1=".urlencode($deresult['remarks'])."&extra2=N.A.&printer=".urlencode($_SESSION['user_printer'])."&event=NANOMAN2024";

               
        //echo $var;
        $contents = url_get_contents('https://www.events-sp.com/PRINT/insert.php?'.$var);    
        
        echo "1";
    }


?>