By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

php session

P: 17
My Php page get expired in 15 min of no activity. But I didn't find any program code mentioning time limit for session expire. (I am sure)

So I thing it is default setting. How I can change it? I would like to set 2 hrs for session expire. And also after time limit i want to display message to user that 'Seesion expired. Pls try again' like that. After that page has to be loaded again. is it possible? How? Advance thanks. friends.
Dec 7 '11 #1
Share this Question
Share on Google+
6 Replies


100+
P: 1,059
take a look at that link
Dec 7 '11 #2

P: 78
There is no time limit for session expire. At the time of page load we start session I think we should write session at the very first line in our code <? session_start(); ?> and we can assign value to the seesion wherever we need in our page for axample at the time of button click like that.
Dec 9 '11 #3

P: 17
Pls , Can you explain, with little sample? Whether i need to place <? session_start(); ?> before </form>.. Thanks
Dec 9 '11 #4

P: 17
when using <? session_start(); ?> ..my variable values are reset. showing wrong answers.
Dec 9 '11 #5

zorgi
Expert 100+
P: 431
There is loads of examples on the page johny10151981 gave you. Just scroll down.
Dec 9 '11 #6

P: 78
Expand|Select|Wrap|Line Numbers
  1. <? session_start();
  2. include("connection.php");
  3. ?>
  4. <form id="form1" name="form1" method="get" action="">
  5.   <table width="22%" border="2">
  6.     <tr>
  7.       <td>Rate This Company</td>
  8.     </tr>
  9.     <tr>
  10.       <td><table width="200">
  11.         <tr>
  12.           <td><label>
  13.             <input type="radio" name="polling" value="2" />
  14.             Good
  15.           </label></td>
  16.         </tr>
  17.         <tr>
  18.           <td><label>
  19.             <input type="radio" name="polling" value="1" />
  20.             Poor
  21.           </label></td>
  22.         </tr>
  23.       </table>
  24.         <input type="submit" name="submit" value="VOTE" />
  25.         <label></label></td>
  26.     </tr>
  27. <?    
  28. if($submit)
  29.     {
  30.     echo $_SESSION['Voted'];    
  31.     if($_SESSION['Voted']=="")
  32.     {
  33.     $_SESSION['Voted'] =1;
  34.  
  35. $totalpoints = $_GET['polling'];
  36. mysql_query("update polling set TotalPoints = TotalPoints + $totalpoints where ID ='1'");
  37. }
  38. else
  39. {
  40. ?>
  41.  
  42. <script type="text/javascript">
  43. alert("You Have Already Voted");
  44. </script>
  45. <script type="text/javascript">
  46. window.location.href ="polling.php";
  47. </script>
  48. <?
  49. }
  50. }
  51.  
  52. ?>
  53.   </table>
  54. </form>
  55.  
  56.  
  57.  
Dec 9 '11 #7

Post your reply

Sign in to post your reply or Sign up for a free account.