Jump to content

i need help with sessions


fbrown

Recommended Posts

i am hosting remotley and i am user session for authentication but somthin is messed up on there servers

uhm i cant recall how to allow error messages but if there is a nother method that is as reliable thet would be help full

 

 

 

 

the action

 

<?php




//setting vars and makeing sure there is an entry and avowding error
if (isset($_POST['name']) && ($_POST['pass_'])){
$username = $_POST['name'];
$password = $_POST['pass_'];


// loggin query 


require_once('Connections/mana.php');

mysql_select_db('desiredrfvtweb') or die('Could not select database');
$query = 'select user_id, pri from users where user_name= "'.$username.'" and password= "'.$password.'"';
$result = mysql_query($query) or die('Query Faild: '. mysql_error());

$success = mysql_numrows($result);




if (!$success){



$lgfaild = 'Loggin faild <br /> incorrect username<br /> or password';




}
else {
// seting session vars for privalige
$_SESSION['active'] = TRUE;
$_SESSION['loggedin'] = 'is_loged_in' ;
$_SESSION['user_id'] = $username;
if (isset($username)){
$_SESSION['pri'] = mysql_result($result,'0','pri');

$loggedin = $_SESSION['loggedin'] ;

}
else { $_SESSION['pri'] = FALSE ;}

}


mysql_free_result($result);
mysql_close($mana);







}
else {$action= 'nothing'; } ;






?>

 

 

 

the form

 

 

<?php if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == 'is_loged_in'){
$username = $_SESSION['user_id'];
echo 'welcome '.$username; } 
elseif (isset($lgfaild)){
echo $lgfaild. '<a href=?section=welcome>try again</a>';}
else { ?>







<style type="text/css">
<!--
.style1 {
color: #FF0000;
font-weight: bold;
}
-->
</style>



<form action="<?php echo $url;?>" method="post" name="login" onsubmit="MM_validateForm('name','','R','pass_','','R');return document.MM_returnValue">
  <table width="126" border="0" align="center">
      <tr>
        <td width="120">
    User Name </td>
      </tr>
      <tr>
        <td height="21">
          <input name="name" type="text" id="name" size="20" maxlength="20" class="eco">        </td>
      </tr>
      <tr>
        <td>Password</td>
      </tr>
      <tr>
        <td><input name="pass_" type="password" id="pass_" size="20" maxlength="20" class="eco"></td>
      </tr>
      <tr>
        <td align="right"><input type="submit" name="Submit" value="login" class="eco"></td>
      </tr>
      <tr>
        <td align="right"><div><a href="?section=register&logreq=forgot_pass">Forgot your password</a></div></td>
      </tr>
      <tr>
        <td align="right"><div align="right"><a href="?section=register&logreq=sign_up">Sign up</a></div></td>
      </tr>
    </table>
</form>
<?php }; ?>

the javascript was taken out

 

 

every thim you login it works your loged in but when you click a ling your kicked  i dont know y

 

home page kingtama.nrgervers.net remember its a work in progress

 

and add a / phpinfo.php to see the phpinfo

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.