Page 1 of 1

Calling a url with parameters...hidden

Posted: Tue Sep 28, 2004 10:32 pm
by Burrito
This should be a relatively easy question to answer. I have a page that does some processing that I would like to call from a form action page. More specifically, I"m going to be uploading a log file and then parsing that log file to insert data into a database.

the page I'm using to parse the log files requires a url variable that I do NOT want my end users to see.

I was thinking of doing something along the lines of:

Code: Select all

<?php
if (isset($_FILES['attachfile']['tmp_name']) && !empty($_FILES['attachfile']['tmp_name']) && file_exists($_FILES['attachfile']['tmp_name']))
{
move_uploaded_file($_FILES["attachfile"]["tmp_name"],"tempupload/".$_FILES["attachfile"]["name"]);
}

include("myParserFile.php?hiddenvar1=bob&hiddenvar2=larry");

?>
but I"m pretty sure that won't work (doing it as an include).

do I need to use fsockopen() to make this work the way I want it to? If so, can someone please provide me with some guidance as to the syntax to use with fsockopen().

thx for your time,

Burr

Posted: Tue Sep 28, 2004 11:31 pm
by feyd
you can use the include, you don't need to pass any variables to it through.. everything available to the including script at that point, is accessible to the included script.

Posted: Tue Sep 28, 2004 11:35 pm
by Burrito
Ya, I understand that, but I don't want my address bar to read:

"www.mydomain.com/myfolder/mypage.php?myvar=1&myvar2=2"

the idea was to hide the url vars.

Does that make more sense?

burr

Posted: Tue Sep 28, 2004 11:50 pm
by feyd
that include wouldn't change your address bar. The including page would be the address bar. So it'd be whatever your original form posted to.

Posted: Tue Sep 28, 2004 11:56 pm
by Burrito
OK, I dont' think I'm explaining myself well enough so let me try again.

I want on my form action page to call my parser page (which requires a url var). I don't want to use an include because I don't want my address line to have the url var in it....I want that var to be hidden.

this is why I would need to do something like:

include("myParserpage.php?myvar=value");

but that doesn't work. I can't pass url vars in the include statement. I don't want to just use the include because in my "parent" page, it won't have any $_GET['vars'] because there won't be any in the actual url of the page. So I need something else to call that parser page that I can pass url vars with. I'm fighting with fsockopen() but can't seem to get a handle on it.

any other ideas?

thx,

Burr

Posted: Tue Sep 28, 2004 11:59 pm
by feyd
you can create the $_GET var it'd need...

form

Posted: Wed Sep 29, 2004 2:40 am
by phpScott
Is the page that might use the include the acutal page that is being called for from the form?

If myParsePage.php is not the page that your form is being submitted to then using an include is fine as all the values in the page are going to be there. If that is going to work then in the background on the submitted page create the url that you need with they myParse=value along with all the other values that are required in myParsePage.php and do a php redirect to the new page.

Does that make any sense?