php-windows Digest 22 Jul 2003 09:11:07 -0000 Issue 1834
Topics (messages 20844 through 20857):
Help With CGI Timeout
20844 by: Chris
20847 by: Chris
20848 by: Kit DeKat
PHP/Mysql issue
20845 by: Nate Dawg
Re: XmlRPC Extension in Apache 4.2.3
20846 by: sven
adding dates
20849 by: Isai Arasu
20850 by: Croskerry, Dan
http referer
20851 by: Jon Phipps
20853 by: Igor Portnoy
20857 by: Luis Ferro
Re: Subject: dynamic html pages
20852 by: Neil Smith
20856 by: Jon Phipps
PHP Redirector Anyone??
20854 by: Shaffin Bhanji
20855 by: skate
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 ---
I have a script that uploads a data file and inserts several thousand
records into a database table. The script seems to time out when it
exceeds the time out limit imposed by CGI. I am using the
set_time_limit() function, to extend the script’s running time, however
this only works until the CGI limit is reached. I have used this script
on several Linux web servers running Apache without a problem. This is
the first time using it on a Windows 2000 server with PHP 4.3.1.
The rub here is my PHP script is being hosted by a third party, so I
don’t have the luxury to make changes to the system myself. What I am
trying to determine is, is it possible/reasonable to ask my hosting
provider to increase the CGI time out limit. If so, how would I instruct
them in this matter? Or possibly, are there other solutions?
Thanks for opinions
Chris
--- End Message ---
--- Begin Message ---
BTW I can run a regular cgi script out of my cgi-bin directory for a much
greater period of time without being shut down by the time limit.
Chris wrote:
> I have a script that uploads a data file and inserts several thousand
> records into a database table. The script seems to time out when it
> exceeds the time out limit imposed by CGI. I am using the
> set_time_limit() function, to extend the script’s running time, however
> this only works until the CGI limit is reached. I have used this script
> on several Linux web servers running Apache without a problem. This is
> the first time using it on a Windows 2000 server with PHP 4.3.1.
>
> The rub here is my PHP script is being hosted by a third party, so I
> don’t have the luxury to make changes to the system myself. What I am
> trying to determine is, is it possible/reasonable to ask my hosting
> provider to increase the CGI time out limit. If so, how would I instruct
> them in this matter? Or possibly, are there other solutions?
>
> Thanks for opinions
> Chris
--- End Message ---
--- Begin Message ---
The page only timeouts of nothing is sent to the browser in the duration
of inserting the 1000+ records, if you could spit out a simple
'currently inserting record x of y'
every few hundred records. you could use DHTML/Javascript to overwrite
the same line on the page. whatever you want to make it look pretty.
At 01:10 PM 7/21/2003, you wrote:
I have a script that uploads a data file and inserts several thousand
records into a database table. The script seems to time out when it
Best regards,
Kit DeKat mailto:[EMAIL PROTECTED]
Web/Systems Programmer
-----BEGIN PERL GEEK CODE BLOCK-----
Version: 0.01
P++>[EMAIL PROTECTED] >++M+$O+>+++(++)$MA >+E+PU >+BD >++C >*$
D++S++>[EMAIL PROTECTED]>++WP?MO?PP!n?CO?PO--o?G A--Ee+++Ev w+m!
------END PERL GEEK CODE BLOCK------
--- End Message ---
--- Begin Message ---
The book I am reading (
http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?userid=2T67AHHR6W&isbn=0764516507&itm=1
)
PHP & MySQL for Dummies has a CD Rom with several PHP files. One is called
mysql_send.php. Book says " The program mysql_send.php has one simple
function: to execute queries and display the results. Copy the program from
the CD into the directory where you are developing your web application,
change the information in lines 11-13 and point your browser at the
program."
I was having problems with the mysql_send.php.
Someone in a MySQL32 email list is working with me. He has suggested several
changes to line 57. Now I no longer get an error pointing to line 57. When I
type in a command ( like SHOW DATABASES ) and hit submit Query all I get
back is a blank box.
While I am working on getting this fixed I made a copy of the file giving me
problems ( mysql_send.php ) and call it mysql_send_test.php. It is in the
same directory as the original.
I am running Win XP. Apache 2.0.47, PHP 3.3.2 and MySQL 4.0.13
The current code in mysql_send_test.php is as follows:
<!-- 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="root";
$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=" . $_SERVER["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>
Also if you would like to see the code of the file mysql_send.php ( DIRECT
off the CD that came with this book ) is as follow:
<!-- 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="root";
$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>
Thank you.
--- End Message ---
--- Begin Message ---
hi donald,
don't know if it works, but can you copy the .dll to winnt/system32 and
restart apache?
ciao SVEN
Donald Tyler wrote:
> Hi Everyone,
>
>
>
> I posted this on the PHP install list but didn't get a reply. I hope
> you guys/gals can be more helpful.
>
>
>
> I am having trouble getting the XmlRpc extension working with PnP
> 4.2.3.
>
>
>
> SYSTEM:
>
> Windows XP Pro
>
> PHP 4.2.3 (Running as Apache module)
>
> Apache 2.0.44
>
>
>
> When Apache starts I get the following error:
>
>
>
> Unknown(): Unable to load dynamic link library 'c:\program
> files\apache group\php\extensions\php_xmlrpc.dll' - The specified
> module could not be found.
>
>
>
> The error.log after a clean start:
>
>
>
> [Fri Jul 18 17:08:29 2003] [notice] Parent: Created child process
> 3420 PHP Warning: Unknown(): Unable to load dynamic library
> 'c:\program files\apache group\php\extensions\php_xmlrpc.dll' - The
> specified module could not be found. in Unknown on line 0 [Fri Jul
> 18 17:08:32 2003] [notice] Child 3420: Child process is running [Fri
> Jul 18 17:08:32 2003] [notice] Child 3420: Acquired the start mutex.
> [Fri Jul 18 17:08:32 2003] [notice] Child 3420: Starting 250 worker
> threads.
>
>
>
> I know the dll exists in the correct location and the extension path
> is specified correctly in the php.ini file because other extensions
> load fine.
>
>
>
> Anyone have any suggestions?
>
>
>
> Thanks.
--- End Message ---
--- Begin Message ---
Hi
how do I add dates???
for example,
if the date from database is thursday, feb 12, 1996
and i want to know the date after 20 days from this
date, is this possible in PHP.
or
if todays date is thursday, feb 12, 1996 , how i will
know the date of the day 20 days from today???
Isai.
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
--- End Message ---
--- Begin Message ---
PHP can format a date in a variety of combinations and I suggest that you
familiarize yourself with these formats if you are going to be doing any
date manipulation -> http://ca.php.net/manual/en/function.date.php
The two lines of code below should do what you want:
$CurrentDate = date("l, F d, Y");
$FutureDate = date("l, F d, Y", strtotime($CurrentDate . "+20 days"));
Cheers,
Dan
-----Original Message-----
From: Isai Arasu [mailto:[EMAIL PROTECTED]
Sent: Monday, July 21, 2003 12:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] adding dates
Hi
how do I add dates???
for example,
if the date from database is thursday, feb 12, 1996
and i want to know the date after 20 days from this
date, is this possible in PHP.
or
if todays date is thursday, feb 12, 1996 , how i will
know the date of the day 20 days from today???
Isai.
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I am having no end of bad luck getting the refering page returned, the issue
may be that I am doing redirects using javascript if a document is not
loaded correctly.
//
// test and redirect if needed
//
<script language="JavaScript" >
<!--/
if (window != parent) top.location.href = location.href;
function checkref() {
if (document.referrer !=
("http://groups.msn.com/CastleOfDarkDesiresDreams/annex.msnw"))
window.location = "http://coddad.thepumas.net/errors/403-50.php";
}
//-->
</script>
How would i get the page that sent someone to the error screen?? Both the
$_SERVER and getenv calls to HTTP_REFERER return either empty or something
undefined..
this code has no effect with or without the getenv capitalized
$refpage=GETENV('HTTP_REFERER');
if ($repage = ""){
$refpage="Direct Hit";
}
and if I try the same thing but with
$refpage=$_SERVER["HTTP_REFERER"];
if ($repage = ""){
$refpage="Direct Hit";
}
I get the following notice on the screen when the script is run
Notice: Undefined index: HTTP_REFERER in E:\coddad\errors\403-50.php on line
28
regards
Jon
--- End Message ---
--- Begin Message ---
Jon,
Try this:
if (($_SERVER[HTTP_REFERER] == "") || ($_SERVER[HTTP_REFERER] !=
"http://your_domain/your_file_name")){
echo "You came from different page or tried to open this file
directly!";
}else {
echo "You came from my page";
}
Take care,
Igor P.
-----Original Message-----
From: Jon Phipps [mailto:[EMAIL PROTECTED]
Sent: Monday, July 21, 2003 11:03 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] http referer
I am having no end of bad luck getting the refering page returned, the
issue
may be that I am doing redirects using javascript if a document is not
loaded correctly.
//
// test and redirect if needed
//
<script language="JavaScript" >
<!--/
if (window != parent) top.location.href = location.href;
function checkref() {
if (document.referrer !=
("http://groups.msn.com/CastleOfDarkDesiresDreams/annex.msnw"))
window.location =
"http://coddad.thepumas.net/errors/403-50.php";
}
//-->
</script>
How would i get the page that sent someone to the error screen?? Both
the
$_SERVER and getenv calls to HTTP_REFERER return either empty or
something
undefined..
this code has no effect with or without the getenv capitalized
$refpage=GETENV('HTTP_REFERER');
if ($repage = ""){
$refpage="Direct Hit";
}
and if I try the same thing but with
$refpage=$_SERVER["HTTP_REFERER"];
if ($repage = ""){
$refpage="Direct Hit";
}
I get the following notice on the screen when the script is run
Notice: Undefined index: HTTP_REFERER in E:\coddad\errors\403-50.php on
line
28
regards
Jon
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
You can't trust the referer info...
It may not exist at all, it may be tampered... It isn't reliable...
(both the servers and the browsers can ruin it).
Cheers,
Luis Ferro
Jon Phipps wrote:
I am having no end of bad luck getting the refering page returned, the issue
may be that I am doing redirects using javascript if a document is not
loaded correctly.
//
// test and redirect if needed
//
<script language="JavaScript" >
<!--/
if (window != parent) top.location.href = location.href;
function checkref() {
if (document.referrer !=
("http://groups.msn.com/CastleOfDarkDesiresDreams/annex.msnw"))
window.location = "http://coddad.thepumas.net/errors/403-50.php";
}
//-->
</script>
How would i get the page that sent someone to the error screen?? Both the
$_SERVER and getenv calls to HTTP_REFERER return either empty or something
undefined..
this code has no effect with or without the getenv capitalized
$refpage=GETENV('HTTP_REFERER');
if ($repage = ""){
$refpage="Direct Hit";
}
and if I try the same thing but with
$refpage=$_SERVER["HTTP_REFERER"];
if ($repage = ""){
$refpage="Direct Hit";
}
I get the following notice on the screen when the script is run
Notice: Undefined index: HTTP_REFERER in E:\coddad\errors\403-50.php on line
28
regards
Jon
--- End Message ---
--- Begin Message ---
You need to split this into 2 separate pages. In page 2 you run the create
page2 function as normal, the same for page 1 with just the create page1
function.
The only difference is that in the HEAD of page1, add the following HTML
tag (since this is an HTML question not a PHP question) :
<meta http-equiv="refresh" content="10; url=page2.php">
No need for javascript or odd server side delays (which cannot do what you
want in any case). Cheers - Neil.
At 12:58 21/07/2003 +0000, you wrote:
what I need is for page 1 to show up then after the time out the window
clear and have page 2 show up. I can get them to both show up at the same
time in the same window but how do I make it look like it has loaded 2
pages.
Jon
--- End Message ---
--- Begin Message ---
Thanks Neil, had not thought of doing it that way.... seems much more
elegant than what I was doing anyway.
Will work that into the code and finaly have it behaving right... now if I
could just get the http referer parsed right for the log file
Jon
"Neil Smith" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> You need to split this into 2 separate pages. In page 2 you run the create
> page2 function as normal, the same for page 1 with just the create page1
> function.
>
> The only difference is that in the HEAD of page1, add the following HTML
> tag (since this is an HTML question not a PHP question) :
>
> <meta http-equiv="refresh" content="10; url=page2.php">
>
> No need for javascript or odd server side delays (which cannot do what you
> want in any case). Cheers - Neil.
>
> At 12:58 21/07/2003 +0000, you wrote:
> >what I need is for page 1 to show up then after the time out the window
> >clear and have page 2 show up. I can get them to both show up at the same
> >time in the same window but how do I make it look like it has loaded 2
> >pages.
> >
> >Jon
>
--- End Message ---
--- Begin Message ---
Hello,
I need a PHP redirector for my server in which I host multiple web
sites as follows:
Site 1
====
Local Path: /var/www/htdocs/site1
Server IP: 192.168.1.10
URL: www.site1.com
Site 2
====
Local Path: /var/www/htdocs/site2
Server IP: 192.168.1.10
URL: www.site.com
When someone refers to either www.site1.com or www.site2.com, I need
them to be redirected to a specific local directory respectively. Can
someone help doing this via PHP?
Thanks,
Shaffin.
--- End Message ---
--- Begin Message ---
$_SERVER["SERVER_NAME"]
then just do a switch on the $_SERVER["SERVER_NAME"] and then
header("Location:....") to redirect them.
there may be a tidier way, but that's what i do...
-skate-
----- Original Message -----
From: "Shaffin Bhanji" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 21, 2003 8:04 PM
Subject: [PHP-WIN] PHP Redirector Anyone??
> Hello,
>
> I need a PHP redirector for my server in which I host multiple web
> sites as follows:
>
> Site 1
> ====
> Local Path: /var/www/htdocs/site1
> Server IP: 192.168.1.10
> URL: www.site1.com
>
> Site 2
> ====
> Local Path: /var/www/htdocs/site2
> Server IP: 192.168.1.10
>
> URL: www.site.com
>
> When someone refers to either www.site1.com or www.site2.com, I need
> them to be redirected to a specific local directory respectively. Can
> someone help doing this via PHP?
>
> Thanks,
> Shaffin.
>
>
--- End Message ---