How to combine these following two scripts as a single script?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bala Kumaran
    New Member
    • Jan 2013
    • 30

    How to combine these following two scripts as a single script?

    Hi experts..

    How can I combining the following two different scripts as a single script?

    Code:
    <?php
    $file = 'loading.gif';
    
    if (file_exists($file)) {
        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename='.basename($file));
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Cache-Control: must-revalidate');
        header('Pragma: public');
        header('Content-Length: ' . filesize($file));
        ob_clean();
        flush();
        readfile($file);
        exit;
    }
    ?>

    The anotherone script is

    Code:
    <?PHP
    require_once("./include/membersite_config.php");
    
    if(isset($_POST['submitted']))
    {
       if($fgmembersite->RegisterUser())
       {
            $fgmembersite->RedirectToURL("thank-you.html");
       }
    }
    
    ?>
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Copy and paste one into the other.

    Comment

    • Bala Kumaran
      New Member
      • Jan 2013
      • 30

      #3
      I've got an error while I copied pasted one into the another like this

      Parse error: syntax error, unexpected T_VARIABLE in /home/a70187881/public_html/downloads/download.php on line 12

      I've tried like this

      Code:
      <?php
      
      require_once("./include/membersite_config.php");
      
      if(!$fgmembersite->CheckLogin())
      {
          $fgmembersite->RedirectToURL("login.php");
          exit;
      }
      
      $file = 'loading.gif';
      
      if (file_exists($file)) {
          header('Content-Description: File Transfer');
          header('Content-Type: application/octet-stream');
          header('Content-Disposition: attachment; filename='.basename($file));
          header('Content-Transfer-Encoding: binary');
          header('Expires: 0');
          header('Cache-Control: must-revalidate');
          header('Pragma: public');
          header('Content-Length: ' . filesize($file));
          ob_clean();
          flush();
          readfile($file);
          exit;
      }
      ?>

      And I've also tried like this

      Code:
      <?PHP
      require_once("./include/membersite_config.php");
      
      if(!$fgmembersite->CheckLogin())
      {
          $fgmembersite->RedirectToURL("login.php");
          exit;
      }
      
      ?>
      
      <?php
      $file = 'loading.gif';
      
      if (file_exists($file)) {
          header('Content-Description: File Transfer');
          header('Content-Type: application/octet-stream');
          header('Content-Disposition: attachment; filename='.basename($file));
          header('Content-Transfer-Encoding: binary');
          header('Expires: 0');
          header('Cache-Control: must-revalidate');
          header('Pragma: public');
          header('Content-Length: ' . filesize($file));
          ob_clean();
          flush();
          readfile($file);
          exit;
      }
      ?>

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        There's no variable on line 12 of either code you posted.

        Comment

        • Bala Kumaran
          New Member
          • Jan 2013
          • 30

          #5
          I can't understand.. please help me to know the working code..

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            I can't either because you posted information that is confusing. There is nothing on line 12 to create that error in either example codes you posted. This means that either you gave me the wrong line number, the wrong error message, or the wrong code. I can't help you if you give me incorrect information.

            Comment

            Working...