Jump to content

[SOLVED] Session Problem


Daney11

Recommended Posts

Hey guys

 

This is my login.php

<form method="post" action="login.php">
<?php
	  
if (isset($HTTP_POST_VARS['member_email']) && isset($HTTP_POST_VARS['member_password']))

{

$member_email = htmlentities($HTTP_POST_VARS['member_email']);
$member_password = htmlentities(md5($HTTP_POST_VARS['member_password']));

$query = 'SELECT * FROM members '."where member_email='$member_email'" . "and member_password='$member_password'" . "and member_teamid='$team_url'";
$result = mysql_query($query);

if (mysql_num_rows($result) >0 )

{


$HTTP_SESSION_VARS['valid_user'] = $member_email;
$HTTP_SESSION_VARS['valid_teamid'] = $member_teamid;

} 

}

if (isset($HTTP_SESSION_VARS['valid_user']))

{

echo 'Welcome '.$HTTP_SESSION_VARS['valid_user'].'';
echo $member_username;

mysql_query("UPDATE members SET member_loggedin=member_loggedin+1 WHERE member_email = '".$HTTP_SESSION_VARS['valid_user']."'");

}
  
else

{

if (isset($member_email))

{
  
echo("You Could Not Be Logged In");

}

?>
<table width="100%" cellpadding="0" cellspacing="0" border="0" height="60">
<tr> 
<td width="50%" height="20" valign="middle"> <strong>Username:</strong></td>
<td width="50%" height="20" valign="middle"><input class="loginform" type="text" name="member_email"></td>
</tr>
<tr> 
<td width="50%" height="20" valign="middle"> <strong>Password:</strong></td>
<td width="50%" height="20" valign="middle"><input class="loginform" type="password" name="member_password"></td>
</tr>
<tr> 
<td width="50%" height="20" valign="middle"> <strong><a href="forgot_password.php">Forgot Password?</a></strong></td>
<td width="50%" height="20" valign="middle"><input class="loginform" type="submit" value="Login"></td>
</tr> 
</table>
</form> 

 

Everything works fine but id like to set another session variable for "$member_username"

 

At the moment, valid_user is the email address, but im not sure how to create a valid_username part for a session, where it gets the members username from the database.

 

Any ideas guys?

 

Thanks

Dane

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.