佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 715|回复: 3

PHP coding 有些不明白。。请教。。

[复制链接]
发表于 25-9-2007 08:29 PM | 显示全部楼层 |阅读模式
请个位大大请教小弟。。 有关以下的 php coding, 小弟还是新手。。
蓝色的部份小弟有些不明。。。

<html>
<head>
<!-- external css file -->
<link href="./wsbs.css" type="text/css" rel="stylesheet" />
<?php
include 'dbheader.php';
?>
<style type=text/css>
.body
{
font-family:verdana;
font-size:9pt;
}
</style>
</head>
<body class=body>
<?php
// Where the file is going to be placed
$target_path = "input\\";
$attachment_location = $target_path;
//$question_id = $_REQUEST['question_id'];
$currDate = time();
$now = date('YmdHis',$currDate);
$seq_no = $now;
$attachment_name = $_FILES['uploadedfile']['name'];
$attachment_type = 'D';
$attachment_size = $_FILES['uploadedfile']['size'];
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$bStatus = 0;
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
  echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
  $bStatus = 1;
} else{
  echo "There was an error uploading the file to $target_path, please try again!";
  print_r($_FILES);
}
// create an record in attachment table
if($bStatus == 1)
{
            // process payment file
            $fh = fopen($target_path, "r";
            while(!feof($fh))
            {
               $lines = fgets($fh, 2048);
               //echo "<br>".$lines;
               if(substr($lines,0,1) == '0')
               {
                  $serial = substr($lines,1,6);

                  if(trim($serial) == "" break;
                  $proc_date = substr($lines,7,8);
                  $tot_rec = substr($lines,15,7);
                  $sign = substr($lines,22,1);
                  $tot_amt = substr($lines,23,8).".".substr($lines,31,2);
                  $cps_pc = substr($lines,35,4);

echo "<br>";
echo "Serial :".$serial."<br>";
echo "rocDate :".$proc_date."<br>";
echo "TotRec :".$tot_rec."<br>";
echo "Sign :".$sign."<br>";
echo "TotAmt :".$tot_amt."<br>";
echo "CPCCycle :".$cps_pc."<br><br>";

echo "<table border=1 cellpadding=0 cellspacing=0><tr>";
                  echo "<td class=field_name>pmt_date</td>";
                  echo "<td class=field_name>pmt_off_code</td>";
                  echo "<td class=field_name>counter</td>";
                  echo "<td class=field_name>occur</td>";
                  echo "<td class=field_name>seq_no</td>";
                  echo "<td class=field_name>sign2</td>";
                  echo "<td class=field_name>trans_amt</td>";
                  echo "<td class=field_name>rev_code</td>";
                  echo "<td class=field_name>adj_code</td>";
                  echo "<td class=field_name>acct_no</td>";
                  echo "<td class=field_name>serv_no</td>";
                  echo "<td class=field_name>pmt_mode</td>";
                  echo "<td class=field_name>rec_no</td>";
                  echo "<td class=field_name>tlx_bill</td>";
                  echo "<td class=field_name>proc_date</td>";
                  echo "<td class=field_name>doc_no</td>";
                  echo "<td class=field_name>bill_no</td>";
                  echo "<td class=field_name>ref_no</td>";
                  echo "<td class=field_name>status</td>";
                  echo "</tr>";
               }
               else if(substr($lines,0,1) == '2')
               {
                  $pmt_date = substr($lines,1,8);
                  $pmt_off_code = substr($lines,9,4);
                  $counter = substr($lines,13,2);
                  $occur = substr($lines,15,2);
                  $seq_no = substr($lines,17,4);
                  $sign2 = substr($lines,21,1);
                  $trans_amt = substr($lines,22,8).".".substr($lines,30,2);
                  $rev_code = substr($lines,32,3);
                  $adj_code = substr($lines,35,2);
                  $acct_no = substr($lines,37,14);
                  $serv_no = substr($lines,51,16);
                  $pmt_mode = substr($lines,67,1);
                  $rec_no = substr($lines,68,8);
                  $tlx_bill = substr($lines,76,8);
                  $proc_date = substr($lines,84,8);
                  $doc_no = substr($lines,100,16);
                  $bill_no = substr($lines,116,10);
                  $ref_no = substr($lines,126,20);

                  $sql = "SELECT count(*) from payment where volser_no = '".
                         $serial."' and acct_no = '".$acct_no.
                                 "' and pmt_receipt_no = '".$rec_no.
                                 "' and to_char(pmt_recd_date,'YYYYMMDD') = '".$pmt_date."'";
                  $stid = ociparse($conn, $sql);
                  if(!$stid)
                  {
                     $e = oci_error($conn);
                     print htmlentities($e['message']);
                     exit;
                  }
                  $r = ociexecute($stid);
                  if(!$r)
                  {
                     $e = oci_error($conn);
                     print htmlentities($e['message']);
                     exit;
                  }
                  if(ocifetch($stid))
                  {
                     $cnt = ociresult($stid, 1);
                  }
                  if($cnt <= 0)
                  {
                  $sql = "INSERT into payment (pmt_id, bci, acct_no, pmt_recd_date, " .
                     "pmt_receipt_no, pmt_recd_by, payment_mode, pmt_amt, ".
                     "cycle_num, sum_code, sub_sum_code, orgin_cycle_no, ".
                     "document_no, bill_num, reference_no, volser_no, ".
                     "serv_type,rev_code) values (pmt_id_seq.nextval, 'WBE00Z21', '".
                     $acct_no."',to_date('".$pmt_date."','YYYYMMDD'),'".
                     $rec_no."', '".$pmt_off_code."-".$counter."-".$occur."','".
                     $pmt_mode."', '".$trans_amt."','".
                     $seq_no."', 'DSK01', 'DBK01','".$cps_cp."','".
                     $doc_no."','".$bill_no."','".$ref_no."', '".$serial."', 'F','".$rev_code."')";
//echo "<br>".$sql;
//return;

                   $stid = ociparse($conn, $sql);
                   if(!$stid)
                   {
                      $e = oci_error($conn);
                      print htmlentities($e['message']);
                      exit;
                   }
                   $r = ociexecute($stid);
                   if(!$r)
                   {
                      $e = oci_error($conn);
                      print htmlentities($e['message']);
                      exit;
                   }
                   $status = 'OK';
                }
                else
                {
                   $status = 'DUP';
                }
                  echo "<tr>";
                  echo "<td class=serv_detail>".$pmt_date."</td>";
                  echo "<td class=serv_detail>".$pmt_off_code."</td>";
                  echo "<td class=serv_detail>".$counter."</td>";
                  echo "<td class=serv_detail>".$occur."</td>";
                  echo "<td class=serv_detail>".$seq_no."</td>";
                  echo "<td class=serv_detail>".$sign2."</td>";
                  echo "<td class=serv_detail>".$trans_amt."</td>";
                  echo "<td class=serv_detail>".$rev_code."</td>";
                  echo "<td class=serv_detail>".$adj_code."</td>";
                  echo "<td class=serv_detail>".$acct_no."</td>";
                  echo "<td class=serv_detail2><b>".$serv_no."</b></td>";
                  echo "<td class=serv_detail>".$pmt_mode."</td>";
                  echo "<td class=serv_detail>".$rec_no."</td>";
                  echo "<td class=serv_detail>".$tlx_bill."</td>";
                  echo "<td class=serv_detail>".$proc_date."</td>";
                  echo "<td class=serv_detail>".$doc_no."</td>";
                  echo "<td class=serv_detail>".$bill_no."</td>";
                  echo "<td class=serv_detail>".$ref_no."</td>";
                  echo "<td class=serv_detail>".$status."</td>";
                  echo "</tr>";
               }
            }
            echo "</table>";
            fclose($fh);
}
?>
<?php
# close the connection
$conn->Close();
?>
</body>
</html>
回复

使用道具 举报


ADVERTISEMENT

发表于 25-9-2007 09:58 PM | 显示全部楼层
大概看了一下,就是打开文件取读资料,
然后把特定的资料显示出来,没有什么特别的.
回复

使用道具 举报

 楼主| 发表于 25-9-2007 10:39 PM | 显示全部楼层
原帖由 为人民服务 于 25-9-2007 09:58 PM 发表
大概看了一下,就是打开文件取读资料,
然后把特定的资料显示出来,没有什么特别的.


是把那个文件upload然后取读那个upload了的文件资料?
回复

使用道具 举报

发表于 26-9-2007 12:34 AM | 显示全部楼层
然后导入数据库里。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 18-9-2025 12:49 AM , Processed in 1.114862 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表