Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

Login through an external file in order to realize an ajax-login

Aloittaja phpchris, heinäkuu 24, 2007, 04:48:56 AP

« edellinen - seuraava »

phpchris

Hi champs,

I am trying to realize a login through an external file.
The file gets the login-details via POST.
Here is my code:

if($_POST['user'] && $_POST['pass'])
  {
$length = 3153600;         
$username = addslashes($_POST['user']);
$passwd2 = sha1($_POST['pass']);
    if(smf_setLoginCookie($length, $username, $passwd2, false))
    {
smf_authenticateUser();
smf_loadSession();
$_SESSION = $_COOKIE;
debugo($passwd2);


The SMF-API is included and a cookie with the correct cookie name is set, doesnt seem to be right though!

Any ideas please?


Rick_bbp

I have a similar problem (not really) but login, sessions and cookie related. .. Noone replied there as well ...

I havent played with the forum yet but looks like I might be able to help given some time .... elaborate what do you want in the end of the day ?

phpchris

Hi and thanks for the reply.

I am sending form data via POST to a custom file.
I want to log into SMF from this file. It is realized with ajax.
I have tried around a bit. It seems as if it sets a cookie but the cookie does not seem to be right.
This is my source:


<?php
require('../forum/SSI.php');
if(
$_POST['user'] && $_POST['pass'])
  {
$length 3153600;         
$username addslashes($_POST['user']);
$passwd2 sha1($_POST['pass']);
setLoginCookie(3153600$_POST['user'], $passwd2);
$cookie = @unserialize(stripslashes($_COOKIE[$smf_settings['cookiename']]));
debugo($cookie);
  }


debugo() is a custom function which gives out the values of an array in <pre> Tags.

Any ideas?


phpchris


phpchris

Ok, cool...
Anyone has an idea where to get help?
Anyone seen a code-snippet or so?


Advertisement: