goodrichdesigns Posted April 23, 2008 Share Posted April 23, 2008 I have a PHP calendar set up that functions using a CMS back-end system. I've installed it however I'm having problems with the login. Quite often, after I have already logged in, I will go to do something e.g. edit an existing event, and it will suddenly ask me for my login again and then I have to start over. Does any have any idea why this could be? I'm fairly new to PHP so apologies if I'm being noobish! Quote Link to comment https://forums.phpfreaks.com/topic/102568-solved-why-do-i-keep-getting-logged-out-of-cms/ Share on other sites More sharing options...
jonsjava Posted April 23, 2008 Share Posted April 23, 2008 does the top of the pages you go to (in the code, not the HTML) have <?php session_start(); ? Quote Link to comment https://forums.phpfreaks.com/topic/102568-solved-why-do-i-keep-getting-logged-out-of-cms/#findComment-525202 Share on other sites More sharing options...
goodrichdesigns Posted April 23, 2008 Author Share Posted April 23, 2008 Not exactly that though it does contain settings for creating a session. I'm afraid my knowledge of sessions and cookies via PHP is relatively poor. I have attached the page which is the main admin page. If you could have a quick look at it that'd be awesome. Thank you for your help [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/102568-solved-why-do-i-keep-getting-logged-out-of-cms/#findComment-525217 Share on other sites More sharing options...
jonsjava Posted April 23, 2008 Share Posted April 23, 2008 Sorry, but there is no way I can verify that this code is good, because it calls too many includes (1 is too many, if we don't know what it is including [variable wise]). Quote Link to comment https://forums.phpfreaks.com/topic/102568-solved-why-do-i-keep-getting-logged-out-of-cms/#findComment-525232 Share on other sites More sharing options...
goodrichdesigns Posted April 23, 2008 Author Share Posted April 23, 2008 So are you saying that too many includes is causing the login issue? Quote Link to comment https://forums.phpfreaks.com/topic/102568-solved-why-do-i-keep-getting-logged-out-of-cms/#findComment-525240 Share on other sites More sharing options...
DeanWhitehouse Posted April 23, 2008 Share Posted April 23, 2008 no, where saying that we don't know what is happening in each include Quote Link to comment https://forums.phpfreaks.com/topic/102568-solved-why-do-i-keep-getting-logged-out-of-cms/#findComment-525263 Share on other sites More sharing options...
MadTechie Posted April 23, 2008 Share Posted April 23, 2008 Your Sessions are being wiped please note the code below Line 10+ if(!is_writable(session_save_path()))session_save_path("/tmp"); session_start(); ob_start(); $__SESSION__=$HTTP_SESSION_VARS['__SESSION__']; foreach($HTTP_POST_VARS as $k=>$v){ if(!is_array($v))${urldecode($k)}=urldecode($v); } Line: 82+ $page or $page = 'e'; if($page =="l"){ $HTTP_SESSION_VARS = array(); //This line will cause the problem header("Location: index.php"); exit; } EDIT: maybe try setting the Session to a var then setting them back after the call ie <?php session_start(); $tmpSession = $_SESSION; include "calander_admin_file.php"; $_SESSION = $tmpSession; ?> Quote Link to comment https://forums.phpfreaks.com/topic/102568-solved-why-do-i-keep-getting-logged-out-of-cms/#findComment-525273 Share on other sites More sharing options...
goodrichdesigns Posted April 23, 2008 Author Share Posted April 23, 2008 Okay, I have figured out (almost) what I need to do. Apparently Ito fix the login loop I need to check the cookie and session save locations in the php.ini file. However, I've never come across this before. How do I access it? Quote Link to comment https://forums.phpfreaks.com/topic/102568-solved-why-do-i-keep-getting-logged-out-of-cms/#findComment-525276 Share on other sites More sharing options...
MadTechie Posted April 23, 2008 Share Posted April 23, 2008 its probably here /usr/local/lib/php/php.ini i must ask, do you ONLY have this problem when you use he 'calander_admin_file.php' file ? if so, then your fix will probably not work Quote Link to comment https://forums.phpfreaks.com/topic/102568-solved-why-do-i-keep-getting-logged-out-of-cms/#findComment-525285 Share on other sites More sharing options...
goodrichdesigns Posted April 23, 2008 Author Share Posted April 23, 2008 No it happens with another admin CMS that is used for uploading podcasts that is also hosted on the same server. Quote Link to comment https://forums.phpfreaks.com/topic/102568-solved-why-do-i-keep-getting-logged-out-of-cms/#findComment-525291 Share on other sites More sharing options...
MadTechie Posted April 23, 2008 Share Posted April 23, 2008 could be the same type of problem.. if you use only the CMS and don't have this problem then i would blame the other "plugins/addons" the code for the calander looks out dated for example $HTTP_SESSION_VARS is the old way of setting sessions Quote Link to comment https://forums.phpfreaks.com/topic/102568-solved-why-do-i-keep-getting-logged-out-of-cms/#findComment-525305 Share on other sites More sharing options...
MadTechie Posted April 23, 2008 Share Posted April 23, 2008 i have created a revised version it may work.. it used the basic idea of the above code but takes into account the headers locations. of couse an include could also mess it up! backup your current file and remove the 2 from this file [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/102568-solved-why-do-i-keep-getting-logged-out-of-cms/#findComment-525311 Share on other sites More sharing options...
goodrichdesigns Posted April 23, 2008 Author Share Posted April 23, 2008 (Solved) Thanks man! That appears to have done the trick Quote Link to comment https://forums.phpfreaks.com/topic/102568-solved-why-do-i-keep-getting-logged-out-of-cms/#findComment-525330 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.