php-windows Digest 29 Mar 2002 09:21:48 -0000 Issue 1068
Topics (messages 12807 through 12814):
NT User info using COM...ASP getObject() alternative
12807 by: Shrock, Court
12809 by: J Wynia
Re: USING $_SESSION instead of session_register()
12808 by: Bossanova
12813 by: Pac mon
IIS PHP 2000
12810 by: RCAuction
ODBC Connection Problems
12811 by: Robin Bolton
ZZip an .TAR
12812 by: Andy Muth
server problem?
12814 by: Mihail Bota
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Was searching through the groups and thought I would share this code:
<?php
// set this to your NT domain
$DomainName = "domain";
// set this to the username you want info on
$UserAccount = "username";
// Binds to the user account
$ADSIObject = new COM("WinNT://" . $DomainName . "/" . $UserAccount);
//Returns full name
echo $ADSIObject->FullName . '<br>';
//Returns Account Name
echo $ADSIObject->Name . '<br>';
//Returns Account Description
echo $ADSIObject->Description . '<br>';
?>
--- End Message ---
--- Begin Message ---
You can grab some of those variables automatically.
$network = new COM("WScript.Network");
$computername = $network->ComputerName;
$username = $network->UserName;
"Court Shrock" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Was searching through the groups and thought I would share this code:
>
> <?php
> // set this to your NT domain
> $DomainName = "domain";
>
> // set this to the username you want info on
> $UserAccount = "username";
>
> // Binds to the user account
> $ADSIObject = new COM("WinNT://" . $DomainName . "/" . $UserAccount);
>
> //Returns full name
> echo $ADSIObject->FullName . '<br>';
>
> //Returns Account Name
> echo $ADSIObject->Name . '<br>';
>
> //Returns Account Description
> echo $ADSIObject->Description . '<br>';
> ?>
--- End Message ---
--- Begin Message ---
Pardon my ignorance, I've been searching for answers for this new $_SESSION to work to
no avail. If someone can help me out by giving examples how I can pass the session_id
to the next page and access the same $_SESSION["var"] on that page, it would be very
helpful.
My question is, once I set this on the 1st page:
<?
session_start();
if (!isset($_SESSION["foo"])) {
$_SESSION["foo"] = "test foo";
}
?>
<body>
<? echo $_SESSION["foo"] . "<br>";
echo session_id() . "<br>";
echo "<br><br>";
?>
<a href="reg_2.php?id="<? session_id(); ?>">reg_2.php</a>
</body>
How do I set up link to the next page, and what should I put on the next page? Will
this be correct?
<?
session_id($_GET["PHPSESSID"]);
session_start();
?>
<body>
<? print $_SESSION["foo"]."<br>"; ?>
</body>
But I got this error message:
Warning: Undefined index: foo in c:\phps\reg_2.php on line 6
I'm new to PHP so this is also a major factor of the failure. Again, thanks for your
help.
Burhan
greg wrote:
-------------------------------
Use of $_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended for
security and code readablity. With $_SESSION or $HTTP_SESSION_VARS, there is no need
to use session_register()/session_unregister()/session_is_registered() functions.
Users can access session variable like a normal variable.
http://www.php.net/manual/en/ref.session.php
--- End Message ---
--- Begin Message ---
Not quite... Here's something that ought to work better for you:
----page1------
<?
session_start();
if (!isset($_SESSION['foo'])) {
$_SESSION['foo'] = "test foo";
}
?>
<body>
<? echo $_SESSION['foo'] . "<br>";
echo session_id() . "<br>";
echo "<br><br>";
?>
<a href="reg_2.php">reg_2.php</a>
</body>
----page2--------
<?
session_start();
?>
<body>
<? print $_SESSION['foo']."<br>"; ?>
</body>
----Original Message Follows----
From: "Bossanova" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: [PHP-WIN] HELP: USING $_SESSION instead of session_register()
Date: Thu, 28 Mar 2002 13:06:55 -0800
Pardon my ignorance, I've been searching for answers for this new $_SESSION
to work to no avail. If someone can help me out by giving examples how I can
pass the session_id to the next page and access the same $_SESSION["var"] on
that page, it would be very helpful.
My question is, once I set this on the 1st page:
<?
session_start();
if (!isset($_SESSION["foo"])) {
$_SESSION["foo"] = "test foo";
}
?>
<body>
<? echo $_SESSION["foo"] . "<br>";
echo session_id() . "<br>";
echo "<br><br>";
?>
<a href="reg_2.php?id="<? session_id(); ?>">reg_2.php</a>
</body>
How do I set up link to the next page, and what should I put on the next
page? Will this be correct?
<?
session_id($_GET["PHPSESSID"]);
session_start();
?>
<body>
<? print $_SESSION["foo"]."<br>"; ?>
</body>
But I got this error message:
Warning: Undefined index: foo in c:\phps\reg_2.php on line 6
I'm new to PHP so this is also a major factor of the failure. Again, thanks
for your help.
Burhan
greg wrote:
-------------------------------
Use of $_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is
recommended for security and code readablity. With $_SESSION or
$HTTP_SESSION_VARS, there is no need to use
session_register()/session_unregister()/session_is_registered() functions.
Users can access session variable like a normal variable.
http://www.php.net/manual/en/ref.session.php
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
--- End Message ---
--- Begin Message ---
my site runs fine but always asks for username and password
running php as cgi
its driving me nuts
Thanks
--- End Message ---
--- Begin Message ---
I have an Access database which I made a DSN connection to.
As long as the .mdb file is on the same machine as my Apache Server I can
connect to it just fine. However, if I try to set the DSN to point to an
.mdb file on our network (mapped to a drive letter), I get the following
error in PHP:
Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft
Jet database engine cannot open the file '(unknown)'. It is already opened
exclusively by another user, or you need permission to view its data., SQL
state S1000 in SQLConnect in c:\www\test\odbc\odbctest3.php on line 2
I know for a fact it's not open on any other machines, so it's not a sharing
issue. Which knocks it down to either permissions or just more PHP network
sillyness.
I've tried pointing the DSN connection to the .mdb using both the mapped
drive letter and UNC paths, same error either way.
The username that I log onto my workstation with has administrative
priveledges for both our domain, and the machine itself.
Server: NT 4.0 Server
Workstation: Win 2000, Apache, PHP 4.1.2
Thanks,
Robin Bolton
IT / Web Developer
Lone Pine Publishing
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
I'm just curious if anyone has gotten ZZIPlib libraries to work under
Windows, or Linux for that matter? I can't seem to get either of them to
work.
On another note, does anyone know of a way to read a .TAR file using PHP?
Thanks
Andy
--- End Message ---
--- Begin Message ---
Dear all,
I was navigating through my database remotely and suddenly the php
stopped to answer. The error I continously get is:
CGI Error
The specified CGI application misbehaved by not returning a complete set
of HTTP headers. The headers it did return are:
Any other kinds of pages or files (html, gif, swf) are working, so the
server is working. All the php code is there, unchanged, all the
php-related folders, .dll's, exe, ini are in their places.
Had this thing ever occured to anybody? What should I do?
I am using Win 2K and IIS 5.0, PhP 4.1.1
Thanks for your help.
Mihai
--- End Message ---