나는 코드 조각으로 어려움을 겪고 있습니다. 이 코드에 오류가 있음을 이미 알고 있습니다. cURL을 사용합니다. curl 프로세스는 완벽하게 작동하지만 특정 변수를 다른 서버에 전달하기 위해 논리를 확인하는 if 문을 추가했습니다. 미리 감사드립니다 ..
<?php
include("../config.php");
if ( !isset( $_COOKIE['admin'] ) ) {
include_once("login.php");
echo ("<div id='quote'>Error: Can not access page.");
}
else {
if (isset($_GET['user']) && ($_GET['user'] != "") && isset($_GET['licence']) && ($_GET['licence'] != "") &&
isset($_GET['to']) && ($_GET['to'] != "") && ($_GET['username'] !=
"")) {
$username = $_GET["username"];
$idlisc= $_GET["user"];
$licence = $_GET["licence"];
$to = $_GET["to"];
$acc = new Account;
$acc->changeVis($idlisc, $licence, $to);
header("Location: search.php?user=".$username);
if ($get["lic_".$i.] == 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20) {
$ch = curl_init(); //http post to another server
curl_setopt($ch, CURLOPT_URL,"http://xxx/add-user");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"codes=$licence");
// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
print_r($server_output);
curl_close ($ch);
}
else {
$ch = curl_init(); //http post to another server
curl_setopt($ch, CURLOPT_URL,"http://xxx/add-user");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"usr=$username&code=$licence&password=$id");
// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
print_r($server_output);
curl_close ($ch);
}
}
두 가지 구문 오류가 있습니다.
if ($_get["lic_".$i.]
-------------^ // Remove this dot
둘째, 코드 끝에서 중괄호를 닫아야합니다.
curl_close ($ch);
}
}
} //<---- Add a brace here
편집하다 :
귀하의 if
진술이 이와 같은지 확인하십시오 .
if ($_get["lic_".$i] == 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20)
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다