简体   繁体   English

如何将每个用户连接到他自己的数据库?

[英]How Can I Connect Each User To His Own Database?

I have created a Cataloguer using php/mysql. 我使用php / mysql创建了一个Cataloguer。 This Cataloguer will be distributed for some people (about 20+). 该目录将分发给一些人(约20+)。 All of them will have a specific database with there own cataloguer. 所有这些都将拥有一个具有自己的编目器的特定数据库。 Those database will be created by the ADM. 这些数据库将由ADM创建。 But how can I redirect a user to his own database? 但是,如何将用户重定向到自己的数据库?

Right now the only thing I know about alternating from one database to another is by my dbh.php file: 现在我唯一知道从一个数据库到另一个数据库交替的是我的dbh.php文件:

<?php

$dbServername = "localhost";
$dbUsername = "root";
$dbPassword = "";
$dbName = "user1";

$conn = mysqli_connect($dbServername, $dbUsername, $dbPassword, $dbName);

I have a login page wich its link I will send to these people. 我有一个登录页面,我将发送给这些人的链接。 In that login page I want to make it so they fill in a key (each person has its specific key) that redirects them to a website (the cataloguer) and that cataloguer will use the database of that specific key only. 在该登录页面中,我想要这样做,以便他们填写一个密钥(每个人都有其特定的密钥),将它们重定向到一个网站(编目员),并且该编目员将仅使用该特定密钥的数据库。

If you know of any tutorial on that please send me! 如果你知道任何教程,请发给我!

Create a database for the users themselves and in it store the name and credentials for each user's own database. 为用户自己创建一个数据库,并在其中存储每个用户自己的数据库的名称和凭据。 Once you log the user in then simply connect to the specific user's database. 登录用户后,只需连接到特定用户的数据库即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我怎样才能获得自己的每个数据库信息? - How can I get each database info in their own <td>? 每个用户都可以在 laravel 应用程序中连接自己的谷歌驱动器 - Each user can connect their own google drive in laravel app 如何使用PHP创建文件夹和子文件夹,用户可以给出自己的名称和要创建的文件夹数 - How to create folders and subfolders using PHP where user can give his own NAME and number of folders to be created 如何授权用户仅使用Laravel oauth2 API查看自己的数据? - How do I authorize a user to only see his own data with a Laravel oauth2 API? 如何通过用户ID检查WordPress是否在线? - How can I check if a user is online in WordPress by his id? 输入用户ID时如何将用户重定向到他的目录 - How can I redirect user to his directory when he enters his ID Yii2 rbac用户无法更新自己的帖子 - Yii2 rbac user can not update his own post Cakephp-我想允许用户创建自己的页面,该页面的网址就是他的名字 - Cakephp - I want to allow a user to create his own page, the url of which would be his name 如何连接到该数据库? 我无法连接 - How to connect to this database? I can't connect Tymon JWT:我如何通过他的 id 从经过身份验证的用户向另一个用户进行身份验证? - Tymon JWT: how can I authenticate from authenticated user with another user via his id?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM