View Single Post
  #59  
Old 04-09-2012, 10:17 PM
KaceKuma KaceKuma is offline
I am a Fish.
 
Join Date: Sep 2011
Location: Under the sea
Posts: 28
Gender: Female
Credits: 3,098
KaceKuma is on a distinguished road
Default

I did everything you said to do to upgrade my sire from 1.3.0 to 1.3.1 and something is wrong :\ Everytime I try to login it just says I have a programing error...help?!

Snapshot: http://www.iaza.com/work/120410C/iaza18671524773200.png

Code of Login Page:
Quote:
<?php

include("functions/functions.php");
include("functions/functions_users.php");
include("inc/lang.php");

//***************//
// START SCRIPT //
//***************//

if($isloggedin == "yes"){

$article_title = $langislog;
$article_content = $langislogfull;

}
else{

//User is not logged in, so let's attempt to log them in...

$username = $_POST["username"];
$username = secure($username);
$password = $_POST["password"];
$password = secure($password);
$salt = $_POST["salt"];
$salt = secure($salt);

//User is not logged in

$loginform = "<form name='form1' method='post' action='login.php'>
<p>Username:
<input name='username' type='text' id='username'>
</p>
<p>Password:
<input name='password' type='password' id='password'>
</p>
<p>
<input type='submit' name='Submit' value='Submit'>
</p>
<p>Don't have an account?<br>
<a href='register.php'>Register Free</a> </p>
<a href='forgotpass.php'>Forgot your password? Click Here</a>
</form>";



if($loggedinname == "" and $password == ""){
// User is viewing login form
$article_title = "Member Login:";

$article_content = $loginform;
}
else if(($username != "" and $password == "") or ($username == "" and $password != "") ){

//Something was left blank
$article_title = "Login Error:";
$article_content = "Something was left blank. Please try logging in again.<br><br>{$loginform}";

}
else if($username != "" and $password != ""){
// Try to log the user in

$user = $adopts->select("users", array(), "username = '{$username}'")->fetchObject();
$password = passencr($username, $password, $user->salt);

if($username == $user->username and $password == $user->password){
$article_title = "Login Successful!";
$article_content = "Welcome back {$username}. You are now logged in. <a href='account.php'>Click Here to view or edit your account.</a>";

// Set the cookie
$Month = 2592000 + time();
// Convert from username to uid to secure data, no need for password since it is already hashed.
$uid = usernametouid($username);
$session = session_id();
$myssession = md5($uid.$session);
setcookie("mysuid",$uid,$Month);
setcookie("myssession",$myssession,$Month);

// Now update the user login session
$adopts->update("users", array("session" => $myssession), "username = '{$username}'");

// Time for forum-integration check
include("inc/config_forums.php");
if($mybbenabled == 1){
include_once("functions/functions_forums.php");
$forums = new Database($mybbdbname, $mybbhost, $mybbuser, $mybbpass, $mybbprefix) or die("Cannot connect to forum database, please contact an admin immediately.");
$mybbuser = $forums->select("users", array("uid", "loginkey"), "username = '{$username}'")->fetchObject();
$cookiesettings = array();
$cookiesettings['cookiedomain'] = $forums->select("settings", array("value"), "name = 'cookiedomain'")->fetchColumn();
$cookiesettings['cookiepath'] = $forums->select("settings", array("value"), "name = 'cookiepath'")->fetchColumn();
$cookiesettings['cookieprefix'] = $forums->select("settings", array("value"), "name = 'cookieprefix'")->fetchColumn();
mybbsetcookie("mybbuser", $mybbuser->uid."_".$mybbuser->loginkey, NULL, true, $cookiesettings);

$mybbsid = mybb_random_str(32);
mybbsetcookie("sid", $mybbsid, -1, true);
}
}
else{
$article_title = "Login Failed!";
$article_content = "Sorry, we could not log you on with the details specified. You can <a href='login.php'>try again</a> or <a href='forgotpass.php'>request a password reset.</a>";
$fail = 1;
}
}




}


//***************//
// OUTPUT PAGE //
//***************//

echo showpage($article_title, $article_content, $date);

?>
__________________
Just your average everyday human bean.