preg_match不适用于PHP 5.5和$ nick

时间:2015-05-11 11:02:05

标签: php

我需要你对这个表格的帮助..试试看,不要工作

这是in.php 形式是index.php,问题在这里 in.php

///////////////////////////////////////
        header('Content-type:text/html; charset=utf-8');
        echo '<?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">';
        echo'<html>';
        echo'<head>';
        echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />";
        echo "<meta http-equiv=\"no-cache\" content=\"no-cache\" />";
        echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />";
        echo"<title> Enter $_time</title>";
        echo'<link rel="stylesheet" href="style.css" type="text/css"/>';
        echo"<link rel='shortcut icon' href='fevicon.ico' />";
        echo'</head>';
        echo'<body>';

        echo"<div class='logo' align='center'><b>xat</b></div>";

        if ($c1 == "1")
        {
        echo "<div class=errnotice>* Capcha Not Match.!</div>";
        echo "<div class='body'><a href=\"index.php\">Re Enter</a></div>";
        }
        if ($c1 == "0")
        {


 if (preg_match("/[^A-Za-z0-9\!]/", $nick))
    {
    echo "<div class='errnotice'><b>Invalid Characters!</b></div>";
    echo"<div class='body'>Please use A-Z/0-9 Characters in Nick Special Symbol not Allowed.</div>";
    }
    else {
    if(strlen($nick)<3
        {
        echo "<div class='errnotice'>Use minimum 4 charactor in nick</div>";
        }
        else
        {
        if (isset($_COOKIE["inactive"]))
        {
        echo" <div class='errnotice'><b>YOUR IP NAME BLOCKED FOR 6 DAYS DUE TO ABUSING AND SPAMING!!</b></div>";
        }

        else
        {

        if($nick!=="") {
        $update = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM `".$px.$utable."` WHERE nick ='".$nick."'"));
        if($update[0]!=="0") {
        echo "<div class='errnotice'>Plz Take a Diffrent Nick</div>";
        echo "<div class='body'><a href=\"index.php\">Re Enter</a></div>"; } else {
        if($g=="m") { $gg=Male; } else { $gg=Female; }
        if($sm=="1") { $smm=Yes; } else { $smm=No; }
        @mysql_query("insert into `".$px.$utable."` values(0,'$nick','$sm','$g','$a','".time()."','$room','".getenv(HTTP_USER_AGENT)."','0','$c','".$_SERVER["REMOTE_ADDR"]."','$ci');");
        echo "<div class='inmenubox'>Welcome </div>";
        echo"<div class='inbox'>";
        echo "<div class='body2'><img src='enter.gif' alt='enter'><B>$nick</b></div>";

第51行错误preg_mach和$ nick 这个问题只有php 5.3和5.5 ....在php 5.2中正常工作

1 个答案:

答案 0 :(得分:0)

替换

  `<b>` if (preg_match("/[^A-Za-z0-9\!]/", $nick))

通过

if (preg_match("/[^A-Za-z0-9\!]/", $nick))

并检查一次。