This topic is locked
[SOLVED]

 Login Multiple Projects With One Login Screen

6/6/2014 12:43:24 PM
ASPRunnerPro General questions
G
gonzalosb author

hi all,

I'm interested in see if i can create a "ONE FOR ALL" Login page for all my projects.

I need to be redirected to different URL/Databases/project depending of team name or number or create a bypass of the existing login page with a custom one.


Now:


What i need:


basically is redirect to a specific database in to a URL to look for username and password and stay on that URL project.
this are all complete different projects and needs to stay working independent one from each oder but all get access from the same login page on my website
thank for your help in advance

G
gonzalosb author 6/9/2014

im trying to do it over the URL instead and i found this on the ASP Tips and tricks at this link autologin over URL but doesnt work.

can someone help me to see what is wrong? it this work with ASPR 7.1?

or if you have a working code that can do this function, please share it with me.



strUsername = Request("username")

strPassword = Request("password")
if strUsername<>"" and strPassword<>"" then

strSQL = "select * from LoginTableName where " & CSmartStr(AddFieldWrappers(cUserNameField)) & "=" & CSmartStr(strUsername) _

& " and " & CSmartStr(AddFieldWrappers(cPasswordField)) & "=" & CSmartStr(strPassword)
logged = false

doAssignment rs,db_query(strSQL,conn)

doAssignment data,db_fetch_array(rs)

if bValue(data) then

if IsEqual(data(cUserNameField),sUsername) and IsEqual(data(cPasswordField),sPassword) then

logged = true

end if

end if

if bValue(logged) then

doArrayAssignment Session,"UserID",pUsername

Session("AccessLevel") = ACCESS_LEVEL_USER

end if

asp_header "Location: menu.asp"

response.end

end if


thank you

G
gonzalosb author 7/11/2014

OK, new turn aoround

can be posible to select what database to use on the login page, ex:
UserName : gonzalo

Password : sb

Database : DB1
Login
or do that over URL like: www.mypage/login.asp?database=db1&username=gonzalo&password=sb&login=true
so i can use one application instead of 10 same applications on my server
thanks for your help

lefty 7/11/2014



OK, new turn aoround

can be posible to select what database to use on the login page, ex:
UserName : gonzalo

Password : sb

Database : DB1
Login
or do that over URL like: www.mypage/login.asp?database=db1&username=gonzalo&password=sb&login=true
so i can use one aplication instead of 10 iqual on my server
thanks for your help


Use after sucessfull login event to redirect users by thier Team Code.

If values("Team_Code") = 1 Then

Response.redirect "someproject_menu.asp"

else if values("Team_Code") = 2 Then

Response.redirect "somproject2_menu.asp"

else

end if
and so on.

Just make sure all projects users tables are the same so username is in all tables and password and Team_Code is in all fields in the user table.

If you use advanced security they need to be identical . or you will get locked out of some pages and functions.

G
gonzalosb author 7/14/2014

thanks john for your answer.

what i need is redirect to a Team database before username and password is authenticated because they are complete different teams/company for each database.

a month ago i found the answer looking for other problem's solution on ASP forums and i didn't pay attention to it because i didn't need it but now i look all over for that forum and is impossible for me to found!!!
basically you choose the database you wan to use at the beginning so the entire session you use that database.
i remember that need to overwrite " include\dbconnection.asp " using a script on "before process" to do this, where we have:



<%

strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Server.MapPath("db\db1.accdb") & ";Jet OLEDB:Database Password=;User ID="
%>


showld change "("db\db1.accdb)" for "db2,db3,db4" and so on.
all the app and the database structure are the same and every time i have to apply an update i have to update the same project 20 times and is tedious and time consuming.

thank you for your help and time to respond to this forum.

G
gonzalosb author 7/29/2014

this can be part of my solution, only that is for PHP not ASP... can someone help me to translate it ?
-how-to-make-single-project-connect-to-different-databases-passing-database-name-via-url/page_
thanks

mperry622 8/5/2014

Honestly - I have 23 projects and they all use the same db with user name and passwords and email... that way everything is the same... but yes under security use a DB that has username and password and your life will be so much simpler...

G
gonzalosb author 9/4/2014

i steel working on this if anyone have any solution, idea or workaround.

lefty 9/7/2014



Honestly - I have 23 projects and they all use the same db with user name and passwords and email... that way everything is the same... but yes under security use a DB that has username and password and your life will be so much simpler...


If you have all these projects and the user will login to 1 database . We are looking to far into this . Just use the same user tables in each output . If you use Team Code as the field to determine this , Just redirect after login to that particular project. As I stated before if you use the same tables with the same field names , when you redirect to menu.asp and add a record it already knows which database to use as you just redirected him automatically to that project output which has the includes for that database . So technically use one output as the login table and put the same user/password tables in each project ( exactly the same ) . Now login from the main user table output and redirect after successfull login event to the matching Team Code to that output . The session is in the dictionary if it is the same so it knows

  1. The Security
  2. The database , because you are logged into that project which the includes already have the database to use.

    3.If you use Advanced Security then this won't work. Only works if the database matches all security levels the same and encryption is turned off . SO if you go this method you have to write the username and password to each database , when you either setup user/password or if they register , You need script to write to all databases or by team code when you login. another workaround is the link above that you showed but , I could not deciper it in asp from PHP. Will test it for you in ASP and let you know.
  3. You also might try redirect before login to authenticate that database , So you redirect before login and the next step would be logged into that database based on Team Code.

G
gonzalosb author 9/9/2014

thank you John for your answer.

I look to all the variables you say before but let me explain the problem.

  1. i use advance security (each admin can assign view, edit, delete rights to users)
  2. the user can download his own database as personal backup (witch if i use the same for all the projects this company will get the information from the others).
    i need to treat each database separated before Login with whatever method:

    selecting the database : How to make single project connect to different databases passing database name via URL?
    or via URL : www.mypage/login.asp?database=db1&username=gonzalo&password=sb&btnSubmit=login
    also can you explain mor your point 4.> " You also might try redirect before login to authenticate that database , So you redirect before login and the next step would be logged into that database based on Team Code."


it sounds that may work

thanks for your help and interest on my question