standard web form results in: form data problem message

Max_Fancourt

New Member
Has anyone got the standard webforms supplied to work

Everything else has worked including subscribing unsubscribing to and from the remote lists via an email, the only change i did was adjusting the CHMOD from 777 to CHMOD 755 via an ftp program because my server didn't like it set to 777 (the result that I just got the server error message until I dropped it to 755), but apart from that everything worked well, Apart from the online forms... all I get from the "subscribe_single_fixed.php" web form in-fact all of them is this message:

Sorry but we can't process your request
Please fix the following issues
A problem has been detected processing the form data.


I am assuming I have to amend the subscribe_single_fixed.php form so I had a look at it with a text editor and (I am assuming this):

Code:
//-- INTERNAL PARAMETERS -------------------------------------------------------

$script_file = $_SERVER["SCRIPT_NAME"];
$script_path = Explode( '/', $script_file );
$script_name = $script_path[ count( $script_path ) - 1 ];

may need to be changed... I am having to guess this because i can't find any specific references tutorials, literature etc. on how to use the actual form supplied on a website and what to change if anything.

I did try a few experiments like changing the

$script_file = $_SERVER["SCRIPT_NAME"];

for the actual list name which was uploaded via the web interface admin page
but that just caused an error so I put it back

So my question is where is the explanation on where to set up the examples and or what am I supposed to do to get this to work

so to summarise my set up is:
lm folder is set to 755
I am not use msql ... i am using text file because I don't have access to a database
web admin interface is working correctly
remote list was uploaded and is working
subscribe and unsubscribe is working via emails
all webforms do not work

any help would be appreciated
kind regards max
 

stanbusk

Administrator
Staff member
The code:
Code:
$script_file = $_SERVER["SCRIPT_NAME"];
$script_path = Explode( '/', $script_file );
$script_name = $script_path[ count( $script_path ) - 1 ];
is standard PHP to get the script name from the full path. You can try to set the name manually. For example, for 'subscribe_single_fixed.php' it would be:

Code:
$script_name = "subscribe_single_fixed.php";
--
Follow maxprog.com on Facebook | Google+ | Linkedin | Twitter | YouTube
and keep up-to-date with the latest Max Programming updates!
 

Max_Fancourt

New Member
Ok I have tried everything that I can find that's been suggested on all the other posts that might be applicable

and I have also recorded and uploaded on vimeo the error i see
this recording is of the demo which you can try here: https://www.maxprog.com/site/scripts/li ... ection.php
Which displays exactly the same error that I get so I am assuming what ever the problem is.. is not just my uploaded version
The recording so you can see it happen is here:
https://vimeo.com/255557389


So just to summarise:

My set up Everything works except any of the online forms.
I have tried out the suggestion below, and I have also tried downgrading maxbulk to 8.4.7 because some people on this forum have had better luck with the older version.

1. So to rule that out I used 8.4.7 then used those uploaded MLM scripts. This version gives a different result, on hitting submit, the page goes to the redirect page and then back again. Please note: This does not add any new email address to the list.. so that doesn't work either.

2. Next as mentioned above I tried the suggestion of swopping the
Code:
$script_name = $script_path[ count( $script_path ) - 1 ];
for this
Code:
$script_name = "subscribe_single_fixed.php";
and that didn't make any difference

3. Then I tried the suggestion of
Code:
replacing $lm_path = "http".(empty($_SERVER['HTTPS'])?'':'s').'://'. $_SERVER['HTTP_HOST'] . str_replace( "html/$script_name", '', $_SERVER['PHP_SELF'] );
with
$lm_path = "http://www.xxx.com/lm/lm.php";
(and yes I replaced http://www.xxx.com with my full URL) and nope that didn't work.. in fact, this change to the script stopped my website from being seen, so I had to remove this
I double checked just to make sure I had written it correctly because I thought I must have made a mistake to have this effect, but no I hadn't. so I reverted the script, and everything came back.

4. Ok, I thought stuff this server... it must be a server problem.
I will use a completely different server. The MLM scripts were duly uploaded, and this time on this server it allowed CHMOD 777. As before everything seems to be fine.. but the result of using any of the uploaded web forms is the same error:

Sorry but we can't process your request
Please fix the following issues
A problem has been detected processing the form data.

So that's it, from what I can see I can't do anymore.. I don't know why these scripts don't work on either of the servers.

Please note I am not using a mySQL database but the raw text file version.
So I come back to the original question which is: has anyone got this working with the raw text file choice?

kind regards max
 

stanbusk

Administrator
Staff member
Try to replace:

Code:
if ( isset( $_POST['token'] ) && !empty( $_POST['token'] ) ) { $token = $_POST['token']; }
with

Code:
if ( isset( $_REQUEST['token'] ) && !empty( $_REQUEST['token'] ) ) { $token = $_REQUEST['token']; }

Actually just make sure you don't have any $_POST or $_GET, just only $_REQUEST for all variables.

--
Follow maxprog.com on Facebook | Google+ | Linkedin | Twitter | YouTube
and keep up-to-date with the latest Max Programming updates!
 

Max_Fancourt

New Member
Hi Stan
Ok I tried that...
and at least I don't get the red error message anymore but its doesn't add any subscriptions to the list.
What it does on clicking the submit is go to the redirect page and then back to the form and I checked to make sure if the list was updated and no it didn't update and no double opt-in emails were triggered or sent either

Kind regards max
 

Max_Fancourt

New Member
Hi stan no I haven't moved anything
The unsubscribe will work when using the subscribe or unsubscribe in an email footer but the actual form example doesn't work

I have written a javascript based form / link on a html page, which does actualy add and remove from the list so I know the list is functioning correctly.. but i didn't really want to use JS
to add and remove from the list


this is what I am using for testing purposes so I know its working but as I said this looks hackie to me and I don't know the security implications of using javascript on the mlm

Code:
<form id="theForm">
	<input id='firstname' placeholder="First Name"/>
	<input id='lastname' placeholder="Last Name"/>
    <input id='email' placeholder="Email Address"/> 
    <input type='submit' value="Subscribe"/> 
</form>

<form id="theFormU">
     <input type='submit' value="Unsubscribe"/>
</form>

Code:
<script>
var theForm = document.getElementById('theForm');
var theInputF = document.getElementById('firstname');
var theInputL = document.getElementById('lastname');
var theInputE = document.getElementById('email');

theForm.onsubmit = function(e){
    location = "http://www.mywebsite.org.uk/lm/lm.php?cmd=subscribe&list=test-list&email=" 
	+ encodeURIComponent(theInputE.value) + "&firstname=" + encodeURIComponent(theInputF.value) + "&lastname=" + encodeURIComponent(theInputL.value); 
    return false;
}

theFormU.onsubmit = function(e){
    location = "http://www.mywebsite.org.uk/lm/lm.php?cmd=Unsubscribe&list=test-list&email=" 
	+ encodeURIComponent(theInputE.value); 
    return false;
}
</script>

So I would prefer to use your php forms rather than the form I cobbled together.

speak soon max
 
Top