[PHP] OOT - postgress help

2001-05-21 Thread toto

First, i'm sorry if this is an out of topic subject, but i've try to post
this email to one of postgres mailing list, and i can't find any help there.
i wish, if one of you know the solutions of my problem, you can share it
with me.

i create a little stored procedure using plpgsql from pgaccess. function
input is table name where the function will simply iterate along each record
in the table and raise notice for each of them.

when i run this function from shell command using : select
browse_table('sex'), the function error with error message 'ERROR:  parser:
parse error at or near $2'. As i concern, this error came from the line i
mark because the function can't receive variable 'table_name' to generate
query.

i'm new here, so can some body help me, please

the source code is below.
===
DECLARE
table_name ALIAS for $1;
each_row RECORD;
BEGIN
FOR each_row IN select * from table_name LOOP == i believe this's an
error source
raise notice 'row';
END LOOP;
END;
===
function description :
function name : browse_table
returns   : bpchar
parameters: bpchar
language  : plpgsql


-toto-



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




Re: [PHP] file()

2001-05-21 Thread elias

yes true.
10x
Christian Reiniger [EMAIL PROTECTED] wrote in message
01051912242605.00594@chrisbig">news:01051912242605.00594@chrisbig...
On Saturday 19 May 2001 01:27, elias wrote:
 hello,

 i have my file which reads like:
 dir3/dir3-3/
 dir2/
 dir1/
 s

[...]

 as you noticed that in each element of the array $a a space is
 appended for an unknown reason!

Wild guess: You're on a Unixy server and the file is in DOS format (CRLF
endings)?

--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Very funny, Scotty! Now beam up my clothes...

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




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




Re: [PHP] e*reminder and cron

2001-05-21 Thread James Holloway

Hi Henry,  I'm not too familiar with Cron, but check the man pages for cron
and crontab (type 'man cron' or 'man crontab', or type 'man man' if you've
not used man pages before).


James.


Henry [EMAIL PROTECTED] wrote in message
018b01c0e19d$544818a0$046265cb@henry">news:018b01c0e19d$544818a0$046265cb@henry...
 i'd like to run something like
http://sourceforge.net/projects/e-reminders/
 on my site. it uses cron to trigger the mail to be sent.

 i'm not familiar with unix and cron. apparently i need to use shell access
 on my site to get this working.

 anybody got any tips to get cron working in the simplest way.

 cheers
 Henry
 http://www.bigjolt.com


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




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




[PHP] select the max value

2001-05-21 Thread Jacky

Hi all
Is this the corerct way of selecting the max value in a table?
select * from score where MAX(scorevalue)
cheers
Jack
[EMAIL PROTECTED]
There is nothing more rewarding than reaching the goal you set for yourself



[PHP] security

2001-05-21 Thread Ker Ruben Ramos

ey guys,

  what are the functions that's disabled if safe_mode is On?
also, what I just did now is disabling the functions exec() and system() just to 
prevent shell commands.
but, how do i disable something like `ls -l /` ? the backticks.

Thanks guys



RE: [PHP] select the max value

2001-05-21 Thread Craig Vincent

SELECT MAX(scorevalue) FROM score

Will display the maximum value of your scorevalue column.

Sincerely,

Craig Vincent

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




[PHP] UK based Hosting?

2001-05-21 Thread Tarrant Costelloe

 Can anyone recommend a good/cheap uk based, PHP host? I say cheap as I am
 going to be needing about 500mg's of space for my current site
 (httpp://planet-tolkien.com) hosted with uk2.net.

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




Re: [PHP] select the max value

2001-05-21 Thread Tom Rogers

Hi
try:
select * from score order by scorevalue DESC LIMIT 1

or if your db supports sub selects:
select * from score where scorevalue=(select MAX(scorevalue) from score)

Tom


At 03:38 PM 21/05/01 -0500, Jacky wrote:
Hi all
Is this the corerct way of selecting the max value in a table?
select * from score where MAX(scorevalue)
cheers
Jack
[EMAIL PROTECTED]
There is nothing more rewarding than reaching the goal you set for yourself


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




Re: [PHP] include() in a file incuded()

2001-05-21 Thread Christian Reiniger

On Sunday 20 May 2001 19:39, Jaime Torres wrote:

 I've been blocked by this tiny problem...

 I have a main.php file:

 ?
 $frames = true;
 $open = http://myserver.com/info.html;;
 if ($frames)
 {
 include (frameset.php);
 }
 ?

 The frameset.php looks like (omitting almost all the HTML):
 frameset rows=100,* border=0
 frame src=onlineview.php3
 frame src=footer.html
 /frameset

 In the onlineview.php file I need to use the $open URL defined before,
 but it isn't defined here. What am I doing wrong? How can I get $open's
 value from this file?

(1) $open is defined in frameset.php
(2) frameset.php outputs a HTML page with the frameset definition
(3) when the browser receives this, it issues two new requests, one for 
onlineview.php3 and one for footer.html

So you don't *include* onlineview.php3, you just reference it in the HTML 
code.

do a 
 frame src=onlineview.php3?open=?= rawurlencode ($open) ?
instead (i.e. pass $open as parameter to onlineview.php3).

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.

- George Gordon Noel Byron (1788-1824), [Lord Byron]

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




Re: [PHP] PHP and XHTML

2001-05-21 Thread Christian Reiniger

On Sunday 20 May 2001 20:51, Manuel Lemos wrote:
 Hello Navid,

 On 20-May-01 14:36:33, you wrote:
 So you suggest that I use the name attribute in XHTML and ignore the
  fact that it has been depreciated and replaced by the ID attribute?
  Will that solve my problem?

 It depends.  If what is going to process the document is a regular
 browser, the NAME attribute is what matters.  Future browsers will have
 to handle current HTML compatibly. So there is no point in removing the
 NAME attribute.

Why not specify both? 

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.

- George Gordon Noel Byron (1788-1824), [Lord Byron]

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




[PHP] checking to see if part of a variable exists?

2001-05-21 Thread Sandeep Hundal

hi all!

i need to see if a $variable has a piece of text included in it. how do i do
that?

i need to do something like:

if ($variable =matches= @monkeys.com) { then do this}

tia!


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




Re: [PHP] checking to see if part of a variable exists?

2001-05-21 Thread James Holloway

Hi Sandeep,

?
if (preg_match(/@monkeys.com/i, $variable)) {
echo Got some monkeys.;
} else {
echo No monkeys here.;
}
?

preg_match();
ereg();
eregi();

Will all help you.

James.

Sandeep Hundal [EMAIL PROTECTED] wrote in message
A0A5617A0A05D5118EBD00508B8B953B5EA932@PROF-X">news:A0A5617A0A05D5118EBD00508B8B953B5EA932@PROF-X...
 hi all!

 i need to see if a $variable has a piece of text included in it. how do i
do
 that?

 i need to do something like:

 if ($variable =matches= @monkeys.com) { then do this}

 tia!


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




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




RE: [PHP] checking to see if part of a variable exists?

2001-05-21 Thread Jon Haworth

http://www.php.net/manual/en/function.strstr.php

if (strstr (i like beer, beer)) {
  // it's in there
} else {
  // it's not
}

-Original Message-
From: Sandeep Hundal [mailto:[EMAIL PROTECTED]]
Sent: 21 May 2001 11:39
To: Php (E-mail)
Subject: [PHP] checking to see if part of a variable exists?


hi all!

i need to see if a $variable has a piece of text included in it. how do i do
that?

i need to do something like:

if ($variable =matches= @monkeys.com) { then do this}

tia!


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



**
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or
confidentiality'

**

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




Re: [PHP] How to loop the HTTP_POST_VARS array?

2001-05-21 Thread Carlos Fernando Scheidecker Antunes

Maxim,

This is great. Thank you very much !!

I really appreciate your explanation since I did not get anything this good
in any of my books.

Since all the values that I need to retrieve are CheckBoxes that are Named
C1,C2,C3,C... I have done the following and it worked :

function RetrieveItens() {
global $Itens;
global $HTTP_POST_VARS;



$index = count($HTTP_POST_VARS);

for($i=1; $i = $index; $i++) {
if (isset($HTTP_POST_VARS[C$i]))
$Itens[] = $HTTP_POST_VARS[C$i];
}
$index = count($Itens);
return $index;

} // function RetrieveItens



- Original Message -
From: Maxim Maletsky [EMAIL PROTECTED]
To: 'Carlos Fernando Scheidecker Antunes' [EMAIL PROTECTED];
PHP-GENERAL [EMAIL PROTECTED]
Sent: Monday, May 21, 2001 1:00 AM
Subject: RE: [PHP] How to loop the HTTP_POST_VARS array?


no, you are trying to get an $HTTP_POST_VAR[integer]... it is not there. The
keys are your variable names, therefore this is correct:

foreach($HTTP_POST_VARS as $key=$val) {
$itens[] = $val;
}

will fit everything form ..POST_VARS into $itens array. BUT you'll loose all
the key names, knowing nothing of where these values came from.

try rather do this:

foreach($HTTP_POST_VARS as $key=$val) {
$itens[$key] = $val;
}

this will result you true:

if($HTTP_POST_VARS['var_name'] == $itens['var_name']) {}


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer
 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com



-Original Message-
From: Carlos Fernando Scheidecker Antunes [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 21, 2001 12:43 PM
To: PHP-GENERAL
Subject: [PHP] How to loop the HTTP_POST_VARS array?
Importance: High


Oops. I've got a typo : $itens[]
Here's the correct code :

Hello all,

I'm trying to loop the $HTTP_POST_VARS variable like an array like this :

$index = count($HTTP_POST_VARS);

for($i=0; i  $index; i++) {
$itens[] = $HTTP_POST_VARS[$i];
}

But it is not working.

Can anoyone tell me how to do it?

Thanks,

Carlos Fernando.



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

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


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




Re: [PHP] Re: [PHP-DEV] Fork() in php?

2001-05-21 Thread Plutarck

IMHO, one of the main attractions of open source software is that the
creators themselves are easy to contact. Getting a question answered by a
company usually involves talking to customer service, who gets an answer
from a supervisor, who asked the lead of the programming department, who
asked the guys in charge of the parts of the code your asking about, who
read through some internal documentation and maybe the code itself, to get
the answer.

With open source your questions are usually answered by someone who actually
works on the code itself. And sometimes the people who actually 'invented'
the product are the one's you're talking to!

To me, that's just really cool. It's the main attraction to open-source and
small companys for me; you get to talk to the people in charge. Suggest
something good and it may get done. It's like being really rich without
being able to buy anything. ;)

Which is precisely why it's wise to treat everyone in the community with an
equal level of respect, because you're already talking to the people in
charge.

The PHP Group, Zend, and individuals like Rasmus control what PHP will and
won't support. None of them do it on there own. There are no real dictators
who control the flow of PHP's future, which is how open-source is suppose to
be.



Plutarck

Frank Joerdens [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Mon, May 21, 2001 at 01:55:10PM +1000, Greg Wright wrote:
 [ . . . ]
  IIRC Rasmus was one of the main people involved in bringing PHP to life,
it

 Well, if anyone can be said to have invented it, it's Rasmus. At some
 point around 96 (?) he was approached by Zeev and some others who
 suggested to recode what was then PHP/FI from scratch. The outcome was
 PHP 3.0 . . . shouldn't someone write a history of PHP?

 A little anecdote I keep telling is that back in '97, when I asked my
 very first question on this list, it was answered within less than half
 an hour by the mighty Rasmus himself! Having worked with M$ stuff mostly
 up until then if felt, wow, this is like, I post to Microsoft and get an
 answer from Bill within the half-hour! I was undecided then as to which
 scriptiong environment to go for. This won me over.

 Cheers,
 Frank

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




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




Re: [PHP] comparison operators

2001-05-21 Thread Christian Reiniger

On Monday 21 May 2001 08:03, Heidi Belal wrote:

 I have a form where i let people choose a file to
 upload, but i want to limit them to image files only.
 So i want to only allow the .gif and .jpg to be
 uploaded.  What i tried doing was this:
 if ($filename_type == image/gif)
-- upload file
 otherwise give an error message!

 but for some reason this doesn't work.  It uploads any
 kind of file without complaint!  So what am i doing
 wrong?  Is there another operator to compare strings
 for instance? Or what is the problem?

== is perfectly fine for string comparison. Try doing a
echo '$filename_type';
and (generally) a phpinfo ();
to see what's passed to your script.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.

- George Gordon Noel Byron (1788-1824), [Lord Byron]

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




Re: [PHP] How to test content encoding?

2001-05-21 Thread Christian Reiniger

On Monday 21 May 2001 08:14, Plutarck wrote:
 I'm trying to test the gz_handler, among other things, but I have no
 idea if the output is actually gzip encoded.

You could try using wget with a custom Http-Accept-Encoding: header

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.

- George Gordon Noel Byron (1788-1824), [Lord Byron]

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




Re: [PHP] ok, are servlets/jsp faster than php4?

2001-05-21 Thread Plutarck

 why oh why doesn't php/plain zend cache scripts in the first place? :-/

PHP is developed in a way that no feature is added that would harm the
performance or usability for the vast majority of people (80-90%+). Caching
would speed individual scripts, but what if you have a very large amount of
scripts or a few very large scripts? Or what if your scripts aren't used
very often and you don't have plenty of extra memory (and who does?)?

PHP's design would have to be significantly changed and altered, and many
people wouldn't use it anyway. Thus the perfect solution is just to use an
outside product. As we can see from APC and Zend Cache, caching is obviously
not very easy to accomplish. If it were, we probably wouldn't be talking
about this in the first place ;)

The only thing that needs to be changed in PHP, IMHO, is to allow
pre-compiled scripts to be handed to it for execution. Thus developing a
cache would be much easier, I'd imagine.

The way I'd think a cache would work best:

When a script is called rather than calling PHP, have it call Cache instead
of PHP directly.

The cache checks it's memory and sees if that script has been compiled. If
so it checks to ensure the source hasn't been altered since compiling it,
then it has PHP execute it and serves it out (if the page has no dynamic
pieces which change for each request like printing out the time, Cache could
just hand the page out without calling PHP).

Cache can be configured to store the most popular scripts, the one's that
are naturally the slowest, or it can be told to handle certain scripts
regardless of their popularity. And you would be able to tell it what's the
most memory it could use.


Sounds great, but if it were easy someone would have already done it.

Currently any language is only as fast as the programmer makes it. You can
write pure assembler code which trudges along at a truly embarrasingly slow
rate. PHP is no different. It doesn't matter what language you're using, the
more code that has to be run the slower it's going to be. The more librarys
you use the slower and more memory intensive the code. It's beyond reason to
think it would be any other way.

PHP is slower in code execution than the C it's written in. *pauses for the
duuuhh! reaction to wear off*
That's how every scripting language works, and it is completely, utterly,
and impossibly unavoidable.

Trading simplicity for speed is unavoidable, unless you want to code in
hexadecimal. PHP remains to be the best trade off between simplicity and
speed, which means that there will always be a faster language than PHP. But
IMHO, none are both faster and easier. Otherwise I wouldn't be using PHP ;)



If you don't know why something isn't working, it's probably your fault.
(words to live by :)

Plutarck

Steven Haryanto [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 yes, i have discovered recently that php is not as fast as it
 is hyped to be. don't get me wrong. php is fast, but it depends
 on how you arrange your scripts. if you include a lot of library
 code (PEAR, etc etc), the overhead would increase and increase.
 i thought php has always cached compiled scripts (since it is
 fast enough for me so far), but the fact is it does not. without
 cacher like apc or zend cache, mod_php is no better than cgi,
 except it avoids per-request forking and configuration parsing.

 why oh why doesn't php/plain zend cache scripts in the first
 place? :-/

 Regards,
 Steve

 On 20/05/2001 20:53, Christopher Leigh wrote:
 ok, are servlets/jsp faster than php4?
 since zend cache isn't free... :(


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




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




[PHP] Quotes in GET variables

2001-05-21 Thread Mark Rogers

If I submit a string to a script via GET which contains quotes, how should
they appear in my script?

Eg:
--- test.php ---
echo $HTTP_GET_VARS['test'];

Go to:
test.php?test=this+doesn%27t+work

.. and you get:
this doesn\'t work

(Char 27 is a single quote. Echoing $test gives the same result.)

I can use stripslashes lose the escape char, but should this be necessary?
I'm using v4.0.4pl1

--
Mark Rogers
Lose the -news in the email address if replying direct



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




Re: [PHP] get all defined constants?

2001-05-21 Thread Plutarck

Hmm...SID is a constant, and when it's set it is present in $GLOBALS.

But when I run this:

?php

define(CON1, Hi there!);

echo CON1;
print_r($GLOBALS);

?

...the constant exists, but is not present in $GLOBALS. Weird...anyone know
why this happens? (I'm using 4.0.5)


Plutarck

Alex Black [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  phpinfo() allways has a list of variables. but of course every variable
is
  allways in $GLOBALS too.

 including constants?

 I just print_r'd globals to refresh my memory, and found what I was
 expecting: none of my constants.

 ?

 _alex


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




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




RE: [PHP] function to complete strings with white spaces on the left

2001-05-21 Thread Craig Vincent

untested!

?
if (strlen($word)  17) { $padding = 17-strlen($word); $word .= str_repeat('
', $padding); unset($padding); }
?

The reason for the if statement is that str_repeat will produce an error if
17-strlen($word) = 0 and that'll break your scriptof course you could
remove the if state if you're positive the # of characters in $word never
exceeds 16.

Sincerely,

Craig Vincent


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




Re: [PHP] Quotes in GET variables

2001-05-21 Thread Plutarck

It's a feature of PHP that it automatically escapes data submitted in
PUT/GET/etc.

It's nice in that it adds to how secure PHP code is, but it can be a hassle.
Not sure if there is a function which removes escape characters will leaving
normal backslashes alone. If you REALLY need to turn it off I believe it's
the magic_quotes_gpc option.


Plutarck

Mark Rogers [EMAIL PROTECTED] wrote in message
9eavif$dks$[EMAIL PROTECTED]">news:9eavif$dks$[EMAIL PROTECTED]...
 If I submit a string to a script via GET which contains quotes, how should
 they appear in my script?

 Eg:
 --- test.php ---
 echo $HTTP_GET_VARS['test'];

 Go to:
 test.php?test=this+doesn%27t+work

 .. and you get:
 this doesn\'t work

 (Char 27 is a single quote. Echoing $test gives the same result.)

 I can use stripslashes lose the escape char, but should this be necessary?
 I'm using v4.0.4pl1

 --
 Mark Rogers
 Lose the -news in the email address if replying direct



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




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




Re: [PHP] Quotes in GET variables

2001-05-21 Thread Mark Rogers

 It's a feature of PHP that it automatically escapes data submitted in
 PUT/GET/etc.

It didn't seem to be happening with POST which is why I thought it odd, but
that probably means I didn't test properly :-)

 It's nice in that it adds to how secure PHP code is, but it can be a
hassle.

Out of curiousity, what are the security implications? Presumably a failure
to validate input properly leading to unintended actions, but I can't think
of any examples to help me decide whether to turn this off.

Thanks for the quick response.
--
Mark Rogers




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




[PHP] generating thumbnails

2001-05-21 Thread Samuel Lüscher

is there any way to resize images in php and save them to a new file?
i want to write sort of a (db-powered) picture gallery that automatically
creates thumbnails out of http-uploaded files.

thanks for your advice
venome

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


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




Re: [PHP] Quotes in GET variables

2001-05-21 Thread James Holloway

Hi Mark,

  It's nice in that it adds to how secure PHP code is, but it can be a
 hassle.

 Out of curiousity, what are the security implications? Presumably a
failure
 to validate input properly leading to unintended actions, but I can't
think
 of any examples to help me decide whether to turn this off.

Most default to set magic_quotes_gpc on - otherwise, to safeguard against
(amongst many other things) mysql or other database errors, all fields that
aren't integers would have to have addslashes() applied to them.  Try
entering a string like this:

$string = a href=\http://www.php.net\;PHP/a;

$string = stripslashes($string);

$insert = @mysql_query(INSERT INTO table (string) VALUES ('$string'))
or die (mysql_error());

And see how fast you run into errors ;)

James.



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




Re: [PHP] generating thumbnails

2001-05-21 Thread George E. Papadakis

Find a good command line programm that does resing and use exec or system to
do the thumbnailing
Fopen  fwrite   exec.

If you are on linux I suggest using NetPBM.

- Original Message -
From: Samuel Lüscher [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, May 21, 2001 3:21 PM
Subject: [PHP] generating thumbnails


 is there any way to resize images in php and save them to a new file?
 i want to write sort of a (db-powered) picture gallery that automatically
 creates thumbnails out of http-uploaded files.

 thanks for your advice
 venome

 --
 GMX - Die Kommunikationsplattform im Internet.
 http://www.gmx.net


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



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




Re: [PHP] generating thumbnails

2001-05-21 Thread Shawn Reed

nahhh, if you're doing a lot of images on a page, doing a system call for
each one would generate entirely too much overhead, imo.

check out the built-in image manipulation functions in php.
http://www.php.net/manual/en/ref.image.php

there is a function called ImageCopyResized() which is probably what you would need to 
use.  i used to have a thumbnailer written in php but alas, it's been so long ago, 
that i forgot how i wrote it. :)

~shawn

- Original Message -
From: George E. Papadakis [EMAIL PROTECTED]
To: Samuel L?scher [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, May 21, 2001 8:31 AM
Subject: Re: [PHP] generating thumbnails


 Find a good command line programm that does resing and use exec or system
to
 do the thumbnailing
 Fopen  fwrite   exec.

 If you are on linux I suggest using NetPBM.

 - Original Message -
 From: Samuel L?scher [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, May 21, 2001 3:21 PM
 Subject: [PHP] generating thumbnails


  is there any way to resize images in php and save them to a new file?
  i want to write sort of a (db-powered) picture gallery that
automatically
  creates thumbnails out of http-uploaded files.
 
  thanks for your advice
  venome
 
  --
  GMX - Die Kommunikationsplattform im Internet.
  http://www.gmx.net
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


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






[PHP] What's wrong with this code?

2001-05-21 Thread Plutarck

I'm creating a filter to re-write webpages, and everything is going fine.
I'm trying to strip out anything using the SCRIPT tag, and here's what I
know works:

$file = eregi_replace(script.*.*/script, !-- RWW: Scripting
killed --, $file);

But I use PCRE functions, so I don't want to use ereg in one place and PCRE
in another, so I tried:

$file = preg_replace(#script.*.*/script#i, !-- RWW: Scripting
killed --, $file);

Thing is, that doesn't work. And I don't know why.

I assume that the brackets are what is causing the trouble, but what do
those brackets do in PCRE that requires they be escaped? But escaping them
doesn't seem to work either...

So, what's wrong with the second piece of code that isn't wrong in the
first?


Thanks in advance.

Plutarck



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




php-general Digest 21 May 2001 13:20:48 -0000 Issue 699

2001-05-21 Thread php-general-digest-help


php-general Digest 21 May 2001 13:20:48 - Issue 699

Topics (messages 53649 through 53708):

PLEASE -- Compiling an extension for PHP module (pgsql.so -- missing libpq.so.2)
53649 by: Jason

Re: function to complete strings with white spaces on the left
53650 by: Mark Maggelet
53700 by: Craig Vincent

?=SID? is not translated...
53651 by: Christian Marschalek

undo htmlspecial
53652 by: Nicholas

should be simple
53653 by: Richard Kurth
53654 by: Jason Murray
53655 by: Richard Kurth
53656 by: Gerard Onorato

e*reminder and cron
53657 by: Henry
53679 by: James Holloway

query question
53658 by: Jacky
53662 by: Maxim Maletsky

How to loop the HTTP_POST_VARS array?
53659 by: Carlos Fernando Scheidecker Antunes
53660 by: Carlos Fernando Scheidecker Antunes
53664 by: Maxim Maletsky
53665 by: Rasmus Lerdorf
53693 by: Carlos Fernando Scheidecker Antunes

php3 vs php4 and ini_get
53661 by: Dennis Gearon

Re: [PHP-DEV] Fork() in php?
53663 by: Greg Wright
53666 by: Frank Joerdens
53667 by: Frank Joerdens
53694 by: Plutarck

porting from perl
53668 by: Matt Broughton
53671 by: Brian Clark

Trimming 2 Characters from the end of a string?
53669 by: Jason
53670 by: Rasmus Lerdorf
53688 by: Gyozo Papp

Cannot view source via IE browser
53672 by: John M
53673 by: Maxim Maletsky

Re: ok, are servlets/jsp faster than php4?
53674 by: Steven Haryanto
53697 by: Plutarck

comparison operators
53675 by: Heidi Belal
53695 by: Christian Reiniger

How to test content encoding?
53676 by: Plutarck
53696 by: Christian Reiniger

OOT - postgress help
53677 by: toto
53702 by: Gyozo Papp

Re: file()
53678 by: elias

select the max value
53680 by: Jacky
53682 by: Craig Vincent
53684 by: Tom Rogers
53687 by: Gyozo Papp

security
53681 by: Ker Ruben Ramos

UK based Hosting?
53683 by: Tarrant Costelloe

Re: include() in a file incuded()
53685 by: Christian Reiniger

Re: PHP and XHTML
53686 by: Christian Reiniger

Re: RegEx Question
53689 by: Gyozo Papp

checking to see if part of a variable exists?
53690 by: Sandeep Hundal
53691 by: James Holloway
53692 by: Jon Haworth

Quotes in GET variables
53698 by: Mark Rogers
53701 by: Plutarck
53703 by: Mark Rogers
53705 by: James Holloway

Re: get all defined constants?
53699 by: Plutarck

generating thumbnails
53704 by: Samuel Lüscher
53706 by: George E. Papadakis
53707 by: Shawn Reed

What's wrong with this code?
53708 by: Plutarck

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--



Hi,

I'm trying to compile an extension for Postgre support which I will either
load in the php.ini or use the dl() function.

Both methods fail right now. The dl() function gives me verbose though.

I compiled the module like this:

./configure --with-apache=/usr/local/Apache/apache_13 --with-pgsql=shared
make

I entered the php_4.0.5/modules directory. I see two files pgsql.so and
pgsql.la.

I copy both to /usr/local/lib (where my libs sit as specified in php.ini).

I restart the server and I get an error saying a shared library (libpq.so.2)
cannot be found.

I went to /usr/local/pgsql/lib and copy libpq.so.2 to /usr/local/lib.

Now I get the following error:

Warning: Unable to load dynamic library '/usr/local/lib/pgsql.so' -
/usr/local/lib/pgsql.so: Undefined symbol zend_ini_boolean_displayer_cb in
/public_html/inc/mainfile.php on line 3

Whats the deal with this? I am compiling right? Should php have produced a
different libpq.so.2 file elsewhere?

THANKS!!!





On Sun, 20 May 2001 22:03:05 -0300, Carlos Fernando Scheidecker
Antunes ([EMAIL PROTECTED]) wrote:
Hello All,

I need to output a string that must always be 17 characters even if
the inside value is not.

Supose a have the HELLO word that is a 5 character string and I need
to output HELLO which is 17 characters.
How can I accomplish this in PHP4 ?

Has anyone ever did it?

echo str_pad(HELLO,17);






untested!

?
if (strlen($word)  17) { $padding = 17-strlen($word); $word .= str_repeat('
', $padding); unset($padding); }
?

The reason for the if statement is that str_repeat will produce an error if
17-strlen($word) = 0 and that'll break your scriptof course you could
remove the if state if you're positive the # of characters in $word never
exceeds 16.

Sincerely,

Craig Vincent





My system does not tranlate ?=SID? into the PHP Session 

[PHP] php, apache, mysql

2001-05-21 Thread Gregory Hernandez

hello everyone.

ok, here's a question.  i'm running MacOS X.  i had previously installed 
php and apache with no problem.  this past weekend, i installed the 
unofficial latest version of mysql, MySQL 3.23.38, the version 
packaged for of course MacOS X. 

I noticed that mysql was installed on a different path/directory than 
apache and php.  so, my question is the following, where 
(path/directory) should i re-install ALL THREE applications? 

thanks in advance.


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




Re: [PHP] What's wrong with this code?

2001-05-21 Thread CC Zona

In article 9eb4nf$pdf$[EMAIL PROTECTED],
 [EMAIL PROTECTED] (Plutarck) wrote:

 $file = eregi_replace(script.*.*/script, !-- RWW: Scripting
 killed --, $file);
 
 But I use PCRE functions, so I don't want to use ereg in one place and PCRE
 in another, so I tried:
 
 $file = preg_replace(#script.*.*/script#i, !-- RWW: Scripting
 killed --, $file);
 
 Thing is, that doesn't work. And I don't know why.

pregs are greedy by default, while eregs are ungreedy by default.  If you 
make your preg ungreedy (using the U modifier), do you get a result more 
consisent with the ereg's?

-- 
CC

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




Re: [PHP] What's wrong with this code?

2001-05-21 Thread Rasmus Lerdorf

 But I use PCRE functions, so I don't want to use ereg in one place and PCRE
 in another, so I tried:

 $file = preg_replace(#script.*.*/script#i, !-- RWW: Scripting
 killed --, $file);

   '/script.*.*?\/script/i'

-Rasmus


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




Re: [PHP] xmlHTTP.send equiv?

2001-05-21 Thread phpman

Does anyone have info on doing this with a secure server?


Michael Conley [EMAIL PROTECTED] wrote in message
2102328FD2ECD411879E00609737BFD10BE2AD@FATBOY">news:2102328FD2ECD411879E00609737BFD10BE2AD@FATBOY...
 does anyone have info on this?

 -Original Message-
 From: Todd Kennedy [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 01, 2001 1:38 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] xmlHTTP.send equiv?


 Does anyone know of an equivilent for ASP's xmlHTTP.send command for
 PHP?

 i need to send a XML string out to an HTTP server without using user
 interaction (from the inside of a script).

 please respond via email at [EMAIL PROTECTED]

 thanks


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








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



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




Re: [PHP] Quotes in GET variables

2001-05-21 Thread Plutarck

I saw an article just a few days ago on Hacking PHPNuke that was an
excellant example of how the escape GPS thing saved a program from a major
security hole caused by a very minor oversite in less than 0.01% of the
code. Can't remember the name of the site...I think it was linked from
TheRegister.co.uk, but I can't recall. It had a kind of metallic greyish
look with small print.

Anyway, it's not a big thing if you're _really_ stringent about how you
check every single variable which is used in a database query,
system/passthru/exec, or eval command, and your checking methods are
flawless, but otherwise it's just best to go to the trouble of hacking
around the input explicitly.

Unless you're setting of PHP will only effect your application and no one
elses, and you don't have to worry about having the script run on a system
who's config you don't control, then knock yourself out. But it's a good
idea to pretend that the default settings of PHP can't be changed, since
most people have those settings and you don't want your code to be system
dependent :)



Plutarck

Mark Rogers [EMAIL PROTECTED] wrote in message
9eb0sl$vvr$[EMAIL PROTECTED]">news:9eb0sl$vvr$[EMAIL PROTECTED]...
  It's a feature of PHP that it automatically escapes data submitted in
  PUT/GET/etc.

 It didn't seem to be happening with POST which is why I thought it odd,
but
 that probably means I didn't test properly :-)

  It's nice in that it adds to how secure PHP code is, but it can be a
 hassle.

 Out of curiousity, what are the security implications? Presumably a
failure
 to validate input properly leading to unintended actions, but I can't
think
 of any examples to help me decide whether to turn this off.

 Thanks for the quick response.
 --
 Mark Rogers




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




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




RE: [PHP] Quotes in GET variables

2001-05-21 Thread Boget, Chris

 Anyway, it's not a big thing if you're _really_ stringent about how you
 check every single variable which is used in a database query,
 system/passthru/exec, or eval command, and your checking methods are
 flawless, but otherwise it's just best to go to the trouble of hacking
 around the input explicitly.

What would you do to go about doing this?  How can you be
_really stringent_ in checking your variables?  Check that they
have a value?

Chris



Re: [PHP] generating thumbnails

2001-05-21 Thread Rasmus Lerdorf

 is there any way to resize images in php and save them to a new file?
 i want to write sort of a (db-powered) picture gallery that automatically
 creates thumbnails out of http-uploaded files.

It's rather bleeding edge, but if your gra a copy of GD2-beta and a
snapshot of PHP (from snaps.php.net) then you can use imagecopyresampled()
to create thumbnails.  It can be a bit slow if your originals are huge,
but the quality is very good.

-Rasmus


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




Re: [PHP] generating thumbnails

2001-05-21 Thread Rasmus Lerdorf

 nahhh, if you're doing a lot of images on a page, doing a system call for
 each one would generate entirely too much overhead, imo.

 check out the built-in image manipulation functions in php.
 http://www.php.net/manual/en/ref.image.php

 there is a function called ImageCopyResized() which is probably what you would need 
to use.  i used to have a thumbnailer written in php but alas, it's been so long ago, 
that i forgot how i wrote it. :)

The problem with that function is that it is going to dither things down
to 8-bit colour for you and the resulting thumbnail isn't going to look
very good.  Sometimes for thumbnails that is not an issue though.

imagecopyresampled() does a very nice job of scaling images without losing
quality, but you need GD2 to use it.

-Rasmus


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




[PHP] Check multiple cookies

2001-05-21 Thread Sam Gooding

Is it possible to check multiple cookie values and then redirect to another 
page depending on what cookie values have been set?  Sort of like:

if(cookie == 3)
   goto(url1)
elseif(cookie2 = 5)
   goto(url2)
else
   goto(url3)

Thanks in advance!


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




[PHP] Upload Problem

2001-05-21 Thread Feroze Md. Arif

Hi,

I wrote a small upload script (using http) to upload various files to a
website.  I am able to upload jpg and gif files but I am unable to upload
tif files.  This seems strange.  Could anyone please let me know what I am
missing out on?  I have checked the mime.types file of apache and i saw the
entry for tif files there.

The server that I am uploading is a Cobalt Cube 2, Apache 1.3.3 Cobalt, PHP
4.0.5.  PHP has been compiled as a dynamic loadable module with apxs, ftp,
mysql etc.

I hope that someone will be able to help me.

Best Regards
Feroze

Jar Jar Binks will be Jedi!


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




[PHP] if $submit

2001-05-21 Thread Tarrant Costelloe

Whenever I use  the ? if ($submit) ? statement in a php page it always
comes up with:

Warning: Undefined variable
Until the submit has been hit, and then it continue on with the rest of the
script fine ( ifelse).

How do you stop this warning message?

Thanks in advance!

Tarrant Costelloe
Web Developer
InsurE-com Ltd.

Office Tel:  +44 (0)1273 852014
Mobile: +44 07714087114
[EMAIL PROTECTED]
http://www.insur-e.net


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




Re: [PHP] What's wrong with this code?

2001-05-21 Thread Plutarck

Since there is a / in the code itself, I use # as a delimiter instead so
I don't have to escape it, making it harder to read.

So here's the code:

$file = preg_replace(#script.*.*/script#Ui, !-- RWW: Scripting
killed --, $file);

Which works...kinda. But here's the weird thing. This is a piece of code in
the HTML which will be replaced:

SCRIPT Language='JavaScript'
!--
function changeimage(imgNam,status) {
 if (document.images) {
  document[imgNam].src=eval(imgNam + '_' + status + '.src');
 }
}
// --
/SCRIPT
SCRIPT LANGUAGE='JavaScript'
!--
if (document.images)
{
// Preload images for onclick image change function
major1_on   = new Image();
major1_on.src   = '/nav/1-on.gif';
major1_off  = new Image();
major1_off.src  = '/nav/1-off.gif';
major1_over = new Image();
major1_over.src = '/nav/1-over.gif';
}
// --
/SCRIPT


And here's the weird part. When I run my preg code on just that piece of
code, it does absolutely nothing to it. This is the whole code I'm using to
test:

?php

$file = SCRIPT Language='JavaScript'
!--
function changeimage(imgNam,status) {
 if (document.images) {
  document[imgNam].src=eval(imgNam + '_' + status + '.src');
 }
}
// --
/SCRIPT
SCRIPT LANGUAGE='JavaScript'
!--
if (document.images)
{
// Preload images for onclick image change function
major1_on   = new Image();
major1_on.src   = '/nav/1-on.gif';
major1_off  = new Image();
major1_off.src  = '/nav/1-off.gif';
major1_over = new Image();
major1_over.src = '/nav/1-over.gif';
major2_on   = new Image();
major2_on.src   = '/nav/2-on.gif';
major2_off  = new Image();
major2_off.src  = '/nav/2-off.gif';
major2_over = new Image();
major2_over.src = '/nav/2-over.gif';
major3_on   = new Image();
major3_on.src   = '/nav/3-on.gif';
major3_off  = new Image();
major3_off.src  = '/nav/3-off.gif';
major3_over = new Image();
major3_over.src = '/nav/3-over.gif';
major4_on   = new Image();
major4_on.src   = '/nav/4-on.gif';
major4_off  = new Image();
major4_off.src  = '/nav/4-off.gif';
major4_over = new Image();
major4_over.src = '/nav/4-over.gif';
major5_on   = new Image();
major5_on.src   = '/nav/5-on.gif';
major5_off  = new Image();
major5_off.src  = '/nav/5-off.gif';
major5_over = new Image();
major5_over.src = '/nav/5-over.gif';
major6_on   = new Image();
major6_on.src   = '/nav/6-on.gif';
major6_off  = new Image();
major6_off.src  = '/nav/6-off.gif';
major6_over = new Image();
major6_over.src = '/nav/6-over.gif';
major7_on   = new Image();
major7_on.src   = '/nav/7-on.gif';
major7_off  = new Image();
major7_off.src  = '/nav/7-off.gif';
major7_over = new Image();
major7_over.src = '/nav/7-over.gif';
major8_on   = new Image();
major8_on.src   = '/nav/8-on.gif';
major8_off  = new Image();
major8_off.src  = '/nav/8-off.gif';
major8_over = new Image();
major8_over.src = '/nav/8-over.gif';
major28_on   = new Image();
major28_on.src   = '/nav/28-on.gif';
major28_off  = new Image();
major28_off.src  = '/nav/28-off.gif';
major28_over = new Image();
major28_over.src = '/nav/28-over.gif';
major29_on   = new Image();
major29_on.src   = '/nav/29-on.gif';
major29_off  = new Image();
major29_off.src  = '/nav/29-off.gif';
major29_over = new Image();
major29_over.src = '/nav/29-over.gif';
}
// --
/SCRIPT;

$file = preg_replace(#script.*.*?/script#i, !-- RWW: Scripting
killed --, $file);

echo $file;

?


Does nothin. Haven't the foggiest clue as to why, but here's what's really
making me sick. By running it on http://www.theregister.co.uk which is where
I got the code I'm trying to strip down, this is what I do in my code:

?php

$target = 'http://www.theregister.co.uk';
$fp = fopen($target, r);
$file = fread($fp, 1000);

// kill scripting
$file = preg_replace(#script.*.*?/script#i, !-- RWW: Scripting
killed --, $file);

echo $file;

?

When run it misses the first use of SCRIPT that I posted above, but it
catches the second one! And I don't know why! ;(



Plutarck

Rasmus Lerdorf [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  But I use PCRE functions, so I don't want to use ereg in one place and
PCRE
  in another, so I tried:
 
  $file = preg_replace(#script.*.*/script#i, !-- RWW: Scripting
  killed --, $file);

'/script.*.*?\/script/i'

 -Rasmus


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




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




[PHP] Accesing Oracle

2001-05-21 Thread Kike

Hi all,
I've just installed Orcale 8.1.7 in a linux server in my lan. I'm trying to access to 
the server from another computer with apache and i get the next:
Fatal error: Call to undefined function: ora_logon() in 
/usr/local/apache/htdocs.
Where can i find docs to configure boths machines to access to the 
oracle server?
Thanks a lot.


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




RE: [PHP] if $submit

2001-05-21 Thread Sandeep Hundal

i always use such statements like :

if ($submit) { then do this }

else { render the page

}

and it works fine...
-Original Message-
From: Tarrant Costelloe [mailto:[EMAIL PROTECTED]]
Sent: 21 May 2001 15:16
To: Php (E-mail)
Subject: [PHP] if $submit


Whenever I use  the ? if ($submit) ? statement in a php page it always
comes up with:

Warning: Undefined variable
Until the submit has been hit, and then it continue on with the rest of the
script fine ( ifelse).

How do you stop this warning message?

Thanks in advance!

Tarrant Costelloe
Web Developer
InsurE-com Ltd.

Office Tel:  +44 (0)1273 852014
Mobile: +44 07714087114
[EMAIL PROTECTED]
http://www.insur-e.net


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

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




Re: [PHP] if $submit

2001-05-21 Thread Plutarck

error_reporting (E_ALL ^ E_NOTICE);

http://www.php.net/manual/en/function.error-reporting.php

I personally change my php.ini setting to:

error_reporting  =  E_ALL  ~E_NOTICE

Then at the top of my scripts which I want to debug I add the line:

error_reporting(E_ALL);



Plutarck

Tarrant Costelloe [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Whenever I use  the ? if ($submit) ? statement in a php page it always
 comes up with:

 Warning: Undefined variable
 Until the submit has been hit, and then it continue on with the rest of
the
 script fine ( ifelse).

 How do you stop this warning message?

 Thanks in advance!

 Tarrant Costelloe
 Web Developer
 InsurE-com Ltd.
 
 Office Tel:  +44 (0)1273 852014
 Mobile: +44 07714087114
 [EMAIL PROTECTED]
 http://www.insur-e.net


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




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




Re: [PHP] Check multiple cookies

2001-05-21 Thread Plutarck

header(Location: http://www.example.com;);

That redirects the user to the wepage of you're choosing. The rest is just a
matter of checking variables. For instance, you can do this:

if ($var1)
{
$url = 'www.example1.com';
}
elseif ($var2)
{
$url = 'www.example2.com';
}
elseif ($var3)
{
$url = 'www.example3.com';

header(Location: $url);


Obviously there are endless ways to do it, but that's the basic idea.


Plutarck

Sam Gooding [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Is it possible to check multiple cookie values and then redirect to
another
 page depending on what cookie values have been set?  Sort of like:

 if(cookie == 3)
goto(url1)
 elseif(cookie2 = 5)
goto(url2)
 else
goto(url3)

 Thanks in advance!


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




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




RE: [PHP] Accesing Oracle

2001-05-21 Thread Sam Masiello


Sounds like you need to recompile PHP with Oracle support.  Recompile PHP
with the -with-oracle flag when running the configure script to include the
Oracle functions.

HTH

Sam Masiello
Systems Analyst
Chek.Com
(716) 853-1362 x289
[EMAIL PROTECTED]

 -Original Message-
From:   Kike [mailto:[EMAIL PROTECTED]]
Sent:   Monday, May 21, 2001 10:22 AM
To: [EMAIL PROTECTED]
Subject:[PHP] Accesing Oracle

Hi all,
I've just installed Orcale 8.1.7 in a linux server in my lan. I'm trying to
access to
the server from another computer with apache and i get the next:
Fatal error: Call to undefined function: ora_logon() in
/usr/local/apache/htdocs.
Where can i find docs to configure boths machines to access to the
oracle server?
Thanks a lot.


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


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




Re: [PHP] sending attachements with mail

2001-05-21 Thread Tolga \thorr\ Orhon

Yes you can do it, but it takes some time as you need to know MIME
extensions. It took 2 hours to implement just picture attachments. It will
surely be easier to use some kind of script but I couldnt find any that gets
attachments direcly (as I am getting attachments from MySql DB) so I did my
own.

--
Tolga 'thorr' Orhon

Mark Wouters [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Nobody knows if it's possible to send attachements with mail()??

 Thanks,

 --
 Mark Wouters
 eXpanded Media
 Web Designer
 Parijsstraat 74, B-3000 Leuven - Louvain
 Tel: +32 (16) 31.10.12
 Fax: +32 (16) 31.10.19
 E-mail: [EMAIL PROTECTED]
 URL: http://www.expandedmedia.be



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




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




Re: [PHP] Quotes in GET variables

2001-05-21 Thread Plutarck

Basically, use one of the escape functions :)

For instance, looking at this piece of code:

$result = mysql_query(SELECT * FROM table WHERE username='$username' AND
password='$password');

Now, you have the variables $username and $password to worry about. Now we
ask ourselves, what characters are valid entrys here?

If we know that usernames and passwords can't contain spaces, we'll strip
out whitespace. If A-Z, 0-9, and underscores are the only legal characters,
we'll strip out anything that isn't a word character.

Using this kind of what's legal here? questioning is typically the best
way to handle things. It ensures that no illegal entries can be in your code
so that no errors are spit out such as this is not a legal resource
identifier. It also ensures no 'massaged' data can cause an unauthorized
user to see something they shouldn't see.

Then it only comes down to ensuring that legal characters can't be used in
some fashion which is not intended. I tend to limit myself to using only
word characters and whitespace, which seems safe in most cases. If you need
to use some other data, always use one of the PHP escape functions.

The final method to use is to ask yourself, what variables can be passed
via session/cookie/put/get?. All other variables should be explicitly set
to _something_ early in the code before they would normally be used, and in
a way that ensures they are being set to something no matter what flow the
program takes (in other words, don't set them inside a conditional loop).

This is the cause for the majority of security holes. Often a program
evaluates a variable which is conditionally set inside the code without
ensuring that it's clean. For example:

if ($submit)
{
$sql = SELECT * FROM table;
}

// bunch of code here

$result = mysql_query($sql);


If the user can massage the transaction so that $submit will evaluate to
false (such as appending ?submit= onto the end of you're page's URL), they
are now able to query your database with absolutely any query they like.
SELECT, UPDATE, or DROP, it's their choice. To be safe you need only insert
one line before the loop:

$sql = ;

So when using a variable which shouldn't be submitted from an outside
source, be sure that it's explicitly set to something before any evaluation
of that variable is done.


And that's about all I can think of. Still, it's best just to leave the
function on as an extra bit of security. You can never be too safe.


Plutarck

Boget, Chris [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Anyway, it's not a big thing if you're _really_ stringent about how you
  check every single variable which is used in a database query,
  system/passthru/exec, or eval command, and your checking methods are
  flawless, but otherwise it's just best to go to the trouble of hacking
  around the input explicitly.

 What would you do to go about doing this?  How can you be
 _really stringent_ in checking your variables?  Check that they
 have a value?

 Chris




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




Re: [PHP] if $submit

2001-05-21 Thread Plutarck

For the sake of completeness, whenever PHP encounters a reference to a
variable which has not been set it will throw a warning.

The reason most people don't see that behavior is that their version of PHP
uses the default setting of show all errors but don't mention the
warnings. If they use:

error_reporting(E_ALL);

...they'll probably see a whole bunch of ugly little warnings. Useful for
debugging, annoying as all heck for production code.


Plutarck

Tarrant Costelloe [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Whenever I use  the ? if ($submit) ? statement in a php page it always
 comes up with:

 Warning: Undefined variable
 Until the submit has been hit, and then it continue on with the rest of
the
 script fine ( ifelse).

 How do you stop this warning message?

 Thanks in advance!

 Tarrant Costelloe
 Web Developer
 InsurE-com Ltd.
 
 Office Tel:  +44 (0)1273 852014
 Mobile: +44 07714087114
 [EMAIL PROTECTED]
 http://www.insur-e.net


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




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




Re: [PHP] Max execution time exceeded in Unknown on line 0

2001-05-21 Thread Tolga \thorr\ Orhon

I had a smilar problem. My system was working just fine with php 4.0.4pl1,
apache 1.3.14 and mysql 3.23.33. Then I upgraded system to php 4.0.5 with
curl and dom-xml support, and other components are same, I am getting the
same error. Besides each apache process eats all cpu avaliable. Other than
that everything works just fine, eg I am getting pages correctly, can reach
database etc. Whenever I have time, I will try to isolate the problem.

I have only one question, is your server a multiprocessor system? I got some
information about problems in apache + php on SMP systems on some versions.

It is just like solving puzzle in Batman. Which products will kill you when
combined :)) If you find something, let me know too.

--
Tolga 'thorr' Orhon

David De Graff [EMAIL PROTECTED] wrote in message
003401c0e103$3f4a7690$[EMAIL PROTECTED]">news:003401c0e103$3f4a7690$[EMAIL PROTECTED]...
 Hi,

 I've had php (4.0.5) working fine with postgres and w-agora (forum
 software),  but am now having trouble after trying installs of php-nuke
and
 phpWebSite. These use mysql, which has also been freshly installed.

 After a reboot the ? phpinfo(); ? tag executes immediately, but after
 trying to execute a php script from one of the new web apps all php
scripts
 perform very slowly and the results include the following error at the
 bottom of the page:

 Fatal error: Maximum execution time of 30 seconds exceeded in Unknown on
 line 0

 This happens even for a test page with nothing but the ? phpinfo(); ?
 tag.

 It does seem like php is connecting to mysql, since the results that are
 eventually returned include database-depended content. For phpinfo() most
 results are returned immediately but the page hangs after the php
variables
 heading, and results for this page are not returned until the 30 second
time
 limit is apparently reached. Then those results are displayed, followed by
 the error described above.

 Other pages, say the admin.php page for phpWebSite, don't return anything
 until the time limit expires. Then what seems to be the entire page is
 displayed, followed by the same error line.

 Any help would be much appreciated. I've been beating my head against this
 for quite a while.

 Thanks,

 Dave De Graff


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




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




[PHP] PHP 2 of 5 code bars

2001-05-21 Thread Anderson Moreira

Hi,

That's for those who needs to generate 2 of 5 code bars.

See you

Anderson J. Moreira

-- 
Visite:  http://www.ambientebrasil.com.br
E-mail: [EMAIL PROTECTED]
Fone:  0xx 41 222-6345
 i25.tgz

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


[PHP] Intranet links

2001-05-21 Thread kaab kaoutar

Hi

do u have any interesting links about careting an intranet?

Thanks
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




Re: [PHP] Accesing Oracle

2001-05-21 Thread Brian S. Dunworth


At 03:21 PM 5/21/01 +0100, Kike wrote:
Hi all,
I've just installed Orcale 8.1.7 in a linux server in my lan. I'm trying 
to access to
the server from another computer with apache and i get the next:
Fatal error: Call to undefined function: ora_logon() in
/usr/local/apache/htdocs.
Where can i find docs to configure boths machines to access to the
oracle server?

   First, if you're trying to access an Oracle 8i database, you'll want 
OCILogon() not ora_logon() --  ora_* functions are for Oracle 7.x 
databases, OCI* functions are for Oracle 8.x databases...

   The first thing you need to do is install the Oracle Net8 Client on your 
apache webserver machine and configure it so that you can connect to the 
Oracle 8.1.7 server.

   Be sure to set ORACLE_SID, NLS_LANG, and ORACLE_HOME in your default 
environment (or, specifically in the environment for your apache user) so 
that the Net8 client software can connect to the database when executed as 
the 'nobody' user...

   Next, compile PHP again, including the OCI8 functions, and restart apache.


  -
Brian S. Dunworth
Sr. Software Development Engineer
Oracle Database Administrator
The Printing House, Ltd.

(850) 875-1500  x225
[EMAIL PROTECTED]
  -


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




Re: [PHP] Multiple emails

2001-05-21 Thread Plutarck

The general concencus is that when you have to send one email to a whole
lotta people, it's best to use a mail list handler like egroups, listgroup,
major domo, etc. It's just more reliable and you can spend time on
developing your code, not your emailing system.

I never do that, but I figure I should reccommend it anyway ;)

Now, if you're using Bcc or multiple functions the only spam blocker is from
your system's sendmail. Some people set sendmail so that if a single user is
sending a very large number of emails, some of the emails might get trashed
because the system thinks the person is a spammer. This only happens with
some webhosts and most of them don't do it, and not much you can do if they
do it other than leave or use a mail list service, so there you have it.

If I were you I'd stick about 40-50 addresses into Bcc, send it to mail,
then get the next load of address and send them to mail, lather, rinse, and
repeat till finished. Less of a chance for sendmail to eat an email and
suddenly your whole list misses the email.

The ideal way is to give the email and the addresses to some other program
which will pass them to sendmail one at a time, waiting for each one to
finish before sending another, but not holding up your PHP program and
logging any errors to a log file. If I knew more about how sendmail worked
I'd write something like that in java :)


Plutarck

Tom Carter [EMAIL PROTECTED] wrote in message
000f01c0e120$0616e260$0a00a8c0@bjorn">news:000f01c0e120$0616e260$0a00a8c0@bjorn...
 Hi all,

 I have a list of email addresses pulled from a database and I want to send
 out an email to all of them  (they are the registered users of this
 particular site). For the first issue of the newsletter I expect to have
 about 4000 people, but that will probably go up significantly in future
 issues.

 I can do the sending email normally and extraction of addresses, but my
 question was really a more general one.
 Is there anything I should be doing different when sending to so many?
 Is it better to send a load of addresses altogether (in bcc for example)
for
 each mail call? how many?
 or is it better to use a mail call for each address? I did a few quick
speed
 test and mail seemed to be very fast. I guess this way would have the
 advantage of being able to personallise for each person.
 And is there a possibility that my mails would be blocked my some kind of
 spam filtering system? Its not I might add!

 Any advice and past experience would be very welcome.

 BTW, my system is apache on linux, php 4.0.4pl1 running on a cobalt raq.

 Thanks in advance

 Tom Carter
 Web Architect
 roundcorners ltd.



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




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




Re: [PHP] Max execution time exceeded in Unknown on line 0

2001-05-21 Thread David De Graff

Tolga,

Thanks for the reply.

I'm running the Zeus web server on Solaris 2.6 on a dual-cpu Sun Ultra 2.
One or two php processes do spike to large loads when this happens, though
not all of the cpu - something like 25-40% for quite a while, then the load
fades.

Will let you know if I fina anything else.

Best,

Dave De Graff

- Original Message -
From: Tolga thorr Orhon [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, May 21, 2001 7:58 AM
Subject: Re: [PHP] Max execution time exceeded in Unknown on line 0


 I had a smilar problem. My system was working just fine with php 4.0.4pl1,
 apache 1.3.14 and mysql 3.23.33. Then I upgraded system to php 4.0.5 with
 curl and dom-xml support, and other components are same, I am getting the
 same error. Besides each apache process eats all cpu avaliable. Other than
 that everything works just fine, eg I am getting pages correctly, can
reach
 database etc. Whenever I have time, I will try to isolate the problem.

 I have only one question, is your server a multiprocessor system? I got
some
 information about problems in apache + php on SMP systems on some
versions.

 It is just like solving puzzle in Batman. Which products will kill you
when
 combined :)) If you find something, let me know too.

 --
 Tolga 'thorr' Orhon

 David De Graff [EMAIL PROTECTED] wrote in message
 003401c0e103$3f4a7690$[EMAIL PROTECTED]">news:003401c0e103$3f4a7690$[EMAIL PROTECTED]...
  Hi,
 
  I've had php (4.0.5) working fine with postgres and w-agora (forum
  software),  but am now having trouble after trying installs of php-nuke
 and
  phpWebSite. These use mysql, which has also been freshly installed.
 
  After a reboot the ? phpinfo(); ? tag executes immediately, but after
  trying to execute a php script from one of the new web apps all php
 scripts
  perform very slowly and the results include the following error at the
  bottom of the page:
 
  Fatal error: Maximum execution time of 30 seconds exceeded in Unknown on
  line 0
 
  This happens even for a test page with nothing but the ? phpinfo(); ?
  tag.
 
  It does seem like php is connecting to mysql, since the results that are
  eventually returned include database-depended content. For phpinfo()
most
  results are returned immediately but the page hangs after the php
 variables
  heading, and results for this page are not returned until the 30 second
 time
  limit is apparently reached. Then those results are displayed, followed
by
  the error described above.
 
  Other pages, say the admin.php page for phpWebSite, don't return
anything
  until the time limit expires. Then what seems to be the entire page is
  displayed, followed by the same error line.
 
  Any help would be much appreciated. I've been beating my head against
this
  for quite a while.
 
  Thanks,
 
  Dave De Graff
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



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



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




Re: [PHP] Intranet links

2001-05-21 Thread Plutarck

Do you mean creating as in physically plugging wires into network cards in
computers to create one, or programming software that's designed for use
over the intranet, socket programming on an intranet, or something else?

Creating an intranet is too broad of a subject to give you a very good
answer.


Plutarck

kaab kaoutar [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi

 do u have any interesting links about careting an intranet?

 Thanks
 _
 Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




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




Re: [PHP] function to complete strings with white spaces on the left

2001-05-21 Thread Markus Fischer

On Mon, May 21, 2001 at 10:04:21AM -0500, Tolga thorr Orhon wrote : 
 One improvment:
 
 $strpad = HELLO;
 echo str_pad(substr($strpad,0,17),17);

why ?

- Markus

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




Re: [PHP] Intranet links

2001-05-21 Thread kaab kaoutar


I meant soft side!

From: Plutarck [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Intranet links
Date: Mon, 21 May 2001 10:13:44 -0500

Do you mean creating as in physically plugging wires into network cards 
in
computers to create one, or programming software that's designed for use
over the intranet, socket programming on an intranet, or something else?

Creating an intranet is too broad of a subject to give you a very good
answer.


Plutarck

kaab kaoutar [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi
 
  do u have any interesting links about careting an intranet?
 
  Thanks
  
_
  Get Your Private, Free E-mail from MSN Hotmail at 
http://www.hotmail.com.
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



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


_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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




[PHP] Syntax for CURL

2001-05-21 Thread Todd Cary

I need to send a POST string to a HTTPS server and receive the returned
string.  Does anyone know the correct syntax for this?  I have looked at
the HELP a www.php.net; however, I am not completely clear on what I
need to put into the curl_setopt().

Todd

--
Todd Cary
Ariste Software
[EMAIL PROTECTED]



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




Re: [PHP] ?=SID? is not translated...

2001-05-21 Thread Markus Fischer

Hallo Chris,

On Mon, May 21, 2001 at 04:08:52AM +0200, Christian Marschalek wrote : 
 My system does not tranlate ?=SID? into the PHP Session id... Don't
 have a clue why, though...

SID gets only defined if the appropriate cookie is NOT set (which
makes sense: you don't need to populate it anywhere in your code
if the right cookie is set).

If you just want the session ID use 'session_id()'.

- Markus

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




Re: [PHP] Max execution time exceeded in Unknown on line 0

2001-05-21 Thread David De Graff

I think it's related to include files, maybe combined with an MP issue.

I wrote a simple db access test file which ran fine, then pasted include
statements in from the files that were having problems. The problems then
occurred when running the simple script. Not sure if there's something wrong
with my paths (include_path = .:/usr/local/lib/). That path seems OK to me,
particularly given that the files being included are in the working
directory or are included with relative paths from there.

Thx,

Dave

- Original Message -
From: Tolga  thorr Orhon [EMAIL PROTECTED]
To: David De Graff [EMAIL PROTECTED]
Sent: Monday, May 21, 2001 8:11 AM
Subject: Re: [PHP] Max execution time exceeded in Unknown on line 0


 It seems to me its like multiprocessor problem with php. There are some
bug
 reports on php.net. Symptoms are much similar. If I found something, I
will
 let u know too..

 Yours,

 Tolga 'thorr' Orhon
 Network Security Administrator
 Asena Corporation

 - Original Message -
 From: David De Graff [EMAIL PROTECTED]
 To: Tolga thorr Orhon [EMAIL PROTECTED]
 Cc: php-general list [EMAIL PROTECTED]
 Sent: Monday, May 21, 2001 10:06 AM
 Subject: Re: [PHP] Max execution time exceeded in Unknown on line 0


  Tolga,
 
  Thanks for the reply.
 
  I'm running the Zeus web server on Solaris 2.6 on a dual-cpu Sun Ultra
2.
  One or two php processes do spike to large loads when this happens,
though
  not all of the cpu - something like 25-40% for quite a while, then the
 load
  fades.
 
  Will let you know if I fina anything else.
 
  Best,
 
  Dave De Graff
 
  - Original Message -
  From: Tolga thorr Orhon [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, May 21, 2001 7:58 AM
  Subject: Re: [PHP] Max execution time exceeded in Unknown on line 0
 
 
   I had a smilar problem. My system was working just fine with php
 4.0.4pl1,
   apache 1.3.14 and mysql 3.23.33. Then I upgraded system to php 4.0.5
 with
   curl and dom-xml support, and other components are same, I am getting
 the
   same error. Besides each apache process eats all cpu avaliable. Other
 than
   that everything works just fine, eg I am getting pages correctly, can
  reach
   database etc. Whenever I have time, I will try to isolate the problem.
  
   I have only one question, is your server a multiprocessor system? I
got
  some
   information about problems in apache + php on SMP systems on some
  versions.
  
   It is just like solving puzzle in Batman. Which products will kill you
  when
   combined :)) If you find something, let me know too.
  
   --
   Tolga 'thorr' Orhon
  
   David De Graff [EMAIL PROTECTED] wrote in message
   003401c0e103$3f4a7690$[EMAIL PROTECTED]">news:003401c0e103$3f4a7690$[EMAIL PROTECTED]...
Hi,
   
I've had php (4.0.5) working fine with postgres and w-agora (forum
software),  but am now having trouble after trying installs of
 php-nuke
   and
phpWebSite. These use mysql, which has also been freshly installed.
   
After a reboot the ? phpinfo(); ? tag executes immediately, but
 after
trying to execute a php script from one of the new web apps all php
   scripts
perform very slowly and the results include the following error at
the
bottom of the page:
   
Fatal error: Maximum execution time of 30 seconds exceeded in
Unknown
 on
line 0
   
This happens even for a test page with nothing but the ? phpinfo();
 ?
tag.
   
It does seem like php is connecting to mysql, since the results that
 are
eventually returned include database-depended content. For phpinfo()
  most
results are returned immediately but the page hangs after the php
   variables
heading, and results for this page are not returned until the 30
 second
   time
limit is apparently reached. Then those results are displayed,
 followed
  by
the error described above.
   
Other pages, say the admin.php page for phpWebSite, don't return
  anything
until the time limit expires. Then what seems to be the entire page
is
displayed, followed by the same error line.
   
Any help would be much appreciated. I've been beating my head
against
  this
for quite a while.
   
Thanks,
   
Dave De Graff
   
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
   
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail:
[EMAIL PROTECTED]
  
 



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




Re: [PHP] if $submit

2001-05-21 Thread Markus Fischer

On Mon, May 21, 2001 at 03:15:37PM +0100, Tarrant Costelloe wrote : 
 Whenever I use  the ? if ($submit) ? statement in a php page it always
 comes up with:
 
 Warning: Undefined variable
 Until the submit has been hit, and then it continue on with the rest of the
 script fine ( ifelse).
 
 How do you stop this warning message?

1) set new error level: error_reporting( E_ALL ^ E_NOTICE);

2) use isset()

if( isset( $submit)) { ...

3) or use @ in front of the variable

if( @$submit) { ...

- Markus

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




Re: [PHP] Accesing Oracle

2001-05-21 Thread Markus Fischer

On Mon, May 21, 2001 at 03:21:30PM +0100, Kike wrote : 
 Hi all,
 I've just installed Orcale 8.1.7 in a linux server in my lan. I'm trying to access 
to 
 the server from another computer with apache and i get the next:
 Fatal error: Call to undefined function: ora_logon() in 
 /usr/local/apache/htdocs.
 Where can i find docs to configure boths machines to access to the 
 oracle server?
 Thanks a lot.

Additionally to the other posts, make sure PHP _AND_ APACHE is at
least linked against libpthread.so:

LDFLAGS=-lpthread ./configure 

This is for both php and apache

- Markus

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




Re: [PHP] query question

2001-05-21 Thread Markus Fischer

On Mon, May 21, 2001 at 10:36:42AM -0500, Jacky wrote : 
 What do I do if i want to move all values stored in one field
 to another field in the same table, from field A to field B?
 Has anyone ever done that? 

As simple as you think it should be

UPDATE table SET column_a = column_b

- Markus

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




Re: [PHP] Check multiple cookies

2001-05-21 Thread Sam Gooding


At 09:31 AM 5/21/01 -0500, you wrote:
header(Location: http://www.example.com;);

That redirects the user to the wepage of you're choosing. The rest is just a
matter of checking variables. For instance, you can do this:

if ($var1)
{
$url = 'www.example1.com';
}
elseif ($var2)
{
$url = 'www.example2.com';
}
elseif ($var3)
{
$url = 'www.example3.com';

header(Location: $url);


Obviously there are endless ways to do it, but that's the basic idea.

The following is exactly what I typed in (just copy and pasted) but I'm 
still getting the error:

Cannot add header information - headers already sent by (output started at 
web.php:2) in
web.php on line 19

?
if ($var1)
{
$url = 'www.example1.com';
}
elseif ($var2)
{
$url = 'www.example2.com';
}
elseif ($var3)
{
$url = 'www.example3.com';
}
else
{
$url = 'www.example4.com';
}

header(Location: $url);


?

Sam Gooding [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Is it possible to check multiple cookie values and then redirect to
another
  page depending on what cookie values have been set?  Sort of like:
 
  if(cookie == 3)
 goto(url1)
  elseif(cookie2 = 5)
 goto(url2)
  else
 goto(url3)
 
  Thanks in advance!
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



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


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




Re: [PHP] Check multiple cookies

2001-05-21 Thread James Holloway

Hi Sam,


 The following is exactly what I typed in (just copy and pasted) but I'm
 still getting the error:

 Cannot add header information - headers already sent by (output started at
 web.php:2) in
 web.php on line 19

Make sure that all output for Cookies and header information is sent before
any HTML, and that there is no whitespace before the initial ? tag - that's
probably the source of the problem.

Have a search for Output buffering on the PHP main site.

James.



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




Re: [PHP] security

2001-05-21 Thread Brave Cobra

With the Safe Mode on, no files outside the document root(defined in the
php.ini) are being handled.

- Original Message -
From: Ker Ruben Ramos [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 22, 2001 2:01 AM
Subject: [PHP] security


ey guys,

  what are the functions that's disabled if safe_mode is On?
also, what I just did now is disabling the functions exec() and system()
just to prevent shell commands.
but, how do i disable something like `ls -l /` ? the backticks.

Thanks guys



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




Re: [PHP] What's wrong with this code?

2001-05-21 Thread Christian Reiniger

On Monday 21 May 2001 16:23, Plutarck wrote:

 Since there is a / in the code itself, I use # as a delimiter
 instead so I don't have to escape it, making it harder to read.

 So here's the code:

 $file = preg_replace(#script.*.*/script#Ui, !-- RWW: Scripting
 killed --, $file);

Stupid error (noticed this after trying for ~10 minutes...):
Add the s modifier. Otherwise . doesn't match newlines.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Error 032: Recursion error - see error 032

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




Re: [PHP] sending attachements with mail

2001-05-21 Thread py

Here is a nice class that handles e-mail attachment.
Works fine for me.
py

// ==
// start code
// ==
?php

/* notes from Dan Potter:
Sure. I changed a few other things in here too though. One is that I let
you specify what the destination filename is (i.e., what is shows up as in
the attachment). This is useful since in a web submission you often can't
tell what the filename was supposed to be from the submission itself. I
also added my own version of chunk_split because our production version of
PHP doesn't have it. You can change that back or whatever though =).
Finally, I added an extra \n before the message text gets added into the
MIME output because otherwise the message text wasn't showing up.

/*
note: someone mentioned a command-line utility called 'mutt' that
can mail attachments.
*/

/*
If chunk_split works on your system, change the call to my_chunk_split
to chunk_split
*/

/* Note: if you don't have base64_encode on your sytem it will not work */

// =
// simple class that encapsulates mail() with addition of mime file
// attachment.
// =
class CMailFile {
var $subject;
var $addr_to;
var $text_body;
var $text_encoded;
var $mime_headers;
var $mime_boundary = --==_846811060==_;
var $smtp_headers;

function CMailFile($subject,$to,$from,$msg,$filename,$mimetype =
application/octet-stream, $mime_filename = false) {
 $this-subject = $subject;
 $this-addr_to = $to;
 $this-smtp_headers = $this-write_smtpheaders($from);
 $this-text_body = $this-write_body($msg);
 $this-text_encoded =
$this-attach_file($filename,$mimetype,$mime_filename);
 $this-mime_headers = $this-write_mimeheaders($filename, $mime_filename);
}

function attach_file($filename,$mimetype,$mime_filename) {
 $encoded = $this-encode_file($filename);
 if ($mime_filename) $filename = $mime_filename;
 $out = -- . $this-mime_boundary . \n;
 $out = $out . Content-type:  . $mimetype . ; name=\$filename\;\n;
 $out = $out . Content-Transfer-Encoding: base64\n;
 $out = $out . Content-disposition: attachment;
filename=\$filename\\n\n;
 $out = $out . $encoded . \n;
 $out = $out . -- . $this-mime_boundary . -- . \n;
 return $out;
 // added -- to notify email client attachment is done
}

function encode_file($sourcefile) {
 if (is_readable($sourcefile)) {
  $fd = fopen($sourcefile, r);
  $contents = fread($fd, filesize($sourcefile));
  $encoded = chunk_split(base64_encode($contents));
  fclose($fd);
 }
 return $encoded;
}

function sendfile() {
 $headers = $this-smtp_headers . $this-mime_headers;
 $message = $this-text_body . $this-text_encoded;
 mail($this-addr_to,$this-subject,$message,$headers);
}

function write_body($msgtext) {
 $out = -- . $this-mime_boundary . \n;
 $out = $out . Content-Type: text/plain; charset=\us-ascii\\n\n;
 $out = $out . $msgtext . \n;
 return $out;
}

function write_mimeheaders($filename, $mime_filename) {
 if ($mime_filename) $filename = $mime_filename;
 $out = MIME-version: 1.0\n;
 $out = $out . Content-type: multipart/mixed; ;
 $out = $out . boundary=\$this-mime_boundary\\n;
 $out = $out . Content-transfer-encoding: 7BIT\n;
 $out = $out . X-attachments: $filename;\n\n;
 return $out;
}

function write_smtpheaders($addr_from) {
 $out = From: $addr_from\n;
 $out = $out . Reply-To: $addr_from\n;
 $out = $out . X-Mailer: PHP3\n;
 $out = $out . X-Sender: $addr_from\n;
 return $out;
}
}

// usage - mimetype example image/gif
// $mailfile = new
CMailFile($subject,$sendto,$replyto,$message,$filename,$mimetype);
// $mailfile-sendfile();

// Splits a string by RFC2045 semantics (76 chars per line, end with \r\n).
// This is not in all PHP versions so I define one here manuall.
function my_chunk_split($str){
 $stmp = $str;
 $len = strlen($stmp);
 $out = ;
 while ($len  0) {
  if ($len = 76) {
   $out = $out . substr($stmp, 0, 76) . \r\n;
   $stmp = substr($stmp, 76);
   $len = $len - 76;
  }
  else {
   $out = $out . $stmp . \r\n;
   $stmp = ; $len = 0;
  }
 }
 return $out;
} // end script
?
// ==
// end code
// ==
- Original Message -
From: Tolga thorr Orhon [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, May 21, 2001 3:47 PM
Subject: Re: [PHP] sending attachements with mail


 Yes you can do it, but it takes some time as you need to know MIME
 extensions. It took 2 hours to implement just picture attachments. It will
 surely be easier to use some kind of script but I couldnt find any that
gets
 attachments direcly (as I am getting attachments from MySql DB) so I did
my
 own.

 --
 Tolga 'thorr' Orhon

 Mark Wouters [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Nobody knows if it's possible to send attachements with mail()??
 
  Thanks,
 
  --
  Mark Wouters
  eXpanded Media
  Web Designer
  Parijsstraat 74, B-3000 Leuven - Louvain
  Tel: +32 (16) 31.10.12
  Fax: +32 (16) 31.10.19
  E-mail: [EMAIL 

Re: [PHP] Syntax for CURL

2001-05-21 Thread Tolga \thorr\ Orhon

The script below is working fine for me:

$data2send = field1=value1field2=value2;

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,https://www.postside.com/postpage;);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt ($ch, CURLOPT_USERAGENT, Mozilla/4.0 (compatible; MSIE 5.01;
Windows NT 5.0));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, https://www.yoursite.com/;);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data2send);
$result=curl_exec ($ch);
curl_close ($ch);

You can find meanings of options at:
http://www.php.net/manual/en/function.curl-setopt.php

Some guidelines for options:
USERAGENT is sometimes necessary on some sites as they do not let you
connect if your browser is not known.
FOLLOWLOCATION is necessary for following redirects on posting page.

You can find others easily.

Yours,

--
Tolga 'thorr' Orhon

Todd Cary [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I need to send a POST string to a HTTPS server and receive the returned
 string.  Does anyone know the correct syntax for this?  I have looked at
 the HELP a www.php.net; however, I am not completely clear on what I
 need to put into the curl_setopt().

 Todd

 --
 Todd Cary
 Ariste Software
 [EMAIL PROTECTED]



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




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




[PHP] wrapping text on a page display.

2001-05-21 Thread Floyd Baker



Hello..  Sorry, I know this is a constant problem.., at least for me.

Now I am using 'text' to store big inputs.  It does not wrap on the
screen display...   

I have it working on my machine with wordwrap with php4.
The isp does not have php4 yet, and it doesn't work with I upload.

What is the php3 alternative please?

The ascii between the ;'s is exactly this... One long line.

;I\'ll add details later.  Now is the time for all good men to come to
the aid of their country...  The quick brown fox jumped over the lazy
dogs back 12345 times...  Of all the fishes in the sea, the mermaid is
still the only one for me;


I am using include() on a net fusion .php3 page to pull the php script
to pull and print the text field.

Thanks. 

Floyd

--


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




[PHP] best way to flush stdout?

2001-05-21 Thread Phil Glatz

I have a page that displays a few lines, then runs a database query that 
takes five or six seconds. I'd like to flush stdout and display the first 
text while the query is running, so the user doesn't think the site is 
down.  What's the best way to accomplish this?  thanks


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




Re: [PHP] Quotes in GET variables

2001-05-21 Thread Mark Rogers

 Anyway, it's not a big thing if you're _really_ stringent about how you
 check every single variable which is used in a database query,
 system/passthru/exec, or eval command, and your checking methods are
 flawless, but otherwise it's just best to go to the trouble of hacking
 around the input explicitly.

Obviously my code is perfect, so I don't need to worry - but I'll leave it
set as default anyway :-)

One thing I do avoid is using register_globals, which removes some of the
threats suggested elsewhere in this thread. I do validate user input fairly
thoroughly, but it's always better to be safe. The reason I asked the
question was because I wasn't sure the behavior I was seeing was correct,
and didn't want to fix loads of code that I'd have to un-fix later on. Now I
know what's going on I'll go ahead with the fixes. Saves me remembering to
change PHP.INI on other machines, if nothing else.

Thanks for the help.
--
Mark Rogers




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




Re: [PHP] Re: [PHP-DEV] Fork() in php?

2001-05-21 Thread Zeev Suraski

At 08:24 21/5/2001, Rasmus Lerdorf wrote:
You are assuming they even read this mailing list.

*ping* (in Tokyo, so it took me a while to catch up on my Email)

Zeev


--
Zeev Suraski [EMAIL PROTECTED]
CTO   co-founder, Zend Technologies Ltd. http://www.zend.com/


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




Re: [PHP] best way to flush stdout?

2001-05-21 Thread Tolga \thorr\ Orhon

I am not sure that it is the best way to do it but here is my solution:
I redirect the page with:

header(Location: page1.php);

to page1.php which contains a message about the process in progress then
after a few moments redirecting to page2.php with javascript:

script
setTimeout(redirect(), 500)
function redirect()
{
  window.location = page2.php
}
/script

In this case it redirects in 500msecs, ie half second. Then page2.php done
the real job which is MySql query but does not display results or send
anything to browser untill query completed. In that case the previous output
stays on screen until the query completed.

I know that it is not a efficient method but a solution. If anyone knows how
to refresh a browser at anytime I will glad to know. And if someone knows if
there is a way to refresh only one part of browser (I mean just inside a
layer or so..) I really want to know. In that case one can show results as
they come from database. It is really good if you have a huge database and
searching on multiple tables and/or databases.

yours,
--
Tolga 'thorr' Orhon

Phil Glatz [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have a page that displays a few lines, then runs a database query that
 takes five or six seconds. I'd like to flush stdout and display the first
 text while the query is running, so the user doesn't think the site is
 down.  What's the best way to accomplish this?  thanks


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




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




[PHP] Job listings DB

2001-05-21 Thread Vikram Vaswani

Hi,

I am designing a system for my company to get employee resumes via the Web,
rather than paper. All resumes now go into a mySQL DB, which can be
searched by HR (at least that's the theory :) 

Here are the scripts I will be writing.

User pages

Listings
Descriptions
Application form

Admin pages
---
Add listing
Edit listing
Delete listing
Search for matches

---

Now, job description consists of:

job code
department
desig
location
desc
qualification
contact
posted on
salary range (?)

Application form consists of:

personal information:
job code and name
first name
last name
age 
sex 
addr 1
addr 2
city
state
zip
country
email
web site
primary phone
country code
city code
local area
type - home/work/cell
sec. phone
SAA
willing to relocate??

employment history (last 3 jobs)
start
end
employer
job title
field of work
responsibilities
is current employer?

skills
skill name
years of experience

references
contact person
phone
email

additional info
free-form field

salary
current monetary range
current non-monetary benefits
expected

type of employment
trainee
freelance
full-time

would you like your resume to be shared with other departments?

My questions:

For job listings - how do I design the tables? Can I dump all job listings
into a single table, and all applications/resumes into another one? Or
should they be normalized?

If normalized - how much? For example, in a listing, I have job code,
department, location, salary range, etc. - should I have separate tables
for each of these? Like

jcode   deptloc
1   213 2
2   77  3

where dept and loc are FKs to other tables? Or is this taking it too far? 

Same for application form. All this information that I am getting - should
I put into a single table, or split across separate tables? I do plan to
search by differenet criteria later.

What about items in drop-downs? For example, if I have a drop-down for
salary ranges or countries - should this information come from a table, or
should I hard-code into the form itself? How do I make the decision as to
which is appropriate?

Any assistance much appreciated. TIA,

Vikram
--
Give a homeless man a bundle of firewood, and he'll be warm for one day.
Douse him with a gallon of gasoline and set him on fire, and he'll be warm
for the rest of his life!

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




[PHP] fread via ftp to NT fails

2001-05-21 Thread Mark Heintz PHP Mailing Lists


I'm attempting to read a file from a remote server and save it to a
variable.  The code below works fine if the remote server is unix based,
but fails with the server I actually need to retrieve data from (NT4 SP4,
beyond my control).  When trying to fread from the NT server,
$invoice_contents ends up being null ($invoice_contents === '').

if( !($fd = fopen(anonymous:[EMAIL PROTECTED]/pub/readme.txt, rb))){
  $error = true;
  $error_msg = Unable to connect to server.;
}
else {
  $i = 0;
  do {
$invoice_contents = fread($fd, 10);
$i++;
  } while( $invoice_contents ==   $i  2 );
  fclose($fd);
}

Here's the interesting part:  If I comment out the fread and run this
code, there is no visable difference in the ftp logs on the NT server (a
USER, PASS, and sent path/file appear for the connection).  Am I
correct in interpreting this as the file is being sent immediately (after 
the fopen) rather than at the fread?  Has anybody else encountered this? 

Thanks,
mth


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




Re: [PHP] best way to flush stdout?

2001-05-21 Thread Markus Fischer

On Mon, May 21, 2001 at 10:03:33AM -0700, Phil Glatz wrote : 
 I have a page that displays a few lines, then runs a database query that 
 takes five or six seconds. I'd like to flush stdout and display the first 
 text while the query is running, so the user doesn't think the site is 
 down.  What's the best way to accomplish this?  thanks

Make sure output is not buffered via ob_* functions and just call
'flush()'.

But note there's no real world fix because browsers can refuse to
display immdiatly (depending on its rendering engine, etc) and
apache can cache the output, too.

- Markus

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




Re: [PHP] Job listings DB

2001-05-21 Thread py

 Hi,

 I am designing a system for my company to get employee resumes via the
Web,
 rather than paper. All resumes now go into a mySQL DB, which can be
 searched by HR (at least that's the theory :)

[I would do it like that also]


 My questions:

 For job listings - how do I design the tables? Can I dump all job listings
 into a single table, and all applications/resumes into another one? Or
 should they be normalized?

[They should be normalized]

 If normalized - how much? For example, in a listing, I have job code,
 department, location, salary range, etc. - should I have separate tables
 for each of these? Like

[Yes, I would say so]

 jcode dept loc
 1 213 2
 2 77 3

 where dept and loc are FKs to other tables? Or is this taking it too far?

[It is not a necessity, but it would be easier to modify or upgrade later,
wich we always do]

 Same for application form. All this information that I am getting - should
 I put into a single table, or split across separate tables? I do plan to
 search by differenet criteria later.

 What about items in drop-downs? For example, if I have a drop-down for
 salary ranges or countries - should this information come from a table, or
 should I hard-code into the form itself? How do I make the decision as to
 which is appropriate?

[I would never hard code anything that can change, salary ranges can
changes, country can change too :) ]
[Besides, in what I call Code Table like country I would have 3 fields:
country_id, country_name, country_zorder,  you increment country_zorder by 5
The reason: You can later order by country table by name, by id or by a
specific
order that you defined (putting more popular country on top)]

 Any assistance much appreciated. TIA,

 Vikram
 --
 Give a homeless man a bundle of firewood, and he'll be warm for one day.
 Douse him with a gallon of gasoline and set him on fire, and he'll be warm
 for the rest of his life!

[ouch!]




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




Re: [PHP] security

2001-05-21 Thread Jack Sasportas

I realize this is old, but I was just reading through it and noticed there were
not many suggestions.
My idea would be to have a directory which is in a non-publically viewable
place that you can refer to in an include, like
include /home/nobodyseesthisfolder/secret file
It should bomb when it can't find the file.
Now that's not the only thing you can do, because anybody with total server
access to their own box can put that file in place, and possibly work around
the issue.
So I suggest putting some of your core functions in a file in the same folder,
that way the program really can't run without that file.

Good Luck


Randy Johnson wrote:

 In PHP how do I make it so a script cannot be called from somewhere else
 other than from my server.

 Example

 http://domain.com/mail.php   is my mail script that is called by
 http://domain.com/signup.html

 How do I make it so

 http://somebodyelsesdomain.com/signup.html cannot call the mail.php script.

 thanks

 Randy

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

--
___
Jack Sasportas
Innovative Internet Solutions
Phone 305.665.2500
Fax 305.665.2551
www.innovativeinternet.com
www.web56.net



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




Re: [PHP] Job listings DB

2001-05-21 Thread Mark Maggelet

On Mon, 21 May 2001 13:55:12 +0100, py ([EMAIL PROTECTED]) wrote:
 Hi,

 I am designing a system for my company to get employee resumes via
the
Web,
 rather than paper. All resumes now go into a mySQL DB, which can
be
 searched by HR (at least that's the theory :)

[I would do it like that also]


 My questions:

 For job listings - how do I design the tables? Can I dump all job
listings
 into a single table, and all applications/resumes into another
one? Or
 should they be normalized?

[They should be normalized]

only if it makes life easier. I hardly ever do it that way because it
takes longer and doesn't usually speed things up any.

 If normalized - how much? For example, in a listing, I have job
code,
 department, location, salary range, etc. - should I have separate
tables
 for each of these? Like

[Yes, I would say so]

sounds like a headache to me.

 jcode dept loc
 1 213 2
 2 77 3

 where dept and loc are FKs to other tables? Or is this taking it
too far?

[It is not a necessity, but it would be easier to modify or upgrade
later, wich we always do]

not necessarily easier, it just means you're making changes to one
table instead of another.

 Same for application form. All this information that I am getting
-
 should
 I put into a single table, or split across separate tables? I do
plan to
 search by differenet criteria later.

 What about items in drop-downs? For example, if I have a drop-down
for
 salary ranges or countries - should this information come from a
table, or
 should I hard-code into the form itself? How do I make the
decision as to
 which is appropriate?

[I would never hard code anything that can change, salary ranges can
changes, country can change too :) ]

I agree there.

you can even take laziness to the next level and use 1 table with
fields for just the items you will use in your sql, serialize the
rest of the data and put it in a text field - that way you can add
fields later without having to alter the table.

Plus you could put a fulltext index on that and do an easy keyword
search on all the data.


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




[PHP] Problem installing extension

2001-05-21 Thread Ben Curtis

I'm having problems loading an extension I just compiled into PHP 4.0.5 on linux.  On 
startup I get this...

PHP Warning:  Unable to load dynamic library 
'/usr/local/lib/php/extensions/no-debug-non-zts-20001222/myextension.so' - cannot open 
shared object file: cannot load shared object file: No such file or directory in 
Unknown on line 0

That message is repeated twice.  The .so _is_ there -- any clues?

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




RE: [PHP] ?=SID? is not translated...

2001-05-21 Thread Johnson, Kirk

Is the session.use_trans_sid flag set to 1 in php.ini?

Kirk

 -Original Message-
 From: Christian Marschalek [mailto:[EMAIL PROTECTED]]
 Sent: Monday, May 21, 2001 1:16 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP] ?=SID? is not translated...
 
 
 I know that, and this option is not enabled and ?=SID? does not work
 although the cookies are turned off...
 
  -Original Message-
  From: Rama [mailto:[EMAIL PROTECTED]] 
  Sent: Monday, May 21, 2001 8:19 AM
  To: Christian Marschalek
  Subject: RE: [PHP] ?=SID? is not translated...
  
  
  http://www.php.net/manual/en/ref.session.php
  
  PHP is capable of doing this transparently when compiled
  with --enable-trans-sid. If you enable this option, relative 
  URIs will be changed to contain the session id automatically. 
  Alternatively, you can use the constant SID which is defined, 
  if the client did not send the appropriate cookie. SID is 
  either of the form session_name=session_id or is an empty string.
  
  
  Rama
  
  -Original Message-
  From: Christian Marschalek [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, May 20, 2001 8:09 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] ?=SID? is not translated...
  
  
  My system does not tranlate ?=SID? into the PHP Session 
  id... Don't have a clue why, though...
  
  Any clues?
  
  Tia! Chris
  
  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 

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




Re: [PHP] wrapping text on a page display.

2001-05-21 Thread Floyd Baker

On Mon, 21 May 2001 12:57:13 -0400, you wrote:



Hello..  Sorry, I know this is a constant problem.., at least for me.

Now I am using 'text' to store big inputs.  It does not wrap on the
screen display...   

I have it working on my machine with wordwrap with php4.
The isp does not have php4 yet, and it doesn't work with I upload.

What is the php3 alternative please?

The ascii between the ;'s is exactly this... One long line.

;I\'ll add details later.  Now is the time for all good men to come to
the aid of their country...  The quick brown fox jumped over the lazy
dogs back 12345 times...  Of all the fishes in the sea, the mermaid is
still the only one for me;


I am using include() on a net fusion .php3 page to pull the php script
to pull and print the text field.

Thanks. 

Floyd



You know there's an extra } in the first example for word wrap, under
string functions in the manual..I'm still having trouble with it
so I'd like someone else to take a crack at it too.  

Thanks..

Floyd



--


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




[PHP] hi, highlight_string.

2001-05-21 Thread Michel 'ZioBudda' Morelli

Hi, I want to save into a variable ($tmp) the value of highlight_string
command. Any one? or any similar function?

-- 
SORDOMUTO TENTA DUE RAPINE MA NON RIESCE A FARSI CAPIRE
(Dai Giornali)

--
Michel ZioBudda Morelli   [EMAIL PROTECTED]

ICQ UIN: 58351764   PR of Linux in Italy
http://www.ziobudda.net http://www.linuxlab.it


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




[PHP] PHP URL Question - omitting index.php

2001-05-21 Thread colin olkowski

Quick question on passing arguments via URL.

Does anyone know if any browsers have a hard time dealing with something
like the following?

http://www.blahbalh.com/directory/?arg1=arg1arg2=arg2

In this case the directory would have an index.php file that would react
based on the query string, but as you can see I'm not including the
index.php in the link.

Is this o.k. or will some browsers get confused?

thanks in advance

colin olkowski


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




Re: [PHP] hi, highlight_string.

2001-05-21 Thread Alexander Wagner

Michel 'ZioBudda' Morelli wrote:
 Hi, I want to save into a variable ($tmp) the value of
 highlight_string command. Any one? or any similar function?

Have a look at PHP 4's output buffering functions. You can use them to 
safe the output instead of displaying it.

regards
Wagner

-- 
Some guy hit my fender, and I told him, 'Be fruitful and multiply,' 
but not in those words.
 - Woody Allen

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




[PHP] mysql and user-defined functions

2001-05-21 Thread Lybarger, Denver J (LYBARDJ8)

Hi All,
  Is there a way to return the results of a mysql_query or the array
 that is generated after mysql_fetch_array, via a function?  Note I have
 tried to do a straight return.  Another issue is that all of the tables
 are a different size, therefore a static array size would be a big waste
 of memory.  Thanks for any help you could lend.
 - Denver



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




Re: [PHP] mysql and user-defined functions

2001-05-21 Thread Alexander Wagner

Lybarger, Denver J (LYBARDJ8) wrote:
   Is there a way to return the results of a mysql_query or the
 array that is generated after mysql_fetch_array, via a function? 
 Note I have tried to do a straight return.

What was the problem? This should work. Maybe you just got the 
mysql_fetch_array() wrong, or the database-connect.

 Another issue is that all
 of the tables are a different size, therefore a static array size
 would be a big waste of memory.

PHP doesn't have static array sizes, only associative arrays.

  Thanks for any help you could lend.

Sorry, but what you wrote is insufficent to find out where your problem 
lies. For me, anyway.

regards
Wagner

-- 
Some guy hit my fender, and I told him, 'Be fruitful and multiply,' 
but not in those words.
 - Woody Allen

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




[PHP] Pls Help with this newbie question

2001-05-21 Thread Tom

I can't seem to get unset() to work when I'm strying to delete an 
element from an array.

I have a select list that is populated by an array, and i need to 
be able to delete items from the list by deleting them from the 
array, but I don't know how.

I tried using unset($array['element']); but it doesn't work.
Does anyone know why?
Does anyone know of a way to use array_diff() to delete elements 
from an array?

Thanks,
Tom  




 
   

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




[PHP] Is this a typo or what?

2001-05-21 Thread Floyd Baker



There's an extra '}' in the first example for a word wrap function,
under string functions in the manual..

I think I removed the right one but I'm still having trouble with it.
Can someone else take a crack at it too?  

Or give me a new one?  

Thanks..

Floyd





--


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




Re: [PHP] e*reminder and cron

2001-05-21 Thread Henrik Hansen

Henry [EMAIL PROTECTED] wrote:

  i'd like to run something like http://sourceforge.net/projects/e-reminders/
  on my site. it uses cron to trigger the mail to be sent.
  
  i'm not familiar with unix and cron. apparently i need to use shell access
  on my site to get this working.
  
  anybody got any tips to get cron working in the simplest way.

from you shell enter :

crontab -e

then you are in the crontab file, here you can input a cronjob, look
more at man crontab

-- 
Henrik Hansen


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




[PHP] cron jobs

2001-05-21 Thread Matt Costello

Hi

Am running php4 on Red Hat 7(ish) and i need to setup cron job to run php
script. the script works fine if i load in browser, but creates an error
under cron. The script doesn;t try and echo anything to screen, just does
some DB stuff then sends out an email.

Matt



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




Re: [PHP] Is this a typo or what?

2001-05-21 Thread Henrik Hansen

Floyd Baker [EMAIL PROTECTED] wrote:

  There's an extra '}' in the first example for a word wrap function,
  under string functions in the manual..
  
  I think I removed the right one but I'm still having trouble with it.
  Can someone else take a crack at it too?  
  

I dont see any extra } what i see is:

$text = The quick brown fox jumped over the lazy dog.;
$newtext = wordwrap( $text, 20 );

echo $newtext\n;

a note for wordwrap is if you use if for wrapping in html you might
want to do something like this, to split every line with a br:

wordwrap($text, 20, br);

-- 
Henrik Hansen


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




[PHP] replacing directory references at beginning of file name

2001-05-21 Thread Dennis Gearon

Could someone please send me the code for doing the above? I have the
book, Mastering Regex, blah blah, but I don't have time to read it
until the end of the school quarter.

I'd like to remove the following chars from the beginning of a string:
'$', '\', '/', and '.' .

I plan on doing it like so:

while( ereg_replace( $dir_remove_patt, , $file_name) ){;}

I need the value for $dir_remove_patt, and I would be most grateful. I'm
a stubborn kind of guy, and I don't usually ask for direct help; I'm not
a moocher of code. But I could use some help, thanks :-)

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




Re: [PHP] cron jobs

2001-05-21 Thread Henrik Hansen

Matt Costello [EMAIL PROTECTED] wrote:

  Hi
  
  Am running php4 on Red Hat 7(ish) and i need to setup cron job to run php
  script. the script works fine if i load in browser, but creates an error
  under cron. The script doesn;t try and echo anything to screen, just does
  some DB stuff then sends out an email.

how do you call the script from cron?

-- 
Henrik Hansen


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




[PHP] Class var not retaining values

2001-05-21 Thread Bob

I have a class defined with a var $reasons that I will use as an array.  The
code to add to it is:

 function AddReason($score, $reason, $id)
 {
  static $index = 0;
  $this-reasons[$index] = $score|$reason|$id;
  for ($i = 0; $i  $index; $i++)
  {
   $out = $this-reasons[$i];
   echo $out...;
  }
  $index++;
  return $score;
 }

However, every time I call it, the value stored in the reasons array seems
to disappear, and the array holds no data.  It seems to be behaving like a
local variable, even though it is in a class.  Any suggestions would be
greatly appreciated.

Thanks



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




Re: [PHP] Is this a typo or what?

2001-05-21 Thread Floyd Baker

On 21 May 2001 23:22:17 +0200, you wrote:

Floyd Baker [EMAIL PROTECTED] wrote:

  There's an extra '}' in the first example for a word wrap function,
  under string functions in the manual..
  
  I think I removed the right one but I'm still having trouble with it.
  Can someone else take a crack at it too?  
  

I dont see any extra } what i see is:

$text = The quick brown fox jumped over the lazy dog.;
$newtext = wordwrap( $text, 20 );

echo $newtext\n;

a note for wordwrap is if you use if for wrapping in html you might
want to do something like this, to split every line with a br:

wordwrap($text, 20, br);

-- 
Henrik Hansen



Henrik

You are looking in the wrong area..  I'm working with php3.  

 There's an extra '}' in the first example for a word wrap function,
 under string functions in the manual..

Here is what I see... and if you count the brackets, there are 15.. ?

[EMAIL PROTECTED]
12-Nov-1999 05:15 
A quick and dirty function to wrap text at a given wrap margin: 

function wraptext($text, $wrapmargin) 
{ 
$rettext = ; 
$linebuf = ; 
$linelen = 0; 
$tok = split([ \t], $text); 
$numtok = count($tok); 
for ($i = 0; $i  $numtok; $i++) 
{ 
$elem = $tok[$i]; 
$elemlength = strlen($elem) + 1; 
if ($linelen + $elemlength  $wrapmargin) 
{ 
$rettext = $rettext . $linebuf . \n; 
$linebuf = ; 
$linelen = 0; 
} 

// Do we have a newline in this element? 
$pos = strrpos($elem, \n); 
if ($pos) 
{ 
$before = substr($elem, 0, $pos); 
$after = substr($elem, $pos); 
$rettext = $rettext . $linebuf .   . $before . \n; 
$linebuf = $after; 
$linelen = strlen($after); 
} 
else 
{ 
$linebuf = $linebuf .   . $elem; 
$linelen = $linelen + $elemlength; 
} 
} 

// Do we have a newline in this element? 
$pos = strrpos($elem, \n); 
if ($pos) 
{ 
$before = substr($elem, 0, $pos); 
$after = substr($elem, $pos); 
$rettext = $rettext . $linebuf .   . $before . \n; 
$linebuf = $after; 
$linelen = strlen($after); 
} 
else 
{ 
$linebuf = $linebuf .   . $elem; 
$linelen = $linelen + $elemlength; 
} 
} 
return $rettext; 
} 

 


--


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




Re: [PHP] Is this a typo or what?

2001-05-21 Thread Henrik Hansen

Floyd Baker [EMAIL PROTECTED] wrote:

  Henrik
  
  You are looking in the wrong area..  I'm working with php3.  
  
   There's an extra '}' in the first example for a word wrap function,
   under string functions in the manual..
  
  Here is what I see... and if you count the brackets, there are 15.. ?
  

ok well, I can see the script inserts \n, if you are wrapping in html
you dont see the text is actual wraping because you need to add br
instead, maybe do a nl2br() on the ourput from the functions and see
if the text wraps as wanted.

-- 
Henrik Hansen


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




[PHP] array sort

2001-05-21 Thread Alex Black

hi all,

I'm trying to do an array sort that takes:

$test = array(
array( // this is $test[0].
string = this is the second,
num = 2
),
array( // this is $test[1].
string= this is the first,
num = 1
),
);

and sorts that array based on $test[$x][num], so I get:

$test = array(
array( // this was $test[1], now $test[0].
string= this is the first,
num = 1
),
array( // this was $test[0], now $test[1].
string= this is the second,
num = 2
),

);

Note that the key/value pairs _must_not_ change, so I can't just copy this
stuff around to get what I want. (because I'm actually doing this for load
order of class instances)

so, I'm trying to sort the order of the top level arrays in a structure,
based on a key.

I played with array_moltisort, but could not get what I wanted out of it.
I have this nagging feeling like I _could_ get what I want out of it, thus
the post :)

oh yes, please cc me @ [EMAIL PROTECTED]

tia, all.

_alex



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




  1   2   >