致命错误:在load.php中调用未定义的函数escape()

时间:2013-10-09 11:59:49

标签: php html forms submit

对于我的网站,我创建了一个表格,由参与者填写进行一些培训。

我开始收到此错误:

Fatal error: Call to undefined function escape() in load.php on line 10

我有两个包含在HTML,load.php和disp.php

中的php文件

disp.php

<form method="post" name="FORMA" id="RTABLE">
    <table width="100%" cellspacing="3" cellpadding="3">
            <td class="Label">Ime i prezime:<span class="Red">*</span></td>
            <td class="Field"><input type="text" maxlength="200" name="ime_prezime" value="<?php echo $Error ? $Recover[ 'ime_prezime' ] : ""; ?>" /></td>
        </tr>
        <tr>
            <td class="Label">E-mail:<span class="Red">*</span></td>
            <td class="Field"><input type="text" name="email" maxlength="100" value="<?php echo $Error ? $Recover[ 'email' ] : ""; ?>" /></td>
        </tr>
        <tr>
            <td class="Label">Phone:<span class="Red">*</span></td>
            <td class="Field"><input type="text" name="telefon" maxlength="30" value="<?php echo $Error ? $Recover[ 'telefon' ] : ""; ?>" /></td>
        </tr>
        <tr>
            <td class="Label">Faculty:<span class="Red">*</span></td>
            <td class="Field"><input type="text" name="fakultet" maxlength="100" value="<?php echo $Error ? $Recover[ 'fakultet' ] : ""; ?>" /></td>
        </tr>
        <tr>
            <td class="Label">Year of study:<span class="Red">*</span></td>
            <td class="Field">
                <select name="year" id="year">
                    <?php
                        $year = array (1,2,3,4,5);
                        for ( $i = 0; $i < count( $year ); $i++ ){
                            $year[ $i ] = htmlspecialchars( $year[ $i ] );
                            echo "<option value=" . $year[ $i ] . " " . ( $Error && $year[ $i ] == $Recover[ 'year' ] ? 'selected' : '' ) . ">" . $year[ $i ] . "</option>";
                        }
                    ?>
                </select>
            </td>
        </tr>

        <tr>
            <td colspan="2" align="right"><input type="submit" name="PRIJAVA" value="Prijavite se!" class="BUTTON" /><div style="font-size:11px">obavezna polja <span class="Red">*</span></div></td>
        </tr>
    </table>
</form>

load.php

<?php
$Added = false;
$Try = false;
$Error = false;
$ErrMsg = "";
if ( isset( $_POST[ 'PRIJAVA' ] ) ){
    try{
        $Try = true;

        $ImePrezime = escape( $_POST[ 'ime_prezime' ] );
        $Email = escape( $_POST[ 'email' ] );
        $Telefon = escape( $_POST[ 'telefon' ] );
        $Fakultet = escape( $_POST[ 'fakultet' ] );
        $year = escape( $_POST[ 'year' ] );


        if ( $ImePrezime == "" ) raiseError( 0x0F, "Morate uneti ime i prezime." );
        else if ( $Email == "" ) raiseError( 0x0F, "Morate uneti e-mail adresu." );
        else if ( strpos( $Email, '@' ) === false ) raiseError( 0x0F, "Uneli ste nevalidnu e-mail adresu." );
        else if ( $Telefon == "" ) raiseError( 0x0F, "Morate uneti kontakt telefon." );
        else if ( $Fakultet == "" ) raiseError( 0x0F, "Morate uneti fakultet." );
        else if ( $year == "" ) raiseError( 0x0F, "Morate uneti godinu studija." );

        //$rs = &dbexecute( "SELECT COUNT( id ) FROM jf_eric_prijava WHERE email = '{$Email}' AND naziv = '{$Trening}' and tip_prijave = 'Trening'" );

        if ( mysql_result( $rs, 0, 0 ) ) raiseError( 0x0F, "Vec ste prijavljeni za praksu." );

        dbexecute( "INSERT INTO jf_eric_prijava ( ime_prezime, email, telefon, fakultet, year) VALUES( '{$ImePrezime}', '{$Email}', '{$Telefon}', '{$Fakultet}', '{$year}' )" );
        $Added = true;
    }catch( Exception $Ex ){
        $ErrMsg = $Ex;
        $Error = true;
        foreach ( $_POST as $K => $P ){
            $Recover[ $K ] = htmlspecialchars( $P );
        }
    }
}
?>

有塞尔维亚语字符串,只是想给原文。

2 个答案:

答案 0 :(得分:0)

只是

  

$ email = escape($ _POST ['email']);

你收到错误了吗?可以尝试对其进行评论并运行其余部分以查看是否仍然会收到其他语句的错误。可能想检查你的逃生功能本身,可能有些不对劲。可以发布,如果你能够,可以帮助确定问题。

答案 1 :(得分:0)

这是因为PHP版本 在较新的版本中,“转义”未定义 您最好更改功能并使用准备功能