|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Thu Jul 11 2002 - 13:13:31 CDT
php-general Digest 11 Jul 2002 18:13:31 -0000 Issue 1458
Topics (messages 107030 through 107197):
php4apache.dll...
107030 by: Peter
107033 by: Tyler Longren
Re: Table Making
107031 by: Martin Towell
107032 by: Jason Soza
107034 by: Tyler Longren
107042 by: Chris Hewitt
107100 by: Justin French
107117 by: joakim.andersson.cybercom.se
107150 by: Analysis & Solutions
107151 by: Analysis & Solutions
107178 by: Jason Soza
107181 by: Chris Boget
107184 by: Chris Boget
107186 by: Jason Soza
Session, performance, timeout
107035 by: Fredrik Nygren
how to know upload progress status
107036 by: S.
107043 by: val petruchek
107114 by: S.
Where is the Error
107037 by: millw0rm
107039 by: John Legg
Re: Postal / Zip Code Proximity Search
107038 by: Richard Lynch
107116 by: Analysis & Solutions
Re: sort problem
107040 by: andy
107099 by: Justin French
107123 by: Analysis & Solutions
[REGEX] Regex ref to '<' character problem (fwd)
107041 by: Benjamin Plaquevent
Posting Problem
107044 by: Sameh Attia
PHP CGI versus Module
107045 by: Richard Lynch
Re: getting the IP address off a visitor
107046 by: Richard Lynch
Re: Cross-Site Sesison ID Propagation
107047 by: Richard Lynch
Re: Build-up of MySQL Sessions
107048 by: Richard Lynch
Re: No server var array, why
107049 by: Richard Lynch
Re: <no subject>
107050 by: Richard Lynch
Re: Dual Server...
107051 by: Richard Lynch
Re: Qmail and PHP
107052 by: Richard Lynch
Re: Odd Request: Image 2 HEX
107053 by: Richard Lynch
Re: header()
107054 by: Richard Lynch
107152 by: Chris Hewitt
Re: Wait/Timeout
107055 by: Richard Lynch
Re: Script File Permissions
107056 by: Richard Lynch
107063 by: Richard Lynch
Re: exif_read_data to read, and to write ...?
107057 by: Richard Lynch
Re: sigh... forms
107058 by: Richard Lynch
Re: PHP code optimization
107059 by: Richard Lynch
Re: CANT GET STUFF TO WORK
107060 by: Richard Lynch
Re: The code to the pages that I can't figure out.
107061 by: Richard Lynch
Re: multi dimensional arrays / radio buttons / mass confusion on my part
107062 by: Richard Lynch
Re: Mail() function
107064 by: Richard Lynch
Re: php loopholes
107065 by: Richard Lynch
Re: $_REQUEST???
107066 by: Richard Lynch
Re: How do I import tables into MySQL from web page ...
107067 by: Richard Lynch
107068 by: Richard Lynch
107070 by: Richard Lynch
Re: Function source?
107069 by: Richard Lynch
Re: shtml & php in the same file?
107071 by: Richard Lynch
Re: T_string error
107072 by: Richard Lynch
Re: Exporting mySQL Table Data to .csv
107073 by: Richard Lynch
Re: strange php output
107074 by: Richard Lynch
Re: Storing values in Session
107075 by: Richard Lynch
Re: cookie ?
107076 by: Richard Lynch
Re: PHP 4.2.1 / Apache
107077 by: Richard Lynch
Re: cookie ( still not working )
107078 by: Richard Lynch
Re: strange stuff in a class
107079 by: Richard Lynch
Re: count number of downloads
107080 by: Richard Lynch
Re: Wildcard
107081 by: Richard Lynch
Re: Display criteria
107082 by: Richard Lynch
Re: cookies
107083 by: Richard Lynch
107096 by: Daniel
Re: if syntax
107084 by: Richard Lynch
107130 by: Ford, Mike [LSS]
107188 by: Chris Earle
Re: Images in Mysql
107085 by: Richard Lynch
Re: Getting PHP to read the mail!
107086 by: Richard Lynch
Re: Development Tools
107087 by: Richard Lynch
107110 by: Al Baker
107113 by: Martin Clifford
107148 by: Alexandru COSTIN
107149 by: Alexandru COSTIN
Re: session error ... I think
107088 by: Richard Lynch
107170 by: Alexander Ross
107192 by: Chris Hewitt
107193 by: Alexander Ross
107194 by: Martin Clifford
Re: Security with XML
107089 by: Richard Lynch
Re: Appending to a file
107090 by: Richard Lynch
Re: Question about PHP
107091 by: Richard Lynch
Re: Retrieving/Displaying hyperlinked images with PHP
107092 by: Richard Lynch
Re: Help with Configure Options
107093 by: Richard Lynch
Re: is their a jobs mailing list?
107094 by: Richard Lynch
Execute script then output image.
107095 by: JJ Harrison
107103 by: David Otton
107104 by: JJ Harrison
107107 by: David Otton
Character Array
107097 by: Daniel
107098 by: David Otton
107101 by: Jean-François GAZET
107105 by: David Otton
107106 by: Michal Dvoracek
107172 by: Philip Olson
Re: [PHP-WIN] More bzip woes! No file written...
107102 by: Mikey
session_start and HTTP headers in Mozilla, plz help
107108 by: Lars Olsson
MAIL FROM NO ONE
107109 by: vins
107153 by: Chris Hewitt
107189 by: Chris Knipe
PHP 4.3.0-dev and gd
107111 by: Kevin Waterson
107173 by: Danny Shepherd
HELP using Next() in session array
107112 by: Leonid Vaner
Newbie Logical opertaor question
107115 by: Rw
107119 by: Martin Clifford
107120 by: Martin Clifford
107135 by: Johan Holst Nielsen
Re: Generating word documents based on fields in a browser
107118 by: Mikey
107131 by: Craig
MS SQL Server and ODBC
107121 by: Tim Nields
107122 by: Mikey
107125 by: Adam Voigt
107126 by: Mikey
107127 by: Adam Voigt
107128 by: Mikey
107129 by: Mikey
107132 by: Adam Voigt
Re: setcookie then redirect
107124 by: Cord Schneider
Re: another splice?
107133 by: Ford, Mike [LSS]
Customise Index page using PHP????
107134 by: Craig
107139 by: Craig
107144 by: Martin Clifford
107145 by: Jay Blanchard
compiling with mysql
107136 by: Michael Hall
107138 by: Tyler Longren
107140 by: Rasmus Lerdorf
107141 by: Michael Hall
107147 by: Michael Hall
compiling and php.ini
107137 by: Michael Hall
107142 by: Tyler Longren
fsock and fget driving me mad!
107143 by: Zac Hillier
FDF on windows
107146 by: Tobias Talltorp
How to set focus in a form field
107154 by: Andre Dubuc
107156 by: Richard Black
107157 by: David Otton
107163 by: Andre Dubuc
How to know if we're using http or https
107155 by: LeTortorec, Jean-Louis
107158 by: R'twick Niceorgaw
107160 by: Chris Boget
107161 by: Brian McGarvie
107167 by: LeTortorec, Jean-Louis
can you do exec under Windows OS?
107159 by: Wo Chang
107166 by: Wo Chang
Getting the URL that triggered a 404.
107162 by: Robert Cummings
107164 by: Brian McGarvie
107165 by: Henning Sittler
107183 by: Robert Cummings
mysql question
107168 by: Alexander Ross
107175 by: Miles Thompson
Anybody using PEAR Auth_HTTP?
107169 by: Tim
(OT) No Punishment for Erik Hegreberg, Yet...
107171 by: Jason Soza
107174 by: Rasmus Lerdorf
107176 by: Glenn Sieb
107177 by: Daniel Negron/KBE
107179 by: Scott Fletcher
107180 by: Rasmus Lerdorf
107185 by: vins
107190 by: Kondwani Spike Mkandawire
Re: Breaking Dynamic Content into Pages...
107182 by: Lazor, Ed
Searching a Paradox Table with my PHP Script...
107187 by: Kondwani Spike Mkandawire
Re: Editing files by line
107191 by: Chris Earle
using pdf template
107195 by: Tobias Talltorp
107196 by: Rasmus Lerdorf
Loading dynamic pages based on URL
107197 by: Monty
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Howdy
can any one remember where to get the apache2 ver of php4apache.dll?
Cheers
Peter
"the only dumb question is the one that wasn't asked"
attached mail follows:
Use this file instead:
php4apache2.dll
It's supposedly in the sapi directory. Did you search the internet for
this subject before you posted? If not, you should have. There's lots
of info on this "missing" file. if you can't find a working version
anywhere, mail the php-dev mailing list, they can probably help you out
more.
-- Tyler Longren Captain Jack Communications tylercaptainjack.com www.captainjack.com
On Thu, 11 Jul 2002 16:22:27 +1000 "Peter" <php
vfsa.com.au> wrote:
> Howdy > > can any one remember where to get the apache2 ver of php4apache.dll? > > Cheers > > Peter > "the only dumb question is the one that wasn't asked" >
attached mail follows:
This is the logic I would use
count number of results table rows = num results / 5 (maybe floor() or ceil() it) read results into a 2D array fill column 1 first when column 1 fills up, reset row count to 0 and inc. col count whizz through your array and display the table as needed
HTH Martin
-----Original Message-----
From: Jason Soza [mailto:solja
gci.net]
Sent: Thursday, July 11, 2002 4:05 PM
To: PHP-General Mailing List
Subject: [PHP] Table Making
I'm driving myself crazy trying to visualize what I want to do, so I thought I'd share the insanity and hope for some advice.
I have this nice piece of code to take my SQL result and organize it into a nice 5 column table:
print "<center><table width=\"100%\" border=\"0\">\n"; //start table
$i=0; //define variable - avoid errors $grad_year=""; //define variable - avoid errors
while ($row = mysql_fetch_array($sql)) { extract($row); $i++;
if($i=="1") { print "<tr>\n"; //start table row on $i = 1 }
printf("<td align=\"center\"><a href=\"year.asp?year=%s\">%s</a><br></td>\n", $grad_year, $grad_year); //print links
if ($i=="5") { print "</tr>\n"; //end table row on $i = 5 to get 5 columns $i=0; //reset $i }
$grad_year=""; //clear $grad_year
}
if ($i<5) print "</tr>\n"; //end any rows with less than 5 columns
print "</table></center><p>\n"; //end table -------------------END------------------------
Now, this works great for most things - it takes my SQL results and puts them in a table sequentially, from left to right, top to bottom. So in this case, the top-left cell displays "1941", the top-right cell displays "1945", the next row starts with "1946" on the left and goes to "1950" on the right, and so on.
What I want is rather than sorting left to right, top to bottom, I want to sort top to bottom, left to right. So the top-left would still be "1941", but rather than increasing to the right, it would increase down, then continue at the top of the next column.
I'm thinking this might be an easy thing to do with some creative use of $i and print, but I just can't think it out. I'm guessing $i would be used to limit the amount of items in a column... But, I'm in need of some guidance to get it right. I can't even begin to think where to start. Any help would be great - thanks!
Jason Soza
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Thanks for the code improvement, but that will still print results from left to right, top to bottom, i.e. the items ascend left to right in the rows. I'm not concerned with the actual order that they come out of MySQL in, just how they're displayed.
Basically, instead of this: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
I want this: 1 6 11 2 7 12 3 8 13 4 9 14 5 10 15
Thanks again for the help, though.
Jason Soza
-----Original Message-----
From: Analysis & Solutions [mailto:danielc
analysisandsolutions.com]
Sent: Wednesday, July 10, 2002 10:13 PM
To: PHP List
Subject: Re: [PHP] Table Making
Jason:
On Wed, Jul 10, 2002 at 10:04:45PM -0800, Jason Soza wrote: > > I have this nice piece of code to take my SQL result and organize it into a > nice 5 column table:
Nice is in the eye of the beholder... Here's what I think is nice:
echo "<table width=\"100%\" border=\"0\" align=\"center\">\n"; echo " <tr>\n";
while ($row = mysql_fetch_array($sql, MYSQL_ASSOC)) { echo ' <td align="center"><a href="year.asp?year='; echo $row['grad_year'] . '">' . $row['grad_year'] . "</a></td>\n"; }
echo " </tr>\n"; echo "</table>\n\n";
If you want to reverse the order, use an ORDER BY clause in your query string.
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
attached mail follows:
I'm not sure if you can do that because you have to go row by row when writing html, not column by column. I could be mistaken though.
-- Tyler Longren Captain Jack Communications tylercaptainjack.com www.captainjack.com
On Wed, 10 Jul 2002 22:34:15 -0800 "Jason Soza" <solja
gci.net> wrote:
> Thanks for the code improvement, but that will still print results > from left to right, top to bottom, i.e. the items ascend left to right > in the rows. I'm not concerned with the actual order that they come > out of MySQL in, just how they're displayed. > > Basically, instead of this: > 1 2 3 4 5 > 6 7 8 9 10 > 11 12 13 14 15 > > I want this: > 1 6 11 > 2 7 12 > 3 8 13 > 4 9 14 > 5 10 15 > > Thanks again for the help, though. > > Jason Soza > > -----Original Message----- > From: Analysis & Solutions [mailto:danielc
analysisandsolutions.com] > Sent: Wednesday, July 10, 2002 10:13 PM > To: PHP List > Subject: Re: [PHP] Table Making > > > Jason: > > On Wed, Jul 10, 2002 at 10:04:45PM -0800, Jason Soza wrote: > > > > I have this nice piece of code to take my SQL result and organize it > > into > a > > nice 5 column table: > > Nice is in the eye of the beholder... Here's what I think is nice: > > echo "<table width=\"100%\" border=\"0\" align=\"center\">\n"; > echo " <tr>\n"; > > while ($row = mysql_fetch_array($sql, MYSQL_ASSOC)) { > echo ' <td align="center"><a href="year.asp?year='; > echo $row['grad_year'] . '">' . $row['grad_year'] . > "</a></td>\n"; > } > > echo " </tr>\n"; > echo "</table>\n\n"; > > If you want to reverse the order, use an ORDER BY clause in your query > string. > > --Dan > > -- > PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
Jason,
HTML tables will always be displayed left to right, top to bottom. This is why you should ensure that the data from your database table comes out in the right order. Use an ORDER BY clause in your SELECT statement. Designing the table layout to be suitable avoids the problem you currently have.
HTH Chris
Jason Soza wrote:
>--------------------snip--------------------- > >I'm not concerned with the actual order that they come out of MySQL in, just >how they're displayed. >
attached mail follows:
I hate to think what sort of a burden this would place on ther server, but...
You could always find out how many rows there are, then run individual queries for each cell of the table. In other words, to achieve this layout:
1 4 7 2 5 8 3 6 9
You would do queries in this order:
1 4 7 2 5 8 3 6 9
Like I said, I shudder at the thought of how much this would load the server (especially on large rows (lots of fields) or large tables (lots of rows = lots of queries)), but if the layout is imperative, then maybe this is an option...
I can't see why you can't run it as
1 2 3 4 5 6 7 8 9
Cheers,
Justin
attached mail follows:
This is one way of doing it:
- calculate how many rows are needed given the total number of records (mysql_num_rows()) and how many columns you want. - loop through all records and store them in a two-dimensional array starting at arr[0][0] to arr[maxrows][0] and then increment the 'column' and store arr[0][1] to arr[maxrows][1] etc. - loop through the array the other way round and create the html-table. So start with arr[0][0] to arr[0][4] etc.
Make any sense?
Another way of doing it is to use mysql_data_seek() to jump back and forth in the result set.
Regards Joakim Andersson
> -----Original Message-----
> From: Jason Soza [mailto:solja
gci.net]
> Sent: Thursday, July 11, 2002 8:05 AM
> To: PHP-General Mailing List
> Subject: [PHP] Table Making
>
>
> I'm driving myself crazy trying to visualize what I want to
> do, so I thought
> I'd share the insanity and hope for some advice.
>
> I have this nice piece of code to take my SQL result and
> organize it into a
> nice 5 column table:
>
> print "<center><table width=\"100%\" border=\"0\">\n"; //start table
>
> $i=0; //define variable - avoid errors
> $grad_year=""; //define variable - avoid errors
>
> while ($row = mysql_fetch_array($sql)) {
> extract($row);
> $i++;
>
> if($i=="1") {
> print "<tr>\n"; //start table row on $i = 1
> }
>
> printf("<td align=\"center\"><a
> href=\"year.asp?year=%s\">%s</a><br></td>\n", $grad_year, $grad_year);
> //print links
>
> if ($i=="5") {
> print "</tr>\n"; //end table row on $i = 5
> to get 5 columns
> $i=0; //reset $i
> }
>
> $grad_year=""; //clear $grad_year
>
> }
>
> if ($i<5) print "</tr>\n"; //end any rows with less than 5 columns
>
> print "</table></center><p>\n"; //end table
> -------------------END------------------------
>
> Now, this works great for most things - it takes my SQL
> results and puts
> them in a table sequentially, from left to right, top to
> bottom. So in this
> case, the top-left cell displays "1941", the top-right cell
> displays "1945",
> the next row starts with "1946" on the left and goes to
> "1950" on the right,
> and so on.
>
> What I want is rather than sorting left to right, top to
> bottom, I want to
> sort top to bottom, left to right. So the top-left would
> still be "1941",
> but rather than increasing to the right, it would increase down, then
> continue at the top of the next column.
>
> I'm thinking this might be an easy thing to do with some
> creative use of $i
> and print, but I just can't think it out. I'm guessing $i
> would be used to
> limit the amount of items in a column... But, I'm in need of
> some guidance
> to get it right. I can't even begin to think where to start.
> Any help would
> be great - thanks!
>
> Jason Soza
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
On Thu, Jul 11, 2002 at 03:14:07PM +0200, joakim.andersson
cybercom.se wrote:
>
> Another way of doing it is to use mysql_data_seek() to jump back and forth
> in the result set.
Now that Jason clarified what he's trying to do, Joakim is on target. Since this data set already exists, I'd do this rather than create another data set in an array. Trick is, how...
$Columns = 5; $Rows = ceil( mysql_row_count($Result) / $Columns );
echo "<table border=\"1\">\n"; for ($RowCounter = 0; $RowCounter < $Rows; $RowCounter++) { echo " <tr>\n"; for ($ColCounter = 0; $ColCounter < $Columns; $ColCounter++) { $Index = ($Rows * $ColCounter) + $RowCounter; echo ' <td>'; if ( mysql_fetch_seek($Result, $Index) ) { $row = mysql_fetch_row($Result); echo $row[0]; } else { echo ' '; } } echo " </tr>\n"; } echo "</table>\n\n";
This stuff is untested on MySQL, but I tested it with a sample array and it works.
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
attached mail follows:
On Thu, Jul 11, 2002 at 11:14:51AM -0400, Analysis & Solutions wrote: > echo ' <td>'; > if ( mysql_fetch_seek($Result, $Index) ) { > $row = mysql_fetch_row($Result); > echo $row[0]; > } else { > echo ' '; > }
OOPS! I forgot to close the table cell. Add this...
echo " </td>\n";
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
attached mail follows:
Just an idea I came up with after turning off my computer last night (don't ya hate that!) - I don't know how 'dirty' or 'crude' this would be, but in my head it seems like it would work. Basically, what if the while() printed multiple tables? In each table it made 5 rows, each row with one cell in it, so it would then be vertical. I'm just not sure how to incorporate into the loop (maybe a for() loop is better for this?) incremental queries, so that the first loop pulls rows 1-5, the next query 6-10, etc. until there are no more rows. Think this might work?
I will still try the array method suggested by a couple of people, but... I haven't really ever worked with arrays.
<Pseudo code> Do my first query: $i=0; //define variable $sql = mysql_query("SELECT grad_year FROM alumni LIMIT $i, 5 GROUP BY grad_year");
$grad_year=""; //define variable - avoid errors
while ($row = mysql_fetch_array($sql)) { extract($row);
if($i=="1") { print "<center><table width=\"10%\" border=\"0 \">\n"; //start table } printf("<tr><td align=\"center\"><a href=\"year.asp?year=%s\">% s</a><br></td></tr>\n", $grad_year, $grad_year); //print links, one per row
if ($i=="5") { print "</table>\n"; //end table on $i = 5 }
$i+5;
$grad_year=""; //clear $grad_year } if ($i<5) print "</table>\n"; //end any rows with less than 5 columns
Jason Soza
----- Original Message -----
From: Justin French <justin
indent.com.au>
Date: Thursday, July 11, 2002 3:48 am
Subject: Re: [PHP] Table Making
> I hate to think what sort of a burden this would place on ther server, > but... > > You could always find out how many rows there are, then run individual > queries for each cell of the table. In other words, to achieve > this layout: > > 1 4 7 > 2 5 8 > 3 6 9 > > You would do queries in this order: > > 1 > 4 > 7 > 2 > 5 > 8 > 3 > 6 > 9 > > Like I said, I shudder at the thought of how much this would load > the server > (especially on large rows (lots of fields) or large tables (lots > of rows = > lots of queries)), but if the layout is imperative, then maybe > this is an > option... > > I can't see why you can't run it as > > 1 2 3 > 4 5 6 > 7 8 9 > > > Cheers, > > Justin
attached mail follows:
> Like I said, I shudder at the thought of how much this would load the server > (especially on large rows (lots of fields) or large tables (lots of rows = > lots of queries)), but if the layout is imperative, then maybe this is an > option...
No load whatsoever. You just need to think about how you are going to display it, not how you are going to retrieve it. For a 3x3, instead of:
<table> <tr><td></td><td></td><td></td></tr> <tr><td></td><td></td><td></td></tr> <tr><td></td><td></td><td></td></tr> </table>
you just do it this way:
<table> <tr> <td> <table> <tr><td></td></tr> <tr><td></td></tr> <tr><td></td></tr> </table> </td> <td> <table> <tr><td></td></tr> <tr><td></td></tr> <tr><td></td></tr> </table> </td> <td> <table> <tr><td></td></tr> <tr><td></td></tr> <tr><td></td></tr> </table> </td> </tr> </table>
And just use some height and width attributes to ensure that the rows and cells line up reasonably well.
Setting up code to output it that way is relatively simple. Just a twist on how you would output it otherwise.
Chris
attached mail follows:
> be, but in my head it seems like it would work. Basically, what if the > while() printed multiple tables? In each table it made 5 rows, each row > with one cell in it, so it would then be vertical. I'm just not sure > how to incorporate into the loop (maybe a for() loop is better for > this?) incremental queries, so that the first loop pulls rows 1-5, the
Basically, you'd need an inner and outer loop. Something like this should work (untested):
$result = mysql( $dbname, $query );
$numRows = mysql_num_rows( $result );
echo "<table>\n"; for( $i = 0; $i < $numRows; $i++ ) { echo "<tr><td>\n"; echo "<table>\n";
while( $dataArray = mysql_fetch_assoc( $result )) { echo "<td>" . implode( "</td></tr><tr><td>", $dataArray ) . "</td></tr>
}
echo "</table>\n"; echo "</td></tr>\n";
} echo "</table>\n";
You may need to fool around with it abit, but that should work...
Chris
attached mail follows:
This is exactly what I was looking for. Now I wish I could just leave work now to test it out!
Thanks everyone for your help on this, very appreciated!
Jason Soza
----- Original Message -----
From: "Chris Boget" <chris
wild.net>
Date: Thursday, July 11, 2002 9:05 am
Subject: Re: [PHP] Table Making
> > be, but in my head it seems like it would work. Basically, what > if the > > while() printed multiple tables? In each table it made 5 rows, > each row > > with one cell in it, so it would then be vertical. I'm just not > sure > > how to incorporate into the loop (maybe a for() loop is better > for > > this?) incremental queries, so that the first loop pulls rows 1- > 5, the > > Basically, you'd need an inner and outer loop. Something like > this should work (untested): > > $result = mysql( $dbname, $query ); > > $numRows = mysql_num_rows( $result ); > > echo "<table>\n"; > for( $i = 0; $i < $numRows; $i++ ) { > echo "<tr><td>\n"; > echo "<table>\n"; > > while( $dataArray = mysql_fetch_assoc( $result )) { > echo "<td>" . implode( "</td></tr><tr><td>", $dataArray ) . > "</td></tr> > } > > echo "</table>\n"; > echo "</td></tr>\n"; > > } > echo "</table>\n"; > > You may need to fool around with it abit, but that should work... > > Chris > > >
attached mail follows:
I use PHP sessions for my sites. The session_set_save_handler() is set to "Files". I would like to increase the gc_maxlifetime to get longer sessions. Today my sites generate about 1500-2000 simultaneous sessions. The number of sessions will probably grow if I increase the gc_maxlifetime. My question is: how does increased sessions affect the performance?
Best regards Fredrik Nygren
attached mail follows:
Hello, I'm beginning to use PHP, maybe my question is very simple... Anyway, I want permit users to upload files using a form, and I would show them the upload progress status... I don't know how to extract informations about upload progress status and how to show informations to users. For example I want the users can see 30% of upload completed, or the MByte just uploaded.
I had some difficulties to write to the list, so I send the mail (with some modifies in the address) several times; I apologyze if many mails are sended to the list.
Thanks for help...! S.
In th file "fileupload.php" I call a function named "uploadfile" as shown in the follow code:
uploadfile($g_dir_corrente);
if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) { $nomefile=$HTTP_POST_FILES['userfile']['name'];
if(($nomefile!=".htaccess")&&($nomefile!=".ftpaccess")&&($nomefile!=".quota")) { copy($HTTP_POST_FILES['userfile']['tmp_name'],"$g_dir_corrente/$nomefile"); messaggio(12); // show a message to users echo "<br>"; } else { messaggio(13); // show a message to users } }
**************************************************************
function uploadfile($g_dir_corrente) { $Upload_file=messaggioX(11); // show a message to users echo " <form enctype=\"multipart/form-data\" action=\"fileupload.php\" method=\"post\"> <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"1000000000\"> $Upload_file <input name=\"userfile\" type=\"file\"> <input type=\"submit\" value=\"Upload\"> </form> "; }
attached mail follows:
> I don't know how to extract informations about upload progress status and how > to show informations to users. For example I want the users can see 30% of > upload completed, or the MByte just uploaded.
It's impossible.
PHP script starts when file is 100% uploaded on the server.
-- Sincerely, val petruchek
attached mail follows:
Thanks for informations, I'll try to work on a different approach, maybe analyzing the dimension of the temporary file during upload (if it is possible identify the temporary file and monitoring it with another script). Thanks for your help,
S.
Il 11:55, giovedì 11 luglio 2002, val petruchek ha scritto: > > I don't know how to extract informations about upload progress status and > > how > > > to show informations to users. For example I want the users can see 30% > > of upload completed, or the MByte just uploaded. > > It's impossible. > > PHP script starts when file is 100% uploaded on the server.
attached mail follows:
y m i getting this error???? can ne 1 help me out????
Parse error: parse error, expecting `')'' in /home/test/public_html/mp3/music.php3 on line 10
<? function ConvertBin($Binary) { /* global extract($GLOBALS);*/
//This function converts a binary byte into an ASCII byte. for ($i=1; $i<=strlen($Binary); $i=$i+1) { $strChar=char($AscB[substr($Binary,$i-1,1)]); $function_ret=ConvertBin(.$strChar); } return $function_ret; }
//Specify the folder to iterate through, displaying all the MP3s $folder="/home/test/public_html/mp3/";
//Grab the folder information // $objFSO is of type "Scripting.FileSYstemObject"
$objFolder=readfile($folder);
//Create the Stream object // $objStream is of type "ADODB.Stream"
$objStream.$Type=$adTypeBinary;
//Loop through the files in the folder foreach (; // unknown filesystem method as $objFile) { //Open the stream } $Open; $objStream.$LoadFromFile$objFile.$Path;
//Read the last 128 bytes $objStream.$Position=$objStream.$size-128;
//Read the ID3 v1 tag info $strTag=ConvertBin($objStream.$Read[3]); if (strtoupper($strTag)=="TAG") {
$strSongName=ConvertBin($objStream.$Read[30]); $strArtist=ConvertBin($objStream.$Read[30]); $strAlbum=ConvertBin($objStream.$Read[30]); $strYear=ConvertBin($objStream.$Read[4]); $strComment=ConvertBin($objStream.$Read[30]); }
//Display the results print "<table><tr><td colspan=2><h3>". "ID3 Tag info for:</td></tr><tr>". "<td colspan=2>".$objFile.$Name."</td></tr>"; print "<tr><td><b>Artist: </b></td>". "<td>".$strArtist."</td></tr>"; print "<tr><td><b>Track: </b></td>". "<td>".$strSongName."</td></tr>"; print ;
?>
attached mail follows:
millwOrm
There shouldn't be "." (full stop) before $strChar on line 10:
$function_ret=ConvertBin(.$strChar);
You also have issues on line 30 (the for loop).
Rgds
John
----- Original Message -----
From: "millw0rm" <millw0rm
hotmail.com>
To: <php-general
lists.php.net>
Sent: Thursday, July 11, 2002 8:41 AM
Subject: [PHP] Where is the Error
> y m i getting this error???? can ne 1 help me out???? > > > Parse error: parse error, expecting `')'' in > /home/test/public_html/mp3/music.php3 on line 10 > > > > <? > function ConvertBin($Binary) > { > /* global extract($GLOBALS);*/ > > //This function converts a binary byte into an ASCII byte. > for ($i=1; $i<=strlen($Binary); $i=$i+1) > { > $strChar=char($AscB[substr($Binary,$i-1,1)]); > $function_ret=ConvertBin(.$strChar); > } > return $function_ret; > } > > > //Specify the folder to iterate through, displaying all the MP3s > $folder="/home/test/public_html/mp3/"; > > //Grab the folder information > // $objFSO is of type "Scripting.FileSYstemObject" > > $objFolder=readfile($folder); > > //Create the Stream object > // $objStream is of type "ADODB.Stream" > > $objStream.$Type=$adTypeBinary; > > //Loop through the files in the folder > foreach (; > // unknown filesystem method as $objFile) > { > //Open the stream > } $Open; > $objStream.$LoadFromFile$objFile.$Path; > > //Read the last 128 bytes > $objStream.$Position=$objStream.$size-128; > > //Read the ID3 v1 tag info > $strTag=ConvertBin($objStream.$Read[3]); > if (strtoupper($strTag)=="TAG") > { > > $strSongName=ConvertBin($objStream.$Read[30]); > $strArtist=ConvertBin($objStream.$Read[30]); > $strAlbum=ConvertBin($objStream.$Read[30]); > $strYear=ConvertBin($objStream.$Read[4]); > $strComment=ConvertBin($objStream.$Read[30]); > } > > > //Display the results > print "<table><tr><td colspan=2><h3>". > "ID3 Tag info for:</td></tr><tr>". > "<td colspan=2>".$objFile.$Name."</td></tr>"; > print "<tr><td><b>Artist: </b></td>". > "<td>".$strArtist."</td></tr>"; > print "<tr><td><b>Track: </b></td>". > "<td>".$strSongName."</td></tr>"; > print ; > > ?> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
> >Richard, > >I just tried performing a search on http://chatmusic.com/venues.htm ><http://chatmusic.com/venues.htm> . >All I did was supply my zipcode. I didn't change/supply any other information.
My trial just took 15 seconds, and that's pretty damn slow...
I don't recall it being that slow though.
And the original page took far too long to come up as well, so I suspect there's something wrong somewhere...
The load is around 1.25 which is not so hot...
>The search was really slow. I wanted to ask you what you would attribute >the slowness to. >What is your architecture?
I'm on a shared $20/month server...
uname -a gives me:
OpenBSD o2 2.9 conf#0 i386
But I don't even know how to get the /proc/sysinfo or whatever it is under this OS...
If you know how to get more info out of this box, I'll give it a shot, though.
I sure wouldn't base any kind of performance data on the output from that site though -- It's hardly a dedicated server or anything like that.
And I suspect the server is under abnormally high load or something, cuz it's not usually *that* slow...
I've never even really tried hard to optimize this thing, once I got it to work.
There aren't that many users hitting the page that often...
-- Like Music? http://l-i-e.com/artists.htm Off-Topic: What is the moral equivalent of 'cat' in Windows?
attached mail follows:
On Thu, Jul 11, 2002 at 03:11:08AM -0500, Richard Lynch wrote: > uname -a gives me: > OpenBSD o2 2.9 conf#0 i386 > But I don't even know how to get the /proc/sysinfo or whatever it is under > this OS...
"less /var/run/dmesg.boot" works on my ISP's NetBSD system.
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
attached mail follows:
ok here we go:
Table 1 user_table id points
Table 2 reports report_id user_id rating
The goal is to associate every user extra 50 points if he has a top 10 report. Top 10 report means the 10 reports with the highest ranking. This value is always changing, thats why I did not include it to the other points. Now that we have the users with the additional points we could add them to the total points of the user and then find out the 5 users with the highest total points.
Thats the theory, but how to achieve this in real live??
Thanx for any idas,
Andy
"Analysis & Solutions" <danielc
analysisandsolutions.com> schrieb im
Newsbeitrag news:20020711043907.GA21354
panix.com...
> Please post the relevant table and field names.
>
> --Dan
>
> --
> PHP classes that make web design easier
> SQL Solution | Layout Solution | Form Solution
> sqlsolution.info | layoutsolution.info | formsolution.info
> T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
> 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
attached mail follows:
"If he has a top-ten report"... is that a one-off thing? Or is it a weekly thing? Or is that every time his report get's into the top ten (in which case hovering around 10-11 would be the best bet!!)??
You need to decide WHEN the user is awarded the 50 points for being in the top ten.
For example, if this was judged weekly, then you could write a small script which is run weekly, awarding 50 points to the user_id's in the top 10 ratings... easy, but what happens to the guy who had something in there for Sun-Thur, and you run the job on Friday? Not good.
Or perhaps the points are awarded each time the top 10 changes... can't imagine why!! Yuk!
Or maybe you can only be awarded the 50 points ONCE, the FIRST time you're in the top ten, in which case, I'd add a 4th field to Table "reports", flagging it as "once a top ten", and apply the 50 points at that point.
Like I said, you need to define when this happens, so that we can figure out the best way... or perhaps you'll figure it out for yourself after you have a think about WHEN the 50 points are applied.
Justin French
on 11/07/02 7:30 PM, andy (news.letters
gmx.de) wrote:
> ok here we go: > > Table 1 user_table > id > points > > Table 2 reports > report_id > user_id > rating > > The goal is to associate every user extra 50 points if he has a top 10 > report. > Top 10 report means the 10 reports with the highest ranking. This value is > always changing, thats why I did not include it to the other points. > Now that we have the users with the additional points we could add them to > the total points of the user and then find out the 5 users with the highest > total points. > > Thats the theory, but how to achieve this in real live?? > > Thanx for any idas, > > Andy
attached mail follows:
On Thu, Jul 11, 2002 at 11:30:16AM +0200, andy wrote: > > Table 1 user_table > id > points > > Table 2 reports > report_id > user_id > rating > > The goal is to associate every user extra 50 points if he has a top 10 > report. > Top 10 report means the 10 reports with the highest ranking. This value is > always changing, thats why I did not include it to the other points. > Now that we have the users with the additional points we could add them to > the total points of the user and then find out the 5 users with the highest > total points.
There are probably a couple ways to do this. This is the one that hits me off the top of my head, assuming you're using a version of MySQL which can't do subqueries.
Now, all of this is untested, so my query syntax may be off a tad, but it'll give you the idea of where to go...
Do the following intermittently on a scheduled basis:
1) Make a third table. It'll hold temporary data. user_id totalscore 2) LOCK TABLES Table3 READ 3) DELETE FROM Table3 WHERE 1=1 4) INSERT INTO Table3 (user_id, totalscore) SELECT user_id, 20 AS sc FROM Table2 ORDER BY rating LIMIT 10 5) INSERT INTO Table3 (user_id, totalscore) SELECT id, points FROM Table1 6) UNLOCK TABLES
Now, whenever you want to generate the top 5 list use the following query SELECT user_id, SUM(totalscore) AS thescore FROM Table3 GROUP BY user_id ORDER BY SUM(totalscore) LIMIT 5
If you can create subqueries, then you don't need the third table and can write one nice query, something like this...
SELECT id, sc+points AS totalscore FROM Table1 LEFT JOIN (SELECT user_id, 20 AS sc FROM Table2 ORDER BY rating LIMIT 10) ON (Table1.id = Table2.user_id) ORDER BY sc+points LIMIT 5
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
attached mail follows:
Hi,
I try to refer to the '<' character in a regex using preg_replace function:
preg_replace("/(http:\/\/.\S+(?<![\<\>]))/", "<a href=\"$1\"
target='ext'>$1</a>", "http://test Ref to '>' with '\>' seems to work but not '<' with '\<'...
Any idea???
Thanks!
attached mail follows:
Hi,
I have a problem with php.notes
when I post to php.notes I get nothing...I have no error or no
persmission ...nothing at all
Regards
attached mail follows:
>We have some cases where we run PHP as a standalone executable for scripting
>certain processes that can be called from CRON, and we also have PHP for
>Apache. Does the php.ini affect both? Specifically script times?
Only if you compiled it with the exact same settings for that one --xxx-dir
I can't think of right now...
Just use <?php phpinfo();?> for both and search (grep) for php.ini in the
output.
You'll find out what you need to know.
attached mail follows:
>I am new to PHP and need some help.
>I was wondering if there is a way to get hold of the IP address of a site
>visitor with PHP. I'm trying to develop an interaction where the server
>would recognise a new visitor from a returning visitor via the IP address.
IP address is useless for identification.
Dial up users change IP faster than their underwear, and corporate users
behind a firewall will share an IP.
Use http://php.net/sesssion_start
attached mail follows:
>>All ya gotta do is have three invisible GIFs on all three sites that come
>>from the *other* sites and the GIF does the set_cookie() of whatever their
>>user ID is.
>
>I'm not sure where you got this idea, but you should investigate
>further. A banner ad is usually nothing more than an image, and your
>browser will make a complete separate HTTP GET request for that image.
I'm not sure how you interpreted the above paragraph, but it clearly is not
what I intended.
If you control all three domains, or have some access to put code on them,
you can use the images to send the right Cookies from all three domains to
'synchronize' them by embedding the current site's session_id() in the
request from the 'other' sites, and have the 'other' sites send the Cookies
required with the image.
Each site has three IMG SRC=xxx that are requesting GIFs from the other
sites.
The request for the GIF has, in the GET data, the Cookie value you want to
use.
The servers simply spew out the same Cookie value as the "original" server,
and now they all refer to the same user in a shared database.
>When that is the case, there is no way the remote site can read or write
>cookies outside of its own domain. They can set cookies from their own
>domain, and you might see the cookies warnings on the same "page" or
>whatever, but the domains will definitely be different.
Okay, let me spell it out, since at least some readers are obviously not
"getting" it.
Assumption #1.
You have access to *some* code on all three servers, and want to maintain
the Session ID "the same" across all three.
I believe that was the original poster's thesis -- They simply didn't want
to rip apart all the rest of the HTML on all three sites, but could
painlessly insert a few lines of code at the top of all three site's pages.
If, on all three sites, you can auto_prepend (or include) the following
code:
<?php
session_start();
$session_id = session_id();
echo "<IMG SRC=server1.com/session.jpg?session_id=$session_id>\n";
echo "<IMG SRC=server2.com/session.jpg?session_id=$session_id>\n";
echo "<IMG SRC=server3.com/session.jpg?session_id=$session_id>\n";
?>
Then, on all three servers, have the file session.jpg.
<?php
setCookie('PHPSESSIONID', $session_id);
header("Content-type: image/jpg");
readfile('images/invisible.jpg');
?>
You can effectively get the 'same' Cookie sent from all three sites.
NOTES:
I probably do not have the name of the Cookie variable, PHPSESSIONDID,
correct.
You may want to write cleaner code with more error-checking. :-) And add
the Content-length.
You'll also need to ForceType session.jpg to be PHP, not JPEG, or rename it
session_jpg.php or something to make the code get executed.
If a user is browsing with no Images, or uses Lynx, it ain't gonna work,
because they'll never request the Image that transfers the Cookie values
from site-to-site.
Obviously, the Session Cookie can now be hijacked more easily, since you are
accepting the value from the Internet. You will want to consider this very
carefully, and insert cross-checks that somebody doesn't 'create' an account
simply by presenting a request to all three servers with their own
home-brewed session ID. It might be best to only GET the GIFs from the
'other' two servers on each server, and cross-check with the original
server's data somehow that the account is valid. If you even care. If
Cookies are simply used to identify the user as the same user, and there's
no particularly "private" content nor user-customization happening, there's
not much point. Only you and your application can determine this. Think
the security implications through fully. If you're not 100% sure you'll
never ever use the Cookie ID for anything more than "convenience" as they
travel site-to-site, then you'd better be sure it's not a forgery.
If a user's ID/Session Cookie every changes, you *MUST* re-issue the same
Cookie on all three servers, or you'll get hopelessly out-of-sync. You may
want to use the customized session storage handlers just to be sure you
track this correctly. Search the PHP manual for something not unlike
session_set_handler and you'll find the function I'm talking about.
attached mail follows:
>I'm running windows 2000 and the latest releases of PHP and MySQL. All
>database connections are made with mysql_pconnect(). Connections build
>up, however. The only person connecting to this webserver at the moment
>is myself. It seems that it opens connections and keeps them open, but
>doesn't always reuse them, thus causing it to open new ones. Is this a
>bug in mysql_pconnect()? Should I just use mysql_connect()? Any and all
>help is appreciated.
Some of this answer uses Un*x-specific terminology. MS, of course, would
never use an industry-standard term, so you may need to translate. And,
there actually is a big difference between "process" on Un*x and "thread"
under Windows. However, for the purposes of this discussion, the difference
is *MOOT* so I'm going to pretend they are the same, even when they aren't.
Here's the deal:
When you do mysql_pconnect(), PHP tells MySQL to *KEEP* the connection open.
MySQL keeps the connection open, and, for performance+security reasons,
knows which process opened the connect, and which username/password combo
was used. You see, if MySQL has to change all the stuff related to
username/password, then a lot of the benefit of keeping the old connection
around would be lost. Much of the benefit of the connection is the
construction of some particularly complicated gnarly pieces of data that tie
the connection to a particular username/password.*
* These last two sentences are possibly wildly inaccurate. Maybe even call
them lies. They are particularly useful, though, in that the average user
of PHP/MySQL can believe them and understand them, and cope with the fact
that _pconnect is tied to the username/password, which is just how it is. I
never let facts get in the way of education. YMMV.
When the *SAME* process ('thread' under Win 2K, alright?) with the same
username/password asks the (obviously same) MySQL server to mysql_pconnect()
again, MySQL goes:
"Oh, look, here I already *have* the connection open and ready. I don't
need to make another one."
The reason you see multiple connections "open" is that you have multiple
processes (threads in Win2K), each one holding on to their connection for
their username/password. Actually, MySQL holds on to them *for* the
process, but they are tagged "for that process/username/password only". But
some folks find it easier to think of them as being "held onto" by the HTTP
process. [shrug]
You see, when you asked for your first page, it was "HTTP Process # 1"s turn
to answer.
Then, on the second page, it was "HTTP Process # 2"s turn.
Third, maybe it was #3's turn. Or #4's. Who knows?
Maybe you didn't even do mysql_pconnect on your 4th request.
Maybe by the time you asked for the fifth page, #1 was ready again.
Time went by, and different processes answered different HTTP requests.
*EACH* Process, as it does a _pconnect() gets its own "persistent"
connection left open for it. Indeed, two processes *might* be running
"concurrently" and *need* two connections open, since you don't want one
connection's data getting mixed up with the other's data. They are both
running at the same "time". **
** Purists will point out that the CPU can only do one thing at a time...
Yes, but the *context* for what it is doing, the script that is running, the
data structures/streams required, are all "alive" in some sense
concurrently, even though the actual CPU is only dealing with one at a time.
The Apache/PHP/MySQL/OS software needs to keep all this crap organized and
different processes separated from each other, and it's easiest to think of
them as running "concurrently" even when technically they are all taking
turns with the CPU in time "slices". Unless, of course, you have multiple
CPUs, in which case this paragraph (and entire post) would get hopelessly
complexified to no real benefit for the average reader.
In time *every* process will have its own persistent connection.
If you are running Apache, you can configure the number of "Child" processes
and thus control the maximum number of open connections to MySQL. (One per
process/username/password).
If you are running IIS, you are on your own. :-) While I assume there is
some kind of way to configure IIS wrt number of threads/children, I have no
idea, and don't even want to know, how to do it.
Meanwhile, it is abso[bleep]ing critical that your MySQL settings be such
that *IT* does not have fewer connections limited than the number of
"persistent" connections that your web-server is going to use. In fact, you
want a few extra, so that you can *ALWAYS* use the monitor from the shell to
take down a thrashing, dying, over-loaded MySQL. If you're maxed-out, you
can't even get to MySQL from the shell, and you're in trouble.
Example:
Suppose httpd.conf has a "cap" of 30 HTTPD child processes.
Then my.conf should have, oh, 35 as a limit on the number of open
connections.
Eventually, each HTTP process will have one (1) connection of its own, and
you'll have a few spares for shell access.
*IF* you have multiple username/password combinations, such as on a shared
ISP, and you are using _pconnect, then you need to take this into careful
consideration: *EACH* username/password tied to *EACH* HTTPD using a
_pconnect will "use up" one of your MySQL connections.
While low-traffic virtual sites may not ever even approach the limit, you'd
want every high-traffic virtual site to have a full complement (number of
HTTPD children) of MySQL connections, plus a few spare. You *NEVER* want to
have those high-traffic site "use up" all the connections.
IE, if there are 7 high-traffic sites, and 200 HTTPD children, you'd want at
*least*:
7 * 200 == 1400 MySQL connections as your limit, plus, a few spare... At
least, in theory.
You'd then need to factor in "moderate" traffic sites, and bump this even
higher.
Each persistent connection chews up RAM, though, and while RAM is cheap,
it's not an unlimited resource.
attached mail follows:
>I just moved an application from one Linux server running Apache to another
>running Apache. The version of Apache on both is 1.3.12. The version of PHP on
>one is 4.0.3pl1 and on the other it is 4.0.1pl2.
>
>Here is what is baffling for me: one the second server the $HTTP_ENV_VARS array
>is empty. I have to get my information by calling what would ususally be the
>indexes e.g. $HTTP_SCRIPTNAME.
>
>Is there a switch I did not set?
php.ini
track_vars
Compare <?php phpinfo();?> on both machines any time they are not behaving
the same. Your answer will almost always be in there.
attached mail follows:
Note that this only hides them from "dumber", not "dumb" :-)
Your POST variables and such-like are all visible when doing "View Source",
which is not particularly tricky, even for the average bear.
The better way would be to use HTTP Authentication (search php.net for it).
While this could still be "sniffed", and I'm sure some real geeks can manage
to snag their own username/password out of the browser's RAM, it's much less
visible to the average user.
If you also do that over HTTPS, you can guarantee that they will not be
"sniffed" in transit from browser to server.
>Use the POST method instead of GET for submitting forms.
>
>Bogdan
>
>- wrote:
>
>>Hi everyone,
>>
>>Is there any way to hide my form submitted variables (like
>>passwords etc)
>>in the location
>>bar "http://somedomain.org/checkpassword.php?
>>password=mypassword"
>>or atleast show in an encypted form n the location bar.
attached mail follows:
It might be easiest to have:
----------- default.asp ----------------
<%
' Some ASP I've forgotten that redirects to
http://example.com:8080/index.htm
%>
And your real site, on port 8080, served up by Apache, will be fine, so long
as the links are absolute, and httpd.conf is configured correctly. All the
links/IMG/etc will "stay" on 8080 unless you have an absolute URL in there.
>I will probably do this the other way round as we have a few sites...
>
>so if i have a single file with a frame and point contents of frame to
>apache this should work?
>
>> I have Apache and IIS coexisting on my intranet server and
>> the way I set
>> them up was to put each on a different port. (Apache serves
>> http://intranet
>> and IIS serves http://intranet:8080) this appears to work
>> fine. Hope this
>> helps
>>
>> OK following from my thread 'Browser Issues' I have found
>> that when serving
>> the site from apache, that the aforementioned errors go
>> away... mostly...
>>
>> OK so... What is the best way to setup so that IIS/Apache co-exist...
>>
>> I'd like to keep the 'entry' to the site on IIS as we have other sites
>> too... and use apache to serve the content of it.
>>
>> Any help mucho appreciated... also working to a deadline!
attached mail follows:
>You know really anoying mailing lists that send you e-mail you don't want
>Wait... thats called spam... well...
>to unsubscribe all you have to do is send an email back
>remove Perhaps...
You'll might want to tie into Qmail in the, errrr, Qmail-equivalent of
sendmail.conf and add in your "unsubscribe.php" script as the "EXEC" (is
that what it's called?) for some kind of regex in your spam identifier. I
only did something like this once, so have forgotten the details. There are
a zillion examples with Perl, though, and there's no real difference from
that to doing it with PHP, except the filename ends in .php, not .pl, and
then the file itself is PHP and uses the PHP parser instead of Perl.
You'll need to put "unsubscribe.php" in the smrsh directory, and make it
executable with #!/path/to/php, the CGI (or CLI now) PHP version you
compiled the same way you compiled the Module, only without the --with-apxs
Or, perhaps, you'll want to re-direct *ALL* your email to PHP, and write
your own spam detector in PHP.
Or, perhaps, you don't have access to Qmail at all, and you could build
yourself a web-page where you paste in the offending email, with headers,
and then PHP does something.
I doubt the latter, but it's hard to tell from your question...
attached mail follows:
>I'm using a Zebra label printer in an application I have and in order to
>display an image on the label, according to the ZPL II printer language,
>any image must be converted to HEX code. Does anyone hvae a code snippet or
>know of a free utility that will take a graphic image (BMP, GIF, JPG,
>etc...) and convert it to HEX values?
Something not unlike this may work...
<?php
$image = 'sample.bmp';
$file = fopen($image, 'r') or die("Could not open $image");
while ($file && !feof($file)){
$chunk = fread($file, 1000000); # You can affect performance altering
this number. YMMV.
# This loop will be dog-slow, almost for sure...
# You could snag two or three bytes and shift/add them,
# but at 4 bytes, you violate the 7fffffff limit of dechex...
# You could maybe write a better dechex that would accept multiple bytes
# and use substr... Maybe.
for ($byte = 0; $byte < strlen($chunk); $byte++)){
echo dechex(ord($chunk[$byte]));
}
}
?>
attached mail follows:
>I'm trying to change some information in the header...lets say that User
>Agent for example...but it just wont change.
>
>putenv() will change the User Agent..but nothing else will
>
><?
>$ua = "Mozilla/4.0 (compatible;)";
>
>header("User-Agent: $ua\n", TRUE);
>header("Accept: */*", TRUE);
>
>//putenv("HTTP_USER_AGENT=$ua");
>
>echo "\n<br>user agent: ";
>echo getenv("HTTP_USER_AGENT");
>?>
You are confusing the headers that your web-server sends *TO* the client,
with the headers the server gets *FROM* the user's Browser.
You can't upgrade somebody's stupid IE browser to Mozilla just by sending
them a new User-Agent header, no matter how attractive a solution it might
seem :-)
On each HTTP request, their browser composes a User-Agent setting to tell
you what Browser they are, and you while you can change the value of the
Environment variable that ends up in, it won't change the reality of which
broken browser they are using.
Exactly why did you think you wanted to do this? Because whatever it is
you're trying to do, this for sure is nowhere near the right way to do it.
:-)
Short description:
Each HTTP request and response consists of *TWO* sets of headers -- The
browser *SENDS* some headers to the server, and the server sends back some
headers and (usually) some content.
You can't alter the headers being sent by the browser, though.
Well, okay, you can send Cookies, and they'll come back as headers, and you
can use HTTP Authentication, and on their second page, the browser uses
headers to send back the same username/password they already typed in. But
the actual User-Agent and other stuff the browsers tell you, they make up
all on their own and send in as headers.
Note that geeky users can send any User-Agent they desire...
attached mail follows:
Richard Lynch wrote:
>
>You can't upgrade somebody's stupid IE browser to Mozilla just by sending
>them a new User-Agent header, no matter how attractive a solution it might
>seem :-)
>
Now this is a Really Great Idea. Upgrade everyones' browser on the fly
by code. We would only then have to decide on "which" browser...
:-)
Chris
attached mail follows:
>Hi!
>
>I've been using PHP to write shell scripts and was wondering how to
>implement the following:
>
> - I have a menuing system
> - If a user does not give an input within a certain amount of time, I want
>it to go to a default value
>
>I checked the PHP functions page and the closest thing I found was "sleep"
>which isn't quite right. I'm sure this is a common thing, so does anyone
>have any suggestions? Again, this is a terminal program and not a web CGI.
*MAYBE*, I say just *MAYBE* http://php.net/fgetc will time out and return
false if nothing is typed for "long enough"... But that's probably "too
long" for what you need, and you have no control over it.
If you can somehow use fsockopen instead of a fopen, and "fool" that socket
into being a file using named pipes and redirect, you could *probably* do
much better by then setting the time-out on the socket...
>While I have your attention, I also wanted to create one of those "spinners"
>while users wait for longer tasks to complete. I tried using the ncurses
>stuff to print and erase characters, but it didn't seem to work. What is a
>good way to create a "spinner" so that users know that the program is
>working.
>
>For those who don't know what I mean, I'm thinking of something like...
>
>- (backspace) \ (backspace) | (backspace) / (backspace) etc. etc.
Wild Guess:
<?php
$beach_ball = array('-', '\', '|', '/');
$file = fopen('php://stdout', 'w') or die("Could not open stdout");
for ($i = 0; $i < 80; $i++){
echo $i, chr(8); # 8 is ^H, right?
}
?>
attached mail follows:
>I've been trying and trying to get my site to work lately and all but one
>part does. Of course that one part is the most important part (it always
>is).
>
>My problem is probably rather simple to most of you, but I don't know how to
>get around it: My script does not have permissions to write/append files or
>just flat out create the files; it can read any files (accessed
>"files//nameoffile.xml"). Originally I was working with text files, but
>that didn't work either (and had the exact same problems).
>
>So my question is this: how do I get my script to have permissions to write
>or append to any file?
Your question should be more like:
How do I get specific files to be readable/writeable by PHP?
The only way to get any arbitrary file readable/writeable by PHP is to run
PHP (ie, Apache) as 'root' and that's just plain stupid.
Under Un*x, you can do:
chmod 766 filename
and then PHP will be able to read/write it.
NOTE: So will *ANY* other user on the same system using
PHP/Perl/whatever!!!
You do *NOT* *NOT* *NOT* *NOT* want world-write-able files in your web-tree.
Put them in your home directory, *NEXT* to 'htdocs' or 'www' or 'web' or
whatever they called the directory where you stick your HTML files.
Use a full pathname to access the file.
If you don't know the pathname, you can do:
pwd
to figure it out.
If you can't SSH (or telnet) [is any ISP dumb enough to still allow telnet?]
in to your server, then you *might* be able to use your FTP client to alter
a file's permissions.
If you are on Windows, the same principles apply, but the permissions system
changed from version to version, and in some cases, you're just screwed
because there are no sensible alternatives to set the permissions of a file.
attached mail follows:
>I hope that I can get permissions, but I bet you're right. Probably just
>have to create a database, which I planned on doing (and know how to). I
>really did want to use XML though, oh well.
Using a database does not in any way, shape, or form preclude you from using
XML.
XML is just text.
Databases store text very nicely.
Some databases even claim to understand XML internally. I have no direct
knowledge of the validity of such claims.
If you think it would be better in a database, you are probably correct, and
you probably should stop using files immediately.
Otherwise, you will almost for sure find yourself dealing with race
conditions and other gnarly stuff that is taken care of in the database. In
short, you'll find yourself basically re-writing a goodly chunk of very
tricky code that somebody already wrote for you, for free.
attached mail follows:
>Hi,
>
>I am making a script to generate counter image on the fly for the office
>
>web site, and i have noticed that my dynamically generated jpeg images
>bears following comment: "CREATOR: gd-jpeg v2.0 (using IJG JPEG v62),
>quality = 100"
>
>Does anyone know how to insert user defined comments into generated
>images?
>
>I looked around the net, and php API list, and found that i can only
>read the JPEG header markers with exif_read_data. Is there a
>exif_write_data function?
>
>Thank you,
>Alex
>
If there is no gd_set_comment function in http://php.net/gd
then you are probably reduced to using exec() for some external program to
add comments to the file, or to figuring out how to shove them into the file
"by hand" yourself, by digging apart the JPEG specs...
attached mail follows:
>Speaking of forms, and I'm sure lots have asked this before me, but anyone
>know anywhere I can go to see some examples or existing code for
>automatically generating and and validating dynamic forms?
>
>Wait though, I'm already doing this myself. To explain further, what I
>really want is an abstract set of php functions to say, ok, I want another
>form with say 10 questions, and I want to define each question and set of
>possible answers (input types and ranges) manually, and have the action
>script automatically check that the input types and ranges for each question
>are valid.
oooohforms (not that many 'o's but more than one) inside of PHPLib does
this, I think...
Or are PHPLib and oooooforms competitors?
Whatever.
attached mail follows:
>Question on optimizing code for quicker runtimes.
>Which is quicker (this is on a webpage also..NOT
>commandline)?
>
><?php if ($a){ echo 'abc'; } ?>
>
>OR
>
><?php if ($a) { ?> abc <?php } ?>
You will not be able to measure the difference until you have a zillion of
them...
>Both do the same thing and are legit but wondering
>which is better from an optimization standpoint (NOT
>interested in readability or *proper* code here)
Why not?!
It's *FAR* more important than raw performance 90% of the time!
Optimize the code that's slow, don't try to write all code at maximum
performance.
If we really needed all code at maximum performance, we'd all still be
coding in binary.
attached mail follows:
>Hello, I am wondering if you could help me... I can't seem to figure out
>how to get sessions working.
>Thank You,
>Mike
>
We'll need a lot more info than this...
What part is not working?
Set your browser Cookie settings to "Ask every time" for starters. Are you
getting the cookies from:
<?php
session_start();
Then, are you remembering to:
session_register('counter');
and what do you see when you have:
echo "You have been here ", $counter++. " times.";
?>
attached mail follows:
>it starts here ...
>http://counter.funyon.com/autocounter/signup/signup.phps
<?
ob_start();
session_start();
# My gut tells me this is wrong...
$username = $usersname;
if(is_null($signuppage)){
include("Signup1.php");
}elseif($signuppage = "Signup1"){
if($Account == "True"){
# Just put this right after session_start()
# Then you can just use if (isset($username)) to tell if they've
# provided some kind of username or not.
session_register("username");
include("admin.php");
}else{
include("Signup2.php");
}
}
?>
> then goes to here ...
> http://counter.funyon.com/autocounter/signup/Signup1.phps
<?
print "<input type=\"hidden\" name=\"PHP_SESID\" value=\"$PHP_SESSION_ID\">"
;
?>
You shouldn't need to send their session ID if Cookies are turned on, but if
you want to send it, you'll have to spell PHP_SESSID correctly... :-)
After that, I can't read Signup2.phps, so I can't really tell for sure
what's happening...
At a guess, though, you'll need a TYPE=HIDDEN NAME=Account VALUE="True" in
there, and it's probably missing... Or you could
session_register('Account') right after session_start() so that it will just
be there...
> or here... both included from the signup page
> http://counter.funyon.com/autocounter/signup/admin.phps
> included in admin is:
> http://counter.funyon.com/autocounter/include/getcounters.phps
> which makes links to:
>http://counter.funyon.com/autocounter/signup/editcounter.phps
>
>There you go, I hope that I can get some insight ;)
>Mike
>
>
>
attached mail follows:
>Ok.. what I have is a database of first names and last names, and some other
>columns that don't matter here.
>
>A form is presented to a user, lets them enter a bunch of names, attributes
>of the person, etc.
>
>After submission, each record is checked against the current database to see
>if the name currently exists, or names similar to it exist.
>
>If so, it gives the option of either:
>
>a) entering the new record
>or
>b) selecting one of the existing records
Okay, here's one thing:
Why make me type all the crap in for somebody who might already be there?
It would be much better human interface to first let me know who's missing
before I go typing in all that stuff for the players already input.
I'm assuming LW and RW are, like, Left Wing and Right Wing in soccer or
hockey or something, right?
A team roster is going to be, what, 30 records at most?
Show me the current list and let me choose whom to edit, and give me a "New
Player" button.
>Example:
>
>Enter your names, positions:
>Joe Schmoe, LW
>Random Guy, RW
>
>(submit button)
>
>After DB check for existing users:
>
>Found:
>
>() Joey Schmoe Click radio button to se this record
>() Create New Record
>
>
>No matches found for Random Guy, must be a new user.
>
>(submit button)
>
>
>My problem is keeping this data consistent form by form, and updating the
>data when an existing record is selected instead of creating a new one (the
>existing data needs to go into another table, so I need to grab the user id
># of the existing record, etc)
>
>Any thoughts on how to approach this? After the first form, should I make a
>multi-dimensional array, and have the second form update/change the elements
>of it? I haven't used any PHP arrays in this yet, just been messing with
>the HTML form array stuff..
>
>Sorry if this is confusing.. if any part needs clarification, please let me
>know.
If there are only a few fields, and not too many rows, one thing I
frequently do is display them with User IDs and then use 'NULL' as the ID
for a New Record, and have code something like this:
<?php
require 'connect.inc'; # This just has one line "$connection =
mysql_connnect('localhost', 'user', 'pass');" in it.
# Handle any FORM input:
if (isset($lastname)){
while (list($id, $ln) = each($lastname)){
$fn = $firstname[$id];
# Other fields the same way $xx = $xxxxxxxx[$id];
if ($id == NULL || $id == 'NULL' && ($fn || $ln)){
# New Player, but only if they've filled in a name:
$query = "insert into players (firstname, $lastname, ...)
values('$fn', '$ln', ...)";
}
else{
$query = "update players set firstname = '$fn', lastname = '$ln',
... where players_id = $id";
}
$update = mysql_query($query, $connection) or
error_log(mysql_error());
}
}
# Display FORM
$query = "select players_id, firstname, lastname from players order by
lastname, firstname";
$players = mysql_query($query, $connection) or error_log(mysql_error());
while (list($id, $fn, $ln) = mysql_fetch_row($players)){
echo " <TR>\n";
echo " <TD><INPUT NAME=lastname[$id] VALUE='", htmlentities($ln),
"'></TD>\n";
echo " <TD><INPUT NAME=firstname[$id] VALUE='", htmlentities($fn),
"'></TD>\n";
# More fields here. They can be Radio buttons or whatever, of course.
echo " </TR>\n";
}
# Output a row for a "New Player":
echo " <TR>\n";
echo " <TD><B>NEW:</B><INPUT NAME=lastname[NULL]></TD>\n";
echo " <TD><INPUT NAME=firstname[NULL]></TD>\n";
# More fields here. They can be Radio buttons or whatever, of course.
echo " </TR>\n";
echo "</TABLE></FORM>\n";
?>
Now, this is not going to win any awards for Design or anything, but for a
busy admin to have everything in one place to fill in all the crap and see
all of it is very handy.
It also means that when (not if) they forget to update 'Joe Schmoe', they'll
see his record when they go to add in 'Betsy Buick' -- which means they just
might notice that it's out of date and fix it at the same time.
This simply gets unwieldy, though, if there are a ton of records, or "too
many" fields...
Still, I'm making the wild guess that for a team roster this is going to be
fine...
You can also output 5 or even 10 rows of the "New" row, if they frequently
have to put in a lot of players at once, but then you need to give them
*DIFFERENT* 'key' values inside the [], and change the "if ($id == NULL ||
$id == 'NULL' ...)" part to be more complex:
if (strstr($id, 'NULL') && ($fn[$id] || $ln[$id])){
.
.
.
# Output five rows for a "New Player":
for ($i = 1; $i <= 5; $i++){
echo " <TR>\n";
echo " <TD><B>NEW:</B><INPUT NAME=lastname[NULL$i]></TD>\n";
echo " <TD><INPUT NAME=firstname[NULL$i]></TD>\n";
# More fields here. They can be Radio buttons or whatever, of course.
echo " </TR>\n";
}
attached mail follows:
>I wonder if there’s a way to *HIDE* some parts from the Heading of the
>emails sent with PHP. I’m trying to create an anonymous mail sender but
>in the header of the message appears:
>
>Received: (from httpd You can't do that using PHP's mail function.
That particular header is automatically inserted, I believe, by the software
actually sending the email, IE sendmail or qmail or whatever.
What's more, it's pretty much not kosher to not have that.
This is not to say it's impossible to forge such things, and insert email
via an open relay into the mail stream/system somewhere.
Just that it's not something that should be a built-in function to PHP, or
*ANY* legitimate mass-use software for that matter.
I mean, that would be like inviting *EVERYBODY* to spam, uncontrollably, and
would just be stupid.
I honestly have no idea how to forge an email routing path, just know it can
be done, and is not rocket-science. But you're going to have to dig into
the guts of sendmail or equivalent at a minimum, or search out "send spam to
1,000,000 people!!!" software to do it...
I don't *think* you can even do it with just PHP's fsockopen to the
much-hated Open Relays of the world... Or, at least, they'd be tracked back
to that Open Relay anyway... That might be sufficient for your purposes,
whatever they are. I suggest, however, that you re-examine your purpose,
and decide if it's really worthy of your time and talent.
attached mail follows:
>I just wish RedHat's updater worked as seamlessly as Microsoft's. MUHAHAHA
>;)
I dunno what I screwed up where, but I never have gotten up2date to work :-(
Damn thing takes me to a web-page, I pick what I want, then it takes
forever, then it pukes somehow.
It's been so long since I bothered to try it, I forget the exact error
message.
Sigh.
RedHat 6.2 though...
I've never seen MS auto-updater, and have no intention of seeing it. :-)
attached mail follows:
>Considering all of this... Would it be better simply to turn
>register_globals = On if the vast majority of the stuff you have on your
>site is simple search engine type stuff and/or GET variables?
That's the reason why register_globals was originally ON.
Actually, going way back, I don't think you could even turn it OFF at all...
It's just *SOOOO* convenient.
>Considering the fact that anyone can forge GET, POST, & cookies, is there
>really any purpose in turning register_globals = Off ??
*YES*
Consider the following (stupid but common) code:
<?php
if (valid_user($PHP_AUTH_USER, $PHP_AUTH_PW)){
$valid = 1;
}
.
.
.
if ($valid){
# SECRET stuff here
}
?>
Now, with register globals on, if I visit:
Game Over.
In theory, nobody would ever have a variable they were using that was
uninitialized because they set error_reporting to E_ALL (like they should)
and they completely test every line of code and branch of logic in their
application (like they should)...
Here in the Real World, there are a zillion scripts "out there" by
non-programmers (hey, PHP *is* that easy!) and they have Security Holes like
this in them.
Some of these are (or at least were) in widely-distributed third-party PHP
applications, as I understand it. :-(
Turning register_globals ON will make the above hack to pass in $valid
through GET as a "global" not work. Stops the hack cold, because $valid
isn't allowed to "sneak" in through the URL any more.
You could say "register_globals OFF increases the security of a
badly-written application" :-)
This "register_globals" has *nothing* to do with "global" in functions, just
in case the terminology is making anybody think they're the same thing.
They're not. Not related at all.
If you're an expert programmer and you *NEVER* make the mistake of using an
uninitialized variable, then by all means, turn register_globals on and live
happily ever after writing code without all those pesky $_GET and $_POST, or
$_REQUEST if you want to treat both GET and POST data "the same" for a
particular variable.
If you've ever made a single mistake in your life, leave register_globals
OFF and get used to the new paradigm. :-)
For the record, $_GET and/or globals are *NOT* filtered in any way, shape,
or form by PHP. If they *were* filtered somehow by PHP, there is *NO*
reason that filter could not be applied in either paradigm.
It is entirely UP TO YOU to validate the incoming data as kosher, whatever
kosher means in the context of your application, and at the level of
Security is acceptable risk to your organization, application, boss, and
self-pride.
Alas, PHP really *CANNOT* filter your incoming data, since there's simply no
way for PHP to know what is or isn't kosher. Think about it. Try to write
a generic data-validating system. It gets very messy, very fast, and it
just can't be applied across the board to arbitrary data. You have to know,
at a minimum, some business-logic specific information about the data.
register_globals OFF *ONLY* stops the "hack" of somebody over-riding an
un-initialized variable with whatever value they choose. This is NOWHERE
NEAR sufficient for you to TRUST data coming from the big, bad, Internet.
Disclaimer: I originally argued against register_globals OFF as default,
for various reasons (not least of which is the traffic on this list from
this change), and I still have it ON in many places because I actually *DO*
always initialize variables. It's just an ingrained habit with me, and I
daresay there truly are no uninitialized variables floating around in my
personally-written code. Can't say the same for any third-party code I've
installed (not much) and I *should* migrate to register_globals OFF, but
I've got a *LOT* of code to fix, and there's no maintenance budget for any
of it...
attached mail follows:
>Hi, I am trying to import some tables from a dump file into a MySQL database
>from a php web page. What is the best way to do this without using backticks
>(fpassthru, system, exec or something else) and test for success or failure?
>I tried the following and while it works, my test for success or failure
>always produces a "Success" even when I change something to make it fail. I
>thought system() outputs the last line of the command on success and FALSE
>on failure. Any examples appreciated.
The FALSE on failure is if PHP completely fails to execute the command at
all. This is a rather rare condition.
PHP is quite happy to execute commands that "fail" (whatever that means) and
return the last line of their output which may, or may not, contain an error
message you could detect, though, and as far as PHP is concerned, it did not
fail to execute the command. That your command didn't do what you wanted,
or that the command itself failed, is not a "failure" on the part of PHP, if
you see what I mean.
However, you may want to use exec() and get the full output, as well as the
OS error code, if any, returned by MySQL and then you'd know for sure what
happened.
>
><?php
>
>$status = system("mysql -umyuserid -pmypassword mydbname <
>/path/to/mydumpfile.txt");
>
>if($status == 'FALSE'){
>echo 'Failed';
>} else {
>echo 'Success';
>}
>
>?>
>
>
>
attached mail follows:
>Thanks for pointing out the syntax error. I added the space after the -u but
>it did not make any difference. It still gives the same result, that is
>"Success", when it actually fails. What I am trying to figure out is how I
>can tell if it failed (did not create the tables)? The $status variable does
>not appear to hold the output of the system() function. Anyone know how to
>get the output of system, passthru or exec into the $status variable to
>check for success or failure?
>
>"Analysis & Solutions" <danielc <?php
exec("mysql -u myuserid --password=mypassword myddbname ...", $result,
$errorcode);
echo implode('', $result);
if ($errorcode){
echo "OS Error $errorcode Use 'man errno' to find meaning, but it's
almost always path/permissions";
}
?>
Oh yeah. You'll need the full path to mysql, almost for sure.
attached mail follows:
>But if system() thinks it is a success because the command executed, even
>though MySQL returns an internal error on the command line, why is'nt the
>last line of the MySQL error message stored in the variable as the system()
>manual suggests it should be when system() thinks it is a success?
*MAYBE* system() only "catches" stdout, and not stderr...
Though I doubt it.
Is there a blank line at the end of the MySQL error output when you do it
wrong in the shell?
Use the exec() I just posted and get *ALL* your output, *AND* the actual OS
error (or 0) code returned.
attached mail follows:
>No, they are written in C. And yes, you can of course download the C
>source code from php.net.
If you are interested in a particular PHP function, there's even a really
nice interface at http://cvs.php.net that lets you look at it without
downloading the whole darn thing. VERY nice.
You don't even really really have to know a lot of geeky things to
understand it, so long as you're willing to just ignore the parts you don't
understand, and peck away at what you do understand :-)
attached mail follows:
>I'm working on this site that is all shtml files... in order to add
>some dynamic content, it just includes php scripts in different
>places. However, sessions don't work unless you start it before
>outputting anything to the server and that's what's needed now...
>
>I don't want to change all the links to end in .php and do the
>includes in php just so I can put <? session_start(); ?> at the
>beginning of all the pages.
>
>So I was trying to get the server to treat shtml files as both
>server-parsed and as php scripts. Not working too well. ;)
>
>Anyone have any ideas?
You can't get Apache 1.x to treat the file as both SSI and PHP. Period.
You could just make the first line of each file do whatever magic you do to
include PHP, and then it would be something not unlike:
----------- foo.shtml ----------------------
<!-- #EXEC session.inc --!>
More HTML and SSI here.
--------------------------------------------
I *THINK* if you do this, and have <?php session_start();?> in the
session.inc file, it will work...
I'm assuming there is no output to the browser by the <!-- #EXEC --> bit.
I'm also quite likely not doing SSI right, since I abandoned SSI for PHP
very rapidly.
attached mail follows:
>Can someone tell me what the following error means,
>and how to fix it...please?
>
>Parse error:
>parse error, unexpected T_STRING in
>c:\program files\apache
>group\apache\htdocs\phpbb\language\lang_english\lang_main.php
> on line 629
>
>this is the code on that page:
>
>$lang['Avatar_filesize'] = 'The avatar image file size must be less than %d
>kB'; // The avatar image file size must be less than 6 kB
>
>(than 6 kB < this part of that line is on the next line down)
*REALLY* on the next line down, or just wrapping in your editor?...
What happens if you make the editor window bigger (wider) or even narrower?
That should all be one line.
The error is either because of that, or on the line[s] *before* that line.
attached mail follows:
>I use phpMyAdmin which enables me to take dump of
>mySQL Table Data into Comma Seperated Values file
>(.csv)
>
>Now, i have to create such a program that accomplishes
>this, without using phpMyAdmin. Can someone guide me
>to this procedure..
Since PHP has a fget_csv function (or something like that) odds are pretty
good it can write CSV as well.
If not, and *IF* you can do tab-delimited instead (*MUCH* easier) and just
as easy to suck in on the other end, you can do:
<?php
require 'connect.inc';
$query = "select * from mytable";
$rows = mysql_query($query, $connection) or error_log(mysql_error());
while ($row = msyql_fetch_row($rows)){
$tab_delimited = implode("\t", $row);
echo $tab_delimited, "\n"; // Or you can write to a file, or whatever.
}
?>
If you *MUST* use CSV, not tab-delimited, I *THINK* this will work:
<?php
require 'connect.inc';
$query = 'select * from mytable';
$rows = mysql_query($query, $connection) or error_log(mysql_error());
while ($row = mysql_fetch_row($rows)){
while (list(,$value) = $row){
if (strstr($value, ',') || strstr($value, '"')){
$value = str_replace('"', '""', $value);
$value = str_replace(',', '",', $value);
$value = "\"$value\"";
$output_row[] = $value;
}
echo implode(',', $output_row), "\n";
}
}
?>
attached mail follows:
>I'm trying to do a little trick with my new site. i have one main php
>script, index.php which includes the header and footer scripts and the
>page script between them. the page script is determined by $page, which
>is set to "main" if it doesnt exist already. $page . ".php" is then
>included. I have one other page so far, "datetime.php". I wanted to
>let datatime run itself by including the headers and footers on its own
>if it wasnt included by index.php. so, i add this to the top and
>similar code at the bottom (replaced header with footer):
>
><?
> if (!$page=="datetime") // Not using index.php
> {
> include("header.php");
> }
>?>
The !$page probably happens before the ==, so you are testing !$page (true
or false) being equal to "datetime"...
You may or may not want to use something more like:
<?php
if (!strstr($PHP_SELF, 'datetime')){
include 'header.php';
}
?>
I personally, though, would have *three* files.
One, datetime.inc would do the work.
index.htm would include 'datetime.inc'
datetime.htm would also include 'datetime.inc'
I think this will be less confusing to you a year later when you have to
maintain this code.
attached mail follows:
>I want to add a set of values to the session variable $BOOKS. This is the
>code which I used.
>
> if($BOOKS=="")
> {
> #this seems to be the first book which the user has selected
> $BOOKS = $bookid; #this param comes from the URL
> }
> else
> {
> $BOOKS = $BOOKS+","+$bookid;
> }
>
>Here the 'if..' part gets executed, and because of that I cannot add details
>of another book. I have initialised the session and added the registered the
>value "BOOKS" in the previous page.
Did you call session_start() in this page?
Cuz if not, like, PHP doesn't know you want to use the session variables
from the other page.
Also, it's not + to concatenate strings in PHP. It's .
$BOOKS = $BOOKS . "," . $bookid;
And, what's more, you can shorten $foo = $foo . xxxxxxxxxxxxxxxxxxx to:
$foo .= xxxxxxxxxxxxxxxxxxxxxx
So, in your case, it's:
$BOOKS .= "," . $bookid;
And, since you can "bury" variable in strings and work, even go with:
$BOOKS .= ",$bookid";
You might, however, want to turn $BOOKS into an array anyway:
$BOOKS[] = $bookid;
But you'll need to read up on arrays to use them.
attached mail follows:
>> Do you remember to reload the page after the cookie is sent? (some
>> browser cant see the cookie at the page it sent but first after it
>> have been reloaded!).
>
>Actualy this is not browser issue but PHP issue
No, that's just how cookies work.
PHP can't get a cookie from the browser before you send it.
In slow-motion:
1. Browser asks for URL
2. PHP sends cookie to browser
3. PHP sends HTML page to browser
4. Browser renders page.
5. User clicks to new URL
6. Browser sends cookie with request for new URL
7. PHP gets cookie with request for new URL
PHP *CANNOT* get a cookie the browser never got, and thus never sent back,
until step 7.
Oh yeah:
The stuff about using time/directory is an IE bug.
You can supply *BOTH* time and directory, but not just time.
This is not the way the Cookie spec reads, but Microsoft never reads specs
properly, much less implements them properly, mostly on purpose.
attached mail follows:
>HELLO,
>
>I just installed PHP 4.2.1. I am using a Redhat 7.3, installed as server
>with Apache.
>
>My problem is I can t compile it as a module for Apache :
>
>./configure --with-apache=/usr/include/apache
>
>configure: error: Invalid Apache directory - unable to find httpd.h under
>/usr/include/apache
>
>
>
>But hhtpd.h is really under /usr/inclu/apache
>[root PHP needs to find *both* the include files *AND* the "lib" files (.so) and
you only get to plug in one path to --with-apache (or --with-mysql or any of
them).
In all cases, you want the path *ABOVE* the include/ directory -- You want
only the part that is common to both your "include" directory, and your
"lib" directory.
Probably just "/usr" in your case.
Don't worry about how "far" PHP has to "dig" to find "include" and "lib" so
long as they are *BOTH* somewhere under the directory you provide.
attached mail follows:
>i simpley put an cookie with :
>
>setcookie("gfo_cms" ,$sessid , '');
That's wrong.
You should be passing a TIME in for the third argument, or nothing at all.
Also, due to an IE bug, if you *DO* pass in a TIME, you *MUST* also pass in
a non-empty path.
'/' will be fine.
So, if you want a 'session' Cookie, use:
setcookie('gfo_cms', $sessid);
If you want it to expire, use:
setcookie('gfo_cms', $sessid, time() + 60*60*24*30, '/');
Oh, and for Vins, PHP sessions *USE* cookies, so you're no better off with
them *UNLESS* you --enable-trans-sid or you stuff the session_id() into
every URL/FORM.
><?
>
>if (isset($HTTP_COOKIE_VARS["gfo_cms"])) {
> $sessid = $HTTP_COOKIE_VARS["gfo_cms"];
> if (!check_valid_sessid($sessid)) {
> login_form();
> }
> if (!check_ip($sessid, $REMOTE_ADDR)) {
> login_form();
> }
> $rights = get_user_rights($sessid);
> $user_id = get_userid_from_sessid($sessid);
>
>}
This might as well be "else" -- it will be less cluttered that way.
>if (!isset($HTTP_COOKIE_VARS["gfo_cms"])) {
> login_form();
> }
>
>?>
>
>the last code looks if the cookie exists ...
>but it look likes it won't even create the cookie
Use your browser Preferences to select Cookie "Ask every time" so that when
you do or don't send a Cookie from your own site, you'll know what you're
getting.
You'll want to turn it off before real surfing again, though, since some
sites send a zillion cookies on every damn page, no matter how silly that
is. Sigh.
attached mail follows:
>> class test {
>> function test() {
>> $globals['test2'] = &$this;
>> }
>> }
>> $test1 = new test();
>>
>> The problem hier is that $globals['test2'] is a copy of
>> $globals['test1'] not a
>> references.
>
>Use "$GLOBALS" rather than "$globals"
I think he's building his own "pool" of objects for object-management in
$globals, rather than trying to set the value of $test2...
And mucking directly with $GLOBALS is morally wrong :-)
global $test2;
$test2 = &$this;
if that's what you wanted to do, which I don't think it is.
Of course, you *will* need:
global $globals;
if you expect this code to do anything useful.
attached mail follows:
>I have a php-script with which one can download a file with a specific format
>like this:
>
> header("Content-type: application/specific");
> header("Content-Disposition: attachment; filename=$name.sqrfld");
> echo ("output funny stuff...");
>
>and i will count the number of downloads in a database. When i write the code
>for counting after the "echo ..." statement it will be executed regardless if
>the user aborted the download or not. How can i guarantee that i update the
>database when the download is complete?
Don't think you *CAN* be 100% certain the download succeeded...
You can dink around with ignore_user_abort (or not) and friends to *maybe*
improve accuracy, but you'll never get 100%...
attached mail follows:
>I’m trying to figure out how to do a search trough a MySQL db using LIKE
>or = but the thing is that I have 3 select boxes from where to choose
>the search terms. Can I use something like a wildcard instead of making
>several IF statements like this?
>
>SELECT * FROM table_name WHERE col1 = value1 AND col2 = value2 AND col3
>= %
>
>% goes for an unselected select box (default value = %) in case the user
>doesn’t want to make an *advanced* search, so it fetches all rows which
>does contains values 1 & 2.
Here is what I would do, if I was doing what I think you're doing, which I'm
not at all sure of...
<?php
$query = "select col1, col2, ... from table_name where 1 = 1 ";
if (isset($value1)){
$query .= " and col1 = $value1 ";
}
if (isset($value2)){
$query .= " and col2 = $value2 ";
}
if (isset($value3)){
$query .= " and col3 = $value3 ";
}
mysql_query($query) or error_log(mysql_error());
?>
The where 1 = 1 technique is a sort of "yeast" to allow all the subsequent
parts to start with " and ..."
If you change to " OR ... " then you need " where 1 = 0 "
Think about it or work through an example to see why :-)
attached mail follows:
>I want to display data based on the criteria selected by the user eg click
>on size to display smallest to largest, or by price smallest to highest,
>location etc etc
>
>what is the code I need?
Assuming PHP/MySQL, you'd want something not unlike:
<?php
if (!isset($order)){
$order = 'title';
$ascdesc = 'asc';
}
$query = "select title, size, price from products ";
$query .= " order by $order $ascdesc ";
$products = mysql_query($query, $connection) or error_log(mysql_error());
echo "<TABLE>\n";
echo " <TR>\n";
echo " <TH><A HREF=$PHP_SELF?order=title&ascdesc=asc>^</A><A
HREF=$PHP_SELF?order=title&ascdesc=desc>v</A></TH>\n";
echo " <TH><A HREF=$PHP_SELF?order=size&ascdesc=asc>^</A><A
HREF=$PHP_SELF?order=size&ascdesc=desc>v</A></TH>\n";
echo " <TH><A HREF=$PHP_SELF?order=price&ascdesc=asc>^</A><A
HREF=$PHP_SELF?order=price&ascdesc=desc>v</A></TH>\n";
echo " </TR>\n";
while (list($title, $size, $price) = mysql_fetch_row($products)){
echo " <TR><TD>$title</TD><TD>$size</TD><TD>$price</TD></TR>\n";
}
echo "</TABLE>\n";
?>
Disclaimer: I'll be damned if I can ever tell if ^ is suppose to represent
ASC or DESC in these stupid interfaces. I just click until I get what I
want. YMMV.
attached mail follows:
>Nope thats not they way....
>If you don't specify a expire date it will live for ever or until you delete
>it.
>
>The only way is to set it with an expiry date and then it will delete
>it'self when the browser closes.
>Check this by running a file on the same domain with phpinfo();
No.
If you send no expiration date, it expires when the browsers are all closed.
Read the Cookie spec.
Not that MS actually got all of the Cookie spec correct, but they got that
part right.
To erase a cookie, just do:
setcookie('cookie', '');
attached mail follows:
Surely it would be better to use Sessions in this case?
"Danny Shepherd" <danny attached mail follows:
>Is that also correct?? No brackets needed?
Two Comments:
The "alternate syntax" with the colons is passe -- I think you'd have to dig
pretty deep to find a script old enough that uses it for anything other than
demonstration purposes. (Rasmus?)
You don't *HAVE* to have {} for one-line clauses, but sooner or later,
you'll end up adding a line, and then the whole thing will puke on you
because you don't have {}... Thus, it is morally wrong to not have {} in
all your code. This is a religious issue, and others will disagree.
They're just wrong :-)
attached mail follows:
> -----Original Message-----
> From: Richard Lynch [mailto:rich What utter tosh! *All* my scripts use the "alternative" syntax, as I think
braces are an eyesore and an abomination, and cause more problems than they
solve.
I've pretty much lost count of the number of times I've seen code written
like this:
if (x) {
while (y) {
...
} // end while
...
} // end if
when it would be just as easy, and more functional, to write this (even
saves a few characters, too!):
if (x):
while (y):
...
endwhile;
...
endif;
Another advantage to the alternative syntax is that it can improve error
reporting (slightly). Consider the following:
if (....) {
....;
while (....) {
....;
for (....) {
....;
....
}
....
}
....
PHP will tell you you have a syntax error on the very last line of your
file, and you have no option but to go back and laboriously hand match all
of your braces -- and with each ellipsis representing maybe tens (or even
hundreds!) of lines of code and/or HTML, that's a big job. Now suppose you
wrote it like this instead:
if (....):
....;
while (....):
....;
for (....):
....;
....
endwhile;
....
endif;
....
Now PHP will throw an error at the endwhile, because it knows there's an
endfor missing -- and you've already cut out a large chunk of your code to
check; better yet, as you're checking you can see at a glance what each
"end" should be matching. And every "end" has to be there, too -- no
cursing yourself for that lazy day when you left out a few comments on some
"unimportant" closing braces!
</rant>
Just my two penn'orth.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford attached mail follows:
> when it would be just as easy, and more functional, to write this (even
> saves a few characters, too!):
>
> if (x):
> while (y):
> ...
> endwhile;
> ...
> endif;
You're adding characters...
"{" + "}" opposed to ":" + "endif;"
Don't go for the fuzzy Math from the Al Gore campaign!
attached mail follows:
>the web server, how should the image be named [uniquely]? The problem is
>that if the user specifes the name of the image file, there's a chance
>he'll name another one the same way (and thus overwrite the original). I
>was thinking of maybe a dual approach, where the user gives the image
>file a name, but then the PHP script appends, say, the table name and
>record ID--so as to make the filename unique.
What I do is this:
<?php
# Get rid of gnarly characters in filenames:
$filename = ereg_replace('[^a-zA-Z0-9_\\.-]', '', $photo_name);
# If their filename was so messed up that there's nothing left, give it a
random name.
$filename = $filename ? $filename : chr(rand(ord('A'),ord('Z'))) .
chr(rand(ord('A'),ord('Z'))) . chr(rand(ord('A'),ord('Z'))) .
chr(rand(ord('A'),ord('Z')));
# Now be sure it's unique:
$appendix = '';
# break the filename up into 'whatever' and '.jpg' (or '.gif' or whatever
it is)
# In order to force uniqueness (below) I want to change 'duplicate.jpg'
into 'duplicate2.jpg', not 'duplicate.jpg2' :-)
$extpos = strrpos($filename, '.');
# echo "extpos is $extpos<BR>\n";
if (!$extpos){
$extension = '';
}
else{
$extension = substr($filename, $extpos);
$filename = substr($filename, 0, $extpos);
}
$pathname = "$directory/$filename$appendix$extension";
# echo "extension $extension<BR>\n";
# echo "filename $filename<BR>\n";
# echo "appendix $appendix<BR>\n";
# echo "pathname $pathname<BR>\n";
while ( attached mail follows:
>I'm writting an autoresponder system in PHP. and I'm using wget in my cron
>jobs to process it. Is there a way that I can process incoming mail in PHP
>and call the PHP using a similar method?
>
>Basically I want to go through all the email messages checking if they are
>to autoresponder If you are using sendmail (or qmail) and you have access to sendmail.conf,
do it just like Perl autoresponders:
Change sendmail.conf to have an EXEC (?) that calls a PHP script which must
live in smrsh directory and must start with:
#!/path/to/php
You'll want to read "man smrsh" and "man sendmail" to get started...
This assumes you compiled PHP as a CGI (or CLI these days) as well as Module
for Apache.
attached mail follows:
>I am looking for a good Development tool to write my PHP in and was
>wondering what people are using out there.
I will confess to not reading the entire thread, and if it was mentioned, I
apologize, but I think ActiveState's Komodo might be worth a try-out.
The Zend IDE is great for huge projects if it's in your budget.
My pages are all small and easy (and I like it that way) and I have no
budget :-)
attached mail follows:
I've picked up PHPed, Zend IDE, and Dreamweaver MX.
- ZendIDE has the best code-completion and editing features out of all
of them, best auto-tabs and auto completes.
- PHPed is ok, better with database and total MySQL development then
Zend IDE.
- Dreamweaver MX has limited PHP support but it is far superior on the
front end than the other two.
If only there were a ZendEd MX, hah.
On Thu, 2002-07-11 at 06:33, Richard Lynch wrote:
> >I am looking for a good Development tool to write my PHP in and was
> >wondering what people are using out there.
>
> I will confess to not reading the entire thread, and if it was mentioned, I
> apologize, but I think ActiveState's Komodo might be worth a try-out.
>
> The Zend IDE is great for huge projects if it's in your budget.
>
> My pages are all small and easy (and I like it that way) and I have no
> budget :-)
>
> --
> Like Music? http://l-i-e.com/artists.htm
> Off-Topic: What is the moral equivalent of 'cat' in Windows?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
I usually always have my content dynamically generated by functions, or displayed in include files. I'm not a fan of cluttering up my apps with content.
Martin Clifford
http://www.completesource.net (Now Open!)
>>> "Lazor, Ed" <ELazor Oh, and Dreamweaver has provided the most efficient WYSIWYG created code
that I've seen so far.
So... what do you do when it comes to creating actual content that's
separate from the coding?
My personal approach has been doing the coding necessary to create templates
and then opening templates in Dreamweaver and filling in the blanks.
-Ed
-----Original Message-----
WYSIWYG does nothing more for me than screw up my code. I'm very anal about
how my code looks, firstly. Secondly, most WYSIWYG editors add superfluous
markup into code which not only inflates the file size of your documents,
but also slows down processing of them.
I'm not saying that WYSIWYG isn't right for you, because obviously it is.
I'm just saying that, to me, it might as well be fingernails running down a
chalkboard for all the good it *doesn't* do me, personally.
****************************************************************************
This message is intended for the sole use of the individual and entity to
whom it is addressed, and may contain information that is privileged,
confidential and exempt from disclosure under applicable law. If you are
not the intended addressee, nor authorized to receive for the intended
addressee, you are hereby notified that you may not use, copy, disclose or
distribute to anyone the message or any information contained in the
message. If you have received this message in error, please immediately
advise the sender by reply email and delete the message. Thank you very
much.
attached mail follows:
Hello,
> - Dreamweaver MX has limited PHP support but it is far superior on the
> front end than the other two.
Dreamweaver MX can be easily upgraded to a far supperior PHP suppor
t with PHAkt, our free server model for DWMX. I'll paste the features
below, there's not debugger, and I think that this features will be missing
for a long time from DWMX, but when you reuse good written code all the ti
me you don't really need it....
PHAkt is a free and complex implementation of PHP server model for the
Dreamweaver MX environment. It adds a lot of improvements over the
PHP_MySQL sever model that ships with Dreamweaver:
- Support for multiple databases in a transparent way (ADOdb)
- Support for MySQL, PostgreSQL and MsSQL date locales
- User authentication Server Behaviors
- Master/Detail Server Behaviors
- Go to detail Page Server behaviors
- Improved code generation (all reusable code is kept in functions.inc.php)
- Multiple and extensible recordset support.
- IIS and Apache 2 support by using absolute redirects.
More on PHAkt 2 can be found at http://www.interakt.ro/products/PHAkt/
Alexandru
attached mail follows:
Hello,
If you find the Dreamweaver MX PHP support too immature, you can
always switch to PHAkt, a GPL extension to Macromedia Ultradev that improv
es the PHP support a lot.
The current version 2.0 (PHAkt 1.0 did the same thing for Ultradev 4
but it seems that many PHP developer don't want to be productive and stick t
o code editors like vi or notepad) adds a lot of features like:
- Support for multiple databases in a transparent way (ADOdb)
- Support for MySQL, PostgreSQL and MsSQL date locales
- User authentication Server Behaviors
- Master/Detail Server Behaviors
- Go to detail Page Server behaviors
- Improved code generation (all reusable code is kept in functions.inc.php)
- Multiple and extensible recordset support.
- IIS and Apache 2 support by using absolute redirects.
PHAkt can be downloaded at http://www.interakt.ro/products/PHAkt/
Alexandru
Mark McCulligh wrote:
> I am looking for a good Development tool to write my PHP in and was
> wondering what people are using out there.
>
> I have been looking at Dreamweaver MX, Zend Studio 2.5 and phpEdit.
> I know UltraDev 4 well with ASP, but the new MX now supports PHP. This
> MX/PHP any good? Zend looks good with the integrated documentation and
> debugging tools.
>
> Thanks, Mark.
> _________________________________________
> Mark McCulligh, Application Developer / Analyst
> Sykes Canada Corporation www.SykesCanada.com
> (888)225-6824 ex. 3262
> mmcculli attached mail follows:
>what does this mean:
>
>Warning: Cannot send session cache limiter - headers already sent (output
>started at /home/.edy/alexross/bleen.net/forum/discussion_fns.php:88) in
>/home/.edy/alexross/bleen.net/forum/index.php on line 5
On line 88 in discussion_fns.php there is an echo or print or even just some
HTML, or *EVEN* just a blank line outside of <?php ?> tags.
That is "content" which PHP had to send to the browser.
Now, once PHP has to send content to the browser, it had to send all the
headers first, then a blank line, then the content.
Pretty much, that's why headers are called headers -- They come at the
"head" of the HTML, with a blank line in between.
Once all that went out to the browser, you can't call "header()" function,
because, like, the train has left the station. You can still send more HTML
(jump on a box car) but you can't put anything on the front of the train.
It's gone.
attached mail follows:
I'm slowly beginning to undrestand this, but please bear with a php novice.
When/how were the headers sent? In other words, how do I know that they
have already been sent?
Thanks for humoring me
alex
"Richard Lynch" <rich attached mail follows:
Alexander Ross wrote:
>I'm slowly beginning to undrestand this, but please bear with a php novice.
>When/how were the headers sent? In other words, how do I know that they
>have already been sent?
>
Because something other than a header has gone out. As something other
has gone out, it is not possible to send more headers. Thus headers that
were to be sent must have already been sent. I interpret this error
message as "Something other than headers has already been sent so you
cannot send headers now.", (but then I have been known to be wrong).
HTH
Chris
attached mail follows:
ok ... but the line of code that was the culprit was simply:
print "var id = ".$id."<br>"; //for debugging
how does that line constitute sending more header info?
Alex
"Chris Hewitt" <g0pae attached mail follows:
When you request a page, for instance, php.net, your web browser sends HTTP headers to the server that holds php.net on it. When the server receives these HTTP headers, it knows which page is needed, and sets up it's own headers to send back to the browser, such as location, file types, etc. It then sends back the requested page with all the appropriate header information to the browser, which displays the page.
Where your question comes into play is somewhere in the middle. You can set the HTTP headers only AFTER the request to the server has been made, but has to be BEFORE the page arrives at the client browser for display. So, when we all say that there can be NOTHING output to the HTML file before the headers are sent, we mean it literally.
For example: Open up Notepad. Hit return once, then type this in:
<?php header("Location: index.php"); ?>
Upload it and run it. You'll get an error. Why? Because you sent a hard return to the HTML output BEFORE the header was sent. Hopefully this is not all jumbled an unhelpful. Heh :o)
Good Luck!
Martin
>>> Chris Hewitt <g0pae >I'm slowly beginning to undrestand this, but please bear with a php novice.
>When/how were the headers sent? In other words, how do I know that they
>have already been sent?
>
Because something other than a header has gone out. As something other
has gone out, it is not possible to send more headers. Thus headers that
were to be sent must have already been sent. I interpret this error
message as "Something other than headers has already been sent so you
cannot send headers now.", (but then I have been known to be wrong).
HTH
Chris
attached mail follows:
>I've created a db like system with XML and PHP, and I want to require a
>username/password to change the contents of the file.
>
>How should I go about documenting the username/password? The contents of
>the site aren't really all to important (no financial info or anything like
>that, mostly just links actually), but I don't want someone's information
>stolen because someone found the "users.xml" file and opened it.
>
>Running on a Windows 2k server with IIS5.
Read the PHP Manual about "HTTP Authentication"
attached mail follows:
>I'm just curious if there's a function that allows you to see how many lines
>there are in a file. I could just set up a while(!feof($fp)) { fgets($fp);
>count++; } obviously, but I'm curious if there's a function built in like
>"flines($fp)" that I haven't noticed at php.net?
If it's a relatively small file, it might be a little faster to do:
<?php
$file = file("filename.txt" or die("Could not open file");
echo count($file);
?>
It will suck the whole file into an array of lines faster than you can do
fgets() in PHP.
attached mail follows:
>Hi,
>I am not sure if it is a right email address to ask question, if it is not
>plz disregard this email :)
>if it is this is my Q:
>I am reading a book about php, in its security section, it says " it is more
>secure, as well as more efficient when installing PHP, to install PHP as a
>SAPI module for your Web server that to run it via the CGI interface"
>do you know how can I do that? what is SAPI?
>Thank you for your time
It's definitely more efficient.
A case could be made for times when using PHP as a CGI (via suExec) could be
"more secure" for doing certain kinds of things, though.
I'm not at all there there's any real security difference from Module/CGI
even without the caveats.
Anyway, a SAPI allows PHP to live like a wart on the back of the web server.
So, like, it becomes a part *OF* the web-server which is *already* running,
and waiting to serve up web pages, and if PHP is already there, it just
calls the main PHP function to start doing PHP.
There is ISAPI for IIS, and ASAPI for Apache and so on.
API is A-something Programming Interface or some such, and it's just a fancy
acronym for saying "we designed a logical reasonable set of functions that
you can use to interact with our software without going crazy trying to
figure out all the gory details inside"
I think the "S" part is for "S"erver.
Anyway, for Apache, you just configure it --with-apxs (or --with-apache, but
that's less fun) instead of the php binary in /usr/local/bin. You also
configure httpd.conf with the LoadModule and AddHandler instead of the
Action. (Action is for CGI)
For IIS, you use the php4nts.dll or something like that and make it a
"filter" (MicrosoftIsm for Module) instead of the php.exe
For other web-servers, it's pretty much the same idea, though I got no clue
how to configure them... If you're stuck with one of them, and no PHP
examples are coming up, find a Perl example, and do everything the same,
only plug in PHP where it says Perl.
attached mail follows:
>I am trying to build a "product detail" page that pulls data from a MYSQL
>database using PHP. The data for the page includes product images, which I
>am trying to link to (i.e. from their location on the web server) instead of
>loading the images into the database. However, I cannot find any sample code
>that seems to work. Two questions:
There's tons of it out there...
Though, I admit *finding* the working sample can be tough :-)
>1. Is this possible (i.e. to store the HYPERLINK to the image in the
>database , and as the results are returned to the product detail screen, the
>image file will be displayed)? OR RATHER do I need to store the physical
>image file in the database location and query it that way?
Not only do you not need to store the image data in the db, it's a Bad Idea
(tm), as often discussed here.
>2. The code sample below contains several lines that show a field populated
>with text that I am returning....the line under the //Test comment is the
>field that I'm trying to pull an image back for:
>
>printf("REL_PLAN7: %s<br>\n", mysql_result($result,0,"REL_PLAN7"));
>printf("REL_PLAN8: %s<br>\n", mysql_result($result,0,"REL_PLAN8"));
>printf("REL_PLAN9: %s<br>\n", mysql_result($result,0,"REL_PLAN9"));
>
>//test
>printf(mysql_result($result,0,<a href="FRONT_REND">FRONT_REND</a>);
>
>NOTE: "FRONT_REND" is the name of the database field, and it contains a full
>web address, not relative.
Hmmmm.
Try to think of it this way.
PHP "just" spews out HTML.
I need to spew out the HTML for my web-browser to display an image.
That HTML looks like: <IMG SRC=blahblahblah.jpg>
Or, if you want a link to that image, you'd use:
<A HREF=blahblahblah.jpg>Front Rendering</A>
(or something like that)
So, your code should be something not unlike:
printf("<IMG SRC=%s>", mysql_result($result, 0, 'FRONT_REND'));
or perhaps you want:
printf("<A HREF='%s'>Front Rendering</A>", mysql_result($result, 0,
'FRONT_REND'));
That said, let me point out a few "Big Picture" issues.
printf is incredibly useful for spitting out highly-detailed formatted text,
but it's also a bit slower than echo.
So, really, echo is probably going to be a better work-horse for you in the
long run.
Secondly, calling mysql_result() over and over and over instead of
mysql_fetch_row() once... Well, that's a lot slower.
So, ideally, your code should look more like:
# Maybe in a while loop, maybe not...
list($plan7, $plan8, $plan9, $front_rend) = mysql_fetch_row($result);
echo "$plan7<BR>\n";
echo "$plan8<BR>\n";
echo "$plan9<BR>\n";
echo "<IMG SRC='$front_rend'><BR>\n";
echo "<A HREF='$font_rend'>Front Rendering</A><BR>\n";
You might even have THUMBNAIL path in your database, as well as a FULLSIZE
path for your images:
echo "<A HREF='$fullsize'><IMG SRC='$thumbnail'></A><BR>\n";
attached mail follows:
>I am thinking of moving PHP-based web site to a new server. In doing my due
>diligence, I see that the new server has some different PHP configure
>options.
>
>I was able to make sense of most of them by looking through the PHP web
>site. But I'm still stumped by some of them. I'm hoping people here can
>tell me what they mean:
>
>--enable-libgcc: I found the 1-line explanation on www.php.net,
> but I'm unclear as to the implications of this option. Can
> anyone explain?
I think it specifically tells gcc to link with the right thing, even though
that's what it's going to do anyway...
Unless you're using some really funky set up with weird things going on...
>--enable-pic: likewise. What does this mean?
PIC has something to do with compilation issues...
I think you can almost always ignore this one.
>--enable-inline-optimization: ??
If your computer is a *REAL* dog and has no RAM and no swap space, you can
use this to get PHP to compile...
It will take *FOREVER*, but it will work.
Otherwise, the compiler might puke on you claiming you don't have enough RAM
or something.
>--with-regex=system: the online docs say this is deprecated.
> Could this cause me trouble?
YES!!! Big Trouble.
Your OS has a Regex built-in to it.
PHP has a Regex in it as well.
Apache has a Regex in it as well.
*IF* you forced Apache to use the OS Regex and not its own, and *IF* you
force PHP to use the System Regex and not its own, you just *MIGHT* be okay,
only you'll be using a Regex not quite like anybody else on the planet
trying to help you will think you're using, and a lot of third-party code
will break and some of the more complicated examples won't work, and...
Short answer: Don't do it.
>--with-flex: ?
Wild Guess:
I suppose if you really worked at it you could put bison and flex and all
that crap into some really weird place where ./configure won't be able to
find it, and then you could use this to tell PHP where the hell you put
flex...
>--with-png: I know what PNG is, but I don't know hat this option does.
Tells GD that you not only want GD, but you want GD to be able to actually
create/manipulate PNG files.
--with-gd all by itself is useless.
(Okay "of limited use")
You gotta also say if you want PNG and/or JPEG and/or whatever else GD can
do this week.
Ditto for PDF and Flash and so on, I think.
You are kinda stuck using the same answer (Yes, I want PNG) for any packages
that have PNG as an optional plug-in... I think.
It also lets you tell PHP where the hell you installed PNG, which is
important.
>--with-layout=GNU: I see the explanation in the docs, but I don't know
> if this has any implications for me as a PHP programmer.
Probably not. I never used it.
I think it just changes where PHP is going to install all the files it
creates when it's done.
If you leave it alone, you'll be the way most examples and tutorials expect
you to be.
If you mess with it, you'll have to "translate" any tutorials into your own
setup.
For all of these, leave them alone, and let ./configure do the usual, unless
you *REALLY* know what you are doing, or just want to learn some very arcane
stuff. :-)
attached mail follows:
>But I found nothing about a jobs mailing list. I'm really a Perl programmer and
>we have jobs.perl.org which has a list which does a really good job.
There used to be a nifty jobs database tied into php.net, but I think it was
not getting utilized well, and the original author ended up having less time
for maintenance than he'd hoped, and...
Meanwhile, back at the ranch, scroll to the bottom of this link, which I
found by searching php.net for "Jobs" (whole site, not just function names):
I dunno about these days, but I would hazard a guess that Job Openings would
be kinda nifty, whereas people posting resumes would be pretty damned
annoying. Just my opinion, and I haven't been back long enough to know for
sure :-)
As far as those plotting to *BUILD* a PHP jobs application, I'll throw out
some comments to the wind:
1. Since there used to be such a best on php.net, and it seems to have gone,
I can only surmise that PHP Developers are not *opposed* to the idea, but I
suspect they will be leery of repeating whatever went wrong the first time
around. I'd hazard a guess that it was (1) lack of a dedicated maintainer
to develop it, and/or (2) lack of actual JOBS AVAILABLE postings. You may
even be in a situation where it's more of a "you build it first and then
we'll believe it" from the PHP Dev team given the history... THIS IS JUST A
GUESS I AM NOT "ON" THE TEAM I COULD BE 100% WRONG AND OFTEN AM!!!
Usually because the PHP Dev guys are just plain way nicer than I am :-)
2. This is a *HUGE* project you're suggesting. *HUGE*. If you don't have
real experience in a Project this *HUGE* you really have no idea what you
are biting off, and it's going to choke you.
3. There are a ton of "job sites" out there and some even let you plug in
"PHP" as a known technology, and some of those are even aggressively
managed/marketed by head-hunter-like industry people who are working this
thing to the bone. What is really going to "drive" the traffic to the PHP
version? I think the old one got few JOBS AVAILABLE, so got few Developers,
so never really took off. It would be another MONUMENTAL task to take on
the duty of enticing Job Posters to use it.
Don't get me wrong -- I'd love for a really good jobs.php.net to exist with
tons of work for everybody (self included). But really think this one
through before you start folks, and do some basic homework about why the
previous incarnation disappeared.
attached mail follows:
Sorry,
I lost the email that contained the info and I can't find it in the
archives.
How do I output a static image through a php script?
it had something to do with headers but I can't remember exactly what.
attached mail follows:
On Thu, 11 Jul 2002 21:00:36 +1000, you wrote:
>How do I output a static image through a php script?
>
>it had something to do with headers but I can't remember exactly what.
You need to output the correct content-type header for the image (eg
image/gif), take it's size and output it as content-length, and
suppress error reporting. Then output the image data.
attached mail follows:
There was a much simpler way. It just said the location of the file.
I could use your method but the other one was much simpler.
"David Otton" <david.otton attached mail follows:
On Thu, 11 Jul 2002 22:01:03 +1000, you wrote:
>> You need to output the correct content-type header for the image (eg
>> image/gif), take it's size and output it as content-length, and
>> suppress error reporting. Then output the image data.
>There was a much simpler way. It just said the location of the file.
>
>I could use your method but the other one was much simpler.
Is this what you meant?
http://news.php.net/article.php?group=php.general&article=106348
http://news.php.net/article.php?group=php.general&article=106370
Looks like the same thing I suggested to me...
$filename = "your/file.gif";
// output the correct content-type header
header("Content-Type: image/gif");
// take it's size and output it as content-length
header("Content-length:".filesize($filename));
// Then output the image data
readfile($filename);
djo
attached mail follows:
Is there an easy way to get an array of characters from a string?
attached mail follows:
On Thu, 11 Jul 2002 12:08:59 +0100, you wrote:
>Is there an easy way to get an array of characters from a string?
$str = 'string';
$chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);
print_r($chars);
from
http://www.php.net/manual/en/function.preg-split.php
djo
attached mail follows:
> >Is there an easy way to get an array of characters from a string?
> $str = 'string';
> $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);
> print_r($chars);
A string is already an array of chars :
$toto="test";
echo $toto[0]; // prints t
echo $toto[1]; // prints e
echo $toto[2]; // prints s
echo $toto[3]; // prints t
attached mail follows:
On Thu, 11 Jul 2002 13:50:59 +0200, you wrote:
>> >Is there an easy way to get an array of characters from a string?
>> $str = 'string';
>> $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);
>> print_r($chars);
>
>A string is already an array of chars :
>$toto="test";
>echo $toto[0]; // prints t
>echo $toto[1]; // prints e
>echo $toto[2]; // prints s
>echo $toto[3]; // prints t
Not really; a string is better described as a type that has some
properties in common with the array type. Consider these two examples:
<?
$str = "Hello World!";
$str = array_reverse($str);
echo ($str);
?>
<?
$str = "Hello World!";
$chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);
$str = implode('', array_reverse($chars));
echo ($str);
?>
djo
attached mail follows:
Hello,
IMHO string is array of characters
so is possible:
$str = 'string';
for ($i = 0; $ < count($str); $i++)
echo $str[$i];
Regards,
Michal Dvoracek michal.dvoracek attached mail follows:
Yeah, it behaves like that. But keep in mind
that you should use {} instead of [] for strings
as [] with strings like this is deprecated.
$str = 'abc';
print $str{0}; // a
print $str{2}; // c
The manual also talks about this use too:
http://www.php.net/manual/en/language.types.string.php
Regards,
Philip Olson
On Thu, 11 Jul 2002, Michal Dvoracek wrote:
> Hello,
>
> IMHO string is array of characters
>
> so is possible:
> $str = 'string';
> for ($i = 0; $ < count($str); $i++)
> echo $str[$i];
>
> Regards,
> Michal Dvoracek michal.dvoracek attached mail follows:
I know it is cross-posting, but I thought I might get an answer here...
TIA,
Mikey
> -----Original Message-----
> From: Mikey [mailto:mikey attached mail follows:
Hi!
I've run across a problem when using session_start and HTTP headers in
Mozilla. I'm trying to write a snippet of code that checks whether a
user has logged in or not. If the user has a session variable set I want
to display the page and if he or she hasn't I want to give them a 403
Forbidden header. My current code looks like this:
[top of page]
<?php
// Start session handling
session_start();
// Check login
if (isset($HTTP_SESSION_VARS["xyz"])
and $HTTP_SESSION_VARS["xyz"] == "yes") {
?>
<html>
[page contents]
</html>
<?php
}
else {
header("HTTP/1.0 403 Forbidden");
}
?>
[end of page]
This works perfectly in IE 6 (I get a 403 Error Message) but in Mozilla
I just get an empty page (containing just the <html> and <head> tags).
Most other headers seem to work though.
If I use header("Location: somepage.php") both Mozilla and IE correctly
redirects the browser. I don't know if it's a bug in IE or Mozilla or if
I'm plain stupid, but perhaps someone else has experienced this and
are willing to give me a hint?
Thanks
/lasso
attached mail follows:
Hi... I've just checked out a script from hotscripts.com that send email
from and smtp server...
I've managed to say the email has come from a server that doesn't exist
but the email can still be traced...
is there know way to build a php smtp server ?
attached mail follows:
Vins,
Yes, talk to port 25 of any smtp server using php. You would need to
implement the full RFCs on smtp and its re-inventing the wheel. There
are already classes to talk to whichever smtp server you want. Whichever
smtp server you sent the mail to would log it, and the server it came
from. Competent smtp servers will want to do both forward and reverse
dns lookups on the computer connecting to it, and that is if it was an
open relay (allowing anything to connect). So you would hide the
originating computer in the chain in the email headers, but still leave
a full audit trail in the next computer's logs.
The only reason I can think of for wanting to do this is to send spam.
Its the fastest way for your isp to kick you off that I know of (faster
than not paying the bill). Its a Bad Idea (tm).
Regards
Chris
vins wrote:
>Hi... I've just checked out a script from hotscripts.com that send email
>from and smtp server...
>
>I've managed to say the email has come from a server that doesn't exist
>but the email can still be traced...
>
>is there know way to build a php smtp server ?
>
attached mail follows:
On Thu, Jul 11, 2002 at 02:29:11PM +0200, vins wrote:
> Hi... I've just checked out a script from hotscripts.com that send email
> from and smtp server...
The mail() does exactly the same.... Nothing fancy about it.
> I've managed to say the email has come from a server that doesn't exist
> but the email can still be traced...
Care to show the headers? I'm just curious as to how the messages are
actually produced. You have to keep in mind, that by doing something like
this, the chances are really good that the majority of your email will NOT
be delivered to its final destinations.
Allot of SMTP servers does quite a bit of sanity checking on the headers
received from an email message. They must, for example, include proper
Received By (which is what is used for tracking the email), To:, From:,
BCC:, etc headers. Without these, or with malformed headers, many SMTP
servers will reject and bounce the email. You'll need to be *very* carefull
in doing something like this.
If you don't understand in very much details how SMTP works, and how SMTP
servers delivers email, I'd suggest you do not attempt to tamper with it.
> is there know way to build a php smtp server ?
PHP can't run a script in a daemon that I am aware of, so the short awnser is
definately no. If you want a PHP script to simply send a message to a SMTP
server, then sure, there is the mail() function, or you can open a socket
to port 25 of the mail server. However, as I stated above, if you do not
include proper headers (which identifies the email and make the email
trackable), most SMTP servers will immediately reject the email.
attached mail follows:
trying to get the built in gd to work without luck
I am using redhat and it has gd 1.8.4(or something)
but the newer compiled version does not seem to install.
I check with phpinfo and it just says 1.6.2 or higher
but none of the 2.* functions work so I assume the
new gd did not install. my config line looks like this..
./configure --with-apxs=/usr/sbin/apxs --with-mysql=/usr --with-ttf=/usr --enable-track-vars --enable-ftp --enable-imap --enable-ssl --enable-versioning --enable-trans-sid --enable-sysvsem --with-config-file-path=/etc --with-gd
kind regards
Kev
attached mail follows:
You need to compile with GD2 if you want to use any of the 2.* functions in
PHP - phpinfo will say 'GD 2.0 or higher'
HTH
Danny.
----- Original Message -----
From: "Kevin Waterson" <kevin > trying to get the built in gd to work without luck
> I am using redhat and it has gd 1.8.4(or something)
> but the newer compiled version does not seem to install.
>
> I check with phpinfo and it just says 1.6.2 or higher
> but none of the 2.* functions work so I assume the
> new gd did not install. my config line looks like this..
>
./configure --with-apxs=/usr/sbin/apxs --with-mysql=/usr --with-ttf=/usr --e
nable-track-vars --enable-ftp --enable-imap --enable-ssl --enable-versioning
--enable-trans-sid --enable-sysvsem --with-config-file-path=/etc --with-gd
>
> kind regards
> Kev
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Hey .. for some un known reason .. next doesnt work properly on session
array ...
when the code below gets execuded .. next only traverses to a seconde
element :(
IS it a bug or just me?
------ CODE -----
<?
class questionData {
var $Question;
var $Help;
var $Answer;
}
session_start();
if(!session_is_registered('_SESSION_program')){
session_register('_SESSION_program');
$questionData = new questionData ();
$questionData->Question = "1";
$questionData->Help = "1";
$_SESSION_program [] = $questionData;
$questionData->Question = "2";
$questionData->Help = "2";
$_SESSION_program [] = $questionData;
$questionData->Question = "3";
$questionData->Help = "3";
$_SESSION_program [] = $questionData;
$questionData->Question = "4";
$questionData->Help = "4";
$_SESSION_program [] = $questionData;
$questionData->Question = "5";
$questionData->Help = "5";
$_SESSION_program [] = $questionData;
$questionData->Question = "6";
$questionData->Help = "6";
$_SESSION_program [] = $questionData;
$questionData->Question = "7";
$questionData->Help = "7";
$_SESSION_program [] = $questionData;
$questionData->Question = "8";
$questionData->Help = "8";
$_SESSION_program [] = $questionData;
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="get" action="<?=$_SERVER['PHP_SELF']?>">
<input name="programAction" type="submit" id="programAction" value="Prev">
<input name="programAction" type="submit" id="programAction" value="Next">
</form>
<?
if(isset($programAction) && $programAction =='Next')
print_r(next ($_SESSION_program));
if(isset($programAction) && $programAction =='Prev')
print_r(prev($_SESSION_program));
?>
<?
$obj = current ($_SESSION_program);
echo $obj->Help;
?>
</body>
</html>
attached mail follows:
I have been trying this to no avail.
Tryng to say the equivalent of:
IF (var1 = 1 AND var2 = "a" or "b" or "c")
i.e. yield true if 1 and a
OR
1 and b
OR 1 and c
:-)
Thanks!
attached mail follows:
You'd have to separate it like so:
if($var1 == 1 AND ($var2 == "a" OR $var2 == "b" OR $var2 == "c") {
// do stuff here if true
} else {
// do stuf here if false
}
HTH
Martin Clifford
http://www.completesource.net (Now Open!)
>>> "Rw" <php Tryng to say the equivalent of:
IF (var1 = 1 AND var2 = "a" or "b" or "c")
i.e. yield true if 1 and a
OR
1 and b
OR 1 and c
:-)
Thanks!
attached mail follows:
Fixing the below, since it would produce a parse error (I forgot a parenthesis, hehe)
Martin Clifford
http://www.completesource.net (Now Open!)
>>> "Martin Clifford" <MLC1 if($var1 == 1 AND ($var2 == "a" OR $var2 == "b" OR $var2 == "c")) {
// do stuff here if true
} else {
// do stuf here if false
}
HTH
Martin Clifford
http://www.completesource.net (Now Open!)
>>> "Rw" <php Tryng to say the equivalent of:
IF (var1 = 1 AND var2 = "a" or "b" or "c")
i.e. yield true if 1 and a
OR
1 and b
OR 1 and c
:-)
Thanks!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Rw wrote:
> I have been trying this to no avail.
>
> Tryng to say the equivalent of:
>
> IF (var1 = 1 AND var2 = "a" or "b" or "c")
>
> i.e. yield true if 1 and a
> OR
> 1 and b
> OR 1 and c
I would do something like this:
$CheckArr = array("a", "b", "c");
if($var1 == 1 && in_array($CheckArr, $var2)) {
.....
}
Regards,
Johan
attached mail follows:
> <?
> $word=new COM("word.application") or die("Cannot start MS Word");
> print "Loaded word version ($word->Version)\n";
> $word->visible = 1 ;
> $word->Documents->Add();
> $word->Selection->Typetext("This is a test");
> ?>
>
> does anyone recognise this?????
Oh yes - this would be Word via COM - if you are having problems getting
this to work, I would suggest consulting the VBA reference manual that comes
with Office - it will give you the methods/objects available to you, as well
as examples of how to use them...
Mikey
attached mail follows:
Thanks for all the info, i have found a temporary solution which i am
currently going to develop
If anyone is interested, I found the following at
http://www.pscode.com/xq/ASP/txtCodeId.625/lngWid.8/qx/vb/scripts/ShowCode.h
tm
Thanks Again
Craig
attached mail follows:
I am attempting to connect to a MSSQL 2000 database from a linux box. I
have installed freetds successfully and configured php with sybase as
directed by freetds.
I configured the freetds .conf file. However this is where I have
questions. The freetds.conf file only asks for the ip address of the
database server. I have mulitple databases on my database server. How do I
specify the database that I'm trying to reach?
Are there any configuration flags that I could be missing to use
odbc_connect, etc.?
Any help would be greatly appreciated.
Tim
attached mail follows:
I don't really know much about freetds so this could all be wrong, but...
when you set-up a DSN on a server, the database is specified there - hope
this helps.
Mikey
"Tim Nields" <tnields attached mail follows:
Check out the "mssql_select_db" function.
Call it right after the connection open.
Adam Voigt
adam.voigt On Thu, 2002-07-11 at 12:31, Tim Nields wrote:
> I am attempting to connect to a MSSQL 2000 database from a linux box. I
> have installed freetds successfully and configured php with sybase as
> directed by freetds.
>
> I configured the freetds .conf file. However this is where I have
> questions. The freetds.conf file only asks for the ip address of the
> database server. I have mulitple databases on my database server. How do I
> specify the database that I'm trying to reach?
>
> Are there any configuration flags that I could be missing to use
> odbc_connect, etc.?
>
> Any help would be greatly appreciated.
>
> Tim
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Errr - doesn't that function apply to mySQL databases only?
Mikey
"Adam Voigt" <adam.voigt attached mail follows:
I wouldn't have said it if it did.
Notice that it's MSSQL_select_db not MYSQL_select_db.
Adam Voigt
adam.voigt On Thu, 2002-07-11 at 10:03, Michael Davey wrote:
> Errr - doesn't that function apply to mySQL databases only?
>
> Mikey
>
> "Adam Voigt" <adam.voigt attached mail follows:
doh!
"Adam Voigt" <adam.voigt attached mail follows:
However, this still wouldn't work for ODBC...
"Adam Voigt" <adam.voigt attached mail follows:
Ofcourse not. I didn't say it would. ODBC and FreeTDS (which is what he
said he was using) are two totally different drivers. Thats like saying
mysql_select_db wouldn't work for Oracle databases, ofcourse they
wouldn't, there different drivers.
Adam Voigt
adam.voigt On Thu, 2002-07-11 at 10:08, Michael Davey wrote:
> However, this still wouldn't work for ODBC...
>
> "Adam Voigt" <adam.voigt attached mail follows:
Hi David,
Your question has seen much debate in this newsgroup. I had much the same
problem and solved it by writing the following function:
/**
* wrapper for header( "Location: url" )
*/
function redirect( $url, $showMoved=false ) {
// set refresh to target $url
header( "Refresh: 0; url=$url" ) ;
// show page has moved
if ( $showMoved ) {
echo "<html><head><title>Moved to $url</title></head><body><p>This page
has moved to <a href=\"$url\">$url</a>.</body></html>" ;
}
// exit current script
exit ;
}
Since it doesn't use header( "Location: ..." ) you are able to write your
cookies before you redirect. It's about the most elegant solution to your
problem, short of redesigning your pages. Of course, I have noticed that if
you don't supply the html ($showMoved) Opera chokes. IE and Netscape seem to
handle it fine and I haven't tested Mozilla yet.
Hope it helps!
Cord
"David Busby" <busby attached mail follows:
> -----Original Message-----
> From: David Duong [mailto:davidduong1 You mean like unset($arr[$n]) ??
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford attached mail follows:
Is there a way to create a customised version of the index directory
structure using php?
Eg listing all the pages in the specific directory when an index page isnt
created?
attached mail follows:
I want to acheive something like this
http://www.claviga.com/index.php?pageid=18
attached mail follows:
The easiest way to accomplish that is by using switches. Here is an example:
switch($pageid) {
default:
include("default_page.inc");
break;
case "18":
include("page_18.inc");
break;
}
With that in your index.php page, it will look for the variable $pageid, and depending on what it is set to, display the appropriate information. In this instance, it will display the default index page by default (if $pageid is empty), or page_18.inc if $pageid = 18.
Hope that helps :o)
>>> "Craig" <craig http://www.claviga.com/index.php?pageid=18
attached mail follows:
[snip]
Is there a way to create a customised version of the index directory
structure using php?
Eg listing all the pages in the specific directory when an index page isnt
created?
I want to acheive something like this
http://www.claviga.com/index.php?pageid=18
[/snip]
Yes you can do this. Start with your requirements, then do a flow chart.
From there you can design each process that you need. For customization you
will have to set a cookie for each user holding their customized options so
that the proper information will be displayed when they visit the site.
Search Google for Building Custom PHP Pages;
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=Building+Custom+PHP+P
ages&btnG=Google+Search
HTH!
Jay
"Learn to think through processes step by step, learn to diagram, then write
code, and then write more code. Once you have accomplished this you will be
well on your way to learning how to program." -- professor of computer
science (name forgotten), a long time ago, L.S.U.
attached mail follows:
Another PHP compilation question ...
I've just compiled PHP 4.2.1 --with-mysql. I added no path to mysql, and
it worked fine as it always does. However, I'm keen to add mod_python as a
DSO to Apache as well, and noticed in PHP's INSTALL notes that I'll
probably need to recompile PHP with a path to mysql:
--with-mysql=/somewhere/or/other/
1. Is this always the case?
2. Where would the path be likely to be on RedHat 7.2 with MySQL rpms?
TIA
--------------------------------
Michael Hall ninti attached mail follows:
I've never compiled php with the path to mysql. I've done this on lots
of different servers, and it always works. I don't know if it's the
proper way of doing things, but it does work.
On Fri, 12 Jul 2002 10:02:40 +0930 (CST)
Michael Hall <olc >
> Another PHP compilation question ...
>
> I've just compiled PHP 4.2.1 --with-mysql. I added no path to mysql,
> and it worked fine as it always does. However, I'm keen to add
> mod_python as a DSO to Apache as well, and noticed in PHP's INSTALL
> notes that I'll probably need to recompile PHP with a path to mysql:
>
> --with-mysql=/somewhere/or/other/
>
> 1. Is this always the case?
>
> 2. Where would the path be likely to be on RedHat 7.2 with MySQL rpms?
>
> TIA
>
> --------------------------------
> Michael Hall ninti attached mail follows:
The difference between adding a path and not is that without a path the
bundled mysql client library will be used, whereas if you add a path then
your system's mysql client libs will be used. It is usually a good idea
to use the system libaries if you have them because they are more likely
to match your server version, and if you are linking against other things
that might be linked against the mysql client libraries, then using the
system libraries is a better idea.
-Rasmus
On Thu, 11 Jul 2002, Tyler Longren wrote:
> I've never compiled php with the path to mysql. I've done this on lots
> of different servers, and it always works. I don't know if it's the
> proper way of doing things, but it does work.
>
> --
> Tyler Longren
> Captain Jack Communications
> tyler attached mail follows:
On Thu, 11 Jul 2002, Tyler Longren wrote:
> I've never compiled php with the path to mysql. I've done this on lots
> of different servers, and it always works. I don't know if it's the
> proper way of doing things, but it does work.
>
>
Yeah, me too, but the INSTALL file (or was it the message at the end of
the compile/make) was pretty clear about needing to provide a path if PHP
was going to share access to MySQL with things like mod_perl, mod_python,
etc.
I guess all will become clear when I unpack mod_python and have a go.
--------------------------------
Michael Hall ninti attached mail follows:
OK, thanks for that. I'm about to start a full-time job developing
a portal/intranet and what have you for a tertiary education institution,
and after 'mucking about' with PHP for a couple of years and developing a
few web apps, I realise that there is a lot of detail that I need
to get clear before I start, especially config and security-related stuff.
I guess there are a lot of people in my situation, who have used PHP for
years without having a good grip on some pretty fundamental stuff. The
difference now is that it matters - my reputation (and that of PHP I
suppose, in my employer's mind at least) is on the line if I muck up.
BTW, I've had some people trying to push me in the direction of Zope for
this job, but I've had a look at it and simply don't get it's 'Zen'. I'm
not knocking it, but I don't see how it betters good, clean OO PHP.
Anyway, thanks again.
Michael
On Thu, 11 Jul 2002, Rasmus Lerdorf wrote:
> The difference between adding a path and not is that without a path the
> bundled mysql client library will be used, whereas if you add a path then
> your system's mysql client libs will be used. It is usually a good idea
> to use the system libaries if you have them because they are more likely
> to match your server version, and if you are linking against other things
> that might be linked against the mysql client libraries, then using the
> system libraries is a better idea.
>
> -Rasmus
>
> On Thu, 11 Jul 2002, Tyler Longren wrote:
>
> > I've never compiled php with the path to mysql. I've done this on lots
> > of different servers, and it always works. I don't know if it's the
> > proper way of doing things, but it does work.
> >
> > --
> > Tyler Longren
> > Captain Jack Communications
> > tyler attached mail follows:
I've just compiled PHP 4.2.1 with Apache 1.3.24 on RedHat 7.2. Everything
works just fine as usual. I've got a couple of queries, however.
I compiled with the --enable-magic-quotes option, then figured this was a
bad move as I've been caught out before with scripts that assume it is
on. So, I copied the php.ini-recommended file to php.ini, and now
phpinfo() tells me that magic_quotes_gpc and magic_quotes_runtime are off.
So, does compiling with --enable-magic-quotes have any effects if magic
quotes are turned off in php.ini? Are they "really" off?
Can all "--enable-whatever" options be turned on/off in php.ini,
regardless of ./configure options?
Does the "-with-config-file-path" option set the expected path to php.ini
(I always thought it was to Apache)? How come PHP still works whether the
file is there or not?
TIA
--------------------------------
Michael Hall ninti attached mail follows:
If you do:
--with-mysql, it can't be disabled in php.ini, however you can change
options in php.ini that deal with connecting to a mysql server. If you
had copied the php.ini-dist file, your magic_quotes would probably have
been set to "on". I'm not sure if the php.ini-recommended gets updated
after running the configure script.
On Fri, 12 Jul 2002 09:56:52 +0930 (CST)
Michael Hall <olc >
> I've just compiled PHP 4.2.1 with Apache 1.3.24 on RedHat 7.2.
> Everything works just fine as usual. I've got a couple of queries,
> however.
>
> I compiled with the --enable-magic-quotes option, then figured this
> was a bad move as I've been caught out before with scripts that assume
> it is on. So, I copied the php.ini-recommended file to php.ini, and
> now phpinfo() tells me that magic_quotes_gpc and magic_quotes_runtime
> are off.
>
> So, does compiling with --enable-magic-quotes have any effects if
> magic quotes are turned off in php.ini? Are they "really" off?
>
> Can all "--enable-whatever" options be turned on/off in php.ini,
> regardless of ./configure options?
>
> Does the "-with-config-file-path" option set the expected path to
> php.ini(I always thought it was to Apache)? How come PHP still works
> whether the file is there or not?
>
> TIA
>
>
> --------------------------------
> Michael Hall ninti attached mail follows:
Hi
Can anyone in the group help, I'm trying to read and write from a serial
port using php.
So far using fsockopen I've managed to open and send data through a serial
port but I'm having real problems reading a response. I've tried fgets
really to no success can anyone spare me some ideas or thoughts?
Setup:
Linux box running serproxy ( A tcp to serial port proxy ) IP 192.168.123.192
I connect to this from a webserver running on another machine with:
<?php
$fp = fsockopen ("192.168.123.192", 5331, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
if(fputs ($fp, "test data".chr(37))){
echo 'data sent';
} else {
echo 'no data sent';
}
while (!feof($fp)) {
echo fgets ($fp,128);
}
fclose ($fp);
}
?>
The output is being read by a small ap that displays the serial port data
and allows me to send a response, I've logged the response I send at the
linux box on the serial port and serproxy is supposed to translate this back
to tcp port 5331 however I cannot read it with fgets?
Please help it's driving me mad and I'm sure I'm just being stupid : {
Thanks for any help.
Zac
attached mail follows:
I am interrested in experimenting a bit with FDF, but I use windows, and it
seems that it is only available on Linux... According to Adobe, it should
work on windows aswell, but perhaps not with PHP...
Anyone got it working with windows?
This is what I am talking about:
http://www.php.net/manual/en/ref.fdf.php
// Tobias
attached mail follows:
I have an annoying 'glitch' in the forms on my site:
When a page loads, if it has a form on it, I would like the cursor to move to
the first field, be 'set' - that is, I should see a cursor or blinking cursor
in the first field.
As it is now, on some pages, I either have to 'tab' to the first field, or
click themouse in that field.
Is there anyway to automate this, so that when a page loads it automatically
goes to the first field, and 'highlights' the entry area? (Btw, I tried
'tabindex=1' but it still does not do what I'd like it to.
Any ideas, suggestions, or admontions gratefully accepted.
Tia, Andre
attached mail follows:
You can do it with JavaScript. Something like:
<script language="JavaScript">
document.formname.fieldname.focus();
</script>
At the bottom of the page, replacing formname and fieldname with the
appropriate values, obviously...
HTH
Richy
==========================================
Richard Black
Systems Programmer, DataVisibility Ltd - http://www.datavisibility.com
Tel: 0141 435 3504
Email: rblack -----Original Message-----
From: Andre Dubuc [mailto:aajdubuc I have an annoying 'glitch' in the forms on my site:
When a page loads, if it has a form on it, I would like the cursor to
move to
the first field, be 'set' - that is, I should see a cursor or blinking
cursor
in the first field.
As it is now, on some pages, I either have to 'tab' to the first field,
or
click themouse in that field.
Is there anyway to automate this, so that when a page loads it
automatically
goes to the first field, and 'highlights' the entry area? (Btw, I tried
'tabindex=1' but it still does not do what I'd like it to.
Any ideas, suggestions, or admontions gratefully accepted.
Tia, Andre
attached mail follows:
On Thu, 11 Jul 2002 11:25:50 -0400, you wrote:
>Is there anyway to automate this, so that when a page loads it automatically
>goes to the first field, and 'highlights' the entry area? (Btw, I tried
>'tabindex=1' but it still does not do what I'd like it to.
Javascript, not PHP. Look up the focus() property of a text entry box.
(hint: look at the source for http://www.google.com/)
djo
attached mail follows:
> This is JAVASCRIPT problem because it is on the client end.
Thanks to everyone who responded. I sort of thought it would be a
'Client-side' problem. Oh well, since I'm not prepared to use any javascript,
I guess I'll have to live with it. Sigh . . .
Thanks again,
Andre
>
> -----Original Message-----
> From: Andre Dubuc [mailto:aajdubuc attached mail follows:
Hello all!
Is there a flag that would tell me if the page requested is using SSL, by
https, or regular http?
I'm not sure I could get that from PHP, or from Apache/PHP.
Thanks for your help.
Jean-Louis
attached mail follows:
if ( $_SERVER["HTTPS"]=="on" )
user using HTTPS
else
user usin http
----- Original Message -----
From: "LeTortorec, Jean-Louis" <JLeTortorec > Hello all!
>
> Is there a flag that would tell me if the page requested is using SSL, by
> https, or regular http?
>
> I'm not sure I could get that from PHP, or from Apache/PHP.
>
> Thanks for your help.
>
>
> Jean-Louis
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
attached mail follows:
You can use either of the following checks to see if
the user is using HTTPS...
$HTTPS == "on"
$SERVER_PORT == "443"
Chris
attached mail follows:
yip on the browser a small padlock should appear
> -----Original Message-----
> From: LeTortorec, Jean-Louis [mailto:JLeTortorec attached mail follows:
Thanks to all for your prompt replies!
It works just fine.
attached mail follows:
Dear All,
Sorry to ask this simple question!
I know I can do exec under unix OS but
when I try it on Windows platform (running
Apache), PHP gives me "Warning: Unable to fork".
Off hand I don't remember do I need to
modify the php.ini or semething else,
can someone give me a hand?
Thanks!
--Wo
attached mail follows:
I might found the answer myself but correct me if I'm wrong:
I was trying to pass some args (ex. echo testing) that I tried
to exec but fail. But, if I put the "echo testing" inside a
batch file and have the exec to call that batch file, then it works.
There is also a function call escapeshellcmd to screen out
any bad tricks.
If there is other better ways to do thing, please share.
Thanks.
--Wo
----- Original Message -----
From: "Wo Chang" <wchang > Dear All,
>
> Sorry to ask this simple question!
>
> I know I can do exec under unix OS but
> when I try it on Windows platform (running
> Apache), PHP gives me "Warning: Unable to fork".
>
> Off hand I don't remember do I need to
> modify the php.ini or semething else,
> can someone give me a hand?
>
> Thanks!
>
> --Wo
>
>
attached mail follows:
When the 404 is caught and a PHP script is executed there doesn't
appear to be any information in the environment variables indicating
what URL triggered the 404. Could someone tell me how to obtain that
information?
Cheers,
Rob.
attached mail follows:
you can get the webserver to redirect to a custom errorhandler that could be a php script to do whatever you want.
> -----Original Message-----
> From: Robert Cummings [mailto:robert.cummings attached mail follows:
The $_SERVER environment variables should be there, I'm using them.
Henning Sittler
www.inscriber.com
-----Original Message-----
From: Brian McGarvie [mailto:bmcgarvie you can get the webserver to redirect to a custom errorhandler that could be
a php script to do whatever you want.
> -----Original Message-----
> From: Robert Cummings [mailto:robert.cummings attached mail follows:
Henning Sittler wrote:
>
> The $_SERVER environment variables should be there, I'm using them.
My mistake, I used an absolute url with the www.foo.com and so it did
an external redirect. That'll teach me to gloss over configuration
details :)
Thank you everyone for the help.
Cheers,
Rob.
attached mail follows:
I realize this isn't a php question, but I figured that someone here knows
of a good mysql newsgroup and in the mean time someone here probaby knows
the answer to my question.
Can I set up a query like this:
select * from table where start_shot <= $current_shot and end_shot >=
$current_shot
note everything will be of type INT
Thanks ya'll
attached mail follows:
Yes, though I'd probably add parentheses to make it clearer.
select * from table where ((start_shot <= $current_shot) and (end_shot >=
$current_shot))
Though that's probably not necessary. Make certain you have your less
than's and greater thans set the right way, I've often sat slack-mouthed
wondering why I had no data, simply because I was using "<" when it should
have been ">".
Cheers - Miles Thompson
At 12:06 PM 7/11/2002 -0400, Alexander Ross wrote:
>I realize this isn't a php question, but I figured that someone here knows
>of a good mysql newsgroup and in the mean time someone here probaby knows
>the answer to my question.
>
>Can I set up a query like this:
>
>select * from table where start_shot <= $current_shot and end_shot >=
>$current_shot
>
>note everything will be of type INT
>
>Thanks ya'll
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hello - I am having a lot of trouble with Auth_HTTP. I am using
PostgreSQL and Auth works fine (after reading the source and figuring
out that passwords need to be MD5 encrypted). I can't, however,
make Auth_HTTP work at all. This is what I have. I have tried
plaintext, md5, and crypt passwords all to no avail. I also can't
find any further documentation other than what's on pear.php.net.
Any ideas? I've e-mailed pear-general but no response so far.
Thanks!!
Tim
<?
require_once "Auth_HTTP/Auth_HTTP.php";
require_once "DB.php";
$params = array(
"dsn" => "pgsql://tim $a = new Auth_HTTP("DB", $params);
$a->start();
?>
# select * from auth;
username | password
----------+---------------------------------------
scott | password
tim | $apr1$fVALv...$EajPmS/Yib8BzQ4YcfIAy.
attached mail follows:
Well, my attempts at getting discipline for Erik Hegreberg will have to
go unfinished for now. I guess a list admin would have to retrieve the
original headers from Erik's original posts -before- they hit the
mailing list software and got new headers and distributed. Any list
admins out there want to help with that?
Seems kind of silly - if they keep e-mail transaction logs and they
know the e-mail account of Mr. Hegreberg, they should be able to
correlate my complaint. Oh well, 'twas a valiant effort!
Thanks everyone yesterday for sending me those headers.
In any case, here's the response from abuse Dear mr. Soza,
At 11:27 10.07.2002 -0800, you wrote:
>It appears that you do have the full headers of the message in
>question, as they appeared on my machine. Since Mr. Hegreberg was
>sending these messages to a mailing list, the headers mostly show the
>mailing list information.
The headers you sent did not contain the necessary information. It
seems the mailing-list strips away the important part of the headers,
so that none of the headers you've received are sufficient.
We recommend that you contact the list administrator and ask if he/she
can fix the problems with headers being removed, and if he has the
original headers so that we can track down the users.
Jason Soza
attached mail follows:
No such logs are kept on our end.
On Thu, 11 Jul 2002, Jason Soza wrote:
> Well, my attempts at getting discipline for Erik Hegreberg will have to
> go unfinished for now. I guess a list admin would have to retrieve the
> original headers from Erik's original posts -before- they hit the
> mailing list software and got new headers and distributed. Any list
> admins out there want to help with that?
>
> Seems kind of silly - if they keep e-mail transaction logs and they
> know the e-mail account of Mr. Hegreberg, they should be able to
> correlate my complaint. Oh well, 'twas a valiant effort!
>
> Thanks everyone yesterday for sending me those headers.
>
> In any case, here's the response from abuse attached mail follows:
Personally I think they're copping out.
How many of us forwarded EVERY piece of his crap to them?
There's an old (ok not so old) saying:
Eat rice. A couple billion Chinese people can't be wrong.
Why these admins can't catch a clue and, by the sheer volume of the emails,
do something about this ass, boggles my mind.
Glenn
(who got a similar reply from the idiots)
On 08:17 AM 7/11/2002 -0800, Jason Soza wrote:
>In any case, here's the response from abuse attached mail follows:
Are emails still coming through from this guy. I put a block on my server
for his address, so I can't tell.
Thank You
<><><><><><><><><><><><><><><><>
Daniel Negrón
Lotus Notes Administrator / Developer
KB Electronics, Inc.
954.346.4900x122
http://www.kbelectronics.com
<><><><><><><><><><><><><><><><>
|--------+------------------------>
| | Glenn Sieb |
| | <ges Personally I think they're copping out.
How many of us forwarded EVERY piece of his crap to them?
There's an old (ok not so old) saying:
Eat rice. A couple billion Chinese people can't be wrong.
Why these admins can't catch a clue and, by the sheer volume of the emails,
do something about this ass, boggles my mind.
Glenn
(who got a similar reply from the idiots)
On 08:17 AM 7/11/2002 -0800, Jason Soza wrote:
>In any case, here's the response from abuse --
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Well, you better pray that he won't return!!
<theme & music playing from terminator>
"I'll Be Back!!"
"Rasmus Lerdorf" <rasmus attached mail follows:
He's been blocked at the server level. He won't be able to post to any
php mailing lists.
On Thu, 11 Jul 2002, Scott Fletcher wrote:
> Well, you better pray that he won't return!!
>
> <theme & music playing from terminator>
>
> "I'll Be Back!!"
>
> "Rasmus Lerdorf" <rasmus attached mail follows:
Read the message from the admins from online.no carefully
Don't worry i'll quote
"and if he has the original headers so that we can track down the users."
What a crock of shit....
We all sent his full name and his email address plus the copies of 78 to be
exact spams that he sent to the php mailinglist.....
Those admins sound like South African's that work in our Telecoms business.
"Well, if we didn't receive the fax, then you didn't pay your bill"
If the fools from my telecoms company only check their dam fax machine....
Buncha fools... .and i though south africa was full of lazy ass admins
LOL
Wait Eriks time will come and he will get a tast of his own medicine.....
"Jason Soza" <solja attached mail follows:
I don't know what part of South Africa you're from Bee...
I suppose you are an Afrikanner! I know in Sandton
where my pops is, things run efficiently...
Except for the fact that Internet Cafes run slow connections
I see nothing wrong with the S.A's setting, for that fact
it means people are doing their jobs!! No need to hate
on such an amazing country...
Kondwani
attached mail follows:
Your approach actually seems pretty good to me. I've used two other
approaches in the past though and I'll describe them to give you some other
ideas.
Option 1: Multi-Page Form
You submit a document in stages. From the user's perspective, they click a
button to "add document". This lets them add the first page of the
document. Submit the first page and a web page displays the first page and
provides a link to add page. Click the add page button and receive another
form. Entering information into this form and submitting creates a new page
that gets appended to the document. Repeat process.
Option 2: Single form - auto page breaking
Have a single form people copy their document into. The entire form goes
into the database. When the system goes to display the document, you use
string functions to grab a range of characters from the text that get
displayed. For example, page 1 will display characters 0 through 2000.
Oop... I just remembered, I think I broke this out by words to make sure
individual words weren't chopped.
Hope that helps =)
-Ed
-----Original Message-----
I'm trying to determine the best way to break dynamic content into pages
before flowing into a template (with "1|2|3" type paging icons at the bottom
of the page). I considered using a user-defined type code like "[pagebreak]"
that would allow content contributors to determine the page breaks
themselves when entering the article into the database. A parsing function
would grab the chunk of text/html between the appropriate [pagebreak] codes
for each page.
But this just doesn't seem a very elegant solution. Anyone know of a better
way to do this?
****************************************************************************
This message is intended for the sole use of the individual and entity to
whom it is addressed, and may contain information that is privileged,
confidential and exempt from disclosure under applicable law. If you are
not the intended addressee, nor authorized to receive for the intended
addressee, you are hereby notified that you may not use, copy, disclose or
distribute to anyone the message or any information contained in the
message. If you have received this message in error, please immediately
advise the sender by reply email and delete the message. Thank you very
much.
attached mail follows:
Hallo folks:
I have a bit of an issue with Paradox Table Searching...
I have a fairly large table (4MB+), here is the problem:
When I run a search for an element in the Table on
my localhost which is running Apache and php 4.1,
I have no issues with speed... However when I run it
on the Server at my work place, which is running IIS
Server (I am not sure which version), and the same
PHP version on my Workstation it takes ages to execute...
I have gotten suggestions and have revised my Script
over and over using odbc_exec() with SQL commands
SELECT myColumn FROM myTable, I have used
a COUNT SQL command suggested on this forum,
My general algorithm is as follows...
1) I create an Array using odbc_fetch_array this Array
contains one column from the Table I am searching...
2) Keep trying to matchup each element in the array
against the validation element being checked...
returning found within a sequential loop...
and eventually "Not Found"...
3) I suppose the sequential loop is whats killing me,
but the table is not ordered hence I am forced to
do a sequential search.. Does anyone else have
an idea for a quicker and much more efficient
algorithm...
Once again the issue of Speed is a non-factor on
my local machine running Apache but it does become a
factor when I run it on our Server, which is running an
IIS Server...
Thanks in advance...
Kondwani
attached mail follows:
Cool thanks, that probably will make my code execute a decent bit faster (as
the file gets larger).
But the array_search function never works for me (don't know why, I know
exactly what I'm searching for and that it is there), so I made my own
function..
//Find and return first occurance of a string ("$Find") in any line of
$LineArray
function FindKey($LineArray, $Find)
{
foreach($LineArray as $key => $value)
{
if (ereg($Find, $value))
return $key;
}
return FALSE;
} // END OF FindKey(...);
I think this combined with your code should help me a lot, thanks a ton.
"Analysis & Solutions" <danielc attached mail follows:
Is it possible to produce a PDF, use it as a template and populate
predefined sections of it from a database?
The PDFs I want to create are a little too complex for me to produce from
scratch.
// Tobias
attached mail follows:
Only using the commercial PDI library from pdflib.com
On Thu, 11 Jul 2002, Tobias Talltorp wrote:
> Is it possible to produce a PDF, use it as a template and populate
> predefined sections of it from a database?
> The PDFs I want to create are a little too complex for me to produce from
> scratch.
>
> // Tobias
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Articles for an online magazine will use one template and load content
dynamically from a MySQL database. Assets and images for each article will
be stored in their own folder: e.g., www.mysite.com/topic/article
Even though a physical HTML page will not exist at
www.mysite.com/topic/article, is there a way to load the appropriate
articles in the template without actually specifying a physical page name if
soemone types that URL into their browser? I'd prefer to send people to
www.mysite.com/topic/article instead of
www.mysite.com/topic/article/template.php?id=39403848
I realize this may be more of an Apache issue than PHP, but, thought I'd see
if anyone here has dealt with something similar.
Thanks!
Monty
>");
--
Sameh Attia
Senior System Engineer
T.E. Data
--
__ __ _
_________ _/ /_/ /_(_)___ _
/ ___/ __ `/ __/ __/ / __ `/
(__ ) /_/ / /_/ /_/ / /_/ /
/____/\__,_/\__/\__/_/\__,_/
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
anoyingmaillist.com with the subject "REMOVE"
>
>PHP
>===
>Can this wonder process things like that ????
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
localhost)
> by www.whateverdomain.com (8.10.2/8.10.2) id g69MEA527130;
> Tue, 9 Jul 2002 18:14:10 -0400
>Date: Tue, 9 Jul 2002 18:14:10 -0400
>Message-Id: 200207092214.g69MEA527130
www.
><mailto:200207092214.g69MEA527130
www.%20whateverdomain.com>
>whateverdomain.com
>
>I want to hide the *whateverdomain.com* (because is my hosting provider…
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
analysisandsolutions.com> wrote in message
>news:20020710030254.GA10805
panix.com...
>> On Tue, Jul 09, 2002 at 06:09:36PM -0700, Fargo Lee wrote:
>> >
>> > $status = system("mysql -umyuserid -pmypassword mydbname <
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
localhost php-4.2.1]# slocate httpd.h
>/usr/include/apache/httpd.h
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
kyboshed.com> wrote in message
news:08c501c22825$932917c0$0200a8c0
DANNYS...
> No, I just tested it myself - if you set a cookie with no expire date it
> exists until the browser window is closed.
>
> My code:
>
> <?php
>
> if (!isset($_COOKIE['TestCookie']))
> {
> setcookie ("TestCookie", "FUD");
> echo "Just Set a cookie - reload the page";
> }
> else
> {
> echo "Cookie is : {$_COOKIE['TestCookie']}<br>Close the window then
return
> and the cookie should be gone";
> }
>
> ?>
>
> HTH
>
> Danny.
>
> ----- Original Message -----
> From: "vins" <vins
webonline.co.za>
> To: <php-general
lists.php.net>
> Sent: Wednesday, July 10, 2002 3:34 PM
> Subject: [PHP] Re: cookies
>
>
> > Nope thats not they way....
> > If you don't specify a expire date it will live for ever or until you
> delete
> > it.
> >
> > The only way is to set it with an expiry date and then it will delete
> > it'self when the browser closes.
> > Check this by running a file on the same domain with phpinfo();
> >
> >
> > "Alexander Ross" <alexross
bleen.net> wrote in message
> > news:20020710134339.68660.qmail
pb1.pair.com...
> > > How can I set a cookie which expires when the borwser is closed?? How
> can
> > I
> > > delete a cookie via PHP?
> > >
> > > Thanks
> > >
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
phpbootcamp.com]
> Sent: 11 July 2002 10:54
>
> The "alternate syntax" with the colons is passe -- I think
> you'd have to dig
> pretty deep to find a script old enough that uses it for
> anything other than
> demonstration purposes. (Rasmus?)
lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
file_exists($pathname)){
# It's kinda hacky to ++ the empty string, but it avoids tacking on '0'
# to filenames that were fine as they were...
$appendix++;
$pathname = "$directory/$filename$appendix$extension";
# echo "extension $extension<BR>\n";
# echo "filename $filename<BR>\n";
# echo "appendix $appendix<BR>\n";
# echo "pathname $pathname<BR>\n";
}
if (move_uploaded_file($photo, $pathname)){
# Success!
}
else{
# Error message
}
?>
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
blah.com and if they are I would like to processes the mail
>body and subject line.
>
>I'm sure there are different languages to do all this in; mmmm, Perl 5.0
>for example but I like PHP ;-)
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
This email was sent with Ximian Evolution.
providence.org> 07/10/02 05:38PM >>>
I am too. I've developed an approach to coding with Dreamweaver that allows
me to take advantage of WYSIWYG and my own style of coding at the same time.
The MX version of Dreamweaver is supposed to add support for code snipets,
and a few other things. I'm looking forward to checking them out.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
SykesCanada.com
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
phpbootcamp.com> wrote in message
news:php.general-107088
news.php.net...
> >what does this mean:
> >
> >Warning: Cannot send session cache limiter - headers already sent (output
> >started at /home/.edy/alexross/bleen.net/forum/discussion_fns.php:88) in
> >/home/.edy/alexross/bleen.net/forum/index.php on line 5
>
> On line 88 in discussion_fns.php there is an echo or print or even just
some
> HTML, or *EVEN* just a blank line outside of <?php ?> tags.
>
> That is "content" which PHP had to send to the browser.
>
> Now, once PHP has to send content to the browser, it had to send all the
> headers first, then a blank line, then the content.
>
> Pretty much, that's why headers are called headers -- They come at the
> "head" of the HTML, with a blank line in between.
>
> Once all that went out to the browser, you can't call "header()" function,
> because, like, the train has left the station. You can still send more
HTML
> (jump on a box car) but you can't put anything on the front of the train.
> It's gone.
>
> --
> Like Music? http://l-i-e.com/artists.htm
> Off-Topic: What is the moral equivalent of 'cat' in Windows?
manordat.demon.co.uk> wrote in message
news:3D2DC323.1010507
manordat.demon.co.uk...
> Alexander Ross wrote:
>
> >I'm slowly beginning to undrestand this, but please bear with a php
novice.
> >When/how were the headers sent? In other words, how do I know that they
> >have already been sent?
> >
> Because something other than a header has gone out. As something other
> has gone out, it is not possible to send more headers. Thus headers that
> were to be sent must have already been sent. I interpret this error
> message as "Something other than headers has already been sent so you
> cannot send headers now.", (but then I have been known to be wrong).
>
> HTH
> Chris
>
manordat.demon.co.uk> 07/11/02 01:40PM >>>
Alexander Ross wrote:
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?
--
Like Music? http://l-i-e.com/artists.htm
--
JJ Harrison
webmaster
tececo.com
www.tececo.com
--
JJ Harrison
webmaster
tececo.com
www.tececo.com
overnetdata.com> wrote in message
news:iasqiu4s2p6q4cobbldld4qhj2p6osvi0o
4ax.com...
> On Thu, 11 Jul 2002 21:00:36 +1000, you wrote:
>
> >How do I output a static image through a php script?
> >
> >it had something to do with headers but I can't remember exactly what.
>
> You need to output the correct content-type header for the image (eg
> image/gif), take it's size and output it as content-length, and
> suppress error reporting. Then output the image data.
>
capitol.cz
Capitol Internet Publisher, Korunovacni 6, 170 00 Prague 7, Czech Republic
tel.: ++420 2 3337 1117, fax: ++420 2 3337 1112
capitol.cz
> Capitol Internet Publisher, Korunovacni 6, 170 00 Prague 7, Czech Republic
> tel.: ++420 2 3337 1117, fax: ++420 2 3337 1112
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
splatted.net]
> Sent: 09 July 2002 19:51
> To: php-windows
lists.php.net
> Subject: [PHP-WIN] More bzip woes! No file written...
>
>
> Hi ng!
>
> Well, I have finally managed to make my archive (thanks to being
> set on the
> right track by this ng), yet I am having a problem using the bz2
> functions...
>
> The code I am using to make the compressed file is as follows:
>
> $data = implode ("", file ("$filename.tar"));
> $bz = bzopen ("$filename.bz2", "wb");
> bzwrite ($bz, $data);
> bzclose ($bz);
>
> (The tar file has been created previously in the script.)
> I have checked permissions on the directory in question (I have
> even opened
> them wide up for dev purposes) and yet the script fails withthe following
> error:
>
> Warning: bzopen(): Unable to open file in
> e:\apache\splatted.net\download_basket.php on line 53
>
> Has anyone here got any ideas?
>
> regards,
>
> Mikey
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
--
me
oceania.net>
To: <php-general
lists.php.net>
Sent: Thursday, July 11, 2002 1:49 PM
Subject: [PHP] PHP 4.3.0-dev and gd
wiegmann.net> 07/11/02 09:11AM >>>
I have been trying this to no avail.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
nrc.gov> 07/11/02 09:29AM >>>
You'd have to separate it like so:
wiegmann.net> 07/11/02 09:11AM >>>
I have been trying this to no avail.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
iitri.org> wrote in message
news:20020711134158.89351.qmail
pb1.pair.com...
> I am attempting to connect to a MSSQL 2000 database from a linux box. I
> have installed freetds successfully and configured php with sybase as
> directed by freetds.
>
> I configured the freetds .conf file. However this is where I have
> questions. The freetds.conf file only asks for the ip address of the
> database server. I have mulitple databases on my database server. How do
I
> specify the database that I'm trying to reach?
>
> Are there any configuration flags that I could be missing to use
> odbc_connect, etc.?
>
> Any help would be greatly appreciated.
>
> Tim
>
>
cryptocomm.com
cryptocomm.com> wrote in message
news:1026395892.2307.2.camel
beowulf.cryptocomm.com...
> Check out the "mssql_select_db" function.
> Call it right after the connection open.
>
> Adam Voigt
> adam.voigt
cryptocomm.com
>
> On Thu, 2002-07-11 at 12:31, Tim Nields wrote:
> > I am attempting to connect to a MSSQL 2000 database from a linux box. I
> > have installed freetds successfully and configured php with sybase as
> > directed by freetds.
> >
> > I configured the freetds .conf file. However this is where I have
> > questions. The freetds.conf file only asks for the ip address of the
> > database server. I have mulitple databases on my database server. How
do I
> > specify the database that I'm trying to reach?
> >
> > Are there any configuration flags that I could be missing to use
> > odbc_connect, etc.?
> >
> > Any help would be greatly appreciated.
> >
> > Tim
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
cryptocomm.com
cryptocomm.com> wrote in message
> news:1026395892.2307.2.camel
beowulf.cryptocomm.com...
> > Check out the "mssql_select_db" function.
> > Call it right after the connection open.
> >
> > Adam Voigt
> > adam.voigt
cryptocomm.com
> >
> > On Thu, 2002-07-11 at 12:31, Tim Nields wrote:
> > > I am attempting to connect to a MSSQL 2000 database from a linux box. I
> > > have installed freetds successfully and configured php with sybase as
> > > directed by freetds.
> > >
> > > I configured the freetds .conf file. However this is where I have
> > > questions. The freetds.conf file only asks for the ip address of the
> > > database server. I have mulitple databases on my database server. How
> do I
> > > specify the database that I'm trying to reach?
> > >
> > > Are there any configuration flags that I could be missing to use
> > > odbc_connect, etc.?
> > >
> > > Any help would be greatly appreciated.
> > >
> > > Tim
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
cryptocomm.com> wrote in message
news:1026396309.1609.4.camel
beowulf.cryptocomm.com...
> I wouldn't have said it if it did.
> Notice that it's MSSQL_select_db not MYSQL_select_db.
>
> Adam Voigt
> adam.voigt
cryptocomm.com
>
> On Thu, 2002-07-11 at 10:03, Michael Davey wrote:
> > Errr - doesn't that function apply to mySQL databases only?
> >
> > Mikey
> >
> > "Adam Voigt" <adam.voigt
cryptocomm.com> wrote in message
> > news:1026395892.2307.2.camel
beowulf.cryptocomm.com...
> > > Check out the "mssql_select_db" function.
> > > Call it right after the connection open.
> > >
> > > Adam Voigt
> > > adam.voigt
cryptocomm.com
> > >
> > > On Thu, 2002-07-11 at 12:31, Tim Nields wrote:
> > > > I am attempting to connect to a MSSQL 2000 database from a linux
box. I
> > > > have installed freetds successfully and configured php with sybase
as
> > > > directed by freetds.
> > > >
> > > > I configured the freetds .conf file. However this is where I have
> > > > questions. The freetds.conf file only asks for the ip address of
the
> > > > database server. I have mulitple databases on my database server.
How
> > do I
> > > > specify the database that I'm trying to reach?
> > > >
> > > > Are there any configuration flags that I could be missing to use
> > > > odbc_connect, etc.?
> > > >
> > > > Any help would be greatly appreciated.
> > > >
> > > > Tim
> > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > >
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
cryptocomm.com> wrote in message
news:1026396309.1609.4.camel
beowulf.cryptocomm.com...
> I wouldn't have said it if it did.
> Notice that it's MSSQL_select_db not MYSQL_select_db.
>
> Adam Voigt
> adam.voigt
cryptocomm.com
>
> On Thu, 2002-07-11 at 10:03, Michael Davey wrote:
> > Errr - doesn't that function apply to mySQL databases only?
> >
> > Mikey
> >
> > "Adam Voigt" <adam.voigt
cryptocomm.com> wrote in message
> > news:1026395892.2307.2.camel
beowulf.cryptocomm.com...
> > > Check out the "mssql_select_db" function.
> > > Call it right after the connection open.
> > >
> > > Adam Voigt
> > > adam.voigt
cryptocomm.com
> > >
> > > On Thu, 2002-07-11 at 12:31, Tim Nields wrote:
> > > > I am attempting to connect to a MSSQL 2000 database from a linux
box. I
> > > > have installed freetds successfully and configured php with sybase
as
> > > > directed by freetds.
> > > >
> > > > I configured the freetds .conf file. However this is where I have
> > > > questions. The freetds.conf file only asks for the ip address of
the
> > > > database server. I have mulitple databases on my database server.
How
> > do I
> > > > specify the database that I'm trying to reach?
> > > >
> > > > Are there any configuration flags that I could be missing to use
> > > > odbc_connect, etc.?
> > > >
> > > > Any help would be greatly appreciated.
> > > >
> > > > Tim
> > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > >
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
cryptocomm.com
cryptocomm.com> wrote in message
> news:1026396309.1609.4.camel
beowulf.cryptocomm.com...
> > I wouldn't have said it if it did.
> > Notice that it's MSSQL_select_db not MYSQL_select_db.
> >
> > Adam Voigt
> > adam.voigt
cryptocomm.com
> >
> > On Thu, 2002-07-11 at 10:03, Michael Davey wrote:
> > > Errr - doesn't that function apply to mySQL databases only?
> > >
> > > Mikey
> > >
> > > "Adam Voigt" <adam.voigt
cryptocomm.com> wrote in message
> > > news:1026395892.2307.2.camel
beowulf.cryptocomm.com...
> > > > Check out the "mssql_select_db" function.
> > > > Call it right after the connection open.
> > > >
> > > > Adam Voigt
> > > > adam.voigt
cryptocomm.com
> > > >
> > > > On Thu, 2002-07-11 at 12:31, Tim Nields wrote:
> > > > > I am attempting to connect to a MSSQL 2000 database from a linux
> box. I
> > > > > have installed freetds successfully and configured php with sybase
> as
> > > > > directed by freetds.
> > > > >
> > > > > I configured the freetds .conf file. However this is where I have
> > > > > questions. The freetds.conf file only asks for the ip address of
> the
> > > > > database server. I have mulitple databases on my database server.
> How
> > > do I
> > > > > specify the database that I'm trying to reach?
> > > > >
> > > > > Are there any configuration flags that I could be missing to use
> > > > > odbc_connect, etc.?
> > > > >
> > > > > Any help would be greatly appreciated.
> > > > >
> > > > > Tim
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
pnts.com> wrote in message
news:3D2CC493.7020109
pnts.com...
> List,
> I'm trying to set a cookie like this:
> <?php
> function redirect() {
[..snip..]
hotmail.com]
> Sent: 10 July 2002 22:57
>
> Is their 1 function method to remove an element within an
> array using its
> key instead of its position within the element?
lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
sitedesign.net> 07/11/02 10:42AM >>>
I want to acheive something like this
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
ninti.com
--------------------------------
--
Tyler Longren
Captain Jack Communications
tyler
captainjack.com
www.captainjack.com
ninti.com> wrote:
ninti.com
> --------------------------------
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
captainjack.com
> www.captainjack.com
>
>
>
> On Fri, 12 Jul 2002 10:02:40 +0930 (CST)
> Michael Hall <olc
ninti.com> wrote:
>
> >
> > Another PHP compilation question ...
> >
> > I've just compiled PHP 4.2.1 --with-mysql. I added no path to mysql,
> > and it worked fine as it always does. However, I'm keen to add
> > mod_python as a DSO to Apache as well, and noticed in PHP's INSTALL
> > notes that I'll probably need to recompile PHP with a path to mysql:
> >
> > --with-mysql=/somewhere/or/other/
> >
> > 1. Is this always the case?
> >
> > 2. Where would the path be likely to be on RedHat 7.2 with MySQL rpms?
> >
> > TIA
> >
> > --------------------------------
> > Michael Hall ninti
ninti.com
> > --------------------------------
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
ninti.com
--------------------------------
captainjack.com
> > www.captainjack.com
> >
> >
> >
> > On Fri, 12 Jul 2002 10:02:40 +0930 (CST)
> > Michael Hall <olc
ninti.com> wrote:
> >
> > >
> > > Another PHP compilation question ...
> > >
> > > I've just compiled PHP 4.2.1 --with-mysql. I added no path to mysql,
> > > and it worked fine as it always does. However, I'm keen to add
> > > mod_python as a DSO to Apache as well, and noticed in PHP's INSTALL
> > > notes that I'll probably need to recompile PHP with a path to mysql:
> > >
> > > --with-mysql=/somewhere/or/other/
> > >
> > > 1. Is this always the case?
> > >
> > > 2. Where would the path be likely to be on RedHat 7.2 with MySQL rpms?
> > >
> > > TIA
> > >
> > > --------------------------------
> > > Michael Hall ninti
ninti.com
> > > --------------------------------
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
>
--
--------------------------------
n i n t i . c o m
php-python-perl-mysql-postgresql
--------------------------------
Michael Hall ninti
ninti.com
--------------------------------
ninti.com
--------------------------------
--
Tyler Longren
Captain Jack Communications
tyler
captainjack.com
www.captainjack.com
ninti.com> wrote:
ninti.com
> --------------------------------
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
datavisibility.co.uk
webhart.net]
Sent: 11 July 2002 16:26
To: php-general
lists.php.net
Subject: [PHP] How to set focus in a form field
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
webhart.net]
> Sent: Thursday, July 11, 2002 11:26 AM
> To: php-general
lists.php.net
> Subject: [PHP] How to set focus in a form field
>
>
> I have an annoying 'glitch' in the forms on my site:
>
> When a page loads, if it has a form on it, I would like the cursor to move
> to the first field, be 'set' - that is, I should see a cursor or blinking
> cursor in the first field.
>
> As it is now, on some pages, I either have to 'tab' to the first field, or
> click themouse in that field.
>
> Is there anyway to automate this, so that when a page loads it
> automatically goes to the first field, and 'highlights' the entry area?
> (Btw, I tried 'tabindex=1' but it still does not do what I'd like it to.
>
> Any ideas, suggestions, or admontions gratefully accepted.
>
> Tia, Andre
healthcore.com>
To: <php-general
lists.php.net>
Sent: Thursday, July 11, 2002 8:32 AM
Subject: [PHP] How to know if we're using http or https
healthcore.com]
> Sent: 11 July 2002 4:33 PM
> To: php-general
lists.php.net
> Subject: [PHP] How to know if we're using http or https
>
>
> Hello all!
>
> Is there a flag that would tell me if the page requested is
> using SSL, by
> https, or regular http?
>
> I'm not sure I could get that from PHP, or from Apache/PHP.
>
> Thanks for your help.
>
>
> Jean-Louis
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
nist.gov>
To: <php-general
lists.php.net>
Sent: Thursday, July 11, 2002 11:38 AM
Subject: can you do exec under Windows OS?
--
.-----------------.
| Robert Cummings |
:-----------------`----------------------------.
| Webdeployer - Chief PHP and Java Programmer |
:----------------------------------------------:
| Mail : mailto:robert.cummings
webmotion.com |
| Phone : (613) 731-4046 x.109 |
:----------------------------------------------:
| Website : http://www.webmotion.com |
| Fax : (613) 260-9545 |
`----------------------------------------------'
webmotion.com]
> Sent: 11 July 2002 4:44 PM
> To: php-general
lists.php.net
> Subject: [PHP] Getting the URL that triggered a 404.
>
>
>
> When the 404 is caught and a PHP script is executed there doesn't
> appear to be any information in the environment variables indicating
> what URL triggered the 404. Could someone tell me how to obtain that
> information?
>
> Cheers,
> Rob.
> --
> .-----------------.
> | Robert Cummings |
> :-----------------`----------------------------.
> | Webdeployer - Chief PHP and Java Programmer |
> :----------------------------------------------:
> | Mail : mailto:robert.cummings
webmotion.com |
> | Phone : (613) 731-4046 x.109 |
> :----------------------------------------------:
> | Website : http://www.webmotion.com |
> | Fax : (613) 260-9545 |
> `----------------------------------------------'
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
lennox-mckinlay.co.uk]
Sent: Thursday, July 11, 2002 12:00 PM
To: Robert Cummings; php-general
lists.php.net
Subject: RE: [PHP] Getting the URL that triggered a 404.
webmotion.com]
> Sent: 11 July 2002 4:44 PM
> To: php-general
lists.php.net
> Subject: [PHP] Getting the URL that triggered a 404.
>
>
>
> When the 404 is caught and a PHP script is executed there doesn't
> appear to be any information in the environment variables indicating
> what URL triggered the 404. Could someone tell me how to obtain that
> information?
>
> Cheers,
> Rob.
> --
> .-----------------.
> | Robert Cummings |
> :-----------------`----------------------------.
> | Webdeployer - Chief PHP and Java Programmer |
> :----------------------------------------------:
> | Mail : mailto:robert.cummings
webmotion.com |
> | Phone : (613) 731-4046 x.109 |
> :----------------------------------------------:
> | Website : http://www.webmotion.com |
> | Fax : (613) 260-9545 |
> `----------------------------------------------'
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
.-----------------.
| Robert Cummings |
:-----------------`----------------------------.
| Webdeployer - Chief PHP and Java Programmer |
:----------------------------------------------:
| Mail : mailto:robert.cummings
webmotion.com |
| Phone : (613) 731-4046 x.109 |
:----------------------------------------------:
| Website : http://www.webmotion.com |
| Fax : (613) 260-9545 |
`----------------------------------------------'
localhost/auth",
"table" => "auth",
"usernamecol" => "username",
"passwordcol" => "password"
);
nextra.no (apparently the
same as abuse
online.no):
--
Consultant-ID 23
Abuse Response Team, Telenor Business Solutions
Email: abuse
nextra.no Fax: +47 22 77 19 98
http://www.online.no/abuse (Norwegian only)
nextra.no (apparently the
> same as abuse
online.no):
>
> Dear mr. Soza,
>
> At 11:27 10.07.2002 -0800, you wrote:
> >It appears that you do have the full headers of the message in
> >question, as they appeared on my machine. Since Mr. Hegreberg was
> >sending these messages to a mailing list, the headers mostly show the
> >mailing list information.
>
> The headers you sent did not contain the necessary information. It
> seems the mailing-list strips away the important part of the headers,
> so that none of the headers you've received are sufficient.
>
> We recommend that you contact the list administrator and ask if he/she
> can fix the problems with headers being removed, and if he has the
> original headers so that we can track down the users.
>
>
> --
> Consultant-ID 23
> Abuse Response Team, Telenor Business Solutions
> Email: abuse
nextra.no Fax: +47 22 77 19 98
> http://www.online.no/abuse (Norwegian only)
>
>
> Jason Soza
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
nextra.no (apparently the
>same as abuse
online.no):
---
Glenn E. Sieb
System Administrator
Lumeta Corporation
+1 732 357-3514 (V)
+1 732 564-0731 (Fax)
lumeta.co|
| | m> |
| | |
| | 07/11/02 12:26|
| | PM |
| | |
|--------+------------------------>
>---------------------------------------------------------------------------------------------------------------------------------------------|
| |
| To: php-general
lists.php.net |
| cc: |
| Subject: Re: [PHP] (OT) No Punishment for Erik Hegreberg, Yet... |
>---------------------------------------------------------------------------------------------------------------------------------------------|
nextra.no (apparently the
>same as abuse
online.no):
---
Glenn E. Sieb
System Administrator
Lumeta Corporation
+1 732 357-3514 (V)
+1 732 564-0731 (Fax)
php.net> wrote in message
news:Pine.LNX.4.44.0207110915120.7082-100000
www.lerdorf.com...
> No such logs are kept on our end.
>
> On Thu, 11 Jul 2002, Jason Soza wrote:
>
> > Well, my attempts at getting discipline for Erik Hegreberg will have to
> > go unfinished for now. I guess a list admin would have to retrieve the
> > original headers from Erik's original posts -before- they hit the
> > mailing list software and got new headers and distributed. Any list
> > admins out there want to help with that?
> >
> > Seems kind of silly - if they keep e-mail transaction logs and they
> > know the e-mail account of Mr. Hegreberg, they should be able to
> > correlate my complaint. Oh well, 'twas a valiant effort!
> >
> > Thanks everyone yesterday for sending me those headers.
> >
> > In any case, here's the response from abuse
nextra.no (apparently the
> > same as abuse
online.no):
> >
> > Dear mr. Soza,
> >
> > At 11:27 10.07.2002 -0800, you wrote:
> > >It appears that you do have the full headers of the message in
> > >question, as they appeared on my machine. Since Mr. Hegreberg was
> > >sending these messages to a mailing list, the headers mostly show the
> > >mailing list information.
> >
> > The headers you sent did not contain the necessary information. It
> > seems the mailing-list strips away the important part of the headers,
> > so that none of the headers you've received are sufficient.
> >
> > We recommend that you contact the list administrator and ask if he/she
> > can fix the problems with headers being removed, and if he has the
> > original headers so that we can track down the users.
> >
> >
> > --
> > Consultant-ID 23
> > Abuse Response Team, Telenor Business Solutions
> > Email: abuse
nextra.no Fax: +47 22 77 19 98
> > http://www.online.no/abuse (Norwegian only)
> >
> >
> > Jason Soza
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
php.net> wrote in message
> news:Pine.LNX.4.44.0207110915120.7082-100000
www.lerdorf.com...
> > No such logs are kept on our end.
> >
> > On Thu, 11 Jul 2002, Jason Soza wrote:
> >
> > > Well, my attempts at getting discipline for Erik Hegreberg will have to
> > > go unfinished for now. I guess a list admin would have to retrieve the
> > > original headers from Erik's original posts -before- they hit the
> > > mailing list software and got new headers and distributed. Any list
> > > admins out there want to help with that?
> > >
> > > Seems kind of silly - if they keep e-mail transaction logs and they
> > > know the e-mail account of Mr. Hegreberg, they should be able to
> > > correlate my complaint. Oh well, 'twas a valiant effort!
> > >
> > > Thanks everyone yesterday for sending me those headers.
> > >
> > > In any case, here's the response from abuse
nextra.no (apparently the
> > > same as abuse
online.no):
> > >
> > > Dear mr. Soza,
> > >
> > > At 11:27 10.07.2002 -0800, you wrote:
> > > >It appears that you do have the full headers of the message in
> > > >question, as they appeared on my machine. Since Mr. Hegreberg was
> > > >sending these messages to a mailing list, the headers mostly show the
> > > >mailing list information.
> > >
> > > The headers you sent did not contain the necessary information. It
> > > seems the mailing-list strips away the important part of the headers,
> > > so that none of the headers you've received are sufficient.
> > >
> > > We recommend that you contact the list administrator and ask if he/she
> > > can fix the problems with headers being removed, and if he has the
> > > original headers so that we can track down the users.
> > >
> > >
> > > --
> > > Consultant-ID 23
> > > Abuse Response Team, Telenor Business Solutions
> > > Email: abuse
nextra.no Fax: +47 22 77 19 98
> > > http://www.online.no/abuse (Norwegian only)
> > >
> > >
> > > Jason Soza
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
gci.net> wrote in message
news:baf38c08f3.c08f3baf38
snowy.gci.net...
> Well, my attempts at getting discipline for Erik Hegreberg will have to
> go unfinished for now. I guess a list admin would have to retrieve the
> original headers from Erik's original posts -before- they hit the
> mailing list software and got new headers and distributed. Any list
> admins out there want to help with that?
>
> Seems kind of silly - if they keep e-mail transaction logs and they
> know the e-mail account of Mr. Hegreberg, they should be able to
> correlate my complaint. Oh well, 'twas a valiant effort!
>
> Thanks everyone yesterday for sending me those headers.
>
> In any case, here's the response from abuse
nextra.no (apparently the
> same as abuse
online.no):
>
> Dear mr. Soza,
>
> At 11:27 10.07.2002 -0800, you wrote:
> >It appears that you do have the full headers of the message in
> >question, as they appeared on my machine. Since Mr. Hegreberg was
> >sending these messages to a mailing list, the headers mostly show the
> >mailing list information.
>
> The headers you sent did not contain the necessary information. It
> seems the mailing-list strips away the important part of the headers,
> so that none of the headers you've received are sufficient.
>
> We recommend that you contact the list administrator and ask if he/she
> can fix the problems with headers being removed, and if he has the
> original headers so that we can track down the users.
>
>
> --
> Consultant-ID 23
> Abuse Response Team, Telenor Business Solutions
> Email: abuse
nextra.no Fax: +47 22 77 19 98
> http://www.online.no/abuse (Norwegian only)
>
>
> Jason Soza
>
>
analysisandsolutions.com> wrote in message
news:20020711053247.GB21354
panix.com...
> On Thu, Jul 11, 2002 at 02:11:30PM +1000, Martin Towell wrote:
> >> From: Chris Earle [mailto:chris
earleweb.com]
> >>
> >> I was wondering if there was a function that would allow me to "jump"
> >> to a certain line if a file and then write from there? I'm searching
> >> php.net without any luck :(.
> >
> > I dodn't know of any single function that does what you want, but you
can do
> > this:
> >
> > $contents = file($filename); // each line has it's own array position
> > $contents[$line] = $newline;
>
> That's nice, except you could start overwriting existing data.
>
> If you're only interested in appending to the end of a file, then use
> $fp = fopen('filename', 'a+');
> and fputs() all you want.
>
> But, if you want to stick stuff into the middle...
>
> # Real process uses file(),
> # but for test, set Content manually.
> $Content[] = 'The start of the content array.';
> $Content[] = 'Some more stuff.';
> $Content[] = 'And yet more stuff.';
>
> $Location = array_search('Some more stuff.', $Content);
>
> $New[] = 'Why, here is some new stuff';
>
> $Final = array_merge(
> array_slice($Content, 0, $Location + 1),
> $New,
> array_slice($Content, 0 - (count($Content) - $Location - 1))
> );
>
> # In your process, you'll really want to insert
> # implode('', $Final) into the file with fputs(),
> # but, hey, this is a demonstration.
> print_r($Final);
>
>
> --Dan
>
> --
> PHP classes that make web design easier
> SQL Solution | Layout Solution | Form Solution
> sqlsolution.info | layoutsolution.info | formsolution.info
> T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
> 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409