close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

struggling to understand a rule.....

Thread began 9/10/2012 10:31 am by JamieEff | Last modified 9/10/2012 12:02 pm by Jason Byrnes | 881 views | 3 replies |

JamieEff

struggling to understand a rule.....

Hi Jason

Am trying to set up a simple 'check a code' which then takes a visitor to a page which will then tell them if they have won or not.

The code is predetermined 7 digit and have set up the database with a table called comp (see attached) with a column in it 'compcode'. Am not sure if I have done it right??

On the result page I have 2 content sections, one if you win and one if you dont win

I have set up the access rules 'Winner' and 'NoWin' (also attached) but its not working for me and I know I have done something wrong, I just dont knwo what....

Thanks in advance

Jamie

Sign in to reply to this post

Jason ByrnesWebAssist

your rule makes no sense.

you are comparing the session to itself. This will always return true.

the session "compcode" will always equal itself.


you need to use another comparison.

how are you determining if the user is a winner or not?

how does the session compcode get set?

Sign in to reply to this post

JamieEff

Originally Said By: Jason Byrnes
  how are you determining if the user is a winner or not?  



a 7 digit code and as my experience and skill is very limited, I am setting it so that the visitor has to enter a code that they have received.

This then takes them to the reult page which will show the relevant content subject to them being a winner or not.....

Originally Said By: Jason Byrnes
  how does the session compcode get set?  



I will be doing this manually by changing the winning code in the database

Sign in to reply to this post

Jason ByrnesWebAssist

So you are sending them an email with the code, and you then have a form where they enter the code?

Ok, so on the form page add a recordset to look up the code in the database.

then add a set session value behavior to the page to set a session named "WinningCode"

For the value, click the lightning bolt icon and select the code column from the recordset.

add a second set session value behavior to the page, for the trigger and the value, click the lightning bolt icon and select the code form element.

Set the name to EnteredCode

In the Rule, use the WinningCode session as the Value, and the Entered code session as the Comparison

Sign in to reply to this post

JamieEff

I think I have created a recordset doing what you say.... (please see atatched)

I have no idea how to add a set session value behavior to the page and to which page I would add it......

Do I still need to authenticate the user or is this replacing that on the submit page?

Sign in to reply to this post

Jason ByrnesWebAssist

you need to filter the recordset using the code column and a Form Variable.

in the Filter section of the recordset, select the code column "=" "Form variable" then enter the name of the text box on your form.

the set session value behaviors should be added to the form page.

open the server behaviors panel, and click the plus button, select webassist-> Cookies -> Set Session Value.

Sign in to reply to this post

JamieEff

thanks...

I have added the session

php:
<?php

if (!session_id()) session_start();
if(!isset(
$_SESSION["WinningCode"]))     {
  
$_SESSION["WinningCode"] = "".$row_CompRS['compcode']  ."";
}
?>
<?php
if (!session_id()) session_start();
if(!isset(
$_SESSION["EnteredCode"]))     {
  
$_SESSION["EnteredCode"] = "".((isset($_POST["code"]))?$_POST["code"]:"")  ."";
}
?>



Not sure if I have done it right?

The recordset is attached... am not sure if that is right either.

What do I do with the form and submit now? How do I get from the code entrry to the reult page?

On the results page I have added a rule which doesnt seem to be working - see attached

Jamie



Do I still need to authenticate a user?

Sign in to reply to this post

Jason ByrnesWebAssist

the rule should be configured to use the session variables that you created, not the form post or the recordset.


the point is to set a session with the winning code. In my previous reply, i suggested filtering the recordset, but that was not right. The recordset should not have any filtering, sorry about that.

and set another session with the entered code.

this is done by creating a form with a text box in it and using the set session value behavior to capture it.

In the rule, you use the 2 sessions for comparison to see if they match.

if they do, then the user entered the right code.....

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...