Youtube Linklerini Veritabanına Post ediyorum.. örneğin bu şekilde form alanına kopyalayıp gönderiyorum..
https://www.youtube.com/watch?v=_Ny89Wp7bGQAma Dün Tesadüfen Youtube linkinden id yi ayırabilen bir javascript alert kodu..
çok enteresan deil ama belki sizin için aklıma linki yapıştırıp sadece idesini post edebileceğim fikri geldi... bu mümkünmü acaba..
Buldugum kod...
<script type="text/javascript">
function youtube_parser(url){
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
var match = url.match(regExp);
if (match&&match[7].length==11){
var b=match[7];
alert(b);
}else{
alert("Url incorrecta");
}
}
</script>
<script type="text/javascript">
document.write(youtube_parser("http://youtu.be/0zM3nApSvMg"));
</script>buda benim post ettiğim form un kodları...
<form action="" method="post">
<table class="table">
<tr>
<td>Youtube Video <font color="#FF0000" size="2"></font></td>
<td><input type="text" name="video" class="form-control" ></td>
</tr>
<tr>
<td></td>
<td><input class="btn btn-primary" type="submit" value="Ekle"></td>
</tr>
</table>
</form>
<?php
if ($_POST) {
$video = $_POST['video'];
if ($video<>"") {
if ($baglanti->query("INSERT INTO linkler (video) VALUES ('$video')"))
{
echo "<meta http-equiv=\"refresh\" content=\"1;URL=index.php?Grup=1".$_REQUEST['1']."\"> ";
echo "<div class='alert alert-success'><p>Mesajınız başarıyla gönderildi</p></div>";
}
else
{
echo "<div class='alert alert-danger'><p>Bir Hata Var</p></div>";
}
}
}
?>bu kodu buraya entegre etmek mümkünmü acaba.. kolay ise düzenleyebilirmisiniz bana.. çözemedim bir türlü..Youtube linkini tüm yapıştırıcam form alanına.. ama veritabanına sadece id yi post edecek...