php中的502坏网关

时间:2017-01-17 06:27:29

标签: php mysql

我在php中编写了一个脚本,用于从android应用程序访问。它用于将数据添加到数据库中,但在我将其托管到共享主机后,它总是显示502 BAD网关错误...我不知道我的代码发生了什么

这是我的代码:

<?php
require "init.php";
header('Content-type : bitmap; charset=utf-8');
$encoded_string = $_POST["encoded_string"];
$image_name = $_POST["image_name"];
$glry_encode_string = $_POST["glry_encoded_string"];
$glry_image_name = $_POST["glry_image_name"];
$cash= $_POST["cash"];
$credit = $_POST["credit"];
$description = $_POST["description"];
$date = $_POST["date"];

if(empty($_POST['encoded_string'])) {

} else {
    $camname="http://xxxxxx.com/folder/folder/Camera_images";
    $camimgpath="$camname/$image_name.jpeg";
    $folder="Camera_images/";
    $camera_path="$folder/$image_name.jpeg";
    file_put_contents($camera_path,base64_decode($encoded_string));
    echo "\n+$cash";
    echo "\n+$credit";
    echo "\n+$description";
    echo "\n+$image_name";
}

if(empty($_POST['glry_encoded_string'])) {
} else {
    $galname="http://xxxxx.com/folder/folder/Gallery_images";
    $galimgpath="$galname/$glry_image_name.jpeg";
    $folder="Gallery_images/";
    $glry_path="$folder/$glry_image_name.jpeg";
    file_put_contents($glry_path,base64_decode($glry_encode_string));
}
$sql= "insert into tbl_sales_Report    (cash,credit,description,date,camera_name,camera_path,gallery_name,gallery_path)values('$cash','$credit','$description','$date','$image_name','$camimgpath','$glry_image_name','$galimgpath');";

if(mysqli_query($con,$sql)) {
    echo "<br><h3>sending....</h3>";
} else {
    echo "Error in inserted".mysqli_errno($con);
}
?>

这是服务器端提供的错误日志

  [16-Jan-2017 18:49:49 Etc/GMT] PHP Notice: Undefined index:     encoded_string in /home/samanxw6/public_html/hennasilks.com/jijo/informe /Add_info.php on line 5
    [16-Jan-2017 18:49:49 Etc/GMT] PHP Notice: Undefined index: image_name in /home/samanxw6/public_html/hennasilks.com/jijo/informe/Add_info.php on line 6
   [16-Jan-2017 18:49:49 Etc/GMT] PHP Notice: Undefined index: glry_encoded_string in /home/samanxw6/public_html/hennasilks.com/jijo/informe/Add_info.php on line 7
  [16-Jan-2017 18:49:49 Etc/GMT] PHP Notice: Undefined index: glry_image_name in /home/samanxw6/public_html/hennasilks.com/jijo/informe/Add_info.php on line 8
   [16-Jan-2017 18:49:49 Etc/GMT] PHP Notice: Undefined index: cash in /home/samanxw6/public_html/hennasilks.com/jijo/informe/Add_info.php on line 9
  [16-Jan-2017 18:49:49 Etc/GMT] PHP Notice: Undefined index: credit in /home/samanxw6/public_html/hennasilks.com/jijo/informe/Add_info.php on line 10
  [16-Jan-2017 18:49:49 Etc/GMT] PHP Notice: Undefined index: description in /home/samanxw6/public_html/hennasilks.com/jijo/informe/Add_info.php on line 11
  [16-Jan-2017 18:49:49 Etc/GMT] PHP Notice: Undefined index: date in /home/samanxw6/public_html/hennasilks.com/jijo/informe/Add_info.php on line 12
  [16-Jan-2017 18:49:49 Etc/GMT] PHP Notice: Undefined variable: camimgpath in /home/samanxw6/public_html/hennasilks.com/jijo/informe/Add_info.php on line 42
  [16-Jan-2017 18:49:49 Etc/GMT] PHP Notice: Undefined variable: galimgpath in /home/samanxw6/public_html/hennasilks.com/jijo/informe/Add_info.php on line 42

请帮我找一个解决方案......提前谢谢......

0 个答案:

没有答案