У меня есть форма html для регистрации нового пользователя. Код формы такой:
user_new.php //the name of the file.
<form class="form-horizontal" novalidate id="Register_form" name="Register_form" method="POST" action="load-data-form">
<div class="row">
<div class="col-lg-12">
<fieldset class="form-group position-relative has-icon-left">
<div class="controls">
<input type="text" name="basicUsernameRegistertxt" id="basicUsernameRegistertxt" class="form-control" placeholder="Username" required data-validation-required-message="This username field is required">
<div class="form-control-position"><i class="bx bx-user"></i>
</div>
</div>
</fieldset>
</div>
<div class="col-lg-12">
<fieldset class="form-group position-relative has-icon-left">
<div class="controls">
<input type="email" id="basicEmailRegistertxt" name="basicEmailRegistertxt" class="form-control" placeholder="Email Address" required data-validation-required-message="The email field is required">
<div class="controls">
<input type="email" id="basicEmailRegistertxt" name="basicEmailRegistertxt" class="form-control" placeholder="Email Address" required data-validation-required-message="The email field is required">
</div>
<div class="form-control-position"><i class="bx bx-envelope"></i>
</div>
</fieldset>
</div>
<div class="col-lg-12">
<fieldset class="form-group position-relative has-icon-left">
<div class="controls">
<input type="password" id="basicPasswordRegistertxt" name="basicPasswordRegistertxt" class="form-control" placeholder="Password" required data-validation-required-message="The password field is required" minlength="6">
</div>
<div class="form-control-position"><i class="bx bxs-lock"></i>
</div>
</fieldset>
</div>
<div class="col-lg-12">
<ul class="list-unstyled mb-0">
<li class="d-inline-block mr-2 mb-1">
<fieldset>
<div class="radio radio-info radio-glow">
<input type="radio" id="radioGlow5" name="basicTypeUserRegister" value="USER1">
<label for="radioGlow5">USER1</label>
</div>
</fieldset>
</li>
<li class="d-inline-block mr-2 mb-1">
<fieldset>
<div class="radio radio-warning radio-glow">
<input type="radio" id="radioGlow6" name="basicTypeUserRegister" value="USER2" checked>
<label for="radioGlow6">USER2</label>
</div>
</fieldset>
</li>
</ul>
</div>
<div class="col-lg-12">
<button class="btn btn-primary btn_login_register" id="btnRegisterSend" type="submit">Register</button>
</div>
</div>
</form>
Когда я нажимаю кнопку «Отправить», данные отправляются на эту страницу для обработки:
https://NAME OF THE DOMAIN/no-iugyrtriuh-nbvytii
Эта страница no-iugyrtriuh-nbvytii ( без расширения. php, поскольку этот URL является дружественным) имеет следующее содержимое:
include_once $_SERVER['DOCUMENT_ROOT'] . '/core/app/libraries/Sessions.php';
session_start();
include_once $_SERVER['DOCUMENT_ROOT'] . '/data-set/db_config.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/data-set/Useraccount.php';
$objUsers = new Useraccount();
$user_name = "";
$password = "";
$username = $_POST['basicUsernameRegistertxt'];
$pass = $_POST['basicPasswordRegistertxt'];
$email = $_POST['basicEmailRegistertxt'];
$typeuser = $_POST['basicTypeUserRegister'];
$users = 0;
$users2 = null;
$users3 = null;
$users4 = null;
$token = "";
$token2 = "";
$token_result = "";
$link = "";
if ($username !== "" && $pass !== "" && $typeuser !== "")
{
$password = password_hash($pass, PASSWORD_BCRYPT);
$users = $objUsers->generateNewuser($typeuser, "first_name", "last_name", "nickname", $email, "", "", "", "", "", "", "", "", "Not Position", "Yes", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "");
if ($users > 0)
{
echo $users;
}
else
{
echo "Server error.";
}
}
else{ echo "Some fields are empty.! Please check them.";}
Функция вставки данных в базу данных находится внутри файла Useraccount. php, а соединение с базой данных находится в файл db_config. php
Соединение с БД, если оно нормально и активно, потому что я могу получать данные из базы данных на других страницах моего сайта.
Содержимое файла Useraccount. php:
class Useraccount
{
private $db;
public function __construct()
{
$this->db = new db_config();
}
public function InsertGeneralInfo($field0, $field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $profile_picture, $field9, $field10, $field11, $field12, $field13, $field14, $field15, $field16, $field17, $field18, $field19, $field20, $field21, $field22, $field23, $field24, $field25, $field26, $field27, $field28, $field29, $field30, $field31, $field32, $field33, $field34, $field35, $field36)
{
$this->db->query("INSERT INTO db_name_here (type, first_name, last_name, short_name, email, website_url, twitter_info, facebook_info, phone_number, profile_picture, biography_info, country_info, address_info, position_info, send_message_to_myemail, account_fb, account_twitter, account_google, account_linkedin, account_instagram, account_tumblr, account_vk, account_odnok, account_youtube, account_vimeo, account_rutube, account_dribbb, account_flick, account_pinter, account_medium, account_tripad, account_wikip, account_stumbl, account_livejour, account_skype, account_bloglo, account_whatsapp, account_soundc) VALUES (:type, :first_name, :last_name, :short_name, :email, :website_url, :twitter_info, :facebook_info, :phone_number, :profile_picture, :biography_info, :country_info, :address_info, :position_info, :send_message_to_myemail, :account_fb, :account_twitter, :account_google, :account_linkedin, :account_instagram, :account_tumblr, :account_vk, :account_odnok, :account_youtube, :account_vimeo, :account_rutube, :account_dribbb, :account_flick, :account_pinter, :account_medium, :account_tripad, :account_wikip, :account_stumbl, :account_livejour, :account_skype, :account_bloglo, :account_whatsapp, :account_soundc)");
$this->db->bind(":type", $field0);
$this->db->bind(":first_name", $field1);
$this->db->bind(":last_name", $field2);
$this->db->bind(":short_name", $field3);
$this->db->bind(":email", $field4);
$this->db->bind(":website_url", $field5);
$this->db->bind(":twitter_info", $field6);
$this->db->bind(":facebook_info", $field7);
$this->db->bind(":phone_number", $field8);
$this->db->bind(":profile_picture", $profile_picture);
$this->db->bind(":biography_info", $field9);
$this->db->bind(":country_info", $field10);
$this->db->bind(":address_info", $field11);
$this->db->bind(":position_info", $field12);
$this->db->bind(":send_message_to_myemail", $field13);
$this->db->bind(":account_fb", $field14);
$this->db->bind(":account_twitter", $field15);
$this->db->bind(":account_google", $field16);
$this->db->bind(":account_linkedin", $field17);
$this->db->bind(":account_instagram", $field18);
$this->db->bind(":account_tumblr", $field19);
$this->db->bind(":account_vk", $field20);
$this->db->bind(":account_odnok", $field21);
$this->db->bind(":account_youtube", $field22);
$this->db->bind(":account_vimeo", $field23);
$this->db->bind(":account_rutube", $field24);
$this->db->bind(":account_dribbb", $field25);
$this->db->bind(":account_flick", $field26);
$this->db->bind(":account_pinter", $field27);
$this->db->bind(":account_medium", $field28);
$this->db->bind(":account_tripad", $field29);
$this->db->bind(":account_wikip", $field30);
$this->db->bind(":account_stumbl", $field31);
$this->db->bind(":account_livejour", $field32);
$this->db->bind(":account_skype", $field33);
$this->db->bind(":account_bloglo", $field34);
$this->db->bind(":account_whatsapp", $field35);
$this->db->bind(":account_soundc", $field36);
//execute the query
return $this->db->executeLastID();
}
}
Проблема заключается в том, что когда я отправляю форму на страницу, которую я определил в атрибуте действия, получаемый ответ :
This page doesn't work!
The page DOMAIN_NAME.com Can't process this request now.
HTTP ERROR 500
и пользователь не создан, и я не знаю почему. Когда я работаю в Local, с XAMPP, это нормально, все хорошо, но когда я загрузил это на сервер (я использую бесплатную учетную запись хостинга на 000webhostapp.com, которую я использую для тестирования), это происходит.
Что именно является причиной этой проблемы?