채택완료

Parse error: syntax error, unexpected '{' 오류..

2018-12-10 (월) 03:43:03 7,899
Copy
<?php
    if (isset($_POST['login-submit'])
        {
        include_once '../include/db.inc.php';
        $username = $_POST['userId'];
        $password = $_POST['userPw'];

        if (empty($username) || (empty($password))
         {
          header("Location: ../index.php?error=emptyfields");
          exit();
         }
        else 
         {
          $sql = "SELECT * FROM usertable WHERE userID=? OR userPW=?;"; 
          $stmt = mysqli_stmt_init($conn);    
          if (!mysqli_stmt_prepare($stmt , $sql))
          {
            header("Location: ../index.php?error=sqlerror");
            exit();
           }
         
        else
         {
            mysqli_stmt_bind_param($stmt, "ss" , $username , $password);
            mysqli_stmt_exectue($stmt);
            $result = mysqli_stmt_get_result($stmt);
            if ($row = mysqli_fetch_assoc())
            {
              $pwdCheck = password_verify($password, $row['userPW']);
              if ($pwdCheck == false)
              {
                header("Location: ../index.php?error=wrongpwd");
                exit();   
              }
                else if($pwdCheck == true)
                {
                session_start();
                $_SESSION['userNo'] = $row('userNO');
                $_SESSION['userId'] = $row('userID');
                header("Location: ../index.php?login=sucess");
                exit();     
                }
                else
                {
                    header("Location: ../index.php?error=wrongpwd");
                    exit(); 
                }

            }
            else
            {
             header("Location: ../index.php?error=nouser");
             exit(); 
            }

         }
         }
            }

            ?>

Parse error: syntax error, unexpected '{' in 3번 라인에  오류 같은데 ..어딘지 보이지가 않네용.ㅠ

|

답변 3개

채택된 답변
+20 포인트

54본째줄의 } 를 삭제해 보세요. 닫힘만 있고 열림이 없네요...^^

2번 라인의 

Copy
if (isset($_POST['login-submit'])
를

Copy
if (isset($_POST['login-submit']))
로 수정해보세요.
2018-12-10 (월) 04:12:41

 $sql = "SELECT * FROM usertable WHERE userID=? OR userPW=?;"; 

여기도 이상하네요?

 $sql = "SELECT * FROM usertable WHERE userID=? OR userPW=? "; 

답변을 작성하려면 로그인이 필요합니다.