close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Login Success and Failure Message in Same Div on index.php

Thread began 12/19/2013 7:12 am by deanmale2001272549 | Last modified 1/07/2014 11:33 am by Jason Byrnes | 16028 views | 16 replies |

deanmale2001272549

Login Success and Failure Message in Same Div on index.php

Do you know how I can have a login success message (Welcome! {username}) and a login failed message (Login Failed. Please try again) displayed in the same area? (Just above login username and password fields in my case.) I tried WebAssist> Framework Builder> Plugin> Insert Plugin> trigger> Rule: Log in Success and thought I would load login_success.php page as my Plug- In Source, but that generates an error. Conflicts somehow with my successfully working login using separate pages. (login_success.php and login_failed.php) Ideally, I'd like the Welcome! {username} to just display right in the same exact place over the username field.

WebAssist> Framework Builder> Plugin> Insert Plugin> trigger> Rule: Log in Success

login_success.php and login_failed.php in respective Divs LogInSuccessMessage, LogInFailureMessage, etc.

Thank you!

Sign in to reply to this post

Jason ByrnesWebAssist

dont use plugins for this, use the Security Assist Show region behavior.

Add the login success message where you would like it to show, select the message text and go to then WebAssist -> Security Assist -> Show region. from the list of access rules select the "Logged into <Your user table>" rule (where <Your user table> is the name of your users table.

do the same for the failure message, using the Failed log in access rule.

Sign in to reply to this post

deanmale2001272549

Thanks Jason,

It still rolls over to my 'signed_in.php' page, the way I did it.

I put:

<p class="WelcomeTextUsername"><span class="MemberTextLoggedIn">member:</span> <?php echo $_SESSION['MM_Username']; ?>
</p>

Inside:

<div id="login_logged_in">
<?php if(WA_Auth_RulePasses("Logged in to users")){ // Begin Show Region ?>
<p class="WelcomeTextUsername"><span class="MemberTextLoggedIn">member:</span> <?php echo $_SESSION['MM_Username']; ?>
</p>
<?php } // End Show Region ?>
</div>


Thanks!

Sign in to reply to this post

deanmale2001272549

I can just use the Webassist Wizard pages and modify them, rather than using my working LogIn and adding individual Webassist features. I have the show region areas in and showing, How can I <?php echo $_SESSION['MM_Username']; ?> in the show region area?

If I try and put that line of code to echo Username in Show region, instead of the Anonymous Text Line "You are now logged in" it now just prints out raw code exactly as you see it above. No Username from users table in db.

Thanks!

Sign in to reply to this post

Jason ByrnesWebAssist

edit the security assist authenticate user server behavior and make sure there is no value for the success and failure redirects.

the MM_Username session is not one created by security assist so will not work. also, to show a session, you need to be on a php page.

to show the user name, go to the session tab of the security assist authenticate user server behavior, click the plus button and select the username column. Then place your cursor in the div where the user name should show, go to the bindings tab, expand the session collection, select the username session and click the bind button.

Sign in to reply to this post

deanmale2001272549

In security assist authenticate user server behavior [General Tab] I chose Trigger> Rule: LogIn success. (Leave the rest empty.)

In [Database Tab] I chose my connection, and 'users' table, hit '+' sign chose userName, hit lightning bolt for value, chose Session> userName

In [Session Values Tab] I hit '+' sign chose userName column which gives a Session Name of userName.

Go to Bindings> select the username session and click the insert button.

Hit O.K. button for all, preview in browser and see a completely blank page.



Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

the trigger for the authenticate use server behavior should be the submit button pressed, or a form post. the authenticate user behavior preforms the login and set the login success or failure, so using the login success as the trigger is circular logic.

Sign in to reply to this post

deanmale2001272549

Thank you.

Can you think of any reason why this would not print out username?

<?php if(WA_Auth_RulePasses("Log in success")){ // Begin Show Region ?>
<p>You have been logged in:&nbsp;<?php echo $_SESSION['UserName']; ?></p>
<?php } // End Show Region ?>

Just shows "You have been logged in: " with blank, white space after it.
(No, username)

I checked Column Name Capitals/ Spelling. All looks good.

For Trigger, as suggested, I chose:
Button: LogIn_submit pressed.

Sign in to reply to this post

Jason ByrnesWebAssist

does the login page save a UserName session in the authenticate user behavior?

add the following to the page to dump the entire session contents:

<pre><?php var_dump($_SESSION); ?></pre>

Sign in to reply to this post

deanmale2001272549

That (<pre><?php var_dump($_SESSION); ?></pre>) just brings up this in <body>:

array(2) {
["WAENCRYPTEDRETURNUSED"]=>
bool(false)
["WAENCRYPTEDRETURNSUCCESS"]=>
bool(false)
}

This is in <head> regarding your question about 'Authenticate':

WA_AuthenticateUser($WA_Auth_Parameter);
}

if(isset($_POST["LogIn_submit"]) || isset($_POST["LogIn_submit_x"])){
$WA_Auth_Parameter = array(
"connection" => $myconnectionname,
"database" => $database_mydbname,
"tableName" => "users",
"columns" => explode($WA_Auth_Separator,"UserName"),
"columnValues" => explode($WA_Auth_Separator,"".$_SESSION['UserName'] .""),
"columnTypes" => explode($WA_Auth_Separator,"text"),
"sessionColumns" => explode($WA_Auth_Separator,"UserID".$WA_Auth_Separator."UserName"),
"sessionNames" => explode($WA_Auth_Separator,"UserID".$WA_Auth_Separator."UserName"),
"successRedirect" => "",
"failRedirect" => "",
"gotoPreviousURL" => FALSE,
"keepQueryString" => FALSE
);

WA_AuthenticateUser($WA_Auth_Parameter);
}

I just used the Standard, Security Assist> Create Security Pages> Simple LogIn.

It created the pages that work great. I just would like the username to show when logged in.

I have not modified anything to original pages ulness I've been told to.

Thanks!

Sign in to reply to this post
loading

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