Sort of a noob question: Changing variables in condition

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
smartassx
Forum Newbie
Posts: 2
Joined: Sun Apr 08, 2012 8:27 pm

Sort of a noob question: Changing variables in condition

Post by smartassx »

So i have been working on the code below and for some reason why i change the global variable in one if else statement and try to call it in another it doenst change the default value i have set
GLOBALS['somestuff'] is the variable to watch

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
</head>

<body>
C:\Python27\Lib\site-packages\dropbox-1.3\example\dropConnect.py
.$_POST['somearg']


<?php
	$GLOBALS['somestuff'] = 'xxxxxxxxxx';
    echo "A";
    if(isset( $_REQUEST['passwords']) )
    {
        echo "B";

        #exec("cmd /c C:\Python27\python.exe C:\Python27\Lib\site-packages\dropbox-1.3\example\dropConnect.py");
		
		
		$GLOBALS['somestuff'] = $_REQUEST['passwords'];

		echo "about to run a program with args ".$GLOBALS['somestuff'];
		
	}
	else
	{ 
        echo "C";
        
		 echo '<form method="GET">';
			echo '</br>';
			echo 'Passwords input (3, 8char or 3, 8 bytes of hex (0xXXXXXXXXXX format) passwords):';
			echo '</br>';
			echo '<input type="text" name="passwords" />';
			echo '<input type="submit" value="Submit" />';
			
		echo '</form>' ;
	  }
	
    echo "A";
    if(isset( $_REQUEST['somearg']) )
    {
        echo "B";

        #exec("cmd /c C:\Python27\python.exe C:\Python27\Lib\site-packages\dropbox-1.3\example\dropConnect.py");
		echo "about to run a program with args ".$_REQUEST['somearg'];
		echo "stuff";

		echo $GLOBALS['somestuff'];
	}
	else
	{ 
        echo "C";
       
		 echo '<form method="GET">';
		
			echo '</br>';
			echo 'Choose a file to upload: <input name="somearg" type="file" /><br />';
			echo '<input type="submit" value="Upload File" />';
			echo '</br>';
			
		echo '</form>'; 
	 }
	
?> 

 </body>

</html>


User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Sort of a noob question: Changing variables in condition

Post by Christopher »

What do you expect the values in $GLOBALS to be?
(#10850)
smartassx
Forum Newbie
Posts: 2
Joined: Sun Apr 08, 2012 8:27 pm

Re: Sort of a noob question: Changing variables in condition

Post by smartassx »

a global array i can access and change ...

i just want to echo out what i assign in the first conditional statement in the second..
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Sort of a noob question: Changing variables in condition

Post by Christopher »

So what gets echoed when the various combinations of $_REQUEST['password'] and $_REQUEST['somearg'] are passed?
(#10850)
Post Reply