sgt_fireman Posted July 31, 2012 Share Posted July 31, 2012 Hello guys, so quite simply I've created a rather large PHP file for my website, everything works fine but for the last thing I need to basically take a session variable that a site sets, and be able to access it on the page of my other site that it re-directs to, I know this isn't possible because they're on different servers, and I can't use the database alternative of setting the value in a database and relaying it when I get to the other site because the piece of code that's on the first server is to be posted on a lot of websites, And I of course don't want my MySQL database details going out to other websites, So... anyone know any alternatives of transferring session variables? or alternatives to using session variables? Thank-you very much guys. Quote Link to comment https://forums.phpfreaks.com/topic/266508-carrying-session-variables-from-server-to-server/ Share on other sites More sharing options...
xyph Posted July 31, 2012 Share Posted July 31, 2012 You'd need to use a system like OAuth or similar. Cross-server authentication is quite complex, and I don't suggest trying to tackle it yourself unless you _really_ know what you're doing. Quote Link to comment https://forums.phpfreaks.com/topic/266508-carrying-session-variables-from-server-to-server/#findComment-1365764 Share on other sites More sharing options...
sgt_fireman Posted July 31, 2012 Author Share Posted July 31, 2012 Okay, I'll take a look into both of these now, Thank-you very much for the fast reply! Quote Link to comment https://forums.phpfreaks.com/topic/266508-carrying-session-variables-from-server-to-server/#findComment-1365767 Share on other sites More sharing options...
Pikachu2000 Posted July 31, 2012 Share Posted July 31, 2012 Maybe an explanation of why you're trying to do this, instead of how you're trying to do it would be helpful. Quote Link to comment https://forums.phpfreaks.com/topic/266508-carrying-session-variables-from-server-to-server/#findComment-1365769 Share on other sites More sharing options...
sgt_fireman Posted July 31, 2012 Author Share Posted July 31, 2012 Well, It's an advertising system that I've been setting up for the past few weeks, This is literally the last thing before completion, however when an image is pressed it already takes the money off the right account, but next it has to pay the right account, and to do this it must have some way of identifying the account, so in the MySQL database, there is a column for the website's domain, So my plan was to create a session on the original page with the advert on containing the website's domain name, then carry this to the engine, and basically say, WERE site = $_SESSION['site']; or whatever, then add the money that we owe them... and then I've recently realized, you ofc can't send session variables from one server to another, so this is why I'm searching for an alternative, Quote Link to comment https://forums.phpfreaks.com/topic/266508-carrying-session-variables-from-server-to-server/#findComment-1365772 Share on other sites More sharing options...
sgt_fireman Posted July 31, 2012 Author Share Posted July 31, 2012 I've found a possible other way of doing it.. Does anyone know if you can use $_SERVER['HTTP_REFERER'] to only echo a site domain? because with no other code, just by redirecting to a page and having echo $_SERVER['HTTP_REFERER']; on the page it gets the full domain of the page the user was on, it doesn't matter by the way if anyone can just type the URL in because no functions will happen unless the url excists in the database, anyway back to the question, does anyone know how to make the $_SERVER['HTTP_REFERER'] function only output the domain, for example I want the example.com not the example.com/testpage.php Thanks again guys, Quote Link to comment https://forums.phpfreaks.com/topic/266508-carrying-session-variables-from-server-to-server/#findComment-1365819 Share on other sites More sharing options...
Pikachu2000 Posted July 31, 2012 Share Posted July 31, 2012 It still isn't clear to me what the actual problem is in doing this. Why do you have to track both sides of the click? Why can't you just track which images are clicked on the site that is displaying them to deduce who owes what? Quote Link to comment https://forums.phpfreaks.com/topic/266508-carrying-session-variables-from-server-to-server/#findComment-1365820 Share on other sites More sharing options...
Christian F. Posted August 1, 2012 Share Posted August 1, 2012 The content of $_SERVER['HTTP_REFERER'] is not reliable, as it's sent by the client and easily manipulated. Even turned off, as I have it per default. As for your question: Find the first occurrence of /, as long as it's not part of the protocol definition. Then you can simply cut the string at that point. Quote Link to comment https://forums.phpfreaks.com/topic/266508-carrying-session-variables-from-server-to-server/#findComment-1365874 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.