简体   繁体   English

使用两种不同的帐户类型进行登录注册

[英]Login Registration with Two different account types

I am making a website login and registration page and it is working perfectly. 我正在制作一个网站登录和注册页面,它运行正常。 Now I am in the part were I need to have two account types. 现在我需要部分帐户类型。 Like Homeowner Account and Rentors Account. 像房主帐户和房客帐户。

Now what I have so far is I register and pick Homeowner Account It will go to a profile page with links and Images and that is relevant to that Account. 现在,到目前为止,我要注册并选择房主帐户,它将进入包含链接和图像的个人资料页面,该页面与该帐户相关。

Register/Login-->Homeowner Account--->Homeowner Profile Page 注册/登录->房主帐户---->房主配置文件页面

But now When I register as a Rentors Account it goes to the same page with all the Homeowner Links. 但是现在,当我注册为“租房者帐户”时,它会与所有房主链接一起进入同一页面。 So How can I have it where I can read login and have the database read and determine which account type it has and then redirect it to the proper profile page (ie rentor profile). 因此,如何在可以读取登录信息的位置读取数据库,并确定数据库具有的帐户类型,然后将其重定向到适当的配置文件页面(即租户配置文件)。

Register/Login-->Rentor Account--->Rentors Profile Page 注册/登录->租户帐户---->租户资料页面

Also the reason why I want to have it direct to a different profile page is bc the visual looks of both Homeowner and Rentors Page is different with differnt colours and images. 另外,我之所以要直接将其定向到其他个人资料页面,是因为房主和房客页面的视觉外观在颜色和图像上都不同。

I am working in php and mysql and have a database call users that has all the users info including the account type. 我在php和mysql中工作,并且有一个数据库呼叫用户,该用户具有所有用户信息,包括帐户类型。

Thanks 谢谢

Add one more field in that table and assign two role like homeowner and rentors. 在该表中再添加一个字段,并分配两个角色,例如房主和房客。 Then at the registration time insert this field with some value (homeowner and rentors) or (1 and 2). 然后在注册时,将此字段插入一些值(房主和房客)或(1和2)。 Then check at the time of login then redirect to corresponding profile. 然后在登录时检查,然后重定向到相应的配置文件。

Add another column in your table that will hold the type of account a user holds. 在表中添加另一列,该列将保存用户拥有的帐户类型。 At registration, include an input field where the account type is set. 注册时,请在其中输入用于设置帐户类型的输入字段。 Your login script should be able to determine the account type associated with the username/password combo that was typed in. Using the account type that was returned from the table, the user can be redirected to the appropriate page. 您的登录脚本应该能够确定与键入的用户名/密码组合关联的帐户类型。使用从表返回的帐户类型,可以将用户重定向到适当的页面。 Something like: if($user_type == "Homeowner") { header("Location: homeoweners_page.php);} else { header("Location: rentors_page.php");} 类似于:if($ user_type ==“ Homeowner”){header(“ Location:homeoweners_page.php);} else {header(” Location:rentors_page.php“);}

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM