0

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

我开始收到此错误:

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

我有 2 个包含在 HTML 中的 php 文件,load.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 );
        }
    }
}
?>

有塞尔维亚字符串,只想给原版。

4

2 回答 2

0

难道只是

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

你得到错误了吗?可以尝试将其注释掉并运行其余部分以查看其他语句是否仍然出现错误。可能想检查您的转义功能本身,那里可能有问题。如果可以的话,可以发布,可能有助于确定问题。

于 2013-10-09T12:39:54.210 回答
0

这是因为较新版本的 PHP 版本“escape”未定义,您最好更改函数并使用准备函数

于 2018-07-07T05:35:08.340 回答