PHP form issue

I'm tracking through someone elses code.  
I have a form page, it's supposed to login to a database and bring back some user info.
This was working fine on a previous Linux box. I recently moved the code over to a new box and I'm having problems getting the login to work.
What happens when I press on the "Login" button (See attached) is the page just refreshes and the login info in the input boxes disappears. No errors anyplace. I have verified that PHP is up and running on my new box (I have other php pages that work fine on other sites).
I'm thinking I either 1. Missed something really simple in the move or 2. There is some incompatibility with my current box/version/etc...  The OS on both boxes is RedHat, albeit a newer version on this current box.

I'm putting 'echos' thoughout the code to see where I get.
In this snip below, I get into the " if(!$this->FormSubmitted line 105)  which I'm thinking is saying my Form isn't being submitted but I don't know how/why I would get here.  I'm assuming I should be getting down past this line and to line 109.

Any ideas? Thanks so much.
here is the code where this happens:

//Operation Method @2-3942470C
     96     function Operation()
     97     {
     98         if(!$this->Visible)
     99             return;
    101         global $Redirect;
    102         global $FileName;
    104         if(!$this->FormSubmitted) {
    105 echo 'I am here but should I be';
    106             return;
    107         }
    109         if($this->FormSubmitted) {
    110             $this->PressedButton = "Button_DoLogin";
    111             if(strlen(CCGetParam("Button_DoLogin", ""))) {
    112                 $this->PressedButton = "Button_DoLogin";
    113             }
    114         }
    115         $Redirect = $FileName;
    116         if($this->Validate()) {
    117             if($this->PressedButton == "Button_DoLogin") {
    118                 if(!CCGetEvent($this->Button_DoLogin->CCSEvents, "OnClick")) {
    119                     $Redirect = "";
    120                 }
    121             }
    122         } else {
    123             $Redirect = "";
    124         }
    125     }
    126 //End Operation Method

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

is it using the same version of php

try copying the code and start fresh php file and copy in the contents and see if that helps
Ray PaseurCommented:
Suggest you run phpinfo() on both installations and compare the output line-for-line.  Many "little things" like magic quotes and register globals can trip up a move from one machine to another.  It may also be worth refactoring this code.  The use of "global" declarations inside a function is not a very good design paradigm.

If you're looking for PHP authentication, you might find some good ideas in this article.
nachtmskAuthor Commented:
Ray - thanks.
Unfortunately the other box is offline so I am just left this this new box  :(
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Ray PaseurCommented:
Is this on a public facing computer?  If so, please post a URL so we can take a look a the phenomenon in action.  Maybe we can spot something or at least suggest some debugging steps.
nachtmskAuthor Commented:
Ray .. yep.
here is the URL. Click on the link it provides. Try to login with anything. It should return an error message with an incorrect login but it returns back to itself.

You will see some var_dump outputs at the top of the page ;)

Ray PaseurCommented:
Suggest you add this right at the top of Login.php.  The code might not need to email this information.  It might be OK to print it right on the page, but there is a risk that starting browser output too early may break the cookies, and thus break the session.  A safe way to test this would be to remove everything from line 12 on down.


echo PHP_EOL . "GET ";   var_dump($_GET);
echo PHP_EOL . "POST ";  var_dump($_POST);
echo PHP_EOL . "COOKIE ";var_dump($_COOKIE);
echo PHP_EOL . "SESSION ";var_dump($_SESSION);

$vardump = ob_get_clean();

mail('', 'VARDUMP', "$vardump");

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nachtmskAuthor Commented:
Thanks, I put that code in. If you are looking at the page you will see the output up top.
It's telling me that the username and password are being passed. I'm not sure where it's dying though.
I'm thinking the problem must be something more overall then this because it was working fine on the older box.
Question--- do certain ENV vars need to be set in order to make PHP work?
Did I mention I'm not really a PHP programmer -- I'm more C and Perl.

Ray PaseurCommented:
Any chance you can get the old box back online, even for a moment?  What you would really like to do is run this script on both of them and compare the output line-for-line.
<?php phpinfo();

Open in new window

The short answer about the ENV vars is, "Yep there are things that matter in the PHP environment."

If you cannot get both of the boxes operational so you can compare the PHP environments, please install that script on the new box and post a link to it.  You can take it down later - I would just like to see what's in the new configuration.  Maybe it will suggest something.
nachtmskAuthor Commented:
No chance on the old box, it's wiped.
Here is

Thanks SO much for this help.

nachtmskAuthor Commented:
I'm really thinking it must be some global server thing I'm missing.
Gotta run out now. Thanks for all your help. I'll check back on this later this afternoon.
Ray PaseurCommented:
This is a guess, but should be easy enough to test.  Try using php.ini to turn these two directives on.
register_argc_argv      On
register_globals      On

To see why that might matter, have a look at this article.
Ray PaseurCommented:
You might consider turning this on, too.  Not sure about that part, but it might matter.
magic_quotes_gpc  On

It's another one of those old, bad ideas from the early days of PHP.
Ray PaseurCommented:
And this will probably cause something to belch out a lot of notices, but the answer may appear among the notices.  Add this line to the top of the login script.

Open in new window

nachtmskAuthor Commented:
@Ray -- just a comment. I think I found the problem I've been having all week.
In my php.ini file  register_long_arrays was set to Off. I set it to On and everything started working. I'm guessing I should go ahead and replace all of my HTTP_*VARS variables.
I still have some questions I will be posting as other questions. Thanks again for the help.
Ray PaseurCommented:
replace all of my HTTP_*VARS variables

Yep.  For the most part they are no longer something that makes sense, and are mostly deprecated.  Switching to use the superglobals is the right way to go.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.