0
사이트에 등록한 후 사용자에게 프로필을 보내 줄 스크립트를 작성하려고합니다. 작성자에게 mysqli_query 구문 I에 문제가 있음을 확인했습니다. 오류가 계속 발생 PHP 구문 분석 오류 : 예기치 않은 구문 오류 '{'누군가가 도와 줄 수 있습니까내 사이트에 등록한 후 사용자를 프로필에 리디렉션하려고 시도했습니다.
<?php
// set database connection
require("dbconfig.php");
// lets get our posts //
$email = $_POST['email'];
$pass = $_POST['password'];
$bn = $_POST['bandname'];
$state = $_POST['state'];
$genre = $_POST['genre'];
$description = $_POST['description'];
$image = $_FILES['image'];
/// valid image types ///
$image_type = array("image/jpg","image/jpeg","image/bmp","image/gif","image/png");
/// folder that will hold the image
$imagepath = "images/";
$imagepath .= $image["name"];
// move the file from the tmp folder to the image folder
if (move_uploaded_file($image['tmp_name'], $imagepath)){
$foo = `mogrify -quality 92 -scale 500x $imagepath`;
}
// insert data into mysql
if (!mysqli_query($ms,"insert into dbusers (email, password, bandname, state, genre, description ,image)
values ('$email','$pass','$bn ','$state','$genre','$description','".$image['name'] . "')"){
}else {
$id=mysqli_insert_id($sql);// Get the associated ID number
// Set up a login session
session_start();
$_SESSION ['id' ] = $id;
$_SESSION ['bandname' ] = $bandname;
$_SESSION ['password' ] = $password;
header("Location:ympprofile.php?listid=$id");
}
?>
당신은'경우 (mysqli_query ...'라인에 폐쇄')'누락은 그게 내가 시각적으로 자리 최초의 일이다 - 다른 사람이있을 수 있습니다 –
내가 SQL을 방지 할 수있는 방법 [읽어 주시기 바랍니다. PHP에서 주입] (http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) - 이제는 prepare()/bind_param()/execute()'를 MySQLi와 함께 사용하여 (현재 취약한) 코드를 SQL 주입으로부터 보호합니다. –