Kullanıcı Girişli Site

Kullanıcı Girişli Site session yardımı ile bir panel yapacağız...
İlk olarak 3 tane .asp dosyası oluşturuyoruz(index.asp,sitem.asp,password.asp).index te kullanıcı girişi,password ve benihatırla(cookie) olacak. index.asp içeriğini aşagıda verdim... bu konu yazı ile anlatılamayacağından dolayı yazmıyorum kusura bakmayın tüm dosyanın içeriğini verdim kopyalayarak çalıştırabilirsiniz. Örn; Kullanıcıadı : aspdiliogren Şifre: 123 uygulayarak kendiniz öğrenmenizi tavsiye ederim.

index.asp
-------------------------------------------------------------------------------------

<% if request.Cookies("sifrehatirla")="logontrue" then

session("username")="true"

session("password")="true"

response.Redirect("sitem.asp")

end if

%>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-9" />

<title>Untitled Document</title>

<style type="text/css">

<!--

.style1 {color: #FF0000}

.style2 {color: #000033}

-->

</style>

</head>


<body>

<form name="form1" method="post" action="password.asp">

<table width="219" border="0">

<% if request.QueryString("logon")="izinsiz" then %>

<tr>

<th colspan="2" scope="col"><span class="style2">İzinsiz Sayfaya ulaşmak İstiyorsunuz</span></th>

</tr>

<% end if %>

<% if request.querystring("logon")="false" then %>

<tr>

<th colspan="2" scope="col"><span class="style1">Kullanıcı Şifre Hatalı</span></th>

</tr>

<% end if %>

<tr>

<th width="63" scope="col">Kullanıcı Adı</th>

<th width="146" scope="col"><input type="text" name="username" id="username"></th>

</tr>

<tr>

<th scope="row">Şifre</th>

<td><input type="password" name="password" id="password"></td>

</tr>

<tr>

<th scope="row">&nbsp;</th>

<td><input type="submit" name="button" id="button" value="Giriş"></td>

</tr>

<tr>

<th scope="row">Beni Hatırla</th>

<td><input name="cookie" type="checkbox" id="cookie" value="hatirla"></td>

</tr>

</table>

</form>

</body>

</html>


-------------------------------------------------------------------------------------

sitem.asp
-------------------------------------------------------------------------------------

<% if session("username")="False" or session("password")="False" then

response.redirect("index.asp?logon=izinsiz")

end if

%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-9" />

<title>Untitled Document</title>

</head>

<body>

burası sitem .asp hhee ee as

</body>

</html>



-------------------------------------------------------------------------------------

password.asp
-------------------------------------------------------------------------------------

<% if (request.form("username")="aspdiliogren" and request.form("password") ="123") then

session("username")="true"

session("password")="true"

if request.form("cookie")="hatirla" then

response.cookies("sifrehatirla").expires=date()+15

end if

response.redirect("sitem.asp")

else

session("username")="false"

session("password")="false"

response.redirect("index.asp?logon=false")

end if

%>


-------------------------------------------------------------------------------------

1 yorum:

Yorum Gönder