News:

Wondering if this will always be free?  See why free is better.

Main Menu

Trouble with Passwords

Started by treeleaf20, November 26, 2005, 12:14:16 PM

Previous topic - Next topic

treeleaf20

I use the following code to insert a new user into the smf_members table:

$fname = $_POST['FName'];
$lname = $_POST['LName'];
$email = $_POST['Email'];
$username = $_POST['Username'];
$date_created = date("m/d/Y");
$password = $_POST['Password'];
$password = md5($password);
$ip = $REMOTE_ADDR;
$time=time();
$name = "$fname $lname";

$sqlforum = "INSERT INTO `smf_members` (memberName, dateRegistered, posts, ID_GROUP, lastLogin, realName, instantMessages, unreadMessages, passwd, emailAddress, gender, birthdate, hideEmail, showOnline, signature, timeOffset, im_email_notify, karmaBad, karmaGood, notifyAnnouncements, notifyOnce, memberIP, ID_THEME, is_activated, ID_MSG_LAST_VISIT, ID_POST_GROUP, totalTimeLoggedIn) VALUES ('$username', '$time', '0', '0', '$time', '$name', '0', '0', '$password', '$email', '0', '$user_birth', '1', '1', 'NULL', '0', '1', '0', '0', '1', '1', '$ip', '0', '1', '2', '4', '0')";
//echo $sqlforum;
$resultforum = mysql_query($sqlforum);

I then use SSI.php to log the people in but I keep getting a Password Incorrect page on the forum index.php page.

I have a couple other questions. Instead of displaying the forum page quick before it redirects back to another page is there anywhere I can put in the template or index.php that would say authenticating the user and then based on if they user logged in successfully or not it woudl either redirect back to a login page I created or redirect to them to the home page if they logged in successfully? It looks like this has to be done in LogInOut.php but I'm just not sure where so if you could help with that I would greatly appreciate it.

My second question is I need to set a session variable, would I include the following code in the LogInOut.php page or somewhere else:
$_SESSION['username'] = $_REQUEST['user'];

Thank you for the help in advance.

treeleaf20

I actually got the password part to work, but I can't manage to get the redirects to work yet. So if you could still please help with that I would appreciate it.

treeleaf20

Also I need to know where and how to set the session variable username?? Thank you.

Oldiesmann

If they're logged in, just use $_SESSION['username'] = $context['user']['name'];

Can you post the code you're using for the redirect? I can't really say why it wouldn't work without seeing how you're doing it.
Michael Eshom
Christian Metal Fans

Advertisement: