Trouble with offline activation response download

Hello,

I'm currently implementing your offline activation code in php. I've got everything working except the download.

When the user clicks the "download response" link it gives them an XML file that has all of the double-quotes escaped with a single slash. Obviously the TurboActivate executable won't read this. However, if I copy-paste the XML response from the textarea into a file it will activate just fine since the textarea has no slashes escaping the double quotes.

I've checked my PHP installation and it would appear that magic quotes have been disabled. I've also tried stripslashes(), urldecode(), and htmlspecialchars() on the $response variable within the hidden input value to no avail.

Is there anything else I should do?

Disable magic quotes in php. That should fix your problem.

Disable magic quotes in php. That should fix your problem.

Unfortunately, as I said above magic quotes are disabled. I went ahead and checked by adding the suggested line to my htaccess file and it still didn't work.

I can try doing the inefficient way suggested in the link tomorrow.

With magic quotes disabled it should fix the problem. Make sure you restart your HTTP server after making changes to php.ini. (Also, if you're using PHP-FPM, then restart that server as well).

Run phpinfo() on your server to double check that magic quotes is really disabled.

Magic quotes are disabled and displayed disabled by echoing phpinfo().

Magic quotes is the only thing that will add spurious slashes to $POST data. Can you copy and paste the 3 lines from your phpinfo() results. They should look like this:

magic_quotes_gpc Off Offmagic_quotes_runtime Off Offmagic_quotes_sybase Off Off

magic_quotes_gpc Off Offmagic_quotes_runtime Off Offmagic_quotes_sybase Off Off

Indeed my magic quotes are off. I understand this is a strange scenario. Sorry it took so long to respond. Had other business I had to attend to yesterday.

Let me step back and explain what's happening:

  1. You're requesting an activation request file from LimeLM via the API.
  2. LimeLM gets the request, it's successful, and it sends back the "Activation response" file.
  3. The "manual-activation.php" script on your server gets this activation response (you can dump the response to a log file on your server and see that it comes in unmolested from the LimeLM servers. That is, LimeLM doesn't mangle the response with unnecessary quoting).
  4. This activation response is shown in a "textarea" and it's put in a "form link". When a user clicks the "Download the Activation response XML file" form link, the "manual-activation.php" sends a POST request to the same script file so the browser can download the file. (Look at the source to see exactly how this is done).

So there are 3 possibilities for error:

  1. Magic quotes is enabled (you've already ruled this out).
  2. Your HTTP server is mangling the POST data to "protect" your scripts.
  3. Your browser is screwing up the POST request to your server.

What browser are your using? Try chrome. Or Firefox. (Disable all plugins -- they might be interfering).

What HTTP server are you using? Try disabling "security" or "filter" plugins that modify GET/POST values.

Currently I'm using chrome. It appears to add slashes to the file regardless of what browser I'm using and regardless of whether or I have plugins enabled.

My HTTP server is Apache, and I'm using the WAMP wampserver 2.2 stack on Windows to do my testing.

The funny thing is this only occurs when clicking the download link.

My code for the input looks like:

<input type="hidden" value="<?php echo $response;?>" name="xmlresp"/><br />

and likewise, the code that is shown in the textarea:

<textarea rows="12" cols="80" readonly="readonly"><?php echo $response?></textarea>

The echo code is the same. The only difference is one is the value, the other is not. The textarea displays the text just fine without the extra slashes. The input code however, does not,.

Since this topic is dead I may as well post to say I found the problem.

// output the fileecho stripslashes($_POST['xmlresp']);

All I did was stripslashes the post for xmlresp and it worked great. Take note that nothing on my server was mangling the requests and magic quotes was most certainly turned off.

If we can reproduce this then we'll add it to the example code. The problem has been we haven't been able to reproduce it.