I have one website with Joomla 2.5.
I have another application which was written by asp.net and c#. I need that users who register in Joomla website can login to asp.net application with same username and password.
I need when users want to login to asp.net application, my application connect to Joomla database (user table) and check their username and password.
I don't know how can I do this.
Asked
Active
Viewed 1,594 times
0

Alessandro Minoccheri
- 35,521
- 22
- 122
- 171

BthGh
- 192
- 5
-
I can connect to my database of Joomla. but the problem is that password field in database is encrypt. I don't know how I can check the password that user fill in asp.net application with Joomla password. – BthGh Nov 15 '12 at 12:04
2 Answers
0
http://www.geekgumbo.com/2010/07/02/use-joomla-login-credentials-outside-of-joomla/
This website has a login script using the following:
//Change these to your Joomla details
$dbhostname = 'localhost';
$dbusername = 'root';
$dbpassword = 'password';
$dbdatabase = 'joomla15';
// Get these from your form...
$username_for_check = 'admin';
$password_for_check = 'admin';
$joomla_user;
$joomla_pass;
$joomla_salt;
$mysqli = new mysqli($dbhostname,$dbusername,$dbpassword,$dbdatabase);
if ($result = $mysqli->query('SELECT j.username,j.password FROM joomla15.jos_users j WHERE j.username="'.$username_for_check.'" LIMIT 1;')) {
if ($result->num_rows == 0){
echo 'Username does not exist.';
}else{
while ($row = $result->fetch_object()) {
$joomla_user = $row->username;
$pass_array = explode(':',$row->password);
$joomla_pass = $pass_array[0];
$joomla_salt = $pass_array[1];
}
if($joomla_pass == md5($password_for_check.$joomla_salt)){
echo 'Username and password combination validated.';
}else{
echo 'Invalid password for username.';
}
}
} else {
echo 'LOGIN VALIDATION: MySQL Error - '.$mysqli->error;
}
$mysqli->close();

George Wilson
- 5,595
- 5
- 29
- 42
0
Maybe you can use Central Authentication Service who called CAS solution for this problem.
Joomla has some plugin for CAS and many article exists for explain how to use CAS in C# ASP .NET.
this Joomla plugin may be helped. External Login.
but my big problem is when any body login in Joomla site I want to automatically login in ASP.NET site and I don't know what do am I do for this problem. for more detail you can see How to share Joomla login session from one joomla website to one ASP.Net MVC website

Community
- 1
- 1

sorosh_sabz
- 2,356
- 2
- 32
- 53