close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

logging in and signing up

Thread began 8/24/2009 2:58 pm by deafboyz_audio386924 | Last modified 8/25/2009 9:56 am by Jason Byrnes | 1753 views | 3 replies |

deafboyz_audio386924

logging in and signing up

On my signin page users can sign up, then they are transfered to a restricted access page just for logged in users. problem is after signing up they have to login as well to get the the restricted page. im sure i have a session error im just not sure how to fix it. how do i log users in at the same time that they sign up for the first time?

<?php require_once('Connections/signIn.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;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "signUp")) {
$insertSQL = sprintf("INSERT INTO userdata (userName, userPassword, name, eMail) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['eMail'], "text"));

mysql_select_db($database_signIn, $signIn);
$Result1 = mysql_query($insertSQL, $signIn) or die(mysql_error());

$insertGoTo = "upload.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="C:\DBA\Templates\master.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Sign Up</title>
<style type="text/css">
<!--
#container #mainContent #form .table tr th #Sign Up {
text-align: center;
}
-->
</style>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationConfirm.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationConfirm.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
@import url("styles/main.css");
-->
</style>
</head>

<body>
<div id="container">
<div id="header"><img src="images/top banner.jpg" width="967" height="110" alt="Deaf Boyz Audio - Way too loud..." /></div>
<!-- InstanceBeginEditable name="mainContent" -->
<div id="mainContent">
<div id="headerDiv"><h1>Sign Up</h1></div>
<div id="textDiv">
<p>Got a system that needs to be recognized?</p>
<p>Join DeafBoyzAudio.com</p>
<p> for a chance to show off what you got...</p>
<p>Put in your name, e-mail, and pick a username</p>
<p> and password to start uploading.</p>
<p>User login info will be sent to your email if you ever lose it</p>
<p>so make sure its right...</p>
<p>Don't worry, we hate spam too. </p>
</div>
<form action="<?php echo $editFormAction; ?>" method="POST" name="signUp" class="signUp" id="signUp">
<table width="280" border="0" align="center" cellpadding="1" cellspacing="3" class="table">
<tr>
<td width="85" align="center" scope="row">Name:</td>
<td width="182" align="left"><span id="sprytextfield1">
<label for="name"></label>
<input name="name" type="text" id="name" tabindex="10" size="30" maxlength="30" />
<span class="textfieldRequiredMsg">Name Required</span></span></td>
</tr>
<tr>
<td width="85" align="center" scope="row">E-Mail:</td>
<td align="left">
<label for="eMail"></label>
<span id="sprytextfield2">
<label for="eMail2"></label>
<input name="eMail" type="text" id="eMail2" tabindex="20" size="30" maxlength="40" />
<span class="textfieldRequiredMsg">E-mail Required</span></span></td>
</tr>
<tr>
<td width="85" align="center" scope="row">Username:</td>
<td align="left">
<label for="username"></label>
<span id="sprytextfield3">
<label for="username2"></label>
<input name="username" type="text" id="username2" tabindex="30" size="30" maxlength="30" />
<span class="textfieldRequiredMsg">Username Required</span></span></td>
</tr>
<tr>
<td width="85" align="center" scope="row">Password:</td>
<td>
<label for="password"></label>
<span id="sprytextfield4">
<label for="password3"></label>
<input name="password" type="password" id="password3" tabindex="40" size="30" maxlength="30" />
<span class="textfieldRequiredMsg">Password Required</span></span></td>
</tr>
<tr>
<td align="center" scope="row">Confirm:</td>
<td scope="row">
<label for="confirm"></label>
<span id="spryconfirm1">
<label for="confirm2"></label>
<input name="confirm" type="password" id="confirm2" tabindex="50" size="30" maxlength="30" />
<span class="confirmRequiredMsg">Please Confirm Password</span><span class="confirmInvalidMsg">Passwords Don't Match</span></span></td>
</tr>
<tr>
<th colspan="2" scope="row"><input type="submit" name="Sign Up" id="Sign Up" value="Sign Up " /></th>
</tr>
</table>
<input type="hidden" name="MM_insert" value="signUp" />
</form>
</div>

<!--
//-->

<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur", "change"]});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["blur", "change"]});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {validateOn:["blur", "change"]});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "none", {validateOn:["blur", "change"]});
var spryconfirm1 = new Spry.Widget.ValidationConfirm("spryconfirm1", "password3", {validateOn:["blur", "change"]});
//-->
</script>
<!-- InstanceEndEditable -->
<div id="sidebar">
<p class="sidebarLink"><a href="index.htm">home</a></p>
<p class="sidebarLink"><a href="pics.htm">pics</a></p>
<p class="sidebarLink"><a href="video.htm">video</a></p>
<p class="sidebarLink"><a href="login.php">upload</a></p>
<p class="sidebarLink"><a href="about.htm">about</a></p>
<p class="sidebarLink"><a href="feedback.php">feedback</a></p>
</div>
<div id="footer">
<h6 class="copyright">Copyright Deaf Boyz Audio, 2009</h6>
</div>
</div>
</body>
<!-- InstanceEnd --></html>
Sign in to reply to this post

Jason ByrnesWebAssist

are you using Security assist?

if so add a Security Assist Authenticate User server behavior to the page. make sure the Insert Record server behavior does not redirect after inserting, the Authenticate User server behavior van do the redirect. And make sure that the Authenticate user server behavior occurs after the insert record server behavior.

Sign in to reply to this post

deafboyz_audio386924

no i dont have security but i was able to achieve the same thing by doing insert record, log in user, and then redirect. i also added capability to check for duplicate user name. thanks Jason for helpin me out, once i knew the general idea of how it should work i was able to figure the rest out.

Sign in to reply to this post

Jason ByrnesWebAssist

Excellent, glad to hear 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...