• User Newbie

    Aiuto Per Un Login

    Buongiorno, non sono molto esperto ma ho fatto un sito nel quale non riesco a fare una cosa.
    Allora io ho una chat privata a camera singola; per entrare bisogna mettere un nickname ma per poter mettere il nickname ho messo una pagina protetta in cui uno puo' inserire il nickname ed entrare solo se è registrato nel database.
    Nel database ho i campi : Nome / Numero tessera / codice personale
    Posso fare in modo che nella pagina dove inserire il nickname per la chat ci vada messo il nome che ho nel database con il quale uno è entrato senza possibilità di cambiarlo in modo tale che nella chat il nickname è il suo nome ??

    In attesa di risposta grazie a tutti


  • User Newbie

    QUESTA E' LA STANZA IN CUI SI CHATTA

    <%
    '----------------setup------------------
    title="AspChat v2" 'title of web page
    '----------------/setup------------------

    if request("event")="login" then
    if (InStr(application("emchatusers"), ","& request("login") &",")<>0) then response.redirect("default.asp?error=1&username=" & request("login"))
    Response.Cookies("emchatlogin")=request("login")
    application("emchatusers") = application("emchatusers") & request("login") &"," & minute(now) & ","
    Application(20)=Application(19)
    Application(19)=Application(18)
    Application(18)=Application(17)
    Application(17)=Application(16)
    Application(16)=Application(15)
    Application(15)=Application(14)
    Application(14)=Application(13)
    Application(13)=Application(12)
    Application(12)=Application(11)
    Application(11)=Application(10)
    Application(10)=Application(9)
    Application(9)=Application(8)
    Application(8)=Application(7)
    Application(7)=Application(6)
    Application(6)=Application(5)
    Application(5)=Application(4)
    Application(4)=Application(3)
    Application(3)=Application(2)
    Application(2)=Application(1)
    Application("1")="<font color='green'><b>"& request.Cookies("emchatlogin") & "</b> enters chatroom</font>"
    Response.Redirect "chat.asp"
    end if
    if request.Cookies("emchatlogin")="" then Response.Redirect"default.asp"
    if mid(request.Cookies("emchatlogin"),1,1)=" " then Response.Redirect"default.asp"

    if request("event")="post" then
    Application(20)=Application(19)
    Application(19)=Application(18)
    Application(18)=Application(17)
    Application(17)=Application(16)
    Application(16)=Application(15)
    Application(15)=Application(14)
    Application(14)=Application(13)
    Application(13)=Application(12)
    Application(12)=Application(11)
    Application(11)=Application(10)
    Application(10)=Application(9)
    Application(9)=Application(8)
    Application(8)=Application(7)
    Application(7)=Application(6)
    Application(6)=Application(5)
    Application(5)=Application(4)
    Application(4)=Application(3)
    Application(3)=Application(2)
    Application(2)=Application(1)
    Application("1")="<b>" & request.Cookies("emchatlogin") & ":</b>"& request("text")
    Response.Redirect "chat.asp?event=form"
    end if
    if request("event")="logout" then
    Application(20)=Application(19)
    Application(19)=Application(18)
    Application(18)=Application(17)
    Application(17)=Application(16)
    Application(16)=Application(15)
    Application(15)=Application(14)
    Application(14)=Application(13)
    Application(13)=Application(12)
    Application(12)=Application(11)
    Application(11)=Application(10)
    Application(10)=Application(9)
    Application(9)=Application(8)
    Application(8)=Application(7)
    Application(7)=Application(6)
    Application(6)=Application(5)
    Application(5)=Application(4)
    Application(4)=Application(3)
    Application(3)=Application(2)
    Application(2)=Application(1)
    Application("1")="<font color='green'><b>"& request.Cookies("emchatlogin") & "</b> leaves chatroom</font>"

    userarray=split(application("emchatusers"),",")
    userscount=int(((UBound(userarray)+1))-0.5)
    for f = 0 to userscount-1 step 2
    if userarray(f)=request.Cookies("emchatlogin") then
    reptmp=userarray(f) & "," & userarray(f+1) &","
    application("emchatusers") = replace(application("emchatusers"),reptmp,"")
    end if
    next

    Response.Cookies("emchatlogin")=""
    Response.Redirect"default.asp"
    end if
    if request("event")="form" then
    %>
    <body bgcolor="#FFCC99" topmargin="5">
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr>
    <td>
    <form action='chat.asp?event=post' method='post' name='chatform'>
    <input type='text' name='text' size='50'>
    <input type="image" src="http://www.giorgiotave.it/forum/images/post.gif" width="84" height="18" border="0">
    </td>
    <td width="120">
    <a href="chat.asp?event=setup" target="_top"><p align="right"><img border="0" src="http://www.giorgiotave.it/forum/images/setup.gif" width="44" height="18" ><a href="chat.asp?event=logout" target="_top"></a>
    <img border="0" src="http://www.giorgiotave.it/forum/images/exit.gif" width="44" height="18"></a>
    </td>
    </tr>
    </table>
    </form>

    <script language="VBScript">
    Sub Window_onLoad
    chatform.text.focus
    End Sub
    </script>
    <%
    end if

    if request("event")="show" then
    Response.Write "<meta http-equiv='refresh' content='" & request.Cookies("emchatrefresh") &"'>"
    Response.Write "<body bgcolor='#ECE4B0'>"
    Response.Write "<font face='arial,verdana' size='2'>"
    for f=1 to 20
    Response.Write Application(f) & "<br>"
    next
    userarray=split(application("emchatusers"),",")
    userscount=int(((UBound(userarray)+1))-0.5)

    for f = 0 to userscount-1 step 2
    if abs(minute(now)-int(userarray(f+1))) > 2 then
    application("emchatusers")=replace(application("emchatusers"),userarray(f) & "," & userarray(f+1) & ",","")
    end if
    if userarray(f)=request("userrefresh") then
    reptmp=userarray(f) & "," & userarray(f+1) &","
    application("emchatusers") = replace(application("emchatusers"),reptmp,userarray(f) & "," & minute(now) &",")
    end if
    next
    end if

    if request("event")="listusers" then
    Response.Write "<meta http-equiv='refresh' content='30'>"
    Response.Write "<body bgcolor='#FFCC99'>"
    Response.Write "<font face='arial,verdana' size='2'>"
    userarray=split(application("emchatusers"),",")
    userscount=int(((UBound(userarray)+1))-0.5)
    for f = 0 to userscount-1 step 2
    response.write userarray(f) & "<br>"
    next
    end if

    if request("event")="" then
    if request.Cookies("barpos")="" then
    %>
    <title><%=title%></title>
    <frameset rows="37," frameborder="0">
    <frame name="header" scrolling="no" noresize target="main" src="chat.asp?event=form">
    <frameset cols="
    ,130">
    <frame name="main" target="main" scrolling="auto" noresize src="chat.asp?event=show&userrefresh=<%=request.Cookies("emchatlogin")%>">
    <frame name="main" scrolling="auto" noresize src="chat.asp?event=listusers" target="main">
    </frameset>
    <noframes>
    <body>
    <p>This page uses frames, but your browser doesn't support them.</p>
    </body>
    </noframes>
    </frameset>
    <%
    end if

    if request.Cookies("barpos")="1" then
    %>
    <frameset rows=",37" frameborder="0">
    <frameset cols="
    ,130">
    <frame name="contents" target="main" scrolling="auto" src="chat.asp?event=show&userrefresh=<%=request.Cookies("emchatlogin")%>">
    <frame name="main" scrolling="auto" src="chat.asp?event=listusers">
    </frameset>
    <frame name="bottom" scrolling="no" noresize target="contents" src="chat.asp?event=form">
    <noframes>
    <body>
    <p>This page uses frames, but your browser doesn't support them.</p>
    </body>
    </noframes>
    </frameset>
    <%
    end if
    end if

    if request("event")="refresh" then
    Response.Cookies("emchatrefresh")=request("refresh")
    Response.Redirect"chat.asp"
    end if
    if request("event")="aptop" then
    Response.Cookies("barpos")=""
    Response.Redirect"chat.asp"
    end if
    if request("event")="aptop1" then
    Response.Cookies("barpos")="1"
    Response.Redirect"chat.asp"
    end if

    if request("event")="setup" then
    %>
    <body bgcolor="#FFCC99">
    <b><font face="Arial" size="4">Appearance</font></b>
    <hr noshade>
    <p align="center"><a href='chat.asp?event=aptop'><img border="0" src="http://www.giorgiotave.it/forum/images/bartopico.gif" width="50" height="38"></a>
     
    <a href='chat.asp?event=aptop1'><img border="0" src="http://www.giorgiotave.it/forum/images/bardownico.gif" width="50" height="38"></a></p>
    <b><font face="Arial" size="4">Refresh</font></b>
    <hr noshade>
    <center>
    <form action='chat.asp?event=refresh' method='post'>
    <select size="1" name='refresh'>
    <option <%if request.Cookies("emchatrefresh")="5" then Response.Write "selected"%>>5</option>
    <option <%if request.Cookies("emchatrefresh")="10" then Response.Write "selected"%>>10</option>
    <option <%if request.Cookies("emchatrefresh")="15" then Response.Write "selected"%>>15</option>
    <option <%if request.Cookies("emchatrefresh")="20" then Response.Write "selected"%>>20</option>
    <option <%if request.Cookies("emchatrefresh")="30" then Response.Write "selected"%>>30</option>
    <option <%if request.Cookies("emchatrefresh")="60" then Response.Write "selected"%>>60</option>
    </select>
    <input type='submit' value='Set refresh (sec.)'>
    </form>

    <%
    end if

    %>

    QUESTA E' LA PAGINA DA INSERIRE IL NICKNAME SE SEI REGISTRATO NEL DATABASE

    <%
    if Session("Autenticato")<>"OK" then
    Response.Redirect("index.asp")
    end if
    %>
    <HTML>
    <HEAD>
    <TITLE>LOGIN</TITLE>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
    </style></HEAD>
    <%
    if Request.Cookies("emchatrefresh")="" then response.Cookies("emchatrefresh")="5"
    %>
    <body bgcolor="#FFCC99" topmargin="5">
    <center>
    <font face='verdana,arial' size='2'>Type nickname
    <form action='chat.asp?event=login' method='post'>
    <input type='text' name='login' size='10'>
    <input type='submit' value='Enter'>
    <%if request("error")=1 then response.write "<br><br><font color='red'>Nick "& request("username") &" is used!</font>"%>
    </form>
    <hr size='1'>

    E QUESTA E' LA PAGINA DI ACCESSO TRAMITE DATABASE

    <HTML>
    <HEAD>
    <TITLE>Login</TITLE>
    <style type="text/css">
    <!--
    .Stile1 {
    font-family: "Comic Sans MS";
    color: #FF0000;
    }
    .Stile2 {font-family: "Comic Sans MS"}
    body {
    background-color: #FFFFFF;
    }
    -->
    </style>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>
    <BODY>
    <div align="center"><span class="Stile1">PAGINA AUTENTIFICAZIONE GRUPPO</span> <BR>
    <BR>
    <BR>
    <BR>
    <BR>
    </div>
    <FORM ACTION="login.asp" METHOD="POST">
    <TABLE ALIGN=CENTER BORDER=0 BGCOLOR=#000000>
    <TR BGCOLOR=#EEEEEE>
    <TD WIDTH=150 ALIGN=CENTER><span class="Stile2">Cognome / Nome </span></td>
    <TD>
    <INPUT NAME="nome_utente" TYPE=TEXT SIZE=20>
    </td>
    </TR>
    <TR BGCOLOR=#EEEEEE>
    <TD WIDTH=150 ALIGN=CENTER class="Stile2">N. Tessera</td>
    <TD>
    <INPUT NAME="password" TYPE=TEXT SIZE=20>
    </td>
    </TR>
    <TR BGCOLOR=#EEEEEE>
    <TD WIDTH=150 ALIGN=CENTER><span class="Stile2">Codice personale</span></td>
    <TD>
    <INPUT NAME="codice" TYPE=PASSWORD SIZE=20>
    </TD>
    </TR>
    <TR BGCOLOR=#EEEEEE>
    <TD HEIGHT=30 COLSPAN=2 ALIGN=CENTER>
    <INPUT NAME="show" TYPE=SUBMIT class="Stile2" VALUE="LOGIN">
    </TD>
    </TR>
    </TABLE>
    <p> </p>
    </FORM>
    <p> </p>
    <p align="center"><a href="default.asp"><img src="Bottoni%20link/back2.gif" width="100" height="60" border="0"></a></p>
    </BODY>
    </HTML>

    IO DOVREI PRELEVARE IL NOME/COGNOME (CAMPO UNICO) DALLA PAGINA DI ACCESSO TRAMITE DATABASE E METTERLO COME CAMPO NELLA PAGINA DEL NICKNAME SENZA CHE UNO ABBIA LA POSSIBILITA' DI CAMBIARLO
    IN MODO TALE CHE IL NOME DELLA PAGINA LOGIN E' UGUALE AL NICKNAME

    GRAZIE


  • Super User

    Ciao Webmaster90,
    ti sposto in ASP.


  • Moderatore

    Non devi far altro che prelevare il testo dell'input "nome_utente" e portartelo dietro con una variabile di sessione

    Ciao
    :ciauz: