[PHP] session.gc_probability

2001-09-08 Thread Tobias Strauß

The session handling of php seems not to work very well on my computer:
if  session.gc_probability is set to a value smaler 35, it never executes my
gabarage_collection-function. When it is bigger than 35, it's executed every
time.
I'm using W2K and php 4.02? Does anybody knows the reason for this?



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




[PHP] HTTP_X_FORWARDED_FOR

2001-09-08 Thread Tobias Strauß

On php.net I found this:

When you use REMOTE_ADDR for getting the IP of the current user, sometimes
you get the IP of the ISP Cache server.
When this happens, the HTTP_X_FORWARDED_FOR is also set, it contains the IP
of the user.
[...]
Note that the X-Forwarded for header might contain multiple addresses, comma
separated, if the request was forwarded through multiple proxies.
[...]

My question is:
If the X-Forwarded for header contains multiple addresses, comma separated,
where do I find the one of the user? (I which order does it contain the
adresses?)
Do I get the right order (from the last proxies (at the beginning) to the
user itself (at the end)) when I do this:
$ip_route = $HTTP_SERVER_VARS["REMOTE_ADDR"] . "," .
$HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
So that I finally have a chronological sorted list (i know: a string that
contains the comma seperated ip-addresses of the users way to me (if they
were forwarded by the proxie))? Am I right?

Thanks for any coments about this.



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




Re: [PHP] Homesite & php

2001-09-08 Thread Hugh Danaher

Hi,
I'm using homesite 4.5.1 and I've not had the problem you describe.
However, since I use a remote server, when I have a php page up, and go to
design view, funny things do happen.  I just don't go there anymore.
Hugh
- Original Message -
From: Andonny <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 08, 2001 8:17 PM
Subject: [PHP] Homesite & php


> Hi,
> Does the new version of  homesite still have the same result with php.
When
> I used to change anything in Design View and then went back to Edit View
> the ?>  became  ?>.   Does this still happen???
>
> Thanks
> Andonny
>
>
>
> --
> 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] Win 9x and Shell Commands

2001-09-08 Thread ReDucTor

I can't seem to do any system(), exec(), passthru(), etc on my windows
system..

I've tried doing "command /c "...

Its showing

Warning: Unable to fork [command /c net] in c:\phpdev3\www\net.php on line 2
  - James "ReDucTor" Mitchell


-- 
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 / PHP Join Question

2001-09-08 Thread Don Read


On 09-Sep-2001 Dana Holt wrote:
> 
> I have a query that uses a LEFT JOIN, but the two tables have some columns
> with the same name. How can I tell the columns from each table apart? It
> seems that the "joined" table overwrites the values from the other table.
> 

If the column is part of the join criterion, it won't matter.

otherwise, alias the column name:

SELECT t1.id as siteid, t2.id as wmid, t2.name as name
FROM site as t1 LEFT JOIN webmaster as t2 USING (id)
WHERE t2.name is NOT NULL ...

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

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




[PHP] Re: preg_replace_callback()

2001-09-08 Thread Richard Lynch

A "callback" is when you execute a function, and you provide to it a name of
*another* function, which it will call on some data in the middle of its
task.

It's a very handy way to provide extreme flexibility in functional
languages.

For example:

function my_array_walk($array, $function){
while (list($k, $v) = each($array)){
# Here's the magic that implements a 'callback'
$function($k, $v);
}
}

function your_echo($key, $value){
echo "$key $value\n";
}

$foo = array('a'=>1, 'b'=>2, 'c'=>3);

my_array_walk($foo, 'your_echo');

This rather silly example will "walk" the array and call 'your_echo' on each
key/value pair.

Dunno exactly how preg_ uses it though...

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Arash Dejkam <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 08, 2001 7:35 PM
Subject: preg_replace_callback()


> Hi,
>
> What is a callback in preg_replace_callback(...) ?
> how can I use it ? can anybody give me an example ?
>
> Thanks,
> Arash
>
>


-- 
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: Seperating a textarea into 3 different variables

2001-09-08 Thread Richard Kurth

Hello Gaylen,
I am not sure what worldpay uses as an operating system but this work
just perfect. Thanks

Saturday, September 08, 2001, 6:09:08 PM, you wrote:

Gaylen Fraley> Is this under Windows?  If so, it's probably passing \r\n : carriage
Gaylen Fraley> return/line feed.  Check for both.


Gaylen Fraley> --
Gaylen Fraley> Gaylen

Gaylen Fraley> "Richard Kurth" <[EMAIL PROTECTED]> wrote in message
Gaylen Fraley> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>> I have a problem I am trying to set up a credit card form for worldpay
>>
>> And in the address field that I have to send to them it has to go in
>> a textarea 
>>
>> So when you fill this in it would look like this
>>
>> address
>> city
>> state
>>
>> Now this works fine for sending them the data but when the data is
>> sent back it is also in this format
>> address
>> city
>> state
>>
>> I need to separate it into Address, city, state so it is 3 different
>> variables
>>
>> I have tried
>> $saddress=explode ("
",$address);
>> $address1=$saddress[0];
>> $city=$saddress[1];
>> $state=$saddress[2];
>>
>> 
  is the the new line character
>>
>> I have also tried /n and /s  but none of these work
>>
>> When I echo the $address to the screen it shows as address city state
>> but when I vew the code from the browser it shows it as
>> address
>> city
>> state
>>
>> So I assume that it is passing a new line character
>>
>> Does anybody have a solution for this
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Best regards,
>>  Richard
>> mailto:[EMAIL PROTECTED]
>>






-- 
Best regards,
 Richard  
mailto:[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] insert space to a string (newbie)

2001-09-08 Thread Ryan Fischer

You wrote:
> I have a simple question...
> How can a space inserted to a string after the 3rd char ??
> 
> washington   ->>  was hington 

$str = 'washington';
$str = ereg_replace('^(.{3})(.*)$', '\\1 \\2', $str);

-- 
 -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.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] insert space to a string (newbie)

2001-09-08 Thread rm

Maybe something like:

$word="washington";
$length=strlen($word);

$a=substr($word,0,3);
$b=substr($word,3,$length-3);

$string=$a." ".$b;

print $string;

you might want to test for the length of $word first
to make sure $word has more than 3 characters


--- Andras Kende <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I have a simple question...
> How can a space inserted to a string after the 3rd
> char ??
> 
> washington   ->>  was hington 
> 
> 
> Thanks :)
> 
> 
> Andras
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> 


__
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com

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




[PHP] insert space to a string (newbie)

2001-09-08 Thread Andras Kende

Hi,

I have a simple question...
How can a space inserted to a string after the 3rd char ??

washington   ->>  was hington 


Thanks :)


Andras


-- 
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 / PHP Join Question

2001-09-08 Thread Dana Holt


I have a query that uses a LEFT JOIN, but the two tables have some columns
with the same name. How can I tell the columns from each table apart? It
seems that the "joined" table overwrites the values from the other table.

Anyone know?

Thanks.

--
Dana Holt / [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] Sterilize user input function

2001-09-08 Thread John Lim

It really depends on what you use the user input for.

If you are just storing into a database and splashing it out to a html page
later, htmlspecialchars( ) is adequete protection.

If this is a filename, then checks for the prefix "http://"; and '..'  and
quotes in the file name, and a base directory check is needed.

If you are running a command line program, then < > | ' " come to mind. This
is probably not complete. Read a few advisories. The Perl security stuff is
good as they are the most vulnerable :-)

Regards, John




"Kevin" <[EMAIL PROTECTED]> wrote in message
000d01c138d9$92245d80$503ffea9@kl">news:000d01c138d9$92245d80$503ffea9@kl...
> I think my question could be restated to: What characters are potentially
> lethal in user input.  I can do the regex.  But don't know what to parse
out
> of the strings.
>
> would removing  \ /  .  do the trick?
>



-- 
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] Homesite & php

2001-09-08 Thread Andonny

Hi,
Does the new version of  homesite still have the same result with php. When
I used to change anything in Design View and then went back to Edit View
the ?>  became  ?>.   Does this still happen???

Thanks
Andonny



-- 
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] Sterilize user input function

2001-09-08 Thread Kevin

I think my question could be restated to: What characters are potentially
lethal in user input.  I can do the regex.  But don't know what to parse out
of the strings.

would removing  \ /  .  do the trick?


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




[PHP] Re: PHP and MySQL

2001-09-08 Thread Pieter Philippaerts

Unfortunately, I can't access these settings. It's not our computer that
hosts
our website.

Regards,
Pieter Philippaerts

"Richard Lynch" <[EMAIL PROTECTED]> wrote in message
01e501c138ce$f3008300$6401a8c0@Lynchux100">news:01e501c138ce$f3008300$6401a8c0@Lynchux100...
> Options:
> Increase the settings in MySQL that limit how many databases can be open
at
> once.
> Decrease the number of Apache children running.
>
> Basically, as long as you have more Apache children than MySQL connections
> available, you can get this message.
>
> Actually, have a few spare MySQL connections, so you can telnet/SSH in and
> use the monitor as well, and cron jobs using MySQL can run.
>
> --
> WARNING [EMAIL PROTECTED] address is an endangered species -- Use
> [EMAIL PROTECTED]
> Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
> Volunteer a little time: http://chatmusic.com/volunteer.htm
> - Original Message -
> From: Pieter Philippaerts <[EMAIL PROTECTED]>
> Newsgroups: php.general
> To: <[EMAIL PROTECTED]>
> Sent: Friday, September 07, 2001 11:30 PM
> Subject: PHP and MySQL
>
>
> > Hello,
> > we're using our MySQL database quite extensively from our PHP scripts,
> > but sometimes everything stops working and it says "Too many
connections".
> > Is there a problem with MySQL support from within PHP? Doesn't it close
> > its connections with the database when the script stops executing?
> > Is there anything I can do to resolve this problem?
> >
> > Regards,
> > Pieter Philippaerts
> >
> >
>



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




[PHP] Re: Seperating a textarea into 3 different variables

2001-09-08 Thread Richard Lynch

Use something like this to find out what character is *REALLY* in the stuff
coming from worldpay:

for($i = 0; $i < strlen($worldpay_address); $i++){
$char = $worldpay_address[$i];
if (($ord = ord($char)) < 32){
echo "$char[$ord]";
}
else{
echo $char;
}
}
Another option is to not rely on worldpay to return your address info at
all.

Just store the info (except for credit card) and give them a unique id in
the transaction, and you only look at the transaction ID to snag all the
other info.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Richard Kurth <[EMAIL PROTECTED]>
Newsgroups: php.general
To: php <[EMAIL PROTECTED]>
Sent: Saturday, September 08, 2001 6:50 PM
Subject: Seperating a textarea into 3 different variables


> I have a problem I am trying to set up a credit card form for worldpay
>
> And in the address field that I have to send to them it has to go in
> a textarea 
>
> So when you fill this in it would look like this
>
> address
> city
> state
>
> Now this works fine for sending them the data but when the data is
> sent back it is also in this format
> address
> city
> state
>
> I need to separate it into Address, city, state so it is 3 different
> variables
>
> I have tried
> $saddress=explode ("
",$address);
> $address1=$saddress[0];
> $city=$saddress[1];
> $state=$saddress[2];
>
> 
  is the the new line character
>
> I have also tried /n and /s  but none of these work
>
> When I echo the $address to the screen it shows as address city state
> but when I vew the code from the browser it shows it as
> address
> city
> state
>
> So I assume that it is passing a new line character
>
> Does anybody have a solution for this
>
>
>
>
>
>
>
>
>
>
>
>
> Best regards,
>  Richard
> mailto:[EMAIL PROTECTED]
>


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




[PHP] Re: cURL support

2001-09-08 Thread Richard Lynch

Compare your  with theirs and see what cURL differences
there are...

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Daniel Baldoni <[EMAIL PROTECTED]>
Newsgroups: php.general
To: PHP users <[EMAIL PROTECTED]>
Sent: Saturday, September 08, 2001 8:49 AM
Subject: cURL support


> G'day folks,
>
> I have a site just about ready to go on-line.  All my local testing has
> worked like a dream - but the cURL support on the hosting provider is
> partially broken.
>
> Actually using curl_init()...curl_exec() etc. on my box to contact remote
> URIs (both over HTTP and HTTPS) has worked from day 1 (with versions
4.0.4p1,
> 4.0.5 and 4.0.6).
>
> On the hosting provider, HTTPS connections don't work.  But, I'm told the
> command-line version of curl does work.
>
> So, my question is - what gives?  Are there known (intermittent) problems
> with support for cURL or have the provider's staff "done something" during
> the build of curl and/or PHP?
>
> Any help would be much appreciated as I really don't like the idea of
palming
> off access to secure sites to yet another external program.  Thanks for
any
> information.
>
> Ciao.
>
> --
> ---+--
---
> Daniel Baldoni BAppSc, PGradDipCompSci |  Technical
Director
> require 'std/disclaimer.pl'|  LcdS Pty. Ltd.
> ---+  856B Canning Hwy
> Phone/FAX:  +61-8-9364-8171|  Applecross
> Mobile: 041-888-9794   |  WA 6153
> URL:http://www.lcds.com.au/|  Australia
> ---+--
---
> "Any time there's something so ridiculous that no rational systems
programmer
>  would even consider trying it, they send for me."; paraphrased from "King
Of
>  The Murgos" by David Eddings.  (I'm not good, just crazy)


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




[PHP] Re: php/mysql search. need help

2001-09-08 Thread Richard Lynch

There are various "sounds like" modules such as soundex and metaphone and
suchlike.
These can ameliorate bad spelling.
Another option, if you have a limited number of types available, is to give
the user a popup menu rather than free-form box to type in.
In general, the fewer ways you can provide for the user to type incorrectly,
the better.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Lizlynch <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, September 07, 2001 6:59 PM
Subject: php/mysql search. need help


i have a form where a user inputs a home service type and this results in a
list of that value, eg a user inputs 'plumber' and a list of plumbers is
displayed.
if a user accidentally types plumbar no results are displayed.
 is there anyway of making php/mysql recognise the first three letters or
give a closest match to the query.

yours liz lynch



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




[PHP] Re: How to use environment variables in php.ini?

2001-09-08 Thread Richard Lynch

http://php.net/getenv
http://php.net/setenv
Why you want to set them in the Environment instead of just regular
variables is beyond me.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Yaroukh <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, September 07, 2001 3:07 AM
Subject: How to use environment variables in php.ini?


> Hi there
> Is there any way to use in php.ini previously set environment variables? I
> mean when I set doc_root to "C:/Documents and Settings/zaruba/My
> Documents/My Webs" and several lines below I need to set session_save_path
> to "C:/Documents and Settings/zaruba/My Documents/My Webs/.sessions" is it
> possible to write something like this? ...
> session.save_path = $doc_root/.share
> (ofcourse it doesn't work this way, I wouldn't ask if it did :o)
> Yaroukh
> [Apache/1.3.20 (Win32) PHP/4.0.6]
>
>


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




[PHP] Re: error with socket

2001-09-08 Thread Richard Lynch

Compare PHP versions from your computer  and
http://php.net/socket

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Sagar <[EMAIL PROTECTED]>
Newsgroups: php.general
To: php <[EMAIL PROTECTED]>
Sent: Saturday, September 08, 2001 10:09 AM
Subject: error with socket


hi,

I'm using win98/apache/php4
But it's giving an error saying undefined function when i use socket()
function.
On advice of some one i've also tried socket_create(). but in vain.
I think that i dont have the socket libs in my php. where can i get them.
do u think that i'm correct ?

pl help as soon as possible.

/sagar




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




[PHP] Re: Session variables

2001-09-08 Thread Richard Lynch

You'll have to define what you mean by "currently online".

Do you mean actually waiting this moment for HTML to finish streaming to
their browser?

Or do you just mean, in my session files and not timed out yet?

Probably the easiest way to do that would be to use
http://php.net/session-set-save-handler

You could wrap some book-keeping around PHP's internal FILE sessions, or
store them in MySQL and then your simply need to query how many rows there
are in the table.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Ing. Lalka Peter <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, September 07, 2001 3:22 AM
Subject: Session variables


> Hi!
> I want to know how many users are currently online at my site.
> How can I get this info from php? Can I?
> Thank you for answer.
> Barno
>


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




[PHP] Re: query string - count for records with keywords

2001-09-08 Thread Richard Lynch

That '4' you see is that this is the FOURTH thing you've asked MySQL to do
in this script.

You need to use http://php.net/mysql_result or other similar function to get
your actual answer.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 08, 2001 12:04 PM
Subject: query string - count for records with keywords


> I'm trying to get a count of the number of records in a database that have
> the keyword "cat", for example. Below is the original code; I added the
> query with count at the bottom of this code but it doesn't seem to be
> working.  I just get a return of "4" which doesn't correspond correctly
with
> the true number of records (also, I get the same return of "4" regardless
of
> the keyword I want to search).
>
> All I want to do is put the record number in parantheses next to the
> category so that people visiting the site will be able to tell if new
> submissions have been added since they last visited.
>
> Am I missing something really obvious?
>
> Thanks for your help, Shawna
>
> 
>
> // original code
>
> if($search == "or"){
> $op = "or";
> $query = "0";
> }else{
> $op = "and";
> $query = "1";
> };
>
> if($title){
> $title = addslashes($title);
> $query .= " " . $op . " title like '%$title%'";
> };
> if($keywords){
> $foo = "(0";
> $keywords = addslashes($keywords);
>
> $strings = explode(" ", $keywords);
> $num_strings = count($strings);
>
> for($i=0;$i<$num_strings;$i++){
> $curstring=$strings[$i];
>
> $foo .= " or keywords like '%$curstring%'";
> };
>
> $query .= " " . $op . " $foo)";
> };
> if($category){
> $query .= " " . $op . " category like '%$category%'";
> };
> if($type){
> $query .= " " . $op . " type like '%$type%'";
> };
> if($language){
> $language = addslashes($language);
> $query .= " " . $op . " language like '%$language%'";
> };
> if($region){
> $query .= " " . $op . " region like '%$region%'";
> };
> if($author){
> $author = addslashes($author);
> $query .= " " . $op . " author like '%$author%'";
> };
>
> $offset = addslashes($offset);
> if(!($offset)){$offset = 0;};
>
> $results = mysql_db_query("$db", "select id, title,
> date_format(sources.datetime, '%e/%c/%y') as datetime, category, type,
> description from sources where  ( $query ) and approved = 'y' order by id
> desc limit $offset, 10");
>
>
> file://my code
> $keywordsearch = mysql_db_query("$db", "select count(*) from sources where
> keywords = 'cat' and approved = 'y'");
>
> ?>


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




[PHP] Re: header(Location:...) is redirect: looking for full link

2001-09-08 Thread Richard Lynch

Add *ANOTHER* variable in the header("Location:") code that says
"&redirect=1"

In your page3, do:
if($redirect){
$menuID = $foo;
}
else{
$menuID = $bar;
}
Where foo comes from the location, but bar comes from page2.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Chrisy <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 08, 2001 5:03 PM
Subject: header(Location:...) is redirect: looking for full link


> hi,
>
> The long explanation is below the summary.
>
>
> SUMMARY
>
>
> page1.php
> Header(location:page2.php)
>
>
> page2.php
> HTML link to page3.php
>
>
> page3.php
> REFERER=page1.php
>
>
> But in page3  i WANT to see page2.php as REFERER.
> So i suppose i must change something in page1. But what?
>
>
>
>
> XXX
>
>
>
> THE LONG:
>
> i am working on a dynamic menu module for postnuke.
>
> When a page is called with page.php?menuID=23000 that means the second
> main menu is opened, and of that branch the 3rd subbranch:
>
> >  MENU1
> V  MENU2
>* MENU21
>* MENU22
>V MENU23
>* MENU231
>* MENU232
> > MENU3
> > MENU4
>
> In effect this means i make the part of the page which makes the menu.
> I can't use a form and i can't use session.
>
>
> Now my poroblem is when people follow a link in the menu which in
> itself has subpages, the folllowing links can not be expected to
> always contain the menuID part. In effect the menu would unfortunately
> close.
>
>
> Now i did this trick: i would read menuID in the referer and
>
>
> Then i would do
>   header ('location:'.thispageURL. '&menuID'. $menuID);
>
>
>
> So:
> 1)REFERER?menuID=123
> --links-to-->
> 2) page.php?nada=0
> --checks-(finds no menuID so looks it up in
> referer)then-redirects->
> 3) page.php?nada=0&menuID=123
>
> Works nice up till then. But.
>
>
> Okay, now that page is allright but as header (location) is a
> REDIRECT, the following page does not see the added menuID as it uses
> the URI of step 2).
>
> help..
> 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] Re: creating ZIP file from mySQL content?

2001-09-08 Thread Richard Lynch

http://php.net/zlib

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Brack <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 08, 2001 6:57 AM
Subject: creating ZIP file from mySQL content?


> I have a site where ppl can upload their text-based ideas in real
> time, so that I have new records in db every day. When I did
> uploading by hands and had over 200 files on that site I distributed
> all site content in downloadable for of zipped win-help formate.
> Well, I don't think that I can do help file dinamically but what about
> normal zip file. Can I create the script which would do it for me
> (creating zip-file of all records in db dynamically)?
>
> Youri
> <>< <>< <>< <>< God is our provider ><> ><> ><> ><>
> http://www.body-builders.org


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




[PHP] Re: PHP and MySQL

2001-09-08 Thread Richard Lynch

Options:
Increase the settings in MySQL that limit how many databases can be open at
once.
Decrease the number of Apache children running.

Basically, as long as you have more Apache children than MySQL connections
available, you can get this message.

Actually, have a few spare MySQL connections, so you can telnet/SSH in and
use the monitor as well, and cron jobs using MySQL can run.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Pieter Philippaerts <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, September 07, 2001 11:30 PM
Subject: PHP and MySQL


> Hello,
> we're using our MySQL database quite extensively from our PHP scripts,
> but sometimes everything stops working and it says "Too many connections".
> Is there a problem with MySQL support from within PHP? Doesn't it close
> its connections with the database when the script stops executing?
> Is there anything I can do to resolve this problem?
>
> Regards,
> Pieter Philippaerts
>
>


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




[PHP] Re: optimize question

2001-09-08 Thread Richard Lynch

You probably won't be able to measure the difference unless you are doing
10,000 print statements...
Optimize the things that are slow, not the things that are already fast.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Michele Schiavo <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 08, 2001 6:33 AM
Subject: optimize question


> Is most performant for out a sting use
> echo or print ?
> and if I have more print command ex:
> print "aaa",
> print "";
>
> Is best use a single command with a very long string ?
>
> Thank's michele Schiavo
>
>


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




[PHP] Re: dates problem

2001-09-08 Thread Richard Lynch

Use the MySQL function to_seconds or whatever it is.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Nikola Veber <[EMAIL PROTECTED]>
Newsgroups: php.general
To: php forum <[EMAIL PROTECTED]>
Sent: Saturday, September 08, 2001 1:48 AM
Subject: dates problem


> I'm having a prowith determing a time interval. I need to find out how
many
> seconds, minutes, days have passed since a cpecific date (1.1.1980.), but
when I
> pass that dade to a time stamp , I get 1983.315529200. How am I suposed to
> handle the year (1983.) o there is smething else ? I think the only way to
do this is
> to make the time stamp for the interval between now and the specific date.
>
> thanx
> Nikola Veber
>


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




[PHP] Re: strange register_shutdown_function() and fopen() conflict

2001-09-08 Thread Richard Lynch

@fopen(...) or error_log("Unable to fopen:  $php_errormsg");
Check your Apache log after this.
http://php.net/error_log
--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Kevin Bullaughey <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, September 07, 2001 6:16 PM
Subject: strange register_shutdown_function() and fopen() conflict


> scenario...
>
> i am trying to open a file from i function that is called automatically
> because it is registered with register_shutdown_function().
>
> for some reason i am unable to call fopen(). i am assuming that my script
> causes a fatal error and i cannot see the output because with apache, one
is
> not able to output at this stage.
>
> i'm running redhat linux roswell (7.2 beta), apache 1.3.19
>
> for the code that appears below, if i comment out the line:
>   $testfp = fopen("test.txt", "w+");
>
> then i get the following output.txt file:
>   opened output.txt successfully
>   entered test_shutdown_function()
>   failed to open test.txt
>   end test_shutdown_function()
>
> if i don't comment out the line, then i get only this:
>  opened output.txt successfully
>  entered test_shutdown_function()
>
> any suggestions? my script must be terminating and i'm wondering why?
> i have tried to eliminate the possibility that fopen is failing for
ordinary
> i/o or permissions reasons.
>
> any ideas? or maybe just a hint as to how to debug this?
>
> here is the code
>
> 
> function test_shutdown_function() {
>global $outfp;
>fputs($outfp, "entered test_shutdown_function()\n");
>
>$testfp = fopen("test.txt", "w+");
>if(!$testfp) {
>   fputs($outfp, "failed to open test.txt\n");
>} else {
>   fputs($outfp, "opened test.txt successfully\n");
>   fputs($testfp, "opened test.txt successfully\n");
>}
>fputs($outfp, "end test_shutdown_function()\n");
>fclose($outfp);
>fclose($testfp);
> }
>
> global $output;
> $output = "initial value";
>
> $outfp = fopen("output.txt", "w+");
> if($outfp)

>fputs($outfp, "opened output.txt successfully\n");
> } else {
>fputs($outfp, "failed to open output.txt\n");
> }
>
> register_shutdown_function("test_shutdown_function");
>
> ?>


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




[PHP] Re: files

2001-09-08 Thread Richard Lynch

There's a Un*x utility for automagically doing this, but it leaves the new
file blank, almost for sure...
man logrotate

Can we safely assume no *other* PHP script is going to be trying to write to
this chat file while you're messing with it?  If not, you really need to
move to a database solution...

I guess you could try to http://php.net/flock your file everywhere before
you open it for writing, but that sure won't scale up well!

Depending on whether or not you can get all the lines you want to keep in
RAM or not, you could either:
- not so large, last 1/4th fits in RAM 
$filename = "./chat/chat.txt";
$file = fopen($filename, 'r') or die("Could not open $filename.");
$text = fseek($file, filesize($filename)*0.75);
$partial_line = fgets($file, 1000);
$recent = fread($file, filesize($filename));
fclose($file);
$file = fopen($filename, 'w') or die("Could not open $filename");
fwrite($file, $recent);
fclose($file);


If the file might be too big for this, you'll need to read a piece at a time
and write it out to some other file, and then use http://php.net/copy

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Gerard Samuel <[EMAIL PROTECTED]>
Newsgroups: php.general
To: PHP <[EMAIL PROTECTED]>
Sent: Saturday, September 08, 2001 12:11 AM
Subject: files


> hey, I have a large file and I want to keep the last x row of it.  I
> figured out how to navigate to the point where I want to extract the
> data, but I cant figure out how to extact from the file current $fp and
> write out the data to another file.
> Think of it like this, when the file gets to be x bytes, get the last 20
> lines from it and copy it to another file, so that I could dump the old
> and replace it witht the new
> Thanks.
>
>
> <--snip of example code-->
> $fp = fopen("./chat/chat.txt", "r+");
> $size = filesize("chat/chat.txt");
> $count = 0;
> while (!@feof($fp)) {
>  $lines = fgets($fp, 4096);
>  $count = $count + 1;
> }
> $count--; // return the correct # of lines in file
> echo "Lines: $count";
> $offset = round($count - ($count / 4));
> echo "Offset: $offset";
>
> $count = 0;
> rewind($fp);
> while ($count < $offset) {
>  $lines = fgets($fp, 4096);
>  $count = $count + 1;
> }
> echo "New Offset: $count";
> $file = fread($fp);
> if (!copy($file, $file.'.bak')) {
>  print ("failed to copy $file...\n");
> }
>
> fclose($fp);
>


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




[PHP] Re: independent PHP4 on shared Apache?

2001-09-08 Thread Richard Lynch

You can probably do a CGI install and only put the directives in your
.htaccess or inside your httpd.conf VirtualHost block.

For the Module, there's no way to Load/Unload for different Hosts.
You could do the LoadModule and only have the AddType in *your* Host, but
the Module itself would be part of Apache, which the ISP may not go for...

You can run PHP3 & PHP4 both as modules only if Apache, and both PHP3 and
PHP4 were compiled --enable-shared=max or whatever it is.

See the end of the PHP4 install instructions for details.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Chris Hayes <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 06, 2001 6:15 PM
Subject: independent PHP4 on shared Apache?


> hi,
> we have an account with an ISP which is not
> extremely up to date (PHP3) but we are allowed to
> install MySQL. Ourselves. (But not on the default
> space, which is a disaster. Luckily there is a very
> experienced man, he even used to work for that ISP
> doing this for us. :-) Still took him 40 hours)
>
> Now i was thinking, it is much easier to install
> PHP4 (i sincerley hope) on a non default location.
>
> BUT how can we tell Apache to only for _our_
> account use that PHP4?
>
> This is how it is set up:
>  FreeBSD 4.0.1, Apache,
>  internet dir at usr/local/WWW/www.ourdomain.org/
>  mysql at usr/o/ourdomain/mysql
>  php can be there too like /usr/o/ourdomain.org
>i suppose as a CGI.
>
> Chris
>
> cheers,
> Chris
>
>
>
>
> ---
> -
> --  C.Hayes  Droevendaal 35  6708 PB Wageningen
> the Netherlands  --
> ---
> -
>
>
>


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




[PHP] Re: Delivering an authenticated pdf

2001-09-08 Thread Richard Lynch

http://php.net/readfile
http://php.net/header
You'll want to send Content-type: application/x-octet-stream if you want to
force download, or, errr, whatever a PDF is if you want them to just view
it.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: George Pitcher <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, September 07, 2001 1:04 AM
Subject: Delivering an authenticated pdf


> Hi all,
>
> I want to be able to, after authentication, read a pdf into a string and
> then write it out to the client through the browser.
>
> I can't do all of the procedure in PHP as it's an add on to a
> Lasso/Filemaker site. I can handle the transfer between the two processes,
I
> just need to do the writing out to the client.
>
> Has anyone done this sort of thing before? (Not the lasso/php stuff but
pdf
> delivery.)
>
> The reasoning is that the user should not be able to get to the pdf unless
> they have been authenticated (in Lasso).
>
> Any suggestions?
>
>
> Regards
>
> George Pitcher
>
> Technical Manager
> HERON Project
> Napier University
> Edinburgh EH10 5DT
>
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
>
> Work: www.heron.ac.uk
> Play  : www.pingu.napier.ac.uk
>
> 
>programmer -  A device for transmuting caffeine into code.
> 
>
>
>
>
> _
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>


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




[PHP] Re: private functions

2001-09-08 Thread Richard Lynch

You'll have to use the function to find out if the function is defined.
http://php.net/function_exists

You may want to mess with method_exists and try to define it as a method
rather than a global function, which is what I think you are doing at this
point.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Lukas <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, September 07, 2001 5:34 PM
Subject: private functions


> Hello,
>
> Sorry, i posted this to my local newsfeed a while ago but i don't think it
> is propogating properly, however i apologise if this appears twice.
>
> ---
>
> i've been using private functions like the code below a little, and just
> discovered that if you call the outside function more than once you get an
> error. Apparently it doesn't like redeclaring the inside function the
second
> time you call the outside function... this seems strange to me.
>
> Any help would be appreciated.
>
>  function foo(){
>
>   function private_to_foo(){
>echo("this is private to foo\n");
>   }
>
>   // call my private function
>  echo("Hello, calling my private function\n");
>   private_to_foo();
> }
>
> // call our function
> echo("About to call foo\n");
> foo();
>
> // if you call it again it dies
> foo();
>
> ?>
>
> Lukas
>
>
>
>


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




[PHP] Re: gd-library

2001-09-08 Thread Richard Lynch


You either see GD in all that mess, or it ain't there.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Gert Mellak <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, September 07, 2001 7:29 AM
Subject: gd-library


> hi!
>
> How can I find out if gd-library is installed on my server and if not, how
> can I install it
>
> please email me if you want to help me.
>
> TIA,
>
> gert.
> email: [EMAIL PROTECTED]
> http://www.mellak.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] Re: use of mysql_free_result and unset

2001-09-08 Thread Richard Lynch

It's done at the end of a function, or at any other time, when the variable
is no longer in scope.

You really only need this on a large, long-running script or where memory is
an issue...

For web-sites, that's quite rare.

For a shell script, it might make sense.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Tobias Strauß <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, September 07, 2001 3:54 AM
Subject: use of mysql_free_result and unset


> When do I have to use mysql_free_result($res). Is it good to use it with
> every query or only if the result is very big (what's the size of the
result
> I shoud use mysql_free_result?).
> What's about the use of unset($var). Is this good to save RAM to make my
> script run faster?
> Do I have to do this also when I'm at the end of a function or is it
> automatically done by leaving this function if it's not set global?
>
>


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




[PHP] Re: output using ClibPDF is blank - RESENT in ASCII

2001-09-08 Thread Richard Lynch

take out the header, and see if you have any error messages.

I'm also willing to bet that cdpf_open() returns some special values for
error -- Your code should check that.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Don <[EMAIL PROTECTED]>
Newsgroups: php.general
To: php list <[EMAIL PROTECTED]>
Sent: Thursday, September 06, 2001 3:52 PM
Subject: output using ClibPDF is blank - RESENT in ASCII


> Hi,
>
> I am evaluating ClibPDF and have written a sample rpogram to output some
text and a couple of lines to a letter size page. However,
> the when the PDF loads onto the screen, it is blank.  Can anyone tell me
what went wrong?  The code is below. Am running Apache
> Server on RedHat Linux 6.2
>
> Thanks,
> Don
>
> Code
> --
>   $pdf = cpdf_open(0);
>   cpdf_set_creator($pdf, "bl_print.php");
>   cpdf_set_title($pdf, "Proof B/L");
>
>   cpdf_page_init($pdf, 1, 0, 612, 792);
>
>   cpdf_begin_text($pdf);
>   cpdf_set_font($pdf, "Times-Roman", 30, "WinAnsiEncoding");
>   cpdf_set_text_rendering($pdf, 1);
>   cpdf_text($pdf, "Times Roman outlined", 50, 700);
>   cpdf_end_text($pdf);
>
>   cpdf_moveto($pdf, 55, 757);
>   cpdf_lineto($pdf, 585, 757);
>   cpdf_moveto($pdf, 55, 754);
>   cpdf_lineto($pdf, 585, 754);
>
>   cpdf_finalize_page ($pdf, 1);
>
>   cpdf_finalize($pdf);
>   Header("Content-type: application/pdf");
>   cpdf_output_buffer($pdf);
>   cpdf_close($pdf);
>


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




[PHP] Re: Module/PHP conflict

2001-09-08 Thread Richard Lynch

You'll have to get a new version of php_dbg.dll from PHPEd, I think...

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Michael Cronström <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 06, 2001 6:54 PM
Subject: Module/PHP conflict


php_dbg.dll, required for PHPEd as well as DBG debugger, works fine on
Windows 98SE, PWS and PHP 4.04.
However, when I upgrade to PHP 4.0.6 (CGI binary) and change server to
Apache/1.3.20 (Win32) I get the following error

'Content-type: text/html
PHP Warning: dbg: Unable to initialize module
Module compiled with debug=0, thread-safety=1 module API=20001214
PHP compiled with debug=0, thread-safety=1 module API=20001222
These options need to match in Unknown on line 0'

What do I do to fix it?

Michael Cronström
[EMAIL PROTECTED]



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




[PHP] Re: Netscape & Cookies

2001-09-08 Thread Richard Lynch

Try not using "" and 0 for domain and secure.  You're using the defaults
anyway, I think...

I think the "" is the real culprit...

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Jochen Kaechelin <[EMAIL PROTECTED]>
Newsgroups: php.general
To: PHP General List <[EMAIL PROTECTED]>
Sent: Thursday, September 06, 2001 8:28 PM
Subject: Netscape & Cookies


> Netscape does not accept the following:
>
> SetCookie("bilderanzeige",$bilderanzeige,time()+3600*24*30,"/","",0);
>
> Works fine in IE and Opera!
> Could anyone help, please!
>
> Jochen
>
>


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




[PHP] Re: how to use fileatime() if the file name contains empty char?

2001-09-08 Thread Richard Lynch

You may need to escape it with "file\\ name" for the shell...

Only I woulda thought PHP would take care of that...

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Zhu George-Czz010 <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 06, 2001 4:10 PM
Subject: how to use fileatime() if the file name contains empty char?


> Hi,
>
>Does anyone know how to use fileatime() when the file name contains
empty char inside?
>
> Thank you very much 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] Re: Unresolved Mistery Error in PHP

2001-09-08 Thread Richard Lynch

You probably have differing versions of MySQL compiled into PHP and what you
are actually *running* on your computer.

Re-compile PHP and be sure to use --with-mysql=/path/to/your/mysql/source
That source *MUST* match your running MySQL server.
Watch the configure output messages, and be sure you don't get a warning
about MySQL built-in support at the end.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Webmaster <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 06, 2001 2:25 PM
Subject: Unresolved Mistery Error in PHP


> Hi people:
>
> I trying to run a script from my shell but I get this error:
>
> [root@corotu docs]# ./phorummail
> php: error in loading shared libraries: libmysqlclient.so.6: cannot open
> shared
> object file: No such file or directory
>
> Well, some people said to me that usually this library is located in
> /usr/local/lib/mysql, I search this file in source of MySQL but not
> exists!!! only there are libmysqlclient.so.10, I made a sym-link from
> libmysqlclient.so.10 to libmysqlclient.so.6 after copy to
> /usr/local/lib/mysql and don't work  I received the same error.
>
> The error occurs with any php script not only with Phorummail.
>
> I am on the edge of insane, please somebody help me, I was working in this
> for one week.
>
> Regards,
>
> Peter Brumvig
>


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




[PHP] Re: Seperating a textarea into 3 different variables

2001-09-08 Thread Gaylen Fraley

Is this under Windows?  If so, it's probably passing \r\n : carriage
return/line feed.  Check for both.


--
Gaylen

"Richard Kurth" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a problem I am trying to set up a credit card form for worldpay
>
> And in the address field that I have to send to them it has to go in
> a textarea 
>
> So when you fill this in it would look like this
>
> address
> city
> state
>
> Now this works fine for sending them the data but when the data is
> sent back it is also in this format
> address
> city
> state
>
> I need to separate it into Address, city, state so it is 3 different
> variables
>
> I have tried
> $saddress=explode ("
",$address);
> $address1=$saddress[0];
> $city=$saddress[1];
> $state=$saddress[2];
>
> 
  is the the new line character
>
> I have also tried /n and /s  but none of these work
>
> When I echo the $address to the screen it shows as address city state
> but when I vew the code from the browser it shows it as
> address
> city
> state
>
> So I assume that it is passing a new line character
>
> Does anybody have a solution for this
>
>
>
>
>
>
>
>
>
>
>
>
> Best regards,
>  Richard
> mailto:[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] cookie error

2001-09-08 Thread Julie Meloni

Saturday, September 08, 2001, 5:40:46 PM, you wrote:

AM> when i submit a form and try to have it post a cookie in the php thing i get
AM> this error message:

AM> Warning: Cannot add header information - headers already sent by (output
AM> started at /usr/local/www/data/vi2dev/root/layout/functions.php:167) in
AM> /usr/local/www/data/vi2dev/root/admin/manager.php on line 19

You cannot set a cookie or send any header information (a-ha! a clue
in an error message!) after headers (content) have been sent.

So, put your setcookie() or header() function before any other output.
 "output" includes whitespace and line breaks, etc.

- Julie

--> Julie Meloni
--> [EMAIL PROTECTED]
--> www.thickbook.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] cookie error

2001-09-08 Thread Aaron Moore

when i submit a form and try to have it post a cookie in the php thing i get
this error message:

Warning: Cannot add header information - headers already sent by (output
started at /usr/local/www/data/vi2dev/root/layout/functions.php:167) in
/usr/local/www/data/vi2dev/root/admin/manager.php on line 19

how do i get it to set the cookie???



-- 
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] preg_replace_callback()

2001-09-08 Thread Arash Dejkam

Hi,

What is a callback in preg_replace_callback(...) ?
how can I use it ? can anybody give me an example ?

Thanks,
Arash



-- 
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] Seperating a textarea into 3 different variables

2001-09-08 Thread Richard Kurth

I have a problem I am trying to set up a credit card form for worldpay

And in the address field that I have to send to them it has to go in
a textarea 

So when you fill this in it would look like this

address
city
state

Now this works fine for sending them the data but when the data is
sent back it is also in this format
address
city
state

I need to separate it into Address, city, state so it is 3 different
variables

I have tried
$saddress=explode ("
",$address);
$address1=$saddress[0];
$city=$saddress[1];
$state=$saddress[2];


  is the the new line character

I have also tried /n and /s  but none of these work

When I echo the $address to the screen it shows as address city state
but when I vew the code from the browser it shows it as
address
city
state

So I assume that it is passing a new line character

Does anybody have a solution for this












Best regards,
 Richard  
mailto:[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] header(Location:...) is redirect: looking for full link

2001-09-08 Thread Chrisy

hi,

The long explanation is below the summary.


SUMMARY


page1.php
Header(location:page2.php)


page2.php
HTML link to page3.php


page3.php
REFERER=page1.php


But in page3  i WANT to see page2.php as REFERER.
So i suppose i must change something in page1. But what?




XXX



THE LONG:

i am working on a dynamic menu module for postnuke. 

When a page is called with page.php?menuID=23000 that means the second
main menu is opened, and of that branch the 3rd subbranch:

>  MENU1
V  MENU2
   * MENU21
   * MENU22
   V MENU23
   * MENU231
   * MENU232
> MENU3
> MENU4

In effect this means i make the part of the page which makes the menu.
I can't use a form and i can't use session.


Now my poroblem is when people follow a link in the menu which in
itself has subpages, the folllowing links can not be expected to
always contain the menuID part. In effect the menu would unfortunately
close.


Now i did this trick: i would read menuID in the referer and 

   
Then i would do 
  header ('location:'.thispageURL. '&menuID'. $menuID);



So: 
1) REFERER?menuID=123
--links-to-->  
2)  page.php?nada=0  
--checks-(finds no menuID so looks it up in
referer)then-redirects->
3)  page.php?nada=0&menuID=123

Works nice up till then. But.


Okay, now that page is allright but as header (location) is a
REDIRECT, the following page does not see the added menuID as it uses
the URI of step 2).

help..
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] Sterilize user input function

2001-09-08 Thread B. van Ouwerkerk

For emails I've seen some nice work somewhere in the annoted manual.

I think it's in the chapter about regular expressions..
http://www.php.net/manual/en/function.ereg.php

You might not only want to kill anything dangerous.. Checking email address 
is also handy to prevent your database to be filled with crap..

For Phone numbers you could create a page which contains the - between the 
numbers.. so only numbers are allowed.. quite easy with regular expressions..
Or just one filed and check the number someone gives and see if it hold the 
string you thought it should hold.

Think about what you want to allow and what you want to refuse.

Bye,


B.


At 11:27 8-9-01 -0600, Kevin wrote:
>I am looking for general a function to that would render user input
>harmless.
>
>I would write my own but don't know what to strip from the input that could
>make it potentially damaging on linux boxes.  I need to accept email and
>phone numbers.
>
>Thanks in advance,
>
>Kevin
>
>
>--
>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] Mod-function?

2001-09-08 Thread Rasmus Lerdorf

It is an operator in PHP: %

ie. echo 3 % 2;

-Rasmus

On Sat, 8 Sep 2001, Ville Mattila wrote:

> Hi folks,
>
> I found this kind of formulae which should calculate the distance between two points 
>on earth:
>
> tc1=mod(atan2(sin(lon1-lon2)*cos(lat2),
>cos(lat1)*sin(lat2)-sin(lat1)*cos(lat2)*cos(lon1-lon2)), 2*pi)
>
> This is not PHP code, but now I would need the same formulae in PHP. But I can't 
>find what that mod(x, x) -function does. Any idea is there corresponding function in 
>PHP?
>
> Cheers,
> - Ville
>
> .
> Ville Mattila
> Ikaalinen, Finland
> [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] Mod-function?

2001-09-08 Thread Ville Mattila

Hi folks,

I found this kind of formulae which should calculate the distance between two points 
on earth:

tc1=mod(atan2(sin(lon1-lon2)*cos(lat2),
   cos(lat1)*sin(lat2)-sin(lat1)*cos(lat2)*cos(lon1-lon2)), 2*pi)

This is not PHP code, but now I would need the same formulae in PHP. But I can't find 
what that mod(x, x) -function does. Any idea is there corresponding function in PHP?

Cheers,
- Ville

.
Ville Mattila
Ikaalinen, Finland
[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: a general perl like pares of the query string...

2001-09-08 Thread Aaron Moore

Wow... ok now i get it.. thanks guys

Aaron Moore

"Michael Kimsal" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Aaron, CC Zona wrote before that:
>
>
> If track_vars is on (always true if version >= 4.0.3), then the global
vars
> $HTTP_GET_VARS['bob'] and $HTTP_GET_VARS['phil']  are already set.
>
> And if register_globals is on, then the global vars $bob and $phil are
also
> already set.
>
> --
> Taking from your original post -
>
> file.php?bob=manager&phil=employ
>
>
> If you create a file.php in your server, and hit it with
> file.php?bob=manager,
> you should just be able to say
>
> 
>
> and you'll get "manager" printed out for you.  Most installations of
> PHP, by default,
> create variables for you from the GET string parameters.  There can be a
> security concern
> if you're not careful to validate the data that you get in from those
> GET strings,
> but this 'ease of use' (not having to use that Perl stuff from below, or
> firing up CGI.pm
> every request) is one of the main attractions to PHP for beginning
> developers.
>
> CC Zona also wrote that you can use the $HTTP_GET_VARS array (which would
> be the equivalent to the $fields{} array that is created below.  One
really
> nifty thing about PHP that isn't addressed in your Perl snippet below is
> arrays -
>
> file.php?name[]=mike&name[]=dave&name[]=keith
>
> would give me an array called $name with 3 elements in it.  There's most
> likely
> a Perl module to handle that (does CGI.pm handle that) but it's handled
> automatically
> in PHP.
>
> Aaron Moore wrote:
>
> >Well hers teh perl version of the the parser... how do i convert this to
php
> >
> >$tmp = $ENV{'QUERY_STRING'};
> >@pairs = split(/&/, $tmp);
> >
> >foreach $item (@pairs) {
> > ($key, $content) = split(/=/,$item,2);
> > $content =~ tr/+/ /;
> > $content =~ s/%(..)/pack("c",hex($1))/ge;
> > $fields{$key} = $content;
> >}
> >
>



-- 
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: a general perl like pares of the query string...

2001-09-08 Thread Michael Kimsal

Aaron, CC Zona wrote before that:


If track_vars is on (always true if version >= 4.0.3), then the global vars 
$HTTP_GET_VARS['bob'] and $HTTP_GET_VARS['phil']  are already set.

And if register_globals is on, then the global vars $bob and $phil are also 
already set.

--
Taking from your original post -

file.php?bob=manager&phil=employ


If you create a file.php in your server, and hit it with 
file.php?bob=manager,
you should just be able to say



and you'll get "manager" printed out for you.  Most installations of 
PHP, by default,
create variables for you from the GET string parameters.  There can be a 
security concern
if you're not careful to validate the data that you get in from those 
GET strings,
but this 'ease of use' (not having to use that Perl stuff from below, or 
firing up CGI.pm
every request) is one of the main attractions to PHP for beginning 
developers.

CC Zona also wrote that you can use the $HTTP_GET_VARS array (which would
be the equivalent to the $fields{} array that is created below.  One really
nifty thing about PHP that isn't addressed in your Perl snippet below is 
arrays -

file.php?name[]=mike&name[]=dave&name[]=keith

would give me an array called $name with 3 elements in it.  There's most 
likely
a Perl module to handle that (does CGI.pm handle that) but it's handled 
automatically
in PHP.  

Aaron Moore wrote:

>Well hers teh perl version of the the parser... how do i convert this to php
>
>$tmp = $ENV{'QUERY_STRING'};
>@pairs = split(/&/, $tmp);
>
>foreach $item (@pairs) {
> ($key, $content) = split(/=/,$item,2);
> $content =~ tr/+/ /;
> $content =~ s/%(..)/pack("c",hex($1))/ge;
> $fields{$key} = $content;
>}
>


-- 
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 8 Sep 2001 18:30:26 -0000 Issue 864

2001-09-08 Thread php-general-digest-help


php-general Digest 8 Sep 2001 18:30:26 - Issue 864

Topics (messages 66512 through 66538):

Re: how to execute a php script thru a cron job
66512 by: Carry Ian

Re: run a script for any HTTP request (was: run a script on access to a directory)
66513 by: Enrique Vadillo
66521 by: Geoff Caplan

how to pass authentication info to SMTP server
66514 by: Balaji Ankem

dates problem
66515 by: Nikola Veber

Re: Ordering a query
66516 by: Matthew Loff

manage a mail archive
66517 by: crorepati
66526 by: B. van Ouwerkerk
66530 by: crorepati
66533 by: B. van Ouwerkerk

[-= Your Vacation Winning =-]
66518 by: Tessy103.aol.com

a general perl like pares of the query string...
66519 by: Aaron Moore
66525 by: CC Zona
66535 by: Aaron Moore
66536 by: Rasmus Lerdorf

include problem
66520 by: mail.struempf.com
66531 by: Gaylen Fraley

optimize question
66522 by: Michele Schiavo

creating ZIP file from mySQL content?
66523 by: BRACK

session_name causes break
66524 by: Christian Haines

cURL support
66527 by: Daniel Baldoni

Problem with Encoding
66528 by: Harry Lau

error with socket
66529 by: sagar

Smarty + JavaScript
66532 by: Alexander Deruwe
66534 by: John Lim

query string - count for records with keywords
66537 by: sgibbs.vt.globalhealth.org

Sterilize user input function
66538 by: Kevin

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]


--



thanks daniel,

but how do i add it to the cron job for daily execution ?


regards
carry


On Thursday, September 06, 2001 at 10:51:00 PM, Daniel Rezny wrote:

> Hello Carry,
> 
> Thursday, September 06, 2001, 5:05:53 PM, you wrote:
> 
> CI> hello,
> 
> 
> 
> CI> can anybody suggest me how to execute a php file thru a cron job?
> 
> CI> i have a php script which checks for invalid links in my links database and 
>mails the result to the site admin if any 400 series errors are found.
> 
> 
> 
> CI> thanks in advance.
> 
> If you have a binary php version you can do it like this:
> /path/to/php/binary /path/to/script
> 
> Or you can do it thru lynx like this:
> /path/to/lynx -dump www.some_server.com/script.php
> 
> I hope it helps.
> 
> -- 
> Best regards,
>  Danielmailto:[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]
> 
> 


Carry Ian
e-mail: [EMAIL PROTECTED]



--
Get real solutions to all your problems.

http://www.salahkarindia.com - India's first advisory Portal

Your friend, advisor, healer,companion!!!

Register now  to  get free advice on all your problems.

--





Jason thanks! your information about those 512 bytes is VERY useful
but just a lil' too late, i already came up with a solution using a
conditional URL rewrite rule in my apache, along with a "
ForceType .." which helps me invoke my php script, if anyone is
interested i can send out the details, it actually executes the
php script for every http request received by the apache server.

Rasmus, thanks for your efforts on PHP development, we ALL owe you
big time. I hope you succeed with that request_rec stuff soon,
i spent some 4 hours making possible that a script be invoked
for every http request...  this has to be easier for next
PHP version!

Thanks to everyone who *at least* tried to help.

Enrique-

>From: Rasmus Lerdorf <[EMAIL PROTECTED]>
>To: Jason Bell <[EMAIL PROTECTED]>
>CC: Enrique Vadillo <[EMAIL PROTECTED]>, 
><[EMAIL PROTECTED]>,   <[EMAIL PROTECTED]>
>Subject: Re: [PHP] Re: run a script for any HTTP request (was: run a script 
>on access to a directory)
>Date: Fri, 7 Sep 2001 15:13:10 -0700 (PDT)
>
>Sure, I know that very well, but that has nothing to do with what we are
>discussing here.
>
>-Rasmus
>
>On Fri, 7 Sep 2001, Jason Bell wrote:
>
> > IE has "Friendly Error Messages" so on a normal 404 response, IE would 
>show
> > it's own error message, and not the one from the server. The Documented 
>way
> > around this is to ensure that your 404 document is larger than 512 
>bytes.
> >
> > http://www.zdnet.com/products/stories/reviews/0,4161,2779295-3,00.html
> >
> >
> > - Original Message -
> > From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> > To: "Enrique Vadillo" <[EMAIL PROTECTED]>
> > Cc: <[EMAI

[PHP] Sterilize user input function

2001-09-08 Thread Kevin

I am looking for general a function to that would render user input
harmless.

I would write my own but don't know what to strip from the input that could
make it potentially damaging on linux boxes.  I need to accept email and
phone numbers.

Thanks in advance,

Kevin


-- 
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] query string - count for records with keywords

2001-09-08 Thread sgibbs

I'm trying to get a count of the number of records in a database that have
the keyword "cat", for example. Below is the original code; I added the
query with count at the bottom of this code but it doesn't seem to be
working.  I just get a return of "4" which doesn't correspond correctly with
the true number of records (also, I get the same return of "4" regardless of
the keyword I want to search).

All I want to do is put the record number in parantheses next to the
category so that people visiting the site will be able to tell if new
submissions have been added since they last visited.

Am I missing something really obvious? 

Thanks for your help, Shawna



-- 
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: a general perl like pares of the query string...

2001-09-08 Thread Rasmus Lerdorf

http://php.net/parse_str

On Sat, 8 Sep 2001, Aaron Moore wrote:

> Well hers teh perl version of the the parser... how do i convert this to php
>
> $tmp = $ENV{'QUERY_STRING'};
> @pairs = split(/&/, $tmp);
>
> foreach $item (@pairs) {
>  ($key, $content) = split(/=/,$item,2);
>  $content =~ tr/+/ /;
>  $content =~ s/%(..)/pack("c",hex($1))/ge;
>  $fields{$key} = $content;
> }
>
>
>
>


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




[PHP] Re: a general perl like pares of the query string...

2001-09-08 Thread Aaron Moore

Well hers teh perl version of the the parser... how do i convert this to php

$tmp = $ENV{'QUERY_STRING'};
@pairs = split(/&/, $tmp);

foreach $item (@pairs) {
 ($key, $content) = split(/=/,$item,2);
 $content =~ tr/+/ /;
 $content =~ s/%(..)/pack("c",hex($1))/ge;
 $fields{$key} = $content;
}



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




[PHP] Re: Smarty + JavaScript

2001-09-08 Thread John Lim

>From the smarty manual

{literal}





{/literal}

Alternately use ldelim,rdelim

Bye, John
"Alexander Deruwe" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hey all,
>
> If anyone else out there is using Smarty as templating engine, how do you
put
> JavaScript into the template? It seems to barf on the opening and closing
> braces of every JS function, rendering JS totally useless. I must be
missing
> something.
>
> ad.



-- 
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: manage a mail archive

2001-09-08 Thread B. van Ouwerkerk

I pointed you to sources where you can find the information you need.

I don't run ezmlm with mysql support so I would need to look at the docs 
too. I'm very sorry but I don't have enough time to do the dirty work for you.

I'm not even sure about how far ezmlm and MySQL work together.. A friend 
told me he was going to put all messages in a MySQL database but I'm not 
sure if it's a default feature or his own coding.

I suggest you go to the sources mentioned previous and browse a little.

Bye,


B.


>How do I retrieve the messages from the list archive and how do i store 
>the data in text files/database .
>Pl. help me out.
>thanks
>cp


-- 
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] Smarty + JavaScript

2001-09-08 Thread Alexander Deruwe

Hey all,

If anyone else out there is using Smarty as templating engine, how do you put 
JavaScript into the template? It seems to barf on the opening and closing 
braces of every JS function, rendering JS totally useless. I must be missing 
something.

ad.

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




[PHP] Re: include problem

2001-09-08 Thread Gaylen Fraley

Provide an absolute path to the file, like /path/path1/incl.txt instead of a
URL.


<[EMAIL PROTECTED]> wrote in message
003701c13854$50ecf780$0100a8c0@pentium333">news:003701c13854$50ecf780$0100a8c0@pentium333...
Hi

I have a little Problem with include.I want to include a txt file in every
php file on the server but some php files are in other directories and dont
include this txt file.

Example :

Url for the txt file : www.domain.com/include/incl.txt

So www.domain.com/index2.php includes the txt file correctly but
www.domain.com/shop/shop.php dont do this.

In the include command i used the serverpath to the txt file.

So what should i do ?
Thanks for support !

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] Re: manage a mail archive

2001-09-08 Thread crorepati

hello

How do I retrieve the messages from the list archive and how do i store the 
data in text files/database . 

Pl. help me out. 

thanks
cp 

 

B. van Ouwerkerk writes: 

> You can use MySQL. Take a look at the ezmlm homepage, and check the ezmlm 
> mailinglist archive.. 
> 
> Pulling data out of a MySQL table is easy.. if you don't know how, just 
> look at some tutorials (www.devshed.com) more links can be found at 
> www.php.net 
> 
> Bye, 
> 
>  
> 
> B. 
> 
> 
> At 20:28 8-9-01 +, crorepati wrote:
>> Hello, 
>> 
>> We are using ezmlm mailing list on our server.
>> We want to make the mailing list archive available on our website. How 
>> can we do this ?
>> any help will be highly appreciable. 
>> 
>> thanks
>> cp
> 
 

-- 
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] error with socket

2001-09-08 Thread sagar

hi,

I'm using win98/apache/php4
But it's giving an error saying undefined function when i use socket() function.
On advice of some one i've also tried socket_create(). but in vain.
I think that i dont have the socket libs in my php. where can i get them.
do u think that i'm correct ?

pl help as soon as possible.

/sagar




[PHP] Problem with Encoding

2001-09-08 Thread Harry Lau

I want to include a string into a PNG by ImageTTFText(),
where some of the chars are encoded in BIG5.
I have found the revalent TTF for BIG5.

The output really gives some Traditional Chinese chars,
but the chars are not those I want.
(I think this problem also exist in Shift-JIS encoding.)

Would anyone give me some suggestions?
Thanks a lot :)

Harry





-- 
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] cURL support

2001-09-08 Thread Daniel Baldoni

G'day folks,

I have a site just about ready to go on-line.  All my local testing has
worked like a dream - but the cURL support on the hosting provider is
partially broken.

Actually using curl_init()...curl_exec() etc. on my box to contact remote
URIs (both over HTTP and HTTPS) has worked from day 1 (with versions 4.0.4p1,
4.0.5 and 4.0.6).

On the hosting provider, HTTPS connections don't work.  But, I'm told the
command-line version of curl does work.

So, my question is - what gives?  Are there known (intermittent) problems
with support for cURL or have the provider's staff "done something" during
the build of curl and/or PHP?

Any help would be much appreciated as I really don't like the idea of palming
off access to secure sites to yet another external program.  Thanks for any
information.

Ciao.

-- 
---+-
Daniel Baldoni BAppSc, PGradDipCompSci |  Technical Director
require 'std/disclaimer.pl'|  LcdS Pty. Ltd.
---+  856B Canning Hwy
Phone/FAX:  +61-8-9364-8171|  Applecross
Mobile: 041-888-9794   |  WA 6153
URL:http://www.lcds.com.au/|  Australia
---+-
"Any time there's something so ridiculous that no rational systems programmer
 would even consider trying it, they send for me."; paraphrased from "King Of
 The Murgos" by David Eddings.  (I'm not good, just crazy)

-- 
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] manage a mail archive

2001-09-08 Thread B. van Ouwerkerk

You can use MySQL. Take a look at the ezmlm homepage, and check the ezmlm 
mailinglist archive..

Pulling data out of a MySQL table is easy.. if you don't know how, just 
look at some tutorials (www.devshed.com) more links can be found at www.php.net

Bye,



B.


At 20:28 8-9-01 +, crorepati wrote:
>Hello,
>
>We are using ezmlm mailing list on our server.
>We want to make the mailing list archive available on our website. How can 
>we do this ?
>any help will be highly appreciable.
>
>thanks
>cp


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




[PHP] Re: a general perl like pares of the query string...

2001-09-08 Thread CC Zona

In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Aaron Moore) wrote:

> Ok if you have a query string from like file.php?bob=manager&phil=employ
> 
> how do i split the bob=manager and phil=employ dynamically?
> 
> because i may have 2 or 3 elements and i just want to sepearte them all and
> access them via an array such as if ($var["bob"] = "manager")

If track_vars is on (always true if version >= 4.0.3), then the global vars 
$HTTP_GET_VARS['bob'] and $HTTP_GET_VARS['phil']  are already set.

And if register_globals is on, then the global vars $bob and $phil are also 
already set.

See .

-- 
CC

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




[PHP] session_name causes break

2001-09-08 Thread Christian Haines

hi all,

has anyone else had problems with specifying session_name causing data not
being input into session variables?

For example:

session_name("test");
session_start();
session_register("count");
count++;

causes count not to increment whereas

session_start();
session_register("count");
count++;

with the default PHPSESSID works 



many thanks in advance
christian


-- 
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] creating ZIP file from mySQL content?

2001-09-08 Thread BRACK

I have a site where ppl can upload their text-based ideas in real 
time, so that I have new records in db every day. When I did 
uploading by hands and had over 200 files on that site I distributed 
all site content in downloadable for of zipped win-help formate. 
Well, I don't think that I can do help file dinamically but what about 
normal zip file. Can I create the script which would do it for me 
(creating zip-file of all records in db dynamically)?

Youri
<>< <>< <>< <>< God is our provider ><> ><> ><> ><> 
http://www.body-builders.org

-- 
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] optimize question

2001-09-08 Thread Michele Schiavo

Is most performant for out a sting use
echo or print ?
and if I have more print command ex:
print "aaa",
print "";

Is best use a single command with a very long string ?

Thank's michele Schiavo



-- 
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: run a script for any HTTP request (was: run a script on access to a directory)

2001-09-08 Thread Geoff Caplan

Enrique

> On Fri, 7 Sep 2001, Enrique Vadillo wrote:

> > I am thinking now that i'd like to make it possible that for
> > ANY http request received by my Apache i'd like to have a php
> > script executed first

I do this all the time - it offers all kinds of advantages.

This link explains why and how to do this

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

 My own appoach is to use Apache mod_rewrite to direct all requests to my
"main" script, but leave one directory free for conventional .html or .php
files. You need something like this in your Apache configuration -

RewriteEngine on
RewriteRule !^/my_conventional_directory(.*) /my_main_file.php [nocase]

This means: "if request is not for my conventional directory, run my main
script"

Cheers

Geoff Caplan


-- 
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] include problem

2001-09-08 Thread mail

Hi

I have a little Problem with include.I want to include a txt file in every php file on 
the server but some php files are in other directories and dont include this txt file.

Example :

Url for the txt file : www.domain.com/include/incl.txt

So www.domain.com/index2.php includes the txt file correctly but 
www.domain.com/shop/shop.php dont do this.

In the include command i used the serverpath to the txt file.

So what should i do ?
Thanks for support !

chris



[PHP] a general perl like pares of the query string...

2001-09-08 Thread Aaron Moore

Ok if you have a query string from like file.php?bob=manager&phil=employ

how do i split the bob=manager and phil=employ dynamically?

because i may have 2 or 3 elements and i just want to sepearte them all and
access them via an array such as if ($var["bob"] = "manager")

etc so a loop that would parse the & and also the = signs

appreciate the help



-- 
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] [-= Your Vacation Winning =-]

2001-09-08 Thread Tessy103

You have been specially selected to qualify for the following:

Premium Vacation Package and Pentium PC Giveaway
To review the details of the please click on the link 
with the confirmation number below:

http://wintrip.chn.net
or
http://wintrip.my163.com

Confirmation Number#Lh340
Please confirm your entry within 24 hours of receipt of this confirmation.

Wishing you a fun filled vacation!
If you should have any additional questions or cann't connect to the site 
do not hesitate to contact me direct:
mailto:[EMAIL PROTECTED]?subject=Help!

-- 
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] manage a mail archive

2001-09-08 Thread crorepati

Hello,

We are using ezmlm mailing list on our server. 

We want to make the mailing list archive available on our website. How can 
we do this ? 

any help will be highly appreciable. 


thanks 

cp

-- 
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] Ordering a query

2001-09-08 Thread Matthew Loff


You could insert a ternary operation...

($order?$order:"defaultfield")

Is the same as:

if($order) 
echo $order;
else
echo "defaultfield";

...

$result = mysql_query("SELECT
articles.title,vote.votes,vote.total,articles.date,staff.firstname,artic
les.content,articles.id FROM staff,articles,vote WHERE articles.authorid
= staff.id AND articles.id = vote.item ORDER BY ".
($order?$order:"defaultfield") ." DESC",$db);


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Friday, September 07, 2001 10:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Ordering a query


I use the following code to order the results of the query by the
variable $order.

$result = mysql_query("SELECT
articles.title,vote.votes,vote.total,articles.date,staff.firstname,artic
les.content,articles.id FROM staff,articles,vote WHERE articles.authorid
= staff.id AND articles.id = vote.item ORDER BY `$order` DESC",$db);

I assign the variable a value according to my url,
http://www.mysite.com/file.php?order=something

My question is. Is there a way of assigning the $order variable a
default value? Like if they hit http://www.mysite.com/file.php without
the order=something can I tell the script to assign $order a default
value?

Thanks,
Nate


-- 
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]