Adding login script

Started by creatures, November 30, 2005, 04:51:17 PM

Previous topic - Next topic

creatures

I want my forum users can also use their usernames and passwords to get some special rights at my web site.

I had some search and i found that perfect code below...


<?php
require("SSI.php"); 

if (
$context['user']['is_guest'])
 {
   echo 
   
'<h5>Access Denied</h5>
   We are sorry guest, it seems you dont have premission to view these downloads.'
;
ssi_login('http://sarki.alternatifim.com/');
 }
else
 {
   echo
   
'<h5>Welcome '$context['user']['name'], '!</h5>
   Here are your downloads:'
;
 }
?>



However i am using forum at different domain like http://www.abc.com and my web site has also different domain name like http://www.cba.com

So, How can i check login is correct or not and getting some user information like user_id and username which are stored in db.

Oldiesmann

Not sure if that's possible since the site and the board are on two different domains because the domain name for the board's cookie wouldn't match the domain name for the site's cookie.
Michael Eshom
Christian Metal Fans

creatures

Thanks for your reply,
It is not important for me to use cookies, I just want to check if user has a valid account or not and getting user_id, that's quite enough for me...

creatures


Compuart

As Oldiesmann said, the cookies won't work across domain names, so the users will at least need to log in on each domain seperately. As long as the scripts on both domains have access to the same database, the code you posted should work correctly.
Hendrik Jan Visser
Former Lead Developer & Co-founder www.simplemachines.org
Personal Signature:
Realitynet.nl -> ExpeditieRobinson.net / PekingExpress.org / WieIsDeMol.Com

creatures

Ok, At first i have only one domain and it is asp.net hosting and i was thinking to change my forum to smf. So i bought a new domain name and it is linux hosting. I am quiet happy to use smf really. But i need to make some modification since I let my users using forum's username and password for gaining more right at my site.

So, the asp one has not any smf files, anyway what do i need to copy to use that ssi feature.
Or do my users need to login from forum?

Thanks for your kindly helps...

Compuart

Since your sites seem to be on different servers, I'm affraid integrating them is gonna be hard. If I understand your problem, the easiest way to do it would be as following:

PHP/MySQL Server
=======
Running SMF
Settings.php (with $db_server set to localhost)


ASP Server
=======
SSI.php
Settings.php (with the $db_server set to the PHP/MySQL Server)

Make sure the Sources directory is also present on your ASP server. Also MySQl has to be configured to accept connections from your ASP server.
Hendrik Jan Visser
Former Lead Developer & Co-founder www.simplemachines.org
Personal Signature:
Realitynet.nl -> ExpeditieRobinson.net / PekingExpress.org / WieIsDeMol.Com

creatures

Ok, I uploaded sources directory and also themes directory with index.template.php and index.english.php

It is working but it doesn't to redirects sarki.alternatifim.com it just redirects forum

Now it is working like forum user login system :(
And also, after succesfull login when i get back to page it still askes for me username and password.

What can i do more?

Compuart

Hmm, I forgot about the login part, which requires an index.php that's on the ASP site. Try to copy SMF's index.php to the ASP site, and point the $boardurl that's in Settings.php to URL that contains index.php. If you wanna make sure it redirects after logging in to your frontpage, call the SSI function with an extra parameter:
ssi_login('http://path.to/frontpage.php');
Hendrik Jan Visser
Former Lead Developer & Co-founder www.simplemachines.org
Personal Signature:
Realitynet.nl -> ExpeditieRobinson.net / PekingExpress.org / WieIsDeMol.Com

creatures

I have already copied index.php and my code already ssi_login('http://sarki.alternatifim.com/');
If i change the $boardurl it gives me another error. I also changed the directories from the index.php. Otherwise, i was getting error...

Using ssi isn't necessary for me, if i can check the username and password is correct at the db and getting user_id is enough for me. That's all but how   ???

It really looks hard since password salt code...

creatures

When i changed $board from settings.php at the asp.net server

I am getting that error
Unable to load the 'Errors' template.

Compuart

There's two values setting the forum directory in Settings.php:

$boarddir should be the path that points to the basedir of your (virtual) SMF forum (the $boarddir should also be the directory containing the Sources and Themes sub directory).
$boardurl should be the URL pointing to the same directory as $boarddir
Hendrik Jan Visser
Former Lead Developer & Co-founder www.simplemachines.org
Personal Signature:
Realitynet.nl -> ExpeditieRobinson.net / PekingExpress.org / WieIsDeMol.Com

creatures

Ok,
Settings.php at linux hosting

########## Forum Info ##########
$mbname = 'Alternatifim Cafe'; # The name of your forum.
$language = 'turkish'; # The default language file set for the forum.
$boardurl = 'http://sarki.alternatifim.com'; # URL to your forum's folder. (without the trailing /!)
$webmaster_email = '[email protected]'; # Email address to send emails from. (like [email protected].)
$cookiename = 'SMFCookieXX'; # Name of the cookie to set for authentication.
########## Directories/Files ##########
# Note: These directories do not have to be changed unless you move things.
$boarddir = 'D:\Websites\alternatifim.com\wwwroot\sarki'; # The absolute path to the forum's folder. (not just '.'!)
$sourcedir = 'D:\Websites\alternatifim.com\wwwroot\sarki\Sources'; # Path to the Sources directory.


Settings.php at asp.net hosting

########## Forum Info ##########
$mbname = 'Alternatifim Cafe'; # The name of your forum.
$language = 'turkish'; # The default language file set for the forum.
$boardurl = 'http://www.alternatifimcafe.com'; # URL to your forum's folder. (without the trailing /!)
$webmaster_email = '[email protected]'; # Email address to send emails from. (like [email protected].)
$cookiename = 'SMFCookieXX'; # Name of the cookie to set for authentication.
########## Directories/Files ##########
# Note: These directories do not have to be changed unless you move things.
$boarddir = '/hsphere/local/home/gilbaz/alternatifimcafe.com'; # The absolute path to the forum's folder. (not just '.'!)
$sourcedir = '/hsphere/local/home/gilbaz/alternatifimcafe.com/Sources'; # Path to the Sources directory.


Am i making something wrong?
If i change $boardurl to www.alternatifimcafe.com instead of http://sarki.alternatifim.com
Code works like forum's user login script...

Maybe i need to copy more files since it gives error like Unable to load the 'Errors' template.

Maybe i need to copy default template...  ???

Compuart

Indeed, that would be a good idea. It might try to communicate something, but be unable to do so since there are no templates to show it.
Hendrik Jan Visser
Former Lead Developer & Co-founder www.simplemachines.org
Personal Signature:
Realitynet.nl -> ExpeditieRobinson.net / PekingExpress.org / WieIsDeMol.Com

creatures

After copiying files like login.template it startes the work, but it is not working correctly.
It tries to work as a new forum...

I need to try something difference :(

creatures

I have writed a script for just reading smf_members
But transfering userpassword to passwd with passwordSalt looks like very hard :(

Basically, i need to do this since ssi doesn't make any sense for me :'(

Can anyone help for changing password to passwd (at smf_members table) if we know passwordSalt...

creatures

I am really sorry to reopen this topic, but it is really important for me.

Does anyone can help for checking login from other domain

Advertisement: