Hello guys,
I want to create Login script connected with myBB ([url]http://www.mybboard.com)[/url]. I posted on: http://community.mybboard.net/showthread.php?tid=15478 , but :o
It worked:
When I login on my web site page I can read from mySQL postcount, username etc. and when I go to forum page i am not logged, but now it is not working anything.
<?php
session_start();
include("forum/inc/functions_user.php");
include("config.php");
$username = addslashes($_POST['username']);
$password = addslashes($_POST['password']);
$select = mysql_query("SELECT * FROM forum_users WHERE username='$username'");
while($a=mysql_fetch_array($select)){
$salt_password = salt_password(md5($password), $a["salt"]);
if($username===$a["username"] AND $salt_password===$a["password"]){
$session_id = session_id();
$_SESSION["user_id"] = $a["id"];
setcookie("checksid",$sessionid,time()+60*60*24*30*60);
header("Location: pocetna/");
}
}
include ("pogresan_login.html");
?>
Watch this:
$session_id = session_id();
$_SESSION["user_id"] = $a["id"];
setcookie("checksid",$sessionid,time()+60*60*24*30*60);
header("Location: pocetna/");
I got redirected to "pocetna/" - home page, but I am not logged, I can not read my username etc.
Please help me. :o