0

我在网站的注册表单脚本上遇到了一个特殊的问题。在出生日期字段(例如(1987-1-1)上,它会自动在我的 phpMyadmin 上的 SQL 上添加一个点(。),例如(1987-.01-.01)[NB-only month & date field contains this dot]

我的表单动作-

$rform .= "<form action=\"regagree.php\" method=\"post\">";

我在表单上使用此代码

$rform .= "E-Mail *<br/><input name=\"email\" maxlength=\"35\" size=\"10\"/><br/>";
$rform .= "Birth Date *<br/>";
  $rform .= "<select name=\"day\" value=\"01\">";
  $rform .= "<option value=\"01\">1</option>";
  $rform .= "<option value=\"02\">2</option>";
  $rform .= "<option value=\"03\">3</option>";
  $rform .= "<option value=\"04\">4</option>";
  $rform .= "<option value=\"05\">5</option>";
  $rform .= "<option value=\"06\">6</option>";
  $rform .= "<option value=\"07\">7</option>";
  $rform .= "<option value=\"08\">8</option>";
  $rform .= "<option value=\"09\">9</option>";
  $rform .= "<option value=\"10\">10</option>";
  $rform .= "<option value=\"11\">11</option>";
  $rform .= "<option value=\"12\">12</option>";
  $rform .= "<option value=\"13\">13</option>";
  $rform .= "<option value=\"14\">14</option>";
  $rform .= "<option value=\"15\">15</option>";
  $rform .= "<option value=\"16\">16</option>";
  $rform .= "<option value=\"17\">17</option>";
  $rform .= "<option value=\"18\">18</option>";
  $rform .= "<option value=\"19\">19</option>";
  $rform .= "<option value=\"20\">20</option>";
  $rform .= "<option value=\"21\">21</option>";
  $rform .= "<option value=\"22\">22</option>";
  $rform .= "<option value=\"23\">23</option>";
  $rform .= "<option value=\"24\">24</option>";
  $rform .= "<option value=\"25\">25</option>";
  $rform .= "<option value=\"26\">26</option>";
  $rform .= "<option value=\"27\">27</option>";
  $rform .= "<option value=\"28\">28</option>";
  $rform .= "<option value=\"29\">29</option>";
  $rform .= "<option value=\"30\">30</option>";
  $rform .= "<option value=\"31\">31</option>";
  $rform .= "</select>";
  $rform .= "<select name=\"month\" value=\"01-\">";
  $rform .= "<option value=\"01-\">Jan</option>";
  $rform .= "<option value=\"02-\">Feb</option>";
  $rform .= "<option value=\"03-\">Mar</option>";
  $rform .= "<option value=\"04-\">Apr</option>";
  $rform .= "<option value=\"05-\">May</option>";
  $rform .= "<option value=\"06-\">Jun</option>";
  $rform .= "<option value=\"07-\">Jul</option>";
  $rform .= "<option value=\"08-\">Aug</option>";
  $rform .= "<option value=\"09-\">Sep</option>";
  $rform .= "<option value=\"10-\">Oct</option>";
  $rform .= "<option value=\"11-\">Nov</option>";
  $rform .= "<option value=\"12-\">Dec</option>";
  $rform .= "</select>";
  $rform .= "<select name=\"year\" value=\"1999-\">";
  $rform .= "<option value=\"1999-\">99</option>";
  $rform .= "<option value=\"1998-\">98</option>";
  $rform .= "<option value=\"1997-\">97</option>";
  $rform .= "<option value=\"1996-\">96</option>";
  $rform .= "<option value=\"1995-\">95</option>";
  $rform .= "<option value=\"1994-\">94</option>";
  $rform .= "<option value=\"1993-\">93</option>";
  $rform .= "<option value=\"1992-\">92</option>";
  $rform .= "<option value=\"1991-\">91</option>";
  $rform .= "<option value=\"1990-\">90</option>";
  $rform .= "<option value=\"1989-\">89</option>";
  $rform .= "<option value=\"1988-\">88</option>";
  $rform .= "<option value=\"1987-\">87</option>";
  $rform .= "<option value=\"1986-\">86</option>";
  $rform .= "<option value=\"1985-\">85</option>";
  $rform .= "<option value=\"1984-\">84</option>";
  $rform .= "<option value=\"1983-\">83</option>";
  $rform .= "<option value=\"1982-\">82</option>";
  $rform .= "<option value=\"1981-\">81</option>";
  $rform .= "<option value=\"1980-\">80</option>";
  $rform .= "<option value=\"1979-\">79</option>";
  $rform .= "<option value=\"1978-\">78</option>";
  $rform .= "<option value=\"1977-\">77</option>";
  $rform .= "<option value=\"1976-\">76</option>";
  $rform .= "<option value=\"1975-\">75</option>";
  $rform .= "<option value=\"1974-\">74</option>";
  $rform .= "<option value=\"1973-\">73</option>";
  $rform .= "<option value=\"1972-\">72</option>";
  $rform .= "<option value=\"1971-\">71</option>";
  $rform .= "<option value=\"1970-\">70</option>";
  $rform .= "<option value=\"1979-\">79</option>";
  $rform .= "<option value=\"1978-\">78</option>";
  $rform .= "<option value=\"1977-\">77</option>";
  $rform .= "<option value=\"1976-\">76</option>";
  $rform .= "<option value=\"1975-\">75</option>";
  $rform .= "<option value=\"1974-\">74</option>";
  $rform .= "<option value=\"1973-\">73</option>";
  $rform .= "<option value=\"1972-\">72</option>";
  $rform .= "<option value=\"1971-\">71</option>";
  $rform .= "<option value=\"1970-\">70</option>";
  $rform .= "<option value=\"1969-\">69</option>";
  $rform .= "<option value=\"1968-\">68</option>";
  $rform .= "<option value=\"1967-\">67</option>";
  $rform .= "<option value=\"1966-\">66</option>";
  $rform .= "</select><br/>";

如果需要,它会发布 regagree.php(请询问)

虽然我检查了几次,但无法找出问题所在。

这是regagree.php

<?php
include("inc/func.inc.php");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo "<?xml version=\"1.0\"?>\n";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">\n";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php

  if(!db()){
  echo "<head>";
  echo "<title>BdTEENS - Desi wap community !</title>";
  include("inc/css.inc.php");
  echo "</head>";
  echo "<body>";
  echo getdberror();
  echo "</body>";
  echo "</html>";
  exit();
  }
 $uid = $_POST["uid"];
 $pwd = $_POST["pwd"];
 $state = $_POST["state"];
 $status = $_POST["status"];
 $cpw = $_POST["cpw"];
 $usx = $_POST['usx'];
 $day = $_POST['day'];
 $loc = $_POST['loc'];
 $month = $_POST['month'];
 $year = $_POST['year'];
 $info = $_POST['info'];
 $email = $_POST["email"];
 $refer = $_POST["refer"];
 $captcha = $_POST["captcha"];
 $ubr = $_SERVER['HTTP_USER_AGENT'];
 $uip = getip();
 $nomon = $_SERVER['HTTP_X_FH_MSISDN'];
 $nomtw = $_SERVER['HTTP_MSISDN'];
 $nomtr = $_SERVER['HTTP_X_UP_CALLING_LINE_ID'];
 $nomon2 = $HTTP_X_FH_MSISDN;
 $nomtw2 = $HTTP_MSISDN;
 $nomtr2 = $HTTP_X_UP_CALLING_LINE_ID;

 if($nomon != "")
 {
 $numberp = $nomon;
 }else  if($nomtw != "")
 {
 $numberp = $nomtw;

 }else  if($nomtr != "")
 {
 $numberp = $nomtr;

 }else if($nomon2 != "")
 {
 $numberp = $nomon2;

 }else if($nomtw2 != "")
 {
 $numberp = $nomtw2;

 }else  if($nomtr2 != "")
 {
 $numberp = $nomtr2;
 }


        echo "<head>";
  echo "<title>BdTEENS - Desi wap community !</title>";
  include("inc/css.inc.php");
 echo "</head>";
 echo "<body>";
 echo "<div class=\"box_cen\">";
 echo "<b>Registration</b>";

 if(!canreg())
{
  echo "<div class=\"box_sub\" align=\"center\">";
    echo "<img src=\"images/notok.gif\" alt=\"X\"/><br/>Sorry.. Registration currently closed. Please try later.";
}else{
  $tolog = false;
  if(trim($uid)=="")
 {
    echo registerform(1);
 }else if(trim($pwd)=="")
 {
    echo registerform(2);
 }else if(trim($cpw)=="")
 {
    echo registerform(3);
}else if((regchars($uid))||(nospace($uid))||(checknumber($uid)))
{
    echo registerform(4);
}else if((regchars($pwd))||(nospace($pwd)))
{
    echo registerform(5);
}else if($pwd!=$cpw)
{
    echo registerform(6);
}else if(strlen($uid)<4)
{
    echo registerform(7);
}else if(strlen($pwd)<4)
{
    echo registerform(8);

}else if(nameexist($uid)==true)
{
    echo registerform(9);

}else if(trim($email)=="")
{
    echo registerform(10);
}else if(checkemail($email)==false)
{
    echo registerform(11);
}else if(emailexist($email)==true)
{
    echo registerform(12);
}else if($captcha!=$_SESSION["captcha_code"])
{
    echo registerform(13);
}else if(register($uid, $pwd, $usx, $day, $month, $year, $loc, $email, $info, $state, $status, $refer, $ubr, $uip, $numberp)==1)
{
    echo registerform(14);
}else if(register($uid, $pwd, $usx, $day, $month, $year, $loc, $email, $info, $state, $status, $refer, $ubr, $uip, $numberp)==2)
{
    echo registerform(14);
}else{
  echo "<div class=\"box_sub\" align=\"left\">";
  echo "<center>Registration Completed Successfully!</center><br/><hr>";
 echo "<i><b>Username:</b> $uid</i><br/>";
 echo "<i><b>Password:</b> *****</i><br/>";
 echo "<i><b>E-Mail:</b> $email</i><br/><hr>";
 $tolog = true;
}
}

if($tolog)
{
 $pmtext = "Thank You For Joining Us At BdTEENS, This Your Registration Detail. \n\n Username: $uid \n Password: $pwd";
  $from_head = "From: admin@BdTEENS";
  $subject = "BdTEENS Sign-Up Detail";
  $time = time();
  $ddt = date("M d y", $time);
  $content = "Date: $ddt \n\n $pmtext \n\n BdTEENS The Best Wap Community! \n\n HTTP://BdTEENS";
  mail($email, $subject, $content, $from_head);
    echo "<a href=\"login.php?loguid=$uid&amp;logpwd=$pwd\">";
 echo "Login Now</a>";
echo "</div>";
 echo "</div>";
echo footerweb($hits);
}else{
 echo "</div>";
echo footerweb($hits);
}
echo "</body>";
?>

</html>

这是 register.php

<?php
include("inc/func.inc.php");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo "<?xml version=\"1.0\"?>\n";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">\n";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
  if(!db()){
  echo "<head>";
  echo "<title>BdTEENS - Desi wap community !</title>";
  include("inc/css.inc.php");
  echo "</head>";
  echo "<body>";
  echo getdberror();
  echo "</body>";
  echo "</html>";
  exit();
  }

         echo "<head>";
  echo "<title>BdTEENS - Desi wap community !</title>";
  include("inc/css.inc.php");
 echo "</head>";
 echo "<body>";
 echo "<div class=\"box_cen\" align=\"center\">";
 echo "<b>Registration</b>";

if(!canreg())
{
  echo "<div class=\"box_sub\" align=\"center\">";
    echo "<img src=\"images/notok.gif\" alt=\"X\"/><br/>Sorry.. Registration currently closed. Please try later.";
    echo "</div>";
 echo "</div>";
 echo footerweb($hits);
}else{
  echo "<div class=\"box_sub\" align=\"left\">";
  echo "<b>Confirmation Registrations</b><br/>";
  echo "<b>*</b> Allowed characters in username and password are a-z, A-Z, 0-9, and -_ only<br/>";
  echo "<b>*</b> No vulgar words are accepted in username<br/>";
  echo "<b>*</b> Username must contain at least 4 characters<br/>";
  echo "<b>*</b> Please insert the real e-mail to easy you get your missing password<br/>";
  echo "<b>*</b> If your browser can't view the security question, try to refreshing sites and try again<br/>";
  echo "<b>*</b> Your id was deleted automatic if not active in 3 months<br/>";
  echo "<b>*</b> Your must follow our rules before join this wap<br/>";
    echo "<br/>";
 echo "<center><a href=\"regagree.php\">I Agree</a> / <a href=\"index.php\">I Disagree</a></center></div>";
 echo "</div>";
echo footerweb($hits);
 }
 echo "</body>";
?>
</html>
4

2 回答 2

0

您可以使用字符串函数:

$date = '(1987-.01-.01)';

str_replace('.', '' , $date);
于 2013-08-23T21:34:41.637 回答
0

在 regagree.php 添加这一行并尝试

echo $_POST['year'] . $_POST['month'] . $_POST['day'];
于 2013-08-23T21:43:53.150 回答