duan4739 2015-10-21 02:43
浏览 50
已采纳

localhost和webhost在PHP中的输出不一样

Sorry I'm beginner in PHP, I would like to ask for help why in localhost I perfect what I want to the process but when I upload it on our webhost it was different output from the process, same in date.

I'm from Philippines (GMT+8).

Example of what I entered in my process: the Date today in both date input so the status will be NEW - FRESH - ACTIVE but when I input in webhost side the status will be like DORMANT, WINBACK, INACTIVE.

Screenshot:
Localhost (which is perfect process): enter image description here

Webhost view (which is not correct): enter image description here

EDIT: I ADDED hongkong timezone still have problem in process in webhost Here is my code:

<?php

date_default_timezone_set('Hongkong');
if(isset($_POST['submit']))
{
    $dateRegistration = mysql_real_escape_string($_POST['dateRegistration']);
    $dateStarted = mysql_real_escape_string($_POST['dateStarted']);
    $dateExpiration = mysql_real_escape_string($_POST['dateExpiration']);
    $accType = mysql_real_escape_string($_POST['accType']);
    $subsType = mysql_real_escape_string($_POST['subsType']);
    $status = mysql_real_escape_string($_POST['status']);

    //declartion
    $accType = "NEW";
    $subsType = "FRESH";
    $status = "ACTIVE";
    $color = "<th style=\"color: #cccc00;\">&nbsp;&nbsp;&nbsp;";
    #7f7f00

    //Equation 
    $dateExpiration = date('Y/m/d', strtotime($dateStarted. '+ 30 days'));

    //$dateRegExisting = date('Y/m/d', strtotime($dateRegistration. '+30 days'));


    if (strtotime($dateRegistration)<strtotime('-30 days')) {
        $accType = "EXISTING";
        $subsType = "RENEWAL";
        $color = "<th style=\"color: #7f7f00;\">&nbsp;&nbsp;&nbsp;";

    } 



    if (strtotime($dateStarted)<strtotime('-30 days')) {
        $subsType = "FOR RENEWAL";
        $accType = "EXISTING";
        $status = "INACTIVE";
        $color = "<th style=\"color: red;\">&nbsp;&nbsp;&nbsp;";
    }


      if (strtotime($dateStarted)<strtotime('-90 days')) {
        $accType = "DORMANT";
        $subsType = "FOR WINBACK";
        $status = "INACTIVE";
        $color = "<th style=\"color: red;\">&nbsp;&nbsp;&nbsp;";

    }


}


  $date1 = date('Y/m/d');

  echo "<br/>";
  echo "<br/>";
  echo "Today is: ".$date1;


  ?>


  <html>

  <head>

  <title>Add New Subscriber | Customer Information System</title>
  <script src="https://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script>
  <!-- Bootstrap core CSS -->

  <title>Title goes here</title>


 <script src="http://cdn.jsdelivr.net/webshim/1.12.4/extras/modernizr-custom.js"></script>
 <script src="http://cdn.jsdelivr.net/webshim/1.12.4/polyfiller.js">   </script>
<script>

webshims.setOptions('waitReady', false);
webshims.setOptions('forms-ext', {types: 'date'});
webshims.polyfill('forms forms-ext');

</script>

<style>
table, th, td {
border: 1px solid black;
}

#expiration {

color: red;
 }

</style>
</head>

<body>


<form action="" method="POST">

<br/>
<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label><strong>Date of Registration:</strong></label>
<input type="date" id="date" name="dateRegistration" placeholder="Date of Reg">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label><strong>Start of Subscription:</strong></label>
<input type="date" id="date" name="dateStarted" placeholder="Start ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<input type="hidden" id="expiration" name="dateExpiration" placeholder="Expiration" ></font>
<br/>
<br/>
<input type="submit" name="submit" value="Submit" style="margin-left: 25em;">
<br/>
<br/>
<br/>
<br/>
<table style="margin-left: 7em;">

    <tr>
        <th>&nbsp;&nbsp;Date of Registration&nbsp;&nbsp;</th>
        <th>&nbsp;Start of Subscription&nbsp;&nbsp;&nbsp;</th>
        <th>&nbsp;&nbsp;Expiration&nbsp;&nbsp;&nbsp;&nbsp;</th>
        <th>&nbsp;&nbsp;Account Type&nbsp;&nbsp;&nbsp;&nbsp;</th>
        <th>&nbsp;&nbsp;Subscription Type&nbsp;&nbsp;&nbsp;&nbsp;</th>
        <th>&nbsp;&nbsp;Status&nbsp;&nbsp;&nbsp;&nbsp;</th>
    </tr>
    <tr>
        <?php
        echo "<th style=\"color: black;\">&nbsp;&nbsp;&nbsp;".$dateRegistration."</th>";
        echo "<th style=\"color: black;\">&nbsp;&nbsp;&nbsp;".$dateStarted."</th>";
        echo "<th style=\"color: black;\">&nbsp;&nbsp;&nbsp;".$dateExpiration."&nbsp;&nbsp;&nbsp;</th>";
        echo $color.''.$accType."</th>";
        echo $color.''.$subsType."&nbsp;&nbsp;&nbsp;</th>";
        echo $color.''.$status."&nbsp;&nbsp;&nbsp;</th>";

        ?>

    </tr>

 </table>
 </form>
 </body>
 </html>
  • 写回答

2条回答 默认 最新

  • douqihou7537 2015-10-26 00:36
    关注

    I have my own answer, I removed the mysql_real_escape_string if no database included.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多
  • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
  • ¥60 fail to initialize keyboard hotkeys through kernel.0000000000
  • ¥30 ppOCRLabel导出识别结果失败
  • ¥15 Centos7 / PETGEM
  • ¥15 csmar数据进行spss描述性统计分析
  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿