Avatar billede webbygger Nybegynder
15. november 2007 - 20:12 Der er 4 kommentarer og
1 løsning

Gemmer ikke querystring!

Hejsa

Jeg er i gang med at opdatere min hjemmeside og lige nu (den seneste uge) har jeg arbejdede på et problem med, at implicere 2 egen moduler til Skyportal, alt er næsten løst, men når jeg login fra en side eks.

http://www.lystfiskerens.net/fisk/vis.asp?rid=71&t=Kyst%20endegrej
|
\/
login
|
\/
http://www.lystfistkerens.net/fisk/vis.asp

taber jeg querystring - script kører fint selvstædig, jeg kan "bare" ikke lige finde ud af hvor problemet er!!!

Jeg får denne fejl ved login
//Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'id ='.

/fisk/vis.asp, line 236
//

//vis.asp//

<%

  dim mode,  id
strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("jerg.mdb")
Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open strDSN

    id = Request("rid")
   
%>

<table width="100%" border="0" cellpadding="0" cellspacing="0" class="logo">
  <tr>
    <td>     
  <tr>
    <td valign="top" >
      <div align="left">
    <% Response.Write  "<H2>"  & "</H2>"
   
   
spThemeTitle= "Anmeldelse"
spThemeBlock1_open(intSkin) %>             
            </div>
   
    <%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath ("jerg.mdb")
strUpdate = "UPDATE anm SET visninger = visninger + 1 WHERE id = "& request.querystring("rid") &""
Conn.Execute(strUpdate)

strSQL = "SELECT * From anm where id = " & id
Set rs = myConn.Execute(strSQL)%>

<table width="100%" border="0" cellpadding="0" cellspacing="0" class="logo">
  <tr>
    <td>     
  <tr>
    <td valign="top" >
      <div align="left">
      <table width="80%" border="0" align="center" cellpadding="4" cellspacing="4">
        <tr>
          <td>&nbsp; </td>
        </tr>
        <tr>
          <td height="16"  bgcolor="#E4E4E4" class="ramme"> <div align="left">
              <%
       
'Så kan du checke om "t" er "butik" eller "grej":

dim t
t = LCase(request.querystring("t"))

' LCase betyder at den skal check småbogstaver, da der er forskel på butik, buTIK, BUtik, osv..

Select Case t
case "grejbutik"
' udfør kode der har med "butik" at gøre
response.write "<div align='left'>"

response.write"<table width=100% border=0 bgcolor=#E4E4E4 cellpadding=8 >"

    response.write"<tr>"
    response.write"<td>"
    response.write"<b>  </b>"
    response.write"</td>"
   
    response.write"<td>"
    response.write " "
    response.write"</td>"
   
    response.write"<td >"
    response.write "<font size=2>" & "læst:" & "&nbsp;" & rs("visninger") & " </font> "
    response.write"</td>"
   
    response.write"<tr>"
    response.write"<td>"
    response.write"<b> Indsendt af:</b>"
    response.write"</td>"
   
   
    response.write"<td>"
    response.write rs("MEMBER_ID") & "&nbsp;&nbsp;" & "den" & "&nbsp;&nbsp;" & rs("dato")
    response.write"</td>"
   
    response.write"<tr>"
    response.write"<td>"
    response.write"<b>  Butik:</b>"
    response.write"</td>"
   
    response.write"<td>"
    response.write rs("butik")
    response.write"</td>"
   
    response.write"<tr>"
    response.write"<td>"
    response.write"<b> By:</b>"
    response.write"</td>"
   
    response.write"<td>"
    response.write rs("by")
    response.write"</td>"
   
   
   
    link_url = rs("urlbutik")
                  if link_url<>"" then
                  response.write"<tr>"
                  response.write"<td>" 
                  response.write"<b> Hjemmeside:</b>" & "&nbsp;" & "&nbsp;" & "&nbsp;" & "&nbsp;"
                  response.write"</td>"
                 
                 
                  response.write"<td>"
                  response.write "<a href=" & link_url & " target='_blank'" & ">Besøg siden</a>"   
                  response.write"</td>"
   
                  end if
   

   
    response.write"<tr>"
    response.write"<td>"
    response.write"<b> Faglig ekspertise:</b>"
    response.write"</td>"
   
    response.write"<td>"
    for i = 1 to CInt(rs("faglig"))
                                                    response.write "<img src=""orange.gif"" alt=""Stjerne"">"
                                                    next
    response.write"</td>"
   
    response.write"<tr>"
    response.write"<td>"
    response.write"<b> Kundeservice:</b>"
    response.write"</td>"
   
    response.write"<td>"
    for i = 1 to CInt(rs("kunde"))
                                                    response.write "<img src=""orange.gif"" alt=""Stjerne"">"
                                                    next
    response.write"</td>"
   
    response.write"<tr>"
    response.write"<td>"
    response.write"<b> Udvalg:</b>"
    response.write"</td>"
   
    response.write"<td>"
    for i = 1 to CInt(rs("udvalg"))
                                                    response.write "<img src=""orange.gif"" alt=""Stjerne"">"
                                                    next
    response.write"</td>"
       
       
    response.write"<tr>"
    response.write"<td valign=top>"
    response.write"<b> Bemærkning:</b>"
    response.write"</td>"
   
    response.write"<td>"
    response.write  Replace(rs("beskrivelse"),vbCrLf,"<br>")
    response.write"</td>"
   
    response.write"<tr>"
    response.write"<td>"
    response.write"<b></b>"
    response.write"</td>"
   
    response.write"<td>"
                      Response.Write "<a href=""java script:openWindow4('kommen.asp?rid="&id&"')""><font color=""#FF0000"">Tilføj en kommentar til anmeldelsen</font> </a>"
    response.write"</td>"
   

    response.write"</tr>"
 

response.write "</table>"
response.write "</div>"



case else
' udfør kode der har med "butik" at gøre
response.write "<div align='left'>"
response.write"<table width=""80%"" border=""0"" bgcolor=""#E4E4E4"" cellpadding=""8"" >"
alt_pic = rs("produkt")
    response.write"<tr>"
    response.write"<td>"
    response.write"<b>  </b>"
    response.write"</td>"
   
    response.write"<td>"
    response.write " "
    response.write"</td>"
   
    response.write"<td>"
    response.write "<font size=2>" & "læst:" & "&nbsp;" & rs("visninger") & " </font> "
    response.write"</td>"
   
    response.write"<tr>"
    response.write"<td>"
    response.write"<b>  Produkt:</b>"
    response.write"</td>"
   
    response.write"<td>"
    response.write (alt_pic)
    response.write"</td>"
   
   
    response.write"<tr>"
    response.write"<td>"
    response.write"<b> Indsendt af:</b>"
    response.write"</td>"
   
    response.write"<td>"
    response.write rs("MEMBER_ID") & "&nbsp;&nbsp;" & "den" & "&nbsp;&nbsp;" & rs("dato")
    response.write"</td>"
   
    response.write"<tr>"
    response.write"<td>"
    response.write"<b> Anslået antal ture:</b>"
    response.write"</td>"
   
    response.write"<td>"
    response.write rs("ture")
    response.write"</td>"
   
    response.write"<tr>"
    response.write"<td>"
    response.write"<b> Karakter:</b>"
    response.write"</td>"
   
    response.write"<td>"
    for i = 1 to CInt(rs("karakter"))
                                                    response.write "<img src=""orange.gif"" alt=""Stjerne"">"
                                                    next
    response.write"</td>"
   
    response.write"<tr>"
    response.write"<td valign=top>"
    response.write"<b> Bedømmelse:</b>"
    response.write"</td>"
   
    response.write"<td>"
    response.write  Replace(rs("beskrivelse"),vbCrLf,"<br>")
    response.write"</td>"
   
    response.write"<tr>"
    response.write"<td>"
    response.write"<b> Pris:</b>"
    response.write"</td>"
   
    response.write"<td>"
    response.write rs("pris")
    response.write"</td>"
   
    response.write"<tr>"
    response.write"<td>"
    response.write"<b> </b>"
    response.write"</td>"
   
    response.write"<td>"
    billed_url = rs("url")
   
                  if billed_url<>"" then
                    Response.write "<br>" & "<br>" & "<img src='" & billed_url & "'  alt=""" & (alt_pic) & """ title=""" & (alt_pic) & """>"
                    end if
    billed_url = rs("billede")
                             
                  if billed_url<>"" then
                    Response.write  "<img src='" & "thumbnails450" & "/" & Mid(billed_url,10) & "' class=""rammesort"" alt=""" & (alt_pic) & """ title=""" & (alt_pic) & """ >"
                     
                      end if
                       
    response.write"</td>"   
   
    response.write"<tr>"
    response.write"<td>"
    response.write"<b></b>"
    response.write"</td>"
   
    response.write"<td>"
                if (hasAccess(2)) then 
                    Response.Write "<a href=""java script:openWindow4('kommen.asp?rid="&id&"')""><font color=""#FF0000"">Tilføj en kommentar til anmeldelsen</font> </a>"
                   
                    else
        response.write"<font color=""#FF0000"">Ønsker Du at tilføj en kommentar - så login!</font>"
end if
    response.write"</td>"
   

    response.write"</tr>"

response.write "</table>"
response.write "</div>"




end select

%>
            </div></td>
        </tr>
      </table>
   
    <div align="center"><br>
     
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
            <td> <p align="center"><strong><font size="3" face="Verdana, Arial, Helvetica, sans-serif">Kommentarer
                :</font></strong> </p>
      <p align="center">&nbsp;</p>
      <p>
        <%' HER ER VISNING SIDEN
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath ("jerg.mdb")
strSQL = "Select * from kommen where kategori="&request.querystring("rid")

set rs = Conn.execute(strSQL)

if rs.EOF then
Response.write ""
else
Do Until rs.EOF
dim kategori
kategori = rs("kategori")
%>
      <table width="100%" cellpadding="10" bgcolor="#E4E4E4" class="ramme">
        <tr>
          <td width="250" valign="top" bgcolor="#E4E4E4"> <b>Tilføjet af:</b>
            <% = rs("kommennavn") %><br> <b>Dato:</b> <%=RS("kommendato")%><br> </td>
                  <td valign="top" bgcolor="#FFFFFF"> <%=RS("besked")%><br> </td>
        </tr>
      </table>
      <div align="left"><br>
      </div>
      <%RS.MoveNext
Loop
end if

Conn.Close
Set Conn = Nothing%>
  <tr>
    <td> <%' HER ER FORMSIDEN
DBPATH = "DBQ=" & Server.MapPath("jerg.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open DBPATH

If Request.QueryString("mode") = "new" Then
    navn = ChkString(Request.Form("navn"))
    besked1 = ChkString(Request.Form("besked"))
    besked1 = ChkString(Replace(besked1, "'", "''"))
    besked1 = ChkString(Replace(besked1, vbCrLf, "<br>"))
    besked = besked1
    kategori=ChkString(request.querystring("rid"))
    If navn="" Or besked="" then
        Response.Write "<b>Du skal udfylde alle felter!</b>"
    Else
       
        strSQL="INSERT INTO kommen (kommennavn,besked,kategori,kommendato) VALUES('" & navn & "','" & besked & "'," & kategori & ",'" & day(now) & "-" & month(now) & "-" & year(now)  & "' )"
        Conn.Execute(strSQL)

'og så lige lidt orden, måske ;)
conn.close
set conn=nothing

'og SÅ:
response.redirect "tak.htm"    End If
End If

Set Conn = Nothing
%>
</td>
  </tr>
</table>
     
    </div>

        </td>
      </tr>
   
    </table>
    <%
    spThemeBlock1_close(intSkin)
Avatar billede goose Nybegynder
15. november 2007 - 21:27 #1
Det er i din login del det går galt.

Grunden til fejlen er, at du jo netop ikke har et id med i din forespørgsel som din SQL streng kræver, du mangler altså med andre ord en parameter som er krævet.

Hvordan ser din loginfunktion ud?

/Goose
Avatar billede webbygger Nybegynder
17. november 2007 - 11:13 #2
Hej Goose - undskyld mit sen svar, her er loginsiden fra skyportal som jeg bruger.....


function chkLoginStatus()
  if (strAuthType = "nt") then
    call NTauthenticate()
    if ChkAccountReg() = "1" then
        call NTUser()
    else
      'call regNTuser()
      call NTUser()
    end if
    'NTdebug()
    strDBNTUserName = Session(strUniqueID & "userID")
    strDBNTFUserName = Session(strUniqueID & "userID")
  elseif strAuthType = "db" then
   
    if (Request.Cookies(strUniqueID & "User")("Name") <> "" and Request.Cookies(strUniqueID & "User")("PWord") <> "") then
      if IsEmpty(Session(strUniqueID & "userID")) or IsNull(Session(strUniqueID & "userID")) or trim(Session(strUniqueID & "userID")) = "" then
        Call setMemberSessVars(ChkString(Request.Cookies(strUniqueID & "User")("Name"), "SQLString"),ChkString(Request.Cookies(strUniqueID & "User")("Pword"), "SQLString"))
        setMemberVars()
      else
        Session(strUniqueID & "userID") = Session(strUniqueID & "userID")
        setMemberVars()
      end if
       
    else
        strDBNTUserName = ""
        strUserMemberID = 0
        strUserEmail = ""
        strMTimeAdjust = 0
        mLev = 0
        PMaccess = 0
    end if
  end if
end function

function setMemberVars()   
    strDBNTUserName = Session(strUniqueID & "username")
    strUserMemberID = clng(Session(strUniqueID & "userID"))
    strUserEmail = Session(strUniqueID & "useremail")
    mLev = Session(strUniqueID & "usermlev")
    intIsSuperAdmin = chkIsSuperAdmin(2,strDBNTUsername)
    'strMBirthday = rsCheck("M_AGE")
    strMTimeAdjust = Session(strUniqueID & "usertimeadjust")
    strMTimeType = Session(strUniqueID & "usertimetype")
    intMemberLCID = Session(strUniqueID & "userlcid")
    if len(intMemberLCID) = 4 or len(intMemberLCID) = 5 then
      Session.LCID = intMemberLCID
      strDateFormat = getDateFormat()
    end if
           
    strTimeType = strMTimeType
    strMCurDateAdjust = DateAdd("h", (strTimeAdjust + strMTimeAdjust) , now())
    strMCurDateString = DateToStr2(strMCurDateAdjust)
    strForumDateAdjust = ChkDate2(strMCurDateString)
    strForumTimeAdjust = strForumDateAdjust & chkTime2(strMCurDateString)
           
    PMaccess = cint(Session(strUniqueID & "userpmaccess"))
end function

function setMemberSessVars(mname,mpass)
  strSql = "SELECT MEMBER_ID, M_NAME, M_USERNAME, M_LEVEL, M_EMAIL, M_PASSWORD, M_PMSTATUS"
  strSql = strSql & ", M_PMRECEIVE, M_TIME_OFFSET, M_TIME_TYPE, M_LCID, M_AGE"
  strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS"
  strSql = strSql & " WHERE M_NAME = '" & mname & "'"
  if strAuthType = "db" then
    strSql = strSql & " AND M_PASSWORD = '" & mpass &"'"
  end if
  strSql = strSql & " and M_STATUS=1"
  'response.Write(strSql & "<br /><br />")
  Set rsCheck = my_Conn.Execute(strSql)
  if rsCheck.BOF and rsCheck.EOF then
    Call ClearCookies()
    strDBNTUserName = ""
    strUserMemberID = 0
    strUserEmail = ""
    strMTimeAdjust = 0
    mLev = 0
    PMaccess = 0
  else
    if strAuthType = "nt" then
      Session(strUniqueID & "username") = rsCheck("M_USERNAME")
    else
      Session(strUniqueID & "username") = rsCheck("M_NAME")
    end if
    Session(strUniqueID & "userID") = clng(rsCheck("MEMBER_ID"))
    Session(strUniqueID & "useremail") = rsCheck("M_EMAIL")
    Session(strUniqueID & "usermlev") = rsCheck("M_LEVEL")+1
    Session(strUniqueID & "usertimeadjust") = rsCheck("M_TIME_OFFSET")
    Session(strUniqueID & "usertimetype") = rsCheck("M_TIME_TYPE")
    Session(strUniqueID & "userlcid") = rsCheck("M_LCID")
    Session(strUniqueID & "userpmaccess") = rsCheck("M_PMSTATUS")
    if rsCheck("M_PMRECEIVE") = 0 then
      Session(strUniqueID & "userpmaccess") = 0
    end if
  end if
  set rsCheck = nothing
end function

function setMemberVars_old(mname,mpass)
  strSql = "SELECT MEMBER_ID, M_NAME, M_USERNAME, M_LEVEL, M_EMAIL, M_PASSWORD, M_PMSTATUS"
  strSql = strSql & ", M_PMRECEIVE, M_TIME_OFFSET, M_TIME_TYPE, M_LCID, M_AGE"
  strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS"
  strSql = strSql & " WHERE M_NAME = '" & mname & "'"
  if strAuthType = "db" then
    strSql = strSql & " AND M_PASSWORD = '" & mpass &"'"
  end if
  strSql = strSql & " and M_STATUS=1"
  'response.Write(strSql & "<br /><br />")
  Set rsCheck = my_Conn.Execute(strSql)
  if rsCheck.BOF and rsCheck.EOF then
    Call ClearCookies()
    strDBNTUserName = ""
    strUserMemberID = 0
    strUserEmail = ""
    mLev = 0
    PMaccess = 0
  else
    if strAuthType = "nt" then
      Session(strUniqueID & "username") = rsCheck("M_USERNAME")
    end if
    strDBNTUserName = rsCheck("M_NAME")
    strUserMemberID = clng(rsCheck("MEMBER_ID"))
    strUserEmail = rsCheck("M_EMAIL")
    mLev = rsCheck("M_LEVEL")+1
    intIsSuperAdmin = chkIsSuperAdmin(2,strDBNTUsername)
    strMBirthday = rsCheck("M_AGE")
    strMTimeAdjust = rsCheck("M_TIME_OFFSET")
    strMTimeType = rsCheck("M_TIME_TYPE")
    intMemberLCID = rsCheck("M_LCID")
    if len(intMemberLCID) = 4 or len(intMemberLCID) = 5 then
      Session.LCID = intMemberLCID
      strDateFormat = getDateFormat()
    end if
           
    strTimeType = strMTimeType
    strMCurDateAdjust = DateAdd("h", (strTimeAdjust + strMTimeAdjust) , now())
    strMCurDateString = DateToStr2(strMCurDateAdjust)
    strForumDateAdjust = ChkDate2(strMCurDateString)
    strForumTimeAdjust = strForumDateAdjust & chkTime2(strMCurDateString)
           
    PMaccess = rsCheck("M_PMSTATUS")
    if rsCheck("M_PMRECEIVE") = 0 then
      PMaccess = 0
    else
    end if
  end if
  set rsCheck = nothing
end function

function bldArrUserGroup()
  if strUserMemberID > 0 then ':: they are a member
    strSql = "SELECT G_GROUP_ID, G_GROUP_LEADER FROM " & strTablePrefix & "GROUP_MEMBERS WHERE G_MEMBER_ID = " & strUserMemberID
    set rsApp = my_Conn.execute(strSql)
    if not rsApp.eof then
        tmpArr1 = "2," 'add member group by default
        tmpArr2 = "0,"
        do until rsApp.eof
            tmpArr1 = tmpArr1 & rsApp("G_GROUP_ID") & ","
            tmpArr2 = tmpArr2 & rsApp("G_GROUP_LEADER") & ","
            rsApp.movenext
        loop
        if tmpArr1 <> "" then
            tmpArr3 = split(tmpArr1,",")
            tmpArr4 = split(tmpArr2,",")
            acnt = ubound(tmpArr3)-1
            redim arrGroups(acnt,1)
            for ag = 0 to ubound(tmpArr3)-1
                arrGroups(ag,0) = tmpArr3(ag)
                arrGroups(ag,1) = tmpArr4(ag)
            next
        end if
    else
        redim arrGroups(0,1)
        arrGroups(0,0) = "2" 'members group
        arrGroups(0,1) = "0" 'not group leader
    end if
    set rsApp = nothing
   
  else '::they are a guest
    redim arrGroups(0,1)
    arrGroups(0,0) = "3" 'GUEST group
    arrGroups(0,1) = "0" 'not group leader
  end if
end function

function bldArrAppAccess()
    dim tmpAppID, tmpAppActive, tmpAppGroupsR, tmpAppGroupsW, tmpAppGroupsF, tmpAppIName, bHasAccess
    dim tmpAppSubsc, tmpAppBkMk
    'bHasAccess = true
   
        tmpApp = split(Application(strCookieURL & strUniqueID & "strAppVars"),";")
        tmpAppID = tmpApp(0)
        tmpAppIName = tmpApp(1)
        tmpAppActive = tmpApp(2)
        tmpAppGroupsR = tmpApp(3)
        tmpAppGroupsW = tmpApp(4)
        tmpAppGroupsF = tmpApp(5)
        tmpAppSubsc = tmpApp(6)
        tmpAppBkMk = tmpApp(7)
        tmpAppSecCode = tmpApp(8)
        tmpiData1 = tmpApp(9)
        tmpiData2 = tmpApp(10)
        tmpiData3 = tmpApp(11)
        tmpiData4 = tmpApp(12)
        tmpiData5 = tmpApp(13)
        tmpiData6 = tmpApp(14)
        tmpiData7 = tmpApp(15)
        tmpiData8 = tmpApp(16)
        tmpiData9 = tmpApp(17)
        tmpiData10 = tmpApp(18)
        tmptData1 = tmpApp(19)
        tmptData2 = tmpApp(20)
        tmptData3 = tmpApp(21)
        tmptData4 = tmpApp(22)
        tmptData5 = tmpApp(23)
     
      if tmpAppID <> "" then
        tmpAppID1 = split(tmpAppID,"@")
        tmpAppIName1 = split(tmpAppIName,"@")
        tmpAppActive1 = split(tmpAppActive,"@")
        tmpAppGroupsR1 = split(tmpAppGroupsR,"@")
        tmpAppGroupsW1 = split(tmpAppGroupsW,"@")
        tmpAppGroupsF1 = split(tmpAppGroupsF,"@")
        tmpAppSubsc1 = split(tmpAppSubsc,"@")
        tmpAppBkMk1 = split(tmpAppBkMk,"@")
        tmpAppSecCode1 = split(tmpAppSecCode,"@")
        tmpiData11 = split(tmpiData1,"@")
        tmpiData12 = split(tmpiData2,"@")
        tmpiData13 = split(tmpiData3,"@")
        tmpiData14 = split(tmpiData4,"@")
        tmpiData15 = split(tmpiData5,"@")
        tmpiData16 = split(tmpiData6,"@")
        tmpiData17 = split(tmpiData7,"@")
        tmpiData18 = split(tmpiData8,"@")
        tmpiData19 = split(tmpiData9,"@")
        tmpiData110 = split(tmpiData10,"@")
        tmptData11 = split(tmptData1,"@")
        tmptData12 = split(tmptData2,"@")
        tmptData13 = split(tmptData3,"@")
        tmptData14 = split(tmptData4,"@")
        tmptData15 = split(tmptData5,"@")
        acnt = ubound(tmpAppID1)-1
        redim arrAppPerms(acnt,23)
        for ag = 0 to acnt
          arrAppPerms(ag,0) = tmpAppID1(ag)
          arrAppPerms(ag,1) = tmpAppIName1(ag)
          arrAppPerms(ag,2) = tmpAppActive1(ag)
          arrAppPerms(ag,3) = tmpAppGroupsR1(ag)
          arrAppPerms(ag,4) = tmpAppGroupsW1(ag)
          arrAppPerms(ag,5) = tmpAppGroupsF1(ag)
          arrAppPerms(ag,6) = tmpAppSubsc1(ag)
          arrAppPerms(ag,7) = tmpAppBkMk1(ag)
          arrAppPerms(ag,8) = tmpAppSecCode1(ag)
          arrAppPerms(ag,9) = tmpiData11(ag)
          arrAppPerms(ag,10) = tmpiData12(ag)
          arrAppPerms(ag,11) = tmpiData13(ag)
          arrAppPerms(ag,12) = tmpiData14(ag)
          arrAppPerms(ag,13) = tmpiData15(ag)
          arrAppPerms(ag,14) = tmpiData16(ag)
          arrAppPerms(ag,15) = tmpiData17(ag)
          arrAppPerms(ag,16) = tmpiData18(ag)
          arrAppPerms(ag,17) = tmpiData19(ag)
          arrAppPerms(ag,18) = tmpiData110(ag)
          arrAppPerms(ag,19) = tmptData11(ag)
          arrAppPerms(ag,20) = tmptData12(ag)
          arrAppPerms(ag,21) = tmptData13(ag)
          arrAppPerms(ag,22) = tmptData14(ag)
          arrAppPerms(ag,23) = tmptData15(ag)
        next
      end if
end function

function bldArrAppAccess_old()
    dim tmpAppID, tmpAppActive, tmpAppGroupsR, tmpAppGroupsW, tmpAppGroupsF, tmpAppIName, bHasAccess
    dim tmpAppSubsc, tmpAppBkMk
    'bHasAccess = true
    sSql = "SELECT * FROM "& strTablePrefix & "APPS"
    set rsA = my_Conn.execute(sSql)
    if not rsA.eof then
      do until rsA.eof
        tmpAppID = tmpAppID & rsA("APP_ID") & "|"
        tmpAppIName = tmpAppIName & rsA("APP_iNAME") & "|"
        tmpAppActive = tmpAppActive & rsA("APP_ACTIVE") & "|"
        tmpAppGroupsR = tmpAppGroupsR & rsA("APP_GROUPS_USERS") & "|"
        tmpAppGroupsW = tmpAppGroupsW & rsA("APP_GROUPS_WRITE") & "|"
        tmpAppGroupsF = tmpAppGroupsF & rsA("APP_GROUPS_FULL") & "|"
        tmpAppSubsc = tmpAppSubsc & rsA("APP_SUBSCRIPTIONS") & "|"
        tmpAppBkMk = tmpAppBkMk & rsA("APP_BOOKMARKS") & "|"
        tmpAppSecCode = tmpAppSecCode & rsA("APP_SUBSEC") & "|"
        tmpiData1 = tmpiData1 & rsA("APP_iData1") & "|"
        tmpiData2 = tmpiData2 & rsA("APP_iData2") & "|"
        tmpiData3 = tmpiData3 & rsA("APP_iData3") & "|"
        tmpiData4 = tmpiData4 & rsA("APP_iData4") & "|"
        tmpiData5 = tmpiData5 & rsA("APP_iData5") & "|"
        tmpiData6 = tmpiData6 & rsA("APP_iData6") & "|"
        tmpiData7 = tmpiData7 & rsA("APP_iData7") & "|"
        tmpiData8 = tmpiData8 & rsA("APP_iData8") & "|"
        tmpiData9 = tmpiData9 & rsA("APP_iData9") & "|"
        tmpiData10 = tmpiData10 & rsA("APP_iData10") & "|"
        tmptData1 = tmptData1 & rsA("APP_tData1") & "|"
        tmptData2 = tmptData2 & rsA("APP_tData2") & "|"
        tmptData3 = tmptData3 & rsA("APP_tData3") & "|"
        tmptData4 = tmptData4 & rsA("APP_tData4") & "|"
        tmptData5 = tmptData5 & rsA("APP_tData5") & "|"
        rsA.movenext
      loop
      if tmpAppID <> "" then
        tmpAppID1 = split(tmpAppID,"|")
        tmpAppIName1 = split(tmpAppIName,"|")
        tmpAppActive1 = split(tmpAppActive,"|")
        tmpAppGroupsR1 = split(tmpAppGroupsR,"|")
        tmpAppGroupsW1 = split(tmpAppGroupsW,"|")
        tmpAppGroupsF1 = split(tmpAppGroupsF,"|")
        tmpAppSubsc1 = split(tmpAppSubsc,"|")
        tmpAppBkMk1 = split(tmpAppBkMk,"|")
        tmpAppSecCode1 = split(tmpAppSecCode,"|")
        tmpiData11 = split(tmpiData1,"|")
        tmpiData12 = split(tmpiData2,"|")
        tmpiData13 = split(tmpiData3,"|")
        tmpiData14 = split(tmpiData4,"|")
        tmpiData15 = split(tmpiData5,"|")
        tmpiData16 = split(tmpiData6,"|")
        tmpiData17 = split(tmpiData7,"|")
        tmpiData18 = split(tmpiData8,"|")
        tmpiData19 = split(tmpiData9,"|")
        tmpiData110 = split(tmpiData10,"|")
        tmptData11 = split(tmptData1,"|")
        tmptData12 = split(tmptData2,"|")
        tmptData13 = split(tmptData3,"|")
        tmptData14 = split(tmptData4,"|")
        tmptData15 = split(tmptData5,"|")
        acnt = ubound(tmpAppID1)-1
        redim arrAppPerms(acnt,23)
        for ag = 0 to acnt
          arrAppPerms(ag,0) = tmpAppID1(ag)
          arrAppPerms(ag,1) = tmpAppIName1(ag)
          arrAppPerms(ag,2) = tmpAppActive1(ag)
          arrAppPerms(ag,3) = tmpAppGroupsR1(ag)
          arrAppPerms(ag,4) = tmpAppGroupsW1(ag)
          arrAppPerms(ag,5) = tmpAppGroupsF1(ag)
          arrAppPerms(ag,6) = tmpAppSubsc1(ag)
          arrAppPerms(ag,7) = tmpAppBkMk1(ag)
          arrAppPerms(ag,8) = tmpAppSecCode1(ag)
          arrAppPerms(ag,9) = tmpiData11(ag)
          arrAppPerms(ag,10) = tmpiData12(ag)
          arrAppPerms(ag,11) = tmpiData13(ag)
          arrAppPerms(ag,12) = tmpiData14(ag)
          arrAppPerms(ag,13) = tmpiData15(ag)
          arrAppPerms(ag,14) = tmpiData16(ag)
          arrAppPerms(ag,15) = tmpiData17(ag)
          arrAppPerms(ag,16) = tmpiData18(ag)
          arrAppPerms(ag,17) = tmpiData19(ag)
          arrAppPerms(ag,18) = tmpiData110(ag)
          arrAppPerms(ag,19) = tmptData11(ag)
          arrAppPerms(ag,20) = tmptData12(ag)
          arrAppPerms(ag,21) = tmptData13(ag)
          arrAppPerms(ag,22) = tmptData14(ag)
          arrAppPerms(ag,23) = tmptData15(ag)
        next
      end if
    else
    end if
end function

function bldAppAccess()
    dim tmpAppID, tmpAppActive, tmpAppGroupsR, tmpAppGroupsW, tmpAppGroupsF, tmpAppIName, bHasAccess
    dim tmpAppSubsc, tmpAppBkMk
    dim tmpApp
    tmpApp = ""
    'bHasAccess = true
    sSql = "SELECT * FROM "& strTablePrefix & "APPS"
    set rsA = my_Conn.execute(sSql)
    if not rsA.eof then
      do until rsA.eof
        tmpAppID = tmpAppID & rsA("APP_ID") & "@"
        tmpAppIName = tmpAppIName & rsA("APP_iNAME") & "@"
        tmpAppActive = tmpAppActive & rsA("APP_ACTIVE") & "@"
        tmpAppGroupsR = tmpAppGroupsR & rsA("APP_GROUPS_USERS") & "@"
        tmpAppGroupsW = tmpAppGroupsW & rsA("APP_GROUPS_WRITE") & "@"
        tmpAppGroupsF = tmpAppGroupsF & rsA("APP_GROUPS_FULL") & "@"
        tmpAppSubsc = tmpAppSubsc & rsA("APP_SUBSCRIPTIONS") & "@"
        tmpAppBkMk = tmpAppBkMk & rsA("APP_BOOKMARKS") & "@"
        tmpAppSecCode = tmpAppSecCode & rsA("APP_SUBSEC") & "@"
        tmpiData1 = tmpiData1 & rsA("APP_iData1") & "@"
        tmpiData2 = tmpiData2 & rsA("APP_iData2") & "@"
        tmpiData3 = tmpiData3 & rsA("APP_iData3") & "@"
        tmpiData4 = tmpiData4 & rsA("APP_iData4") & "@"
        tmpiData5 = tmpiData5 & rsA("APP_iData5") & "@"
        tmpiData6 = tmpiData6 & rsA("APP_iData6") & "@"
        tmpiData7 = tmpiData7 & rsA("APP_iData7") & "@"
        tmpiData8 = tmpiData8 & rsA("APP_iData8") & "@"
        tmpiData9 = tmpiData9 & rsA("APP_iData9") & "@"
        tmpiData10 = tmpiData10 & rsA("APP_iData10") & "@"
        tmptData1 = tmptData1 & rsA("APP_tData1") & "@"
        tmptData2 = tmptData2 & rsA("APP_tData2") & "@"
        tmptData3 = tmptData3 & rsA("APP_tData3") & "@"
        tmptData4 = tmptData4 & rsA("APP_tData4") & "@"
        tmptData5 = tmptData5 & rsA("APP_tData5") & "@"
        rsA.movenext
      loop
     
      tmpApp = tmpAppID & ";" & tmpAppIName & ";" & tmpAppActive & ";" & tmpAppGroupsR & ";" & tmpAppGroupsW & ";" & tmpAppGroupsF & ";" & tmpAppSubsc & ";" & tmpAppBkMk & ";" & tmpAppSecCode & ";" & tmpiData1 & ";" & tmpiData2 & ";" & tmpiData3 & ";" & tmpiData4 & ";" & tmpiData5 & ";" & tmpiData6 & ";" & tmpiData7 & ";" & tmpiData8 & ";" & tmpiData9 & ";" & tmpiData10 & ";" & tmptData1 & ";" & tmptData2 & ";" & tmptData3 & ";" & tmptData4 & ";" & tmptData5
     
    end if
    set rsA = nothing
   
    bldAppAccess = tmpApp
end function



'##############################################
'##            NT Authentication            ##
'##############################################
sub regNTuser()
        strSql = "INSERT INTO " & strMemberTablePrefix & "MEMBERS "
        strSql = strSql & "(M_NAME"
        strSql = strSql & ", M_USERNAME"
        strSql = strSql & ", M_PASSWORD"
        strSql = strSql & ", M_EMAIL"
        strSql = strSql & ", M_KEY"
        strSql = strSql & ", M_LEVEL"
        strSql = strSql & ", M_DATE"
        strSql = strSql & ", M_LASTHEREDATE"
        strSql = strSql & ", M_IP"
        strSql = strSql & ", M_RNAME"
        strSql = strSql & ", M_STATUS"
        strSql = strSql & ", M_GLOW"
        strSql = strSql & ", THEME_ID"
        strSql = strSql & ", M_RECMAIL"
        strSql = strSql & ", M_HIDE_EMAIL"
        strSql = strSql & ", M_TIME_TYPE"
        strSql = strSql & ", M_TIME_OFFSET"
        strSql = strSql & ", M_LCID"
        strsql = strsql & ", M_PHOTO_URL"
        strsql = strsql & ", M_AVATAR_URL"
        strSql = strSql & ") VALUES ("
        strSql = strSql & "'" & Session(strUniqueID & "userID") & "'"
        strSql = strSql & ", " & "'" & Session(strUniqueID & "userID") & "'"
        strSql = strSql & ", " & "'" & pEncrypt(pEnPrefix & Session(strUniqueID & "strNTUserFullName")) & "'"
        strSql = strSql & ", " & "'" & Request.Form("Email") & "'"
        strSql = strSql & ", " & "'" & actkey & "'"
        strSql = strSql & ", 1"
        strSql = strSql & ", " & "'" & strCurDateString & "'"
        strSql = strSql & ", " & "'" & strCurDateString & "'"
        strSql = strSql & ", '" & Request.ServerVariables("REMOTE_HOST") & "'"   
        strSql = strSql & ", 'x'"
        strSql = strSql & ", 1"
        strSql = strSql & ", ''"
        strSql = strSql & ", '" & strDefTheme & "'"
        strsql = strsql & ", '0'"
        strSql = strSql & ", 1"   
        strSql = strSql & ", '" & strTimeType & "'"   
        strSql = strSql & ", " & strTimeAdjust & ""   
        strSql = strSql & ", " & intPortalLCID & ""   
        strSql = strSql & ", 'images/no_photo.gif'"   
        strSql = strSql & ", 'files/avatars/noavatar.gif'"                       
        strSql = strSql & ")"
        executeThis(strSql)
       
    '## Updates the member count by 1
    strSql = "UPDATE " & strTablePrefix & "TOTALS "
    strSql = strSql & "SET U_COUNT = (U_COUNT+1) WHERE ID = 1"
    executeThis(strSql)
end sub

sub NTUser()
        Call setMemberSessVars(Session(strUniqueID & "username"),"")
        setMemberVars()
        'if hasAccess(1) then
        if chkIsAdmin(strUserMemberID) then
          Session(strCookieURL & "Approval") = "256697926329"
        end if
end sub

function ChkAccountReg()
  if Session(strUniqueID & "userID") = "" then
    ChkAccountReg = "0"
  else
    strSql ="SELECT " & strMemberTablePrefix & "MEMBERS.M_USERNAME "
    strSql = strSql & "FROM " & strMemberTablePrefix & "MEMBERS "
    strSql = strSql & "WHERE " & strMemberTablePrefix & "MEMBERS.M_USERNAME = '" & Session(strUniqueID & "userID") & "' "
    strSql = strSql & "AND " & strMemberTablePrefix & "MEMBERS.M_STATUS = 1"

    set rs_chk = my_conn.Execute(strSql)

    if rs_chk.BOF and rs_chk.EOF then
        'ChkAccountReg = "0"
        call regNTuser()
        ChkAccountReg = "1"
    else
        ChkAccountReg = "1"
    end if
   
    set rs_chk = nothing
  end if
end function

sub NTAuthenticate()
    dim strUser, strNTUser, checkNT
    strNTUser = Request.ServerVariables("AUTH_USER")
    strNTUser = replace(strNTUser, "\", "/")
    if Session(strUniqueID & "username") = "" then
        strUser = Mid(strNTUser,(instr(1,strNTUser,"/")+1),len(strNTUser))
        Session(strUniqueID & "username") = strUser
    else
        Session(strUniqueID & "username") = Session(strUniqueID & "username")
    end if
    if strNTGroups="1" then
        strNTGroupsSTR = Session(strUniqueID & "strNTGroupsSTR")
        if trim(strNTGroupsSTR) = "" then
            Set strNTUserInfo = GetObject("WinNT://"+strNTUser)
            For Each strNTUserInfoGroup in strNTUserInfo.Groups
                strNTGroupsSTR=strNTGroupsSTR+", "+strNTUserInfoGroup.name
            NEXT
            Session(strUniqueID & "strNTGroupsSTR") = strNTGroupsSTR
        end if
    end if

    if strAutoLogon="1" then
        strNTUserFullName = Session(strUniqueID & "strNTUserFullName")
        if Session(strUniqueID & "strNTUserFullName") = "" then
            Set strNTUserInfo = GetObject("WinNT://"+strNTUser)
            strNTUserFullName=strNTUserInfo.FullName
            Session(strUniqueID & "strNTUserFullName") = strNTUserFullName
        end if
    end if
end sub

sub NTdebug()
  Response.Write("AUTH_USER: " & Request.ServerVariables("AUTH_USER") & "<br />")
  Response.Write("userid: " & Session(strUniqueID & "userID") & "<br />")
  Response.Write("username: " & Session(strUniqueID & "username") & "<br />")
  Response.Write("strNTUserFullName: " & Session(strUniqueID & "strNTUserFullName") & "<br />")
  Response.Write("strNTGroupsSTR: " & Session(strUniqueID & "strNTGroupsSTR") & "<br />")
  Response.Write("ChkAccountReg: " & ChkAccountReg & "<br />")
  'Response.Write(" " &  & "<br />")
  Response.End()
  'Response.Write(": " &  & "<br />")
end sub
Avatar billede goose Nybegynder
17. november 2007 - 14:30 #3
Det var dog den mest omstændige loginfunktion jeg nogenside har set, den må jeg sg* melde pas på.

/Goose
Avatar billede webbygger Nybegynder
17. november 2007 - 15:07 #4
Syntes også den ser uskuligt ud ;0)

Jeg ved ikke om, man kan lave denne her om så man undgå login siden!
Det er login boxen - jeg har prøvet at "pille" ved "<%=Request.ServerVariables("URL")%>" , men det er ikke lykkes for mig endnu. Gad vide om det kan lade sig gør???


<% Sub showloginbox() %>
    <table class="sp_Header_Login" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" align="right">
        <tr>
          <td align="right" valign="middle">
            <form action="<%=Request.ServerVariables("URL")%>" method="post" id="formb1" name="formb1">
          <table width="100%" border="0" cellpadding="3" cellspacing="0">
              <input type="hidden" name="Method_Type" value="login" />
              <tr>
                <td width="90" align="center" valign="middle"><b>&nbsp;<%= txtUsrName %>:</b><br />
                  &nbsp;<input class="textbox" type="text" name="Name" size="10" />
                </td>
                <td width="90" align="center" valign="middle"><b><%= txtPass %>:</b><br />
                  <input class="textbox" type="password" name="Password" size="10" />
                </td>
                <td width="75" align="center" valign="middle">&nbsp;<input class="btnLogin" type="submit" value="<%= txtLogin %>" id="submitx1" name="submitx1" />
                </td>
              </tr>
              <tr>
                <td colspan="3" align="center">
                  <input type="checkbox" name="SavePassWord" value="true" checked />
                  <span class="fSmall"><%= txtSvPass %>&nbsp;&nbsp;</span>
                  <%if (lcase(strEmail) = "1") then %>
                  <a href="password.asp"><span class="fSmall"><%= txtForgotPass %>?</span></a>&nbsp;&nbsp;
                  <% end if
                  if strNewReg = 1 then %>
                  <br /><span class="fSmall"><%= txtNotMember %>?</span>
                  <a href="policy.asp"><span class="fSmall"><%= txtRegNow %>!</span></a>
                  <% End If %>
                  </td>
              </tr>
          </table>
            </form>
                </td>
            </tr>
    </table>
<% End Sub %>
Avatar billede webbygger Nybegynder
01. november 2008 - 21:38 #5
Lukker spørgsmålet
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester