Passing variables from a linux server to a windows server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
robster
Forum Contributor
Posts: 360
Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia

Passing variables from a linux server to a windows server

Post by robster »

Hi all,

I know there are a zillion pass variables threads but this one is strange.

I have a main server, linux based. Due to laziness and a good deal my storage server (for animation mpg video files etc) is the windows server.

I have a functional (until today) form that gets info from the database on the linux box and sends it to the windows box.

In the past it has worked fine. This day though, it decided to stop. I haven't changed the code at ALL, it just stopped.

I send it with submit then try and ready $submit at the other end and it tells me it can't read $submit on that end, though, some variables are DEFINATELY being passed, just not all of them.


Has anyone heard of such a thing? Why would it just change?

The ONLY thing that has happened in the time since I last used it successfuly (which was yesterday) is the host installed GD onto the windows server for me (the one not accepting the Submit variable it seems). Could this have done anything. SO VERY strange, and very anoying. I REALLY need this form working fast but I just can't figuire it out!


Thanks to anyone who can offer advice.

:)

Rob
User avatar
Sevengraff
Forum Contributor
Posts: 232
Joined: Thu Apr 25, 2002 9:34 pm
Location: California USA
Contact:

Post by Sevengraff »

are you accessing the data as $submit or $_POST['submit']?
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Code: Select all

echo '<pre>';
echo 'PHP Version: '.phpversion()."\n";
echo 'Register Globals: '.(ini_get('register_globals') == '' ? 'Off' : 'On')."\n";
echo '</pre>';
If you don't mind, try the following script and let us know what it returns. Sevengraff is on to something, and if correct we can use that as a guiding tool. ;)
User avatar
robster
Forum Contributor
Posts: 360
Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia

Post by robster »

Thanks for the help! :)

This is what it returns:

PHP Version: 4.3.1
Register Globals: Off


Now, I am sending the data like this from the linux server:

Code: Select all

// the values to be sent on again
print "<input type="hidden" name="animator" value="$animator" />";
print "<input type="hidden" name="title" value="$title" />";
print "<input type="hidden" name="hardware" value="$hardware" />";
print "<input type="hidden" name="software" value="$software" />";
print "<input type="hidden" name="creationtime" value="$creationtime" />";
print "<input type="hidden" name="rendertime" value="$rendertime" />";
print "<input type="hidden" name="viewrecommend" value="$viewrecommend" />";
print "<input type="hidden" name="descriptionofcreation" value="$descriptionofcreation" />";
print "<input type="hidden" name="animdescription" value="$animdescription" />";
print "<input type="hidden" name="forum_uid" value="$uid" />";
print "<input type="hidden" name="new_id" value="$id" />";
print "<input type="hidden" name="sound_id" value="$id" />";
print "<input type="hidden" name="sound_year" value="$year" />";
print "<input type="hidden" name="sound_month" value="$month" />";
print "<input type="hidden" name="entrynumber" value="$uid" />";
print "<input type="hidden" name="year" value="$year" />";
print "<input type="hidden" name="month" value="$month" />";
print "<input type="hidden" name="jpg" value="$jpg" />";
print "<input type="hidden" name="mpg" value="$mpg" />";
		
												
// the button	
print "<input type="submit" name="Submit" value="Edit your JPG"><br /><br />";

and from the windoze server I am trying to access it like so:

Code: Select all

//if the user presses the edit JPG button they get this :)
if ($Submit == "Edit your JPG")
&#123;
$animator = stripslashes($_POST&#1111;'animator']);
$title = stripslashes($_POST&#1111;'title']);	
$forum_uid = stripslashes($_POST&#1111;'forum_uid']);	
$new_id = stripslashes($_POST&#1111;'new_id']);
$sound_id = stripslashes($_POST&#1111;'sound_id']);
$sound_year = stripslashes($_POST&#1111;'sound_year']);
$sound_month = stripslashes($_POST&#1111;'sound_month']);
$jpg = stripslashes($_POST&#1111;'jpg']);	
$mpg = stripslashes($_POST&#1111;'mpg']);	
$year = stripslashes($_POST&#1111;'year']);	
$month = stripslashes($_POST&#1111;'month']);
&#125;
It has always worked until today... :(

Thanks for looking at this for me guys...

Rob
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Code: Select all

Register Globals: Off
...is the key.

Code: Select all

...
if ($Submit == "Edit your JPG")
{
$animator = stripslashes($_POST['animator']); 
...
<hint>You are using $_POST at all places, except $submit. ;)</hint>
User avatar
robster
Forum Contributor
Posts: 360
Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia

Post by robster »

see.. now I feel just plain stupid :)


Here is the correct code for anyone in the future:

Code: Select all

if (stripslashes($_POST&#1111;'Submit']) == "Edit your JPG")
					&#123;
						$Submit = stripslashes($_POST&#1111;'Submit']);
						$animator = stripslashes($_POST&#1111;'animator']);
						$title = stripslashes($_POST&#1111;'title']);	
						$forum_uid = stripslashes($_POST&#1111;'forum_uid']);	
						$new_id = stripslashes($_POST&#1111;'new_id']);
						$sound_id = stripslashes($_POST&#1111;'sound_id']);
						$sound_year = stripslashes($_POST&#1111;'sound_year']);
						$sound_month = stripslashes($_POST&#1111;'sound_month']);
						$jpg = stripslashes($_POST&#1111;'jpg']);	
						$mpg = stripslashes($_POST&#1111;'mpg']);	
						$year = stripslashes($_POST&#1111;'year']);	
						$month = stripslashes($_POST&#1111;'month']);
						
					&#125;

There is one more question now, and it's related (I am guessing my host changed globals to off last night?!)

I have this line of code:

Code: Select all

if ($_REQUEST&#1111;'submitted'])&#123; // Begin processing portion of script
and it produces this error:
Notice: Undefined index: submitted in path\hidden\for\security\upload.php on line 81

That code is taking form data from the SAME page on the windoze server (upoad.php) in this form:

Code: Select all

<input type="hidden" name="submitted" value="true">
<input type="submit" name="submit" value="Upload">

erm, I am lost now...

I just want to also thank you so much for helping me out you two :) I am really a newby and it was an easy oversight for me.
User avatar
Sevengraff
Forum Contributor
Posts: 232
Joined: Thu Apr 25, 2002 9:34 pm
Location: California USA
Contact:

Post by Sevengraff »

You could try to check if the variable exists

Code: Select all

if( isset($_REQUEST&#1111;'submitted']) ) &#123;
    // do things
&#125;
Or, check to see if any data was submitted at all

Code: Select all

if( !empty( $_POST ) ) &#123;
    // do things
&#125;
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

*waits for nay to yell about heardoc*.. :p
User avatar
robster
Forum Contributor
Posts: 360
Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia

Post by robster »

That last post lost me :)

The wierd thing is it is reporting that nothing has been posted even though it's printing variables from the post.... using your code:

if( !empty( $_POST ) ) {
 echo "erm, no data posted... bummer ";
}

It would print to the browser: erm, no data posted... bummer but it would also print variables sent from the linux server (in original post). If I submit on form on that page it also sends the same error (erm, no data posted... bummer).... so I am a bit lost now.


STRANGE indeed....

I guess I'll do some pokey jiggery and see what I come up with. Thanks everyone for your help, I REALLY appreciate it.

Well, thanks again!
I'll be sure to check back here incase someone has a suggestion.


:)

Rob
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

LiLpunkSkateR wrote:*waits for nay to yell about heardoc*.. :p
Hahaha... Now that you mention it...

@robster:
Never mind that post. You'll find out what that means when you've been around for a while, trust me. ;)
Post Reply