dsjklb0205 2015-10-28 16:07
浏览 26

Javascript + PHP,总是下载相同的

I have a problem with downloading my files from the website.

When i load my page, i cant download the file and its the correct one. (http://example.com/file.php?id=111) but when i refresh the youtube embed, it shows my next video (works with mysql) and when i click again on the download button it still downloads the previous file. And not the next file.

Code Snipets:

BLANK.PHP (is the page where my player is)

<script>
function ajax_request(){
    $("#video_frame").load("<?php echo $actual_link; ?>");
}
</script>
<?php $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>   
<div id="video_frame" class="video">
    <?php include('video.php'); ?>
</div>

VIDEO.PHP

<script>
$('#download_ajax').click(function(e) {
    e.preventDefault();  //stop the browser from following
     window.open('http://example.com/fetch/?videofile=http://www.example.com/watch?v=<?php echo $urlid; ?>','_blank');
});
</script>
<?php
//MYSQL CONNECTION
    if($_GET['p'] == 'house') {
        $hitsq = $mysqli->query("SELECT urlid FROM `***` ORDER BY RAND() LIMIT 1");
        $hits = $hitsq->fetch_assoc();
        $urlid = $hits['urlid'];
    } else if ($_GET['p'] == 'drumandbass') {
        $hitsq = $mysqli->query("SELECT urlid FROM `***` ORDER BY RAND() LIMIT 0,6");
        $hits = $hitsq->fetch_assoc();
        $urlid = $hits['urlid'];
    } else if ($_GET['p'] == 'hiphop') {
        $hitsq = $mysqli->query("SELECT urlid FROM `***` ORDER BY RAND() LIMIT 0,6");
        $hits = $hitsq->fetch_assoc();
        $urlid = $hits['urlid'];
    } else if ($_GET['p'] == 'futurehouse') {
        $hitsq = $mysqli->query("SELECT urlid FROM `****` ORDER BY RAND() LIMIT 0,6");
        $hits = $hitsq->fetch_assoc();
        $urlid = $hits['urlid'];
    } else if ($_GET['p'] == 'rock') {
        $hitsq = $mysqli->query("SELECT urlid FROM `****` ORDER BY RAND() LIMIT 0,6");
        $hits = $hitsq->fetch_assoc();
        $urlid = $hits['urlid'];
    }
?>    
<div class="video">
    <iframe name="Right" frameborder="0" height="100%" width="100%" src="https://example.com/embed/<?php echo $urlid ?>?rel=0&autoplay=1&controls=0&showinfo=0&autohide=1">
</iframe>
</div>

Site Snippet Preview

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于大棚监测的pcb板设计
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥15 帮我写一个c++工程