![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Hi there! I want to read the client environment and pass the username to php to compare it with the username stored in a MySQL table. To read the client environment I know I have to use javascript (don't know how yet but will find out). Question: how can I pass the JS output to php to do the comparison? Thanx. | |||
|
| Advertisements |
| | #2 | ||
| Gilbert Schroeder say... > Hi there! > > I want to read the client environment and pass the username to php to > compare it with the username stored in a MySQL table. To read the > client environment I know I have to use javascript (don't know how yet > but will find out). Question: how can I pass the JS output to php to > do the comparison? Well you'll have to do some sort of meta refresh or redirect (possibly to the same page), perhaps passing variables via the URL. for example in page test.php, you use some javascript to get what you need and then refresh to test.php?client=something BUT... If it's stuff like getting the user's browser then PHP can do that too: It's automatically stored in $_SERVER['HTTP_USER_AGENT'] -- Nathan. XBL Gamertag: Cowfield http://www.cowfields.com Bow to the Cow! | |||
|
| | #3 | ||
| Nathan <spamfourstomachs@hotmails.com> wrote in message news:<Xns93C76C60973DBfourstomachsspamhotm@130.133 .1.4>... > Gilbert Schroeder say... > > > Hi there! > > > > I want to read the client environment and pass the username to php to > > compare it with the username stored in a MySQL table. To read the > > client environment I know I have to use javascript (don't know how yet > > but will find out). Question: how can I pass the JS output to php to > > do the comparison? > > Well you'll have to do some sort of meta refresh or redirect (possibly to > the same page), perhaps passing variables via the URL. > > for example in page test.php, you use some javascript to get what you need > and then refresh to test.php?client=something > > BUT... > > If it's stuff like getting the user's browser then PHP can do that too: > It's automatically stored in $_SERVER['HTTP_USER_AGENT'] Well, actually, I need the client information, for instance, the environment variable 'username' or 'nwusername' and thus I have to use javascript. Thanx for your help anyway, even if I still don't see how to do | |||
|
| | #4 | ||
| "Gilbert Schroeder" <gibs@valain.com> schreef in bericht news:26b6dc45.0307292219.5bc58ee2@posting.google.c om... > Nathan <spamfourstomachs@hotmails.com> wrote in message news:<Xns93C76C60973DBfourstomachsspamhotm@130.133 .1.4>... > > Gilbert Schroeder say... > > > > > Hi there! > > > > > > I want to read the client environment and pass the username to php to > > > compare it with the username stored in a MySQL table. To read the > > > client environment I know I have to use javascript (don't know how yet > > > but will find out). Question: how can I pass the JS output to php to > > > do the comparison? > > > > Well you'll have to do some sort of meta refresh or redirect (possibly to > > the same page), perhaps passing variables via the URL. > > > > for example in page test.php, you use some javascript to get what you need > > and then refresh to test.php?client=something > > > > BUT... > > > > If it's stuff like getting the user's browser then PHP can do that too: > > It's automatically stored in $_SERVER['HTTP_USER_AGENT'] > > Well, actually, I need the client information, for instance, the > environment variable 'username' or 'nwusername' and thus I have to use > javascript. Thanx for your help anyway, even if I still don't see how > to do If it was possible to get the username or network username from a client computer just through a browser we would make a lot of hackers very happy! There is no way you can get (private) client environment variables through javascript (or PHP) through a html page. You can get stuf about the connection(i.e. ip address) and useragent(browser) in both javascript and PHP because this is usually all you need when creating html pages in javascript look at tthe properties if the navigation object and in PHP look at the $_SERVER and $_ENV arrays. Hope you find what you need Rob | |||
|
| | #5 | ||
| "Rob" <Rob@Demmenie.net> wrote in message news:<6wLVa.671959$gs1.44678814@amsnews03.chello.c om>... > "Gilbert Schroeder" <gibs@valain.com> schreef in bericht > news:26b6dc45.0307292219.5bc58ee2@posting.google.c om... > > Nathan <spamfourstomachs@hotmails.com> wrote in message > news:<Xns93C76C60973DBfourstomachsspamhotm@130.133 .1.4>... > > > Gilbert Schroeder say... > > > > > > > Hi there! > > > > > > > > I want to read the client environment and pass the username to php to > > > > compare it with the username stored in a MySQL table. To read the > > > > client environment I know I have to use javascript (don't know how yet > > > > but will find out). Question: how can I pass the JS output to php to > > > > do the comparison? > > > > > > Well you'll have to do some sort of meta refresh or redirect (possibly > to > > > the same page), perhaps passing variables via the URL. > > > > > > for example in page test.php, you use some javascript to get what you > need > > > and then refresh to test.php?client=something > > > > > > BUT... > > > > > > If it's stuff like getting the user's browser then PHP can do that too: > > > It's automatically stored in $_SERVER['HTTP_USER_AGENT'] > > > > Well, actually, I need the client information, for instance, the > > environment variable 'username' or 'nwusername' and thus I have to use > > javascript. Thanx for your help anyway, even if I still don't see how > > to do > > If it was possible to get the username or network username from a client > computer just through a browser we would make a lot of hackers very happy! > > There is no way you can get (private) client environment variables through > javascript (or PHP) through a html page. > > You can get stuf about the connection(i.e. ip address) and > useragent(browser) in both javascript and PHP because this is usually all > you need when creating html pages > > in javascript look at tthe properties if the navigation object and in PHP > look at the $_SERVER and $_ENV arrays. > Hope you find what you need > > Rob In IE, with the correct permissions, you can get the client environment using ActiveX. But it only works for IE. So, I have an idea how to do this but I still do not know how I could transport the result, the js variable content, to php. And that's the matter. Maybe it's to easy ... | |||
|
| | #6 | ||
| Gilbert Schroeder say... > he js variable content, to php. And that's the matter. Maybe > it's to easy ... Just get Javascript to redirect to a page, passing the variables through the url. I don't really know JS, but surely some sort of write.document type thingy to make either a link something.php?username=nathan If passed through the URL like this, then in something.php: $_POST["username"] == "nathan"; Does this help? -- Nathan. XBL Gamertag: Cowfield http://www.cowfields.com Bow to the Cow! | |||
|
| | #7 | ||
| Nathan <spamfourstomachs@hotmails.com> wrote in message news:<Xns93C89509DBE80fourstomachsspamhotm@130.133 .1.4>... > Gilbert Schroeder say... > > > he js variable content, to php. And that's the matter. Maybe > > it's to easy ... > > Just get Javascript to redirect to a page, passing the variables through > the url. > > I don't really know JS, but surely some sort of write.document type thingy > to make either a link > > something.php?username=nathan > > If passed through the URL like this, then in something.php: > > $_POST["username"] == "nathan"; > > Does this help? OK, I'll try to find a way to pass it thru the URL. I'll post the solution here if I find any. Thanx. | |||
|
| | #8 | ||
| Gilbert Schroeder say... >> >> $_POST["username"] == "nathan"; >> >> Does this help? > > OK, I'll try to find a way to pass it thru the URL. I'll post the > solution here if I find any. Thanx. I've just realised a mistake in the above. If passed through the URL it won't be $_POST["username"] it'll be $_GET ["username"]. HTH -- Nathan. XBL Gamertag: Cowfield http://www.cowfields.com Bow to the Cow! | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: passing, variables |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Passing information to PHPBB? | joebeta | PHP | 2 | 10-08-2008 4:42 PM |
| Passing arrays | burgermeister01@insightbb.com | PHP | 8 | 07-01-2007 3:56 PM |
| Passing arrays | burgermeister01@insightbb.com | PHP | 0 | 07-01-2007 3:48 PM |
| Passing on POST data with Location: | ^MisterJingo^ | PHP | 1 | 07-01-2007 3:40 PM |
| Network sharing and by-passing the public only | Don | Windows | 0 | 05-29-2007 12:49 AM |
| Featured Websites | ||||
|