All pastes #946855 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-03-18 00:09 UTC
rendered paste body
Main Zip Sync Code: file = sync2zip.php

<?php
   define('TITLE1', 'MyOps System - Invoice');
   define('TITLE2', 'Company Selection Screen');
   define('USE_DB', 'workorders');
   $droot = $_SERVER['DOCUMENT_ROOT'];
   $nroot = $_SERVER['PHP_SELF'];
   $scslh = strpos($nroot,'/',1);
   $froot = $droot.substr($nroot,0,$scslh).'/functions/';
   require($froot.'db_connect.php');
   require($froot.'functions.php');
   unset($fld1,$fld2,$fld3,$fld4,$fld5,$fld6,$fil_stat,$frm_stat);
   $fld1 = ($HTTP_POST_VARS['src']);
   $fld2 = ($HTTP_POST_VARS['dir']);
   $fld3 = ($HTTP_POST_VARS['fil']);
   $fld4 = ($HTTP_POST_VARS['zip']);
   $fld5 = ($HTTP_POST_VARS['tof']);
   $fld6 = ($HTTP_POST_VARS['frm']);

echo "1=> $fld1 2=> $fld2 3=> $fld3 4=> $fld4 5=> $fld5 6=> $fld6 <br>";
   foreach($HTTP_POST_VARS as $key => $val) {
echo "K=> $key V=> $val <br>";
      if ($val != "") {
         $proc_tag = trim($key);
      }
   }
   if ($fld3=='on') {
echo "Found File! <br>";
      $typ_str = "<input type=checkbox name=dir ".
                 "onclick=\"document.forms['s2z'].submit();\">Directory</input>".
                 "&nbsp;&nbsp;".
                 "<input type=checkbox checked name=dir ".
                 "onclick=\"document.forms['s2z'].submit();\">File</input>";
   } else {
echo "Found Dir! <br>";
      $typ_str = "<input type=checkbox checked name=dir ".
                 "onclick=\"document.forms['s2z'].submit();\">Directory</input>".
                 "&nbsp;&nbsp;".
                 "<input type=checkbox name=dir ".
                 "onclick=\"document.forms['s2z'].submit();\">File</input>";
   }
   if ($HTTP_POST_VARS['frm']) {
echo "Found From! <br>";
      $tofchk = "";
      $frmchk = "on";
   } else {
echo "Found To! <br>";
      $tofchk = "on";
      $frmchk = "";
   }
   switch ($proc_tag) {
      case "1":
         $dis_var = load_page('inv/inv-det.php');
         break;
      case "2":
         $dis_var = load_page('misc/add-cmp.php');
         break;
      case "3":
         $dis_var = load_page('inv/test3.php');
         break;
      default:
         $dis_var = include('sync_zip.php');
   }   // end swithch ($proc_tag)
?>

<html>
<head>
<title>MyOps System - Invoice</title>
</head>

<BODY BGCOLOR="#ffFFdd">
   <FORM name="s2z" METHOD="POST" ACTION="<?php $_SERVER['PHP_SELF']; ?>">
   <?php
      echo $dis_var;
   ?>
   </FORM>
</BODY>
</HTML>


Screen Zip Sync Code: file = sync_zip.php

<html>
<table width=60% border=2 align=center bgcolor=#555555>
   <tr>
   <td>
      <table width=100% border=0 align=center bgcolor=#55bbff>
         <tr>
         <td colspan=6>&nbsp;</td>
         </tr>

         <tr>
         <td align=center colspan=6><h1>Sync To Zip File</h1></td>
         </tr>

         <tr>
         <td colspan=6>&nbsp;</td>
         </tr>

         <tr>
         <td width=25% align=right><b>Type:</b></td>
         <td align=left>
             <select name=typ>
                <option>Diretory</option>
                <option>File</option>
             </select>
         </td>
         <td width=25% align=right><b>Direction:</b></td>
         <td align=left>
             <select name=dir>
                <option>To</option>
                <option>From</option>
             </select>
         </td>
         <td width=100>&nbsp;</td>
         <td width=100>&nbsp;</td>
         </tr>

         <tr>
         <td width=25% align=right><b>Source:</b></td>
         <td width=75% align=left colspan=5>
             <input type=file size=50 name=src>
         </td>
         </tr>

         <tr>
         <td colspan=6>&nbsp;</td>
         </tr>

         <tr>
         <td align=right><b>Zip File:</b></td>
         <td align=left colspan=5>
             <input type=file size=50 name=zip>
         </td>
         </tr>

         <tr>
         <td colspan=6>&nbsp;</td>
         </tr>

         <tr>
         <td align=center colspan=6>
             <input type=submit name=proc value="Process Synch">
         </td>
         </tr>

         <tr>
         <td colspan=6>&nbsp;</td>
         </tr>
      </table>
   </td>
   </tr>
</table>
</html>

Function load_page from functions.php  First Method

  function load_page($mypfile) {
     $buffer = "";
     if (file_exists($mypfile)) {
        $hand = @fopen($mypfile, "r");
        if ($hand) {
           while (!feof($hand)) {
              $buffer .= fgets($hand, 4096);
           }  // end while
           fclose($hand);
        }     // end if $hand
        return $buffer;
     }        // end if file_exists
  }           // end function

Function load_page from functions.php  Second Method

  function load_page($mypfile) {
     if (file_exists($mypfile)) {
        ob_start();
        include $mypfile;
        $contents = ob_get_contents();
        ob_end_clean();
        return $contents;
     }        // end if file_exists
  }           // end function