php-windows Digest 8 Jul 2003 00:00:39 -0000 Issue 1814
Topics (messages 20710 through 20725):
PHP+IIS - POST data propagate along redirect with header (Location: ....)
20710 by: Sebastian Baran
20711 by: Stephen March
20712 by: Stephen March
20713 by: sebab.dialcom.com.pl
20723 by: The.Rock
ANNOUNCING: Rekall V2.0.0 for Linux/UNIX, Windows, and the Sharpe family of Linux PDAs
20714 by: john.rygannon.com
test
20715 by: The.Rock
Re: Sessions help needed!
20716 by: The.Rock
Re: Connect Active Directory using LDAP... please help :)
20717 by: The.Rock
How to make a picture gallery ?
20718 by: _GeS_
Re: install for dummies?
20719 by: The.Rock
date function problem...
20720 by: H Marc Bower
date function problem... not a problem...
20721 by: H Marc Bower
LINKING TO MYSQL
20722 by: Terry Lowndes
phpinfo.php file now shows up blank in Win xp pro using IIS server, please help
20724 by: Acorn Tutors
20725 by: H Marc Bower
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 ---
Hello,
Has anybody experienced such problem? Let's have script "a.php" with form
<form name="myform" action="a.php" method="POST">
<input name="field" ...>
....
</form>
Script "a.php" receives POST data and process them, then executes
redirect:
header("Location: b.php");
And then on most configurations (like Apache+PHP, no matter on windows
or unix) script "b.php" has no idea about data from form "myform". But I've
found that "my" server, wich is IIS, sends somehow POST data to
"b.php"!!! More, if we "b.php"="a.php" we have a loop! Cause "a.php"
checks if there is something in POST and then redirects to itself.
*********** a.php BEGIN *********
<?php
if ($_POST["field"]) {
(do something)
...
header("Location: a.php");
}
?>
<form action="a.php" method="POST">
<input name="field" ...>
....
</form>
************ END ****************
How to get lost of POST data? Is it a bug in IIS, php or something
else?
Thanks in advance!
my configuration:
PHP Version 4.3.2
System Windows NT WEB 5.0 build 2195
Server API CGI/FastCGI
SERVER_SOFTWARE Microsoft-IIS/5.0
--
Best regards,
Sebastian Baran
DialCom s.c.
--- End Message ---
--- Begin Message ---
In your php.ini (c:\windows\php.ini for 9x, xp, c:\winnt\ for NT4,
2000 => around line 365)
make sure Register Globals = Off.
Register globals does just that, creates global variables from any data
posted to from a form.
As you've noticed it's not the most secure thing, to have these
variables accessible to all your
scripts.
Cheers,
~Steve
Sebastian Baran wrote:
Hello,
Has anybody experienced such problem? Let's have script "a.php" with form
<form name="myform" action="a.php" method="POST">
<input name="field" ...>
....
</form>
Script "a.php" receives POST data and process them, then executes
redirect:
header("Location: b.php");
And then on most configurations (like Apache+PHP, no matter on windows
or unix) script "b.php" has no idea about data from form "myform". But I've
found that "my" server, wich is IIS, sends somehow POST data to
"b.php"!!! More, if we "b.php"="a.php" we have a loop! Cause "a.php"
checks if there is something in POST and then redirects to itself.
*********** a.php BEGIN *********
<?php
if ($_POST["field"]) {
(do something)
...
header("Location: a.php");
}
?>
<form action="a.php" method="POST">
<input name="field" ...>
....
</form>
************ END ****************
How to get lost of POST data? Is it a bug in IIS, php or something
else?
Thanks in advance!
my configuration:
PHP Version 4.3.2
System Windows NT WEB 5.0 build 2195
Server API CGI/FastCGI
SERVER_SOFTWARE Microsoft-IIS/5.0
--- End Message ---
--- Begin Message ---
Sorry, I should also mention you will have to restart your IIS
server. From a command prompt,
(on the server) issue the command:
net stop iisadmin
(type Y - if you have the publisher service active)
net start w3svc
Or reboot it, if you like :)
~Steve
Stephen March wrote:
In your php.ini (c:\windows\php.ini for 9x, xp, c:\winnt\ for
NT4, 2000 => around line 365)
make sure Register Globals = Off.
Register globals does just that, creates global variables from any
data posted to from a form.
As you've noticed it's not the most secure thing, to have these
variables accessible to all your
scripts.
Cheers,
~Steve
Sebastian Baran wrote:
Hello,
Has anybody experienced such problem? Let's have script "a.php" with
form
<form name="myform" action="a.php" method="POST">
<input name="field" ...>
....
</form>
Script "a.php" receives POST data and process them, then executes
redirect:
header("Location: b.php");
And then on most configurations (like Apache+PHP, no matter on windows
or unix) script "b.php" has no idea about data from form "myform".
But I've
found that "my" server, wich is IIS, sends somehow POST data to
"b.php"!!! More, if we "b.php"="a.php" we have a loop! Cause "a.php"
checks if there is something in POST and then redirects to itself.
*********** a.php BEGIN *********
<?php
if ($_POST["field"]) {
(do something)
...
header("Location: a.php");
}
?>
<form action="a.php" method="POST">
<input name="field" ...>
....
</form>
************ END ****************
How to get lost of POST data? Is it a bug in IIS, php or something
else?
Thanks in advance!
my configuration:
PHP Version 4.3.2
System Windows NT WEB 5.0 build 2195 Server API CGI/FastCGI
SERVER_SOFTWARE Microsoft-IIS/5.0
--- End Message ---
--- Begin Message ---
Hi,
I think it's not problem related to registering as globals data from
POST/GET. Problem is that what I expected (and seen on every other
configurations) was POST data being lost after
header("Location: $url);
And here, on IIS+PHP, I get POST data being "forwarded" to script
called with
header("Location: $url);
And I don't want that. That causes problems, cause it's not expected
behavior.
To be sure I just checked - on my other config. Apache+PHP POST data
don't propagate when redirecting, no matter what. No matter
register_globals is set off or on.
I suppose that to be some bug in IIS or PHP module working with IIS.
--
Best regards,
Sebastian Baran
Monday, July 7, 2003, 1:36:46 PM, you wrote:
SM> In your php.ini (c:\windows\php.ini for 9x, xp, c:\winnt\ for NT4,
2000 =>> around line 365)
SM> make sure Register Globals = Off.
SM> Register globals does just that, creates global variables from any data
SM> posted to from a form.
SM> As you've noticed it's not the most secure thing, to have these
SM> variables accessible to all your
SM> scripts.
SM> Cheers,
SM> ~Steve
SM> Sebastian Baran wrote:
>>Hello,
>>
>>Has anybody experienced such problem? Let's have script "a.php" with form
>>
>>
>><form name="myform" action="a.php" method="POST">
>><input name="field" ...>
>>....
>></form>
>>
>>
>>Script "a.php" receives POST data and process them, then executes
>>redirect:
>>
>>header("Location: b.php");
>>
>>And then on most configurations (like Apache+PHP, no matter on windows
>>or unix) script "b.php" has no idea about data from form "myform". But I've
>>found that "my" server, wich is IIS, sends somehow POST data to
>>"b.php"!!! More, if we "b.php"="a.php" we have a loop! Cause "a.php"
>>checks if there is something in POST and then redirects to itself.
>>
>>*********** a.php BEGIN *********
>><?php
>>if ($_POST["field"]) {
>> (do something)
>> ...
>> header("Location: a.php");
>>}
>>?>
>><form action="a.php" method="POST">
>><input name="field" ...>
>>....
>></form>
>>
>>************ END ****************
>>
>>How to get lost of POST data? Is it a bug in IIS, php or something
>>else?
>>
>>Thanks in advance!
>>
>>
>>my configuration:
>>
>>PHP Version 4.3.2
>>
>>System Windows NT WEB 5.0 build 2195
>>Server API CGI/FastCGI
>>SERVER_SOFTWARE Microsoft-IIS/5.0
>>
>>
>>
>>
--- End Message ---
--- Begin Message ---
You don't have restart IIS if your running in CGI mode.
"Stephen March" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Sorry, I should also mention you will have to restart your IIS
> server. From a command prompt,
> (on the server) issue the command:
>
> net stop iisadmin
>
> (type Y - if you have the publisher service active)
>
> net start w3svc
>
> Or reboot it, if you like :)
>
> ~Steve
>
> Stephen March wrote:
>
> > In your php.ini (c:\windows\php.ini for 9x, xp, c:\winnt\ for
> > NT4, 2000 => around line 365)
> > make sure Register Globals = Off.
> >
> > Register globals does just that, creates global variables from any
> > data posted to from a form.
> > As you've noticed it's not the most secure thing, to have these
> > variables accessible to all your
> > scripts.
> >
> > Cheers,
> > ~Steve
> >
> > Sebastian Baran wrote:
> >
> >> Hello,
> >>
> >> Has anybody experienced such problem? Let's have script "a.php" with
> >> form
> >>
> >>
> >> <form name="myform" action="a.php" method="POST">
> >> <input name="field" ...>
> >> ....
> >> </form>
> >>
> >>
> >> Script "a.php" receives POST data and process them, then executes
> >> redirect:
> >>
> >> header("Location: b.php");
> >>
> >> And then on most configurations (like Apache+PHP, no matter on windows
> >> or unix) script "b.php" has no idea about data from form "myform".
> >> But I've
> >> found that "my" server, wich is IIS, sends somehow POST data to
> >> "b.php"!!! More, if we "b.php"="a.php" we have a loop! Cause "a.php"
> >> checks if there is something in POST and then redirects to itself.
> >>
> >> *********** a.php BEGIN *********
> >> <?php
> >> if ($_POST["field"]) {
> >> (do something)
> >> ...
> >> header("Location: a.php");
> >> }
> >> ?>
> >> <form action="a.php" method="POST">
> >> <input name="field" ...>
> >> ....
> >> </form>
> >>
> >> ************ END ****************
> >>
> >> How to get lost of POST data? Is it a bug in IIS, php or something
> >> else?
> >>
> >> Thanks in advance!
> >>
> >>
> >> my configuration:
> >>
> >> PHP Version 4.3.2
> >>
> >> System Windows NT WEB 5.0 build 2195 Server API CGI/FastCGI
> >> SERVER_SOFTWARE Microsoft-IIS/5.0
> >>
> >>
> >>
> >>
> >
> >
> >
>
>
--- End Message ---
--- Begin Message ---
Hi
Do you want to create, edit, or update your PHP databases remotely within a
nice Graphic User Interface without having to use your Web Browser, well you
can do that with Rekall and last week Rekall V2.0.0 was finally released for
KDE3. QT3-only, Windows and Sharp Zaurus. We even have a run time only
version so that you can distribute your Rekall applications. Yes, that's
true, you create applications in much the same way can with MS Access, since
Rekall is a programmable database client. For more information, tutorials,
HOWTOs, examples, etc. please visit http://www.rygannon.com
We are pleased to announce the 2.0 release of Rekall, a personal,
programmable DBMS system for Linux and Windows. Rekall is the only viable
alternative to MS Access for Linux. With Rekall you will be able to quickly
and easily build database applications using Rekall forms and reports. A
full complement of widgets means that applications built in Rekall will be
able to have the look and feel of any other application. Rekall applications
can be extended in their functionality to perform virtually any task via
embedded Python as a scripting language.
Ever since the release of dBase many years ago, the idea of a programmable
DBMS has become increasingly popular. Major systems have been written in
applications like Paradox and MS Access. By focusing on the database, users
are able to leverage their business knowledge into working applications. One
of the limitations of the aforementioned products is that their native
database didn't scale well or support multiple users very well. Rekall
avoids this problem by dispensing with a native database.
The biggest addition to Rekall 2.0.0 is reusable components. Rekall now
comes with a selection of components that you can use in forms; these
include standard buttons and navigation tools.
In addition to these components, you can also construct your own for use as
often as you want. You can store your components either in the database
itself, or in a local area in the file system.
To support reusable components, and to make it easier to script complicated
forms, Rekall 2.0.0 introduces an Event/Slot mechanism (akin to Qt's
Signal/Slot mechanism). This allows to place all script code which is
logically associated with a particular control inside that control, and
means you can copy or delete the control without worrying about copying or
cleaning up script code inside other controls.
Other new features in Rekall 2.0.0 include:
* Static images can by displayed in forms
* Data controls can appear in menu-blocks
* Spin box control
* Link controls can display multiple colums
* Link controls can use Queries as well as tables
* Event logger for debugging
* Raw SQL window for direct SQL execution
* Forms, Reports, etc. can run modally
* Fast table filters for predefined table data display
* Modal forms can be used as dialog boxes
* Explanation of queries generated by Rekall
* Menu and toolbar hiding
* MySQL and PostgreSQL connections over SSH tunnels (Linux only)
In addition, Rekall comes with a thorough demonstration database that
illustrates the various features of the applications. There are actually
three copies of the database, one using MySQL, one PostgreSQL and one using
XBase/XBSQL. Optional drivers are currently available for DB2 and ODBC with
Oracle9i coming later this summer (the Windows version is ready now).
By purchasing Rekall you are getting the source for the application and free
electronic updates to the core application. You get all supported platforms
for one price regardless of when they are released. Rekall is priced at
$79.95 for the physical package and $69.95 for the electronic package.
Rekall can be purchased from www.thekompany.com/products/rekall. Rekall
V2.0.0 demo version can be downloaded from http://www.rygannon.com by
selecting downloads from the navigation menu or by clicking on the downloads
button on the top navigration bar
Regards
John
--- End Message ---
--- Begin Message ---
seeing if it works....
--- End Message ---
--- Begin Message ---
Along with what Luis said, you need to make sure that "session.save_path" is
set and that PHP can write to it, if not this may be why things don't work.
Another problem with your script is that you need to unregister all session
variables after its been determined that the user isn't valid.
"John Fuller" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello all,
> I am new to php in general and am trying to set up a user
authentification system with mysql. The registration page works well and
sends all of the data to the appropriate table in mysql. However, when I
try to get the registered user to log in and start a session, the system
will not remember the session information past the page. For instance, this
page will not work (the one that initially is supposed to register the
session from the login form):
>
> <?
> session_start();
> $username="chris";
> $database="login";
> $login = $_POST['login'];
> $password = $_POST['password'];
> if((!$login) || (!$password)){
> echo "Please enter ALL of the information! <br />";
> include 'login.php';
> exit();
> }
> mysql_connect(localhost,$username);
> @mysql_select_db($database) or die( "Unable to select database");
> $sql=mysql_query("SELECT * FROM login WHERE login='$login' AND
password='$password'");
> $login_check = mysql_num_rows($sql);
> if($login_check > 0){
> // This is where I register the session
> session_register('login');
> $_SESSION['login'] = $login;
> mysql_close();
> include 'success.php';
> } else {
> echo "You could not be logged in! Either the username and password do not
match or you have not validated your membership!<br />
> Please try again!<br />";
> include 'login.php';
> }
> ?>
>
> It proceeds to login the user for that page (I know this happens because I
have played around with it looking at the error checks), but it will not
display any variable that resembles "$_SESSION['login']".
> The next page sequentially (success.php) looks like this:
>
> <?
> session_start();
> echo 'Successful login for "$_SESSION['login']"';
> ?>
>
> Any and all variations of this page come up blank and white whenever the
variable $_SESSION['login'] is called to display. It shows no memory of me
registering a session. Any variation of quotes verse apostrophes changes
nothing, so I figure that either I am blatantly screwing up the session code
(possible for I have never written any sessions before) or my system is not
supporting sessions. I have a php4 something, windows, apache 1.3.27 for my
home network server, and mysql. Any help on this problem would be greatly
appreciated.
> Thanks a lot for your time, John
>
>
>
> ---------------------------------
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
--- End Message ---
--- Begin Message ---
Try this and see if it works. I had the same problem until I did a little
reading. I had to use [EMAIL PROTECTED] as username then I didn't get
the credential errors anymore.
hope this helps, its very basic but hopefully it gets you started.
********* Config.php**********************
<?php
//LDAP connection parameters array
$ldapcfg = array();
//Set default LDAP port
//The default is 389, don't change unless you know
//absolutely that its different.
$ldapcfg["port"] = 389;
//Set LDAP servername to connect to
$ldapcfg["server"] = 'server_name';
//Set ldap username for binding to server
$ldapcfg["username"] = "[EMAIL PROTECTED]";
//Set password for username
$ldapcfg["password"] = "password";
//Set base DN to search the whole domain
$ldapcfg["basedn"] ='dc=Domain_name, dc=com';
?>
**************index.php************************
<?php
include('config.php');
// specify the LDAP server to connect to
$conn = ldap_connect($ldapcfg["server"]) or die("Could not connect to
server");
// bind to the LDAP server specified above
$bind = ldap_bind($conn,$ldapcfg["username"],$ldapcfg["password"]);
if(!$bind)
{
echo ldap_error($conn);
exit;
}
//There is a optional fourth parameter, that can be added to
//restrict the attributes and values returned by the server
//to just those required when searching.
$params = array("mail", "cn", "sn");
// list all entries from the base DN
$result = ldap_list($conn, $ldapcfg["basedn"], "cn=*");
if ($result)
{
// Lets get the entries from our results
$info = ldap_get_entries($conn, $result);
echo "<p>".$info["count"]."entries returned</p>";
// and print attribute values
for ($i=0; $i<$info["count"]; $i++)
{
echo "<table>";
echo "<tr>";
echo "<td>".$info[$i]["cn"][0]."</td>";
echo "<td>".$info[$i]["sn"][0]."</td>";
echo "</tr>";
echo "</table>";
}
}
// all done? then close the connection...
ldap_close($conn);
?>
--- End Message ---
--- Begin Message ---
How can I make my own picture gallery? I have one directory called Pictures and then
there are more directories like Pics1, Pics2, .... I would like to have a php skript
that would now i say something like pictures.php?dir=Pics1 and then it would show all
pics in that directory.
please say my how to make it ?
--- End Message ---
--- Begin Message ---
Amen to that. I'm an IIS guru, and PHP sings better and faster under Apache!
Plus you won't have as many problems in the long run. I've used IIS for so
long it was hard to switch, but once you learn Apache, you won't be going
back. And PHP under IIS6 is DOG SLOW!
"Lance Q" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I know this is not the question you asked, but in my experience, PHP runs
> much much better under Apache than IIS. Perhaps you should consider using
> Apache. (I used to run both IIS 5 and IIS 6 with PHP and it was terribly
> slow. I installed Apache for Windows and it is 1000% better.)
>
> Anyway, there is some good stuff here, especially if you scroll down and
> read some of the user feedback.
>
> http://www.php.net/manual/en/install.iis.php
>
> Lance
>
>
> "George Pitcher" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >
> > Hi, after using PHP for ages, my laptop died on me and I've been trying
to
> > get PHP active on a new W2K machine running IIS5.
> >
> > I've tried both the installer and the binary (both as CGI and ISAPI)
with
> no
> > success.
> >
> > I've copied the php4isapi.dll file along with php.ini to winnt\system32,
> > tried just about any conceivable option in the IS manager configuration
> and
> > the best I can get is to se my code being displayed (phpinfo();)
> >
> > Any suggestions before I head for my train to Edinburgh at 4pm?
> >
> > Cheers
> >
> > George in Oxford
> >
> >
> >
>
>
--- End Message ---
--- Begin Message ---
I'm having a bit of an issue using the date function... it isn't cooperating with any
dates before... sometime in 1970. I guess this is date 0 for unix, if I'm not
mistaken. However, dates before this time are throwing an error at me:
Warning: unexpected error in date() in D:\wwwroot\vvf\oshawa\articles.php on line 110
Not terribly informative, but here is the code that produces that error:
list($yr,$mo,$dy)=explode("-",$art[article_date]);
$date = date("Y F d", mktime(0,0,0,$mo,$dy,$yr));
This works perfectly for everything else... I have pages of database-returned dates,
and when an older article comes up, that's the error I get right at the top of the
list.
Is there any easy workaround for the date function?
Thanks,
Marc
--- End Message ---
--- Begin Message ---
I read the next line in the manual to determine what the issue was - using windows I
can only go back to 01 jan 1970. My bad, I should have read a little further. If
anyone does have a nice little workaround for this for windows, though, I'd appreciate
it. The date is coming out of a mysql database in a YYYY-MM-DD format.
Marc
--- End Message ---
--- Begin Message ---
Have I got the correct $ user and $ host. The following code has been copied
from PHP & MySql for Dummies (that's the level I'm at!). But when I type in
"SHOW DATABASES" as the query I get "Page Not Found". The PHP file I am
using is located in the C:Inetpub/wwwroot folder and I got the user name and
password (not shown in the code) from the My ini tab in WinMySQLAdmin.
Thanks,
Terry Lowndes
<!-- Program Name: mysql_send.php
Description: PHP program that sends an SQL query to the
MySQL server and displays the results.
-->
<html>
<head>
<title>SQL Query Sender</title>
</head>
<body>
<?php
$user="tlowndes";
$host="localhost";
$password="*****";
/* Section that executes query */
if (@$form == "yes")
{
mysql_connect($host,$user,$password);
mysql_select_db($database);
$query = stripSlashes($query) ;
$result = mysql_query($query);
echo "Database Selected: <b>$database</b><br>
Query: <b>$query</b>
<h3>Results</h3>
<hr>";
if ($result == 0)
echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>");
elseif (@mysql_num_rows($result) == 0)
echo("<b>Query completed. No results returned.</b><br>");
else
{
echo "<table border='1'>
<thead>
<tr>";
for ($i = 0; $i < mysql_num_fields($result); $i++)
{
echo("<th>" . mysql_field_name($result,$i) . "</th>");
}
echo " </tr>
</thead>
<tbody>";
for ($i = 0; $i < mysql_num_rows($result); $i++)
{
echo "<tr>";
$row = mysql_fetch_row($result);
for ($j = 0; $j < mysql_num_fields($result); $j++)
{
echo("<td>" . $row[$j] . "</td>");
}
echo "</tr>";
}
echo "</tbody>
</table>";
}
echo "<hr><br>
<form action=$PHP_SELF method=post>
<input type=hidden name=query value=\"$query\">
<input type=hidden name=database value=$database>
<input type=submit name=\"queryButton\" value=\"New Query\">
<input type=submit name=\"queryButton\" value=\"Edit Query\">
</form>";
unset($form);
exit();
}
/* Section that requests user input of query */
@$query = stripSlashes($query);
if (@$queryButton != "Edit Query")
{
$database = " ";
$query = " ";
}
?>
<form action=<?php echo $PHP_SELF ?>?form=yes method="post">
<table>
<tr>
<td align="right"><b>Type in database name</b></td>
<td>
<input type=text name="database" value=<?php echo $database ?> >
</td>
</tr>
<tr>
<td align="right" valign="top"><b>Type in SQL query</b></td>
<td><textarea name="query" cols="60" rows="10"><?php echo $query
?></textarea>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Submit
Query"></td>
</tr>
</table>
</form>
</body>
</html>
--- End Message ---
--- Begin Message ---
Hi folks, I was wondering if you could help. I installed IIS on Win XP pro
and I was able to make and view php files, including viewing the phpinfo.php
file. Now, suddenly for no apparent reason, it comes up blank when I try to
load them locally in IE6. Furthermore, Im unable to view any php code in IE.
Has anyone else had this problem and can tell me how to get my php files to
view again?
Help appreciated,
Doug
--- End Message ---
--- Begin Message ---
It's almost definitely not an IE issue, given how php works. When you do a
View...Source what do you see? You could try stopping and starting IIS to
see if that has any effect.
When you say you are unable to view any php code in IE, I assume you mean
from your own webserver...?
(V)
----- Original Message -----
From: "Acorn Tutors" <[EMAIL PROTECTED]>
> Hi folks, I was wondering if you could help. I installed IIS on Win XP pro
> and I was able to make and view php files, including viewing the
phpinfo.php
> file. Now, suddenly for no apparent reason, it comes up blank when I try
to
> load them locally in IE6. Furthermore, Im unable to view any php code in
IE.
--- End Message ---