-1

こんにちは友達私はPHPのスキルがあまりありません。このコードで私を助けてください。構文エラーの予期しないファイルの終わりが表示されています。テストしましたが失敗しました。ファイルからこのコードを削除すると、ページは正しく表示されますが、このコードを貼り付けると同じエラーが表示されます。

ファイルにはこのコードのみが含まれているため、ブラケット、フルストップ、またはその他の問題がある可能性があります。修正して、回答に修正されたコードを指定してください。困っている人々を本当に助けている皆さんを愛しています。

<?php
include("include/header.php");
if (!isset($_SESSION["userlogin"])) {
    header("location: login.php");
    exit();
}
$edit = dbFetchArray(dbQuery("select * from `user_registration` where `email`='" . $_SESSION["userlogin"] . "'"), MYSQL_BOTH);
$Id = base64_decode($_REQUEST['Id']);
$up = mysql_fetch_array(mysql_query("select * from `jobs` where `id`='" . $Id . "'"));
$status = stripslashes($up["highlighted"]);
$name = stripslashes($up["title"]);
$explode = explode(" ", $name);
$tit = isset($explode[0]) ? $explode[0] : '';
$col = isset($explode[1]) ? $explode[1] : '';
$cat = isset($explode[2]) ? $explode[2] : '';

$user = mysql_fetch_array(mysql_query("select * from `user_registration` where `email`='" . $_SESSION["userlogin"] . "'"));
$fullname = stripslashes($user['fullname']);
$customer_id = $user['id'];
$current_balence = $user['current_balance'];

if (isset($_POST["Button"])) {
    if (isset($_REQUEST["Available_positions"])) {
        $Available_positions = $_POST["Available_positions"];
        if (strpos($Available_positions, '.') === false) {
            $pos = $Available_positions;
            $pos1 = 0;
        } else {
            $pieces = explode(".", $Available_positions);
            $pos = $pieces[0];
            $pos1 = $pieces[1];
        }

        $Payment_per_task = $_POST["Payment_per_task"];

        $hid = $_REQUEST['hid'];
        if ($pos1 > 0) {
            ?>
            <script>
                alert('Job Posting Suspended');
                window.location.href="edit_job.php?Id=<?= base64_decode($hid) ?>";
            </script>
            <?
        } else {
            dbQuery("update `jobs` set `wd2`='" . $Available_positions . "',`price`='" . $Payment_per_task . "' where `id`='" . $hid . "' and `email`='" . $_SESSION["userlogin"] . "'");
            ?>
            <script>
                window.location.href="employer.php";
            </script>
            <?
        }
    }
    $_SESSION['hid'] = $hid;
    if ($hid > 0) {
        $_SESSION["success"] = '';
    } else {
        $_SESSION["error"] = '';
    }
} else if (isset($_POST["Cancel"])) {
    $hid = $_REQUEST['hid'];
    dbQuery("update `jobs` set `status`='3' where `id`='" . $hid . "' and `email`='" . $_SESSION["userlogin"] . "'");
    $resJ = dbFetchArray(dbQuery("select * from `jobs` where `id`='" . $hid . "' and `email`='" . $_SESSION["userlogin"] . "'"), MYSQL_BOTH);

    if ($resJ["wd1"] != $resJ["wd2"]) {
        $CJ = $resJ["wd2"] - $resJ["wd1"];
        $CJFees = $CJ * $resJ["price"];
        dbQuery("insert into `myaccount`(`email`,`amount`,`type`,`createdate`,`jobid`) values('" . $_SESSION['userlogin'] . "','$CJFees','10',NOW(),'" . $resJ["id"] . "')");
        $rescurbal = dbFetchArray(dbQuery("select * from `user_registration` where `email`='" . $_SESSION['userlogin'] . "'"), MYSQL_BOTH);
        dbQuery("update `user_registration` set `current_balance`='" . ($rescurbal["current_balance"] + $CJFees) . "' where `email`='" . $_SESSION['userlogin'] . "'");
    }
    ?>
    <script>
        window.location.href="employer.php";
    </script>
    <?
}
?>
4

3 に答える 3

1

コードの大きなブロックを 1 つずつ切り取り、ページを更新します。エラーを生成せずにスクリプトが特定のポイントまで実行されたかどうかを確認する必要がある場合は、 die関数を使用してそれ以上のスクリプトの実行を停止できます。

エラーが消えたら、カットしたばかりのブロックにあることを意味します。次に、行ごとに手順を繰り返すと、間違いを見つけることができます。括弧、引用符、セミコロンなどを使用した構文エラーである必要があります。

于 2013-04-14T10:56:12.013 に答える
0

また、ファイルのエンコーディングが BOM なしの UTF-8 であることを確認してください。

include ("include/header.php");
if(!isset($_SESSION["userlogin"]))
{
    header("location: login.php");
    exit();
}
$edit = dbFetchArray(dbQuery("select * from `user_registration` where `email`='".$_SESSION["userlogin"]."'"),MYSQL_BOTH);
$Id = base64_decode($_REQUEST['Id']);
$up = mysql_fetch_array(mysql_query("select * from `jobs` where `id`='".$Id."'"));
$status = stripslashes($up["highlighted"]);
$name = stripslashes($up["title"]);
$explode = explode(" ",$name);
$tit = isset($explode[0]) ? $explode[0] : '';
$col = isset($explode[1]) ? $explode[1] : '';
$cat = isset($explode[2]) ? $explode[2] : '';

$user = mysql_fetch_array(mysql_query("select * from `user_registration` where `email`='".$_SESSION["userlogin"]."'"));
$fullname = stripslashes($user['fullname']);
$customer_id = $user['id'];
$current_balence = $user['current_balance'];

if(isset($_POST["Button"]))
{
    if(isset($_REQUEST["Available_positions"]))
    {
        $Available_positions = $_POST["Available_positions"];
        if(strpos($Available_positions,'.') === false)
        {
            $pos = $Available_positions;
            $pos1 = 0;
        }
        else
        {
            $pieces = explode(".",$Available_positions);
            $pos = $pieces[0];
            $pos1 = $pieces[1];
        }

        $Payment_per_task = $_POST["Payment_per_task"];

        $hid = $_REQUEST['hid'];
        if($pos1 > 0)
        {

?>
<script>
alert('Job Posting Suspended');
window.location.href="edit_job.php?Id=<?= base64_decode($hid)?>";
</script>
<?

        }
        else
        {
            dbQuery("update `jobs` set `wd2`='".$Available_positions."',`price`='".$Payment_per_task."' where `id`='".$hid."' and `email`='".$_SESSION["userlogin"]."'");

?>
 <script>
window.location.href="employer.php";
</script>
<?

        }
    }
    $_SESSION['hid'] = $hid;
    if($hid > 0)
    {
        $_SESSION["success"] = '';
    }
    else
    {
        $_SESSION["error"] = '';
    }
}
else
{
    if(isset($_POST["Cancel"]))
    {
        $hid = $_REQUEST['hid'];
        dbQuery("update `jobs` set `status`='3' where `id`='".$hid."' and `email`='".$_SESSION["userlogin"]."'");
        $resJ = dbFetchArray(dbQuery("select * from `jobs` where `id`='".$hid."' and `email`='".$_SESSION["userlogin"]."'"),MYSQL_BOTH);

        if($resJ["wd1"] != $resJ["wd2"])
        {
            $CJ = $resJ["wd2"] - $resJ["wd1"];
            $CJFees = $CJ * $resJ["price"];
            dbQuery("insert into `myaccount`(`email`,`amount`,`type`,`createdate`,`jobid`) values('".$_SESSION['userlogin']."','$CJFees','10',NOW(),'".$resJ["id"]."')");
            $rescurbal = dbFetchArray(dbQuery("select * from `user_registration` where `email`='".$_SESSION['userlogin']."'"),MYSQL_BOTH);
            dbQuery("update `user_registration` set `current_balance`='".($rescurbal["current_balance"] + $CJFees)."' where `email`='".$_SESSION['userlogin']."'");
        }

?>
<script>
window.location.href="employer.php";
</script>
<?
    }
}
于 2013-04-14T10:56:51.623 に答える
-2

短いタグをアクティブにしていない場合は、 を使用する必要があり<?phpます<?。そうしないと、PHP は 内のコードを無視します<? ... ?>。そのため、ブラケットが欠落しているため、取得しているような構文エラーが発生します。

于 2013-04-14T10:54:06.670 に答える