close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

From Registration through Login...

Thread began 9/16/2010 2:01 pm by fdotmedia | Last modified 9/29/2010 3:30 pm by Jason Byrnes | 4483 views | 15 replies |

fdotmedia

From Registration through Login...

Is there an easy way to login a user when they submit the register button on a register page?

Do I need to make and carry the session variables for username and password?

Ideas?

Sign in to reply to this post

Jason ByrnesWebAssist

Add the security assist authenticate user behavior to the to the registration page.


you will need to make sure the insert record behavior does not redirect and that the authenticate user code is after the insert record code, also check the authenticate user behavior on the login page, go to the third step of the wizard, and make sure that any sessions set on the login page are also set on the registration page.

Sign in to reply to this post

fdotmedia

ok Jason... first off thank for the reply...

Am I supposed to have an action on the form? Self maybe... The form doesn't post nor login...

Here's what I have so far...

<?php require_once('Connections/ReThinkNow.php');?>
<?php require_once( "WA_SecurityAssist/Helper_PHP.php" ); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

mysql_select_db($database_ReThinkNow, $ReThinkNow);
$query_classes = "SELECT * FROM rtnClass";
$classes = mysql_query($query_classes, $ReThinkNow) or die(mysql_error());
$row_classes = mysql_fetch_assoc($classes);
$totalRows_classes = mysql_num_rows($classes);
?>
<?php
if(isset($_POST["submit"])){
$WA_Auth_Parameter = array(
"connection" => $ReThinkNow,
"database" => $database_ReThinkNow,
"tableName" => "rtnUser",
"columns" => explode($WA_Auth_Separator,"rtnEmail".$WA_Auth_Separator."rtnPassword"),
"columnValues" => explode($WA_Auth_Separator,"".((isset($_POST["username"]))?$_POST["username"]:"") ."".$WA_Auth_Separator."".((isset($_POST["password"]))?$_POST["password"]:"") .""),
"columnTypes" => explode($WA_Auth_Separator,"text".$WA_Auth_Separator."text"),
"sessionColumns" => explode($WA_Auth_Separator,"rtnUID".$WA_Auth_Separator."rtnEmail".$WA_Auth_Separator."rtnPassword".$WA_Auth_Separator."rtnUserLevel"),
"sessionNames" => explode($WA_Auth_Separator,"rtnUID".$WA_Auth_Separator."rtnEmail".$WA_Auth_Separator."rtnPassword".$WA_Auth_Separator."rtnUserLevel"),
"successRedirect" => "login.php",
"failRedirect" => "",
"gotoPreviousURL" => FALSE,
"keepQueryString" => FALSE
);

WA_AuthenticateUser($WA_Auth_Parameter);
}
?>



and the form...

<form style="width:690px;" action="" method="post" enctype="multipart/form-data">
<p style="padding:0 0 8px 0;"><strong>Bold</strong> fields are required.</p>
<fieldset><legend><img align="top" src="assets/images/step1on.png" border="0" width="28" /> User Information</legend>
<div class="notes">
<h4>User Details</h4>
<p class="last">
Please enter your name and address as they are listed for your debit card, credit card, or bank account.
</p>
</div>

<div class="required">
<label for="first_name">First Name:</label>
<span id="req-fname">
<input name="first_name" id="rtnFName" class="inputText" size="10" maxlength="100" value="" type="text" />
<span class="textfieldRequiredMsg">A value is required.</span>
</span>
</div>

<div class="optional">
<label for="middle_initial">Middle Initial:</label>
<input name="middle_initial" id="rtnMI" class="inputText" size="10" maxlength="100" value="" type="text">
</div>

<div class="required">
<label for="last_name">Last Name:</label>
<input name="last_name" id="rtnLName" class="inputText" size="10" maxlength="100" value="" type="text">
</div>

<div class="required">
<label for="phone">Phone Number:</label>
<input name="phone" id="rtnPhone" class="inputText" size="10" maxlength="50" value="" type="text">
</div>

<div class="required">
<label for="postal">Zip Code:</label>
<input name="zipcode" id="zipcode" class="inputText" size="10" maxlength="50" value="" type="text">
</div>


</fieldset>
<br /><br />
<fieldset><legend>Login Information</legend>
<div class="notes">
<h4>Login Details</h4>
<p>
Your username and password must both be at least 8 characters long and are case-sensitive. Please do not enter accented characters.
</p>
</div>

<div class="required">
<label for="username">Email Address:</label>
<input name="username" id="rtnEmail" class="inputText" size="10" maxlength="100" value="" type="text">
<small>May only contain letters, numbers, and underscore (_) and 8-20 characters long.</small>
</div>

<div class="required">
<label for="password">Password:</label>
<input name="password" id="rtnPasswrod" class="inputPassword" size="10" maxlength="25" value="" type="password">
<small>Must be 8-25 characters long.</small>
</div>

<div class="required">
<label for="confirm_password">Please re-enter your Password:</label>
<span id="confirm-password">
<input name="confirm_password" id="confirm_password" class="inputPassword" size="10" maxlength="25" value="" type="password" />
<span class="confirmRequiredMsg">A password is required.</span>
<span class="confirmInvalidMsg">Your passwords don't match.</span>
</span>
</div>

</fieldset>
<br /><br />
<fieldset><legend>Class Information</legend>
<div class="notes">
<h4>Class Details</h4>
<p>
The classes offered are for individuals to enroll in and
</p>
</div>

<div class="required">
<label for="username">Classes Available:</label>
<select name="rtnClass">
<?php
do {
?>
<option value="<?php echo $row_classes['rtnCTitle']?>" ><?php echo $row_classes['rtnCTitle']?> | <?php echo $row_classes['rtnCPrice']; ?></option>
<?php
} while ($row_classes = mysql_fetch_assoc($classes));
?>
</select>
<small>Choose your class from the list of available classes above.</small>
</div>

</fieldset>
<br /><br />

<fieldset>
<div class="submit">

<div>
<input class="inputSubmit" value="Next Step ยป" name="submit" type="submit">
</div>
</div>
</fieldset>
</form>
Sign in to reply to this post

Jason ByrnesWebAssist

it looks like the authenticate user code is before the insert record code.

you will need to make sure the insert record behavior does not redirect and that the authenticate user code is after the insert record code.

the user cannot be logged in until the user has been stored in the database. PHP code is executed top to bottom.


right now, the authenticate user behavior is checking the database for a user that has not been inserted to the database yet.

Sign in to reply to this post

fdotmedia

Thanks for your help Jason... I have one additional question regarding passing variables through the login...

I have a user that registers, let's say he's uid=100, how do I pass that variable from registration.php through login.php to step-two.php??? I've tried filtering the recordset by URL parameter, Session variable, form variable and I can't get it to pass through any of the recordset update able details...

no matter what variables I filter with - I always get record #1...

any ideas?

Sign in to reply to this post

Jason ByrnesWebAssist

if you set the authenticate user behavior up properly, it will store the UID in a session variable when the login occurs.

Sign in to reply to this post

fdotmedia

Thanks for the reply Jason...

I believe I have login session setup correctly, apparently I don't since it doesn't actually set the session correctly

On the reg.php page I have the authenticate user setup AFTER the insert record using the following data...

"sessionColumns" => explode($WA_Auth_Separator,"rtnUID".$WA_Auth_Separator."rtnFrNumber".$WA_Auth_Separator."rtnEmail".$WA_Auth_Separator."rtnPassword".$WA_Auth_Separator."rtnLName".$WA_Auth_Separator."rtnFName".$WA_Auth_Separator."rtnUserLevel"),
"sessionNames" => explode($WA_Auth_Separator,"rtnUID".$WA_Auth_Separator."rtnFrNumber".$WA_Auth_Separator."rtnEmail".$WA_Auth_Separator."rtnPassword".$WA_Auth_Separator."rtnLName".$WA_Auth_Separator."rtnFName".$WA_Auth_Separator."rtnUserLevel"),



I want to set the users rtnUID, rtnFrNumber, rtnEmail, rtnPassword, rtnLName, rtnFName and rtnUserLevel

On the login.php page I have, literally, exactly the same 'sessionColumns' redirecting the user to a profile.php page that "should" show the current new user, except I only get the 1st row in the DB...

Keep in mind I am a dumbass and if it wasn't for the drag and drop tools WA makes, I'd be totally lost...

BTW, the tool should work with CS5 - right?

Any help would be greatly appreciated...

Ted

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of your login and registration pages in a zip archive please.


yes, if you have the most recent extension versions, they are CS5 compatible.

Sign in to reply to this post

fdotmedia

The following zip includes;
registration1.php
step-two-login.php
step-two.php

Thanks Jason...

Attached Files
Login.zip
Sign in to reply to this post

Jason ByrnesWebAssist

am I missing something? your registration page does not have any form elements on it that correspond with the insert record behavior or the login behavior?

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