how can i put this 2 codec together?

Discussion in 'Programming' started by nevret2, Sep 24, 2007.

  1. #1
    hello, i have a php code and its linking to a download link which was added:
    1
    
    <?php
      $id = $_GET['id'];
      $query = mysql_query("SELECT link FROM links WHERE rand = '$id'");
      $link = mysql_result($query,"link");
      echo "<a href='".$link."' target='_blank'>Download</a>";
      echo '<meta http-equiv="refresh" content="500;url='.$link.'">';
      ?>
    Code (markup):

    now i want, when people click on download , the download link will be opened in a popup, but in this popup it will say again: download, if they click on it, then must be relinked to the link


    i have created a popup.html with the next content:
    2

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <script type="text/javascript">
    function DisplayURL(url)
    {
        document.getElementById('url').innerHTML = url;
    }
    
    function OpenURL(url)
    {
        parent.OpenURL(url);
    }
    </script>
    </head>
    
    <body>
    <p>download</p>
    <p><div id='url'></div></p>
    </body>
    </html>
    Code (markup):

    now i want if they click on download, there must come first a popup, so i have the next code:
    3
    
    <SCRIPT LANGUAGE='JAVASCRIPT' TYPE='TEXT/JAVASCRIPT'>
     <!--
    var win=null;
    function NewWindow(mypage,myname,w,h,pos,infocus){
    if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
    if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
    else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
    settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";win=window.open(mypage,myname,settings);
    win.focus();}
    
    
    // -->
    
    function ShowPopup(url)
    {
        w = window.open('popup.html','Download','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=520,height=580,left = 252,top = 184');
        w.onload = function()
        {
            url = "<a href='"+url+"' onclick=\"OpenURL('"+url+"');return false;\">Download From Rapidshare Source!</a>";
            w.DisplayURL(url);
        }
    }
    
    function OpenURL(url)
    {
        location.href=url;
    }
    
    </script><head>
    <meta http-equiv="Content-Language" content="tr">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
    <title>{@SITE_NAME}</title>
    <style type="text/css">
    <!--
    .style6 {color: {@ACTUAL_URL}}
    -->
    </style>
    </head>
    
    <body>
    
    <p align="center">&nbsp;</p>
    <p align="center">&nbsp;</p>
    <p align="center" class="style6"><a href="{@ACTUAL_URL}" onClick="ShowPopup('{@ACTUAL_URL}');return false;">Downloads</a></p>
    <p align="center" class="style6"><a href="javascript:NewWindow('{@ACTUAL_URL}','popup','550','290','center','front');"></a></p>
    <p align="center" class="style6">&nbsp;</p>
    Code (markup):

    now i want to put the code from 1 in 3, but how can i do that?

    in code 3, its linking to @ACTUAL_URL , this mst be changed with the code in 1, but i dont understand, can someone please help me

    thnx,
     
    nevret2, Sep 24, 2007 IP