Answer the question
In order to leave comments, you need to log in
Redbean is not connecting, what should I do?
Hello, here is such a thing, on my local server ( openserver ) the connection of the redbean library worked fine, as well as its functionality, however, after transferring the files on the server, everything stopped working ... By endless echo, I found out that the matter was in the included file, which carries the functions of connecting the library file ( rb.php ) and connecting to the database, and so, see the code below:
<?php
echo "Test1";
require "rb.php";
echo "Test2";
R::setup( 'mysql:host=avtoasia.mysql;dbname=avtoasia_test2',
'avtoasia_test2', 'Kd34(df2' ); //for both mysql or mariaDB
echo "Test3";
var_dump(R::queryAll('SELECT * FROM table'));
echo "Test4";
?>
<?php
session_start();
echo "1233";
require 'php/db.php';
echo "string";
$data = $_POST;
echo "string";
$errors = array();
echo "string";
if ( trim($data["names"] == "") || trim($data["names"] == " ") ) {
$errors[] = "Вы не ввели имя, код ошибки #01";
}
if ( trim($data["surname"] == "") || trim($data["surname"] == " ") ) {
$errors[] = "Вы не ввели фамилию, код ошибки #02";
}
if ( trim($data["email"] == "") || trim($data["email"] == " ") ) {
$errors[] = "Вы не ввели электронную почту, код ошибки #03";
}
if ( !strpos( $data["email"], "@" ) ) {
$errors[] = "Это не эелектронная почта, код ошибки #031";
}
if ( trim($data["phone"] == "") || trim($data["phone"] == " ") ) {
$errors[] = "Вы не ввели номер телефона, код ошибки #04";
}
if ( mb_strlen( trim($data["phone"]) ) != "11" ) {
$errors[] = "Это не телефон, код ошибки #041";
}
if ( trim($data["login"] == "") || trim($data["login"] == " ") ) {
$errors[] = "Вы не ввели логин, код ошибки #05";
}
if ( trim($data["password"] == "") || trim($data["password"] == " ") ) {
$errors[] = "Вы не ввели пароль или ваш пароль состоит только из пробелов, код ошибки #06";
}
if ( R::count('users', "login = ? OR email = ?", array($data["login"], $data["email"])) > 0 ) {
$errors[] = "Пользователь с таким логином или электронной почтой уже существует, код ошибки #07";
}
print_r( $errors );
if ( empty( $errors ) ) {
$user = R::dispense("users");
$user->names = $data["names"];
$user->surname = $data["surname"];
$user->email = $data["email"];
$user->phone = $data["phone"];
$user->login = $data["login"];
$user->city = $data["city"];
$user->password = password_hash($data["password"], PASSWORD_DEFAULT);
$user->history = "YTowOnt9";
$user->favorite = "YTowOnt9";
R::store($user);
header("Location: index.php");
exit;
} else{
echo "<p style=\"color: red;\">" . array_shift($errors) . "</p><hr>";
}
?>
Answer the question
In order to leave comments, you need to log in
... Through endless echoes, I found out ...
... the site is hosted, the customer does not give access ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question