fbrown Posted June 30, 2007 Share Posted June 30, 2007 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 Quote Link to comment Share on other sites More sharing options...
teng84 Posted June 30, 2007 Share Posted June 30, 2007 declare a session_start(); at the very top of the page hope that helps Quote Link to comment Share on other sites More sharing options...
fbrown Posted June 30, 2007 Author Share Posted June 30, 2007 lol the form is included in th index1.php lol and thats were the session start is but i have noticed that every tim you refresh or hit a link the SID changes like its being destroyed as soo as its created Quote Link to comment Share on other sites More sharing options...
teng84 Posted June 30, 2007 Share Posted June 30, 2007 where is that code and do you have any destroying a session? pls give an accurate code Quote Link to comment Share on other sites More sharing options...
fbrown Posted June 30, 2007 Author Share Posted June 30, 2007 i went to php.net looked up sessions and found somthing it worked i used <?php session_set_cookie_params(3600);?> the session life was set to 0 on the server Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.