Re: [PHP] Inner Join or 2nd Query...?

2005-05-12 Thread Mark Sargent
Kristen G. Thorson wrote:
I don't understand what you're trying to do.  Do you want two separate 
list boxes, one for product types and one for makers?  If so, use two 
queries.  Use the same block of code you have for product types to 
populate the makers box.  If that's not what you're looking for, you 
need to describe what your goal is.  You might also give more of your 
table structure since you're asking about joins.

kgt
Mark Sargent wrote:
Hi All,
with wanting to show both product types(Switch, Router etc) and 
Makers(Cisco, Avaya, etc) on the one page in select boxes, I was 
wondering, do you use 2 seperate queries to the database or do you 
inner join to get all in 1..? I have set up different tables with 
related id's etc. So, to get Products.product_name and 
Products.product_id along with what the below query pulls, what wold 
be best..? I believe if I do a 2nd query, than some variables need to 
be identified with the particular query, yes..? Cheers.

html
body
hr
h1 align=centerJUMBO STATUS/h1p
centerUsed Hardware Specialist/center
hr
h2 align=centerAdmin/h2
table align=center border=2
tr
tdh3 align=centerPRODUCT TYPE/h3/td
/tr
trtdcenter
select name=poduct_type
?php
$db = mysql_connect(localhost, root, grunger);
mysql_select_db(status,$db);
$result = mysql_query(SELECT ProductTypes.product_type_detail, 
ProductTypes.product_type_id FROM ProductTypes,$db);
$num = mysql_num_rows($result);
for ($i=0; $i$num; $i++){
$myrow=mysql_fetch_array($result);
$product_type=mysql_result($result,$i,product_type_detail);
$product_type_id=mysql_result($result,$i,product_type_id);
echo option value=\$product_type_id\$product_type/optionbr;
}
?
/select
/center
/td/tr
/table
p
p
p
hrcenteremail: [EMAIL PROTECTED]p
Telephone: 03-5209-1777p
Fax: 03-5209-2539
/center
hr
/body
/html



Hi All,
I'll try this differently(I hope). With the below code, variables are 
named/set twice ($db, $num, $result, $myrow) etc. In ASP, from what I 
remember, that would be a no no. Currently, this code only populates the 
1st select box. Coupla Qs. Do I have to connect to the db again, in the 
second block of code..? Should the variables in the 2nd block of code, 
be named differently to the 1st block.? In ASP the query variables would 
be named uniquely, identifying to each query like so, prod_query_num, 
prod_query_result and so forth. I must admit, my recollection of ASP is 
very vague. Anyway, I hope this explains what I'm looking to understand. 
Cheers.

Mark Sargent.
html
body
hr
h1 align=centerJUMBO STATUS/h1p
centerUsed Hardware Specialist/center
hr
h2 align=centerAdmin/h2
table align=center border=2
tr
tdh3 align=centerPRODUCT TYPE/h3/td
/tr
trtdcenter
select name=poduct_type
?php
$db = mysql_connect(localhost, root, grunger);
mysql_select_db(status,$db);
$result = mysql_query(SELECT ProductTypes.product_type_detail, 
ProductTypes.product_type_id FROM ProductTypes,$db);
$num = mysql_num_rows($result);
for ($i=0; $i$num; $i++){
$myrow=mysql_fetch_array($result);
$product_type=mysql_result($result,$i,product_type_detail);
$product_type_id=mysql_result($result,$i,product_type_id);
$maker=mysql_result($result,$i,maker_detail);
$maker_id=mysql_result($result,$i,maker_id);
echo option value=\$product_type_id\$product_type/optionbr;
}
?
/select
/center
/td/tr
/table
table align=center border=2
tr
tdh3 align=centerMaker/h3/td
/tr
trtdcenter
select name=slect_maker
?php
$db = mysql_connect(localhost, root, grunger);
mysql_select_db(status,$db);
$result = mysql_query(SELECT Makers.maker_id Makers.maker_detail FROM 
Makers,$db);
$num = mysql_num_rows($result);
for ($i=0; $i$num; $i++){
$myrow=mysql_fetch_array($result);
$maker=mysql_result($result,$i,maker_detail);
$maker_id=mysql_result($result,$i,maker_id);
echo option value=\$maker_id\$maker/optionbr;
}
?
/select
/center
/td/tr
/table
p
p
p
hrcenteremail: ???p
Telephone:p
Fax: ?
/center
hr
/body
/html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Parsing XML with php

2005-05-12 Thread Merlin
Hi there,
I am curious if PHP is now able to pars xml without aditional tools like xmlrpc.
If yes which version is required? Is the current php 4.x tree sufficient?
Thanx, Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] str_replace on words?

2005-05-12 Thread Merlin
Duncan Hill wrote:
On Wednesday 11 May 2005 17:13, Merlin wrote:
Hi there,
I am trying to strip some words from a sentence. I tried it with
str_replace like described here:
http://www.totallyphp.co.uk/code/find_and_replace_words_in_a_text_string_us
ing_str_replace.htm
Unfortunatelly it does not work the way I want, because if I want to
replace the word in all passages containing the characters in are
replaced. For example Singapore.

You need to tokenize your input and do exact matching.  Alternately, 
preg_match / preg_replace may work with \b to specify word boundries.
Hi Duncan,
that in fact was the key and only way to get a proper result.
I found this script on the preg_replace page of php.net:
// Function highlights $words in $str
function highlight_words($str, $words) {
  if(is_array($words)) {
   foreach($words as $k = $word) {
 $pattern[$k] = /\b($word)\b/is;
 $replace[$k] = 'b\\1/b';
   }
  }
  else {
   $pattern = /\b($words)\b/is;
   $replace = 'b\\1/b';
  }
  return preg_replace($pattern,$replace,$str);
}
Which works excellent!
Thanx, Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Inner Join or 2nd Query...?

2005-05-12 Thread Richard Lynch
On Wed, May 11, 2005 10:19 pm, Mark Sargent said:
 I'll try this differently(I hope). With the below code, variables are
 named/set twice ($db, $num, $result, $myrow) etc. In ASP, from what I
 remember, that would be a no no. Currently, this code only populates the

I don't think ASP would issue an error if you re-used a variable...

In fact, I can almost guarantee I re-used variables all the time in ASP.

There might have been some kind of Programming Guidelines where you worked
that said not to do that, though...

 1st select box. Coupla Qs. Do I have to connect to the db again, in the
 second block of code..? Should the variables in the 2nd block of code,
 be named differently to the 1st block.? In ASP the query variables would
 be named uniquely, identifying to each query like so, prod_query_num,
 prod_query_result and so forth. I must admit, my recollection of ASP is
 very vague. Anyway, I hope this explains what I'm looking to understand.
 Cheers.

 Mark Sargent.

 html
 body
 hr
 h1 align=centerJUMBO STATUS/h1p
 centerUsed Hardware Specialist/center
 hr
 h2 align=centerAdmin/h2
 table align=center border=2
 tr
 tdh3 align=centerPRODUCT TYPE/h3/td
 /tr
 trtdcenter
 select name=poduct_type
 ?php


 $db = mysql_connect(localhost, root, grunger);
 mysql_select_db(status,$db);
 $result = mysql_query(SELECT ProductTypes.product_type_detail,
 ProductTypes.product_type_id FROM ProductTypes,$db);
 $num = mysql_num_rows($result);


I would move all of this stuff OUTSIDE the select because after you add
your error messages, you'll never see them if they are inside the
select.


 for ($i=0; $i$num; $i++){
 $myrow=mysql_fetch_array($result);
 $product_type=mysql_result($result,$i,product_type_detail);
 $product_type_id=mysql_result($result,$i,product_type_id);
 $maker=mysql_result($result,$i,maker_detail);
 $maker_id=mysql_result($result,$i,maker_id);
 echo option value=\$product_type_id\$product_type/optionbr;

You are not using maker, nor maker_id, so why put them in the query, and
why get them from your result set?

 }
 ?
 /select
 /center
 /td/tr
 /table
 table align=center border=2
 tr
 tdh3 align=centerMaker/h3/td
 /tr
 trtdcenter
 select name=slect_maker
 ?php
 $db = mysql_connect(localhost, root, grunger);

Don't connect to the database twice.

That's the most expensive (time-wise) thing in your whole script, probably.

 mysql_select_db(status,$db);

And you don't need this either.

 $result = mysql_query(SELECT Makers.maker_id Makers.maker_detail FROM
 Makers,$db);
 $num = mysql_num_rows($result);

Again, move these outside the select

 for ($i=0; $i$num; $i++){
 $myrow=mysql_fetch_array($result);
 $maker=mysql_result($result,$i,maker_detail);
 $maker_id=mysql_result($result,$i,maker_id);
 echo option value=\$maker_id\$maker/optionbr;
 }
 ?
 /select
 /center
 /td/tr
 /table
 p
 p
 p
 hrcenteremail: ???p
 Telephone:p
 Fax: ?
 /center
 hr
 /body
 /html

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] MySql injections (related question)

2005-05-12 Thread Richard Lynch
On Wed, May 11, 2005 8:58 pm, Jason Wong said:
 Well put it this way, addslashes() was not meant to make data safe for
 mysql, it just happened to work. Now there is a better/official/whatever
 alternative why not use it?

Actually, unless I'm very much mistaken about why addslashes() was
written, it *WAS* (and *IS*) designed to make data safe for MySQL.

Okay, maybe technically it was first written for mSQL, but that being in
the state it is, and the current state of affairs of PHP/MySQL...

I'd bet a dollar that if the MySQL C Client library changed what needs
escaping, addslashes would change with it.

Am I delusional?

What problem do you think addslashes() was written to solve?

PS On the language/encoding thing... I don't think I'll ever figure that
stuff out before I die, so there's not much point worrying about it,
though I can certainly see why it's an atrractive MUST USE for those who
can actually cope with more than one natural language!

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] MySql injections (related question)

2005-05-12 Thread Richard Lynch
On Wed, May 11, 2005 8:27 pm, James Williams said:
 On 5/11/05, Richard Lynch [EMAIL PROTECTED] wrote:
 Is mysql_real_escape_string *DIFFERENT* in some incredibly huge secure
 way
 that I want to stop working on all my current projects to go re-write
 the
 10,000,000 lines of code?

 2 words: Search  Replace.

2 words: Magic Quotes

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Inner Join or 2nd Query...?

2005-05-12 Thread Mark Sargent
Richard Lynch wrote:
On Wed, May 11, 2005 10:19 pm, Mark Sargent said:
 

I'll try this differently(I hope). With the below code, variables are
named/set twice ($db, $num, $result, $myrow) etc. In ASP, from what I
remember, that would be a no no. Currently, this code only populates the
   

I don't think ASP would issue an error if you re-used a variable...
In fact, I can almost guarantee I re-used variables all the time in ASP.
There might have been some kind of Programming Guidelines where you worked
that said not to do that, though...
 

Yep, I didn't make any sense there.
 

1st select box. Coupla Qs. Do I have to connect to the db again, in the
second block of code..? Should the variables in the 2nd block of code,
be named differently to the 1st block.? In ASP the query variables would
be named uniquely, identifying to each query like so, prod_query_num,
prod_query_result and so forth. I must admit, my recollection of ASP is
very vague. Anyway, I hope this explains what I'm looking to understand.
Cheers.
Mark Sargent.
html
body
hr
h1 align=centerJUMBO STATUS/h1p
centerUsed Hardware Specialist/center
hr
h2 align=centerAdmin/h2
table align=center border=2
tr
tdh3 align=centerPRODUCT TYPE/h3/td
/tr
trtdcenter
select name=poduct_type
?php
   


 

$db = mysql_connect(localhost, root, grunger);
mysql_select_db(status,$db);
$result = mysql_query(SELECT ProductTypes.product_type_detail,
ProductTypes.product_type_id FROM ProductTypes,$db);
$num = mysql_num_rows($result);
   


I would move all of this stuff OUTSIDE the select because after you add
your error messages, you'll never see them if they are inside the
select.
 

Ok, I'll do just that.
 

for ($i=0; $i$num; $i++){
$myrow=mysql_fetch_array($result);
$product_type=mysql_result($result,$i,product_type_detail);
$product_type_id=mysql_result($result,$i,product_type_id);
$maker=mysql_result($result,$i,maker_detail);
$maker_id=mysql_result($result,$i,maker_id);
echo option value=\$product_type_id\$product_type/optionbr;
   

You are not using maker, nor maker_id, so why put them in the query, and
why get them from your result set?
 

Ah, forgot to remove them b4 posting, as they were there when I was 
doing only 1 query.

 

}
?
/select
/center
/td/tr
/table
table align=center border=2
tr
tdh3 align=centerMaker/h3/td
/tr
trtdcenter
select name=slect_maker
?php
$db = mysql_connect(localhost, root, grunger);
   

Don't connect to the database twice.
That's the most expensive (time-wise) thing in your whole script, probably.
 

Just the answer I wanted. thanx.
 

mysql_select_db(status,$db);
   

And you don't need this either.
 

yep, that's obvious, now that  I know you don't need the db connection a 
2nd time too

 

$result = mysql_query(SELECT Makers.maker_id Makers.maker_detail FROM
Makers,$db);
$num = mysql_num_rows($result);
   

Again, move these outside the select
 

Will do.
 

for ($i=0; $i$num; $i++){
$myrow=mysql_fetch_array($result);
$maker=mysql_result($result,$i,maker_detail);
$maker_id=mysql_result($result,$i,maker_id);
echo option value=\$maker_id\$maker/optionbr;
}
?
/select
/center
/td/tr
/table
p
p
p
hrcenteremail: ???p
Telephone:p
Fax: ?
/center
hr
/body
/html
   

 

But, you dind't comment on the 2nd query. Cheers.
Mark Sargent.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Inner Join or 2nd Query...?

2005-05-12 Thread Mark Sargent
Hi All,
ok, this revised code produces the error below,
?php
mysql_select_db(status,$db);
$maker_result = mysql_query(SELECT Makers.maker_id Makers.maker_detail 
FROM Makers,$db);
$maker_num = mysql_num_rows($maker_result);//Line 40
?
select name=slct_maker
?php
for ($i=0; $i$maker_num; $i++){
$maker_myrow=mysql_fetch_array($maker_result);
$maker=mysql_result($maker_result,$i,maker_detail);
$maker_id=mysql_result($maker_result,$i,maker_id);
echo option value=\$maker_id\$maker/optionbr;
}
?
/select

*Warning*: mysql_num_rows(): supplied argument is not a valid MySQL 
result resource in */var/www/html/products.php* on line *40

Cheers.
Mark Sargent.
*
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Parsing XML with php

2005-05-12 Thread Burhan Khalid
Merlin wrote:
Hi there,
I am curious if PHP is now able to pars xml without aditional tools like 
xmlrpc.
If yes which version is required? Is the current php 4.x tree sufficient?
4.x requires the expat parser (so I guess it would require external libs).
5.x has the simplexml extension (which I believe requires no external libs).
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Posts taking over an hour to be displayed

2005-05-12 Thread Mark Sargent
Hi All,
is anyone else experiencing this.? Over an hour for my posts to be seen. 
Happening from work and home. Cheers.

Mark Sargent.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: [SPAM] Re: [PHP] MySql injections....

2005-05-12 Thread Bostjan Skufca @ domenca.si
True, but the question was about MySQL.

However this is the factor you have to consider before you start implementing 
you application - should it run on more than one database server?

If NOT, then do not worry or if it takes 3 minutes to rewrite stuff do not 
worry either.

If YES then you should (as you probably do) use some sort of a wrapper to 
database (usually called Database abstraction layer or Database class), 
which should provide correct and consistent string escaping function to your 
application. Then the simple use would be:

$string = $db-str_escape($string);

In MySQL wrapper class it should be implemented as 
function str_escape ($string)
{
return mysql_real_escape_string($string);
}

In PgSQL wrapper:
function str_escape ($string)
{
return pg_escape_string($string);
}

If you use this approach throughout your code then it shouldn't be more 
difficult to switch the database server that to switch the database class 
file (assuming you do not use database-server-in-use specific features which 
are not ANSI compliant)

Mind that if you get your data from forms you should check if it is already 
slashed - you should strip slashes if you do you escaping manually.

if (get_magic_quotes_gpc() == 1) {
$string = stripslashes($string);
}


regards,
Bostjan


On Wednesday 11 May 2005 21:20, [EMAIL PROTECTED] wrote:
 Don't forget your native database escaping function.  PHP has this one for
 MySQL, for example:

 mysql_real_escape_string()

 That should properly escape everything that could be used against MySQL to
 perform an injection.

 There should be some equivalent commend in the various database connection
 routines and abstraction layers.   Takes some of the work out of trying to
 properly escape everything manually.

 -TG

 = = = Original message = = =

 it depends

 by having register_globals set to on (server config) it is usually easier
 to create sql-injection exploit, but it is not required. What is true is
 that well written script will defend/sustain such attacks regardles how
 server is configured (unless configuration is really f*cked up).

 Prevention is simply trying to follow few simple rules:

 1. SQL statemens that have no PHP variables are NOT vulnerable:
 $sql = 'SELECT value FROM values WHERE key = 123';
 $db-query($sql);
 (nothing vulnerable here)



 2. If you do not check what you are putting into SQL statements via
 ~PHP variables - add slashes and put it in quotes:
 ($key = 123;) - you get this from some kind of form or URI

 $key_as = addslashes($key); // you should check if slashes were already
 added by php (magic_quotes) $sql = SELECT value FROM values WHERE key =
 '$key';
 $db-query($sql);



 3. If you do not put your variable into quotes - check it!
 if (!preg_match('/^[0-9]+/', $key))
 ~echo Hack attempt!; exit;

 $sql = SELECT value FROM values WHERE key = $key;
 $db-query($sql);

 (if you will not check it anything can get into your sql statement)


 4. All the above assumes you have already assessed potential remote file
 inclusion vulnerabilities.


 Regards,
 Bostjan

 On Wednesday 11 May 2005 14:15, [EMAIL PROTECTED] wrote:
  I have a site and the other days i received a message from a guy that
  told me my site is vulnerable to mysql injections. I do not know how can
  i prevent this. The server is not configured or it's all about the
  script?
 
 
  - Original Message -
  From: Bostjan Skufca @ domenca.com [EMAIL PROTECTED]
  To: php-general@lists.php.net
  Sent: Wednesday, May 11, 2005 1:50 PM
  Subject: Re: [PHP] MySql injections
 
   Probably you mean about prevening mysql injections - or not? :)
  
   Bostjan
  
   On Wednesday 11 May 2005 11:38, [EMAIL PROTECTED] wrote:
   Hi,
   This is not the proper list to put this question but i hope you can
   help me. Does anyone know a good tutorial about mysql injections?
  
   Thanks a lot for your help
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 ___
 Sent by ePrompter, the premier email notification software.
 Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] MySql injections (related question)

2005-05-12 Thread Kim Madsen
 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED]
 Sent: Thursday, May 12, 2005 8:47 AM

 I'd bet a dollar that if the MySQL C Client library changed what needs
 escaping, addslashes would change with it.

Ehhh? I think not. Let´s let a mindgame (can´t spell hypo..whatever :-) and say 
that the MySQL folk figures out they wanna use the same way for escaping as 
PostgreSQL, then addslashes() would add ' ? The whole idea of nameconvention is 
gone then :-)

But I do agree with You, need to hear *WHY* the mysql_real_escape_string() is 
better (and a so fu' long word :)

 What problem do you think addslashes() was written to solve?

For those who has magic qoutes off? I still can figure out why some people hate 
that setting so much? Though one´s not safe with only magic quotes, 
addslashes() are needed too...

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/Systemdeveloper

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Posts taking over an hour to be displayed

2005-05-12 Thread Shaw, Chris - Accenture
Yes, they are taking around an hour, must be the mailing list.

-Original Message-
From: Mark Sargent [mailto:[EMAIL PROTECTED]
Sent: 12 May 2005 08:53
To: php-general@lists.php.net
Subject: [PHP] Posts taking over an hour to be displayed


Hi All,

is anyone else experiencing this.? Over an hour for my posts to be seen. 
Happening from work and home. Cheers.

Mark Sargent.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Posts taking over an hour to be displayed

2005-05-12 Thread Amir Mohammad Saied
No!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Exec don't work

2005-05-12 Thread Burhan Khalid
Greg Donald wrote:
On 5/10/05, Juan Pablo Herrera [EMAIL PROTECTED] wrote:
Hi!
I using php version 4.3.10. I have a script that used the exec
function. Well it script only work from shell, but not work form web
browser.
My php.ini:
safe_mode   Off Off
safe_mode_exec_dir  no valueno value
Have somebody experience in this problem?

Is it possible your mod_php is using a different php.ini than your cli php?
In addition to the thing mentioned above, make sure you check the 
following things :

1. Is mod_security enabled on the server? (check the logs to find this out)
2. Is the command that you want to run in the path of the Apache user? 
If this is not true, then you will need to give a full path to the 
program, not just its executable name.  A good way to test this is to 
run your command line script as Apache.
3. Of course, checking permissions on the program is obvious.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] carriage returns in php mailer

2005-05-12 Thread Ross
Hello,

http://scottishsocialnetworks.org/mailer.phps

I have a php mailer that takes in some text from a text box and puts in in 
an email. The problem is the body text is assigned to a variable to be put 
in the email but it does not pick up the returns.

How do i do this??


R. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] strpos with array?

2005-05-12 Thread Burhan Khalid
Merlin wrote:
Burhan Khalid wrote:
Merlin wrote:
Hi there,
I am wondering if there is a function (I could not find) which does 
the same thing like strpos does, but with an array.

For example:
$replace = array(picture, pics);
$pos = strpos ($term, $replace);
//if ($pos !== false) {

  if (in_array($term,$replace)) {
   $term = str_replace($replace, , $term);
   echo 'term without the word:'.$term;
}

http://www.php.net/in_array
Actually this did not solve the problem, since this function is 
searching for the exact phrase, but not within a string.

I solved it that way:
// try pictures
$replace = array(pictures, picture, bilder, bild, pic, 
pics, pix);
foreach($replace AS $try){
$pos = strpos ($term, $try);
if ($pos !== false) {
$term = str_replace($try, , $term);
   #echo 'yes'.$term.$pos; exit;
   HEADER(Location:/index.php?search_for=.$term.); exit;
1. All functions in PHP are lowercase. Do not UPPERCASE your functions. 
Its Just Not Right.

2. You should always pass a full url (ie, with the scheme and host) to 
the Location header.

3. You need a space after Location:
4. There is no need for . at the end of your Location: string.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Re: SQL Date guru in the house?

2005-05-12 Thread mwestern
Cool thanks for that.

After reading through the strings manual pages on mysql site I came up
with this way of doing it. Not as simple as yours that's for sure,
but it works fine.

SELECT blah 
WHERE CONCAT(, LPAD(mm,2,'0'), LPAD(dd,2,'0')) BETWEEN . $ .
$mm . $dd . AND . $e_ . $e_mm . $e_dd . 

That works as well.   

Thanks a pile for the pointer tho.

Regards
M

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Thursday, 12 May 2005 5:41 AM
To: php-general@lists.php.net
Cc: Matthew Western, IT Support, Lonsdale
Subject: Re: [PHP] Re: SQL Date guru in the house?

Sorry, don't have time to look up the specifics.. and I've worked with a
number of different flavors of SQL, so not sure the syntax or
capabilities of the system you're using, but maybe try something like
this:

SELECT * FROM blah WHERE DATE(mm, dd, yyy) BETWEEN $date1 AND $date2

Basically convert the output of the columns to a date format and do the
comparison that way.

Some DATE commands are in the format DATE(MM, DD, ), some have
commands to convert a string to a date:  STR_TO_DATE(MM + / + DD + /
+ ), etc.

That way you get a serial datestamp to work with which should make
finding things within that range a ton easier.

Good luck!

-TG


= = = Original message = = =

Hello,

on 05/11/2005 03:17 AM [EMAIL PROTECTED] said the following:
 I have a small problem.   
 
 I have a project in which someone has got three integer fields for
 holding the date.   DD, MM,  in an sql database.I now have to
 have a page that inputs two dates and select records between those two
 dates. 
 
 If I had a date field in the table it would be fairly simple, but I'm 
 hoping to do this search/comparison without having to rewrite the 
 pages/database that has already been designed.
 
 
 Start Date:~11/05/2005
 End Date:~11/04/2005
 SELECT * FROM blah WHERE mm BETWEEN 04 AND 05 AND dd BETWEEN 11 AND 11

 AND  BETWEEN 2005 AND 2005
 
 Doesn't work for obvious reasons.  Is there any way that I can do
 this date comparison I the SQL statement without having a decent date 
 field?
 My apologies as this is australian date format and this list is in the

 US I think?

The format is only relevant for outputing dates. For querying you can
use the date values directly to delimit the range that you want

SELECT * FROM blah WHERE mm BETWEEN '11/04/2005' AND '11/05/2005'


-- 

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Seeking decent domain registrar

2005-05-12 Thread Marcus Bointon
Somewhat OT - I've had almost entirely poor experiences with domain  
registrars, so I'm looking for recommendations. I need:

.com, .net, .org domains (easy enough!)
.co.uk support
Multilingual domain support e.g. café.com
Online control of DNS server assignment
Specification of external DNS at registration time (so you don't have  
to change it unnecessarily afterwards)
Multiple admin accounts (I run domains for other people in their  
names and I want to keep them separate)
Don't need any forwarding, web hosting, email or anything beyond  
registration
Low-cost would help of course!

I've been googling for registrars, but as yet I've not found anyone  
that offers all this. Can anyone recommend a registrar that has a  
clue and a decent web interface?

Thanks,
Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] joining array values

2005-05-12 Thread Merlin
Hi there,
I do have a tricky problem with arrays.
There are 3 arrays:
$result[id][]
$result[text][]
$result[relevance][]
Now there might be the case that there are more results with the same $id. I 
would like to count all the relevances together for the same id.

For example:
id  textrelevance
23  ok  2
42  joel1
23  php 1
Desired output:
id  textrelevance
23  ok php  3
42  joel1
Has anybody an ide how to do that?
Thank you for any help,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Same sessions / different domains

2005-05-12 Thread mbneto
Hi,

I need to access a website (written in php) using two different
domains (www.foo.com and www.bar.com). I must see the same content.

Since the site uses session and cookie variables I was wondering if
(and how) it's possible to create a session id that is valid for the
domains I'll be using...

regards.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Seeking decent domain registrar

2005-05-12 Thread Tom Rogers
Hi,

Thursday, May 12, 2005, 8:40:26 PM, you wrote:
MB Somewhat OT - I've had almost entirely poor experiences with domain
MB registrars, so I'm looking for recommendations. I need:

MB .com, .net, .org domains (easy enough!)
MB .co.uk support
MB Multilingual domain support e.g. café.com
MB Online control of DNS server assignment
MB Specification of external DNS at registration time (so you don't have
MB to change it unnecessarily afterwards)
MB Multiple admin accounts (I run domains for other people in their  
MB names and I want to keep them separate)
MB Don't need any forwarding, web hosting, email or anything beyond  
MB registration
MB Low-cost would help of course!

MB I've been googling for registrars, but as yet I've not found anyone
MB that offers all this. Can anyone recommend a registrar that has a
MB clue and a decent web interface?

MB Thanks,

MB Marcus

I have been using bulkregister.com for a few years and no complaints,
you will have to check yourself if they meet your particular needs :)

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] XML Problem

2005-05-12 Thread Juan Antonio Garrido
Hi everybody...

I've been using DOM-XML functions for loading a XML file. When I try load it 
con domxml_open_file, it appears a message Call to undefined function: 
domxml_open_file(). 

PHP has been configured with option --with-dom=shared,/usr 
--with-xslt=shared,/usr(default install), and additional libraries was 
installed (libxml2,php4-domxml,php4-xslt and others). What library more I 
need? What can be failling?

My scenario is Debian,PHP 4.3.10-15 about Apache. 
-- 

---
Juan Antonio Garrido Mata
Emergya, Soluciones Tecnológicas
Tel. +34 954 98 10 53   FAX +34 954 98 11 79
Avda. Luis Montoto, 105.
E41007 - Sevilla(España)
[EMAIL PROTECTED]
http://www.emergya.info

---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Seeking decent domain registrar

2005-05-12 Thread Angelo Zanetti
godaddy.com
domaindirect.com

http://www.telivo.com/

for uk based stuff..

hope this helps

Angelo Zanetti
Z Logic
www.zlogic.co.za
[c] +27 72 441 3355
[t] +27 21 469 1052



Marcus Bointon wrote:

 Somewhat OT - I've had almost entirely poor experiences with domain 
 registrars, so I'm looking for recommendations. I need:

 .com, .net, .org domains (easy enough!)
 .co.uk support
 Multilingual domain support e.g. café.com
 Online control of DNS server assignment
 Specification of external DNS at registration time (so you don't have 
 to change it unnecessarily afterwards)
 Multiple admin accounts (I run domains for other people in their 
 names and I want to keep them separate)
 Don't need any forwarding, web hosting, email or anything beyond 
 registration
 Low-cost would help of course!

 I've been googling for registrars, but as yet I've not found anyone 
 that offers all this. Can anyone recommend a registrar that has a 
 clue and a decent web interface?

 Thanks,

 Marcus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] joining array values

2005-05-12 Thread Brent Baisley
Use the id number as the array key and a simple loop should join 
everything together.
for($i=0; $icount($result['id']); $i++) {
	$id = $result['id'][$i];
	$text = $result['text'][$i];
	$relevance = $result['relevance'][$i];
	
	$resultSummary[$id]['id'] = $id;
	if ( isset($resultSummary[$id]['text']) ) {
		$resultSummary[$id]['text'] .= ' '.$text;
	} else {
		$resultSummary[$id]['text'] = $text;
	}
	if ( isset($resultSummary[$id]['rel']) ) {
		$resultSummary[$id]['relevance'] += ' '.$relevance;
	} else {
		$resultSummary[$id]['relevance'] = $relevance;
	}
}

You actually wouldn't need to have any entry for id in the resulting 
array since the id is the key for the array row.

But you setup your array backwards, and you have a one multidimensional 
array, not three arrays. With your setup, if there is a value missing 
from any of the three categories, then your data is out of sync.
Arrays are great for creating name/value pairs. But you should view a 
two dimensional array as a row/column setup: $result[row][column]
So your array should be setup like:
$result[0]['id']
$result[0]['text']
$result[0]['relevance']
$result[1]['id']
$result[1]['text']
$result[1]['relevance']
...

This assures your data aligns properly and it's actually easier to 
process in a loop.

On May 12, 2005, at 7:30 AM, Merlin wrote:
Hi there,
I do have a tricky problem with arrays.
There are 3 arrays:
$result[id][]
$result[text][]
$result[relevance][]
Now there might be the case that there are more results with the same 
$id. I would like to count all the relevances together for the same 
id.

For example:
id  textrelevance
23  ok  2
42  joel1
23  php 1
Desired output:
id  textrelevance
23  ok php  3
42  joel1
Has anybody an ide how to do that?
Thank you for any help,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] libxslt and xml prolouge

2005-05-12 Thread Brian V Bonini
Using libxslt and DOM to load up an xml file and display within another
file via 'include'.. Something is adding in '?xml version=1.0?' is
there a switch or something that turns this off?


-- 

s/:-[(/]/:-)/g


BrianGnuPG - KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
==
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
Key Info: http://gfx-design.com/keys
Linux Registered User #339825 at http://counter.li.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP 5.0. Save classes in a session. Need help now

2005-05-12 Thread Jochem Maas
Richard Lynch wrote:
On Wed, May 11, 2005 5:19 pm, Oscar Andersson said:
Is it possibele to save a class in a session
ex.
$cl = new Class();
$SESSION['this_class'] = cl;
hello, Oscar - why don't you try it?
notice how 'Class' is a keyword so you can't name a class 'Class'
notice how if you use '$SESSION' it won't work even if you start
the session correctly... $_SESSION on the other hand will work better :-)

Yes, but...
You'd have to actually use $cl in that last line, and you need to require
 ^ --- notice the dollar sign?
the file that defines the class definition *BEFORE* you start your session
in the next page where you expect the class instance to exist.
this is true.
Actually, you could maybe get away with starting the session, the loading
the class definition, then accessing the $cl variable...  But I'm not sure
of that, because I don't use classes, and even if I did, I'd load in all
that wouldn't work - at least none of the methods would be available for 
use -
in affect you have an incomplete object from which you can retrieve all the
properties but not call any methods.
the class files before I started my session, just on principle.
personally I have a Session handler class with which I can
register classes to be automatically _if_ the session is started ;-\
..mostly because I use lots of classes - and loading them all, everytime is
not a good idea - unless you like consistently slow pages :-)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Same sessions / different domains

2005-05-12 Thread Chris Boget
 I need to access a website (written in php) using two different
 domains (www.foo.com and www.bar.com). I must see the same content.
 Since the site uses session and cookie variables I was wondering if
 (and how) it's possible to create a session id that is valid for the
 domains I'll be using...

One possibility (that will require significant security considerations) is
to store all the session data within your datastore and use the session
id as the key to retrieve that data.  As long as session id gets passed
as part of the GET to each page (something you can do both manually
and by enabling 'trans_sid' (I think that's what it's called though I might
be wrong)) then it shouldn't be much of a hardship to allow what you
are asking.

thnx,
Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Same sessions / different domains

2005-05-12 Thread Marek Kilimajer
mbneto wrote:
Hi,
I need to access a website (written in php) using two different
domains (www.foo.com and www.bar.com). I must see the same content.
Since the site uses session and cookie variables I was wondering if
(and how) it's possible to create a session id that is valid for the
domains I'll be using...
regards.
embed the session id in url when linking to the other domain
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Generate CSV File and force download

2005-05-12 Thread Shaun
Hi,

Is it possible to create a csv file from a query and force the user to 
download it by outputting it to the browser, I dont want it saved on the 
server!

Thanks for your advice 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Same sessions / different domains

2005-05-12 Thread Shaun
$_SERVER['HTTP_HOST']

Mbneto [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
Hi,

I need to access a website (written in php) using two different
domains (www.foo.com and www.bar.com). I must see the same content.

Since the site uses session and cookie variables I was wondering if
(and how) it's possible to create a session id that is valid for the
domains I'll be using...

regards. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] joining array values

2005-05-12 Thread Merlin
Brent Baisley wrote:
Use the id number as the array key and a simple loop should join 
everything together.
for($i=0; $icount($result['id']); $i++) {
$id = $result['id'][$i];
$text = $result['text'][$i];
$relevance = $result['relevance'][$i];

$resultSummary[$id]['id'] = $id;
if ( isset($resultSummary[$id]['text']) ) {
$resultSummary[$id]['text'] .= ' '.$text;
} else {
$resultSummary[$id]['text'] = $text;
}
if ( isset($resultSummary[$id]['rel']) ) {
$resultSummary[$id]['relevance'] += ' '.$relevance;
} else {
$resultSummary[$id]['relevance'] = $relevance;
}
}

You actually wouldn't need to have any entry for id in the resulting 
array since the id is the key for the array row.

But you setup your array backwards, and you have a one multidimensional 
array, not three arrays. With your setup, if there is a value missing 
from any of the three categories, then your data is out of sync.
Arrays are great for creating name/value pairs. But you should view a 
two dimensional array as a row/column setup: $result[row][column]
So your array should be setup like:
$result[0]['id']
$result[0]['text']
$result[0]['relevance']
$result[1]['id']
$result[1]['text']
$result[1]['relevance']
...

This assures your data aligns properly and it's actually easier to 
process in a loop.

On May 12, 2005, at 7:30 AM, Merlin wrote:
Hi there,
I do have a tricky problem with arrays.
There are 3 arrays:
$result[id][]
$result[text][]
$result[relevance][]
Now there might be the case that there are more results with the same 
$id. I would like to count all the relevances together for the same id.

For example:
idtextrelevance
23ok2
42joel1
23php1
Desired output:
idtextrelevance
23ok php3
42joel1
Has anybody an ide how to do that?
Thank you for any help,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Hi Brent,
thank you for that excellent example. I tried to get that working in a similar 
way but failed. However, you brought in knowledge which puts me into trouble. 
How can I output those arrays if they are the other way around?
I used to do it like this:
for ($i=0;$icount($result[id]);$i++){
	echo $result[id][$i];
	echo $result[text][$i];
}

Now the array is the other way around, plus the array $resultSummary[$id]['id'] 
is not a 1,2,3 thing but there are missing values?!
I need those Id's to create proper links from the output.

Can you shed some more light on this?
Thank you for your excellent help.
Best regards, Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Inner Join or 2nd Query...?

2005-05-12 Thread Carl Furst
If I may, 

It depends, are the fields you're joining on indexed? How many keys are
being joined and how many joins are you using. What database are you using?
Which version?

I prefer to use joins myself because it gets all the data in one place.
However if you find that you are using a lot of where statements with your
join you may wish to consider a sub select instead. 

A good thing to do would be to try each case and see which works faster in
your situation..


Carl Furst
Vote.com
P.O. Box 7
Georgetown, Ct 06829
203-544-8252
[EMAIL PROTECTED]

-Original Message-
From: Mark Sargent [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 11, 2005 10:31 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Inner Join or 2nd Query...?

Mark Rees wrote:

Hi All,

with wanting to show both product types(Switch, Router etc) and 
Makers(Cisco, Avaya, etc) on the one page in select boxes, I was 
wondering, do you use 2 seperate queries to the database or do you inner

join to get all in 1..? I have set up different tables with related id's

etc. So, to get Products.product_name and Products.product_id along with

what the below query pulls, what wold be best..? I believe if I do a 2nd

query, than some variables need to be identified with the particular 
query, yes..? Cheers.

What is your question in one sentence?

Is it how do I do an inner join?
  

I guess I was looking for people's opinions, not a specific answer, I 
think...

Is it are two separate queries on two tables faster than one query on
both tables?
  

Well, again, no not really. I guess I was curious how others do things.

Or something else entirely?
  

Could be. Sorry, perhaps I'm thinking too general with this, yes..? Cheers.

Mark Sargent.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] libxslt and xml prolouge

2005-05-12 Thread Jared Williams
 
 Using libxslt and DOM to load up an xml file and display 
 within another file via 'include'.. Something is adding in 
 '?xml version=1.0?' is there a switch or something that 
 turns this off?

xsl:output omit-xml-declaration=yes /  in the xsl stylesheet?  

Jared

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] TIDY Functions: Troubles with Get_Attr function

2005-05-12 Thread Ricardo Junior
Hi all,


I'm using the PHP 5.0.4 version with Apache 2 on Windows XP SP2 and
I've turned on the TIDY extension (php_tidy.dll) to parse HTML file
using PHP.

But using the function tidyNode-GET_ATTR() I received the following
error message:

Fatal error: Call to undefined method tidyNode::get_attr() in
C:\Arquivos de programas\Apache
Group\Apache2\htdocs\teste\html\teste.php on line 22

The 22 line in my code is the following one:
$a_href = $child-get_attr (TIDY_ATTR_HREF);

Below I'm attaching the whole source code of my test:
*
** teste.php code 
*
?
// Specify configuration
$config = array('indent'= TRUE,
'indent-spaces' = 3,
'indent-cdata' = TRUE,
'output-xhtml' = TRUE,
'wrap' = 80);

// Tidy
$tidy = new tidy;
$tidy-parseFile(client_computer_options.htm, $config);
run_nodes($tidy-root(), 1);


function run_nodes($node, $indent) {

if($node-hasChildren()) {
foreach($node-child as $child) {
switch ($child-name)
{
case a: {
$a_href = $child-get_attr (TIDY_ATTR_HREF);
$a_title = $child-get_attr (TIDY_ATTR_TITLE);
$a_text = $child-value;

$string = bA - HREF = /b.$a_href. b| TITLE =
/b.$a_title. b| TEXT = /b.$a_text;
break;
}
default: {
$string = $child-name;
break;
}
}
echo str_repeat('.', $indent*2) . ($string ? $string :
''.$child-value.''). br\n;

run_nodes($child, $indent+1);
}
}
}
?
*

Could somebody help me on getting this code working? I really don't
know why the undefined method error is rising... Should it be a
incomplete tidy functions support at this PHP version?

Many Thanks,
Rick Jr.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Generate CSV File and force download

2005-05-12 Thread Jay Blanchard
[snip]
Is it possible to create a csv file from a query and force the user to 
download it by outputting it to the browser, I dont want it saved on the

server!
[/snip]

Just make sure that your mime-type is set to something like octet stream
when you creat the csv file

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] debugger for CLI PHP scripts...?

2005-05-12 Thread Christopher J. Bottaro
Is there such a thing?  You know, with single stepping, breakpoints,
examining vars, etc.  100% of my PHP stuff is CLI (wacky, huh?) and I'd
really benefit from a traditional debugger.  Oh btw, I'm looking for a
free/opensource one.

Thanks!

P.S.  Yes, I've searched Google and www.php.net/manual, and yes, I've found
stuff...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] fgets fails after fopen succeeds -- cleaned up for better digestion.

2005-05-12 Thread Thomas Powell
I removed the r+, since that not my intended mode.
File Handle is 1 after the fopen call.
fgets, feof, and fclose fail on $fh. (So does fread, FWIW).
The file exists. fopen fails if it is moved.
 *Code:*
?php
function make_link_list($name=) {

print './outside/'.$name.'.txt';
?
ul
?
$fh=fopen('./outside/'.$name.'.txt', 'r') || die(Cannot open file); 
print File Handle: .$fh;
for ($line = fgets($fh, 1000); ! feof($fh); $line = fgets($fh, 1000)) {
if (!$line) break ;
$line = trim($line);
if(strlen($line)  0) {
print 'li' . $line ./li\n;
}
}
?
/ul
?
fclose($fh);
}
make_link_list(index);
?
 *Output:*
./outside/index.txt 

   File Handle:1
   *Warning*: fgets(): supplied argument is not a valid stream resource 
   in *C:\Program Files\Apache 
   Group\Apache2\htdocs\youmightbe\outside.php* on line *12*
   
   *Warning*: feof(): supplied argument is not a valid stream resource in 
   *C:\Program Files\Apache Group\Apache2\htdocs\youmightbe\outside.php*on line 
   *12*
   

*Warning*: fclose(): supplied argument is not a valid stream resource
in *C:\Program
Files\Apache Group\Apache2\htdocs\youmightbe\outside.php* on line *22*
**


Re: [PHP] Re: Posts taking over an hour to be displayed

2005-05-12 Thread Angelo Zanetti
yeah mine were quite slow, im in south africa and they route to the USA
to wherever the mailing list server sits...
Amir Mohammad Saied wrote:

 No!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] trying to unsubscribe

2005-05-12 Thread nick
i followed the instructions to unsubscribe because i am out of the country. 
did not work apparently.  can a mod help me please. 

nick

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] XML/XSL parsing

2005-05-12 Thread Brian V Bonini (gfx-Design)
Need to be pointed in the right direction.

xml:
quotes

quote_block
quote_text/quote_text
quote_author/quote_author
/quote_block

quote_block
quote_text/quote_text
quote_author/quote_author
/quote_block

etc...

/quotes


xsl:
xsl:stylesheet version=1.0
xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
xsl:output omit-xml-declaration=yes /
xsl:template match=/
xsl:for-each select=quotes/quote_block
div style=margin-top: 10px; background-color: #f0f0f0; padding:
5px;
  div style=text-align: left; font-weight: bold;xsl:value-of
select=quote_text//div
  div style=text-align: left; font-style: italic;xsl:value-of
select=quote_author//div
/div
/xsl:for-each
/xsl:template

/xsl:stylesheet

I know how to load the document, parse it, display contents etc... But
how can I grab just one group of values at a time using php?


-- 
Brian V Bonini
[EMAIL PROTECTED]
GnuPG - KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
_
gfx-Design
http://www.gfx-design.com
Key Info: http://www.gfx-design.com/keys
[EMAIL PROTECTED]
Phone:(757)623-1655  Fax:(425)675-3094  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Inner Join or 2nd Query...?

2005-05-12 Thread Carl Furst
I think you need to have the result from a mysql_connect() in order for that
to work..

As in:
$myResource = mysql_connect(user, pass, host, etc);

You just have a statement handle there. Which is good for the fetch commands
like mysql_fetch_row(), but not the num rows command.



Carl Furst
[EMAIL PROTECTED]


-Original Message-
From: Mark Sargent [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 12, 2005 3:17 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Inner Join or 2nd Query...?

Hi All,

ok, this revised code produces the error below,

?php
mysql_select_db(status,$db);
$maker_result = mysql_query(SELECT Makers.maker_id Makers.maker_detail 
FROM Makers,$db);
$maker_num = mysql_num_rows($maker_result);//Line 40
?
select name=slct_maker
?php
for ($i=0; $i$maker_num; $i++){
$maker_myrow=mysql_fetch_array($maker_result);
$maker=mysql_result($maker_result,$i,maker_detail);
$maker_id=mysql_result($maker_result,$i,maker_id);
echo option value=\$maker_id\$maker/optionbr;
}
?
/select


*Warning*: mysql_num_rows(): supplied argument is not a valid MySQL 
result resource in */var/www/html/products.php* on line *40

Cheers.

Mark Sargent.
*

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] setParameter

2005-05-12 Thread Laurent Quivogne
Hi,

Has anyone experiment this method with an array as the doc says:


bool setParameter ( string namespace, mixed name [, string value] )

The local name of the XSLT parameter. This can be either a string 
representing the parameter name or an array of name = value pairs. 

Actually i try to pass an xml objects as a parameter... Is it possible?...

Thanks for your help

___
Laurent Quivogne 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] beginner needs help!

2005-05-12 Thread Clinton, Rochelle A
Dear Much Needed Advisor,

 

I am definitely a PHP novice and making some code changes to a PHP
script.

 

I need to change a declared output file to include the date as an
extension.

 

My file is declared at the beginning of the script as:

var $exportFile = Export.txt;

 

I need it to be, for instance, Export.051205.txt.

 

I have played around with the date function many ways:

Ex 1:

var $exportFile = Export . date(mdy);

 

Ex 2:

$file = Export;

$ext = date(mdy);

var $exportFile = $file . $ext;

 

I can't seem to get anything to work.

 

Also, could you point me to somewhere where I can learn the difference
between declaring variables as:

 

$exportFile = Export.txt;

and 

var $exportFile = Export.txt

 

Thank you! Thank you!

 

Rochelle Clinton

Bioinformatics Coordinator

University of Kentucky

200 Thomas Hunt Morgan Building

office: (859) 257-2161

cell: (406) 570-5383

email: [EMAIL PROTECTED]

 



[PHP] Best CC gateway

2005-05-12 Thread Sam Smith
 

Any recommendation for the easiest credit card gate way for PHP running on
FreeBSD?

Authorize.net?

Thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] cURL functions

2005-05-12 Thread Chris Bruce
Hi,
I am connecting to a remote image download API using cURL functions. I 
have the connection working fine and am getting the response from the 
API. The problem is that the resulting image is being displayed as 
binary characters in the browser instead of downloading to my computer. 
Here is the code:

$ch = curl_init(); // create cURL handle (ch)
if (!$ch) {
  die(Couldn't initialize a cURL handle);
 }
// set some cURL options
$ret = curl_setopt($ch, CURLOPT_URL, path/to/api/with/vars/appended);
$ret = curl_setopt($ch, CURLOPT_HEADER, 0);
$ret = curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
$ret = curl_setopt($ch, CURLOPT_TIMEOUT, 30);
// execute
$ret = curl_exec($ch);
and here are the results from curl_getinfo:
Array
(
[url] = path/to/api/with/vars/appended
[http_code] = 200
[header_size] = 312
[request_size] = 242
[filetime] = -1
[ssl_verify_result] = 0
[total_time] = 0.298
[namelookup_time] = 0.013
[connect_time] = 0.013
[pretransfer_time] = 0.013
[size_upload] = 0
[size_download] = 750690
[speed_download] = 2519093.9597315
[speed_upload] = 0
[download_content_length] = 750690
[upload_content_length] = 0
)
Does anyone know how I can take the binary result and force it to 
download as a JPG image?

Thanks.
Chris


Re: [PHP] joining array values

2005-05-12 Thread Jochem Maas
Merlin wrote:
Brent Baisley wrote:
Use the id number as the array key and a simple loop should join 
everything together.
for($i=0; $icount($result['id']); $i++) {
$id = $result['id'][$i];
$text = $result['text'][$i];
$relevance = $result['relevance'][$i];
$resultSummary[$id]['id'] = $id;
if ( isset($resultSummary[$id]['text']) ) {
$resultSummary[$id]['text'] .= ' '.$text;
} else {
$resultSummary[$id]['text'] = $text;
}
if ( isset($resultSummary[$id]['rel']) ) {
$resultSummary[$id]['relevance'] += ' '.$relevance;
} else {
$resultSummary[$id]['relevance'] = $relevance;
}
}
...
For example:
idtextrelevance
23ok2
42joel1
23php1
Desired output:
idtextrelevance
23ok php3
42joel1
Has anybody an ide how to do that?
Thank you for any help,
Merlin

Hi Brent,
thank you for that excellent example. I tried to get that working in a 
similar way but failed. However, you brought in knowledge which puts me 
into trouble. How can I output those arrays if they are the other way 
around?
I used to do it like this:
for ($i=0;$icount($result[id]);$i++){
echo $result[id][$i];
echo $result[text][$i];
}

Now the array is the other way around, plus the array 
$resultSummary[$id]['id'] is not a 1,2,3 thing but there are missing 
values?!
I need those Id's to create proper links from the output.
have you tried foreach? e.g.
foreach ($resultSummary as $id = $vals) {
print_r( $vals );
// do some stuff.
}
Can you shed some more light on this?
it might help to know that actually the '1,2,3 thing'
is a '0,1,2 thing' - sequential (int) keys are always zero based.
read:
http://nl2.php.net/manual/en/language.types.array.php
http://nl2.php.net/array
http://nl2.php.net/foreach
http://nl2.php.net/manual/en/language.control-structures.php
good luck.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] joining array values

2005-05-12 Thread Brent Baisley
You're losing me hear without sample data, but I'll try.
Ideally your input array would be something like:
$result[] = array('id'=23, 'text'='ok', 'relevance'=2);
$result[] = array('id'=42, 'text'='joel', 'relevance'=1);
$result[] = array('id'=23, 'text'='php', 'relevance'=1);
Which gives you an array like:
print_r($result);
Array
(
[0] = Array
(
[id] = 23
[text] = ok
[relevance] = 2
)
[1] = Array
(
[id] = 42
[text] = joel
[relevance] = 1
)
[2] = Array
(
[id] = 23
[text] = php
[relevance] = 1
)
)
If you changed your array to be like this, then the original code won't 
work.
You can cycle through the array like this:
foreach( $result as $resultItem) {
	echo $resultItem['id'];
	echo $resultItem['text'];
	echo $resultItem['relevance'];
}

Hope that helps.
On May 12, 2005, at 10:13 AM, Merlin wrote:
Hi Brent,
thank you for that excellent example. I tried to get that working in a 
similar way but failed. However, you brought in knowledge which puts 
me into trouble. How can I output those arrays if they are the other 
way around?
I used to do it like this:
for ($i=0;$icount($result[id]);$i++){
	echo $result[id][$i];
	echo $result[text][$i];
}

Now the array is the other way around, plus the array 
$resultSummary[$id]['id'] is not a 1,2,3 thing but there are missing 
values?!
I need those Id's to create proper links from the output.

Can you shed some more light on this?
Thank you for your excellent help.
Best regards, Merlin
--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] beginner needs help!

2005-05-12 Thread Jay Blanchard
[snip]
My file is declared at the beginning of the script as:

var $exportFile = Export.txt;

I need it to be, for instance, Export.051205.txt.


I have played around with the date function many ways:

Ex 1:

var $exportFile = Export . date(mdy);
[/snip]

You almost had it;

var $exportFile = Export. . date(mdy) . .txt;

[snip]
Also, could you point me to somewhere where I can learn the difference
between declaring variables as:
[/snip]

http://www.php.net/variables is a good place to start.
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] beginner needs help!

2005-05-12 Thread John Nichel
Clinton, Rochelle A wrote:
Dear Much Needed Advisor,
I am definitely a PHP novice and making some code changes to a PHP
script.
I need to change a declared output file to include the date as an
extension.
My file is declared at the beginning of the script as:
var $exportFile = Export.txt;
I need it to be, for instance, Export.051205.txt.
I have played around with the date function many ways:
Ex 1:
var $exportFile = Export . date(mdy);
Ex 2:
$file = Export;
$ext = date(mdy);
var $exportFile = $file . $ext;
I can't seem to get anything to work.
What is not working with it?  Did you want the .txt extension on the end?
$exportFile = Export. . date ( mdy ) . .txt;
Also, could you point me to somewhere where I can learn the difference
between declaring variables as:
$exportFile = Export.txt;
and 

var $exportFile = Export.txt
I *think* they're the same.  Personally, I've never used 'var' in PHP, 
and all has worked fine.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] beginner needs help!

2005-05-12 Thread Leila Lappin
Will this work?

?php
$string = Export..date(mdy)..txt;
echo $string;
? 

-Original Message-
From: Clinton, Rochelle A [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 12, 2005 12:55 PM
To: php-general@lists.php.net
Subject: [PHP] beginner needs help!


Dear Much Needed Advisor,

 

I am definitely a PHP novice and making some code changes to a PHP
script.

 

I need to change a declared output file to include the date as an
extension.

 

My file is declared at the beginning of the script as:

var $exportFile = Export.txt;

 

I need it to be, for instance, Export.051205.txt.

 

I have played around with the date function many ways:

Ex 1:

var $exportFile = Export . date(mdy);

 

Ex 2:

$file = Export;

$ext = date(mdy);

var $exportFile = $file . $ext;

 

I can't seem to get anything to work.

 

Also, could you point me to somewhere where I can learn the difference
between declaring variables as:

 

$exportFile = Export.txt;

and 

var $exportFile = Export.txt

 

Thank you! Thank you!

 

Rochelle Clinton

Bioinformatics Coordinator

University of Kentucky

200 Thomas Hunt Morgan Building

office: (859) 257-2161

cell: (406) 570-5383

email: [EMAIL PROTECTED]

 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] beginner needs help!

2005-05-12 Thread Jay Blanchard
[snip]
Thank you for your response Jay, but that is not working.  My program
will not run at all with the following:

var $exportFile = Export. . date(mdy) . .txt;

I seem to be able to use the date function is I am not starting the
declaration with var, but then my program is not working correctly.
[/snip]

You may have to assemble it beforehand sort of ...

$exportFileName = Export. . date(mdy) . .txt;
var $exportFile = $exportFileName;

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Best CC gateway

2005-05-12 Thread Greg Donald
On 5/12/05, Sam Smith [EMAIL PROTECTED] wrote:
 Any recommendation for the easiest credit card gate way for PHP running on
 FreeBSD?
 
 Authorize.net?

That's my pick.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] auto_prepend_file in Apache Directory container

2005-05-12 Thread dan
Hello, all -
I'm trying to override the value of php.ini's 'auto_prepend_file' 
function, inside of an Apache Directory container.  I'm not having much 
luck.  In fact, no luck at all.  This never happens.

So I'm wondering now, are functions set by 'php_value' inside of an 
Apache config file only good for the entire VirtualHost in question, or 
can they be applied on a per-directory basis using Apache's Directory 
directive?  Or am I justflat-out doing something wrong? I have something 
similar to this:

VirtualHost 1.2.3.4
...apache config...
php_value auto_prepend_file \
 /var/www/virtual/pornpromoter.net/dev1/auto_prepend_file_02.php
...more apache config...
/VirtualHost
Threw in the '\' there for the sake of some mail clients that would wrap 
the line.  The '\' is not present in the configuration file.

I've been doing some research and have come up dry.  I was hoping 
someone would be kind enough to provide some answers here.

Thanks!
-dant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Best CC gateway

2005-05-12 Thread dan
Sam Smith wrote:
 

Any recommendation for the easiest credit card gate way for PHP running on
FreeBSD?
Authorize.net?
Thanks
Sam -
I've been using CyberSource and have been quite happy with it.  I got a 
deal on it by gonig through Bank of America and acquiring a merchant 
account, as well - although they do have options to just purchase the 
gateway functionality.

Thanks
-dant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] beginner needs help!

2005-05-12 Thread James Williams
On 5/12/05, Clinton, Rochelle A [EMAIL PROTECTED] wrote:
 Dear Much Needed Advisor,
 
 I am definitely a PHP novice and making some code changes to a PHP
 script.
 
 I need to change a declared output file to include the date as an
 extension.
 
 My file is declared at the beginning of the script as:
 
 var $exportFile = Export.txt;

Is this a class?  If not you don't need to declare you're variables with var.

 I need it to be, for instance, Export.051205.txt.
 
 I have played around with the date function many ways:
 
 Ex 1:
 
 var $exportFile = Export . date(mdy);

Use a unix timestamp...  var $exportFile = 'export' . time();

 Ex 2:
 
 $file = Export;
 
 $ext = date(mdy);
 
 var $exportFile = $file . $ext;
 
 I can't seem to get anything to work.
 
 Also, could you point me to somewhere where I can learn the difference
 between declaring variables as:
 
 $exportFile = Export.txt;
 
 and
 
 var $exportFile = Export.txt
 
 Thank you! Thank you!
 
 Rochelle Clinton
 
 Bioinformatics Coordinator
 
 University of Kentucky
 
 200 Thomas Hunt Morgan Building
 
 office: (859) 257-2161
 
 cell: (406) 570-5383
 
 email: [EMAIL PROTECTED]
 
 


-- 
jamwil.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] payflowpro with php

2005-05-12 Thread Rezk Mekhael
Hi Manager,


 
Any idea about this errors? I am try to configure php with payflowpro
I am running 
OS: fedora Core 2
 
 
 
Error Number 1
 
[EMAIL PROTECTED] pfpro# phpize 
configure.in:9: warning: underquoted definition of PHP_WITH_PHP_CONFIG
  run info '(automake)Extending aclocal'
  or see
http://sources.redhat.com/automake/automake.html#Extending%20aclocal
http://sources.redhat.com/automake/automake.html#Extending%20aclocal 
configure.in:32: warning: underquoted definition of PHP_EXT_BUILDDIR
configure.in:33: warning: underquoted definition of PHP_EXT_DIR
configure.in:34: warning: underquoted definition of PHP_EXT_SRCDIR
configure.in:35: warning: underquoted definition of PHP_ALWAYS_SHARED
acinclude.m4:19: warning: underquoted definition of PHP_PROG_RE2C
configure.in:65: error: possibly undefined macro: AC_PROG_LIBTOOL
  If this token and others are legitimate, please use m4_pattern_allow.
  See the Autoconf documentation.

Error Number 2
 

[EMAIL PROTECTED] pfpro]# ./configure
--with-pfpro=/usr/local/verisign/payflowpro/linux/
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether gcc and cc understand -c and -o together... yes
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main
-I/usr/include/php/Zend -I/usr/include/php/TSRM
checking for PHP extension directory... /usr/lib/php4
checking for re2c... exit 0;
checking for gawk... gawk
./configure: line 2693: AC_PROG_LIBTOOL: command not found
mkdir: too few arguments
Try `mkdir --help' for more information.
configure: creating ./config.status
config.status: creating config.h

 
--
Sincerely,
Rezk Mekhael
 


Incoming / Outgoing Mail scanned for known Viruses by CLUnet(R)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] beginner needs help!

2005-05-12 Thread James Williams
hmmm, well... If I could see the code I could probably fix it for you,
the problem is everything changes depending on the context it's used
and how the class is setup.  For example, it's poor practice to assign
values to vars when you declare them... It is recommended you assign
them inside the class constructor.

If you have no idea what I'm talking about with constructors and
whatnot, check out a tutorial on OOP or classes... www.codewalkers.com
I believe has a good one.  I'd give you the link but my comp is messed
right now.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Form handling

2005-05-12 Thread dan
Richard Lynch wrote:
While this *CAN* work, and a lot of people like it, it tends to add a fair
amount of cruft for not that much benefit, really...
What do you GAIN having this big old switch statement?
What data/processing is really really shared in all these steps?
On Wed, May 11, 2005 4:57 pm, dan said:
Hello, all -
I've been researching how to handle forms properly, and I think I
figured out a way that might be beneficial for me to use.  It is as
follows:
(index.php)
session_start();
if (isset($_SESSION['step'])) {
switch $_SESSION['step'] {
case 1:
require('step1.php');
break;
case 2:
require('step2.php');
break;
case 3:
require('step3.php');
break;

Simpler:
case 1:
case 2:
case 3:
  require step$step.php;
break;
Also not that it's pretty unlikely that your default will kick in, since
somebody would have to intentationally hack $step to be, say, 4 or
something to reach that line of code... [more]

// add more case statements here if I need to
default:
require('step1.php');
break;
}
} else {
$_SESSION['step'] = '1';
require('step1.php');
}

So you might want to start off with:
$step = isset($_SESSION['step']) ? $_SESSION['step'] : 1;
Then you could do your switch, and default to step1, thereby having all
the same functionality, but with fewer branches in the actual algorithm.

Each stepX.php file would look something similar to this:
(step1.php)
// if submitted, check data for completeness
// if complete, set 'step' to 2, to be used as argument to index.php
$_SESSION['step'] = '2'
// redirect back to index.php, use new value of 'step' to direct
header('Location: http://somesite.com/index.php');
// else display form data

Now, this is, really, one of my first experiences with doing forms.  I
just want to know if I can/should/would anticipate any problems down the
road while doing this.  I think it would work quite well, but I've only
been doing this for a short while.

I did it this way at first, but quicly found that the amount of shared
code between steps was so minimal, that it was better to just have each
step as a separate form, with filenames that made sense for the
information gathered at that stage.
It's also sometimes good to let the user fill in different steps in
whatever order they prefer -- depending on the data gathered and what your
business goals are.
I've seen a particularly nice implementation of this at CDBaby (which is
not real useful to anybody reading this unless you happen to be a musician
with a CD you want to sell...) where the steps can be done in any order,
but the first five are MUST DO and are flagged as such in RED until you do
them, and the last three are OPTIONAL and are in yellow until you do them.
 Completed steps are changed to green.
Since some of the steps could require a fair amount of background work
(writing/editing/fixing-up your Bio, for example, or getting a complete
track listing with titles in order) he lets you do them in the order that
fits into your life, not in the order he happened to program that morning.
 Very nice.
Richard -
I was just looking for some sort of confirmity and ease of use.  I've 
been experimenting with some of my own ways to handle form data. 
There's nothing that I hate more than clutter, so that's why I wanted to 
break the form apart inside of these smaller files.

Thanks!
-dant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] MySql injections (related question)

2005-05-12 Thread James Williams
I'm pretty sure that, in order to use mysql_real_escape_string() you
must have magic quotes off or use stripslashes first... the same as
addslashes, so it should work if you just search and replace.  Don't
quote me on that though

On 5/12/05, Richard Lynch [EMAIL PROTECTED] wrote:
 On Wed, May 11, 2005 8:27 pm, James Williams said:
  On 5/11/05, Richard Lynch [EMAIL PROTECTED] wrote:
  Is mysql_real_escape_string *DIFFERENT* in some incredibly huge secure
  way
  that I want to stop working on all my current projects to go re-write
  the
  10,000,000 lines of code?
 
  2 words: Search  Replace.
 
 2 words: Magic Quotes
 
 --
 Like Music?
 http://l-i-e.com/artists.htm
 
 


-- 
jamwil.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] sleep function

2005-05-12 Thread virtualsoftware
Hi,

I want to create a script that displays all names from a database once per 
second. 
A part of the script look like this.

for ($i=0; $i$total_names; $i++)
{
  echo namebr;
  sleep (1);
}

The scipt works fine but it displays all names at once. I want to display the 
first name, then refresh the browser and display the first name and the second, 
then the first name, the second and the third and so on.
Can someone please tell me how can i do this?


Thanks in advance for your help !!!



Re: [PHP] Saving of buffers, from a security standpoint

2005-05-12 Thread Colin Ross
in my own defence, i too am not much of a silent failure kinda guy. Custom 
errar handlers are great, (i user PEAR::ErrorStack and it works great)

my point is that in a public, production environment, i'd rather have 
anything not caught by the custom eror handler go unseen by the browser, 
although i'd log it somewhere in case errors did start creeping up

On 5/11/05, Richard Lynch [EMAIL PROTECTED] wrote:
 
 Personally, I'd rather have the error messages go SOMEWHERE useful, and
 write custom error handler to put nice error messages to the browser
 that reveal nothing.
 
 If things go wrong in my script/software/hardware/network, I don't want
 the system to just silently FAIL and swallow errors.
 
 Yes, it's remotely possible that I could manage to somehow screw up my
 custom error handler some day, and that would then expose things, but
 that's less likely than the CC server going down or the script to process
 the CC getting changed and messed up and passing QA somehow or...
 
 A customer error handler is pretty much a set it and forget it kind of
 thing for me, so I'm not really likely to screw that up and risk exposure.
 
 Whereas the processing of the form for ordering stuff and processing the
 credit cards seems to change all too often... The client changes their
 preferred shopping cart, or their Merchant or their data-gathering of non
 CC info or... As much as I try to separate that stuff out, they usually
 somehow manage to insist on some bone-headed requirement for the
 form/processing that makes me change the stuff that breaks the CC
 processing and while you catch THAT during testing before you go live,
 there still is more risk that the code you changed is somehow going to
 break live than the custome error handler you haven't touched since day
 3.
 
 I'm kinda religious about the software shouldn't silently fail thing,
 though, so maybe it's just me...
 
 PS Got no idea what ob_start() does to buffer your output... Wild Guess is
 it just uses RAM, and if your HTML is too big to fit in RAM/swap, you are
 screwed.
 
 On Wed, May 11, 2005 3:14 pm, Colin Ross said:
  at this point, I'm planning on (at least on production) turning off all
  error reporting, I am using PEAR::ErrorStack mainly for error handling,
  which I love using btw...
 
  all I'm trying to do is make sure that no information gets outputed from
  the
  script, even if some horrible error occurs, i guess i figured i could 
 just
  have it buffer output, then destroy the buffer output after...
  ie.
 
  ?php
  ob_start();
  .
  .. do my CC processing here
  .
  ob_end_clean();** 
 http://us4.php.net/manual/en/function.ob-end-clean.php
  ?
 
  Maybe this is just the wrong way to think about it... In the end though,
  i'd
  rather error on the side of security and output no info (even on an 
 error)
  then output _too much_ info if you know what I mean.
 
  if the buffer gets saved into the swap file, that okay. I'm with you on
  that
  point, if he can read my swap.. i'm just S.O.L. and the system is
  compromised, period. I was just wondering if PHP saved this kinda info 
 in
  the same style that it saves session data (under /tmp) by default, one 
 of
  the main reasons why session data should not be concidered all too
  secure
 
  Colin
 
  On 5/11/05, Richard Lynch [EMAIL PROTECTED] wrote:
 
  On Wed, May 11, 2005 10:02 am, Colin Ross said:
   I am working on a bit of code for credit-card processing, so please
  keep
   in
   mind, security of the data is essential..
   On part of it i wish to use a buffer, but i wonder if that data is
  saved
   anywhere on the running system (as a temp file, etc), or is it just
  held
   in
   the system's memory?
 
  What kind of a buffer?
 
  Actually, scratch that question.
 
  There is no guarantee, in PHP, that the data in your running script 
 will
  not be stored in swap (temp file) on disk as the script runs.
 
  It would be nice, perhaps, if there were a way to allocate memory only
  in
  RAM that could not be swapped.
 
  There are, in some OSes, low-level calls to do this, but I don't think
  PHP
  wrappers exist (yet) for them.
 
  At any rate, my point is that if the Bad Guys can read your swap files,
  you're probably already in so much trouble that the credit card numbers
  isn't your #1 concern. It is that bad.
 
   My concern is that if an error occurs in the processing, i don't want
  that
   buffer to remain (with possible valid Credit Card data) on the
  system...
 
  You want to catch/handle as many possible errors as you can, and work
  through them intelligently.
 
  No matter what you do, it's possible that you'll end up with a core 
 dump
  (or similar) with your RAM including CC#s in it. You'll want to make
  this
  as unlikely as you can, but you'll also want to think about what you'll
  do
  if it *DOES* happen. Should you turn off core dumps on a production
  server? Probably, if you can. Does that guarantee that somebody (maybe
  you a year 

Re: [PHP] str_replace on words?

2005-05-12 Thread James E Hicks III
Merlin wrote:
Hi there,
I am trying to strip some words from a sentence. I tried it with 
str_replace like described here:
http://www.totallyphp.co.uk/code/find_and_replace_words_in_a_text_string_using_str_replace.htm 

Unfortunatelly it does not work the way I want, because if I want to 
replace the word in all passages containing the characters in are 
replaced. For example Singapore.

Does anybody know how to do this on just words?
Thank you for any hint,
Merlin
$variable = 'I like to Sing in Singapore';
$variable = str_replace(' in ',' for ',$variable);
echo $varible;
Results should be:
I like to Sing for Singapore
James
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] cURL functions

2005-05-12 Thread Jason Wong
On Friday 13 May 2005 02:54, Chris Bruce wrote:

 $ret = curl_setopt($ch, CURLOPT_HEADER, 0);

Try enabling the above or ...

 Does anyone know how I can take the binary result and force it to
 download as a JPG image?

... send an appropriate header before dumping the binary data.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] payflowpro with php

2005-05-12 Thread Rezk Mekhael
 


Hi Manager,


 
Any idea about this errors? I am try to configure php with payflowpro I am
running
OS: fedora Core 2
 
 
 
Error Number 1
 
[EMAIL PROTECTED] pfpro# phpize
configure.in:9: warning: underquoted definition of PHP_WITH_PHP_CONFIG
  run info '(automake)Extending aclocal'
  or see
http://sources.redhat.com/automake/automake.html#Extending%20aclocal
http://sources.redhat.com/automake/automake.html#Extending%20aclocal
configure.in:32: warning: underquoted definition of PHP_EXT_BUILDDIR
configure.in:33: warning: underquoted definition of PHP_EXT_DIR
configure.in:34: warning: underquoted definition of PHP_EXT_SRCDIR
configure.in:35: warning: underquoted definition of PHP_ALWAYS_SHARED
acinclude.m4:19: warning: underquoted definition of PHP_PROG_RE2C
configure.in:65: error: possibly undefined macro: AC_PROG_LIBTOOL
  If this token and others are legitimate, please use m4_pattern_allow.
  See the Autoconf documentation.

Error Number 2
 

[EMAIL PROTECTED] pfpro]# ./configure
--with-pfpro=/usr/local/verisign/payflowpro/linux/
checking build system type... i686-pc-linux-gnu checking host system type...
i686-pc-linux-gnu checking for gcc... gcc checking for C compiler default
output file name... a.out checking whether the C compiler works... yes
checking whether we are cross compiling... no checking for suffix of
executables... 
checking for suffix of object files... o checking whether we are using the
GNU C compiler... yes checking whether gcc accepts -g... yes checking for
gcc option to accept ANSI C... none needed checking whether gcc and cc
understand -c and -o together... yes checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes checking for PHP prefix...
/usr checking for PHP includes... -I/usr/include/php -I/usr/include/php/main
-I/usr/include/php/Zend -I/usr/include/php/TSRM checking for PHP extension
directory... /usr/lib/php4 checking for re2c... exit 0; checking for gawk...
gawk
./configure: line 2693: AC_PROG_LIBTOOL: command not found
mkdir: too few arguments
Try `mkdir --help' for more information.
configure: creating ./config.status
config.status: creating config.h

 
--
Sincerely,
Rezk Mekhael
 


Incoming / Outgoing Mail scanned for known Viruses by CLUnet(R)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] auto_prepend_file in Apache Directory container

2005-05-12 Thread dan
dan wrote:
Hello, all -
I'm trying to override the value of php.ini's 'auto_prepend_file' 
function, inside of an Apache Directory container.  I'm not having much 
luck.  In fact, no luck at all.  This never happens.

So I'm wondering now, are functions set by 'php_value' inside of an 
Apache config file only good for the entire VirtualHost in question, or 
can they be applied on a per-directory basis using Apache's Directory 
directive?  Or am I justflat-out doing something wrong? I have something 
similar to this:

VirtualHost 1.2.3.4
...apache config...
php_value auto_prepend_file \
 /var/www/virtual/pornpromoter.net/dev1/auto_prepend_file_02.php
...more apache config...
/VirtualHost
Threw in the '\' there for the sake of some mail clients that would wrap 
the line.  The '\' is not present in the configuration file.

I've been doing some research and have come up dry.  I was hoping 
someone would be kind enough to provide some answers here.

Thanks!
-dant
Hello -
Doing some more research, even on the following page:
http://us3.php.net/manual/en/ini.php#ini.list
...shows that php_prepend_file should still work inside an Apache 
directory container (as indicated by changeable PHP_INI_PERDIR), but 
it is not.

Has anyone had this kind of problem before?
Thanks!
-dant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] debugger for CLI PHP scripts...?

2005-05-12 Thread Andy Pieters
On Thursday 12 May 2005 17:35, Christopher J. Bottaro wrote:
 Is there such a thing?  

Hi Christopher

Spoken as someone who actively uses PHP both in webpages, and for scripts on 
CLI, the only debugger I am aware of is Gubed (but that's only for PHP  
Webbpages)

Personally, I use the following setup (pseudo code, I could give you the 
actuall source code, but this is better because it will actually enhance your 
knowledge)

This does not have breakpoints, but if you want them, you can write a function
function breakpoint($info)
{debug($info);
 die();}

After that if you want conditional breakpoints, use an assert like function

function assert($var,$value,$msg)
{if($var==$value)
  breakpoint($msg);
}


Do you see the light yet?

If you implement it properly, you don't even need to change your source code 
when debugging is done.


example flow:

Register_shutdownfunction(debug,dump);

then everywhere in the script, 

function dosomething($param)
{debug(domsomething($param));
...
}

function debug()
{static $data='';
 get parameter list
 if first param=dump
 {if preferences=dumtofile
   writetofile $data
  else
   writetoconsole $data
}
 else
  data[]=$parameters
}
}

Can you see the use of this?

Kind regards


Andy

-- 
Registered Linux User Number 379093
-- --BEGIN GEEK CODE BLOCK-
Version: 3.1
GAT/O/E$ d-(---)+ s:(+): a--(-)? C$(+++) UL$ P-(+)++
L+++$ E---(-)@ W++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e$@ h++(*) r--++ y--()
-- ---END GEEK CODE BLOCK--
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/
--

--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sleep function

2005-05-12 Thread Philip Hallstrom
Hi,
I want to create a script that displays all names from a database once per 
second.
A part of the script look like this.
for ($i=0; $i$total_names; $i++)
   {
 echo namebr;
 sleep (1);
   }
The scipt works fine but it displays all names at once. I want to display the 
first name, then refresh the browser and display the first name and the second, 
then the first name, the second and the third and so on.
Can someone please tell me how can i do this?
Right before your sleep(1) function add:
flush();
This should do it.  Depends on how your webserver buffers things and if 
there's any proxy servers, etc. in the way.

-philip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] sleep function

2005-05-12 Thread James Williams
On 5/12/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi,
 
 I want to create a script that displays all names from a database once per 
 second.
 A part of the script look like this.
 
 for ($i=0; $i$total_names; $i++)
 {
   echo namebr;
   sleep (1);
 }
 
 The scipt works fine but it displays all names at once. I want to display the 
 first name, then refresh the browser and display the first name and the 
 second, then the first name, the second and the third and so on.
 Can someone please tell me how can i do this?
 
 Thanks in advance for your help !!!
 
 
You're gonna have to use output buffering... I have never used it so
I'm no expert, but I figured I could point you in the right direction.
http://ca3.php.net/outcontrol

-- 
jamwil.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sleep function

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 12:39 pm, [EMAIL PROTECTED] said:
 I want to create a script that displays all names from a database once per
 second.
 A part of the script look like this.

 for ($i=0; $i$total_names; $i++)
 {
   echo namebr;

http://php.net/flush

   sleep (1);
 }

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] MySql injections (related question)

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 12:39 pm, James Williams said:
 I'm pretty sure that, in order to use mysql_real_escape_string() you
 must have magic quotes off or use stripslashes first... the same as
 addslashes, so it should work if you just search and replace.  Don't
 quote me on that though

Well, yes, but you see it's no longer as simple as a global search and
replace, since there is no addslashes all over the place.

I have to hand-examine every file in, what, almost a decade's worth of
code spread over several dozen websites?

What is the CURRENT security advantage, if any, to
mysql_real_escape_string versus Magic Quotes?

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] auto_prepend_file in Apache Directory container

2005-05-12 Thread Chris
dan wrote:
dan wrote:
Hello, all -
I'm trying to override the value of php.ini's 'auto_prepend_file' 
function, inside of an Apache Directory container.  I'm not having 
much luck.  In fact, no luck at all.  This never happens.

So I'm wondering now, are functions set by 'php_value' inside of an 
Apache config file only good for the entire VirtualHost in question, 
or can they be applied on a per-directory basis using Apache's 
Directory directive?  Or am I justflat-out doing something wrong? I 
have something similar to this:

VirtualHost 1.2.3.4
...apache config...
php_value auto_prepend_file \
 /var/www/virtual/pornpromoter.net/dev1/auto_prepend_file_02.php
...more apache config...
/VirtualHost
Threw in the '\' there for the sake of some mail clients that would 
wrap the line.  The '\' is not present in the configuration file.

I've been doing some research and have come up dry.  I was hoping 
someone would be kind enough to provide some answers here.

Thanks!
-dant
Hello -
Doing some more research, even on the following page:
http://us3.php.net/manual/en/ini.php#ini.list
...shows that php_prepend_file should still work inside an Apache 
directory container (as indicated by changeable PHP_INI_PERDIR), but 
it is not.

Has anyone had this kind of problem before?
Thanks!
-dant
I don't know what to tell you, it works for me.. Could you be overriding 
it somewhere? Are you sure that portion of the config file is being 
applied correctly? It seems much more likely to me that Apache, for some 
reason,.isn't reading the directive.or is reading another after it that 
is overwriting it.

Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Form handling

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 12:55 pm, dan said:
 I was just looking for some sort of confirmity and ease of use.  I've
 been experimenting with some of my own ways to handle form data.
 There's nothing that I hate more than clutter, so that's why I wanted to
 break the form apart inside of these smaller files.

I'm only suggesting that you take that farther -- break the form apart
into smaller files, with no super-structure trying to control them.

The value added of the central switch seems dubious to me.

Just my opinion.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] beginner needs help!

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 12:36 pm, Jay Blanchard said:
 [snip]
 Thank you for your response Jay, but that is not working.  My program
 will not run at all with the following:

 var $exportFile = Export. . date(mdy) . .txt;

 I seem to be able to use the date function is I am not starting the
 declaration with var, but then my program is not working correctly.
 [/snip]

 You may have to assemble it beforehand sort of ...

 $exportFileName = Export. . date(mdy) . .txt;
 var $exportFile = $exportFileName;

PHP has no 'var' at all, anyway, *EXCEPT* inside a 'class' definition, and
PHP5+ has better keywords (public/private/ etc) to use instead of 'var'

Furthermore, where you do have var in PHP, you can ONLY provide it with a
constant.  It cannot be a derived value.  Not a variable.  Not an
expression.  A constant.

Disclaimer: I don't use classes, so maybe I'm wrong... But I think I got
this one right.
-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cURL functions

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 11:54 am, Chris Bruce said:
 API. The problem is that the resulting image is being displayed as
 binary characters in the browser instead of downloading to my computer.

 Does anyone know how I can take the binary result and force it to
 download as a JPG image?

At a minimum, for current browsers, you need:
header(Content-type: image/jpeg);
before you send the JPEG out.

Actually, before you send *ANYTHING* out, but you'd break the JPEG sending
anything else out before that anyway.

If you want to support older browsers, on more platforms, you would do
well to look at another thread from yesterday where I talk about about
PATH_INFO.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] I want to get count rows with the pear packet

2005-05-12 Thread =?iso-8859-1?Q?Tom=E1s_Rodriguez_Orta?=
Hello hard people!!!
I want to get count rows at the query using odbc over windows.
but I can't get any value of this, I doing this.

$sql=SELECT * FROM id Like '$id';
$res=$db-query($sql);
$numRecords=$res-numRows();
echo $numRecords;

but when I the page print $numRecords I saw this Object id #5 

somebody can Help me?

I need an small help. please

regrads TOMAS
 



-
Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27
en el dominio de correo angerona.cult.cu  y no se encontro ninguna coincidencia.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] MySql injections (related question)

2005-05-12 Thread James Williams
I couldn't tell you the technicals of it, but just from the php documentation:

 This function must always (with few exceptions) be used to make data
safe before sending a query to MySQL.

On 5/12/05, Richard Lynch [EMAIL PROTECTED] wrote:
 On Thu, May 12, 2005 12:39 pm, James Williams said:
  I'm pretty sure that, in order to use mysql_real_escape_string() you
  must have magic quotes off or use stripslashes first... the same as
  addslashes, so it should work if you just search and replace.  Don't
  quote me on that though
 
 Well, yes, but you see it's no longer as simple as a global search and
 replace, since there is no addslashes all over the place.
 
 I have to hand-examine every file in, what, almost a decade's worth of
 code spread over several dozen websites?
 
 What is the CURRENT security advantage, if any, to
 mysql_real_escape_string versus Magic Quotes?
 
 --
 Like Music?
 http://l-i-e.com/artists.htm
 
 


-- 
jamwil.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] debugger for CLI PHP scripts...?

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 8:35 am, Christopher J. Bottaro said:
 Is there such a thing?  You know, with single stepping, breakpoints,
 examining vars, etc.  100% of my PHP stuff is CLI (wacky, huh?) and I'd
 really benefit from a traditional debugger.  Oh btw, I'm looking for a
 free/opensource one.

I suspect the IDEs are tied into the web-server with --enable-debug...

You *could* set up your dev box to run your CLI scripts through the web
server, just for testing/debugging...

The PHP GTK guys might have some insight on this one -- They do all CLI
stuff with a butt-load of objects, so they must do *something* for those
nasty objects, right?

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] auto_prepend_file in Apache Directory container

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 12:48 pm, dan said:
 I'm trying to override the value of php.ini's 'auto_prepend_file'
 function, inside of an Apache Directory container.  I'm not having much
 luck.  In fact, no luck at all.  This never happens.

 So I'm wondering now, are functions set by 'php_value' inside of an
 Apache config file only good for the entire VirtualHost in question, or
 can they be applied on a per-directory basis using Apache's Directory
 directive?

Certainly some php_value directives can be over-ridden in .htaccess,
regardless of whether they were set globally in httpd.conf or in a
VirtualHost or Directory block.

Equally certainly, some cannot be over-ridden.

I am almost 100% certain that php_value makes no distinction between
*where* in httpd.conf the setting comes from.  I daresay php_value in
.htaccess can't even tell the difference from one part of httpd.conf to
the other.

http://php.net/ has a page devoted to describing exactly which php_value
settings can be over-ridden where.  Check that.

It's also possible that once auto_prepend_file is set, it's set, and
that's it -- Regardless of where it is set, you're stuck with it at that
value.

So it's more of a 'define' for a constant that some kind of variable you
can change on a whim.  Part of that could easily be to provide web host
administrators with a way to guarantee that some PHP code of theirs gets
run no matter what their clients may try to do...  Which I could see might
be handy for some hosts, and they'd not want it over-ridden.  These last
two paragraphs are pure speculation on my part.  But it could be true, and
it wouldn't really fit into that nifty chart in the manual.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Generate CSV File and force download

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 6:54 am, Shaun said:
 Is it possible to create a csv file from a query and force the user to
 download it by outputting it to the browser, I dont want it saved on the
 server!

fputcsv('php:/stdout', ...)

should work, I think.

If not, there are only a few dozen implementations of CSV output in PHP.

Some of them even get the commas and quotes correct. :-^

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] carriage returns in php mailer

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 2:40 am, Ross said:
 http://scottishsocialnetworks.org/mailer.phps

 I have a php mailer that takes in some text from a text box and puts in in
 an email. The problem is the body text is assigned to a variable to be put
 in the email but it does not pick up the returns.

The returns could come from a Windows browser (\r\n) or a Mac browser (\r)
or a Linux browser (\n)

You first need to get them to all be the same:

$body = str_replace(\r\n, \n, $body);
$body = str_replace(\r, \n, $body);
//Note that the order of the two statements is crucial

//You now have all Linux (\n) newlines.

If you are using Linux for your outgoing mail server, you are done.

If you are using Windows for your mail server, you probably need \r\n for
outgoing email:
$body = str_replace(\n, \r\n, $body);

If you are using Mac, you probably need \r:
$body = str_replace(\n, \r, $body);


Aside:
Some days I just wanna shoot the guys who made up these different newline
formats...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] MySql injections (related question)

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 1:44 am, Kim Madsen said:
 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED]
 Sent: Thursday, May 12, 2005 8:47 AM

 I'd bet a dollar that if the MySQL C Client library changed what needs
 escaping, addslashes would change with it.

 Ehhh? I think not. Let´s let a mindgame (can´t spell hypo..whatever :-)
 and say that the MySQL folk figures out they wanna use the same way for
 escaping as PostgreSQL, then addslashes() would add ' ? The whole idea of
 nameconvention is gone then :-)

 But I do agree with You, need to hear *WHY* the mysql_real_escape_string()
 is better (and a so fu' long word :)

 What problem do you think addslashes() was written to solve?

 For those who has magic qoutes off? I still can figure out why some people
 hate that setting so much? Though one´s not safe with only magic quotes,
 addslashes() are needed too...

Kim, I'm sorry, but it's blatantly clear that you don't understand Magic
Quotes and addslashes()

Magic Quotes calls addslashes() automatically on data coming from
GET/POST/COOKIE.  (And maybe from other sources, depending on php.ini)

It's that simple.

You would NEVER use both Magic Quotes and addslashes() on the same chunk
of data.

That would just escape the escape characters and screw up your data, so
you'd need to use stripslashes() on all data coming *OUT* of the database,
to un-do the second addslashes() you called on the data you never should
have called it on in the first place.

Which is not to say I haven't seen a few zillion newbies, and even
journey-man scripts do this, as the programmers incorrectly believed
that's what they needed to do.

I'm almost certain that both addslashes() and Magic Quotes were designed,
from the get-go, to escape data being sent to mSQL/MySQL, but I'm waiting
to hear from, say, Rasmus, that that's true.  Wanna bet money on it?  I
got a dollar.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Inner Join or 2nd Query...?

2005-05-12 Thread Richard Lynch




On Thu, May 12, 2005 12:17 am, Mark Sargent said:
 Hi All,

 ok, this revised code produces the error below,

 ?php

You took out the mysql_connect completely???

Don't do that.

 mysql_select_db(status,$db);
 $maker_result = mysql_query(SELECT Makers.maker_id Makers.maker_detail
 FROM Makers,$db);

if (!$maker_result) die(mysql_error());

 $maker_num = mysql_num_rows($maker_result);//Line 40
 ?
 select name=slct_maker
 ?php
 for ($i=0; $i$maker_num; $i++){
 $maker_myrow=mysql_fetch_array($maker_result);
 $maker=mysql_result($maker_result,$i,maker_detail);
 $maker_id=mysql_result($maker_result,$i,maker_id);
 echo option value=\$maker_id\$maker/optionbr;
 }
 ?
 /select


 *Warning*: mysql_num_rows(): supplied argument is not a valid MySQL
 result resource in */var/www/html/products.php* on line *40

 Cheers.

 Mark Sargent.
 *

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] MySql injections (related question)

2005-05-12 Thread Chris Shiflett
Richard Lynch wrote:
It's all very well to repeat these pronouncements from on high that
mysql_real_escape_string is better but I personally would sure
appreciate somebody who's saying this to say *WHY* it is better, and in
precisely what ways it is different from addslashes and/or magic quotes
with or without data scrubbing.
From me:
The fact that it uses the character set of your current connection to 
MySQL means that what your escaping function considers to be a single 
quote is exactly what your database considers to be a single quote. If 
these things don't match, your escaping function can miss something that 
your database interprets, opening you up to an SQL injection attack.

This type of attack isn't quite as easy as when someone doesn't escape 
their data at all, but it's something that can be avoided by using the 
proper escaping function.

From Derick Rethans (sitting beside me):
Other things are that addslashes() screws up with big-5 (it can contains 
\'s in multi-byte characters), and mysql_real_escape_string() takes into 
account charcter sets.

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Same sessions / different domains

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 6:58 am, Shaun said:
 $_SERVER['HTTP_HOST']

 Mbneto [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Hi,

 I need to access a website (written in php) using two different
 domains (www.foo.com and www.bar.com). I must see the same content.

 Since the site uses session and cookie variables I was wondering if
 (and how) it's possible to create a session id that is valid for the
 domains I'll be using...

There is no built-in way to just tell the browser that it's okay for
cookie X to work for both foo.com and bar.com

You will have to write some code that passes the cookie name/value between
foo.com and bar.com

You might have a special script like 'propogate_cookie.php' something like:
?php
  $var = $_REQUEST['var'];
  $value = $_REQUEST['value'];
  setcookie($var, $value);
?

Put this on both servers, and then when somebody surfs to foo.com you do:
?php
  session_start();
  $file = file(http://bar.com/propogate_cookie.php?var=PHPSESSIDvalue=;
. session_id());
?

Do the same thing on bar.com (only calling the propoage_cookie.php script
on foo.com instead)

You will also need a custom session handler using the same backend --
probably your database is the simplest example -- so that the session data
is shared between foo.com and bar.com

The down-side here is that ANYBODY could surf to propogate_cookie.php and
set themselves up with whatever session ID they can sniff out, thereby
hijacking the session cookie a little easier, maybe...  Though if they can
sniff it out, they could just hijack it on the first server too...

Still, might be worth recording who first issued the cookie (foo.com or
bar.com) in your session data, and then checking that the cookie/session
is still valid when you propogate it, by making sure it's in the database
from the other server already.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Passing variable number of parameters by reference

2005-05-12 Thread Robert Meyer
Hello,

Using: PHP Version 5.0.3

I build the following function:

function Set4HTMLOut() {
  $C = func_num_args();
  for ($I = 0; $I  $C; $I++) {
$A = func_get_arg($I);
 echo 'I['.$I.']('.strlen($A).'): '.$A.'br /';
$A = htmlspecialchars($A);
 echo 'I['.$I.']('.strlen($A).'): '.$A.'br /';
  }
}

And called it like this:

 Set4HTMLOut($LName, $LOrg, $LWebSite, $LPhones, $LComments);
 echo 'br /After call:br /'.
 'LName: '.$LName.'br /'.
 'LOrg: '.$LOrg.'br /'.
 'LWebSite: '.$LWebSite.'br /'.
 'LPhones: '.$LPhones.'br /'.
 'LComments: '.$LComments.'br /';

The echo statements in the Set4HTMLOut() function echos all the correct 
data and proves the data was received correctly then altered by the 
htmlspecialchars() function appropriately.  Notice that the caller passes 
each variable as a reference.  Yet, the echo statement after the call 
displays the data without any changes, like the first echo statement in 
the Set$HTMLOut() function does.

Is it not possible to pass variables by reference to a variable-length 
parameter list?  Or am I doing something wrong?  If so, what?

I have already built a work around.  I do not need any work arounds.  I just 
think one should be able to pass variables by reference to a function that 
accepts a variable-length parameter list.

Regards

Robert

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] dynamically updating site

2005-05-12 Thread Sebastian
I looking for a way to update certain parts of a site that is highly
dynamic. I've tried creating static files via cronjobs then including them,
but it is a pain to do. for instance, i have a news page that utilizes
mysql, rather than query the DB on each page load i would like to have it
update at say 5 minute intervals.. not sure if this is possible to do
without generating static files..

any suggestions?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] MySql injections (related question)

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 4:43 pm, Chris Shiflett said:
  From me:
 The fact that it uses the character set of your current connection to
 MySQL means that what your escaping function considers to be a single
 quote is exactly what your database considers to be a single quote. If
 these things don't match, your escaping function can miss something that
 your database interprets, opening you up to an SQL injection attack.

Under the following pre-conditions:
1. C Locale / English in MySQL data
2. No intention to ever switch natural language, nor database.

is there any real benefit to spending man hours I really can't afford for
legacy code to switch from Magic Quotes to mysql_real_escape_string -- and
make no mistake, it would be a TON of man hours.

If I *HAVE* to do it; fine.

If it's not going to really make a difference in my Security, I'm only
going to use mysql_real_escape_string going forward.

Or, put it another way:

If somebody puts in some big-5 data, or whatever, and I have Magic Quotes,
is it safe or is that somehow going to allow some sql-injection security
hole?

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Seeking decent domain registrar

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 3:40 am, Marcus Bointon said:
 Somewhat OT - I've had almost entirely poor experiences with domain
 registrars, so I'm looking for recommendations. I need:

 Multilingual domain support e.g. café.com

Er.

Maybe they changed the rules, but I don't think that's a valid domain name
AT ALL.

So maybe the reason you are having trouble is you are looking for
something that cannot exist...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Form handling

2005-05-12 Thread Rory Browne
Personally I'm lazy, but I'd probably go with something along the lines of 

$filename = sprintf(step%d.php, (int)($_SESSION['step']) );
require ( file_exists($filename) ? $filename : step1.php );

same results in two lines of code - was one line, but I split it into
two lines to make it more readable, although tbh in production code,
I'd add an array_key_exists, to make sure that $_SESSION['step'],
actually exists. It also scales up to as many steps as you like, so
long as they're all in the stepNUMBER.php format. I don't think there
is any need for both a %d formatter and (int) typecasting, but it's
generally best to take every reasonable precaution when you're
including/requireing files.

On 5/12/05, dan [EMAIL PROTECTED] wrote:
 Hello, all -
 
 I've been researching how to handle forms properly, and I think I
 figured out a way that might be beneficial for me to use.  It is as follows:
 
 (index.php)
 
 session_start();
 if (isset($_SESSION['step'])) {
 switch $_SESSION['step'] {
 case 1:
 require('step1.php');
 break;
 case 2:
 require('step2.php');
 break;
 case 3:
 require('step3.php');
 break;
 // add more case statements here if I need to
 default:
 require('step1.php');
 break;
 }
 } else {
 $_SESSION['step'] = '1';
 require('step1.php');
 }
 
 Each stepX.php file would look something similar to this:
 
 (step1.php)
 
 // if submitted, check data for completeness
 // if complete, set 'step' to 2, to be used as argument to index.php
 $_SESSION['step'] = '2'
 // redirect back to index.php, use new value of 'step' to direct
 header('Location: http://somesite.com/index.php');
 // else display form data
 
 Now, this is, really, one of my first experiences with doing forms.  I
 just want to know if I can/should/would anticipate any problems down the
 road while doing this.  I think it would work quite well, but I've only
 been doing this for a short while.
 
 Thanks!
 -dant
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] I want to get count rows with the pear packet

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 7:14 pm, Tomás Rodriguez Orta said:
 Hello hard people!!!
 I want to get count rows at the query using odbc over windows.
 but I can't get any value of this, I doing this.

 $sql=SELECT * FROM id Like '$id';
 $res=$db-query($sql);
 $numRecords=$res-numRows();
 echo $numRecords;

 but when I the page print $numRecords I saw this Object id #5

As I recall, some ODBC drivers simply don't support a numRows call -- and
they return -1 when they get used...

At a minimum, if you want a good answer, you really need to tell the list
*WHICH* odbc driver you are using, as well as *which* object-oriented
database abstraction layer you are using in your $db variable.

And, finally, what kind of database you are connecting to -- ODBC works
with virtually every database on the planet.  Some databases won't support
a numRows() function, or at least not in some circumstances.

Of course, it's also possible that your db abstraction layer in $db
doesn't return an integer of the number of rows from numRows() method, but
returns some kind of object instead, and you need to call a method on that
object to find out the actual number of rows.  That would be a pretty
goofy thing to do, but it's possible.

As it stands now, we have nowhere near enough info to help you!

You should also try using var_dump() and printr() on your $numRecords
object to see what structure it has.  That alone could tell you what is
going on.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Help!!! Cannot do Authentication

2005-05-12 Thread K.S. TANG
I have a page using the Basic HTTP Authentication and works well before.
But this night, the server seems to not receiving any $_SERVER pass in from
Web browsers.

  if ( (!isset($_SERVER['PHP_AUTH_USER'])) || ($_SERVER['PHP_AUTH_USER'] !=
netop) || ($_SERVER['PHP_AUTH_PW'] != cti63) ) {
   header('WWW-Authenticate: Basic realm=Please enter User Name and
Password:');
   header('HTTP/1.0 401 Unauthorized');
   echo 'Authentication error!!';
   exit;
  }

I've trial to put this on another server, it doesn't work too !! (but it
works before also).

I've trial to use the most simple code from php.net

  if (!isset($_SERVER['PHP_AUTH_USER'])) {
   header('WWW-Authenticate: Basic realm=My Realm');
   header('HTTP/1.0 401 Unauthorized');
   echo 'Text to send if user hits Cancel button';
   exit;
  } else {
   echo pHello {$_SERVER['PHP_AUTH_USER']}./p;
   echo pYou entered {$_SERVER['PHP_AUTH_PW']} as your password./p;
  }

But it doesn't work too. The browser ask for the user name and password for
three times and than echo the line Text to send if user hits...

Please !!! Please help me.
Thanks a lot. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] MySql injections (related question)

2005-05-12 Thread Jennifer Goodie
 -- Original message --
From: Richard Lynch [EMAIL PROTECTED]
 On Thu, May 12, 2005 4:43 pm, Chris Shiflett said:
   From me:
  The fact that it uses the character set of your current connection to
  MySQL means that what your escaping function considers to be a single
  quote is exactly what your database considers to be a single quote. If
  these things don't match, your escaping function can miss something that
  your database interprets, opening you up to an SQL injection attack.
 
 Under the following pre-conditions:
 1. C Locale / English in MySQL data
 2. No intention to ever switch natural language, nor database.
 
 is there any real benefit to spending man hours I really can't afford for
 legacy code to switch from Magic Quotes to mysql_real_escape_string -- and
 make no mistake, it would be a TON of man hours.

I believe it also takes into account special characters like _ and %, which 
addslashes does not.  In certain instances if you do not escape special 
characters, such as the wildcards I mentioned, the results that you get can 
differ from what you intended.  One instance this comes into play is a search 
form used by a non-technical user.  You should probably check that though, it 
has been a while since I have looked into it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] protected too much!

2005-05-12 Thread Miguel Vaz
	I am having a weird problem with a simple file listing on one of my 
client's host.

	My code works perfectly on my host, but if i use the same code on his, it 
only lists certain types of files. Heres the code: (i hate hosts that only 
allow php inside the cgi-bin dir, its crazy to code like this)

#!/usr/local/bin/php
?
$count = 0;
$handle=opendir(/whu1/sites/op158006/public_html/clientes/adagio/);
while (($file = readdir($handle)) !== false) {
if ($file == . || $file == .. || $file == list.php) {
} else {
if (filetype($file) == file) {
$size= filesize($file)/1000;
print $file ($size KB)br;
$count ++;
}
}
}
closedir($handle);
print  b$count/b Ficheiro(s)br;
?
	This hoster only allows PHP inside the cgi-bin directory. And i can only 
list files properly if i list that dir (cgi-bin). I.E. if i use:

$handle=opendir(/whu1/sites/op158006/cgi-bin/);
	it lists the dir perfectly, with images or whatever it might have in 
there. But if i try to list somje other dir outside the cgi-bin scope list 
comes out only with .txt and .php type of files, if i have an image in 
there it simply ignores it.
	Why does this happen? Its so frustrating!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Passing variable number of parameters by reference

2005-05-12 Thread Marek Kilimajer
I believe it's mentioned somewhere in the manual you can't do that. 
func_get_arg() always return a copy. You can workaround this using an array.

Robert Meyer wrote:
Hello,
Using: PHP Version 5.0.3
I build the following function:
function Set4HTMLOut() {
  $C = func_num_args();
  for ($I = 0; $I  $C; $I++) {
$A = func_get_arg($I);
 echo 'I['.$I.']('.strlen($A).'): '.$A.'br /';
$A = htmlspecialchars($A);
 echo 'I['.$I.']('.strlen($A).'): '.$A.'br /';
  }
}
And called it like this:
 Set4HTMLOut($LName, $LOrg, $LWebSite, $LPhones, $LComments);
 echo 'br /After call:br /'.
 'LName: '.$LName.'br /'.
 'LOrg: '.$LOrg.'br /'.
 'LWebSite: '.$LWebSite.'br /'.
 'LPhones: '.$LPhones.'br /'.
 'LComments: '.$LComments.'br /';
The echo statements in the Set4HTMLOut() function echos all the correct 
data and proves the data was received correctly then altered by the 
htmlspecialchars() function appropriately.  Notice that the caller passes 
each variable as a reference.  Yet, the echo statement after the call 
displays the data without any changes, like the first echo statement in 
the Set$HTMLOut() function does.

Is it not possible to pass variables by reference to a variable-length 
parameter list?  Or am I doing something wrong?  If so, what?

I have already built a work around.  I do not need any work arounds.  I just 
think one should be able to pass variables by reference to a function that 
accepts a variable-length parameter list.

Regards
Robert
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Inner Join or 2nd Query...?

2005-05-12 Thread Mark Sargent
Richard Lynch wrote:

On Thu, May 12, 2005 12:17 am, Mark Sargent said:
 

Hi All,
ok, this revised code produces the error below,
?php
   

You took out the mysql_connect completely???
Don't do that.
 

mysql_select_db(status,$db);
$maker_result = mysql_query(SELECT Makers.maker_id Makers.maker_detail
FROM Makers,$db);
   

if (!$maker_result) die(mysql_error());
 

$maker_num = mysql_num_rows($maker_result);//Line 40
?
select name=slct_maker
?php
for ($i=0; $i$maker_num; $i++){
$maker_myrow=mysql_fetch_array($maker_result);
$maker=mysql_result($maker_result,$i,maker_detail);
$maker_id=mysql_result($maker_result,$i,maker_id);
echo option value=\$maker_id\$maker/optionbr;
}
?
/select
*Warning*: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in */var/www/html/products.php* on line *40
Cheers.
Mark Sargent.
*
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   


 

Hi All,
all is well.
1st Query
?php
$db = mysql_connect(localhost, root, grunger);
mysql_select_db(status,$db);
$result = mysql_query(SELECT ProductTypes.product_type_detail, 
ProductTypes.product_type_id FROM ProductTypes,$db);
$num = mysql_num_rows($result);
?
select name=slct_product_type
?php
for ($i=0; $i$num; $i++){
$myrow=mysql_fetch_array($result);
$product_type=mysql_result($result,$i,product_type_detail);
$product_type_id=mysql_result($result,$i,product_type_id);
echo option value=\$product_type_id\$product_type/optionbr;
}
?
/select

2nd Query
?php
$maker_result = mysql_query(SELECT Makers.maker_id, Makers.maker_detail 
FROM Makers,$db);
if (!$maker_result) die(mysql_error());
?
select name=slct_maker
?php
$maker_num = mysql_num_rows($maker_result);
for ($i=0; $i$maker_num; $i++){
$myrow=mysql_fetch_array($maker_result);
$maker=mysql_result($maker_result,$i,maker_detail);
$maker_id=mysql_result($maker_result,$i,maker_id);
echo option value=\$maker_id\$maker/optionbr;
}
?
/select

Thanx for everyone's patience. Cheers.
Mark Sargent.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Inner Join or 2nd Query...?

2005-05-12 Thread Mark Sargent
Richard Lynch wrote:

On Thu, May 12, 2005 12:17 am, Mark Sargent said:
 

Hi All,
ok, this revised code produces the error below,
?php
   

You took out the mysql_connect completely???
Don't do that.
 

Sorry, was following what you suggested b4, no..?
$db = mysql_connect(localhost, root, grunger);
Don't connect to the database twice.
That's the most expensive (time-wise) thing in your whole script, probably.
 

mysql_select_db(status,$db);
$maker_result = mysql_query(SELECT Makers.maker_id Makers.maker_detail
FROM Makers,$db);
   

if (!$maker_result) die(mysql_error());
 

Ok, will add that
 

$maker_num = mysql_num_rows($maker_result);//Line 40
?
select name=slct_maker
?php
for ($i=0; $i$maker_num; $i++){
$maker_myrow=mysql_fetch_array($maker_result);
$maker=mysql_result($maker_result,$i,maker_detail);
$maker_id=mysql_result($maker_result,$i,maker_id);
echo option value=\$maker_id\$maker/optionbr;
}
?
/select
*Warning*: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in */var/www/html/products.php* on line *40
Cheers.
Mark Sargent.
*
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   


 

Cheers.
Mark Sargent.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] 'Require' and 'Select' lists

2005-05-12 Thread Andre Dubuc
Hi,

I've had some rather odd intermittent behavior with a select list drawn by a 
'require' on my production site. Sometimes, rather than displaying 'In 
USA/Canada' from the 'option selectedIn USA/Canada/option' code in the 
required file, it will display a blank. Yet, if I try to duplicate this 
behavior on the development box, it will display as coded.

Since I use this text string as a validator for user input, it really messes 
up the database/code functions that rely on it.

?php require(provcountry.sty); ?

[snippet of 'require' text (provcountry.sty)]
tr
tdbState nbsp;/b/td
tdSELECT NAME=selstate
option selectedIn USA/Canada/option
option value=AlabamaAlabama/option
. . .
/SELECT/td
/tr

[snippet of some validating code verifying $selstate that relies on $selstate]

?php
if (($_POST['selstate'] != In USA/Canada)($_POST['typstate'] != ))
 die (h5brbrPlease choose from 'In USA/Canada' or type in 'Other
 State'.
brDo not use bothbrbrClick 'Back' on your  browser to
 re-enter information/h5);
?

Any ideas why this is happening?

Tia,
Andre

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sleep function

2005-05-12 Thread James Williams
I just tried a couple of output_buffering on a test script I made and
it won't work... It simply waits for 10 seconds then displays
everything...  Kinda sucks.

On 5/12/05, Richard Lynch [EMAIL PROTECTED] wrote:
 On Thu, May 12, 2005 12:39 pm, [EMAIL PROTECTED] said:
  I want to create a script that displays all names from a database once per
  second.
  A part of the script look like this.
 
  for ($i=0; $i$total_names; $i++)
  {
echo namebr;
 
 http://php.net/flush
 
sleep (1);
  }
 
 --
 Like Music?
 http://l-i-e.com/artists.htm
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
jamwil.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sleep function

2005-05-12 Thread James Williams
Okay... the difference is between Apache + PHP for windows, and Apache
+ PHP for unix... it works on linux / unix... but not on windows...
check it out.

http://www.jamwil.com/misc/flush.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   >