Bahsettiğiniz sistemi yapmanın bir çok yolu vardır.
Siz örneğin ali isimli üyeyi ilk olarak db ye eklediğinizde şifrede ekleyecekseniz ve ali oturum açtığında hoşgeldin ali yazacaksa bu başka bir sistem.
Siz aliyi eklediğinizde ali sayfayı açar açmaz hoşgeldin ali yazması bu başka bir sistem.
sorunuzu tam oalrak aktarabilirseniz yardımcı olabilirim.
ipucu olarak : aliyi tanımak istiyorsanız login yani oturum olmadan cookie yazabilirsiniz veya ip adresini db ye yazabilirsiniz.
Şu şekilde olcak. Bu kişiler domain ortamında çalışıyorlar. Hepsinin domainde user'ı var. Ben isimlerini db'de sadece isim soyisim sicil numarası kullanıcı adı ve sonuç satırları olcak. Ben manuel olarak isim soyisim sicil numarası ve kullanıcı adını girerim sorun olmaz. Kullanıcı açında şifre girmicek direk domain user'olduğundan çekicek. Ve kabul ediyorumu tıklarsa evet yazıcak sonuca etmiyorumu tıklarsa hayır yazıcak.
Ben şöyle kodlar buldum ama pek anlamadım. Çok iyi bilmiyorum.
AuthName ByPassword
<Files ~ "[^/]*\.html$">
SetHandler blabla
require valid-user
</Files>
<Files "*">
require valid-user
</Files>
####
then last but not least, I used a php file to test my theory;
<?php
echo "<p>Hello, your username is $REMOTE_USER.</p>";
?>
you can use tcpdump to check if your box is going to your pdc/bdc for the username, I used "tcpdump port netbios-ssn" and every time I tried to access the page, a request would go through to to the pdc
after all this, I went to a couple different machines and loaded up the webpage, it told me I was a different user each time! (woo). Tried on a non authenticated machine and would not let me onto the network.
so there ya go. I hope this works for you as well as it did for me, and to think I was *this* close to saying "bugger it, I'll run iis"
-Pete Goldsmith
ve
Johan den Boer <me@knoware.nl> wrote:
[color=blue]
> I am new to php. Is it possible to find out the windows user name in php ?
>
> Logon in windows domain with 'user1'. I want to get the username in php in
> my example : user1.[/color]
Hi Johan,
If the web server is in the same domain, i.e. intranet, try echoing
$_SERVER['LOGON_USER'] and $_SERVER['AUTH_USER']. Might only work with IE
though.
A good start is generally having a phpinfo() running to check what headers &
information the browser sends to the server.
----------------------------------------------------------------------------
<?PHP
if (isset($_POST['username']))
{
$username =3D $_POST['username'];
echo "returned<br>";
echo $username;
}
else
{
echo "go";
echo "
<html>
<head>
<title>testing username script</title>
</head>
<body>
<form name=3D'postvars' method=3D'POST' action=3D'test.php'
onsubmit=3D'submitform()'>
<input type=3D'hidden' name=3D'username' value=3D''>
</form>
<script language=3Djavascript><!--
var WshNetwork =3D new ActiveXObject(\"WScript.Network\");
document.postvars.username.value =3D WshNetwork.UserName;
document.postvars.submit();
//--></script>
</body>
</html>
";
}
?>Bunlar yardımcı olabilir mi?