A Session quandry
Posted: Wed Apr 25, 2007 4:58 pm
I have a script - home_page.php - with a link to - comment.php. visitor hits the link, fills out the form, submits the form to the top of the page via <form action="$_SERVER['PHP_SELF']" method="POST" If all is well the visitor lands on - message_page.php - with a success message.
It works fine.
Now, I need to create a session so a person cannot go directly to the -comment.php page without first entering the site through the index.php ~ home_page.php - and if he tries, he is redirected to the index.php page. so far so good.
So...
I have a script - index.php - that assigns a $_SESSION variable then sends the visitor to - home_page.php. The - comment.php - page link is still there and both pages - home_page.php and comment.php - have the $_SESSION variable that was created in Index.php.
Now the problem:
the visitor fills out the form on the - comment.php - page, this time, however, with sessions - the submit button (with the action="$_SERVER[PHP_SELF]") does not work. Instead, only the page url is sent (file/comment.php) and not the entire URL with host (mysite.com/file/comment.php) causing an error message.
I can subsitute $_GET instead of $_POST and it works. I can leave off $_SERVER[PHP_SELF]" and just use action="" and it works.
To make matters worse - It does work on some computers - my Server admin got it to work on everything he tried, and it was verified, but I can't get it to work on anything in the country that I have tried.
There must be a simple fix but after a week and a half working tirelessly I can't seem to find it.
David
It works fine.
Now, I need to create a session so a person cannot go directly to the -comment.php page without first entering the site through the index.php ~ home_page.php - and if he tries, he is redirected to the index.php page. so far so good.
So...
I have a script - index.php - that assigns a $_SESSION variable then sends the visitor to - home_page.php. The - comment.php - page link is still there and both pages - home_page.php and comment.php - have the $_SESSION variable that was created in Index.php.
Now the problem:
the visitor fills out the form on the - comment.php - page, this time, however, with sessions - the submit button (with the action="$_SERVER[PHP_SELF]") does not work. Instead, only the page url is sent (file/comment.php) and not the entire URL with host (mysite.com/file/comment.php) causing an error message.
I can subsitute $_GET instead of $_POST and it works. I can leave off $_SERVER[PHP_SELF]" and just use action="" and it works.
To make matters worse - It does work on some computers - my Server admin got it to work on everything he tried, and it was verified, but I can't get it to work on anything in the country that I have tried.
There must be a simple fix but after a week and a half working tirelessly I can't seem to find it.
David