php-windows Digest 20 Apr 2002 03:33:26 -0000 Issue 1102
Topics (messages 13190 through 13204):
A Breath fo Fresh Air -- Bandwidth Waster
13190 by: R.S. Herhuth
mysql_fetch_array()
13191 by: Guilherme Dávalos
Creating dynamic variables and assigning values in a while statement
13192 by: Robert Trembath
13197 by: Nicole Amashta
Re: can't view php
13193 by: joey
13194 by: Dash McElroy
13196 by: Nicole Amashta
13204 by: joey
Re: .php unrecognizable extension
13195 by: Nicole Amashta
13198 by: Nicole Amashta
Re: mssql, query and schoolboy error
13199 by: Nicole Amashta
13200 by: Nicole Amashta
Security Risk w/ PHP and Apache 1.3.x
13201 by: Benjamin Scherrey
inclusion error
13202 by: Bryan Maynard
Upload Help
13203 by: Waldemar Brand Neto
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 just want to say that after two weeks of working with PHP I'm finally
getting it (thanks to this list and it's contributors!). PHP rocks!
Ron
--- End Message ---
--- Begin Message ---
Hi folks,
I'm trying to run an application, made on PHP3/LINUX, on PHP 4.1.2/Windows in module
scheme. But its seems be reclaiming that mysql_fetch_array() function doesn't work at
4.1.2 version. How can i fix it?
[ ]'s
Pajé
--- End Message ---
--- Begin Message ---
Good morning everyone,
Kinda got stuck here. Must be brain dead this morning. I'm trying to
loop thru a results set from a mysql query that will always return an
array of 13 results. I need to loop thru using a while statement and
create dynamic variables $temp1 - $temp13 and $tempcolor1 - $tempcolor13
to assign values to each of these variables as I loop thru. Here's the
code, please review and advise, suggest whatever. This script is used to
build a line graph in php from the data in the $temp variables.
$counter = "0";
//loop thru wells to create line plots
while( $row = mysql_fetch_array( $query ) )
{
//define global
$temp="ydata$counter";
global $$temp;
$tempcolor="ydata$counter";
global $$tempcolor;
// Create the linear plot
$ydata = explode(",", $row[CurveData]);
$$temp = $ydata;
//Set Line Plot Color
$lineplot->SetColor("$color[$counter]");
$$tempcolor = $lineplot;
//add 1 to counter
$counter = $counter + 1;
}
//define lines
$lineplot0=new LinePlot($temp0);
$lineplot1=new LinePlot($temp1);
$lineplot2=new LinePlot($temp2);
$lineplot3=new LinePlot($temp3);
$lineplot4=new LinePlot($temp4);
$lineplot5=new LinePlot($temp5);
$lineplot6=new LinePlot($temp6);
$lineplot7=new LinePlot($temp7);
$lineplot8=new LinePlot($temp8);
$lineplot9=new LinePlot($temp9);
$lineplot10=new LinePlot($temp10);
$lineplot11=new LinePlot($temp11);
$lineplot12=new LinePlot($temp12);
//set colors
$lineplot0->SetColor("$tempcolor0");
$lineplot1->SetColor("$tempcolor1");
$lineplot2->SetColor("$tempcolor2");
$lineplot3->SetColor("$tempcolor3");
$lineplot4->SetColor("$tempcolor4");
$lineplot5->SetColor("$tempcolor5");
$lineplot6->SetColor("$tempcolor6");
$lineplot7->SetColor("$tempcolor7");
$lineplot8->SetColor("$tempcolor8");
$lineplot9->SetColor("$tempcolor9");
$lineplot10->SetColor("$tempcolor10");
$lineplot11->SetColor("$tempcolor11");
$lineplot12->SetColor("$tempcolor12");
//ad lines
$graph->Add($lineplot0);
$graph->Add($lineplot1);
$graph->Add($lineplot2);
$graph->Add($lineplot3);
$graph->Add($lineplot4);
$graph->Add($lineplot5);
$graph->Add($lineplot6);
$graph->Add($lineplot7);
$graph->Add($lineplot8);
$graph->Add($lineplot9);
$graph->Add($lineplot10);
$graph->Add($lineplot11);
$graph->Add($lineplot12);
HELP!!!!
--------------------------
D. Robert Trembath
Chief Software Engineer
Bacterial BarCodes Inc.
e|[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
>>> $counter = "0";
This line may work in your code, but if you are assigning numbers, you don't
need to put quotes around them since they are numbers and not strings.
If you then want to use that number as part of a string, do like you did:
$temp="ydata$counter";
or do like so:
$temp="ydata " . $counter;
I don't use the $$ thing, so I'm not sure what you are doing there.
SO, what is the error you are getting? Or what is/isn't happening with your
code? Can you be more specific?
--
Nicole Amashta
Web Application Developer
www.aeontrek.com
"Robert Trembath" <[EMAIL PROTECTED]> wrote in message
000201c1e7b5$bdcdc300$4001a8c0@roblaptop">news:000201c1e7b5$bdcdc300$4001a8c0@roblaptop...
> Good morning everyone,
>
> Kinda got stuck here. Must be brain dead this morning. I'm trying to
> loop thru a results set from a mysql query that will always return an
> array of 13 results. I need to loop thru using a while statement and
> create dynamic variables $temp1 - $temp13 and $tempcolor1 - $tempcolor13
> to assign values to each of these variables as I loop thru. Here's the
> code, please review and advise, suggest whatever. This script is used to
> build a line graph in php from the data in the $temp variables.
>
> $counter = "0";
> file://loop thru wells to create line plots
> while( $row = mysql_fetch_array( $query ) )
> {
> file://define global
> $temp="ydata$counter";
> global $$temp;
> $tempcolor="ydata$counter";
> global $$tempcolor;
> // Create the linear plot
> $ydata = explode(",", $row[CurveData]);
> $$temp = $ydata;
>
> file://Set Line Plot Color
> $lineplot->SetColor("$color[$counter]");
> $$tempcolor = $lineplot;
>
> file://add 1 to counter
> $counter = $counter + 1;
> }
>
> file://define lines
> $lineplot0=new LinePlot($temp0);
> $lineplot1=new LinePlot($temp1);
> $lineplot2=new LinePlot($temp2);
> $lineplot3=new LinePlot($temp3);
> $lineplot4=new LinePlot($temp4);
> $lineplot5=new LinePlot($temp5);
> $lineplot6=new LinePlot($temp6);
> $lineplot7=new LinePlot($temp7);
> $lineplot8=new LinePlot($temp8);
> $lineplot9=new LinePlot($temp9);
> $lineplot10=new LinePlot($temp10);
> $lineplot11=new LinePlot($temp11);
> $lineplot12=new LinePlot($temp12);
>
> file://set colors
> $lineplot0->SetColor("$tempcolor0");
> $lineplot1->SetColor("$tempcolor1");
> $lineplot2->SetColor("$tempcolor2");
> $lineplot3->SetColor("$tempcolor3");
> $lineplot4->SetColor("$tempcolor4");
> $lineplot5->SetColor("$tempcolor5");
> $lineplot6->SetColor("$tempcolor6");
> $lineplot7->SetColor("$tempcolor7");
> $lineplot8->SetColor("$tempcolor8");
> $lineplot9->SetColor("$tempcolor9");
> $lineplot10->SetColor("$tempcolor10");
> $lineplot11->SetColor("$tempcolor11");
> $lineplot12->SetColor("$tempcolor12");
>
> file://ad lines
> $graph->Add($lineplot0);
> $graph->Add($lineplot1);
> $graph->Add($lineplot2);
> $graph->Add($lineplot3);
> $graph->Add($lineplot4);
> $graph->Add($lineplot5);
> $graph->Add($lineplot6);
> $graph->Add($lineplot7);
> $graph->Add($lineplot8);
> $graph->Add($lineplot9);
> $graph->Add($lineplot10);
> $graph->Add($lineplot11);
> $graph->Add($lineplot12);
>
> HELP!!!!
>
> --------------------------
> D. Robert Trembath
> Chief Software Engineer
> Bacterial BarCodes Inc.
> e|[EMAIL PROTECTED]
>
>
--- End Message ---
--- Begin Message ---
Ok i'm using Apache 1.3.24 and PHP 4.1.2 and the windows platform is XP home
edition
yes i've added this line in my httpd.conf file
AddType application/x-httpd-php .php
"Joey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Everytime i try to view a php file on my server it prompts me to download
> the file then opens it up in word pad. I can view any other file just not
> php.
>
> Can anyone help me with this problem please?
>
>
>
--- End Message ---
--- Begin Message ---
Joey,
It sounds like PHP is not telling apache that is a Content-type of
text/html. See this line in PHP.ini (which should be in c:\<windows
directory>).
default_mimetype = "text/html"
Also, try adding a line in your httpd.conf for .html files like this:
AddType application/x-httpd-php .html
and then see if html files do the same thing.
I have my server(s) set up this way.
-Dash
p.s. does Apache run as a service on XP Home?
-----Original Message-----
From: joey [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 19, 2002 8:25 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Re: can't view php
Ok i'm using Apache 1.3.24 and PHP 4.1.2 and the windows platform is XP home
edition
yes i've added this line in my httpd.conf file
AddType application/x-httpd-php .php
"Joey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Everytime i try to view a php file on my server it prompts me to download
> the file then opens it up in word pad. I can view any other file just not
> php.
>
> Can anyone help me with this problem please?
>
>
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Keep reading the documentation ... if that's the only line you added, you
aren't done.
--
Nicole Amashta
Web Application Developer
www.aeontrek.com
"Joey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Ok i'm using Apache 1.3.24 and PHP 4.1.2 and the windows platform is XP
home
> edition
>
> yes i've added this line in my httpd.conf file
> AddType application/x-httpd-php .php
>
> "Joey" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Everytime i try to view a php file on my server it prompts me to
download
> > the file then opens it up in word pad. I can view any other file just
not
> > php.
> >
> > Can anyone help me with this problem please?
> >
> >
> >
>
>
--- End Message ---
--- Begin Message ---
yes i've tried that too *sigh* :( i've read the manual over and over again
and installed it a few times and added all those lines ppl suggested but
still no luck. I'm about to just give up. I know how to work PHP but I just
can't find where this problem comes from. Maybe it's a windows thingy who
knows, maybe i need IIS on my system which of course doesn't come with Win
XP Home Edition. I read something about webpage in management tools in
Windows but i don't have that so i can't change things there. I really do
appreciate all your reactions and replies.
it's probably just one simple thingy somewhere BUT WHERE.
"Nicole Amashta" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Keep reading the documentation ... if that's the only line you added, you
> aren't done.
>
> --
> Nicole Amashta
> Web Application Developer
> www.aeontrek.com
>
>
> "Joey" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Ok i'm using Apache 1.3.24 and PHP 4.1.2 and the windows platform is XP
> home
> > edition
> >
> > yes i've added this line in my httpd.conf file
> > AddType application/x-httpd-php .php
> >
> > "Joey" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Everytime i try to view a php file on my server it prompts me to
> download
> > > the file then opens it up in word pad. I can view any other file just
> not
> > > php.
> > >
> > > Can anyone help me with this problem please?
> > >
> > >
> > >
> >
> >
>
>
--- End Message ---
--- Begin Message ---
Did you read your documentation on setting up Apache and PHP with Apache?
You have several files to configure in order to get PHP working with Apache
and vice versa ....
When in doubt, RTFM :)
http://www.php.net
http://www.apache.org
If you need further help, let me know.
--
Nicole Amashta
Web Application Developer
www.aeontrek.com
"Dion" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am running Apache 1.3 on WindowsXP just for some developement stuff that
I
> do at home. I just installed PHP to the server but I can't get it to
> recognize .php as an extension and to have it load those as if they were
> .html files. IE.... index.php it just shows a directory listing instead
of
> loading the file. Can someone help me?
>
>
>
--- End Message ---
--- Begin Message ---
Ooops, I'm sure you've figured this one out by now ... 3+ months later.
--
Nicole Amashta
Web Application Developer
www.aeontrek.com
"Dion" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am running Apache 1.3 on WindowsXP just for some developement stuff that
I
> do at home. I just installed PHP to the server but I can't get it to
> recognize .php as an extension and to have it load those as if they were
> .html files. IE.... index.php it just shows a directory listing instead
of
> loading the file. Can someone help me?
>
>
>
--- End Message ---
--- Begin Message ---
Here is your problem:
below is your code:
<snip>
$result = mssql_query($query,$link); file://JUST CRASHES ON THIS LINE
$r = mssql_rows_affected ( $link);
</snip>
The 2nd line there:
$r = mssql_rows_affected( $link );
should be
$r = mssql_rows_affected( $result );
AND, you do not need to pass the $link into the mssql_query($query) function
at that point. It's understood.
Hope that helped ! :)
If you get an error occurred on such and such line, it isn't always
necessary the correct line. It may be the line before, or even multiple
lines before.
Good luck,
--
Nicole Amashta
Web Application Developer
www.aeontrek.com
"Rob Fraser" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
...
Dear All,
I hope somebody can help me. I am new to PHP (I've used ASP for three
years:-( ) and I'm loving PHP and trying to get my work to convert but
I've coming across a error with mssql_query() explorer its just crashes
with a php.exe 'memory could not be read error'. I'm sure it a school
boy error from me but I'm just stuck, please help me code is......
===========
$link = mssql_connect ("laptop", "sa", "elmwood");
print ("<br>LINK was $link");
$back = mssql_select_db ( "elmback",$link);
print("<br>back was $back");
$query = "SELECT * FROM tblperson";
print("<br>query was $query");
$result = mssql_query($query,$link); file://JUST CRASHES ON THIS LINE
$r = mssql_rows_affected ( $link);
print("<br>rows affected was $r");
$close = mssql_close ($link);
print("<br>close was $close");
=========
I run IIS4, NT4 (SP6a) and SQL 7 on the same machine as its my
development one, out of date maybe but you should see my clothes but PHP
was test downloaded a month ago - any ideas from a white knight?
best regards
Rob
--- End Message ---
--- Begin Message ---
Here is your problem:
below is your code:
<snip>
$result = mssql_query($query,$link); file://JUST CRASHES ON THIS LINE
$r = mssql_rows_affected ( $link);
</snip>
The 2nd line there:
$r = mssql_rows_affected( $link );
should be
$r = mssql_rows_affected( $result );
AND, you do not need to pass the $link into the mssql_query($query) function
at that point. It's understood.
Hope that helped ! :)
If you get an error occurred on such and such line, it isn't always
necessary the correct line. It may be the line before, or even multiple
lines before.
Good luck,
--
Nicole Amashta
Web Application Developer
www.aeontrek.com
"Rob Fraser" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
...
Dear All,
I hope somebody can help me. I am new to PHP (I've used ASP for three
years:-( ) and I'm loving PHP and trying to get my work to convert but
I've coming across a error with mssql_query() explorer its just crashes
with a php.exe 'memory could not be read error'. I'm sure it a school
boy error from me but I'm just stuck, please help me code is......
===========
$link = mssql_connect ("laptop", "sa", "elmwood");
print ("<br>LINK was $link");
$back = mssql_select_db ( "elmback",$link);
print("<br>back was $back");
$query = "SELECT * FROM tblperson";
print("<br>query was $query");
$result = mssql_query($query,$link); file://JUST CRASHES ON THIS LINE
$r = mssql_rows_affected ( $link);
print("<br>rows affected was $r");
$close = mssql_close ($link);
print("<br>close was $close");
=========
I run IIS4, NT4 (SP6a) and SQL 7 on the same machine as its my
development one, out of date maybe but you should see my clothes but PHP
was test downloaded a month ago - any ideas from a white knight?
best regards
Rob
--- End Message ---
--- Begin Message ---
I'm working with a company doing internet intrusion detection and there is an exploit
known in PHP that I am trying to detect.
See http://www.securiteam.com/windowsntfocus/5ZP030U60U.html for details about it.
Basically if someone does something like
"http://www.example.com/php/php.exe?d:\winnt\repair\secret.txt" then they'll get back
the specified file (when Apache has the exploit present). Now I'm not a
Windows/Apache/PHP
guy but I do use it in Linux. I know its bad form to have php.exe in your links so my
detection idea is to look for that in the request and alert on its presence. My
question is,
is this common usage for Windows deployments? I don't want a lot of false positive
alerts resulting from this. Optionally, I might consider also testing for the presence
of an
absolute file location in addition to the php.exe or maybe a link that specifies a
file extension that isn't common like php3/4,.htm?, etc... I'm posting this here to
get some
feedback from Windows/Apache/PHP people and see what you all think about this idea.
Please send me any concerns/ideas you might have about this.
thanx & later,
Ben Scherrey
--- End Message ---
--- Begin Message ---
I believe that I am close to getting this to work but now I am getting the
following error when trying to view .php files in my browser:
Warning: Failed opening '/wwwroot/[directory]/time.php' for inclusion
(include_path='c:\php4\pear') in Unknown on line 0,
where [directory] is the directory of my html and php files.
--- End Message ---
--- Begin Message ---
Hi, I am a newbie in php. I have to upload an Image to a BLOB field in Mysql. But when
I insert the field it save the path of the image file and not the image itself.
This is the code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Upload.php</title>
</head>
<BODY BGCOLOR=#3366FF>
<CENTER>
<FORM ENCTYPE="multipart/form-data" ACTION="Upload1.php" METHOD=POST>
<h1> Kompatscher & Cia Ltda </h1>
<hr>
<?php
$con = mysql_connect("*****************************************) or die ("Erro ao
conectar!");
mysql_select_db("**********r", $con) or die ("Erro ao selecionar a database!");
$comando="SELECT codigo,foto FROM cadgrupo";
$res = mysql_query($comando,$con);
$linha = mysql_fetch_array($res);
echo "<TABLE ALIGN=CENTER>";
echo "<tr>";
echo "<td>";
echo "Código";
echo "</td>";
echo "<td>";
$i=$linha['codigo'];
echo "<input type=text value=$i name=codigo>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo "Foto";
echo "</td>";
echo "<td>";
$i=$linha['foto'];
echo "<input type=image value=$i border=0>";
echo "</td>";
echo "</tr>";
echo "</TABLE>";
?>
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="4000000">
<p>
Arquivo com a foto da peça: <INPUT NAME="foto" TYPE="file">
<br>
<INPUT TYPE="submit" VALUE="Enviar">
</FORM>
</CENTER>
</BODY>
</html>
Upload1.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Upload1.php</title>
</head>
<BODY BGCOLOR=#3366FF>
<center>
<h1> Kompatscher & Cia Ltda </h1>
<hr>
<?php
$con = mysql_connect("****************************************") or die ("Erro ao
conectar!");
mysql_select_db("***********", $con) or die ("Erro ao selecionar a database!");
$res=0;
$comando= "UPDATE cadgrupo SET foto='$foto' WHERE codigo=$codigo";
echo $comando;
$res = mysql_query($comando,$con);
if ($res <= 0)
{
// query incorreta
echo "<h3><B>Erro na Atualização " . $res ."</B></h3>";
}
else {
echo "<h3>Cadastro de<b> " . $nome . "</b> foi atualizado com sucesso.</h3>";
}
mysql_close($con);
?>
</center>
</body>
</html>
Thank´s for any help.
Waldemar
--- End Message ---