navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

how to automatically input the username into a field

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> how to automatically input the username into a field
Page: [1]
 
nettop

 

Posts: 210
Joined: 2/9/2004
Status: offline

 
how to automatically input the username into a field - 3/1/2008 20:42:35   
I am using Spooky database on a Windows server. I have it set up and working great for a person to register and become one of my members/agents. I then want them to input data that only they will be able to edit/delete in the future so I have a field in the new database that is their username. How do I get this new form to automatically input their Spooky UserName and set it so that it can't be edited? Here's the code for their form (the field name is 'Agent_Email' near the bottom in red that is also the Spooky UserName that I'm trying to validate)

<%

On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Err.Clear

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear

Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"

Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"

fp_conn.Open Application("listings08_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"

fp_rs.Open "Results", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"

fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(33)
Dim arFormDBFields0(33)
Dim arFormValues0(33)

arFormFields0(0) = "Owners_City"
arFormDBFields0(0) = "Owners_City"
arFormValues0(0) = Request("Owners_City")
arFormFields0(1) = "Agent_Name"
arFormDBFields0(1) = "Agent_Name"
arFormValues0(1) = Request("Agent_Name")
arFormFields0(2) = "Owners_Email1"
arFormDBFields0(2) = "Owners_Email1"
arFormValues0(2) = Request("Owners_Email1")
arFormFields0(3) = "Owners_State"
arFormDBFields0(3) = "Owners_State"
arFormValues0(3) = Request("Owners_State")
arFormFields0(4) = "Owners_Mailing_Address"
arFormDBFields0(4) = "Owners_Mailing_Address"
arFormValues0(4) = Request("Owners_Mailing_Address")
arFormFields0(5) = "Detailed_Description"
arFormDBFields0(5) = "Detailed_Description"
arFormValues0(5) = Request("Detailed_Description")
arFormFields0(6) = "Owners_Email2"
arFormDBFields0(6) = "Owners_Email2"
arFormValues0(6) = Request("Owners_Email2")
arFormFields0(7) = "Owners_First_Name"
arFormDBFields0(7) = "Owners_First_Name"
arFormValues0(7) = Request("Owners_First_Name")
arFormFields0(8) = "Price"
arFormDBFields0(8) = "Price1"
arFormValues0(8) = Request("Price")
arFormFields0(9) = "Owners_Fax"
arFormDBFields0(9) = "Owners_Fax"
arFormValues0(9) = Request("Owners_Fax")
arFormFields0(10) = "Owners_Cell_Phone"
arFormDBFields0(10) = "Owners_Cell_Phone"
arFormValues0(10) = Request("Owners_Cell_Phone")
arFormFields0(11) = "Type"
arFormDBFields0(11) = "Type"
arFormValues0(11) = Request("Type")
arFormFields0(12) = "City"
arFormDBFields0(12) = "City"
arFormValues0(12) = Request("City")
arFormFields0(13) = "Agent_Email"
arFormDBFields0(13) = "Agent_Email"
arFormValues0(13) = Request("Agent_Email")
arFormFields0(14) = "Owners_Zip"
arFormDBFields0(14) = "Owners_Zip"
arFormValues0(14) = Request("Owners_Zip")
arFormFields0(15) = "Spouses_Name"
arFormDBFields0(15) = "Spouses_Name"
arFormValues0(15) = Request("Spouses_Name")
arFormFields0(16) = "Agent_Phone"
arFormDBFields0(16) = "Agent_Phone"
arFormValues0(16) = Request("Agent_Phone")
arFormFields0(17) = "Area"
arFormDBFields0(17) = "Area"
arFormValues0(17) = Request("Area")
arFormFields0(18) = "Business_name"
arFormDBFields0(18) = "Business_name"
arFormValues0(18) = Request("Business_name")
arFormFields0(19) = "Revenues"
arFormDBFields0(19) = "Revenues1"
arFormValues0(19) = Request("Revenues")
arFormFields0(20) = "Zip"
arFormDBFields0(20) = "Zip"
arFormValues0(20) = Request("Zip")
arFormFields0(21) = "Status_Number"
arFormDBFields0(21) = "Status_Number"
arFormValues0(21) = Request("Status_Number")
arFormFields0(22) = "Area_Number"
arFormDBFields0(22) = "Area_Number"
arFormValues0(22) = Request("Area_Number")
arFormFields0(23) = "Owners_Last_Name"
arFormDBFields0(23) = "Owners_Last_Name"
arFormValues0(23) = Request("Owners_Last_Name")
arFormFields0(24) = "Timestamp"
arFormDBFields0(24) = "Timestamp"
arFormValues0(24) = Request("Timestamp")
arFormFields0(25) = "Type_Number"
arFormDBFields0(25) = "Type_Number"
arFormValues0(25) = Request("Type_Number")
arFormFields0(26) = "Description_and_price"
arFormDBFields0(26) = "Description_and_price"
arFormValues0(26) = Request("Description_and_price")
arFormFields0(27) = "Page"
arFormDBFields0(27) = "Page"
arFormValues0(27) = Request("Page")
arFormFields0(28) = "State"
arFormDBFields0(28) = "State"
arFormValues0(28) = Request("State")
arFormFields0(29) = "Street_Address"
arFormDBFields0(29) = "Street_Address"
arFormValues0(29) = Request("Street_Address")
arFormFields0(30) = "Adjusted_Net"
arFormDBFields0(30) = "Adjusted_Net1"
arFormValues0(30) = Request("Adjusted_Net")
arFormFields0(31) = "Status"
arFormDBFields0(31) = "Status"
arFormValues0(31) = Request("Status")
arFormFields0(32) = "Owners_Home_Phone"
arFormDBFields0(32) = "Owners_Home_Phone"
arFormValues0(32) = Request("Owners_Home_Phone")

FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0

If Request.ServerVariables("HTTP_USER_AGENT") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("HTTP_USER_AGENT"), "Browser_type"
End If
If Request.ServerVariables("REMOTE_HOST") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_HOST"), "Remote_computer_name"
End If
FP_SaveFieldToDB fp_rs, Now, "Timestamp1"
If Request.ServerVariables("REMOTE_USER") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_USER"), "User_name"
End If

fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"

fp_rs.Close
fp_conn.Close

Session("FP_SavedFields")=arFormFields0
Session("FP_SavedValues")=arFormValues0
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
Response.Redirect "default.asp"

End If
End If

Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")

%>
<% ON ERROR RESUME NEXT
If cint(Session("AccessLevel")) < 3 Then
Response.redirect "/authorized.asp?Redirect=" &Request.Servervariables("URL")
End if
%>
<% Response.Buffer = True %>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Results -- New</title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body bgcolor="#FFFFFF">

<table width="100%" align=left>
<tr>
<td width="100%">
<!--webbot bot="Include" U-Include="../12_graphics/topheader.htm" TAG="BODY" --></td>
</tr>
<tr>
<td width="100%">
<font face="Arial"><font color="#000080"> <b><font size="4">2008 New Listing Submission Form</font></b>
| Return To Agents Page | </font><b><a href="../logout.asp">
<font color="#FF0000" size="2">Logout</font></a></b></font><table>
<tr>
<td>

</td>
</tr>
</table>
</td>
</tr>
</table>


<p>
<font face="Arial">
<br clear="all">
</font>
<hr>
<p>

<form METHOD="POST" action="--WEBBOT-SELF--" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">

<input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="../_fpclass/fpdbform.inc"-->

FIELDS REMOVED TO SIMPLIFY THIS VIEW

<p><font face="Arial">Agent Email/UserName (format:
bret@paramountbusinessbrokers.com)<br>
<font size="3">
<!--webbot bot="Validation" s-display-name="Misc1" s-data-type="String" b-value-required="False" i-maximum-length="50" --><input name="Agent_Email" size="60" maxlength="50" value="<%=FP_FieldHTML(fp_rs,"Agent_Email")%>"></font></font></p>


FIELDS REMOVED TO SIMPLIFY THIS VIEW


<p><font size="3" face="Arial"><input type="submit" value=" OK "><input type="reset" value=" Reset "></font></p>

</form>

</body>

</html>


< Message edited by nettop -- 3/2/2008 22:40:02 >
nettop

 

Posts: 210
Joined: 2/9/2004
Status: offline

 
RE: how to automatically input the username into a field - 3/2/2008 22:32:59   
The longer version of what I'm trying to do is the following:

1) Agents register using Spooky
2) Once verified, they can login and be taken to an 'Agents' area
3) In the Agents area, they can ADD LISTING. When they do, one of the fields (that they cannot edit) takes their 'UserName' from the Spooky login and enters it into a field that marks the record as their listing.
4) When they click on the 'View Listings' link, they will only see THEIR listings
5) When they click on the 'Edit Listings' link, they can only edit/delete their listings.

I was trying to take it 'step by step'. Any adivce on how best to proceed?

Thanks, Tim

(in reply to nettop)
bernieboy31

 

Posts: 79
Joined: 3/5/2005
From: London, United Kingdom
Status: offline

 
RE: how to automatically input the username into a field - 3/5/2008 13:16:02   
Hi,

FWIW have you though of setting up a Session() for the User ID when they log on {isn't that already in Spooky login?} E.g. Session("User_ID")

You can then use that for a filter within a barebones .asp or a DRW.

viz

strSQL = "SELECT * FROM mytable WHERE User_ID = '"& Session(User_ID") &"'"

or something similar. Works a treat for me

HTH?

(in reply to nettop)
nettop

 

Posts: 210
Joined: 2/9/2004
Status: offline

 
RE: how to automatically input the username into a field - 3/5/2008 23:09:10   
I'm not sure how to use this...I've not used sessions before. The field I'm trying to fill is <p><font face="Arial">Agent Email/UserName (format:
bret@paramountbusinessbrokers.com)<br>
<font size="3">
<!--webbot bot="Validation" s-display-name="Misc1" s-data-type="String" b-value-required="False" i-maximum-length="50" --><input name="Agent_Email" size="60" maxlength="50" value="<%=FP_FieldHTML(fp_rs,"Agent_Email")%>"></font></font></p> The table I'm pulling from is the 'agents' .mdb file. Thanks for your help...Tim

(in reply to bernieboy31)
bernieboy31

 

Posts: 79
Joined: 3/5/2005
From: London, United Kingdom
Status: offline

 
RE: how to automatically input the username into a field - 3/7/2008 3:56:44   
For info on session variables go down the page on http://www.w3schools.com/asp/asp_sessions.asp


(in reply to nettop)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> how to automatically input the username into a field
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts