[PHP] Yo: webmaster@php.net dude

2001-11-16 Thread jtjohnston

Hmmm. Well they both work. Now I've learned two ways :)

Coming from Perl, Javascript, Delphi, ASP, etc. it's always fun to know
someone has done something different.

  if (!strpos(...))
  will be better...
 Why?

The only thing I would love to know is why isn't error checking more
precise/helpful. If I leave off a { by accident, why can't the error
say:
Duh! ERROR!! Alarm, alarm, alarm
You left of a } ya idiot!
Go look NEAR something and correct it stupid! g

I - at least - am cheap and use Wordpad to do my PHPing. Looking up line
numbers SUuuucks.
@ O
-~-
 U
One advantage to Perl. Maybe the only one left!

IS ANYONE LISTENING!!

Thanks, g

John



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Regular expressions?

2001-11-16 Thread Jack Dempsey

If you'd really like to develop your regex skills, and everyone should,
pickup Mastering Regular Expressions by Jeffrey Friedl(O'Reilly Press). Its
the best out there, and will probably teach you more than you thought
possible.

Jack

-Original Message-
From: Martin Thoma [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 16, 2001 2:31 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Regular expressions?


Hello!

I need to search for strings between html-tags. For example, I need to
know if the String Searchstring is between H2 and /H2
(case-insensitive).

How is it done?

I think I need regular expressions, but I have no idea about it. I'm not
getting to clever out of the php-documentaion. Where can I start to
learn reg-exp? Should I use the ereg- oder preg-functions? Help!

Martin



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: strpos

2001-11-16 Thread jtjohnston

Andrew Kirilenko wrote:

 Oops. Forgot about 0 return ;(

Which means ???
They both work for me, yeah? No?

This tells me that the user made a boo boo:

 if((strpos($yourimage, \.jpg) !== false) || (strpos($yourimage, \.jpeg)
!== false))

So what does this do?

if((!strpos($yourimage, .jpg)) || (!strpos($yourimage, .jpeg)))


J


  -Original Message-
  From: Martin Thoma [mailto:[EMAIL PROTECTED]]
  Sent: Friday, November 16, 2001 9:42 AM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] Re: strpos
 
 
   if (!strpos(...))
   will be better...
 
  Why?
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: JPG Images from database to filename.jpg

2001-11-16 Thread jtjohnston

See these. Reduire.phps probably has what you want.

 http://www.collegesherbrooke.qc.ca/si/php/exemples/photos/afficher.phps
 http://www.collegesherbrooke.qc.ca/si/php/exemples/photos/charger.phps
 http://www.collegesherbrooke.qc.ca/si/php/exemples/photos/lire_binaire.phps

 http://www.collegesherbrooke.qc.ca/si/php/exemples/photos/reduire.phps



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] custom errors

2001-11-16 Thread Oosten, Sjoerd van


Hi,

I know how to make an error message when the connection is lost with the
database, with the @ and the OR DIE in the connection with the database.


Is there also a way to display a custom error message when this error is
displaid?

Warning: Supplied argument is not a valid MySQL result resource in
/opt/guide/www.domain.nl/HTML/inc/menu.php on line 34

Thanks,

Sjoerd


Sjoerd van Oosten 
Digitaal vormgever [EMAIL PROTECTED]
Datamex E-sites B.V. 
http://www.esites.nl
Minervum 7368 Telefoon: (076) 5 730 730 
4817 ZH BREDA Telefax: (076) 5 877 757 
___


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] How to save a dynamic search result for later use as a static page?

2001-11-16 Thread Tom Smith

Hi All,
Here is the problem:
I have a quey building form that returns results from a database as a form to generate 
a new query.
On open, it shows a form, then on submit it shows resutls that are in a form 
(checkboxes that let
you omit that record from the next query by $id).

What I want to do is let the user save the page to show others in his group. First I 
though of
saving the query, but then it seemed simpler to just save the resutling html to a file 
that could be
referenced in email.

How do you get the current page to slurp into a file along with all the current 
variables?

On an unrelated note, it seems like I'm generating the restults twice. Any input on 
how to
stream-line it?

full script:
?php
if ($save) { //save is a hidden field, will always be true so that I can test fwriting 
to saved.html
$fp = fopen(/home/www/html/locations/site/saved.html, w);
//$fp = fopen(saved.html, w);
//fflush($fp);
//fpassthru($fp);
fwrite($fp, ??); 
}

# ln -s index.php omit.php
# This file is a search form/query builder with the ability to 
# pare down a result set.
function Refine($query, $to_omit) {

$query = str_replace(order by locations.id, AND , $query);

/* //debug:
foreach ($HTTP_POST_VARS as $k = $v){
echo k: $k, v: pre$v/pre;
}
*/  
if ($to_omit) {
trim($to_omit);
$arr_to_omit = explode( , $to_omit);
array_pop($arr_to_omit);
foreach($arr_to_omit as $v) {
$query .= locations.id != '$v' AND \n;

}

}

$query = chop($query);  
$query = substr_replace($query, '', -3, 3);

$query .=  order by locations.id;
$query = str_replace(~, ', $query);
return $query;
}


?
html
headtitleLocations search/title
link rel=stylesheet href=images/klamath.css type=text/css

script language=JavaScript
!-- hide from old browser//
function checkOmit() {
var form = document.refine
form.to_omit.value = ''
for (var i = 0; i  (form.omit.length); i++) {
if (form.omit[i].checked) {
form.to_omit.value += (form.omit[i].value) + ' '
}
}
return true
}
//quit hiding --
/script

/head
body bgcolor=#6E89AB

?php
$db = mysql_connect(localhost, user, password)
or die (No connection);

mysql_select_db(locations,$db)
or die (No select db);







if ($submit == 'refine') {

Refine($query, $to_omit);

//debug:
//  echo h2After function calll we get:/h2\$query\;

/* //debug:
$headers = getallheaders();
while (list ($header, $value) = each ($headers)) {
echo $header: $valuebr\n;
}
*/


$res = mysql_query ($query, $db) 
or die (brBad query, comrade. line 77, number: .mysql_errno()., . 
mysql_error());
$query = str_replace(', ~, $query); //gotta hack 2wice

$numrows = mysql_numrows($res);

if($numrows  1) {
echo Nope, nothing like that.;
}

echo h2Refined Results:/h2\n;
echo form name=refine onSubmit='return checkOmit();' method=post\n;
echo input type=hidden name=query value=\$query\br;
echo input type=hidden name=refine value=true\n;
echo input type=hidden name=to_omit value='$to_omit'\n;
echo input type=hidden name=save value='save'\n;


echo tabletrtd background='images/bg-menu.gif'valign=top\n;
include menu.php;
echo /tdtd\n;

echo table align=center width=95%\n; 
echo tr 
bgcolor=silvertdThumbnail/tdtdAddress/tdtdContact/td/tr\n;

$c = 0;

while (($row = mysql_fetch_array ($res))  $numrows  0) {

$c++;
$id = $row[id];
$loc_name = $row[loc_name];
$folder = $row[folder];
$thumb = $row[thumb];
$address = $row[address];
$city = $row[city];
$state = $row[state];
$zip = $row[zip];
$contact_id = $row[contact_id];
$name = $row[name];


if(strlen($description)  150) {
$description = substr($row[description], 0, 150).'...';
}


$type = $row[type];

if ($c % 2 == 0) {
$bg = bgcolor=lightgrey;
} else {
$bg = 'bgcolor=white';
}

echo tr $bg\n
tdinput type=checkbox name=omit value=$idOmitbr\n

a href='$PHP_SELF?id=$id'img src='$folder/thumbs/$thumb'/a/td\n

  

Re: [PHP] Jump to internal link after $PHP_SELF post

2001-11-16 Thread Rob van Jaarsveld

Hi Chris, Just a small modification and it works!!!
Many thanks!

Syntax:
onclick=\document.pageform.action='$PHP_SELF#$value'; submit()\




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Sending mail without using mail()

2001-11-16 Thread Jaime Iniesta Aleman



Ok, where can I find a tutorial about sending mail using fsockopen ?

***

 Hi, is it possible to send SMTP mail if the server where are my pages
 hosted forbids the use of the mail() function ? I mean, by opening a
 sockets connection to an external SMTP server and writing the commands
 there directly...

Yes, *IF*:

The ISP was not smart enough to realize this and didn't disable the
http://php.net/fsockopen function

Your SMTP server will accept connections from your web-server.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Sending mail without using mail()

2001-11-16 Thread Johan Holst Nielsen

 Ok, where can I find a tutorial about sending mail using fsockopen ?
 
 ***

http://www.phpbuilder.com/columns/tim19990221.php3

Regards,
Johan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Display gif/jpg etc.?

2001-11-16 Thread Raymond

Hi !

Do I have to edit mu ini file to display pictures with php? Is it possible
to have pictures in include files?


Best regards

Ramyond LIlleødegård



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: custom errors

2001-11-16 Thread CC Zona

In article C9F89DA57491D511BDAF00E0180C348103BFC0@ESADM01,
 [EMAIL PROTECTED] (Sjoerd Van Oosten) wrote:

 Is there also a way to display a custom error message when this error is
 displaid?
 
 Warning: Supplied argument is not a valid MySQL result resource in
 /opt/guide/www.domain.nl/HTML/inc/menu.php on line 34

http://www.php.net/manual/en/ref.errorfunc.php
http://www.php.net/manual/en/function.mysql-errno.php 
http://www.php.net/manual/en/function.mysql-error.php

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP with ORACLE 8i/9i

2001-11-16 Thread Steve Haemelinck

Question:

I want to build php withd support for ORACLE 8i or 9i.
Normally you use the option with-oci=path-to-oraclehome.  So far so good.
How can I achieve this when the oracle database is running on another
server?

Thx

Haemelinck Steve

Haemelinck.be - Developers Unite (Under construction )
http://www.haemelinck.com
http://www.haemelinck.be:8080/
[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] link to a pdf file

2001-11-16 Thread Oosten, Sjoerd van

Hello, a question again. 

I have a pdf file which can be downloaded. How can i link to this file so,
that the file isn't opened in the browser (if acrobat reader is installed)
but the file download popup appears?

Greetings,


Sjoerd van Oosten 
Digitaal vormgever [EMAIL PROTECTED]
Datamex E-sites B.V. 
http://www.esites.nl
Minervum 7368 Telefoon: (076) 5 730 730 
4817 ZH BREDA Telefax: (076) 5 877 757 
___


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Filling a text field from a different window

2001-11-16 Thread Carlo Loiudice

Hi, I'm Carlo.

Is there a way (probably javascript) to fill a text
field (or another form object) selecting from a select
box on a window different from that where's the text
filed ?

Ciao, Carlo

__

Abbonati a Yahoo! ADSL con Atlanet!
Naviga su Internet ad alta velocità, e senza limiti di tempo! 
Per saperne di più vai alla pagina http://adsl.yahoo.it

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Filling a text field from a different window

2001-11-16 Thread _lallous

You can do that only if you've got a reference to the window you want to
change its properties.

the reference is obtained like this:

script
var w = window.open('file.htm');
w.document.theform.theControl.theProperty = someValue here;
/script

Carlo loiudice [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi, I'm Carlo.

 Is there a way (probably javascript) to fill a text
 field (or another form object) selecting from a select
 box on a window different from that where's the text
 filed ?

 Ciao, Carlo

 __

 Abbonati a Yahoo! ADSL con Atlanet!
 Naviga su Internet ad alta velocità, e senza limiti di tempo!
 Per saperne di più vai alla pagina http://adsl.yahoo.it




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Copying into another table

2001-11-16 Thread _lallous

Hello!

Is there is anyway to copy from a table to another but by applying a filter?

Example:

SELECT * FROM table1 WHERE (condition)
INSERT INTO table2 (the results of the last query)



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Copying into another table

2001-11-16 Thread Alexander Weber

_lallous wrote:
 
 Hello!
 
 Is there is anyway to copy from a table to another but by applying a filter?
 
 Example:
 
 SELECT * FROM table1 WHERE (condition)
 INSERT INTO table2 (the results of the last query)

Just try this one:
INSERT INTO table2 SELECT * FROM table1 WHERE (condition)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Copying into another table

2001-11-16 Thread Andrey Hristov

 INSERT INTO table2 SELECT * FROM table1 WHERE (condition);

Easy, isn't it *grin*

Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS


- Original Message - 
From: _lallous [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 16, 2001 1:16 PM
Subject: [PHP] Copying into another table


 Hello!
 
 Is there is anyway to copy from a table to another but by applying a filter?
 
 Example:
 
 SELECT * FROM table1 WHERE (condition)
 INSERT INTO table2 (the results of the last query)
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP with ORACLE 8i/9i

2001-11-16 Thread Thies C. Arntzen

On Fri, Nov 16, 2001 at 10:49:17AM +0100, Steve Haemelinck wrote:
 Question:
 
 I want to build php withd support for ORACLE 8i or 9i.
 Normally you use the option with-oci=path-to-oraclehome.  So far so good.
 How can I achieve this when the oracle database is running on another
 server?

you need to install oracle on the client-machine as well!

tc
 
 Thx
 
 Haemelinck Steve
 
 Haemelinck.be - Developers Unite (Under construction )
 http://www.haemelinck.com
 http://www.haemelinck.be:8080/
 [EMAIL PROTECTED]
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] link to a pdf file

2001-11-16 Thread Stefan Rusterholz

Hi
Besides that I think this is the wrong mailing list for dealing with that
question:
Zip that pdf-file and link to the zipped file.
Everything else (AFAIK) won't work because this phenomenon is caused by the
client and not by the server.

Stefan Rusterholz, [EMAIL PROTECTED]
--
interaktion gmbh
Stefan Rusterholz
Zürichbergstrasse 17
8032 Zürich
--
T. +41 1 253 19 55
F. +41 1 253 19 56
W3 www.interaktion.ch
--
- Original Message -
From: Oosten, Sjoerd van [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 16, 2001 11:20 AM
Subject: [PHP] link to a pdf file


 Hello, a question again.

 I have a pdf file which can be downloaded. How can i link to this file so,
 that the file isn't opened in the browser (if acrobat reader is installed)
 but the file download popup appears?

 Greetings,

 
 Sjoerd van Oosten
 Digitaal vormgever [EMAIL PROTECTED]
 Datamex E-sites B.V.
 http://www.esites.nl
 Minervum 7368 Telefoon: (076) 5 730 730
 4817 ZH BREDA Telefax: (076) 5 877 757
 ___


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] problem with xgettext and php with javascript file

2001-11-16 Thread Pavel Novák

Hello all!

I want to use gettext for multilanguage webs, so I'm pleasing you to help
me.

When I use this: xgettext  --keyword=_ file.php
on this file:
---
script language=JavaScript
!--
function zmen_cenu() {
window.opener.document.celkem.cena_celkem.value = ? echo _(nìjaký
blábol); ?
}
// --
/script
---

I get this message: file.php: 4: warning: unterminated string literal



but when I use the same on this file:
---
?$str = _(nìjaký blábol);?
script language=JavaScript
!--
function zmen_cenu() {
window.opener.document.celkem.cena_celkem.value = ?= $str?;
}
// --
/script
---

gettext makes this good.


Do you know where is a problem?
My gettext version is 0.10.35


Thanks,
 Pavel Novák





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: link to a pdf file

2001-11-16 Thread The Big Roach

This works for what I do:
Try this and fiddle with the variables.
$conn_id is your pointer to an FTP connection.
Familiarize yourself with the FTP functions in PHP if there are any doubts.

PART I: Put this in one script (say pdf_list.php):
// list server contents
if ((!$F) || ($F==)){
  $dir_list = @ftp_nlist($conn_id, );
  if (!empty($dir_list)){
  while (list($lvar, $lvalue) = each($dir_list)){
  $S = @ftp_size ($conn_id, $lvalue);
  echo $lvaluenbsp;nbsp;$Snbsp;nbsp;[a
href=\download.pdf%20.php?F=http://$ftp_server/$my_dir$lvalueS=$S\;DOWNLO
AD/a]br;
  }
  }
  else {
  echo No files available!br;
  }
}

PART II: And save this as a separate file (download.pdf .php):
==observation: there is a space in this file name. See above: %20!
?php
//You can submit $Dir, $File_Name, $File_Extension by another script
adapting to your needs.
header(Server:Keep-Alive);
header(Accept-Ranges: $S-$S/$S);
header(Content-Length: $S);
header(Content-disposition: filename=$F);
header(Content-type: application/force-download);
readfile($F);
?

Payment can be made with a thousand blondes from the Netherlands: in
bikinis - no camels accepted!
(Fine print: they must be pretty - the girls, not the camels!)


Sjoerd Van Oosten [EMAIL PROTECTED] wrote in message
C9F89DA57491D511BDAF00E0180C348103BFCC@ESADM01">news:C9F89DA57491D511BDAF00E0180C348103BFCC@ESADM01...
 Hello, a question again.

 I have a pdf file which can be downloaded. How can i link to this file so,
 that the file isn't opened in the browser (if acrobat reader is installed)
 but the file download popup appears?

 Greetings,

 
 Sjoerd van Oosten
 Digitaal vormgever [EMAIL PROTECTED]
 Datamex E-sites B.V.
 http://www.esites.nl
 Minervum 7368 Telefoon: (076) 5 730 730
 4817 ZH BREDA Telefax: (076) 5 877 757
 ___






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] stupid little problem

2001-11-16 Thread Michiel van Heusden

sorry..I'm quite new in this php-stuff
i've got a little problem

if I write

a$ = test;
b$ = test2;
data$ .= a$ . . b$   ;
echo data$;

it outputs:
test test2
instead of:
test   test2  

I really need that spaces..
any help?
thnx



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: problem with xgettext and php with javascript file

2001-11-16 Thread _lallous

this code seem incomplete:
 window.opener.document.celkem.cena_celkem.value = ? echo _(nìjaký
 blábol); ?
 }
 here's a fix:
 function zmen_cenu() {
 window.opener.document.celkem.cena_celkem.value = ? echo _(nìjaký
blábol); ?;
}

Pavel NováK [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello all!

 I want to use gettext for multilanguage webs, so I'm pleasing you to help
 me.

 When I use this: xgettext  --keyword=_ file.php
 on this file:
 ---
 script language=JavaScript
 !--
 function zmen_cenu() {
 window.opener.document.celkem.cena_celkem.value = ? echo _(nìjaký
 blábol); ?
 }
 // --
 /script
 ---

 I get this message: file.php: 4: warning: unterminated string literal



 but when I use the same on this file:
 ---
 ?$str = _(nìjaký blábol);?
 script language=JavaScript
 !--
 function zmen_cenu() {
 window.opener.document.celkem.cena_celkem.value = ?= $str?;
 }
 // --
 /script
 ---

 gettext makes this good.


 Do you know where is a problem?
 My gettext version is 0.10.35


 Thanks,
  Pavel Novák







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] stupid little problem

2001-11-16 Thread Christoph Starkmann

Hi!

 a$ = test;
 b$ = test2;
 data$ .= a$ . . b$   ;
 echo data$;
 
 it outputs:
 test test2
 instead of:
 test   test2  
 
 I really need that spaces..
 any help?

HTML is normalizing all text; So any number of spaces, tabs newlines etc.
become one space  ;

If you want a certain number of spaces, you could use the nbsp;-entity:

$a = test;
$b = test2;
$data = $a . nbsp;nbsp;nbsp;nbsp; . $b . nbsp;nbsp;nbsp;nbsp;;

echo $data;

Greets,

Kiko

-
It's not a bug, it's a feature.

[.nfq]

christoph starkmann

tel.: 0821 / 56 97 94 34
fax.: 0821 / 56 97 94 38

http://www.fh-augsburg.de/~kiko

ICQ: 100601600
-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] stupid little problem

2001-11-16 Thread Richard Baskett

In html anything more than one space will be represented as only one space,
so to overcome that you'll need to use nbsp; which is a non-breaking space.
To get three spaces in between a word you would do:

word1 nbsp; word2

and there will be exactly three spaces in between.  I hope that helps!

Rick

 sorry..I'm quite new in this php-stuff
 i've got a little problem
 
 if I write
 
 a$ = test;
 b$ = test2;
 data$ .= a$ . . b$   ;
 echo data$;
 
 it outputs:
 test test2
 instead of:
 test   test2  
 
 I really need that spaces..
 any help?
 thnx
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Problem with Header!

2001-11-16 Thread Andre Lacour

I want to sent a script-result as a renamed html-document to the client.
I tried:

- header(Content-Disposition: inside; filename=name.html);

- header(Content-Disposition: inside; filename=\name.html\);

- header(Content-Disposition: inside;);
  header(Content-filename=name.html);

even with a content-type: text/html...
but it doesn't work.

inside replaced by something other like attachement or inline does not work,
either!

someone an idea?
thx






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] stupid little problem

2001-11-16 Thread Andrey Hristov

Use the pre tag before the input, and /pre after it.

Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS


- Original Message - 
From: Michiel van Heusden [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 16, 2001 2:30 PM
Subject: [PHP] stupid little problem


 sorry..I'm quite new in this php-stuff
 i've got a little problem
 
 if I write
 
 a$ = test;
 b$ = test2;
 data$ .= a$ . . b$   ;
 echo data$;
 
 it outputs:
 test test2
 instead of:
 test   test2  
 
 I really need that spaces..
 any help?
 thnx
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Safe mode and dir permissions

2001-11-16 Thread Rodrigo Peres

Hi List,

My ISP runs the PHP in Safe Mode, this is causing me a lot of trouble. In
safe mode how can I change the permission of a dir to 0777?, my problem is
that I've built a Content management system, and for every new people
inserted the system creates a Directorie and will upload things
automatically on it, but I couldn't create it with 0777 permission, so I
can't upload nothing with PHP, and I don't have how change every single
folder permissio by hand.

Thank's

-- 


Rodrigo


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Safe mode and dir permissions

2001-11-16 Thread Bas Jobsen

Hello,

You can't change permissions in safe_mode.

and for every new people
 inserted the system creates a Directorie and will upload things

Maybe you give the new people something like a autonumbered userid. So you
can created the dirs
/userid0/, /userid1/ etc. already by hand.



- Original Message -
From: Rodrigo Peres [EMAIL PROTECTED]
To: PHP [EMAIL PROTECTED]
Sent: Friday, November 16, 2001 2:02 PM
Subject: [PHP] Safe mode and dir permissions


 Hi List,

 My ISP runs the PHP in Safe Mode, this is causing me a lot of trouble. In
 safe mode how can I change the permission of a dir to 0777?, my problem is
 that I've built a Content management system, and for every new people
 inserted the system creates a Directorie and will upload things
 automatically on it, but I couldn't create it with 0777 permission, so I
 can't upload nothing with PHP, and I don't have how change every single
 folder permissio by hand.

 Thank's

 --


 Rodrigo


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: problem with xgettext and php with javascript file

2001-11-16 Thread Pavel Novak

now it is the same problem without javascript:

FIRST file includes only this row:
input type=submit name=submit_dotaz value=?=_(Odeslat dotaz)?
class=tlacitko

SECOND file includes this:
?$str=_(Odeslat dotaz)?
input type=submit name=submit_dotaz value=?=_$str?
class=tlacitko


When I use:
xgettext  --keyword=_ file.php

on FIRST file I don't get any error message, but it doesn't create the file
'messages.po'

but on SECOND file it creates the file 'messages.po' correctly...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PB mail()

2001-11-16 Thread RVB Pixels

Hi,

I've put in place a site using Nuke, however my server where the site is
hosted does not accept the mail(). It is disabled for security reasons.

How can I use the feedback section on the site if this function is disabled?

thxs in advance,

Stephen


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Problem with Header!

2001-11-16 Thread George Whiffen

Yeah, 

It seems to be a black art to get the browsers to behave properly.

I don't know if it's relevant but I use Content-disposition and Content-type
rather than Content-Disposition and Content-Type and it seems to work for
me for inline;.  I haven't tried inside;.

If you really can't get it working, I guess there is a pretty kludgy
workaround available (at least with Apache) by doing a redirect to the filename 
first and then
getting your script to pretend to be that file and just return the result anyway.  If 
you can
guarantee that your file will
NOT exist, you could for instance get Apache to go to your php script on
a 404 not found.  So the sequence goes:

1. Request comes to your script
2. Your script immediately redirects to the filename you want to be.
3. Apache fails to find the file and calls your script as the error
handler.
4. Your script then correctly executes and returns the appropriate 
results.

Or maybe there is some very clever trick that could be done with the
Apache rewrite module, but that's another black art!

You might want to try a post to Apache or another http mailing list.

Regards 

George 




and then
making sure there is something there to supply your result 
For downloads of tab data:

   header(Content-type: text/tab-separated-values);
   header(Content-disposition: inline; filename=missing.txt);
seems to work.


Andre Lacour wrote:
 
 I want to sent a script-result as a renamed html-document to the client.
 I tried:
 
 - header(Content-Disposition: inside; filename=name.html);
 
 - header(Content-Disposition: inside; filename=\name.html\);
 
 - header(Content-Disposition: inside;);
   header(Content-filename=name.html);
 
 even with a content-type: text/html...
 but it doesn't work.
 
 inside replaced by something other like attachement or inline does not work,
 either!
 
 someone an idea?
 thx

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: How to save a dynamic search result for later use as a static page?

2001-11-16 Thread George Whiffen

Look at the output buffer handling functions:

ob_handler etc.

These let you take the final (or intermediate) output of the script and do whatever 
you want with it
e.g. save it, or in your case save it and empty it.  In that case your user could have 
a simple SAVE
button which ran the entire script and then at the last minute saved the output, 
(possibly with
extra stuff added in), as a static page (or in a database) but didn't pass it back to 
the user at
all.


Tom Smith wrote:
 
 Hi All,
 Here is the problem:
 I have a quey building form that returns results from a database as a form to 
generate a new query.
 On open, it shows a form, then on submit it shows resutls that are in a form 
(checkboxes that let
 you omit that record from the next query by $id).
 
 What I want to do is let the user save the page to show others in his group. First I 
though of
 saving the query, but then it seemed simpler to just save the resutling html to a 
file that could be
 referenced in email.
 
 How do you get the current page to slurp into a file along with all the current 
variables?
 
 On an unrelated note, it seems like I'm generating the restults twice. Any input on 
how to
 stream-line it?
 
 full script:
 ?php
 if ($save) { //save is a hidden field, will always be true so that I can test 
fwriting to saved.html
 $fp = fopen(/home/www/html/locations/site/saved.html, w);
 //$fp = fopen(saved.html, w);
 //fflush($fp);
 //fpassthru($fp);
 fwrite($fp, ??);
 }
 
 # ln -s index.php omit.php
 # This file is a search form/query builder with the ability to
 # pare down a result set.
 function Refine($query, $to_omit) {
 
 $query = str_replace(order by locations.id, AND , $query);
 
 /* //debug:
 foreach ($HTTP_POST_VARS as $k = $v){
 echo k: $k, v: pre$v/pre;
 }
 */
 if ($to_omit) {
 trim($to_omit);
 $arr_to_omit = explode( , $to_omit);
 array_pop($arr_to_omit);
 foreach($arr_to_omit as $v) {
 $query .= locations.id != '$v' AND \n;
 
 }
 
 }
 
 $query = chop($query);
 $query = substr_replace($query, '', -3, 3);
 
 $query .=  order by locations.id;
 $query = str_replace(~, ', $query);
 return $query;
 }
 
 ?
 html
 headtitleLocations search/title
 link rel=stylesheet href=images/klamath.css type=text/css
 
 script language=JavaScript
 !-- hide from old browser//
 function checkOmit() {
 var form = document.refine
 form.to_omit.value = ''
 for (var i = 0; i  (form.omit.length); i++) {
 if (form.omit[i].checked) {
 form.to_omit.value += (form.omit[i].value) + ' '
 }
 }
 return true
 }
 //quit hiding --
 /script
 
 /head
 body bgcolor=#6E89AB
 
 ?php
 $db = mysql_connect(localhost, user, password)
 or die (No connection);
 
 mysql_select_db(locations,$db)
 or die (No select db);
 
 if ($submit == 'refine') {
 
 Refine($query, $to_omit);
 
 //debug:
 //  echo h2After function calll we get:/h2\$query\;
 
 /* //debug:
 $headers = getallheaders();
 while (list ($header, $value) = each ($headers)) {
 echo $header: $valuebr\n;
 }
 */
 
 
 $res = mysql_query ($query, $db)
 or die (brBad query, comrade. line 77, number: .mysql_errno()., . 
mysql_error());
 $query = str_replace(', ~, $query); //gotta hack 2wice
 
 $numrows = mysql_numrows($res);
 
 if($numrows  1) {
 echo Nope, nothing like that.;
 }
 
 echo h2Refined Results:/h2\n;
 echo form name=refine onSubmit='return checkOmit();' method=post\n;
 echo input type=hidden name=query value=\$query\br;
 echo input type=hidden name=refine value=true\n;
 echo input type=hidden name=to_omit value='$to_omit'\n;
 echo input type=hidden name=save value='save'\n;
 
 
 echo tabletrtd background='images/bg-menu.gif'valign=top\n;
 include menu.php;
 echo /tdtd\n;
 
 echo table align=center width=95%\n;
 echo tr 
bgcolor=silvertdThumbnail/tdtdAddress/tdtdContact/td/tr\n;
 
 $c = 0;
 
 while (($row = mysql_fetch_array ($res))  $numrows  0) {
 
 $c++;
 $id = $row[id];
 $loc_name = $row[loc_name];
 $folder = $row[folder];
 $thumb = $row[thumb];
 $address = $row[address];
 $city = $row[city];
 $state = $row[state];
 $zip = $row[zip];
 $contact_id = $row[contact_id];
 $name = $row[name];
 
 
 if(strlen($description)  150) {
 $description = substr($row[description], 0, 150).'...';
 }
 
 
 

[PHP] SQL Server Previous Next

2001-11-16 Thread MindHunter

Hi,

Does anyone know of a script/tutorial etc on displaying Microsoft SQL Server
records, lets say 20 at a time and on clicking NEXT it will display the next
20 records and if you click PREVIOUS the previos 20 records?

I have one for MYSQL but the catch is that MYSQL has something like:

select column from table limit 4,10

Thus selecting the 10 records starting at the 5th record.

MS SQL Server does not have something similar, so what is my options.

Tx
MH



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Info on another page

2001-11-16 Thread MindHunter

Hi,

Lets say I want to get the current exchangerate from another page on the web
and use it in calculations on my own page.  How do I retrieve info from
another site once someone access my page?

Tx
MH



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: strpos

2001-11-16 Thread George Whiffen

I always get strpos wrong.

So typically in this case I would do something like:

list($file,$ext) = explode('.',$yourimage);

if ($ext != 'jpg' or $ext != 'jpeg')
{
   error...
}

(More properly we should make sure jpg or jpeg are at the very end of the filename 
i.e. you probably
don't like myfile.jpegold.gif so you would need:

list($ext,$file) = explode('.',strrev($yourimage));
$ext = strrev($ext);
$file = strrev($file);

if ($ext != 'jpg .etc.

)

If $yourimage really is a reference to an image e.g. an uploaded image, you might like 
to run
getimagesize() on it to see if it really, really is a
jpeg and not just called .jpg or .jpeg see 
(http://www.php.net/manual/en/function.getimagesize.php).

George


Jtjohnston wrote:
 
 I suppose I'm doing this right? I want to know if the user entered
 \.jpeg or \.jpg. If he didn't, it should error.
 
 It errors anyways? What do I have to do add slashes in my input???
 :o)
 
 // if((!strpos($yourimage, \.jpg)) || (!strpos($yourimage,
 \.jpeg)))  \\ --- tried both!
  if((!strpos($yourimage, .jpg)) || (!strpos($yourimage, .jpeg)))
 {
   error_found(error found);
   $errorfound++;
  }

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Session problem

2001-11-16 Thread Daniel Alsén

Hi,

i am writing a simple postcard-script. I use php 4 sessions and stores the
data in MySql with the sessionid as a unique id for the card.

The problem is - i can´t send more than one card with the same id. I can´t
find any way to get a new session id without closing the browser. In the
manual there only seems to be functions to unset or unregister the actual
data inside the session - not the id itself.

Any ideas?

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: problem with xgettext and php with javascript file

2001-11-16 Thread Pavel Novak

so I know where is the problem:

input type=submit name=bla value=?=_(Odeslat dotaz)?

gettext is seeking through all of strings in the file, it thinks that one
string is:
?=_(

and second:
)?


And it doesn't work even with this:
value=?=_('Odeslat dotaz')?
or this:
value='?=_(Odeslat dotaz)?'

Does anybody know how I can do it to be good?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: JPG Images from database to filename.jpg

2001-11-16 Thread George Whiffen

I'm confused. Is your problem serving up the images in your database to the web or 
writing them out
to files on the server?

If it's serving images, I would expect you to have: 

select myimage from db
Header(Content-type: image/jpeg);
echo $myrow[myimage];
exit();

etc.

If it's writing from the db to a real file on your server, I would expect: 

select myimage from db
open myfile
write $myrow[myimage];
close myfile
etc.

The Header is just for the web, to tell the browser or other client what kind of file 
it is getting
from your php script since it is not the expected type automatically supplied by the 
web-server
(text/html).  Real physical files don't need a header.  The web servers automatically 
generate
appropriate headers for real image files based on the file extension before they send 
them out over
the web.

Does that make sense, or have I completely missed the point?


George



Mike Gifford wrote:
 
 Hello,
 
 I've got a number of images in a database..  Ultimately what I would
 like to do is be able to resize the image that is already in the
 database and then insert that image into another field.
 
 Uploading the files generally inserts these both at the same time,
 however I need to create a number of new thumbprints based on a
 different scale.
 
 What I thought would be easiest would be to take the image, save it to
 filename.jpg and then run the thumbnailing script on it.
 
 I think that this would look like the following:
 
 ?php
 // There's other DB stuff here, but this isn't important
 $Images = stripslashes($row[0]);
 $File = ReThumbnail.jpg;
 
 // Create JPG image
 ImageJPEG(imagecreatefromstring($Images), $File);
 
 // Scale image
 system(djpeg -pnm $File | pnmscale -xscale .1 -yscale .1 | cjpeg 
 $File.tmb);
 
 // Write thumbprint
 $fd = fopen( $File.tmb, r+);
 $tmb = addslashes(fread($fd, filesize($File.tmb)));
 fclose($fd);
 
 // Insert Thumbprint image into database
 $sql = UPDATE Images SET Thumbnail='$tmb' WHERE ID=$ID;
 // There's other DB Stuff here too...
 ?
 
 I'm really quite stuch here..
 
 How do you take a db image of a database and create a physical jpg file?
   I think I'm getting messed up by the header in:
 
 Header(Content-type: image/jpeg);
 echo $Images;
 
 I can't figure out how to create the header.  There's lots of examples
 of how to do the above, but I have yet to stumble across an example
 which allows you to write the header into a file
 
 Suggestions would be appreciated..
 
 Mike

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: problem with xgettext and php with javascript file

2001-11-16 Thread Rasmus Lerdorf

Note that you don't need to use xgettext to use gettext.  It is simply a 
time-saver that generates a template .po file for you.  You can easily 
create this text file yourself.

-Rasmus

On Fri, 16 Nov 2001, Pavel Novak wrote:

 so I know where is the problem:
 
 input type=submit name=bla value=?=_(Odeslat dotaz)?
 
 gettext is seeking through all of strings in the file, it thinks that one
 string is:
 ?=_(
 
 and second:
 )?
 
 
 And it doesn't work even with this:
 value=?=_('Odeslat dotaz')?
 or this:
 value='?=_(Odeslat dotaz)?'
 
 Does anybody know how I can do it to be good?
 
 
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: HTTP_POST_VARS and eval?

2001-11-16 Thread George Whiffen

Henrik,

I think your problem is jsimply that you are not getting variable substitution
of $HTTP_GET_VARS[whatever] inside double quotes.  

print whatever is $HTTP_GET_VARS[whatever];

is not safe.

You need  

print whatever is {$HTTP_GET_VARS[whatever]};

or, (IMHO better),  

print 'whatever is '.$HTTP_GET_VARS[whatever];

The fact that you are actually evaluating an assignment is I think irrelevant, it's 
just the
variable substitution that's failing. See the variable parsing section of
http://www.php.net/manual/en/language.types.string.php


George
Henrik Hudson wrote:
 
 Hey List-
 
 Working on a program and I seem to have run into a problem with
 HTTP_POST_VARS. Are the HTTP_VARS considered special?
 
 Here is what I am doing, reading in from a file into an array and then
 grabbing each line and looking for  ]string[  and replacing that with
 $HTTP_POST_VARS[string]
 
 The first echo prints out the lines correctly, but the echo after the eval
 prints out the same lines. My error log shows this:
 
 PHP Parse error:  parse error, expecting `T_STRING' or `T_VARIABLE' or
 `T_NUM_STRING' in
 /data/www/webpages/test.rhavenn.net/public_html/formmail/formmail.php(164) :
 eval()'d code on line 1
 
 So, its having problems doing an eval on the HTTP_POST? If I replace the
 HTTP_POST stuff with just$\\1  and then define $string =
 $HTTP_POST_VARS[string] it works just fine, but I can't do this since I
 don't know what string is going to be, just that it is between ] [  chars and
 there can be multiple ] [  on one line.
 
 Any thoughts? Code is below.
 
 //Read the array
 $form_data = ;
 for($i=0; $i  count($filearr); $i++){
 $line = $filearr[$i];
 //Strip the ] [ from around the variables so they will be interpreted
 $line = eregi_replace(\]([^\[]+)\[, \$HTTP_POST_VARS['\\1'],
 $line);
 echo Line: $lineBR;
 //eval the variables from $line into themselves and they become
 literal
 eval (\$line = \$line\;);
 echo Lineafterwards: $lineBR\n;
 //Write the line back into a single variable
 $form_data = $form_data . $line;
 }
 exit;
 
 Thanks!
 
 Henrik
 --
 
 Henrik Hudson
 [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Session problem

2001-11-16 Thread Daniel Alsén

Nope. That is just the problem. session_destroy() only destroys the data
inside the session. Not the id.

But i actually solved it now. I am using the same algorithm as php itself to
create a new id everytime the page is loaded:

   session_id( md5( uniqid( , 1 ) ) );
   session_start();

- Daniel

 -Original Message-
 From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED]]
 Sent: den 16 november 2001 15:40
 To: Daniel Alsén
 Subject: Re: [PHP] Session problem


 I think you can set a new session id using session_start()
 so if you need a new id just destroy the old one using session_destroy()
 then call sessio_start(your new id)  and that should work fine now.

 - Original Message -
 From: Daniel Alsén [EMAIL PROTECTED]
 To: PHP [EMAIL PROTECTED]
 Sent: Friday, November 16, 2001 9:05 AM
 Subject: [PHP] Session problem


  Hi,
 
  i am writing a simple postcard-script. I use php 4 sessions and
 stores the
  data in MySql with the sessionid as a unique id for the card.
 
  The problem is - i can´t send more than one card with the same
 id. I can´t
  find any way to get a new session id without closing the browser. In the
  manual there only seems to be functions to unset or unregister
 the actual
  data inside the session - not the id itself.
 
  Any ideas?
 
  Regards
  # Daniel Alsén| www.mindbash.com #
  # [EMAIL PROTECTED]  | +46 704 86 14 92 #
  # ICQ: 63006462   |  #
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: server side games question

2001-11-16 Thread Brinkman, Theodore

Sorry for sending this message through the list, but I'm getting mail errors
when I try to send it directly.

- - - - -

Sorry it took so long.  The generation scripts aren't very fleshed out, 
and neither is the display format, but it's a good solid example of the 
basic example.  Every main unit of distance (tile, sector, screen, 
etc...) has a key which can be calculated from nothing more than it's 
location, and this key is used to generate pseudo-random information 
about that location.  Obviously, in a game where that information could 
change, a database of some sort would be needed to record those changes, 
but you don't need to store every bit of data about every section of a 
1000 x 1000 universe.

The scripts I created are attached.  I haven't tinkered with them for a 
while, so I'm not completely familiar with them any more, but you can 
pretty much navigate through them starting from index.php.

- Theo

- - - - -
Remember, the guy who has to maintain your code may know where you live.


 BFconfig.php  BattleFleet.css  combat.php  index.php  
alert.txt  map.php  page.php  login.php  sector.php 
-Original Message-
From: Brown, Daniel (staff) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 10:19 AM
To: '[EMAIL PROTECTED]'
Subject: Re: server side games question


What's the project? Don't know yet probably some form of wargame I would
imagine a time based RTS or something (i'm not sure yet).  I've not done
any
decant C/C++ coding for too long and am now getting must
code-something-cool-soon feeling last time this happened I ended up making
a
3d landscape generator

I would be interested to see your code for generating a star map, its
something I have always thought of doing and have never quite got round to
doing!

Cheers,

Daniel

Theodore Brinkman [EMAIL PROTECTED] wrote in
message
news:[EMAIL PROTECTED]...

PHP will do fine.  What's the project?  I'm a wannabe game developer, and

I

had a bit of fun a few months back with randomly generated, but
reproducable, game worlds (in my case it was a star map for a space

conquest

type of game).  It's a really neat concept, and its how alot of the 'big
world' games were done when games came on floppy disks.  

The code isn't very polished, but if you're interested in that sort of
thing, I can dig it up and fire it off to you.

  - Theo

-Original Message-
From: Daniel [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 5:32 AM
To: [EMAIL PROTECTED]
Subject: server side games question


Hi,

Right I'm still pretty new to server side programming and have a few
questions regarding the possible uses of existing technology in
'low-tech'
(not 3d FPS/RTS/RPGs) online games.  As I understand it PHP is used to
add
dynamic content to HTML (from MySQL database for example) and it is also
possible to write applications in C/C++ that run on server computer (SUSE
7.2 + APACHE for example) that update databases at set time intervals.  I

am

a games programmer and was wondering if it would be possible to code the
following system which would run on an SUSE Apache server box:

An database containing client and game data (use MySQL?),
An HTML/PHP based front end (is PHP best choice for this?),
A Some form of application that process the game or turn info (in the DB)

at

set time intervals and updates the game database with it (use C/C++?).

I am competent in C/C++, ok at php and ok at MySQL but not sure how to
fit
it all together like how do I go about creating an application that
process's the database?  Can any one suggest sites/books/people who I

could

read/ask to find out more about this idea?  Also are the languages I
specified the best languages to use for this?  I am open to suggestions

and

constructive criticism.

Cheers,

Daniel









   Network Associates GroupShield Exchange  **
  Alert generated at: Friday, November 16, 2001 12:19:51 AM Eastern Standard 
Time
**


The file login.html has been replaced.
Please consult your administrator for further help
and remember to quote your ticket number: OA2114_1005887991_OHDAYTOXCHG3


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


Re: [PHP] Sending mail without using mail()

2001-11-16 Thread R'twick Niceorgaw

grab a copy of phpmailer .. it does exactly what you want
- Original Message - 
From: Jaime Iniesta Aleman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 16, 2001 4:01 AM
Subject: [PHP] Sending mail without using mail()


 
 
 Ok, where can I find a tutorial about sending mail using fsockopen ?
 
 ***
 
  Hi, is it possible to send SMTP mail if the server where are my pages
  hosted forbids the use of the mail() function ? I mean, by opening a
  sockets connection to an external SMTP server and writing the commands
  there directly...
 
 Yes, *IF*:
 
 The ISP was not smart enough to realize this and didn't disable the
 http://php.net/fsockopen function
 
 Your SMTP server will accept connections from your web-server.
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Parse POST-Data myself

2001-11-16 Thread Stefan

Hi

I have following problem:
I get a form with some fields having the same name.
PHP solves this problem by appending [] to the form-field-names which causes the 
creation of arrays.
My problem now is, that I have to pass those variables further to another script (not 
PHP) in exactly that order I receive them from the form.
But when I have a form (schematically) like this:
-input type=text name=myfield1
-input type=text name=myfield2
-input type=text name=myfield1
-input type=text name=myfield2
-input type=text name=myfield1
-input type=text name=myfield2

Then I get in PHP all myfield1 in 1 variable (the array myfield1) and all myfield2 in 
1 other variable - order is irreversibly destroyed.
Give the fields numbers is not a solution (for complexity reasons).

So my ultima ratio is to parse the post-data myself - but how can I do this?
I have not found any indices for a variable containing post-data :-(

If someone has another approach to a solution: I will have both ears open for it :)

Thanks in advance
Stefan Rusterholz, [EMAIL PROTECTED]
--
interaktion gmbh
Stefan Rusterholz
Zürichbergstrasse 17
8032 Zürich
--
T. +41 1 253 19 55
F. +41 1 253 19 56
W3 www.interaktion.ch
--



[PHP] Database design/relationship basics book

2001-11-16 Thread Dan McCullough

Does anyone have some recommendations for database books.  This is something that I 
want to get
better versed in as I have gotten along by visualizing the database and its 
relationship for small
projects, but I think I need a better base and more knowledge.  Recommendations can 
before both
MySQL specific, a query book and a database in general, please I have done database 
designs for
small projects by trial and error and extending original schemas, I would like to 
learn to do it
right the first time.  So any suggestions will help.

thanks in advance

dan

__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Parse POST-Data myself

2001-11-16 Thread Matthew Luchak


If you know the setup of the form beforehand it is relatively easy to do
something like :

$string=$myfield1[0] $myfield2[0] $myfield1[1] $myfield2[1]  etc...

However I remember one of my stupid mistakes awhile ago was mistakenly
giving two form fields the same name.  My result was that the second
field overwrote the first.  How do you get an array?



 
Matthew Luchak 
Webmaster
Kaydara Inc. 
[EMAIL PROTECTED]


-Original Message-
From: Stefan [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 16, 2001 10:03 AM
To: PHP
Subject: [PHP] Parse POST-Data myself


Hi

I have following problem:
I get a form with some fields having the same name.
PHP solves this problem by appending [] to the form-field-names which
causes the creation of arrays.
My problem now is, that I have to pass those variables further to
another script (not PHP) in exactly that order I receive them from the
form.
But when I have a form (schematically) like this:
-input type=text name=myfield1
-input type=text name=myfield2
-input type=text name=myfield1
-input type=text name=myfield2
-input type=text name=myfield1
-input type=text name=myfield2

Then I get in PHP all myfield1 in 1 variable (the array myfield1) and
all myfield2 in 1 other variable - order is irreversibly destroyed.
Give the fields numbers is not a solution (for complexity reasons).

So my ultima ratio is to parse the post-data myself - but how can I do
this?
I have not found any indices for a variable containing post-data :-(

If someone has another approach to a solution: I will have both ears
open for it :)

Thanks in advance
Stefan Rusterholz, [EMAIL PROTECTED]
--
interaktion gmbh
Stefan Rusterholz
Zürichbergstrasse 17
8032 Zürich
--
T. +41 1 253 19 55
F. +41 1 253 19 56
W3 www.interaktion.ch
--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Parse POST-Data myself

2001-11-16 Thread _lallous

take the query string as is:
$QUERY_STRING
in this case:
$qstring = myfield1=myfield2=aaacccmyfield1=;
and then pass it on as is again to whoever you want!

or you can parse it like:
$qstrings = split('', $qstring);
then split each pair:
$pairN = split('=', $qstrings[$i]);

etc

Stefan [EMAIL PROTECTED] wrote in message
002601c16eaf$cb057830$3c01a8c0@quasimodo">news:002601c16eaf$cb057830$3c01a8c0@quasimodo...
Hi

I have following problem:
I get a form with some fields having the same name.
PHP solves this problem by appending [] to the form-field-names which causes
the creation of arrays.
My problem now is, that I have to pass those variables further to another
script (not PHP) in exactly that order I receive them from the form.
But when I have a form (schematically) like this:
-input type=text name=myfield1
-input type=text name=myfield2
-input type=text name=myfield1
-input type=text name=myfield2
-input type=text name=myfield1
-input type=text name=myfield2

Then I get in PHP all myfield1 in 1 variable (the array myfield1) and all
myfield2 in 1 other variable - order is irreversibly destroyed.
Give the fields numbers is not a solution (for complexity reasons).

So my ultima ratio is to parse the post-data myself - but how can I do this?
I have not found any indices for a variable containing post-data :-(

If someone has another approach to a solution: I will have both ears open
for it :)

Thanks in advance
Stefan Rusterholz, [EMAIL PROTECTED]
--
interaktion gmbh
Stefan Rusterholz
Zürichbergstrasse 17
8032 Zürich
--
T. +41 1 253 19 55
F. +41 1 253 19 56
W3 www.interaktion.ch
--




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Need help with reading values from a form

2001-11-16 Thread _lallous

name the checkbox as:
input type='checkbox' value='?=$field['id']?' name='selectedplayers'

where ID is used to identify this current field!

then read in the posted page as:
?
while (list(, $selected) = each($selectedplayers))
{
  // $selected  holds the ID of the field that was previously selected
  // do whatever here!
}
?

P. Roescher [EMAIL PROTECTED] wrote in message
01c16eab$65226360$015a@cc48693a">news:01c16eab$65226360$015a@cc48693a...
 The script I have:
 ?
  $query = SELECT * FROM members ORDER BY MemberName ASC;
  $player = MYSQL_QUERY($query);
  $Aantal_play = MYSQL_NUM_ROWS($player);
  $x=0;
  while ($x  $Aantal_play) :
$name = mysql_result($player,$x,MemberName);$name = $name +
 NAME;
 ?
 tr
   td width=25% height=18
 font face=Verdana size=2 color=#FF? print $name;
 ?/font
   /td
   td width=75% height=18
 input type=checkbox name=?print $name? value=ON
   /td
 /tr
 ?
   $x++;
   endwhile;
 ?
 The Problem I have:
 How can i read all checkboxes?!?





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Different include paths for different virtualhosts?

2001-11-16 Thread David Otton

Hi - my sysadmin tells me that PHP is compiled in, rather than loaded
as an Apache module.

I need to use

VirtualHost foo
php_value include_path .:/www/includes/foo
/VirtualHost

to get different include paths for different sites. How do I
accomplish this?

The manual says When using PHP as an Apache module, you can also
  ^
change the configuration settings using directives in Apache
configuration files and .htaccess files.

djo


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Info on another page

2001-11-16 Thread _lallous

you can fopen() remote files!
$fp = fopen(www.site.com/infodir/exchange.txt,r);
$rates = fread($fp, ...);
fclose($fp);

Mindhunter [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 Lets say I want to get the current exchangerate from another page on the
web
 and use it in calculations on my own page.  How do I retrieve info from
 another site once someone access my page?

 Tx
 MH





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Example code for multiple uploads? (Using PHP 4.0.6)

2001-11-16 Thread Nate Carlson

I'm trying to create a form that supports multiple uploads (of up to 4
files), but does not require each of them. I've tried all the code
examples in the PHP documentation, and they don't appear to work with PHP
4.0.6. Basically, I get the file names returned in the arrays, but the
array that should contain the name of the temporary file just says 'none'.
Things work fine for a single upload.

Does anyone have example code for this? Thanks! :)

-- 
Nate Carlson [EMAIL PROTECTED]   | Phone : (952)943-8700
http://www.real-time.com| Fax   : (952)943-8500


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Fatal error: Call to undefined function: imagecreate()

2001-11-16 Thread Jeff Bearer

Thanks for pointing me to phpinfo(),  the field for the ./configure
command is my old one, I guess I'll go back and start from scratch, must
of forgot a step.



On Thu, 2001-11-15 at 21:06, Johan Holst Nielsen wrote:
  I know it's probabally overkill but in the configure messages, it says
  yes for everything gd, jpeg, png, and zlib.  Any suggestions? If anybody
  wants to see the configure messages let me know.
 
 What do PHP tells you about the GD lib extension.
 Try making a phpinfo() file and send the output in the GD lib section.
 
 Regards,
 Johan
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
-- 
Jeff Bearer, RHCE
Webmaster
PittsburghLIVE.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Recursive call of index.php/test=2

2001-11-16 Thread Francis Grignon


When we open this url : http://localhost/index.php/test=2

Yep index.php/test=2 not index.php?test=2

Apache open the page index.php one time for every broke link he find in the
index.php page.  Example :

?PHP
  // Simple PHP test page
?
HTML
TITLESimple PHP test page/TITLE
BODY
  PSimple PHP test page/P
  IMG SRC=image1.gifbr
  IMG SRC=image2.gifbr
  IMG SRC=image3.gif
/BODY
/HTML
?

  // Keep a log

  /* Log table

CREATE TABLE `simple_log` (
  `sl_time` BIGINT UNSIGNED NOT NULL,
  `sl_url`  VARCHAR(255) NOT NULL
)

  */

  // Current time
  $now = time();

  // Database configuration
  $host = 'localhost';
  $username = '';
  $password = '';
  $database = '';

  // Open a database connection
  $linkd = mysql_connect($host, $username, $password);
  mysql_select_db($database, $linkd);

  // Insert a log
  $sql = INSERT INTO simple_log (sl_time, sl_url) VALUES ('$now',
'$REQUEST_URI');
  mysql_query($sql, $linkd);

  // Close the database connection
  mysql_close($linkd);
?

Images are broke because the path http://localhost/index.php/image1.gif
does not exist.  In this case, Apache open 4 times the page index.php.

Here the listing of the log table :

sl_timesl_url
1005924055 /index.php/test=2
1005924055 /index.php/image1.gif
1005924055 /index.php/image2.gif
1005924055 /index.php/image3.gif

We have the same problem on 3 differents servers.

Compilation script :

'./configure' '--with-mysql=/virtual/mysql' '--enable-bcmath' '--with-gd'
'--with-dbase' '--with-curl' '--with-xml' '--with-pgsql=/virtual/postgres/'
'--with-imap' '--with-apxs=/virtual/apachedev/bin/apxs'

Apache version :

1.3.20

Php version :

4.0.6 and 4.2.0-dev

Do you have any suggestion to block the recusive call?  Thank you




Francis Grignon [[EMAIL PROTECTED]]
Analyse programmeur
Groupe iWeb Technologies Inc.

ICQ : #74395718
Tel : +1 514-286-4242

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Image Upload, renaming question

2001-11-16 Thread George Whiffen

Joe,

One approach that works for me is to have a separate IMAGE table with an automatically 
generated
primary key image_id (auto_increment with MySQL).  I don't use this store the image, 
but just to
give me the unique name for the image file.  I also use the IMAGE table to store away 
the original
image name, and the image type and dimensions from GetImageSize.  Type and dimensions 
can be useful
to have stored in case you need to set IMG WIDTH and HEIGHT dynamically to maintain 
proportions if
the image is over-sized for the page it's on and/or manipulate and image with gd 
functions.

The IMAGE table is shared across the whole site to guarantee unique image names and 
any updates of
images are always handled as inserts to stop problems with  browsers caching old 
images.  image_id
is then held on the table where the use of the image is recorded e.g. the table 
holding a page's
content.  The actual directory where the images reside is not actually held in the 
database but set
as a global in a standard include.  This makes it easier to move between 
machines/sites etc. without
changing data. 

This seems to work well, you can use standard code for image upload/update/deletion 
and functions
for image_insert,
image_delete etc.

Cheers,

George

Joe Van Meer wrote:
 
 Thx Richard, I would like the files to all be dumped into one directory,
 each with a unique name. Then I will create a path and store that in the db.
 Thx for the ideas, I will check them out and get back to youvia this thread.
 
 Cheers Joe:)
 
 Richard Lynch [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Joe Van Meer wrote:
 
   Hi there, I have an upload form on my website that works great, however
 I
   have come to a roadblock...how the heck do I rename the copied file?
   Everytime I upload an image it overwrites the old one with the new. The
   code below uploads the file and displays the following:
  
   Your photo has been uploaded successfully.
   Size of Image in Bytes: 36315
   Image Type: image/pjpeg
   File exists on server.
   /rotatingimages/C:\PHP\uploadtemp\php12D.tmp   -- I notice that this is
 a
   temporary name
 
  If two files were being uploaded at once, you'd get two different names...
 
  But it's entirely up to *YOU* to decide where to copy the file to.  Maybe
  you'd *WANT* to replace files as they were uploaded.
 
  I tend to use the user's filename and preg_replace() to get rid of
  everything except a-zA-Z._-  and then checking where I'm copying to tack
 on
  1, 2, 3, ... until I find a new filename that's not in use.
 
  You should also start using http://php.net/move_uploaded_file instead of
  copy or whatever you are doing.
 
  --
  Like music?  http://l-i-e.com/artists.htm
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Parse POST-Data myself

2001-11-16 Thread Andrew Forgue

On Fri, 2001-11-16 at 10:19, Matthew Luchak wrote:
 
 If you know the setup of the form beforehand it is relatively easy to do
 something like :
 
 $string=$myfield1[0] $myfield2[0] $myfield1[1] $myfield2[1]  etc...
 
 However I remember one of my stupid mistakes awhile ago was mistakenly
 giving two form fields the same name.  My result was that the second
 field overwrote the first.  How do you get an array?

By putting brackets after the variable name [] in a form element

input type=text name=text[]
input type=text name=text[]
input type=text name=text[]
// etc

this will emerge as

$text[0]..[2]: being each value in the form


 
 
 
  
 Matthew Luchak 
 Webmaster
 Kaydara Inc. 
 [EMAIL PROTECTED]
 
 
 -Original Message-
 From: Stefan [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 16, 2001 10:03 AM
 To: PHP
 Subject: [PHP] Parse POST-Data myself
 
 
 Hi
 
 I have following problem:
 I get a form with some fields having the same name.
 PHP solves this problem by appending [] to the form-field-names which
 causes the creation of arrays.
 My problem now is, that I have to pass those variables further to
 another script (not PHP) in exactly that order I receive them from the
 form.
 But when I have a form (schematically) like this:
 -input type=text name=myfield1
 -input type=text name=myfield2
 -input type=text name=myfield1
 -input type=text name=myfield2
 -input type=text name=myfield1
 -input type=text name=myfield2
 
 Then I get in PHP all myfield1 in 1 variable (the array myfield1) and
 all myfield2 in 1 other variable - order is irreversibly destroyed.
 Give the fields numbers is not a solution (for complexity reasons).
 
 So my ultima ratio is to parse the post-data myself - but how can I do
 this?
 I have not found any indices for a variable containing post-data :-(
 
 If someone has another approach to a solution: I will have both ears
 open for it :)
 
 Thanks in advance
 Stefan Rusterholz, [EMAIL PROTECTED]
 --
 interaktion gmbh
 Stefan Rusterholz
 Zürichbergstrasse 17
 8032 Zürich
 --
 T. +41 1 253 19 55
 F. +41 1 253 19 56
 W3 www.interaktion.ch
 --
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] timing

2001-11-16 Thread Caspar Kennerdale

I have a script that when is executed parses and html file and writes the
contents to a text file.

I need to then read this text file from another apllication

Is there a way of timing this operation,  so that my other app does not try
to access the file before being written?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: HTTP_POST_VARS and eval?

2001-11-16 Thread Henrik Hudson

Thanks. It actually turned out that I wanted to do just:

$HTTP_POST_VARS[\\1]

in the regex (ie: removing the quotes entirely inside the array)

and it works just fine. Thanks for the info however.


On Friday 16 November 2001 09:37, George Whiffen wrote:
 Henrik,

 I think your problem is jsimply that you are not getting variable
 substitution of $HTTP_GET_VARS[whatever] inside double quotes.

 print whatever is $HTTP_GET_VARS[whatever];

 is not safe.

 You need

 print whatever is {$HTTP_GET_VARS[whatever]};

 or, (IMHO better),

 print 'whatever is '.$HTTP_GET_VARS[whatever];

 The fact that you are actually evaluating an assignment is I think
 irrelevant, it's just the variable substitution that's failing. See the
 variable parsing section of
 http://www.php.net/manual/en/language.types.string.php


 George

 Henrik Hudson wrote:
  Hey List-
 
  Working on a program and I seem to have run into a problem with
  HTTP_POST_VARS. Are the HTTP_VARS considered special?
 
  Here is what I am doing, reading in from a file into an array and then
  grabbing each line and looking for  ]string[  and replacing that with
  $HTTP_POST_VARS[string]
 
  The first echo prints out the lines correctly, but the echo after the
  eval prints out the same lines. My error log shows this:
 
  PHP Parse error:  parse error, expecting `T_STRING' or `T_VARIABLE' or
  `T_NUM_STRING' in
  /data/www/webpages/test.rhavenn.net/public_html/formmail/formmail.php(164
 ) : eval()'d code on line 1
 
  So, its having problems doing an eval on the HTTP_POST? If I replace the
  HTTP_POST stuff with just$\\1  and then define $string =
  $HTTP_POST_VARS[string] it works just fine, but I can't do this since I
  don't know what string is going to be, just that it is between ] [  chars
  and there can be multiple ] [  on one line.
 
  Any thoughts? Code is below.
 
  //Read the array
  $form_data = ;
  for($i=0; $i  count($filearr); $i++){
  $line = $filearr[$i];
  //Strip the ] [ from around the variables so they will be
  interpreted $line = eregi_replace(\]([^\[]+)\[,
  \$HTTP_POST_VARS['\\1'], $line);
  echo Line: $lineBR;
  //eval the variables from $line into themselves and they become
  literal
  eval (\$line = \$line\;);
  echo Lineafterwards: $lineBR\n;
  //Write the line back into a single variable
  $form_data = $form_data . $line;
  }
  exit;
 
  Thanks!
 
  Henrik
  --
 
  Henrik Hudson
  [EMAIL PROTECTED]

-- 

Henrik Hudson
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] timing

2001-11-16 Thread Matthew Luchak


If the other application is written in PHP you can use flock.
 
Matthew Luchak 
Webmaster
Kaydara Inc. 
[EMAIL PROTECTED]


-Original Message-
From: Caspar Kennerdale [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 16, 2001 11:00 AM
To: Php-General
Subject: [PHP] timing


I have a script that when is executed parses and html file and writes
the
contents to a text file.

I need to then read this text file from another apllication

Is there a way of timing this operation,  so that my other app does not
try
to access the file before being written?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] timing

2001-11-16 Thread Caspar Kennerdale

unfortunaelty its not in php- but director

-Original Message-
From: Matthew Luchak [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 16, 2001 16:03
To: Php-General
Subject: RE: [PHP] timing



If the other application is written in PHP you can use flock.
 
Matthew Luchak 
Webmaster
Kaydara Inc. 
[EMAIL PROTECTED]


-Original Message-
From: Caspar Kennerdale [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 16, 2001 11:00 AM
To: Php-General
Subject: [PHP] timing


I have a script that when is executed parses and html file and writes
the
contents to a text file.

I need to then read this text file from another apllication

Is there a way of timing this operation,  so that my other app does not
try
to access the file before being written?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: PHP versus all other languages

2001-11-16 Thread Manuel Lemos

Hello,

Pat Hanna wrote:
 
 I'm doing my senior exit project on database languages online. I'm asking
 for help from anyone who can provide any information on the comparison
 between the different languages. I'm comparing languages such as PHP, ASP,
 ColdFussion, perl and any others that I might not know about that you guys
 might know. Thank you to anyone who helps me out in the least.

If you are going to compare languages for database programming, you may
want to get to know Metabase which is a PHP database abstraction layer
that enables you to develop database independent applications so that
you can use the same application code with any of the supported DBMS
with having to change anything.

http://phpclasses.UpperDesign.com/browse.html/package/20

Regards,
Manuel Lemos

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Example code for multiple uploads? (Using PHP 4.0.6)

2001-11-16 Thread George Whiffen

Nate Carlson wrote:
 
 I'm trying to create a form that supports multiple uploads (of up to 4
 files), but does not require each of them. I've tried all the code
 examples in the PHP documentation, and they don't appear to work with PHP
 4.0.6. Basically, I get the file names returned in the arrays, but the
 array that should contain the name of the temporary file just says 'none'.
 Things work fine for a single upload.
 
 Does anyone have example code for this? Thanks! :)
 
 --
 Nate Carlson [EMAIL PROTECTED]   | Phone : (952)943-8700
 http://www.real-time.com| Fax   : (952)943-8500

Multi loads are fine for me in 4.0.3 at least, but I don't use arrays, each upload has 
a different
name (I gave up on form arrays at IE 3!).  Have you tried giving them unique names?

George

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Re: PHP versus all other languages

2001-11-16 Thread Chris Bailey

PEAR is another db abstraction layer, and potentially will be integrated
into PHP.  I use it for all my DB access (in PHP) now.  In fact, I'd say
it's more powerful and easier than using the mysql_ methods for example.
PEAR uses the standard factory design pattern to determine which DB it's
talking to, etc.  I have not looked at Metabase so can't comment on that.

-Original Message-
From: Manuel Lemos [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 16, 2001 8:09 AM
To: [EMAIL PROTECTED]; Pat Hanna
Subject: [PHP] Re: PHP versus all other languages


Hello,

Pat Hanna wrote:

 I'm doing my senior exit project on database languages online. I'm asking
 for help from anyone who can provide any information on the comparison
 between the different languages. I'm comparing languages such as PHP, ASP,
 ColdFussion, perl and any others that I might not know about that you guys
 might know. Thank you to anyone who helps me out in the least.

If you are going to compare languages for database programming, you may
want to get to know Metabase which is a PHP database abstraction layer
that enables you to develop database independent applications so that
you can use the same application code with any of the supported DBMS
with having to change anything.

http://phpclasses.UpperDesign.com/browse.html/package/20

Regards,
Manuel Lemos

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: apache+php overloading when user clicks many times on the same link

2001-11-16 Thread George Whiffen

Peter Frlicka wrote:
 
 Hello.
 
 What does apache + php do if the user refreshes a page 10 times in a while
 before the scripts finishes? do all 10 .php scripts finish or do the first 9
 get aborted? how can i solve the problem that when someone clicks a lot on a
 link (always the same link) the server gets overloaded (because the action
 taken in the script is somehow memory consuming). i need to ensure a user
 (www) can run only one instance of a .php script.
 
 Peter Frlicka

See http://www.php.net/manual/en/features.connection-handling.php

I'm worried about why the user is clicking so much.  If your connection/processing 
really is going
to take a long time you could consider sending them the first bit of your page as 
quickly as
possible using flush().  That will take away any buttons/links they've clicked on 
(but not
Refresh), and at least make them feel something is happening!

However multiple clicking is a general problem with no great solutions.  It's a 
particularly
important issue for  on-line E-commerce applications when it is not only vital that 
the php script
complete but also that it should not be repeated.   For that you almost have to use a 
database to
record transactions (or at least the session variables which identify a 
transaction).
 
I typically do the following : 

1. set ignore_user_abort

2. check to see if we have a record of this transaction, if we do check to see if it 
is complete. 
If it's complete
take them to a results/end page, if it's not complete take them to a holding page with 
an automatic
META-REFRESH to
the same url.

3. if we have no record of the transaction, create one, do the work, mark the 
transaction as
complete and show them the results/end page.

If the user only clicks once, everything proceeds smoothly and they get their results 
page as
normal.  

If the user clicks two or more times they go to a holding page with an automatic 
refresh which
keeps showing the same holding page until the first script completes and the next 
refresh takes them
to the results.

This is basically a safe approach but it's significant work unless you really need it! 

George

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Loading a dll

2001-11-16 Thread Daniel Berwig

Does anyone know if it is possible to load a dll at runtime that is not in
the extensions_dir configured in the php.ini? And if it is possible, how can
I do it?

Thanks in advance.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Array From DB sQLServer

2001-11-16 Thread Joe Van Meer

Hi there. I have a table called IMAGES and I would like to retrieve all
image_ids and dump into an array. I'm new to php so any help would greatly
be appreciated. I started my code below, but am unsure what to do next :(

Thx Joe:)

'connect to db
$connectionToDBid = odbc_connect(codesnipits, joecode, joecode);


// sql statement
$sqlb = SELECT image_id FROM IMAGES;

'execute the query and dump into $row variable
$row = odbc_fetch_row($connectionToDBid, $sqlb);


'loop through each record and dump image_ids into array

for each($row as $value){
// assign ids to array here???


}







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: PHP versus all other languages

2001-11-16 Thread Manuel Lemos

Hello,

Chris Bailey wrote:
 
 PEAR is another db abstraction layer, and potentially will be integrated
 into PHP.  I use it for all my DB access (in PHP) now.  In fact, I'd say
 it's more powerful and easier than using the mysql_ methods for example.

PEAR is essencially a Perl DBI clone, so it inherits its design
limitations. For instance, since Perl only supports string and integer
scalars, Perl DBI assumes that every field is either an integer or a
text value. This is a bad design decision because for instance, date
fields may be handled as text values, but each DBMS formats date in text
eventually in different ways.

So, if you have to deal with date fields in your Perl-DBI, and
consequently, PEAR-DB database applications, those applications will not
be portable because you will still have to handle the eventual
differences of format representation on the application side because the
Perl-DBI/PEAR-DB will not do it for you.

Metabase handles that in an elegant way. The applications only see dates
formatted in a standard way: ISO 9601 (-MM-DD). If necessary,
Metabase will convert date values back and forth the database. That
works for all other datatypes: integer, text, boolean, date, time,
timestamp, float, decimal and even LOBs (Large Object fields).

The way I see it, using a database abstraction layer in your
applications is only useful for developing database independent
applications. If your abstraction layer does not provide full database
abstraction, you'd better dump it and use the native database API
functions because you will end with a non-portable application anyway,
and at least using the native API functions you don't have to put up
with the overhead that abstraction layers add top your applications.


 PEAR uses the standard factory design pattern to determine which DB it's

I am not sure what you mean by standard factory design so I don't know
what is that good for.


 talking to, etc.  I have not looked at Metabase so can't comment on that.

You should. Metabase has been developing for the last 3 years. It is
very mature and since it was first release publically, its API did not
change in a backwards incompatible way. You may rely on it. It has even
more wonderful features that I have not mentioned and no other database
abstraction package provides, not for PHP, nor for anything else (not
even Java - JDBC). Go ahead, the URL is still below. :-)

Regards,
Manuel Lemos


 
 -Original Message-
 From: Manuel Lemos [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 16, 2001 8:09 AM
 To: [EMAIL PROTECTED]; Pat Hanna
 Subject: [PHP] Re: PHP versus all other languages
 
 Hello,
 
 Pat Hanna wrote:
 
  I'm doing my senior exit project on database languages online. I'm asking
  for help from anyone who can provide any information on the comparison
  between the different languages. I'm comparing languages such as PHP, ASP,
  ColdFussion, perl and any others that I might not know about that you guys
  might know. Thank you to anyone who helps me out in the least.
 
 If you are going to compare languages for database programming, you may
 want to get to know Metabase which is a PHP database abstraction layer
 that enables you to develop database independent applications so that
 you can use the same application code with any of the supported DBMS
 with having to change anything.
 
 http://phpclasses.UpperDesign.com/browse.html/package/20
 
 Regards,
 Manuel Lemos

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: JPG Images from database to filename.jpg

2001-11-16 Thread Mike Gifford

Hi George,

George Whiffen wrote:

 I'm confused. Is your problem serving up the images in your database to the web or 
writing them out
 to files on the server?


Sorry for the confusion..  It was in writing out the database images to 
files on the server.  This is where my problem lies..


 If it's serving images, I would expect you to have: 
 select myimage from db
 Header(Content-type: image/jpeg);
 echo $myrow[myimage];
 exit();


Yes..  This is consistent with what is done in the rest of the script 
and indeed what any of other tutorials describe..


 If it's writing from the db to a real file on your server, I would expect: 
 select myimage from db
 open myfile
 write $myrow[myimage];
 close myfile


I've tried something like this:

$connection = mysql_connect(host, user, pwd);
mysql_select_db(dbname);
$query = 'SELECT imagefiled FROM imagetabel WHERE id = '.$id;
$result = mysql_query($query);
$row = mysql_fetch_row($result);

$fd = fopen( $File.tmb, r+);
$tmb = addslashes(fwrite($fd, $row[0]));
fclose($fd);

However, I can't view the file that is saved (there is a file saved each 
time I do this, but can't tell if it is the appropriate file)..
   I assumed that I needed to include the header file..

The template also doesn't seem to work, but that is because of an error 
I'm getting an error when i run this on the server (the expression of 
what I am trying to do with the system() command below):

djpeg -pnm ReThumbnail.jpg | pnmscale -xscale .1 -yscale .1 | cjpeg  
ReThumbnail.jpg.tmb

Corrupt JPEG data: 67 extraneous bytes before marker 0xc2
Quantization table 0x01 was not defined
pnmscale: Command not found.
Empty input file

I don't know what this all means


 The Header is just for the web, to tell the browser or other client what kind of 
file it is getting
 from your php script since it is not the expected type automatically supplied by the 
web-server
 (text/html).  Real physical files don't need a header.  The web servers 
automatically generate
 appropriate headers for real image files based on the file extension before they 
send them out over
 the web.


So, why can't I see this the 17159 bytes of this image then:
http://www.wtoaction.org/caravan2001/ReThumbnail.jpg

I was assuming that I couldn't see it because I didn't have the header. 
  I was just trying to use ImageJPEG to force in a header.  It would be 
far easier to just write the contents of an image from a database and 
insert them into a file..


 Does that make sense, or have I completely missed the point?


You got the point.. Thanks for your help..  Still not there yet though..

Mike


 Mike Gifford wrote:
 
Hello,

I've got a number of images in a database..  Ultimately what I would
like to do is be able to resize the image that is already in the
database and then insert that image into another field.

Uploading the files generally inserts these both at the same time,
however I need to create a number of new thumbprints based on a
different scale.

What I thought would be easiest would be to take the image, save it to
filename.jpg and then run the thumbnailing script on it.

I think that this would look like the following:

?php
// There's other DB stuff here, but this isn't important
$Images = stripslashes($row[0]);
$File = ReThumbnail.jpg;

// Create JPG image
ImageJPEG(imagecreatefromstring($Images), $File);

// Scale image
system(djpeg -pnm $File | pnmscale -xscale .1 -yscale .1 | cjpeg 
$File.tmb);

// Write thumbprint
$fd = fopen( $File.tmb, r+);
$tmb = addslashes(fread($fd, filesize($File.tmb)));
fclose($fd);

// Insert Thumbprint image into database
$sql = UPDATE Images SET Thumbnail='$tmb' WHERE ID=$ID;
// There's other DB Stuff here too...
?

I'm really quite stuch here..

How do you take a db image of a database and create a physical jpg file?
  I think I'm getting messed up by the header in:

Header(Content-type: image/jpeg);
echo $Images;

I can't figure out how to create the header.  There's lots of examples
of how to do the above, but I have yet to stumble across an example
which allows you to write the header into a file

Suggestions would be appreciated..

Mike




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: JPG Images from database to filename.jpg

2001-11-16 Thread Mike Gifford

Sorry if I wasn't very clear abou tthis..

I don't need to echo the contents to be viewed on the web..  I'm already 
doing that here:

http://www.wtoaction.org/caravan2001/

It's a matter of saving it to a file on the disk (from the database) so 
I can manipulate it with djpeg, pnmscale, cjpeg

Thanks for throwing in the mysql stuff I left out..

Mike

Johan Holst Nielsen wrote:

Header(Content-type: image/jpeg);
echo $Images;

I can't figure out how to create the header.  There's lots of examples
of how to do the above, but I have yet to stumble across an example
which allows you to write the header into a file

 
 You could make a PHP script that generate the picture?
 
 Like this:
 
 ?php
 /* Picture file need an ID!! */
 $connection = mysql_connect(host, user, pwd);
 mysql_select_db(dbname);
 $query = 'SELECT imagefiled FROM imagetabel WHERE id = '.$id;
 $result = mysql_query($query);
 if(mysql_num_rows($result)  0) {
//You got the image
header(Content-type: image/jpeg);
$row = mysql_fetch_row($result);
echo $row[0];
 }
 else {
//No image with that id!
 }
 mysql_close($connection);
 ?
 
 HTML file where the image is:
 
 html
 body
 img src=phpfile.php?id=23 border=0 alt=
 /body
 /html
 
 Dont know if you misunderstand you?
 
 Regards,
 Johan
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Multiviews and GET requests no longer working?

2001-11-16 Thread James Green

Hi all,

So a few weeks back on my Debian Sid box I had everything running
nicely, PHP4, Apache 1.3, and had it such that Multiviews were turned
on, and I could call /foo?id=1 and the file foo.php would register the
variable id as having a value of 1.

I dist-upgraded last weekend (now PHP-4.1.0-RC2), and now it's stopped
working.

If I call foo?id=1, not only is the id variable not set,
_SERVER[QUERY_STRING] isn't either. Cookies and session variables work
fine, it's just variables passed via GET. If I turn off Multiviews, the
variables come through fine, but it means calling foo.php.

This has completely floored me. I don't want to re-write the site with
references to URLs with file extensions -- I deliberately don't want
users to see file extensions.

Anyone had similar problems? Anyone have any ideas what to try? I have
register_globals = On in the php.ini file, nothing in the php.ini or
httpd.conf files appears to have changed.

I'm at a loss. Please help!

Thanks,
James Green



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] quick friday query

2001-11-16 Thread Caspar Kennerdale

I am writing files to my server using

$fp = fopen(myfile.txt, w);

this all works. However in the php manual it says that by using the w
switch that php will create the file if it doesn exist

However this does not seem to work

I can only write to a file that already exists and has CHMOD 777

Is this a school boy error or do I need my server re configured?

Thanks



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: PHP versus all other languages

2001-11-16 Thread George Whiffen

Pat Hanna wrote:
 
 I'm doing my senior exit project on database languages online. I'm asking
 for help from anyone who can provide any information on the comparison
 between the different languages. I'm comparing languages such as PHP, ASP,
 ColdFussion, perl and any others that I might not know about that you guys
 might know. Thank you to anyone who helps me out in the least.
 
 Patrick
 
 --
 Database integration--E-commerce solutions
 The Wentworth Company
 
 Get paid cash every time you receive email!
 Sign up FREE at: http://www.MintMail.com/?m=1080349

What criteria are you thinking of using to compare them?

You might, for example, consider :
   - useability
- supportability
- productivity
- functionality
- performance
- scalability
- stability/robustness
- product support 
- ease of integration with other technologies

and I guess you'll mention cost, but don't forget to include :
- licensing costs
- hardware costs
- development personnel costs e.g. development programmers
- administrative personnel costs e.g. system administrators, DBAs   
- support personnel costs e.g. support programmers

For the record, I'd pick php over the others on the following grounds:

1. ColdFusion worries me when it comes to performance, functionality and its ease of 
integration
with other technologies.  Good integration with the other Macromedia technologies, 
e.g. Dreamweaver,
Flash rather than good integration with databases and third-party web technologies 
smtp/xml etc.

2. ASP has product support,stability,robustness and in particular long-term backward 
compatibility
issues.  I would feel very nervous about signing a five year support contract for an 
ASP application
without plenty of escape clauses!  

3. Perl has issues over useability/supportability primarily because it was never 
designed for web
database applications, not because it can't do them well.  I would rather have to 
maintain an
application someone else wrote in php than the same application written using Perl, 
simply because
the php is likely to be much easier to follow and understand than the Perl.

4. It's not easy to find fault with php, except when it comes to marketing.  It's 
grossly undersold,
but then some of us find that very refreshing ;).



George
George.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] HELP ME!!!!

2001-11-16 Thread P. Roescher

The script I have: 
?
 $query = SELECT * FROM members ORDER BY MemberName ASC; 
 $player = MYSQL_QUERY($query); 
 $Aantal_play = MYSQL_NUM_ROWS($player);
 $x=0;
 while ($x  $Aantal_play) : 
   $name = mysql_result($player,$x,MemberName);$name = $name +
NAME; ? tr
  td width=25% height=18
font face=Verdana size=2 color=#FF? print $name;
?/font
  /td
  td width=75% height=18
input type=checkbox name=?print $name? value=ON
  /td
/tr
? 
  $x++; 
  endwhile; 
?
The Problem I have:
How can i read all checkboxes?!?
Please respond with a source



Re: [PHP] quick friday query

2001-11-16 Thread James Green

On Fri, 2001-11-16 at 17:49, Caspar Kennerdale wrote:
 I am writing files to my server using
 
 $fp = fopen(myfile.txt, w);
 
 this all works. However in the php manual it says that by using the w
 switch that php will create the file if it doesn exist
 
 However this does not seem to work
 
 I can only write to a file that already exists and has CHMOD 777
 
 Is this a school boy error or do I need my server re configured?

Sounds like the webserver doesn't have permission to write into that
directory. Permissions 777 lets anyone write to the file, so there's a
good chance I'm right.

jg



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] quick friday query

2001-11-16 Thread R'twick Niceorgaw

check under what user Apache is running ( mostly nobody  ). You have to give
write permission on the directory where you want the files to be to that
user. For security reasons, just don't give write access on your
document_root, instead create a directory outside ( or within) your
document_root and give write access on it to nobody ( Apache user id) and
write your file there.
- Original Message -
From: Caspar Kennerdale [EMAIL PROTECTED]
To: Php-General [EMAIL PROTECTED]
Sent: Friday, November 16, 2001 12:49 PM
Subject: [PHP] quick friday query


 I am writing files to my server using

 $fp = fopen(myfile.txt, w);

 this all works. However in the php manual it says that by using the w
 switch that php will create the file if it doesn exist

 However this does not seem to work

 I can only write to a file that already exists and has CHMOD 777

 Is this a school boy error or do I need my server re configured?

 Thanks



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Loading a dll

2001-11-16 Thread Henrik Hansen

[EMAIL PROTECTED] (Daniel Berwig) wrote:

  Does anyone know if it is possible to load a dll at runtime that is not in
  the extensions_dir configured in the php.ini? And if it is possible, how can
  I do it?

if anything dl() does it.

-- 
Henrik Hansen

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Loading a dll

2001-11-16 Thread Daniel Berwig

The problem is that the php tries to load the dll from the extension_dir. Is
there a way to make it load from anywhere else?

Henrik Hansen [EMAIL PROTECTED] escreveu na mensagem
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 [EMAIL PROTECTED] (Daniel Berwig) wrote:

   Does anyone know if it is possible to load a dll at runtime that is not
in
   the extensions_dir configured in the php.ini? And if it is possible,
how can
   I do it?

 if anything dl() does it.

 --
 Henrik Hansen



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Array From DB sQLServer

2001-11-16 Thread Joe Van Meer

got it :) thx for looking

Joe Van Meer [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there. I have a table called IMAGES and I would like to retrieve all
 image_ids and dump into an array. I'm new to php so any help would greatly
 be appreciated. I started my code below, but am unsure what to do next :(

 Thx Joe:)

 'connect to db
 $connectionToDBid = odbc_connect(codesnipits, joecode, joecode);


 // sql statement
 $sqlb = SELECT image_id FROM IMAGES;

 'execute the query and dump into $row variable
 $row = odbc_fetch_row($connectionToDBid, $sqlb);


 'loop through each record and dump image_ids into array

 for each($row as $value){
 // assign ids to array here???


 }









-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Loading a dll

2001-11-16 Thread Henrik Hansen

[EMAIL PROTECTED] (Daniel Berwig) wrote:

  The problem is that the php tries to load the dll from the extension_dir. Is
  there a way to make it load from anywhere else?

try to supply a path in dl().

-- 
Henrik Hansen

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] quick friday query

2001-11-16 Thread caspar kennerdale

ahh

write permission the folder- duh- not thinkingtoday

thank alot

-Original Message-
From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED]]
Sent: 16 November 2001 18:14
To: Caspar Kennerdale; Php-General
Subject: Re: [PHP] quick friday query


check under what user Apache is running ( mostly nobody  ). You have to give
write permission on the directory where you want the files to be to that
user. For security reasons, just don't give write access on your
document_root, instead create a directory outside ( or within) your
document_root and give write access on it to nobody ( Apache user id) and
write your file there.
- Original Message -
From: Caspar Kennerdale [EMAIL PROTECTED]
To: Php-General [EMAIL PROTECTED]
Sent: Friday, November 16, 2001 12:49 PM
Subject: [PHP] quick friday query


 I am writing files to my server using

 $fp = fopen(myfile.txt, w);

 this all works. However in the php manual it says that by using the w
 switch that php will create the file if it doesn exist

 However this does not seem to work

 I can only write to a file that already exists and has CHMOD 777

 Is this a school boy error or do I need my server re configured?

 Thanks



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] random images fom db

2001-11-16 Thread Joe Van Meer

Hi there. I have s a php page that randomly grabs an image's path from a db
field and displays it on my php page. My problem is that sometimes when I
refresh the image won't display. So I guess you can say I'm getting
intermittent images...sometimes it displays and sometimes not. I've checked
all of my paths for all of the images and they are all the same. My code is
below.

Thx,  Joe

/connect to db
$connectionToDBid = odbc_connect(codesnipits, joecode, joecode);


// sql statement
$sqlb = SELECT image_id FROM IMAGES;

/run the query and dump into $row variable
$row = odbc_do($connectionToDBid, $sqlb);

//  create an array
$myArray = Array();
srand ((float) microtime() * 1000);

/loop through each record and dump image_ids into array

while(odbc_fetch_row($row)){
// grab and assign ids to array
$imageid = odbc_result($row,1);
$myArray[] = $imageid ;

}

/loop through and print out array values
foreach ($myArray as $value){
print $value;
}


/create $randomimageid  variable here
$randomimageid = array_rand($myArray,1);





/create query statement to grab random image path and dump into variable --
randomimage
$sqlr = SELECT imagepath FROM IMAGES WHERE image_id = $randomimageid;


/run the sql statement on the connection made
$resultset = odbc_do($connectionToDBid, $sqlr);

/dump into $randomimage here
$randomimage = odbc_result($resultset, 1);


/close connection to db
odbc_close($connectionToDBid);

print brbrbrdiv align='center';
print table width='400' border=0 cellpadding=2 ;
print trtd align='left' ;
print  font color='#ff' face='verdana'h4 . Welcome back  .
$firstname . /h4/font;
print /td/tr;
print trtd align='center' ;
print img src='$randomimage'  align='center' border='0'br;
print /td/tr;
print /table;



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: JPG Images from database to filename.jpg

2001-11-16 Thread Mike Gifford

Hello,

Jtjohnston wrote:

 See these. Reduire.phps probably has what you want.
  http://www.collegesherbrooke.qc.ca/si/php/exemples/photos/reduire.phps

This is what I was looking for I think..  But it still gives me an 
error..  This one actually got inserted right into the database:

br bWarning/b: Data is not in a recognized format. in 
b/home/mike/wtoaction/public_html/caravan2001/edit_image_handler.php/b 
on line b65/bbr br bWarning/b: Supplied argument is not a 
valid Image resource in 
b/home/mike/wtoaction/public_html/caravan2001/edit_image_handler.php/b 
on line b34/bbr br bWarning/b: Supplied argument is not a 
valid Image resource in 
b/home/mike/wtoaction/public_html/caravan2001/edit_image_handler.php/b 
on line b40/bbr

This is these are the relenvant pieces of the code..

Any suggestions would be appreciated..

Mike

?php php_track_vars?
?php

include config.inc.php;
include $baseDIR/php-dbi.inc;
include $baseDIR/connect.inc;
include $baseDIR/misc.inc;

function ResizeImage( $srcImage, $srcWidth, $srcHeight, $xscale, $yscale) {
// http://www.collegesherbrooke.qc.ca/si/php/exemples/photos/reduire.phps
//obtain the original image Height and Width
// $srcWidth = ImageSX( $srcImage );
// $srcHeight = ImageSY( $srcImage );

// the following portion of code checks to see if
// the width  height or if width  height
// if so it adjust accordingly to make sure the image
// stays smaller then the $newWidth and $newHeight
// $ratioWidth = $srcWidth/$newWidth;
// $ratioHeight = $srcHeight/$newHeight;

// if( $ratioWidth  $ratioHeight){
// $destWidth = $srcWidth/$ratioHeight;
// $destHeight = $newHeight;
// }else{
// $destWidth = $newWidth;
// $destHeight = $srcHeight/$ratioWidth;
// }

$destWidth = $srcWidth * $xscale;
$destHeight = $srcHeight * $yscale;

$destImage = imagecreate($destWidth, $destHeight);
ImageCopyResized( $destImage, $srcImage, 0, 0, 0, 0, $destWidth, 
$destHeight, $srcWidth, $srcHeight );

//  (changer selon le genre)
ImageJPEG($destImage,,100);

//free the memory used for the images
ImageDestroy( $srcImage );
ImageDestroy( $destImage );
}

if(!isAdmin())
{
 die(Must be admin!);
}

if(!isset($ID)) { die(You must have an ID to proceed); }

if($ReThumbnail) {
ob_start();

$sql = SELECT Image FROM Images,Width,Height WHERE ID='$ID';
$res = dbi_query ( $sql );
if ( $res ) {
  if($row = dbi_fetch_row( $res ))
  dbi_free_result ( $res );
  $Images = stripslashes($row[0]);
  $Width = stripslashes($row[1]);
  $Height = stripslashes($row[2]);
}
// echo Image: br$Images;

$srcimage = imagecreatefromstring($Images);
ResizeImage( $srcImage, $Width, $Height, $xscale, $yscale);

//copy output buffer to string
$resizedImage = ob_get_contents();
//clear output buffer that was saved
ob_end_clean();
$tmb = addslashes($resizedImage);

$sql = UPDATE Images SET Thumbnail='$tmb' WHERE ID=$ID;
if(dbi_query($sql)) {
echo ReThumbnailing Successful;
exit;
} else {
$error = dbi_error ();
}
}


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] quick friday query

2001-11-16 Thread Brian Paulson

Casper,


My guess would be that the folder that you are trying to write the file
to doesn't have the correct permissions to allow the webserver to write
to it.

Try that and let me know if it works!

Thank You
Brian Paulson
Sr. Web Developer
[EMAIL PROTECTED]
http://www.chieftain.com

-Original Message-
From: Caspar Kennerdale [mailto:[EMAIL PROTECTED]] 
Sent: Friday, November 16, 2001 9:49 AM
To: Php-General
Subject: [PHP] quick friday query


I am writing files to my server using

$fp = fopen(myfile.txt, w);

this all works. However in the php manual it says that by using the w
switch that php will create the file if it doesn exist

However this does not seem to work

I can only write to a file that already exists and has CHMOD 777

Is this a school boy error or do I need my server re configured?

Thanks



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Loading a dll

2001-11-16 Thread Daniel Berwig

It doesn't load the dll, when specifying the path (relative path neither
absolute path).

Any solution?


Daniel Berwig


Henrik Hansen [EMAIL PROTECTED] escreveu na mensagem
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 [EMAIL PROTECTED] (Daniel Berwig) wrote:

   The problem is that the php tries to load the dll from the
extension_dir. Is
   there a way to make it load from anywhere else?

 try to supply a path in dl().

 --
 Henrik Hansen



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: JPG Images from database to filename.jpg

2001-11-16 Thread Mike Gifford

Sorry, couple post-Post changes..

The initial query should have been:
 $sql = SELECT Image,Width,Height FROM Images WHERE ID='$ID';

The an echo of the UPDATE sql now looks like this:

UPDATE Images SET Thumbnail='
Warning: Supplied argument is not a valid Image resource in 
/home/mike/wtoaction/public_html/caravan2001/edit_image_handler.php on 
line 34
ÿØÿà\0JFIF\0\0\0\0\0\0ÿþ\0 Warning: Supplied argument is not a valid Image 
resource in 
/home/mike/wtoaction/public_html/caravan2001/edit_image_handler.php on 
line 40
' WHERE ID=95ReThumbnailing Successful



This is the essential part of the script which is displaying the data now:

$sql = SELECT Format,Image FROM Images WHERE ID=$ID;
$res = dbi_query ( $sql );
if ( $res )
{
   if( $row = dbi_fetch_row ( $res ) )
   {
 Header(Content-type: image/jpeg);
 echo $row[1];
   }
   dbi_free_result ( $res );
}

The image looks just fine here:
http://www.wtoaction.org/caravan2001/image.php?ID=95

I must be missing something really simple..

Mike


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Parse POST-Data myself

2001-11-16 Thread jimmy elab

Andrew Forgue wrote:
 
 By putting brackets after the variable name [] in a form element
 
 input type=text name=text[]
 input type=text name=text[]
 input type=text name=text[]

BLAAACH!!! Please add an index variable, as fields that you don't need
wil NOT be posted, so when you have several fields for one single
dataset, you might end up with the wrong set of indexes.

Adding them now, you'll never regret. 
Forget them now and you will regret it later...

  for ($i= 1; $i= 3; $i++) {
  ?
 input type=text name=text[?php echo $il ?]
  ?php
  }

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] SQL question. how relevent are the search results ?

2001-11-16 Thread Chris Lee

if I give the user a search and he enters 'cat dog' I am going to want to
find all the results that have the word 'cat' or 'dog' in them, but I want
all the results that have 'cat' and 'dog' at the beginning of the results
because these would be more relevent. now how I see it is this, it aint
pretty.

$result = select * from product where product_feature like '%cat%' and
product_feature like '%dog%'
foreach( $result as $pos = $val )
$name[$val['product_id']] = $val['product_name']
$result = select * from product where product_feature like '%cat%' or
product_feature like '%dog%'
foreach( $result as $pos = $val )
$name[$val['product_id']] = $val['product_name']
foreach( $name as $pos = $val )
echo $val br;

this will put the 'AND' before the 'OR'. but its not nice, would be nice if
I could do this with one simple query. this is only with two keywords. with
three its gets exponentially nasty.

'cat dog mouse'

$result = select * from product where product_feature like '%cat%' and
product_feature like '%dog%' and product_feature like '%mouse%'
foreach( $result as $pos = $val )
$name[$val['product_id']] = $val['product_name']
$result = select * from product where product_feature like '%cat%' and
product_feature like '%dog%'
foreach( $result as $pos = $val )
$name[$val['product_id']] = $val['product_name']
$result = select * from product where product_feature like '%cat%' and
product_feature like '%mouse%'
foreach( $result as $pos = $val )
$name[$val['product_id']] = $val['product_name']
$result = select * from product where product_feature like '%dog%' and
product_feature like '%mouse%'
foreach( $result as $pos = $val )
$name[$val['product_id']] = $val['product_name']
$result = select * from product where product_feature like '%cat%' or
product_feature like '%dog%' or product_feature like '%mouse%'
foreach( $result as $pos = $val )
$name[$val['product_id']] = $val['product_name']
foreach( $name as $pos = $val )
echo $val br;

ouch, this is just nasty, not good. there must be a better way. accually
writing code to take a dynamic number of keywords is guna be ugly.

any SQL idea's ? yes I know this is a php forum, but its related.

--

  Chris Lee
  [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Parse POST-Data myself

2001-11-16 Thread jimmy elab

Jimmy Elab wrote:
  input type=text name=text[?php echo $il ?]

When your not positioned straigth at your keyboard a ';' may
occasionally turn into an 'l'...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] switch() for links like ?id=index problem

2001-11-16 Thread Ann Jamison

my code looks something like this:

switch($id) {
case home: include(home.php);
break;
}
so links can be something like www.url.com?id=home
I have also tried to use require instead of include

When the desitred link is clicked, the page loads the new link, but also
includes my index page taked onto the bottom of the new pages.

what can I do to prevent this?





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: random images fom db

2001-11-16 Thread Joe Van Meer

Got it...if anyone's interested the code is below :)

/connect to db
$connectionToDBid = odbc_connect(codesnipits, joecode, joecode);


// sql statement
$sqlb = SELECT imagepath FROM IMAGES;

/ run the query and dump into $numberofrecords variable
$row = odbc_do($connectionToDBid, $sqlb);

//  create an array
$myArray = Array();

/ seed random number generator
srand ((float) microtime() * 1000);

/ loop through each record and dump image paths into array

while(odbc_fetch_row($row)){
// grab and assign all image paths to array
$imagepath = odbc_result($row,1);
$myArray[] = $imagepath ;

}


/ grab a random index from $myArray here
$imagearrayindex = array_rand($myArray);
$randomimage = $myArray[$imagearrayindex];


print brbrbrdiv align='center';
print table width='400' border=0 cellpadding=2 ;
print trtd align='left' ;
print  font color='#ff' face='verdana'h4 . Welcome back  .
$firstname . /h4/font;
print /td/tr;
print trtd align='center' ;
print img src=' . $randomimage .'  align='center' border='0'br;
print /td/tr;
print /table;




Joe Van Meer [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there. I have s a php page that randomly grabs an image's path from a
db
 field and displays it on my php page. My problem is that sometimes when I
 refresh the image won't display. So I guess you can say I'm getting
 intermittent images...sometimes it displays and sometimes not. I've
checked
 all of my paths for all of the images and they are all the same. My code
is
 below.

 Thx,  Joe

 /connect to db
 $connectionToDBid = odbc_connect(codesnipits, joecode, joecode);


 // sql statement
 $sqlb = SELECT image_id FROM IMAGES;

 /run the query and dump into $row variable
 $row = odbc_do($connectionToDBid, $sqlb);

 //  create an array
 $myArray = Array();
 srand ((float) microtime() * 1000);

 /loop through each record and dump image_ids into array

 while(odbc_fetch_row($row)){
 // grab and assign ids to array
 $imageid = odbc_result($row,1);
 $myArray[] = $imageid ;

 }

 /loop through and print out array values
 foreach ($myArray as $value){
 print $value;
 }


 /create $randomimageid  variable here
 $randomimageid = array_rand($myArray,1);





 /create query statement to grab random image path and dump into
variable --
 randomimage
 $sqlr = SELECT imagepath FROM IMAGES WHERE image_id = $randomimageid;


 /run the sql statement on the connection made
 $resultset = odbc_do($connectionToDBid, $sqlr);

 /dump into $randomimage here
 $randomimage = odbc_result($resultset, 1);


 /close connection to db
 odbc_close($connectionToDBid);

 print brbrbrdiv align='center';
 print table width='400' border=0 cellpadding=2 ;
 print trtd align='left' ;
 print  font color='#ff' face='verdana'h4 . Welcome back  .
 $firstname . /h4/font;
 print /td/tr;
 print trtd align='center' ;
 print img src='$randomimage'  align='center' border='0'br;
 print /td/tr;
 print /table;





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Example code for multiple uploads? (Using PHP 4.0.6)

2001-11-16 Thread Nate Carlson

On Fri, 16 Nov 2001, George Whiffen wrote:
 Multi loads are fine for me in 4.0.3 at least, but I don't use arrays,
 each upload has a different name (I gave up on form arrays at IE 3!).
 Have you tried giving them unique names?

I was hoping to avoid that.  :)

I'll give it a shot, though. Thanks!

-- 
Nate Carlson [EMAIL PROTECTED]   | Phone : (952)943-8700
http://www.real-time.com| Fax   : (952)943-8500



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Php Array

2001-11-16 Thread Wee Chua

Hi all,
How can I send the values inside the array into a function for calculation?

Thank you,
Calvin

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Php Array

2001-11-16 Thread Boget, Chris

 How can I send the values inside the array into a function 
 for calculation?

function addValues( $arrayVar ) {
  $reteval = 0;

  foreach( $arrayVar as $element ) {
$retval += $element;

  }

  return $retval;

}

$myArray = array( 1, 2, 3, 4, 4 );

echo addValues( $myArray );

Chris



[PHP] php switch() problem

2001-11-16 Thread Ann Jamison

I'm using switches to make liunks like www.link.com?go=home

code :

switch($go) {
case home:include (home.php);
break;
}
etc, also tried require stead of include.

what i get is the requested liunk loaded on top of the index.php page on the
same page, check it out @ www.ribec.airann.com

what can be done to stop this?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Install php+Apache on win98

2001-11-16 Thread Worapoj Kiatsuksri

I config PHP4.0.6 for Apache 1.3.12 on Win32

: in apache configuation file:

ScriptAlias /php/ C:/PHP/
AddType application/x-httpd-php .php
Action application/x-httpd-php /php/php.exe

then I test with phpinfo.php file in htdocs directory.

: phpinfo.php :

?php phpinfo(); ?

when I type: http://localhost/phpinfo.php, Browser should show me some information 
table but It show me the original code.

?php phpinfo(); ?

What happen and What should I do?

Thanks
Worapoj



RE: [PHP] php switch() problem

2001-11-16 Thread Kees Hoekzema

hey

use exit; instead of break;

break breaks the switch statement and continues with the
code below, exit exits the script (en doesnt execute any
code below the switch statement)

Kees

 -Original Message-
 From: Ann Jamison [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 16, 2001 1:44 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] php switch() problem


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] RE: webmaster@php.net dude

2001-11-16 Thread Andrew Chase

I'm cheap too.  That's why I use a free editor that does support line
numbers, like ConTEXT (http://www.fixedsys.com/context/) or EMACS.  It's
been a long time since I had debugged anything in PERL, but it seems to me
that knowing exactly which line the problem is occurring on is a lot more
helpful than knowing what it occurred near.  As for knowing exactly what the
problem is, that usually becomes self-evident once you look at the line
indicated in the error message or the line immediately before or after.

But, A chacun son gout as they say.

-Andy


 The only thing I would love to know is why isn't error checking more
 precise/helpful. If I leave off a { by accident, why can't the error
 say:
 Duh! ERROR!! Alarm, alarm, alarm
 You left of a } ya idiot!
 Go look NEAR something and correct it stupid! g

 I - at least - am cheap and use Wordpad to do my PHPing. Looking up line
 numbers SUuuucks.

 One advantage to Perl. Maybe the only one left!

 IS ANYONE LISTENING!!

 Thanks, g

 John


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] I have pulled all my hair out - imap_sort still not working - please help!

2001-11-16 Thread richard phynga

Thanks for the thought Alex,
alas, unlike other languages, PHP handles ANY scalar value in a switch
statement, including variables

So now I an really stumped !!

I am gonna try a whole series of 'ifs' though and deal with the ugliness
of it !

thanks again for your post,

regards

richard

--- Alec Smith [EMAIL PROTECTED] wrote:
 One thing -- If I'm not mistaken, you can only use a
 switch/case/break/case/etc construct for types that resolve to an
 integer
 type -- either an int or a char. To do comparisons based on strings, I
 think you'll need strcmp() and a whole lot of if/else if blocks.
 
 
 
 On Wed, 14 Nov 2001, richard phynga wrote:
 
  Hello people out there,
 
  I have been tearing my hair out with this one, as I cannot get
 imap_sort
  to perform correctly.
 
  below is the piece of code that I use. of all the sort types, only
  SORTSIZE works. All the otheres give incorreclty sorted lists.
 
  to see an example of this please go to :
 
  http://www.tijuana.com
 
  login : phplist
  passwd : phplistphp
 
  and send the account an email. Click on the header columns to sort the
  headers.
 
  please tell me what I am doing wrong. I cant stare at it any
 longer :(
  ___
  machine OS specs:
  RH7.1, php4.0.5, wu-imap, apache1.3.19
  ---
  ---code snip ---
 
  $newstrm = imap_open ($ms.$selectedmb, $usr, $usrpwd) or die (cant
  connect: .imap_last_error());
switch ($sortby) {
  case date:
$sorted_headers = imap_sort($newstrm,SORTDATE, $rev_flag,'');
break;
  case subject:
$sorted_headers = imap_sort($newstrm,SORTSUBJECT, $rev_flag,'');
break;
  case tag:
if ($tag == From) {
$sorted_headers = imap_sort($newstrm,SORTFROM, $rev_flag,'');
} else {
$sorted_headers = imap_sort($newstrm,SORTTO, $rev_flag,'');
}
break;
  case size:
$sorted_headers = imap_sort($newstrm,SORTSIZE, $rev_flag,'');
break;
}
while (list(,$qq) = each($sorted_headers)) {
  $header = imap_headerinfo($newstrm, $qq);
  $msgnumber = $header-Msgno;
 
  etc etc etc..
 
  --- code snip -
 
  but hte order never come out correct. The listing of using the sort by
  does change, but it is not correct.
 
  thanks in advance
 
  richard
 
  __
  Do You Yahoo!?
  Find the one for you at Yahoo! Personals
  http://personals.yahoo.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 
 
 


__
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] eregi_replace probs

2001-11-16 Thread phantom

function scan_string($str) {
$forbid = array (coke, tylenol, ford);
$swap = array (pepsi, advil, chevrolet);
for ($i = 0; $i  count ($forbid); $i++) {
 eregi_replace($forbid[$i],$swap[$i],$str);
}
}

I run this script, and I know the array's load up and the for...do loop
runs ok.  As does the passing variable ($str).

I enter a test script such as I like coke. and my returned value
remains I like coke.

It appears the eregi_replace is the problem.

Any idea why?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




  1   2   >