misal, site.com/deneme.asp sayfasına giriş yaptıklarında sifre sorsun dogru sifryi yazdıktan sonra giriş yapsin.


7
●3.693
<!-- TWO STEPS TO INSTALL MULTIPLE USERS:
1. Copy the first code into the HEAD of your HTML document
2. Put the last coding into the BODY of your HTML document -->
<!-- STEP ONE: Copy this code into the HEAD of your login HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
function Login(){
var done=0;
var username=document.login.username.value;
username=username.toLowerCase();
var password=document.login.password.value;
password=password.toLowerCase();
if (username=="KULLANICI ADI" && password=="ŞİFRESİ") { window.location="GİDİLECEK URL"; done=1; }
if (username=="member2" && password=="password2") { window.location="page2.html"; done=1; }
if (username=="member3" && password=="password3") { window.location="page3.html"; done=1; }
if (done==0) { alert("yanlış şifre!!!"); }
}
// End -->
</SCRIPT>
<!-- STEP TWO: Paste this code into the BODY of your HTML document -->
<BODY>
<center>
<form name=login>
<table width=225 border=1 cellpadding=3>
<tr><td colspan=2><center><font size="+2"><b>Members-Only Area!</b></font></center></td></tr>
<tr><td>Username:</td><td><input type=text name=username></td></tr>
<tr><td>Password:</td><td><input type=text name=password></td></tr>
<tr><td colspan=2 align=center><input type=button value="Login!" onClick="Login()"></td></tr>
</table>
</form>
</center>
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 1.60 KB --> <?php
// Kullanici Listesi
$kul[0]['username']="k.adi";
$kul[0]['password']="şifre";
// Dogrulama
function authenticate()
{
header( 'WWW-Authenticate: Basic realm="Private"' );
header( 'HTTP/1.0 401 Unauthorized' );
echo 'Şifre yada kullanıcı Adınız Yanlış';
exit;
}
if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) { authenticate(); } else
{
for($i=0;$i<count($kul);$i++) { if($_SERVER['PHP_AUTH_USER']==$kul[$i]['username'] && $_SERVER['PHP_AUTH_PW']==$kul[$i]['password']){$auth=TRUE;}}
if($auth !=TRUE) {authenticate();}
}
?>bunu denersen en kullanışlısı olduğunu goreceksın