Originally posted by nightowl
I guess you cannot expect somebody to browse through all that code without you first narrowing it down to the main problem...
Admittedly that is a lot of code, and being a "newbie" I can only guess what to narrow it down to. And if I do venture a guess and post only a small section, how would I know being a "newbie" that it indeed is the main problem.
However I will gladly :-) give it a try by posting this section:
function login($uname, $pass)
{
global $setinfo;
include("config.php");
if ($user_dblocation)
{
@mysql_select_db("$user_dbname") or die ("Unable to select database");
$result = mysql_query("select pass, uid, storynum, umode, uorder, thold, noscore, ublockon, theme, commentmax
FROM " . $table_prefix."users where strcmp(uname,'$uname')=0");
@mysql_select_db("$dbname") or die ("Unable to select database");
}
else
{
$result = mysql_query("select pass, uid, storynum, umode, uorder, thold, noscore, ublockon, theme, commentmax, conversionflag FROM " . $table_prefix."users where strcmp(uname,'$uname')=0");
}
if($result && mysql_num_rows($result)==1)
{
$setinfo = mysql_fetch_array($result);
$dbpass = $setinfo[pass];
$tmppass = ($setinfo[conversionflag]==0) ? crypt($pass, substr($dbpass,0,2)) : md5($pass);
$updatepass = ($setinfo[conversionflag]==0) ? 1 : 0;
if (strcmp($dbpass, $tmppass))
{
html_header_location("user.php?stop=1");
return;
}
$pass=md5($pass);
// if needed convert old password to the new md5() based system
if ($updatepass) {
if ($user_dblocation)
{
@mysql_select_db("$user_dbname") or die ("Unable to select database");
mysql_query("update " . $table_prefix."users set pass='$pass', conversionflag='1' where strcmp(uname,'$uname')=0");
@mysql_select_db("$dbname") or die ("Unable to select database");
}
else
{
mysql_query("update " . $table_prefix."users set pass='$pass', conversionflag='1' where strcmp(uname,'$uname')=0");
}
}
docookie($setinfo[uid], $uname, $pass, $setinfo[storynum], $setinfo[umode], $setinfo[uorder], $setinfo[thold], $setinfo[noscore], $setinfo[ublockon], $setinfo[theme], $setinfo[commentmax]);
html_header_location("user.php?op=userinfo&bypass=1&uname=$uname");
}
else html_header_location("user.php?stop=1");
Thank you for your consideration,
Robb