
Joshua4550
Members-
Posts
148 -
Joined
-
Last visited
Never
Everything posted by Joshua4550
-
header() function is killing my sessions?
Joshua4550 replied to Joshua4550's topic in PHP Coding Help
Hmm. Seems to work, after clearing all existing cookies xD Idk why, but thanks bud. -
header() function is killing my sessions?
Joshua4550 replied to Joshua4550's topic in PHP Coding Help
I used print_r() on the page, it printed out the value of the session when not on a subdomain, but when on a subdomain it prints NOTHING. This means that the session is EMPTY on any subdomain? Wtf is wrong? -
header() function is killing my sessions?
Joshua4550 replied to Joshua4550's topic in PHP Coding Help
Define examine. Do you want me to print them? -
header() function is killing my sessions?
Joshua4550 replied to Joshua4550's topic in PHP Coding Help
Guess noone knows since you all left. -
header() function is killing my sessions?
Joshua4550 replied to Joshua4550's topic in PHP Coding Help
If this script is interrupting the sessions, then I probably have an alternative solution. -
header() function is killing my sessions?
Joshua4550 replied to Joshua4550's topic in PHP Coding Help
I don't really know how i'd go about testing that, tbh. But this is the script which all subdomains redirect to: <?PHP session_set_cookie_params(0, '/', '.example.net'); SESSION_START(); $subdomain = str_replace("example.net", "", str_replace(".example.net", "", $_SERVER['HTTP_HOST'])); // Detect whether we're on the main website or a subdomain if ($subdomain == "www" || empty($subdomain)) { // On the main website header("Location: /title.php"); } else { // On a subdomain header("Location: /site/" . $subdomain ); } ?> Would this script interrupt the sessions at all? -
header() function is killing my sessions?
Joshua4550 replied to Joshua4550's topic in PHP Coding Help
Session is set from: http://www.example.net/login.php Then the session works on: http://www.example.net/site/hello But does NOT work on: http://hello.example.net/site/hello Note: I have a wildcard dns record set which redirects all subdomains to one script on the main domain, and then the main domain asks if theres a subdomain.. if so uses header() to send them to another script.. but the sessions dont work here. If I just go to www. the sessions DO work. -
header() function is killing my sessions?
Joshua4550 replied to Joshua4550's topic in PHP Coding Help
The session is being set from www. or no subdomain, and then it can be accessed from ww. or no subdomain, but if i use a subdomain.. BOOM it wont work. I do still have this on each page though: session_set_cookie_params(0, '/', '.example.net'); SESSION_START(); -
header() function is killing my sessions?
Joshua4550 replied to Joshua4550's topic in PHP Coding Help
Still no workie. Lol -
header() function is killing my sessions?
Joshua4550 replied to Joshua4550's topic in PHP Coding Help
Okay, well I now have this in each page: session_start(); session_set_cookie_params(0, '/', '.example.net'); But after a session is set, if i go to a subdomain.. it doesn't seem to work. Or maybe I have to set the params before starting the session? -
header() function is killing my sessions?
Joshua4550 replied to Joshua4550's topic in PHP Coding Help
Lol, yes. Thanks. One last thing: Would 0 enable the lifetime to ulimited? session_set_cookie_params(0, '/', '.example.com'); yes? -
header() function is killing my sessions?
Joshua4550 replied to Joshua4550's topic in PHP Coding Help
Atm im using sessions Simple $_SESSION['hello'] = "true"; -
header() function is killing my sessions?
Joshua4550 replied to Joshua4550's topic in PHP Coding Help
Yes. They can use a subdomain, because I have set a wildcard dns record to redirect all subdomains to my one script which then checks the subdomain, puts it into a var and checks it.. then it uses header() How can this be fixed so that my sessions stay the same? -
Hey guys, I have recently made progress on my site, but came to do something savvy with it, and something has started destroying my session vars. Say I had $_SESSION['hello'] set to "true", when a user visits one page, it asks for $_POST details, and depending on what the post details are.. uses the header() function to redirect the user to a page to edit their website. My only problem is that if they go to this script after having the session "hello" set, when they're redirected by the header() function, the session isn't set anymore? Is there a quick solution to this, or should I just use cookies for this?
-
Thanks alot, and thank you for explaining it nicely. I'll replace all uses of ereg or eregi with preg_match in my sources, thanks for telling me about that!
-
Hey guys, I REALLY can't get my head around this RegEx shit.. not quite sure why though, anything I try doesn't work.. even with this simple regex i need. Can anybody tell me the regex for any number, letter, period or underscore? I think I'll be using eregi for it, unless you suggest something more efficient. This is because i need to check a string to see whether it contains anything that is NOT this, then I can give the user an error. Thanks.
-
Works a charm! Thank you very much, thanks for being so calm and understanding, and for helping me!
-
Okay, but it seems to not work. Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_URI} !-f RewriteCond %{REQUEST_URI} !-d RewriteRule site/^(.*)$ /site.php?s=$1 http://site.com/site/hi Not Found The requested URL /site/hi was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
-
Okay thanks - but one thing. What about if I wanted to do it so they have to put the username after /site such as site.com/site/USERNAME Because i'm guessing i can't just stick /site/ infront of the RegEx?
-
Sorry, i'm REALLY new to this - so PLEASE excuse me. I'm probably going to research some tomorrow, but it's late atm. What exactly would that one do?
-
Oh, and on the redirection - to avoid image/js/css collision, I could just redirect from a URL which doesnt exist, such as site.com/site/WHATEVERHERE which redirects to site.com/site.php?s=WHATEVERHERE This will stopp the collision with css/js/imgs won't it? Since the directory /site doesn't actually exist, it's just what the users will type
-
Oh, I thought reqriting worked both ways... In which case, what I actually needed was site.com/USERNAME to send them to site.com/site.php?s=USERNAME Would the concept be the same? And/or still easy?
-
Thanks. Is there anything I need to include before that in the .htaccess file? (I read other things on tuorials around the web)
-
Okay, well my main aim to use this for is for the following: converting- site.com/site.php?s=ANYTHINGHERE to- site.com/ANYTHINGHERE (And maybe the opposite way around too, so they can type either one) I'm guessing this cannot be too difficult? Thanks!
-
Any idea how?