<% ' *** Validate request to log in to this site. MM_LoginAction = Request.ServerVariables("URL") If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString MM_valUsername=CStr(Request.Form("txtaccount")) If MM_valUsername <> "" Then MM_fldUserAuthorization="" MM_redirectLoginSuccess="status.asp" MM_redirectLoginFailed="cabs.asp" MM_flag="ADODB.Recordset" set MM_rsUser = Server.CreateObject(MM_flag) MM_rsUser.ActiveConnection = MM_taximan_STRING MM_rsUser.Source = "SELECT UserID, Password" If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization MM_rsUser.Source = MM_rsUser.Source & " FROM dbo.Users WHERE UserID='" & Replace(MM_valUsername,"'","''") &"' AND Password='" & Replace(Request.Form("txtpassword"),"'","''") & "'" MM_rsUser.CursorType = 0 MM_rsUser.CursorLocation = 2 MM_rsUser.LockType = 3 MM_rsUser.Open If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then ' username and password match - this is a valid user Session("MM_Username") = MM_valUsername If (MM_fldUserAuthorization <> "") Then Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value) Else Session("MM_UserAuthorization") = "" End If if CStr(Request.QueryString("accessdenied")) <> "" And false Then MM_redirectLoginSuccess = Request.QueryString("accessdenied") End If MM_rsUser.Close Session("UserID") = Request.Form("txtaccount") Response.Redirect(MM_redirectLoginSuccess) End If MM_rsUser.Close Response.Redirect(MM_redirectLoginFailed) End If %> User Login
Account Number:
Password:
   
[allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => AnkleBurner webforumsuser@macromedia.com [ip] => "AnkleBurner" w [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> Setting a session Variable - Macromedia Dreamweaver

Setting a session Variable - Macromedia Dreamweaver

Im having problems getting my session variable to set. What I want it to do, is as soon as the user is validated, for it to store the username into a session variable and then proceed to teh next page. here is my code. <%LANGUAGE="VBSCRIPT"%> <!--#include file="Connections/taximan.asp" --> <% ' *** Validate request to log in to this site. MM_LoginAction = Request.ServerVariables("URL") If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString MM_valUsername=CStr(Request.Form("txtaccount")) If MM_valUsername <> "" Then MM_fldUserAuthorization="" MM_redirectLoginSuccess="status.asp" MM_redirectLoginFailed="cabs.asp" MM_flag="ADODB.Recordset" set MM_rsUser = Server.CreateObject(MM_flag) MM_rsUser.ActiveConnection = MM_taximan_STRING MM_rsUser.Source = "SELECT UserID, Password" If MM_fldUserAuthorization <> "" Then MM_rsUser.Source ...

  1. #1

    Default Setting a session Variable

    Im having problems getting my session variable to set. What I want it to do, is as soon as the user is validated, for it to store the username into a session variable and then proceed to teh next page. here is my code.

    <%LANGUAGE="VBSCRIPT"%>
    <!--#include file="Connections/taximan.asp" -->
    <%

    ' *** Validate request to log in to this site.
    MM_LoginAction = Request.ServerVariables("URL")
    If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString
    MM_valUsername=CStr(Request.Form("txtaccount"))
    If MM_valUsername <> "" Then
    MM_fldUserAuthorization=""
    MM_redirectLoginSuccess="status.asp"
    MM_redirectLoginFailed="cabs.asp"
    MM_flag="ADODB.Recordset"
    set MM_rsUser = Server.CreateObject(MM_flag)
    MM_rsUser.ActiveConnection = MM_taximan_STRING
    MM_rsUser.Source = "SELECT UserID, Password"
    If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
    MM_rsUser.Source = MM_rsUser.Source & " FROM dbo.Users WHERE UserID='" & Replace(MM_valUsername,"'","''") &"' AND Password='" & Replace(Request.Form("txtpassword"),"'","''") & "'"
    MM_rsUser.CursorType = 0
    MM_rsUser.CursorLocation = 2
    MM_rsUser.LockType = 3
    MM_rsUser.Open
    If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
    ' username and password match - this is a valid user
    Session("MM_Username") = MM_valUsername
    If (MM_fldUserAuthorization <> "") Then
    Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization ).Value)
    Else
    Session("MM_UserAuthorization") = ""
    End If
    if CStr(Request.QueryString("accessdenied")) <> "" And false Then
    MM_redirectLoginSuccess = Request.QueryString("accessdenied")
    End If
    MM_rsUser.Close
    Session("UserID") = Request.Form("txtaccount")
    Response.Redirect(MM_redirectLoginSuccess)
    End If
    MM_rsUser.Close

    Response.Redirect(MM_redirectLoginFailed)
    End If
    %>
    <html>
    <head>
    <title>User Login</title>
    <meta http-equiv="Content-Type" content="text/html; cht=iso-8859-1"></head>
    <body bgcolor="#FFFFFF" text="#000000">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><div align="center"><img src="images/checker.gif" width="145" height="95"></div></td>
    <td> <form action="<%=MM_LoginAction%>" name="checkerLogin" method="POST" target="mainFrame">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><font color="#BD4747"><strong>Account Number:</strong></font></td>
    <td><input name="txtaccount" type="text" id="txtaccount"></td>
    </tr>
    <tr>
    <td><strong><font color="#BD4747">Password:</font></strong></td>
    <td><input name="txtpassword" type="password" id="txtpassword"></td>
    </tr>
    <tr>
    <td><div align="right">
    <input type="submit" name="Submit" value="Login">
    </div></td>
    <td><input type="reset" name="Submit2" value="Reset"></td>
    </tr>
    </table>
    </form></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    </table>
    </body>
    </html>


    AnkleBurner webforumsuser@macromedia.com Guest

  2. #2

    Default Re: Setting a session Variable

    The user name is already stored in a session for you:

    Session("MM_Username")

    HTH's

    --

    __o
    _-\<,
    (_)/(_)____ [url]http://tinyurl.com/2gf2[/url]
    ::kindler chase::

    wanna play? [url]http://tinyurl.com/2gf0[/url]
    wanna cube? [url]http://www.nCubed.com[/url]

    "When you find your passion, it's easy to be illogical" - me
    _______________________________________________

    Dreamweaver FAQ & Resource List
    [url]http://www.dreamweaverfaq.com[/url]

    "AnkleBurner" <webforumsusermacromedia.com> wrote in message
    news:bemjru$pmp$1forums.macromedia.com...
    > Im having problems getting my session variable to set. What I want it to
    do, is as soon as the user is validated, for it to store the username into a
    session variable and then proceed to teh next page. here is my code.
    >

    Kindler Chase Guest

  3. #3

    Default Re: Banner Stuck

    To recap/verify what's been sorted out so far:

    It's an animated GIF file.

    It shows first frame in Dw Design view (that's by design- the animation
    won't play in Dw design view)

    It shows in "Preview in Browser"

    It doesn't show when viewing the page from the server??


    exact url to page with this banner pls.
    exact url to the animated GIF file also pls.


    > Need to understand why banner plays on desktop preview mode, but not at
    > server/net.
    >
    > Thanks
    >
    >
    >
    --
    Team Macromedia Volunteer for Dreamweaver
    Certified Dreamweaver MX Developer

    Alan Ames Guest

  4. #4

    Default Re: Setting a session Variable

    Could you please provide a bit more information e.g. what is the problem?

    Is the session variable not being set? Or is the form not working correctly?

    If you can narrow down the problem I might be able to help.

    Matt



    Womble Guest

  5. #5

    Default Re: Setting a session Variable

    For some reason the Session Variable wont set. it did once or twice and now it doesnt. The form works fine, and it goes to the next page but, the recordset on the next page is dependant apon the session variable being set



    AnkleBurner webforumsuser@macromedia.com Guest

  6. #6

    Default Re: Setting a session Variable

    What happens if you goto a blank page which just displays the session variable instead of going to a page with anyother code on it?

    Matt


    Womble Guest

  7. #7

    Default Re: Setting a session Variable

    Same thing, the variable doesnt get set


    AnkleBurner webforumsuser@macromedia.com Guest

  8. #8

    Default Re: Setting a session Variable

    You have the following code;
    Session("MM_Username") = MM_valUsername

    Try changing it to
    Session("MM_Username") = test (or any text/number)

    If test displays on the blank page then you know the issue is located where you set the variable value.

    If test isn't displayed then there is a problem elsewhere

    Matt


    Womble Guest

Similar Threads

  1. #39634 [NEW]: session variable and normal variable
    By erhanbaris at gmail dot com in forum PHP Bugs
    Replies: 3
    Last Post: November 27th, 10:09 AM
  2. Setting a variable name with a variable in a loop
    By DAYohn in forum Coldfusion - Advanced Techniques
    Replies: 4
    Last Post: March 17th, 08:40 PM
  3. Replies: 0
    Last Post: July 23rd, 12:40 PM
  4. Replies: 1
    Last Post: July 17th, 01:35 AM
  5. [SESSION] Session variable deleted prior to command?
    By Ivo Fokkema in forum PHP Development
    Replies: 0
    Last Post: July 16th, 12:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139