Jump to content

Carrying session variables from server to server?


sgt_fireman

Recommended Posts

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.

Link to comment
Share on other sites

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,

Link to comment
Share on other sites

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,

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.