My session seems to only be valid in the current window/tab. Also it seems to timeout quickly. Heres how I'm currently attempting to do it:
This is in my login controller:
$adapter = $this->getAuthAdapter($data);
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($adapter);
if (!$result->isValid()) {
$this->view->err = "Invalid username or password.<br/>Please try again.";
return $this->render('index'); // re-render the login form
}
Zend_Session::rememberMe(60*60*24*7*4);
And this is in my bootstrap:
Zend_Session::start();
I'm relatively new to some of this stuff, so bear with me! Any help would be greatly appreciated.
Here's what was happening. This website was on a server sharing a sessions folder with another website on the server. Even though I increased session lifetime with ini_set, my sessions were still being deleted by the other application.
To solve this I simply set session.save_path to a new folder. Problem solved!
I just want to add that you change the session.save_path in the .htaccess with the follow row to make it work. I saw the answer thought I changed it in the .ini, but it's in the .htaccess.
For example:
php_value session.save_path /home/kaos/data/sessions/
Looking through the source for zend_session, the rememberMe() method calls rememberUntil() which calls the built in php method session_set_cookie_params()
So you may wish to check your php.ini values for session.cookie_lifetime. If it isn't 0, then Zend_Session::rememberMe() would be useless unless the value is less than session.cookie_lifetime. In which case you would want to set it to 0 in either php.ini or in your application using ini_set() as indicated in the first comment on the session.cookie_lifetime man page.
Related
I'm working on my first app in PhalconPHP so I'm deep in the documentation while working, but this doesn't seem to be covered.
Let's say that my app is running on www.myapp.tld. In some situations I need to redirect the user back to the home page and for that I'm using the following code:
if ($haveToRedirect) {
$this->response->redirect();
$this->view->disable();
return;
}
Instead if redirecting to www.myapp.tld, the user is redirected to www.myapp.tld/index. I've tried different redirect calls, but all give the same result:
$this->response->redirect('');
$this->response->redirect('/');
$this->response->redirect('/', TRUE);
In the app's bootstrap I've set the BaseUri to be '/':
$di->set('url', function() {
$url = new Phalcon\Mvc\Url();
$url->setBaseUri('/');
return $url;
});
Is there a way to avoid "index" being added and just have it redirect to "www.myapp.tld"?
If a file is not specified, you will be directed to the index page in that directory by default. You need to specify a file location. Also try URI, not URL
The cause of redirection to "/index" was actually in the Permission class I made several weeks ago. It had:
$this->response->redirect('index');
for every controller that guest could not access to. Since I added new controllers I was continuously redirected to index, and noticed that redirect comes from somewhere else when I removed the conditional redirects I've put in the controller.
Anyway, this is it. Lesson learned - next time grep for 'index' before asking for help. :)
I am getting a problem at the time of account creation in magneto. it starts loading and not redirect on index page but data saved in database and redirect URL is empty when i checked.
Even not send account confirmation mail if required confirmation enabled.
please help and tell me what setting should be done here because it's working on local but not on live.
You might use the custom extension for that registration.
Or, the AccountController might be rewritten by the other module.
Please check it ( \app\code\core\Mage\Customer\controllers\AccountController.php )
createPostAction()
And also, in your site the magento session might not work properly.
OK, i got the solution as in app\code\core\Mage\Customer\controllers\AccountController.php $url = $this->_welcomeCustomer($customer); was empty so i replaced it with $url = Mage::getBaseUrl()."customer/account/index/"; and it's working.
I need some help troubleshooting.
I've just upgraded my 1.3 site to 2.0 (with the intent of going on to 2.1). I get the actual page running, content is read from DB etc, but I cannot log in to the admin panel!
Just to make sure I didn't forget the password I did
<?php echo sha1('password' . 'salt'); ?>
Taking the salt from the DB, and the output is the same as is stored in the DB. But still I cannot log in. The log in prompt just reloads, no error message or anything. Any ideas?
I've also tried clearing cache/sessions/etc, and even a different browser to no affect.
Crossposted from the PyroCMS forum: https://www.pyrocms.com/forums/topics/view/19323
OK, since there doesn't seem to be any good suggestions found either here or on the PyroCMS forums and my site is very small content wise I decided to just wipe everything and do a clean install of the latest build instead.
Not a very good solution for future reference, but it will have to do.
From my checklist (it's been a while since I had this happen to me):
If you didn't get an incorrect password error, it may well be you were just being redirected back to the login page before the details were even checked. You can run into issues with enabling the 'Remove index.php from URL' in .htaccess - in /system/cms/config/config.php try changing
$config['index_page'] = 'index.php';
to $config['index_page'] = '';
or (as you've hinted):
clear the contents of default_ci_sessions table
clear the cookies for the domain (a quicker way is to just open a new Google Incognito window which won't have any cookies).
Also - you can initiate a password reset for the admin password using the ordinary user login form if you or someone else does ever forget it (don't though).
I started using facebook php sdk with codeigniter but since then the urls on my website all have a 'PHPSESSID' added to the end.
I created a config file containing the app id and secret and used the following code to load the library.
$this->load->library('facebook');
Does anybody know of a workaround to this problem??
The Facebook script uses PHP native sessions. You can change this in your php.ini file:
# set
session.use_cookies = 1
# to
session.use_cookies = 0
http://www.webune.com/forums/disable-phpsessid-phpini.html
Instead of changing php.ini setting I went ahead and replaced the $_SESSION usages in facebook.php with Codeigniter sessions $this->session->set_userdata(). Works for me till now. Not very foolproof I guess.
Just figured it out:
php.ini
session.use_trans_sid = 0
This will hide (make intransparent / invisible) all the PHPSESSID from your URLs.
I have a toy facebook app I'm playing with so I can understand how it all works. It's fine if you go the the app like this: http://apps.facebook.com/pushup-challenge/ (and connect it). But if you then go to it from your facebook page, FB uses the URL http://apps.facebook.com/pushup-challenge/?ref=bookmarks.
In my log file, I see that FB is POSTing the data and including the /?ref=bookmarks to it's call to my codeigniter system. This is causing it to either say "invalid URI parameters" or give me a 404, depending on if I've edited the system/core/URI.php file to add rawurlencode() to a particular call.
I've tried using mod_rewrite to get rid of the query_string, too, but since it's POSTing, it doesn't appear to be working (though I'm not exactly sure why).
Has anyone else run into this? How did you fix it?
Thanks in advance,
Hans
try $config['uri_protocol'] = “PATH_INFO”; and set enable_query_strings = TRUE
or
set
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-?=';
in config.php
Because it isn't calling your file by name (just ?ref=bookmarks) the server runs thru the standard default files: index.htm, index.html, index.asp. Because you need to accept a POST, you need a server that allows POSTs to htm & html if you choose to use those. Index.asp will accept POSTs on most servers, and that works for me.
SOLUTION: Add a file (index.asp), that calls the real app that you named in the App settings.