Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Dieguinhu Web

Area restrita em flash

Recommended Posts

Galera tenho um sistema em ASP ...que contem uma area restrita...

 

Como faço pra colocar ela no flash do jeito que está o meu cód?

 

logon.asp

 

<%@ LANGUAGE="VBScript" %>
<% 
  Option Explicit
  'Buffer the response, so Response.Expires can be used
  Response.Buffer = TRUE
  Response.Expires = -1
%>

<?xml version="1.0"?>
<!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">

  <!--
  Liberum Help Desk, Copyright (C) 2000-2001 Doug Luxem
  Liberum Help Desk comes with ABSOLUTELY NO WARRANTY
  Please view the license.html file for the full GNU General Public License.

  Filename: logon.asp
  Date:	 $Date: 2002/01/19 16:32:56 $
  Version:  $Revision: 1.52 $
  Purpose:  Get username and password from user.  Will redirect them
  back to where they entered.
  -->
  <!--	#include file = "settings.asp" -->
  <!-- 	#include file = "public.asp" -->

  <%
  Call SetAppVariables

  Dim cnnDB, sid
  Set cnnDB = CreateCon
  sid = GetSid

  %>

  <head>
	<title>
	  <% = Cfg(cnnDB, "SiteName") %> <%=lang(cnnDB, "HelpDesk")%>
	</title>
	<link rel="stylesheet" type="text/css" href="default.css">
  </head>
  <body>

	<%
	  ' **************************************
	  ' Get logon info.
	  ' **************************************

	  ' By default, the user will not have admin access.
	  ' User must enter password on admin page.
	  Dim username, url, invalid

	  url = Trim(Request.QueryString("URL"))
	  If Len(url) = 0 Then
		url = "default.asp"
	  End If

	  Select Case Cfg(cnnDB, "AuthType")

		Case 1	' NT Authentication
		  Dim domainLen
		  username = Request.ServerVariables("AUTH_USER")

		  If Len(username) = 0 Then
			Call DisplayError(3, lang(cnnDB, "UnabletoobtainusernamewithNTauthentication"))
		  End If

		  domainLen = InStr(username, "\")
		  username = Mid(username, (domainLen+1), (Len(username)-domainLen))
		  username = Lcase(username)

		  If CBool(InStr(username, "'")) Then
			Call DisplayError (3, lang(cnnDB, "Username") & " " & Lang(cnnDB, "containsinvalidcharacters") & ".")
		  End If

		  Dim ntUserRes
		  Set ntUserRes = SQLQuery(cnnDB, "SELECT sid FROM tblUsers WHERE uid='" & username & "'")
		  If ntUserRes.EOF Then
			Dim ntUpdRes, ntSidRes
			ntUpdRes = SQLQuery(cnnDB, "INSERT INTO tblUsers (sid, uid) VALUES (" & GetUnique(cnnDB, "users") & ", '" & username & "')")
			ntSidRes = SQLQuery(cnnDB, "SELECT sid FROM tblUsers WHERE uid='" & username & "'")
			Session("lhd_sid") = ntSidRes("sid")
			url = "register.asp?edit=1&new=1"
		  Else
			Session("lhd_sid") = ntUserRes("sid")
		  End If
		  ntUserRes.Close

		Case 2	' DB Authentication
		  If Request.Form("logon") = 1 Then
			Dim password
			username = Left(Lcase(Trim(Request.Form("uid"))), 50)
			username = Replace(username, "'", "''")
			password = Left(Trim(Request.Form("password")), 50)
			
			Dim userRes
			Set userRes = SQLQuery(cnnDB, "SELECT sid, password FROM tblUsers WHERE uid='" & username & "'")
			If userRes.EOF Then
			  invalid = TRUE
			  url=""
			ElseIf userRes("password") <> password Then
			  invalid = TRUE
			  frm_url = url
			  url=""
			Else
			  Session("lhd_sid") = userRes("sid")
			End If
			userRes.Close
		  Else
			Dim frm_url
			frm_url = url
			url = ""
		  End If

		Case 3	' External Authentication
		  If Len(Session("lhd_ext_uid")) > 0 Then
			username = Lcase(Trim(Session("lhd_ext_uid")))
		  ElseIf Len(Request.Form("lhd_ext_uid")) > 0 Then
			username = Lcase(Trim(Request.Form("lhd_ext_uid")))
		  ElseIf Len(Request.QueryString("lhd_ext_uid")) > 0 Then
			username = Lcase(Trim(Request.QueryString("lhd_ext_uid")))
		  Else
			Call DisplayError (3, lang(cnnDB, "Nousernamewasspecifiedbytheexternalauthenication") & ".")
		  End If

		  If CBool(InStr(username, "'")) Then
			Call DisplayError (3, lang(cnnDB, "Username") & " " & Lang(cnnDB, "containsinvalidcharacters") & ".")
		  End If

		  Dim extUserRes
		  Set extUserRes = SQLQuery(cnnDB, "SELECT sid FROM tblUsers WHERE uid='" & username & "'")
		  If extUserRes.EOF Then
			Dim extUpdRes, extSidRes
			extUpdRes = SQLQuery(cnnDB, "INSERT INTO tblUsers (sid, uid) VALUES (" & GetUnique(cnnDB, "users") & ", '" & username & "')")
			extSidRes = SQLQuery(cnnDB, "SELECT sid FROM tblUsers WHERE uid='" & username & "'")
			Session("lhd_sid") = extSidRes("sid")
			url = "register.asp?edit=1&new=1"
		  Else
			Session("lhd_sid") = extUserRes("sid")
		  End If
		  extUserRes.Close

	  End Select

	  Session("lhd_IsAdmin") = FALSE

	  If Len(url) > 0 Then
		' Update logon time
		Dim updTimeRes
		If (Application("DBType") = 3) OR (Application("DBType") = 4) Then
		  Set updTimeRes = SQLQuery(cnnDB, "UPDATE tblUsers SET dtLastAccess=Now() WHERE sid=" & Session("lhd_sid"))
		Else
		  Set updTimeRes = SQLQuery(cnnDB, "UPDATE tblUsers SET dtLastAccess=GETDATE() WHERE sid=" & Session("lhd_sid"))
		End If
		cnnDB.Close
		Response.Redirect url
	  End If
	%>
	<div align="center">
	  <table Class="Narrow">
		<tr class="Head1">
		  <td>
			<% = Cfg(cnnDB, "SiteName") %>
			<br />
			<%=lang(cnnDB, "HelpDesk")%>
		  </td>
		</tr>
		<tr class="Body1">
		  <td>
			<form action="logon.asp?URL=<% = frm_url %>" method="POST">
			  <input type="hidden" name="logon" value="1">
			  <div align="center">
				<u><h3><%=lang(cnnDB, "Logon")%></h3></u>
			  </div>
		   <% If invalid Then 
				Response.Write "<div align=""center"">" & _
				  "<i>" & lang(cnnDB, "Invalidusernameorpassword") & ".</i></div>"
			  End If %>
			  <table class="Narrow" border="0">
				<tr>
				  <td>
					<b><%=lang(cnnDB, "UserName")%>:</b>
				  </td>
				  <td>
					<input type="text" name="uid" size="20">
				  </td>
				</tr>
				<tr>
				  <td>
					<b><%=lang(cnnDB, "Password")%>:</b>
				  </td>
				  <td>
					<input type="password" name="password" size="20">
				  </td>
				</tr>
				<tr><td> </td></tr>
			  </table>
			  <div align="center">
				<input type="submit" value="<%=lang(cnnDB, "Logon")%>">
			  </div>
			</form>
			<p>
			<div align="center">
			  <% If Cint(Cfg(cnnDB, "EnableKB")) = 3 Then %>
				<a href="kb/"><% = lang(cnnDB, "SearchtheKnowledgeBase") %></a>
				<p>
			  <% End If %>
			  <a href="register.asp"><%=lang(cnnDB, "NewUser")%></a>
			  <% 
			  If Cfg(cnnDB, "EmailType") <> 0 Then 
				Response.Write "| <a href=""forgotpass.asp"">" & lang(cnnDB, "EmailMyPassword") & "</a>"
			  End If 
			  %>
			</div>
			</p>
		  </td>
		</tr>
	  </table>
	</div>
	<%
	  Call DisplayFooter(cnnDB, sid)
	  cnnDB.Close
	%>
  </body>
</html>

default.asp (essa é a tela de interface na qual o cliente se loga se 1 usuario REP se 2 usuario help )

<%@ LANGUAGE="VBScript" %>
<% 
  Option Explicit
  'Buffer the response, so Response.Expires can be used
  Response.Buffer = TRUE
%>

<?xml version="1.0"?>
<!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">

  <!--
  Liberum Help Desk, Copyright (C) 2000-2001 Doug Luxem
  Liberum Help Desk comes with ABSOLUTELY NO WARRANTY
  Please view the license.html file for the full GNU General Public License.

  Filename: default.asp
  Date:	 $Date: 2001/12/09 02:01:24 $
  Version:  $Revision: 1.50 $
  Purpose:  This is the main page that will redirect users to the logon screen
  or to their user or rep menu.
  -->
  <!--	#include file = "settings.asp" -->
  <!-- 	#include file = "public.asp" -->
  <%
	Call SetAppVariables

	Dim cnnDB, sid
	Set cnnDB = CreateCon
	sid = GetSid
  %>

  <head>
	<title>
	  <% = Cfg(cnnDB, "SiteName") %> <%=lang(cnnDB, "HelpDesk")%>
	</title>
	<link rel="stylesheet" type="text/css" href="default.css">  
	</head>
  <body>
	<%
	  ' See if user is authenticated
	  Call CheckUser(cnnDB, sid)

	  ' This page will just redirect users to their menu.
	  ' If they aren't logged in, CheckUser will redirect to logon.asp

	  If Usr(cnnDB, sid, "IsRep") = 1 Then
		cnnDB.Close
		Response.Redirect "rep/"
	  Else
		cnnDB.Close
		Response.Redirect "user/"
	  End If

	  cnnDB.Close
	%>
  </body>
</html>

Está funcionando eu precisava colocar em um filme loadado na base principal ou seja esse dynamic input vai ser carregado por loadmovie num filme principal...digitou usuario e senha valida e loga no sistema com um target _self...

 

 

é isso....com base em meu sistema de logon em ASP

 

 

Quem puder dar uma olhada no meu cód...sei que passa valores por POST em loadvariable mas queria ssaber se é possivel neste cód e do jeito q falei ...

 

 

abraços

Compartilhar este post


Link para o post
Compartilhar em outros sites

ave maria tudo isso ai por 1 login???

 

Por isso que amo php.......

 

Faça 2 campos de texto e instancie eles 1 de login outro de senha

Coloque um botão de enviar...

 

E mande com um post as variaveis...

 

Exemplo:

senha.password = true;
var obj_l:LoadVars = new LoadVars();
var obj_s:LoadVars = new LoadVars();

bt_enviar.onPress = function(){
	if(login.text == "" or senha.text == ""){
		//Texto dizendo que login ou senha estão incorretos ou vazies...
	}else {
		obj_s.login = login.text;
		obj_s.senha = senha.text;
		obj_s.sendAndLoad("seu arquivo asp", obj_l, "POST");
		obj_l.onLoad = resposta();
	}
}

function resposta(){
	if(obj_l.resposta=="1"){
		//Passa para o proximo frame
	}else{
		//da erro
	}
}

Fiz um bem fácilzinho...

Para recuperar a resposta do asp escreva Response.Write "&resposta=1&";

 

Pode colocar if e else para dar a resposta correta

 

Ai você aproveita e verifica se a senha e o login estão corretos no proprio asp... em vez de usar o flash para isso. Uma vez que acredito eu que você programe melhor em asp do que em flash... (descartando a possibilidade de tu ter copiado esse código da internet :P).

 

Abraços

Compartilhar este post


Link para o post
Compartilhar em outros sites

ave maria tudo isso ai por 1 login???

 

Por isso que amo php.......

 

Faça 2 campos de texto e instancie eles 1 de login outro de senha

Coloque um botão de enviar...

 

E mande com um post as variaveis...

 

Exemplo:

senha.password = true;
var obj_l:LoadVars = new LoadVars();
var obj_s:LoadVars = new LoadVars();

bt_enviar.onPress = function(){
	if(login.text == "" or senha.text == ""){
		//Texto dizendo que login ou senha estão incorretos ou vazies...
	}else {
		obj_s.login = login.text;
		obj_s.senha = senha.text;
		obj_s.sendAndLoad("seu arquivo asp", obj_l, "POST");
		obj_l.onLoad = resposta();
	}
}

function resposta(){
	if(obj_l.resposta=="1"){
		//Passa para o proximo frame
	}else{
		//da erro
	}
}

Fiz um bem fácilzinho...

Para recuperar a resposta do asp escreva Response.Write "&resposta=1&";

 

Pode colocar if e else para dar a resposta correta

 

Ai você aproveita e verifica se a senha e o login estão corretos no proprio asp... em vez de usar o flash para isso. Uma vez que acredito eu que você programe melhor em asp do que em flash... (descartando a possibilidade de tu ter copiado esse código da internet :P).

 

Abraços

 

Vo defender o ASP , aqui rsrsrs Não tem necessidade desse código desse tamanho nao, o rpz ai que se excedeu ou pegou pronto, ou coisa do tipo.

Quanto a dúvida pode utilizar tb de xml pra não precisar usar o loadVars.

 

Abs

Compartilhar este post


Link para o post
Compartilhar em outros sites

Berseck...

putz...não entendi....eu copiei sim da internet.... é um help desk q futuramente iriei adapta-lo...é o liberium está no script brasil.com.br

 

mas voltando..eu não queria que essa function resposta fosse para o proximo frame...gostaria de ao usuario digitar o login e senha nos dynamic logasse ele no sistema

 

 

o dito cujo está em www,fractalinfo.com.br clica em web cliente q você vai entender do que estou falando...

 

ou seja

 

seu cód

 

senha.password = true;

var obj_l:LoadVars = new LoadVars();

var obj_s:LoadVars = new LoadVars();

 

bt_enviar.onPress = function(){

if(login.text == "" or senha.text == ""){

AKI COLOCO UM ALERTA PRA PREECNHER TODOS CAMPOS

}else {

obj_s.login = login.text;

obj_s.senha = senha.text;

obj_s.sendAndLoad("seu arquivo asp", obj_l, "POST");

obj_l.onLoad = resposta(); SE PASSAR DAKI O USUARIO JA DEVE LOGAR NO SISTEMA

}

}

 

function resposta(){

if(obj_l.resposta=="1"){

 

}else{

//da erro

}

}

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.