/    Sign up×
Community /Pin to ProfileBookmark

How Do I (If NT Username) Display This…

I have if certain ip is viewing site to display this code, this is used for internal intranet. But I want something like this, instead of using an ip, how can I say, if NT User name is JDoe, then echo the code, else, nothing. Is that possible?

<?php

$ip=$_SERVER[‘REMOTE_ADDR’];

if(eregi(“192(.*)”, $ip))

{

echo “Hello Admin”;
}

else {

}
?>

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@sciguyryanAug 30.2004 — I think I get what you mean.

Do you mean based on the persons IP address?

If so, its possible but not practical unless you have all broadband users with fixed IP's.



RyanJ
Copy linkTweet thisAlerts:
@d_brandusaauthorAug 30.2004 — No, based on NT User name, I have the code that works right for our ip addresses. I need it to say if NT USer = JDoe, then parse code, else do Nothing.
Copy linkTweet thisAlerts:
@sciguyryanAug 30.2004 — I don't think PHP can get the loggin info you want. It may be possible in COM but thats more than I can do.


RyanJ
Copy linkTweet thisAlerts:
@d_brandusaauthorAug 30.2004 — This more for internal use, this is how I obtain our NT Info.

[code=php]
<?php

$Logon_User = $_SERVER["LOGON_USER"];
echo $Logon_User;

?>
[/code]

So I need like if $Logon_User = JDoe, then parse info, else nothing.
Copy linkTweet thisAlerts:
@sciguyryanAug 30.2004 — Ok, try this:


[code=php]
<?php
$Logon_User = $_SERVER["LOGON_USER"];
if ($Logon_User == "JDoe"){
$ip = $_SERVER['REMOTE_ADDR'];
if (eregi("192(.*)", $ip)){
echo "Hello Admin";
}
else {}
}
else {}
?>
[/code]



RyanJ
×

Success!

Help @d_brandusa spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...