每个人 我在数据库PostgreSQL中使用odoo12网站 和我使用react-native创建一个应用程序,我想将我的应用程序与postgresql数据库连接 顺便说一下,数据库在我正在工作的情况下被隔离在另一台服务器中 请问你能帮帮我吗 ? 我正在等待您的回复
最好的问候 洋红Everyone
i'm Using odoo12 site web with database postgresql
and I Create an app Using react-native , and i want to connect my app with
postgresql database
by The way The Database is separated in another server wher i'm working
Could you help me Please ?
I'm Waiting For your Response
best regards
eyounes
/*************** Login Code ************/
UserLoginFunction = () =>{
const { username } = this.state ;
const { password } = this.state ;
fetch('http://192.168.43.56/ff/users.php', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
username: username,
password: password
})
}).then((response) => response.text())
.then((responseJson) => {
// If server response message same as Data Matched
if(responseJson === 'Data Matched')
{enter code here
//Then open Profile activity and send user email to profile activity.
this.props.navigation.navigate('intervention', { Email: UserEmail });
}
else{
Alert.alert(responseJson);
}
}).catch((error) => {
console.error(error);
});
}
/********************** DbConfig.php *********************/
<?php
//Define your host here.
$HostName = "Odoo-serv12";
//Define your database name here.
$DatabaseName = "Lpn_auto";
//Define your database username here.
$HostUser = "openpg";
//Define your database password here.
$HostPass = "openpg";
?>
/******************* users.php *****************/
<?php
// Importing DBConfig.php file.
include 'DBConfig.php';
// Creating connection.
$con = pg_connect($HostName,$HostUser,$HostPass,$DatabaseName);
// Getting the received JSON into $json variable.
$json = file_get_contents('php://input');
// decoding the received JSON and store into $obj variable.
$obj = json_decode($json,true);
// Populate User email from JSON $obj array and store into $email.
$username = $obj['login'];
// Populate Password from JSON $obj array and store into $password.
$password = $obj['password'];
//Applying User Login query with email and password match.
$Sql_Query = "select * from res_users where login = '$username' and password = '$password' ";
// Executing SQL Query.
$check = pg_fetch_array(pg_query($con,$Sql_Query));
if(isset($check)){
$SuccessLoginMsg = 'Data Matched';
// Converting the message into JSON format.
$SuccessLoginJson = json_encode($SuccessLoginMsg);
// Echo the message.
echo $SuccessLoginJson ;
}
else{
// If the record inserted successfully then show the message.
$InvalidMSG = 'Invalid Username or Password Please Try Again' ;
// Converting the message into JSON format.
$InvalidMSGJSon = json_encode($InvalidMSG);
// Echo the message.
echo $InvalidMSGJSon ;
}
pg_close($con);
?>
关于出轨的所有信息 谢谢