Search Results

Search found 3 results on 1 pages for 'joshholat'.

Page 1/1 | 1 

  • Best way to handle PHP sessions across Apache vhost wildcard domains

    - by joshholat
    I'm currently running a site that allows users to use custom domains (i.e. so instead of mysite.com/myaccount, they could have myaccount.com). They just change the A record of their domain and we then use a wildcard vhost on Apache to catch the requests from the custom domains. The setup is basically as seen below. The first vhost catches the mysite.com/myaccount requests and the second would be used for myaccount.com. As you can see, they have the exact same path and php cookie_domain. I've noticed some weird behavior surrounding the line below "#The line below me". When active, the custom domains get a new session_id every page load (that isn't the same as the non-custom domain session). However, when I comment that line out, the user keeps the same session_id on each page load, but that session_id is not the same as the one they'd see on a non-custom domain site either despite being completely on the same server. There is a sort of "hack" workaround involving redirecting the user to mysite.com/myaccount, getting the session ID, redirecting back to myaccount.com, and then using that ID on the myaccount.com. But that can get kind of messy (i.e. if the user logs out of mysite.com/myaccount, how does myaccount.com know?). For what it's worth, I'm using a database to manage the sessions (i.e. so there's no issues with being on different servers, etc, but that's irrelevant since we only use one server to handle all requests currently anyways). I'm fairly certain it is related to some sort of CSRF browser protection thing, but shouldn't it be smart enough to know it's on the same server? Note: These are subdomains, they're separate domains entirely (but on the same server). <VirtualHost *:80> DocumentRoot "/opt/local/www/mysite.com" ServerName mysite.local ErrorLog "/opt/local/apache2/logs/mysite.com-error.log" CustomLog "/opt/local/apache2/logs/mysite.com-access.log" common <Directory "/opt/local/www/mysite.com"> AllowOverride All #php_value session.save_path "/opt/local/www/mysite.com/sessions" php_value session.cookie_domain "mysite.local" php_value auto_prepend_file "/opt/local/www/mysite.com/core.php" </Directory> </VirtualHost> #Wildcard (custom domain) vhost <VirtualHost *:80> DocumentRoot "/opt/local/www/mysite.com" ServerName default ServerAlias * ErrorLog "/opt/local/apache2/logs/mysite.com-error.log" CustomLog "/opt/local/apache2/logs/mysite.com-access.log" common <Directory "/opt/local/www/mysite.com"> AllowOverride All #php_value session.save_path "/opt/local/www/mysite.com/sessions" # The line below me php_value session.cookie_domain "mysite.local" php_value auto_prepend_file "/opt/local/www/mysite.com/core.php" </Directory> </VirtualHost>

    Read the article

  • Dismissing iPad UIPopoverController when BarButtonItem is pushed while it's open

    - by joshholat
    Using a split view on the iPad, I have the following code: - (void)splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController:(UIPopoverController*)pc { barButtonItem.title = @"Categories"; NSMutableArray *items = [[toolbar items] mutableCopy]; [items insertObject:barButtonItem atIndex:0]; [toolbar setItems:items animated:YES]; [items release]; self.popoverController = pc; } This works well to show the popover when the button is pressed. However, I'd also like to have the popover dismiss if the button is pressed while it is already open to follow good guidelines. How would I go about doing this? (i.e. if the user repeatedly clicks this button, the popover should come and hide every other hit.)

    Read the article

  • Dismissing iPad UIPopoverController from within it's content controller

    - by joshholat
    So I have a popover with a button in it. When that button is pushed, I want the popover to go away. It seems easy enough, but I can't figure it out for the life of me. The code I use to show the popover is below: AddCategoryViewController* content = [[AddCategoryViewController alloc] init]; UIPopoverController* aPopover = [[UIPopoverController alloc] initWithContentViewController:content]; aPopover.delegate = self; [content release]; // Store the popover in a custom property for later use. self.addCategoryPopover = aPopover; [aPopover release]; [addCategoryPopover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; Within the addcategoryviewcontroller, I have: -(IBAction)saveAddCategory:(id)sender { if (rootViewController == nil) rootViewController = [[RootViewController alloc] init]; [rootViewController.addCategoryPopover dismissPopoverAnimated:YES]; [rootViewController dismissPopover]; } Rootviewcontroller is where the popover is being created from. Unfortunately, neither of those methods work to dismiss it. any help?

    Read the article

1