.swf file downloading in php

Discussion in 'PHP' started by padma525, Jun 3, 2008.

Thread Status:
Not open for further replies.
  1. padma525

    padma525 New Member

    Joined:
    Jun 3, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    i am new to this forum.

    i have developed a page in that some radio buttons are there associcated with the values as .swf file names. if i clicked one radio button that corresponding swf file is going to be downloaded.and at the same time a mail will also go to the admin. :worried:


    for that i have devloped the code as shown below.


    HTML code:
    -------------------
    HTML:
    <form name="form" method="post" action="optionpage1.php">
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td align="left" valign="top">&nbsp;</td>
    <tr>
     <tr>
    <td align="left" valign="top" class="text">Check the box of the video  you would like to watch and get instant access on the very next page!</td>
                      </tr>
    				   <tr>
                        <td align="left" valign="top">&nbsp;</td>
                      </tr>
                      <tr>
                        <td align="left" valign="top">
                          <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                            <tr>
                              <td align="left" valign="top" style="width:30px; height:25px;"><input type="radio" name="download" value="direct_mail_campaigns_recorded" id="download1" /></td>
                              <td align="left" valign="top" class="text">Dominant Direct Mail  Campaigns (take over the entire subdivision)</td>
                            </tr>
                            <tr>
                              <td align="left" valign="top" style="height:25px;"><input type="radio" name="download" value="Getting the Edge at Listing Appointments FLASH" id="download2"/></td>
                              <td align="left" valign="top" class="text">Getting the Edge at Listing  Appointments</td>
                            </tr>
                            <tr>
                              <td align="left" valign="top" style="height:25px;"><input type="radio" name="download" value="Price Reductions FLASH" id="download3" /></td>
                              <td align="left" valign="top" class="text">Techniques for getting  Price Reductions (get your listings sold!)</td>
                            </tr>
                            <tr>
                              <td align="left" valign="top" style="height:25px;"><input type="radio" name="download" value="USP'S FLASH" id="download4"/></td>
                              <td align="left" valign="top" class="text">Unique Selling Propositions  (build a 100ft wall from your competition)</td>
                            </tr>
                            <tr>
                              <td align="left" valign="top" style="height:25px;"><input type="radio" name="download" value="Divorce  Estate Attorneys FLASH" id="download5"/></td>
                              <td align="left" valign="top" class="text">Getting Divorce and Estate  Attorneys to hand you highly motivated prospects</td>
                            </tr>
                          </table>
                                           </td>
                      </tr>
                      <tr>
                        <td align="left" valign="top" style="height:10px;"></td>
                      </tr>
                      <tr>
                        <td align="left" valign="top">					</td>
                      </tr>
                      <tr>
                        <td>
                          <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                            <tr>
                              <td align="right" valign="top" class="mailtxt" style="width:200px; height:25px;">Enter Your First   Name :</td>
                              <td align="left" valign="top" style="padding-left:5px;"><input name="name" type="text" class="text2" size="25" /></td>
                            </tr>
                            <tr>
                              <td align="right" valign="top" class="mailtxt" style="width:200px; height:25px;">Type In Your E-mail Address : </td>
                              <td align="left" valign="top" style="padding-left:5px;"><input name="email" type="text" class="text2" size="25" />      </td>
                            </tr>
                          </table>
                        				</td>
                      </tr>
                      <tr>
                        <td align="left" valign="top" style="height:10px;"></td>
                      </tr>
                      <tr>
                        <td align="center" valign="middle"><table width="0" border="0" align="center" cellpadding="2" cellspacing="0">
                          <tr>
                            <td bgcolor="#9f0000"><input name="Button" type="submit" class="h2" value="Claim Your FREE Videos Now!"/></td>
                          </tr>
                        </table></td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                      </tr>
                    </table>
    				
    </form>
    

    php code:
    ---------------

    PHP:
    <?php
    //print_r($_POST);exit;
    $download=$_POST['download'];
    $name=$_POST['name'];
    $email=$_POST['email'];
    //echo $download;
    //echo $email;
    if(($download!='')&&($email!=''))
    {
                     
          
    $file $download;
           
    header("Content-type: application/swf");
           
    header("Content-Disposition: attachment; filename=".$file);
          
    readfile($file);

                     
         
    $subject="Download video files details from Scott Jackson Real Estate Marketing";
                        
    $message="Dear  Admin, <br><br> I have downloaded &nbsp;&nbsp;'$download'&nbsp;&nbsp; \t\t  file."
                      
                     
    $message=$message."<br><br>Regards<br>$name";
                     
                            
                     
    $headers="MIME-Version: 1.0"."\r\n";
                     
    $headers.="From:$email\r\n";
                     
    $headers.="Content-type: text/html "."\r\n";
                     
                     
    $to="aaa@yahoo.com"
                     
    mail($to,$subject,$message,$headers);
                     
        }
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,376
    Likes Received:
    388
    Trophy Points:
    83
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice