<?php



$REQUEST_URI = $_SERVER['REQUEST_URI'];
$REQUEST_URI = str_replace('/plugins/r/', '', $REQUEST_URI);
$REQUEST_URI = explode('/', $REQUEST_URI);
$iCnt = 0;
$oReq = [];
foreach ($REQUEST_URI as $sVar) {
    $sVar = trim($sVar);
    $iCnt++;
    $sVar = rawurldecode($sVar);
    $sVar = rawurlencode($sVar);
    $oReq['req' . $iCnt] = $sVar;
}



switch ($oReq['req1']) {
    case '320x100':
    echo '<html> <head> <title>Smartbee.az</title> </head> <body><script async src="//code.ainsyndication.com/v2/js/slot.js"></script> <ins class="ainsyndication" style="display:block; width: 320px; height: 100px;" data-ad-slot="'.$oReq['req2'].'" data-dimension="320x100"></ins></body> </html>';
    break;
    case '468x60':
    echo '<html> <head> <title>Smartbee.az</title> </head> <body><script async src="//code.ainsyndication.com/v2/js/slot.js"></script> <ins class="ainsyndication" style="display:block; width: 468px; height: 60px;" data-ad-slot="'.$oReq['req2'].'" data-dimension="468x60"></ins></body> </html>';
    break;
    
    
    case 'share':
    $webUrl = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST']."?v=".$oReq['req2']."&share_user_id=".$oReq['req3'];
?>
	<style>
		body {margin:0; padding:0; font-family: Arial, Tahoma, sans-serif;}
		.embedbox {
			display: flex;
			flex-direction: column;
			justify-content: space-around;
			align-items: center;
			width: 100%;
			height: 100%;
			padding: 0;
			background-image: linear-gradient(to bottom, rgba(0,0,0,0.77), rgba(0,0,0,0.75));
			color: white;
		}
		.e-form {width: 500px; max-width: 100%;}
		.e-form .e-form-a {padding:10px; }
		.e-row {margin-bottom:20px;}
		.e-row label {display:block; font-size:15px; line-height:20px; margin-bottom:5px;}
		.e-input {position:relative;}
		.e-input input {display: block; width: 100%; border: 2px solid #f04b23; border-radius: 4px; font-size: 16px; line-height: 24px; padding: 5px 10px; outline: 0;}
		.e-input .e-button {color: #fff; background-color: #f04b23; position: absolute; right: 0; top: 0; bottom: 0; border-radius: 0 3px 3px 0; font-size: 16px; line-height: 22px; padding: 8px 12px; cursor: pointer; user-select:none;}
	</style>
	<script>
		function copyembed() {
		  var copyText = document.getElementById("embed");

		  copyText.select();
		  copyText.setSelectionRange(0, 99999); /* For mobile devices */

		  document.execCommand("copy");
		}
		
		function copylink() {
		  var copyText = document.getElementById("link");

		  copyText.select();
		  copyText.setSelectionRange(0, 99999); /* For mobile devices */

		  document.execCommand("copy");
		}
	</script>
	<div class="embedbox">
		<div class="e-form">
			<div class="e-form-a">
				<div class="e-row">
					<label>Embed kodu:</label>
					<div class="e-input">
						<input type="text" id="embed"  value="<iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;<?=$webUrl?>&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen></iframe>">
						<div class="e-button" onclick="copyembed()">KOPYALA</div>
					</div>
				</div>
				<div class="e-row">
					<label>Birbaşa link:</label>
					<div class="e-input">
						<input type="text" class="form-control" id="link" value="<?=$webUrl?>">
						<div class="e-button" onclick="copylink()">KOPYALA</div>
					</div>
				</div>
			</div>
		</div>
	</div>
<?php
    break;
}




?>