I am having a problem.
To access a database I need to use a different port in the url.
Example: (these aren't real pages just made up for examples)
I have a form on a page - https://mysite.com/form.php (it is https).
The action is to https://mysite.com/form_action.php which does all the error checking.
If it is all succesful I use a header function call to send the page to https://mysite.com:120/form.php (120 is a made up number). My service provider requires me to use a special port in the url to access my database.
When I do this I lose all of my session and cookie variables on the site. But I need them to insert the information in the database.
How can I access them across the port?
Or can I do a file include with a different port? Something like include(':120/filename.php').
I know that won't work but just a thought.
Please HELP!!!!!
Passing sessions or cookies across a different port
Moderator: General Moderators
Re: Passing sessions or cookies across a different port
So you have a database with (session_id, session_data).awolfe76 wrote: If it is all succesful I use a header function call to send the page to https://mysite.com:120/form.php (120 is a made up number). My service provider requires me to use a special port in the url to access my database.
When I do this I lose all of my session and cookie variables on the site. But I need them to insert the information in the database.
You know the user's session_id (seesession_id and session_name).
You've got two options: include("https://myhost.example.com/whatever.php ... session_id");
or header("Location: http://myhost.example.com/whatever.php? ... session_id");
Not quite. Let me tell you more.
This is a user application to get access to web pages.
I can connect to the database fine.
I am using the specific port in the URL to access the database....but I can't to my form validation with a page that has the port in the URL because that port is not configured correctly to handle post variables.
So I do all the form validation without the port.
Then if all of that is ok I use the header call : (notice the :120)
to send the information to a page the connects to the database and does all database actions.
I know I could add the data to the end of the URL but I don't want to do that. I would have to pass something like 20 variables that way and that would just be a mess. 20 because of all the information that would need to be submitted.
So I tried setting all this in session variables (some are arrays). But when I send the page to the database connection and processing page using the port in the URL I don't get my sessions.
So I can't insert, select, or anything on the database. The database table name is also passed as a session. So I can't access the table in the database without the table name (no kidding).
Can I do this :
from within a page not using the port??? Again notice the :120
Then do all the database actions.
Is there another way to pass the user information across to the other port or another way to do this all together?
I have been racking my brain for sometime and can find nothing.
Maybe its just not possible and the provider will have to either configure the port to handle post variables - problem solved - or they will have to configure PHP properly so that I don't have to use the port to connect to the database - also problem solved.
Let me know if you know of a way without the provider having to change anything.
Thanks.
This is a user application to get access to web pages.
I can connect to the database fine.
I am using the specific port in the URL to access the database....but I can't to my form validation with a page that has the port in the URL because that port is not configured correctly to handle post variables.
So I do all the form validation without the port.
Then if all of that is ok I use the header call :
Code: Select all
header("Location: http://myhost.example.com:120/whatever.php);to send the information to a page the connects to the database and does all database actions.
I don't have the session_id or session_name in the database. Its not needed...yet.So you have a database with (session_id, session_data).
I know I could add the data to the end of the URL but I don't want to do that. I would have to pass something like 20 variables that way and that would just be a mess. 20 because of all the information that would need to be submitted.
So I tried setting all this in session variables (some are arrays). But when I send the page to the database connection and processing page using the port in the URL I don't get my sessions.
So I can't insert, select, or anything on the database. The database table name is also passed as a session. So I can't access the table in the database without the table name (no kidding).
Can I do this :
Code: Select all
include("https://myhost.example.com:120/whatever.php");Then do all the database actions.
Is there another way to pass the user information across to the other port or another way to do this all together?
I have been racking my brain for sometime and can find nothing.
Maybe its just not possible and the provider will have to either configure the port to handle post variables - problem solved - or they will have to configure PHP properly so that I don't have to use the port to connect to the database - also problem solved.
Let me know if you know of a way without the provider having to change anything.
Thanks.