close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

server validation to restrict login

Thread began 10/22/2009 6:28 pm by JBWebWorks | Last modified 10/23/2009 2:18 pm by Jason Byrnes | 1531 views | 3 replies |

JBWebWorks

server validation to restrict login

building web site for posting items for sale

basic membership can post 10 items then must upgrade account.

php/mysql tables
accounts
items
primary index accounts.account_ID
index items.account_ID

sql is this
SELECT COUNT(items.account_ID)
FROM items INNER JOIN accounts ON items.account_ID = accounts.account_ID
WHERE accounts.account_email = var1
GROUP BY items.account_ID
//var1 is $_POST['user_name'] // user name is login text field

not sure how to get a server validation from this or if that is even what i want

i want a user to be denied login when they reach their posting limit and echo a message to encourage them to upgrade.

Sign in to reply to this post

Jason ByrnesWebAssist

On the login page, add the account_email as a session that is created when they login.

double click the Authenticate user server behavior. On the third page, you can select columns to store in session variables.

No recreate the recordset using the account_email session variable instead of the post value on the login success page.

add a set session value server behavior to capture the count that is returned.


For the trigger use Session Variable is not set.

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

You will need to manually rearrange the code so the set session value behavior is after the recordset.



In the security assist access rules manager, create a new rule to check that the count session is less than or equal to 10. then apply that rule to the login success page and send them to the update your account page if it fails.


Again, you may have to rearrange the code so the the rule is after the session value code.

Sign in to reply to this post

JBWebWorks

thanks Jason,

i accomplished what i wanted but did it a little differently.
Once i figured out the COUNT()recordset

//sql is---
SELECT items.account_ID, COUNT(*)
FROM items INNER JOIN accounts ON items.account_ID = accounts.account_ID
WHERE accounts.account_screen_name = var1
GROUP BY items.account_ID

I used PHP if/else statement to
hide the submit button on the item post page and replace with a statement

<?php if ($row_rs_count['COUNT(*)']<"10"){ ?>
<input type="submit" name="submit1" id="submit1" value="Post Your Item for Sale" />
<?php }
elseif ($row_rs_account['account_validated']=="goldaccount"){ ?>
<input type="submit" name="submit2" id="submit2" value="Post Your Item for Sale" />
<?php }
else { echo ('<h2>Your account has reached the limit of 10 items. Upgrade your account to <a href="Gold-Member.php">Gold Member</a> for unlimited item postings</h2>');
}
?>

then i used Universal Email to send an email to the account holder encouraging them to upgrade their account to be able to post unlimited items

<?php
if ((($row_rs_count['COUNT(*)']>="10" && $row_rs_account['account_validated']=="basicaccount"))) {
//WA Universal Email object="mail"
//Send Loop Once Per Entry
$RecipientEmail = "".$row_rs_account['account_email'] ."";include("WA_Universal_Email/WAUE_post-item_1.php");
$RecipientEmail = "webmaster@bubbasmobileyardsales.com";include("WA_Universal_Email/WAUE_post-item_1.php");

//Send Mail All Entries
if (""!="") {
header("Location: ");
}
}
?>

thanks again for WebAssist Support,
Jim Balthrop

Sign in to reply to this post

Jason ByrnesWebAssist

OK, glad you got it working.

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...