Become a part of the TranceAddict community!Frequently Asked Questions - Please read this if you haven'tSearch the forums
TranceAddict Forums > Main Forums > Chill Out Room > Applet Question
  Last Thread   Next Thread
Share
Author
Thread    Post A Reply
UglyDave
i ran a marathon : )



Registered: Jan 2003
Location: Buncrana, Éire
Applet Question

right folks

i've written an applet which retrieves a clients local machine username and writes it to a file.

however, when i the applet as an applet, it doesn't work.

when i run it in BlueJ (by creating an object & calling the methods), it works perfectly.

i didn't write all the code myself, some came from another app.

here's the code:

code:
import java.applet.*; import java.awt.Graphics; public class ntApplet extends Applet { public String userName = "unknown"; public void init(){ try { com.sun.security.auth.module.NTSystem ntSystem = new com.sun.security.auth.module.NTSystem(); userName = ntSystem.getName(); toFile(getUserName()); System.out.println(getUserName()); } catch (Exception e) { System.out.println("Error : " + e + "\n"); } } public void paint (Graphics g){ super.paint(g); g.drawString("Username:"+userName, 25,25); } public void toFile(String st){ try{ file f = new file("users.txt"); f.openForAppend(); f.print(st); f.close(); } catch (Exception e){ System.out.println("Error: " + e ); } } public String getUserName() { return this.userName; } }


and the html:

code:



any help greatly appreciated!!

Old Post Mar-11-2004 22:52  Ireland
Click Here to See the Profile for UglyDave Click here to Send UglyDave a Private Message Visit UglyDave's homepage! Add UglyDave to your buddy list Report this Post Reply w/Quote Edit/Delete Message
UglyDave
i ran a marathon : )



Registered: Jan 2003
Location: Buncrana, Éire

basically, when in run it from BlueJ, i get the output i want. but when i run it from a browser it gives me "unknown"

anyone have any suggestions??

Old Post Mar-11-2004 22:56  Ireland
Click Here to See the Profile for UglyDave Click here to Send UglyDave a Private Message Visit UglyDave's homepage! Add UglyDave to your buddy list Report this Post Reply w/Quote Edit/Delete Message
DigiNut
You kids get off my lawn!



Registered: Dec 2002
Location: Toronto, Self-proclaimed Centre of the Universe

Oi vey Dave, you don't make this easy for troubleshooters do you.

1. What is the error?
2. Does the applet run at all?
3. What system are you running, and what system is the web server running?
4. What is the actual filename of the class? Are you sure it's practicals.ntApplet.class?
5. Hurry up, my sobriety won't last much longer tonight.


___________________
My party schedule:
2009-02-21 - DJ Attention @ I'm So Popular
2009-06-18 - DJ Annoying @ People Need To Know Where I'll Be
2012-11-32 - DJ Insufferable ɸ Or At Least the Stalkers I Complain About
2048-06-66 - Spastic & Whocares Although I'm Actually Flattered
9999-45-81 - Tweaker Gimp I Probably Won't Even Go To This But I Have To Make Sure I Fill Up All The Available Space Here

Old Post Mar-12-2004 00:10  Canada
Click Here to See the Profile for DigiNut Click here to Send DigiNut a Private Message Add DigiNut to your buddy list Report this Post Reply w/Quote Edit/Delete Message
whiskers
old skool



Registered: Sep 2001
Location: in your dreams

yeah... aren't you not supposed to be able to get someone's username simply by running a script on their machine?


might be a browser issue.


___________________

Old Post Mar-12-2004 00:20  Ukraine
Click Here to See the Profile for whiskers Click here to Send whiskers a Private Message Add whiskers to your buddy list Report this Post Reply w/Quote Edit/Delete Message
UglyDave
i ran a marathon : )



Registered: Jan 2003
Location: Buncrana, Éire

quote:
Originally posted by DigiNut
1. What is the error?

ok, BlueJ allows u to creat instances of classes to test them etc.. when i run it in bluej, i run it, run the methods and it works fine. it returns the username.

2. Does the applet run at all?
yes, it displays "username: unknown"

basically. it runs ok when i create an object and run the methods that way. but it wont work when i run it from a browser.

3. What system are you running, and what system is the web server running?

runnin win2k at the min. just runnin the applets from my local machine


4. What is the actual filename of the class? Are you sure it's practicals.ntApplet.class?

ntApplet.class - in the practicals directory - also practicals directory

5. Hurry up, my sobriety won't last much longer tonight.[/COLOR]
there.. about 12 mins not a bad responce time!!
[/FONT]

Old Post Mar-12-2004 00:23  Ireland
Click Here to See the Profile for UglyDave Click here to Send UglyDave a Private Message Visit UglyDave's homepage! Add UglyDave to your buddy list Report this Post Reply w/Quote Edit/Delete Message
UglyDave
i ran a marathon : )



Registered: Jan 2003
Location: Buncrana, Éire

quote:
Originally posted by whiskers
yeah... aren't you not supposed to be able to get someone's username simply by running a script on their machine?


point me in the direction of this script!

Old Post Mar-12-2004 00:24  Ireland
Click Here to See the Profile for UglyDave Click here to Send UglyDave a Private Message Visit UglyDave's homepage! Add UglyDave to your buddy list Report this Post Reply w/Quote Edit/Delete Message
whiskers
old skool



Registered: Sep 2001
Location: in your dreams

script, applet, whatever

getting pc username is a security issue and i doubt browsers would allow that. then again, i might be wrong.


___________________

Old Post Mar-12-2004 00:29  Ukraine
Click Here to See the Profile for whiskers Click here to Send whiskers a Private Message Add whiskers to your buddy list Report this Post Reply w/Quote Edit/Delete Message
UglyDave
i ran a marathon : )



Registered: Jan 2003
Location: Buncrana, Éire

quote:
Originally posted by whiskers
script, applet, whatever

getting pc username is a security issue and i doubt browsers would allow that. then again, i might be wrong.


well, i'm just tryin to keep track of the users who post shit on my messageboard.. this wasy if someone comes on and says "David is gay"

i might have some means by which i can find out hwo it is..

Old Post Mar-12-2004 00:32  Ireland
Click Here to See the Profile for UglyDave Click here to Send UglyDave a Private Message Visit UglyDave's homepage! Add UglyDave to your buddy list Report this Post Reply w/Quote Edit/Delete Message
DigiNut
You kids get off my lawn!



Registered: Dec 2002
Location: Toronto, Self-proclaimed Centre of the Universe

Lordy...

quote:
Originally posted by UglyDave
ok, BlueJ allows u to creat instances of classes to test them etc.. when i run it in bluej, i run it, run the methods and it works fine. it returns the username.

So there's no error at all, it just says unknown? That means that the call to the getName() failed, or possibly the program failed to create an instance of the NTSystem class.

quote:
yes, it displays "username: unknown"

basically. it runs ok when i create an object and run the methods that way. but it wont work when i run it from a browser.

That really doesn't surprise me. You're totally confusing the client and server, Dave. The program is running on the web server - you'll never be able to retrieve an NT username from the client machine. If the call you are making doesn't fail, then it will retrieve the SERVER'S username, not the clients. But the call is probably failing because the web user (probably IUSR_ or IWAM_) doesn't have the privileges to execute those functions.

quote:
runnin win2k at the min. just runnin the applets from my local machine

Keep in mind that even if you got it working on your machine, there is no chance it would ever work on a UNIX server and might not work on an external NT server either if their security isn't set up the same as yours.


quote:
there.. about 12 mins not a bad responce time!!

I'd give it about another half hour before I'm completely out.

P.S. whiskers said that you CAN'T get someone's username, which I'll have to agree with. He didn't say there was a script that can.

Edit: for debugging purposes, you might want to try to check to see if the NTSystem class was created or if it is null - try adding something to the effect of "if ntSystem == nil userName = 'failed';" or something like that. Or, use separate try/except clauses for each statement at the top and see where the program is failing. There's no way to tell without proper debugging info. But I'd hazard a guess that you simply can't do what you're trying to do, at all, no matter what.


___________________
My party schedule:
2009-02-21 - DJ Attention @ I'm So Popular
2009-06-18 - DJ Annoying @ People Need To Know Where I'll Be
2012-11-32 - DJ Insufferable ɸ Or At Least the Stalkers I Complain About
2048-06-66 - Spastic & Whocares Although I'm Actually Flattered
9999-45-81 - Tweaker Gimp I Probably Won't Even Go To This But I Have To Make Sure I Fill Up All The Available Space Here

Old Post Mar-12-2004 00:32  Canada
Click Here to See the Profile for DigiNut Click here to Send DigiNut a Private Message Add DigiNut to your buddy list Report this Post Reply w/Quote Edit/Delete Message
UglyDave
i ran a marathon : )



Registered: Jan 2003
Location: Buncrana, Éire

mis read whiskers first post!

u guys "are teh 1ee7est"

i shal never use "teh" again

Old Post Mar-12-2004 00:35  Ireland
Click Here to See the Profile for UglyDave Click here to Send UglyDave a Private Message Visit UglyDave's homepage! Add UglyDave to your buddy list Report this Post Reply w/Quote Edit/Delete Message
UglyDave
i ran a marathon : )



Registered: Jan 2003
Location: Buncrana, Éire

aah well, i'll arse about for a while longer. see if i can find any exceptions.

later dudes!
cheers for the help!

have fun drinkin Digi!

Old Post Mar-12-2004 00:37  Ireland
Click Here to See the Profile for UglyDave Click here to Send UglyDave a Private Message Visit UglyDave's homepage! Add UglyDave to your buddy list Report this Post Reply w/Quote Edit/Delete Message

TranceAddict Forums > Main Forums > Chill Out Room > Applet Question
Post New Thread    Post A Reply

 
Last Thread   Next Thread
Click here to listen to the sample!Pause playbackneed to Id this ...'Never Again' [2002] [1]

Click here to listen to the sample!Pause playbackMotorcycle - "As The Rush Comes" (Sweeping Strings Mix) [2004]

Show Printable Version | Subscribe to this Thread
Forum Jump:

All times are GMT. The time now is 08:33.

Forum Rules:
You may not post new threads
You may not post replies
You may not edit your posts
HTML code is ON
vB code is ON
[IMG] code is ON
 
Search this Thread:

 
Contact Us - return to tranceaddict

Powered by: Trance Music & vBulletin Forums
Copyright ©2000-2026, Jelsoft Enterprises Ltd.
Privacy Statement / DMCA
Support TA!