Re: [PHP] sessions and trans-sid problem/question

2002-11-24 Thread Jean-Christian Imbeault
Michael Sims wrote:


I 'm not where I can test this right now, but if a session is older
than session.gc_maxlifetime, isn't it invalid anyway?  I.E. if I
bookmark a page on your site and then come back 3 hours later passing
an old SID, shouldn't that session have expired on the server by that
time, in which case the session vars would be empty and you could kick
me back to your login page?


If my understanding of sessions is correct, no.

session.gc_maxlifetime does set the lifetime of a session, but a session 
will not be cleaned by PHP until session.gc_probability has been hit. 
Again, if my understanding is correct, PHP doesn't automatically check 
to see if a session has expired before accessing it. It pre-supposes 
that any session file lying around is till active. And those session 
file will stay there until session.gc_probability has been hit.

I might be wrong though ...

Jc


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



Re: [PHP] sessions and trans-sid problem/question

2002-11-24 Thread Jean-Christian Imbeault
Michael Sims wrote:


Then I suppose it's just an added feature of the session handler I am
using.  Maybe the OP should give it a shot, as I use it and I
definitely don't have a problem with expired sessions


I'll think about writing my own session handler as it can be quite 
useful. However I need to evaluate the amount of extra disk read/writes 
it would add. Using a DB vs the file system does add some overhead ...

Jc


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



[PHP] does //commenting reduce performance?

2002-11-24 Thread Adam
I have always had the opinion that the more comments you put into php
scripts, the slower they will run because there is more data to be read...
Can someone tell me if there is any truth in this or whether commenting has
absolutely 'no' impact on the performance of a script?

Thanks,
Adam.



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




[PHP] Newbie: element index array

2002-11-24 Thread Michael Wai
If I declared an element indexed array and put some values into it:

$a['element1'] = array('btime' = '19D', 'etime' = '22D', 'dayname' = 4);
$a['element2'] = array('btime' = '12D', 'etime' = '20D', 'dayname' = 2);
$a['element3'] = array('btime' = '15D', 'etime' = '17D', 'dayname' = 3);

I would like to ask that how can I completely delete the $a['element2'] in
the array? That's mean I will get 'false' in 'isset($a['element2']) after
the delete process is taken place.

Thanks for your help.

Regards,
Michael Wai



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




php-general Digest 24 Nov 2002 09:23:29 -0000 Issue 1723

2002-11-24 Thread php-general-digest-help

php-general Digest 24 Nov 2002 09:23:29 - Issue 1723

Topics (messages 125739 through 125772):

Re: using cookies
125739 by: Paul Marinas
125742 by: Rich Gray
125754 by: Chris Shiflett

Re: Using Ping (was: using cookies)
125740 by: Marco Tabini

Passing Variables
125741 by: Craig Edgmon
125743 by: Marco Tabini
125745 by: Rich Gray
125749 by: Stephan Seidt

Re: Php search results]
125744 by: Tom Culpepper

Re: grabbing data from a site
125746 by: Tom Culpepper

Re: put result of include into a variable
125747 by: Tom Culpepper

Re: dynamic arraynames
125748 by: Floyd Baker
125753 by: Hugh Danaher

logs(querystring) in php4 or apache?
125750 by: Frank Wang

PHP Syntax - mail statement
125751 by: Michael Sharp
125752 by: Marco Tabini

strings and vars
125755 by: empty
125756 by: Kyle Gibson
125757 by: Ernest E Vogelsinger
125758 by: empty

Parse URLs
125759 by: Stephen
125760 by: Tom Culpepper
125761 by: Stephen
125762 by: Tom Culpepper

getting mysql dump using php
125763 by: See Kok Boon
125764 by: Rich Gray
125765 by: Morgan Hughes

Secureing PHP.
125766 by: Steven Adams
125767 by: Stephan Seidt

Re: sessions and trans-sid problem/question
125768 by: Jean-Christian Imbeault
125769 by: Jean-Christian Imbeault
125770 by: Jean-Christian Imbeault

does //commenting reduce performance?
125771 by: Adam

Newbie: element index array
125772 by: Michael Wai

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]


--

---BeginMessage---

dose anyone how to send a ping in local network

thanks

Paul Marinas
Technical Support
RDS Craiova


Phone:  +402-51-410-194
Mobile: +407-22-451-439
Fax:+402-51-416-579
www.rdsnet.ro
.

Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this
message (or responsible for delivery of the message to such person), you may
not copy or deliver this message to
anyone. In such a case, you should destroy this message and kindly notify
the sender by reply e-mail.



---End Message---
---BeginMessage---
Try the system() or passthru() functions...

Rich
-Original Message-
From: Paul Marinas [mailto:[EMAIL PROTECTED]]
Sent: 23 November 2002 13:09
To: Rich Gray
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] using cookies



dose anyone how to send a ping in local network

thanks

Paul Marinas
Technical Support
RDS Craiova


Phone:  +402-51-410-194
Mobile: +407-22-451-439
Fax:+402-51-416-579
www.rdsnet.ro
.

Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this
message (or responsible for delivery of the message to such person), you may
not copy or deliver this message to
anyone. In such a case, you should destroy this message and kindly notify
the sender by reply e-mail.



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




---End Message---
---BeginMessage---
--- Ken Nagorski [EMAIL PROTECTED] wrote:

 I have never used cookies before, however I am trying to
 implement them to make things a little more secure. Rather
 than passing a sql statement via a hidden input tag I am
 setting a cookie.

I think someone else already mentioned this, but let me emphasize
that this is a terrible idea and definitely does not make things a
little more secure.

The best analogy I can think of for a cookie would be handing out
name tags to people who visit your site. Imagine that you write the
following SQL on someone's name tag:

select * from foo where unique_id='12345'

This helps you distinguish them from the next person who may have a
unique identifier of 23456. While this might work for those who play
by the rules, you are placing a tremendous amount of trust in these
people. What if someone erased what you wrote on their name tag,
replacing it with this:

delete from foo

If you were to trust this person's name tag the next time you saw
them, you would delete all of the data from that table.

In addition to this, hidden form variables are just as bad. It is a
different method, but you are still basically sending something to
the client and just trusting the client to return exactly what you
sent. Placing so much trust in the client is never a good idea.

I would recommend abandoning these methods for anything that you, as
you say, are wanting to make more secure. Look into using sessions
instead. When you use 

Re: [PHP] Newbie: element index array

2002-11-24 Thread Chase Urich
unset($a['element2']);

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

 I would like to ask that how can I completely delete the $a['element2'] in
 the array? That's mean I will get 'false' in 'isset($a['element2']) after
 the delete process is taken place.
-- 
Linux: Because rebooting is for adding hardware.
Fingerprint = CE24 057D 1E88 A253 3196 89DB 9FF0 9EF0 2F70 8BE8 BE8



signature.asc
Description: This is a digitally signed message part


[PHP] Re: Newbie: element index array

2002-11-24 Thread Kyle Gibson
If I declared an element indexed array and put some values into it:

$a['element1'] = array('btime' = '19D', 'etime' = '22D', 'dayname' = 4);
$a['element2'] = array('btime' = '12D', 'etime' = '20D', 'dayname' = 2);
$a['element3'] = array('btime' = '15D', 'etime' = '17D', 'dayname' = 3);

I would like to ask that how can I completely delete the $a['element2'] in
the array? That's mean I will get 'false' in 'isset($a['element2']) after
the delete process is taken place.

Thanks for your help.


Use unset()

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

--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/


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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread Kyle Gibson
I have always had the opinion that the more comments you put into php
scripts, the slower they will run because there is more data to be read...
Can someone tell me if there is any truth in this or whether commenting has
absolutely 'no' impact on the performance of a script?


The comments are ignored, except the characters that initiate the actual 
comment.

//some comment
$somevar=va;

some comment wouldn't even be looked at. PHP sees the //, and goes to 
the next line.

I suppose on a large scale this could reduce performance, but the 
performance that is lost in standard applications is minuscule.

One thing you might want to avoid is using comments inside loops.


--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/


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



[PHP] Creating mySql search feature.....

2002-11-24 Thread Cookra
Hi all,
Need a little help here been at this for a while now...

I have a database holding a table which in turn holds a collection of fields
I need to search.

Ive set up search form that sends the variable $S_For and $S_From, these
variables represent the following:

$S_For = the search keyword itself
$S_From = the column which I need to search

Ive created this and it works fine for single words, the problem as you may
of guessed is when I enter a string of words ie:

apple - works fine

orange - works fine

apple orange - doesnt

Any help would be ideal

-

Databse = clientacc
Table = hospitality

-

Everything else works on my site apart from this search
feature.. please help!


Regards

R



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




[PHP] Re: Creating mySql search feature.....

2002-11-24 Thread Jean-Christian Imbeault
Cookra wrote:


Any help would be ideal


Some code would be nice. Youdidn't post any code so we have no idea what 
your problem might be ... do you get an error message, or no results, or 
the wrong results?

We don't even what what SQL query you are using ...

Jc


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



Re: [PHP] Creating mySql search feature.....

2002-11-24 Thread Hatem Ben
Hello,

What you need is :
1- parse your query and make it boolean
apple orange  become apple and orange and so on

2- then you can generate a MySQL query based on that like this way

---
SELECT id, field1
match (field1) against (' apple orange ') as relevance
FROM hospitality
WHERE
match (field1) against ('apple')0 AND match (field1) against ('orange')0
HAVING relevance0
ORDER BY relevance DESC
---

field1 will be your field(s) you're searching in.

Hope this will help
Hatem


Cookra [EMAIL PROTECTED] a écrit dans le message de news:
[EMAIL PROTECTED]
 Hi all,
 Need a little help here been at this for a while now...

 I have a database holding a table which in turn holds a collection of
fields
 I need to search.

 Ive set up search form that sends the variable $S_For and $S_From, these
 variables represent the following:

 $S_For = the search keyword itself
 $S_From = the column which I need to search

 Ive created this and it works fine for single words, the problem as you
may
 of guessed is when I enter a string of words ie:

 apple - works fine

 orange - works fine

 apple orange - doesnt

 Any help would be ideal

 -

 Databse = clientacc
 Table = hospitality

 -

 Everything else works on my site apart from this search
 feature.. please help!


 Regards

 R



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


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




Re: [PHP] sessions and trans-sid problem/question

2002-11-24 Thread Ernest E Vogelsinger
At 08:47 24.11.2002, Jean-Christian Imbeault said:
[snip]
Ernest E Vogelsinger wrote:
 
 if ($_COOKIE[$_SESSION['cookie_name']] == $_SESSION['cookie_token']) {

Ok, please forgive my ignorance, but in PHP isn't $_COOKIES the same as 
$_SESSION?. I thought it was if the user had cookies turned off (and 
even if the user had cookies turned on come to think of it) ... If not 
I'm in trouble.

I was always under the impression that $_SESSION vars were passed as 
cookies ...
[snip] 

No, that's a misunderstanding. Session var's are never passed to and from
the client, only the session _name_ is passed, either via a cookie
(PHPSESSIONID) or via trans-sid href encoding.

Session vars are kept server-side in session storage, which is (by default)
a file located in the directory where session.save_path is pointing to. The
default file name  is sess_session-identifier. The client only transmits
the session identifier so the server is able to correlate a session to a
particular request.

What I did for this particular application was to extend the system with a
cookie that's programmatically sent, using a random cookie name and a
random cookie content. Thus I am able to distinguish between multiple
logical sessions using the same session identifier, a scenario that could
happen when a URL containing a trans-sid has been bookmarked or transfered,
or when the client had opened a new window within the same session and
continued in split mode.

Whatever the client passes to PHP as a cookie you can access in the
$_COOKIES array. Whatever PHP has stored in session storage can be accessed
in the $_SESSION array. They are quite different.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] sessions and trans-sid problem/question

2002-11-24 Thread Ernest E Vogelsinger
At 08:56 24.11.2002, Jean-Christian Imbeault said:
[snip]
session.gc_maxlifetime does set the lifetime of a session, but a session 
will not be cleaned by PHP until session.gc_probability has been hit. 
Again, if my understanding is correct, PHP doesn't automatically check 
to see if a session has expired before accessing it. It pre-supposes 
that any session file lying around is till active. And those session 
file will stay there until session.gc_probability has been hit.

I might be wrong though ...
[snip] 

You're quite right :=


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread DL Neil
Adam,

 I have always had the opinion that the more comments you put into php
 scripts, the slower they will run because there is more data to be read...
 Can someone tell me if there is any truth in this or whether commenting
has
 absolutely 'no' impact on the performance of a script?


An answer proposed that there was little impact, but then suggested comments
not be used within loops (one presumes from this, the concern is that even a
little impact can mount up when repeated many times).

Why don't you run a microtime testbench to time a commented and an
uncommented loop, settle your mind, and report back with REAL information!?

Computer programming is the embodiment of 'write once, run many' manta.
Comments are no use at all during execution, but should be intended to be of
considerable assistance during the writing/maintaining phases. Never give
anyone an excuse for not writing (meaningful) comments - enough energy
already goes into creative excuses for that - and you may be the next to
suffer from some predecessor's arrogance! There are routines available which
take in a developer's script and output a comment-less, stripped-down for
maximum slipstream, dense code, version - ready for execution.

Regards,
=dn


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




[PHP] get info of sub-directories

2002-11-24 Thread gamin
Hi,

   i wanted to know if given a certain dir it is possible to get all the
sub-directories and files in an XML document. There could be many ways to do
this, just wandering if anybody has already done this.

thx in advance

gamin.



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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread Ernest E Vogelsinger
At 09:42 24.11.2002, Adam said:
[snip]
I have always had the opinion that the more comments you put into php
scripts, the slower they will run because there is more data to be read...
Can someone tell me if there is any truth in this or whether commenting has
absolutely 'no' impact on the performance of a script?
[snip] 

As PHP is an interpreter it needs to scan every line and every token of
code as it runs it. Thus said, of course using comments takes more time to
execute than having no comments.

I have no profiling yet how much having comments or blank lines would
actually effect execution times, but I doubt it would be really an issue
since PHP, once a comment start is encountered, doesn't parse the text but
just scans for the end-comment tag.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




[PHP] Re: [PHP-WIN] Unable to upload.. :(

2002-11-24 Thread Boris Kolev
This is a forwarded message
From: Boris Kolev [EMAIL PROTECTED]
To: toby z [EMAIL PROTECTED]
Date: Sunday, November 24, 2002, 2:02:09 PM
Subject: [PHP-WIN] Unable to upload.. :(

===8==Original message text===
Hello toby,

Sunday, November 24, 2002, 1:04:25 PM, you wrote:

tz Hi all
tz I am trying to upload a file. It works fine on my local Apache, but
tz gives me Permission denied to create file error on my online host..
tz Any clue???

tz $file = $_FILES['userfile']['tmp_name'];
tz if (is_uploaded_file($file)) 
tzprint_r(Copying .$file);
tz  if (copy($file, ./files/. $_FILES['userfile']['name'])) 
tz   echo(Success);

tz  else
tz   echo(Failure);


tz __
tz Do You Yahoo!?
tz Everything you'll ever need on one web page
tz from News and Sport to Email and Music Charts
tz http://uk.my.yahoo.com

Hi
because online apache use user to create files in folder but your
administrator must give rights(access) to tish user in this folder to
create files :))

-- 
Best regards,
 Borismailto:[EMAIL PROTECTED]


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




Re: [PHP] sessions and trans-sid problem/question

2002-11-24 Thread Jean-Christian Imbeault
Ernest E Vogelsinger wrote:


No, that's a misunderstanding. Session var's are never passed to and from
the client, only the session _name_ is passed, either via a cookie
(PHPSESSIONID) or via trans-sid href encoding.


Thanks for clearing that up! I hadn't realized that only the session 
name was passed around. I thought all the session data was too.

This now hands me a dilemma ... I was building my site conservatively, 
i.e. assuming the user would have cookies turned off. And so I am making 
heavy use of session variables. *But* I had thought that if the user had 
cookies enabled then the variables would be saved as cookie information, 
hence saving my server a lot of disk reads and writes. Now you have 
shown me the err of my ways ...

I have to consider rewriting my scripts so that if cookies *are* enabled 
the session information is sent has cookie data. Hum ... I hate 
re-writes 

Jc


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



[PHP] getting mysql dump using php

2002-11-24 Thread See Kok Boon
hi Rich,

yes think i need more info to the mysqldump utility. i suppose you mean
there is in fact this utility?

-Original Message-
From: Rich Gray [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 24, 2002 8:14 PM
To: See Kok Boon; PHP
Subject: RE: [PHP] getting mysql dump using php


Answer is No. 2)

Use cron to run the mysqldump utility instead of a php script.
Let me know if you need more info.

Cheers
Rich





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




[PHP] Stripslashes through an array.........

2002-11-24 Thread Cookra
Hi all is it possible to stripslahes from this query?



$results = mysql_query(SELECT * FROM $DB_Table_A ORDER BY name ASC LIMIT
$page, $limit);

while ($data = (mysql_fetch_array($results)))
{
//-- something here would be nice
}


Thanks..



Regards

R



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




[PHP] backticks vs Safe Mode

2002-11-24 Thread Vincent Starre
I can think of no security reason why you would want to allow anyone to 
display output from a command, but wouldnt want them to be able to assign 
that output to a variable. Can someone explain a situation where that would 
be useful? Arent any security concerns addressed by the safe_mode_exec_dir= 
directive? Is there any way to get the safety of safe mode without this 
seemingly backwards rule? [If I was a malicious user with the ability to 
upload a script, I certainly wouldnt be at all hindered by being unable to 
have the script itself parse the output- I'd get a seperate script to do that 
for me and POST the results back to the server's script just as fast.]

{The intent of this message is to find a way to circumvent this idiocy, to be 
noticed by a developer who will go oops, did we leave that idiocy in? or to 
be presented with an explanation for what is seemingly, idiocy. }

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




[PHP] getting mysql dump using php

2002-11-24 Thread See Kok Boon
thanks Morgan,

i am sure your script will do a great job... unfortunately, crontab returns
/bin/mail permission denied... and i cant chage system settings because i am
not the WSP (or ISP)

actually... i am thinking of something really silly.. but it will work
surely... and that is to use SELECT * then use a loop to format the
results into a database dump (data and structure) and then email the content
to myself. how's that?

-Original Message-
From: Morgan Hughes [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 24, 2002 12:35 PM
To: PHP
Subject: RE: [PHP] getting mysql dump using php


On Sun, 24 Nov 2002, Rich Gray wrote:

 Answer is No. 2)
 Use cron to run the mysqldump utility instead of a php script.
 Let me know if you need more info.

  I use this one with crontab, it works pretty well, if your email program
  can handle uuencode:


#!/bin/sh
# File: db_backup.sh
# Descript: Runs a ful mysqldump of one or more MySQL databases, uuencodes
#   and compresses them, and mails them to a specified address.
#   Requires mysqldump, gzip, uuencode, mail or mailx, and crontab.
#
#   Normally this run from crontab, with an entry like:
# 0 3 * * * sh ~/db_backup
#
# Version : 1.00
# Author  : Morgan Hughes ([EMAIL PROTECTED])
# License : Copyright (C) 2002, Morgan Hughes.  Use freely.


# Account/password/email info
db_list=your_database
db_user=your_username
db_pass=your_password
email=your_email_addy

# program locations
mysqldump=mysqldump
dump_opts=
uuencode=uuencode
gzip=gzip
mail=mail

# Actual code
for db_name in $db_list ; do

date=`date '+%Y%m%d-%H%M%S'`
$mysqldump $dump_opts -u $db_user --password=$db_pass $db_name | \
$gzip -c9 | $uuencode $db_name-$date.sql.gz | \
$mail -s DB backup, $db_name, $date $email

done

# Ends: db_backup.sh



  At home I have a script plugged into .procmailrc with an entry like:

# First off, catch inbound automated backups.
:0
* ^Subject: DB backup, kyhm
| ~/bin/catch_backup ~/kyhm.com/backups/db



  The ~/bin/catch_backup script is as follows:

#!/bin/sh
if [ $1 !=  -a -d $1 ] ; then
cd $1
else
cd ~
fi
cat | uudecode



  Hope this is useful...

--
   Morgan Hughes
   C programmer and highly caffeinated mammal.
   [EMAIL PROTECTED]
   ICQ: 79293356



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




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




Re: [PHP] sessions and trans-sid problem/question

2002-11-24 Thread Justin French
on 24/11/02 11:10 PM, Jean-Christian Imbeault ([EMAIL PROTECTED]) wrote:

 This now hands me a dilemma ... I was building my site conservatively,
 i.e. assuming the user would have cookies turned off. And so I am making
 heavy use of session variables. *But* I had thought that if the user had
 cookies enabled then the variables would be saved as cookie information,
 hence saving my server a lot of disk reads and writes. Now you have
 shown me the err of my ways ...
 
 I have to consider rewriting my scripts so that if cookies *are* enabled
 the session information is sent has cookie data. Hum ... I hate
 re-writes 

I'd leave it as is... this ensures that ALL users can use the site, because
the session id can be passed around in either the URL or cookies... and
enabling trans sid means you don't even have to worry about it... PHP will
use cookies if possible, or else append it to the URLs.

What sort of stuff are you storing in the session that your are worried
about with too many writes?



Justin French

http://Indent.com.au
Web Development  
Graphic Design



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




[PHP] Huffman encoding

2002-11-24 Thread Hatem Ben
Hey all

I'm looking to implement the huffman encoding in PHP, but i would like to
ask if it isn't already done ? (why reinventing the wheel)

Thx
Hatem


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




Re: [PHP] getting mysql dump using php

2002-11-24 Thread @ Edwin
Hello,

...seems like Rich is not available yet so let me try :)

See Kok Boon [EMAIL PROTECTED] wrote:

 hi Rich,

 yes think i need more info to the mysqldump utility. i suppose you mean
 there is in fact this utility?

Well, most probably you'll be able to find it inside your mysql/bin
directory.

Check the manual for more info:

  http://www.mysql.com/doc/en/mysqldump.html

And of course you can google for some related info ;)

  http://www.google.com/search?hl=enie=UTF-8oe=UTF-8q=mysqldump

HTH,

- E

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




Re: [PHP] sessions and trans-sid problem/question

2002-11-24 Thread Jean-Christian Imbeault
Justin French wrote:


What sort of stuff are you storing in the session that your are worried
about with too many writes?


Oh, this site is just your regular, run-of-the-mill, amazon.com copy.

For each open session I store up to 20 variables. It's not a lot, but 
each access to a script means a disk read/write so they will eventually 
add up if there are enough users.

Of course this problem goes away if you throw enough money at the 
hardware ...

Jc


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



[PHP] Re: Huffman encoding

2002-11-24 Thread Jean-Christian Imbeault
Hatem Ben wrote:


I'm looking to implement the huffman encoding in PHP, but i would like to
ask if it isn't already done ? (why reinventing the wheel)


You have highjacked someone else's thread. Not very nice of you 

Please repost and start your own message thread ... highjacked threads 
rarely get any responses ...

Jc

PS the reason you highjacked the thread is that you used the reply 
button while reading a post and simply deleted the subject. That is not 
good.

To post a new question use the new message or compose button of your 
newsgroup reader. That is good.


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



Re: [PHP] Secureing PHP.

2002-11-24 Thread @ Edwin
Hello,

Steven Adams [EMAIL PROTECTED] wrote:

 Hi,
 I am looking to secure my php install, like the settings in php.ini
etc.

 I am using apache 1.3.27 and running latest php.

 Is there like a tut or something that can take u thought the php.ini and
 explain ina little more detail?

 safe_mode = Off

 is that a bad idea or should i leave it on..

I suggest you leave it on. (Never really had any reason myself to turn it
on.)

More info in the manual:

  http://www.php.net/manual/en/features.safe-mode.php

- E

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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread Ernest E Vogelsinger
At 12:58 24.11.2002, DL Neil said:
[snip]
Why don't you run a microtime testbench to time a commented and an
uncommented loop, settle your mind, and report back with REAL information!?
[snip] 

Some time ago I've made myself a framework for such tests and have run it
against a commented loop. This test was run on a dual PIII/1000 Dell server.

$hpr = _fwx_profile_start('Loop with end-of-line comment', true);
for ($i = 0; $i  100; ++$i) {
$a += 1;// this is an end-of-line comment
}
_fwx_profile_end($hpr, $i);
Average time per loop: 0.059 msec

$hpr = _fwx_profile_start('Loop with inline comment', true);
for ($i = 0; $i  100; ++$i) {
/* this is an inline comment */ $a += 1;
}
_fwx_profile_end($hpr, $i);
Average time per loop: 0.059 msec

$hpr = _fwx_profile_start('Loop without comment', true);
for ($i = 0; $i  100; ++$i) {
$a += 1;
}
_fwx_profile_end($hpr, $i);
Average time per loop: 0.059 msec

Conclusio: I didn't find any measurable difference in these loops, be it an
end-of-line comment, an inline comment, or no comment.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread @ Edwin
Hello,

Ernest E Vogelsinger [EMAIL PROTECTED] wrote:

 As PHP is an interpreter it needs to scan every line and every token of
 code as it runs it. Thus said, of course using comments takes more time to
 execute than having no comments.

 I have no profiling yet how much having comments or blank lines would
 actually effect execution times, but I doubt it would be really an issue
 since PHP, once a comment start is encountered, doesn't parse the text but
 just scans for the end-comment tag.

That said, it's reasonable to think that

//
//  I
//  have
//  long
//  comments
//  that
//  extends
//  hundreds,
//  if not,
//  thousands
//  of lines.
//  Just kidding! :)
//

  would be faster (unnoticeable it may be) than

/* -

 I
 have
 long
 comments
 that
 extends
 hundreds,
 if not,
 thousands
 of lines.
 Just kidding! :)

- */

Anyway, it's *always* better to have comments than nothing at all...

- E

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




Re: [PHP] Huffman encoding / almost done

2002-11-24 Thread Hatem Ben
Sorry for the last email (i wasn't looking to highjack any thread :( very sorry guys !)


- Original Message - 
From: Hatem Ben [EMAIL PROTECTED]
To: PHP [EMAIL PROTECTED]
Sent: Sunday, November 24, 2002 2:06 PM
Subject: [PHP] Huffman encoding


 Hey all
 
 I'm looking to implement the huffman encoding in PHP, but i would like to
 ask if it isn't already done ? (why reinventing the wheel)
 
 Thx
 Hatem
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sessions and trans-sid problem/question

2002-11-24 Thread Ernest E Vogelsinger
At 13:10 24.11.2002, Jean-Christian Imbeault said:
[snip]
This now hands me a dilemma ... I was building my site conservatively, 
i.e. assuming the user would have cookies turned off. And so I am making 
heavy use of session variables. *But* I had thought that if the user had 
cookies enabled then the variables would be saved as cookie information, 
hence saving my server a lot of disk reads and writes. Now you have 
shown me the err of my ways ...

I have to consider rewriting my scripts so that if cookies *are* enabled 
the session information is sent has cookie data. Hum ... I hate 
re-writes 
[snip] 

Why would you do that? session data is read and decoded once from a LOCAL
file, while transmitting all session data over a REMOTE line would be much
slower. Further it's MORE than insecure to hand possibly sensitive session
data to the client where any bad guy might tamper with it and harm your
application. Lastly cookies are limited to a certain size of data (I
believe it's 1k but I don't know exactly).

Use sessions as intended, it's a very well tested and very fast way to
create a persistent state across multiple subsequent connections.

If you don't like the file approach you can always invent your own session
handling system, be it database-driven (which would be even slower), or
some kind of session-server process that runs locally and gets contacted by
the applications, or even some shared memory... choose your ways, but keep
your data at the server's.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] sessions and trans-sid problem/question

2002-11-24 Thread Ernest E Vogelsinger
At 14:15 24.11.2002, Jean-Christian Imbeault said:
[snip]
Oh, this site is just your regular, run-of-the-mill, amazon.com copy.

For each open session I store up to 20 variables. It's not a lot, but 
each access to a script means a disk read/write so they will eventually 
add up if there are enough users.

Of course this problem goes away if you throw enough money at the 
hardware ...
[snip] 

Assuming you're running a server operating system (either Linux, or other
X, or even Win2K _server_) disk i/o gets already greatly reduced by the OS.
Any server OS implements its own decent file i/o cache that leverages
repeated disk i/o transparently. I wouldn't bother about that too much.

What you should keep in mind that the OS needs enough memory to build up
its decent cache. Which would mean that you plug in more memory banks the
more users you have. If you suspect your server is slowing down because of
disk i/o why not run a realtime performance log to see where bottlenecks
are, and to act accordingly then?

My experience shows that file session storage is the very last bottleneck
that ever would occur; the database times add up much quicker than any
session file i/o would ever be able to.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




[PHP] How do I Install PHP on Apache 2.0?

2002-11-24 Thread Tweak2x
can somebody please help me? I cant figure it out.



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




[PHP] Re: How do I Install PHP on Apache 2.0?

2002-11-24 Thread Stephan Seidt
Hi,

You must build a shared library by configuring php with --with-apxs2.

On Sun, 24 Nov 2002 09:42:40 -0500
[EMAIL PROTECTED] (Tweak2x) wrote:

 can somebody please help me? I cant figure it out.
 
 

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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread DL Neil
Neatly done Ernest!
Also in showing how these questions are best answered with five minutes on
the PC, than a msg to the list...


 At 12:58 24.11.2002, DL Neil said:
 [snip]
 Why don't you run a microtime testbench to time a commented and an
 uncommented loop, settle your mind, and report back with REAL
information!?
 [snip]

 Some time ago I've made myself a framework for such tests and have run it
 against a commented loop. This test was run on a dual PIII/1000 Dell
server.

 $hpr = _fwx_profile_start('Loop with end-of-line comment', true);
 for ($i = 0; $i  100; ++$i) {
 $a += 1;// this is an end-of-line comment
 }
 _fwx_profile_end($hpr, $i);
 Average time per loop: 0.059 msec

 $hpr = _fwx_profile_start('Loop with inline comment', true);
 for ($i = 0; $i  100; ++$i) {
 /* this is an inline comment */ $a += 1;
 }
 _fwx_profile_end($hpr, $i);
 Average time per loop: 0.059 msec

 $hpr = _fwx_profile_start('Loop without comment', true);
 for ($i = 0; $i  100; ++$i) {
 $a += 1;
 }
 _fwx_profile_end($hpr, $i);
 Average time per loop: 0.059 msec

 Conclusio: I didn't find any measurable difference in these loops, be it
an
 end-of-line comment, an inline comment, or no comment.


 --
O Ernest E. Vogelsinger
(\)ICQ #13394035
 ^ http://www.vogelsinger.at/





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




[PHP] Frequent question..Which Mailing List Script

2002-11-24 Thread Bret L Conard
Howdy List,

I know this gets asked alot, but:

Does anyone have a recommendation for a *good* mailing list management script?
Requirements:
Multiple domain support
PHP 4 
MySQL 

Any thought are appreciated





Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread DL Neil
Ernest,

 Some time ago I've made myself a framework for such tests and have run it
 against a commented loop. This test was run on a dual PIII/1000 Dell
server.

 $hpr = _fwx_profile_start('Loop with end-of-line comment', true);
 for ($i = 0; $i  100; ++$i) {
 $a += 1;// this is an end-of-line comment
 }
 _fwx_profile_end($hpr, $i);
 Average time per loop: 0.059 msec

 $hpr = _fwx_profile_start('Loop with inline comment', true);
 for ($i = 0; $i  100; ++$i) {
 /* this is an inline comment */ $a += 1;
 }
 _fwx_profile_end($hpr, $i);
 Average time per loop: 0.059 msec

 $hpr = _fwx_profile_start('Loop without comment', true);
 for ($i = 0; $i  100; ++$i) {
 $a += 1;
 }
 _fwx_profile_end($hpr, $i);
 Average time per loop: 0.059 msec

 Conclusio: I didn't find any measurable difference in these loops, be it
an
 end-of-line comment, an inline comment, or no comment.


=Apologies: I hit 'Send' on the preceding msg, even before signing off...
Duh!

=I have a similar test bench/frame, but which only puts out microtime
differences. My personal/dev PC is an Armada portable with 266MHz processor
and so is considerably more modest than your own beastie.

=I find that because the wee beastie is running PHP, Apache server, MySQL
server, etc, etc; that multiple runs of the same code can yield considerable
differences in execution time - see also warnings in manual, eg 'caching'.
Accordingly I run six cycles and record the last three:

=Herewith:
End of line comment: 4.3118, 4.415713, 4.342078
Inline comment: 4.331843, 4.403446, 4.339082
Loop without comment: 4.415728, 4.399776, 4.420114

=however a quick analysis shows that the fastest-slowest differences are:
.104, .072, and .021 (secs, resp)

=the differences between test types run to:
slow end: .012, and .017
fast end: .020 and .068

=In other words, apart from the first set of tests, any and all differences
are insignificant/disappear into 'noise'. However, if the Loop without
comment results make sense to you - you're a better man than I, Gunga Din!

=Concur completely with your own analysis,
=dn


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




[PHP] rad tools, form paser/validator

2002-11-24 Thread Robert Mena
Hi all,

I've been working with php for a while and whenever I
have the chance I give some tutorials/speeches about
it to other developers, specially those with no
experience with web development.

They all find easy but in one point or another start
asking about an IDE with a debugger, variable watch
etc or RAD tools (they come from Visual Basic/Delphi
enviroments).

In the IDE part I know we have some paid tools (such
as Zend) but can't tell anything that could count as
RAD tool.

So, I'd like to know if there are any RAD tools ,
either free or paid that you know.

One thing that I am planing to develop, or enhance if
I found something similar already, is a form
parser/validator.

Suppose your design department comes with a real nice
html-css-form and you need to validate it, send the
content as email or add in a database.

This tool would read the HTML and prompt you for the
optional/required fields, validation options
(minimum/max length) etc, send via email or add in a
database..

Then would generate the php code to validate and
perform the required actions.

I think there is a classe (from manuel lemos) that
does soemthing similar but also generate the form
itself based on a definition.

What do you thing about it ?

The ideia is to speed up the repetitive/boring stuff
leting the developer focus on special logic - usually
restricted to fewer options.

__
Do you Yahoo!?
Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread Sterling Hughes
 At 09:42 24.11.2002, Adam said:
 [snip]
 I have always had the opinion that the more comments you put into php
 scripts, the slower they will run because there is more data to be read...
 Can someone tell me if there is any truth in this or whether commenting has
 absolutely 'no' impact on the performance of a script?
 [snip] 
 
 As PHP is an interpreter it needs to scan every line and every token of
 code as it runs it. Thus said, of course using comments takes more time to
 execute than having no comments.
 
 I have no profiling yet how much having comments or blank lines would
 actually effect execution times, but I doubt it would be really an issue
 since PHP, once a comment start is encountered, doesn't parse the text but
 just scans for the end-comment tag.


Having comments within loops is no different than having comments anywhere else
in your PHP scripts, comments are stripped out in the lexical analysis phase, 
and therefore, they don't even enter into consideration in the execution phase.

If you're worried about the extra lex/io time on your scripts then (besides 
being a little insane :), you should just be using a cache like the PHP 
Accelerator or APC, which will make comments give you absolutely no performance
hit.

-Sterling

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




[PHP] Re: How do I Install PHP on Apache 2.0?

2002-11-24 Thread Tweak2x
how do i do that?

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

 You must build a shared library by configuring php with --with-apxs2.

 On Sun, 24 Nov 2002 09:42:40 -0500
 [EMAIL PROTECTED] (Tweak2x) wrote:

  can somebody please help me? I cant figure it out.
 
 



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




[PHP] Re: How do I Install PHP on Apache 2.0?

2002-11-24 Thread Stephan Seidt
windows, unix ?


On Sun, 24 Nov 2002 10:26:21 -0500
[EMAIL PROTECTED] (Tweak2x) wrote:

 how do i do that?
 
 Stephan Seidt [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi,
 
  You must build a shared library by configuring php with --with-apxs2.
 
  On Sun, 24 Nov 2002 09:42:40 -0500
  [EMAIL PROTECTED] (Tweak2x) wrote:
 
   can somebody please help me? I cant figure it out.
  
  
 
 

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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread Ernest E Vogelsinger
At 16:10 24.11.2002, DL Neil said:
[snip]
However, if the Loop without
comment results make sense to you - you're a better man than I, Gunga Din!
[snip] 

I'd rather have my scripts crawl than having no comments in them *g*


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




[PHP] Re: How do I Install PHP on Apache 2.0?

2002-11-24 Thread Tweak2x
windows xp pro

Stephan Seidt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 windows, unix ?


 On Sun, 24 Nov 2002 10:26:21 -0500
 [EMAIL PROTECTED] (Tweak2x) wrote:

  how do i do that?
 
  Stephan Seidt [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Hi,
  
   You must build a shared library by configuring php with --with-apxs2.
  
   On Sun, 24 Nov 2002 09:42:40 -0500
   [EMAIL PROTECTED] (Tweak2x) wrote:
  
can somebody please help me? I cant figure it out.
   
   
 
 



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




[PHP] security of stand alone script

2002-11-24 Thread gamin
Hi,

   Running Red Hat 7.2, PHP 4.0.6. Is there any way of knowing if a certain
PHP script was run from the command line, shell script or through the
webserver (Apache). May be i could check the user calling the script and
find out but how would i do that ?

thx in advance

gamin




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




Re: [PHP] sessions and trans-sid problem/question

2002-11-24 Thread Michael Sims
On Sun, 24 Nov 2002 17:01:21 +0900, you wrote:

Michael Sims wrote:
 
 Then I suppose it's just an added feature of the session handler I am
 using.  Maybe the OP should give it a shot, as I use it and I
 definitely don't have a problem with expired sessions

I'll think about writing my own session handler as it can be quite 
useful. However I need to evaluate the amount of extra disk read/writes 
it would add. Using a DB vs the file system does add some overhead ...

Experience has taught me that the additional overhead is negligible,
especially if the database is running locally on the web server...

Having a DB based session handler comes in very handy when you are
troubleshooting a new session-based application.  It's much easier to
run queries against active sessions that to mess around with files,
IMHO.

Good luck...

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




Re: [PHP] Linux Question

2002-11-24 Thread Marek Kilimajer
You might solve this by providing different style sheet to on linux 
running browsers:
if(ereg('Linux',$_SERVER['HTTP_USER_AGENT'])) {
   echo 'link REL=StyleSheet HREF=linux.css TYPE=text/css';
} else {
   echo 'link REL=StyleSheet HREF=win.css TYPE=text/css';
}


conbud wrote:

Hey. This really isnt a PHP question. but what fonts do you reccomend using
so they look decent on linux. Mainly looking for a good font that will look
nice in MoZilla and Galeon. Almost all the fonts Ive used so far appear
really tiny or really bold and not very good to read.

-Lee



 



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




Re: [PHP] Insert file into sql server binary field.

2002-11-24 Thread Marek Kilimajer
Read the file, addslashes(), and then insert it

Naif Al-Otaibi wrote:


How can I insert a file into a binary field in sql server 2000. Do I 
need some function in the query like upload or just read the file and 
insert it.

Thanks,

 



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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread Vincent Vandemeulebrouck
 I have always had the opinion that the more comments you put into php
 scripts, the slower they will run because there is more data to be read...
 Can someone tell me if there is any truth in this or whether commenting
has
 absolutely 'no' impact on the performance of a script?

If the overhead of the parser removing comments becomes an issue for you,
you'll probably be in the situation where your application is heavy, with
thousands of scripts, and a lot of commenting everywhere.

As said before, the comments only impact the parsing. So, you just have to
implement a stripcomment script, that you run when you move your script
from your development server to your production server.

And anyway, this would not be significant, unless you recompile a custom PHP
version where you remove the comment parsing. This would be intereting if
your code was already optimized...

Vincent Vandemeulebrouck


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




Re: [PHP] Insert file into sql server binary field.

2002-11-24 Thread Sterling Hughes
 Read the file, addslashes(), and then insert it

Rather, read the file, don't touch addslashes, then insert it.

AddSLashes is not for binary data...

-Sterling



 Naif Al-Otaibi wrote:
 
 How can I insert a file into a binary field in sql server 2000. Do I 
 need some function in the query like upload or just read the file and 
 insert it.
 
 Thanks,
 
  
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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




Re: [PHP] sessions and trans-sid problem/question

2002-11-24 Thread Chris Shiflett
--- Jean-Christian Imbeault [EMAIL PROTECTED] wrote:

 This now hands me a dilemma ... I was building my site
 conservatively, i.e. assuming the user would have
 cookies turned off. And so I am making heavy use of
 session variables. *But* I had thought that if the
 user had cookies enabled then the variables would be
 saved as cookie information, hence saving my server a
 lot of disk reads and writes.

 Now you have shown me the err of my ways ...
 
 I have to consider rewriting my scripts so that if
 cookies *are* enabled the session information is sent
 has cookie data.

There are two reasons why you should not consider such a rewrite:

1. performance
2. security

You say you want to pass data as cookies to save your server the
latency of disk access. Think about that for a moment, and you will
see that it makes no sense. This is similar to making a decision to
store all of your data on a remote FTP server rather than your local
disk, thinking that this somehow saves you time. Regardless of how
much bandwidth your network has and how slow your disk is, there is
no way transmitting this data to/from the client across the Internet
is going to be faster than local disk access. Floppy access is
probably not even as slow as what you are considering.

A more important reason to avoid the rewrite you are considering is
security. A cookie is sent by the client. The client can be anyone
using your site. What if the client is trying to circumvent your
site's security in some way? Do you really want to trust everyone who
visits to be honest?

When you set a cookie, you are asking the client to send that cookie
(value unchanged of course) in future requests. There is nothing
aside from honesty that keeps a client from changing the cookie.

Also, cookies are intended as a mechanism for maintaining state. This
means that they are well-suited for helping you identify a client
(the Web browser). Session management requires a little bit more, and
this is where PHP sessions come into play. Cookies are a poor choice
for session management (state management + maintaining client data),
and this is what it seems like you are considering.

Chris

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




[PHP] php and caching

2002-11-24 Thread Alex
Hi,

I have a few pages on my site that contains dynamical content that must be
processed each time the page is loaded. But I'd also want to allow the
users to be able to use the back button of their browser to go back to forms
and that these forms still contain the information they entered (instead of
being cleared).

Can someone give me a hint on how to accomplish this if there's a way to do
it?

Thanks,

Alexandre Soares



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




[PHP] Parse URLs

2002-11-24 Thread Stephen
Thanks! Just one more question. I also want to replace emoticons, such as
:-), :), or ;-), that are stored in a table. The structure is this: id,
emote, replace. How could I check to see if the text the user typed in
contains any of the emotes in the table then replace them with the correct
replacement? Also, how could I then limit how many are in the post?


 - Original Message -
 From: Tom Culpepper [EMAIL PROTECTED]
 To: Stephen [EMAIL PROTECTED]
 Cc: PHP List [EMAIL PROTECTED]
 Sent: Saturday, November 23, 2002 9:46 PM
 Subject: Re: [PHP] Parse URLs


  from the archives of the list
  http://www.phpbuilder.com/mail/php-windows/2001042/0222.php
 
  -tom culpepper
 
 
  Stephen wrote:
   They are entering in a whole paragraph or two of text and I want to
 search
   the paragraph for URLs then make it a clickable URL and then store it
in
 a
   MySQL database.
  
  
   - Original Message -
   From: Tom Culpepper [EMAIL PROTECTED]
   To: Stephen [EMAIL PROTECTED]; [EMAIL PROTECTED]
   Sent: Saturday, November 23, 2002 9:05 PM
   Subject: Re: [PHP] Parse URLs
  
  
  
  not entirely sure what is going on there, but if the user is entering
  the url in a html form.  Then just grab the variable on the next page
  and run this
  
  $url=user $HTTP_GET_VARS[url]; (or $HTTP_POST_VARS depending on your
  form method)
  $url=a href=.$url..$url./a;
  echo $url;
  
  the only way to change it dynamically on the same page would be
  
   javascript.
  
  -tom culpepper
  
  Stephen wrote:
  
  I have a simple post script and I want to make it so if a user types
in
  a URL of some sort, to change it to make it clickable. How could I do
  
   that?
  
  Thanks,
  Stephen Craton
  http://www.melchior.us
  
  Life is a gift from God. Wasting it is like destroying a gift you
got
  from the person you love most. -- http://www.melchior.us
  
  
  
  
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  
  
  
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



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




[PHP] Re: security of stand alone script

2002-11-24 Thread gamin
i guess i can use $remote_addr to see if the user has an IP.

But still out of curosity - any way of knowing the user that called the
script ?

gamin.

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

Running Red Hat 7.2, PHP 4.0.6. Is there any way of knowing if a
certain
 PHP script was run from the command line, shell script or through the
 webserver (Apache). May be i could check the user calling the script and
 find out but how would i do that ?

 thx in advance

 gamin






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




Re: [PHP] Re: security of stand alone script

2002-11-24 Thread Stephen
Just a little note. Don't use $remote_addr. I would strongly recomend using
$HTTP_SERVER_VARS[REMOTE_ADDR].


- Original Message -
From: gamin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, November 24, 2002 1:10 PM
Subject: [PHP] Re: security of stand alone script


 i guess i can use $remote_addr to see if the user has an IP.

 But still out of curosity - any way of knowing the user that called the
 script ?

 gamin.

 Gamin [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi,
 
 Running Red Hat 7.2, PHP 4.0.6. Is there any way of knowing if a
 certain
  PHP script was run from the command line, shell script or through the
  webserver (Apache). May be i could check the user calling the script and
  find out but how would i do that ?
 
  thx in advance
 
  gamin
 
 
 



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




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




[PHP] Re: php and caching

2002-11-24 Thread Stephan Seidt
Maybe Pear's Cache class could help you..
But I'm not sure, never played around with it in detail.

On Sun, 24 Nov 2002 12:47:08 -0500
[EMAIL PROTECTED] (Alex) wrote:

 Hi,
 
 I have a few pages on my site that contains dynamical content that must be
 processed each time the page is loaded. But I'd also want to allow the
 users to be able to use the back button of their browser to go back to forms
 and that these forms still contain the information they entered (instead of
 being cleared).
 
 Can someone give me a hint on how to accomplish this if there's a way to do
 it?
 
 Thanks,
 
 Alexandre Soares
 
 

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




Re: [PHP] security of stand alone script

2002-11-24 Thread DL Neil
Hi gamin,

Running Red Hat 7.2, PHP 4.0.6. Is there any way of knowing if a
certain
 PHP script was run from the command line, shell script or through the
 webserver (Apache). May be i could check the user calling the script and
 find out but how would i do that ?


There is a difference in the way argc and argv are managed - see manual.

Also (do two phpinfo() runs to check - one under Apache and one from the
command line) depending upon the web server (Apache in our cases) there are
whole sections of the 'standard output' that do not have relevance from the
command line (because there is no web server!), eg SERVER_SOFTWARE and
SERVER_SIGNATURE.

Should you figure out something better than this, please let me know too!

Regards,
=dn


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




Re: [PHP] Insert file into sql server binary field.

2002-11-24 Thread Marek Kilimajer
Never heard of that, in fact, addslashes escapes also NUL, so it must be 
binary,
and BLOB is like TEXT, except for comparison is case sensitive in BLOB.
And what if the file contains malicious code - it might come from remote 
user's upload

Sterling Hughes wrote:

Read the file, addslashes(), and then insert it

   

Rather, read the file, don't touch addslashes, then insert it.

AddSLashes is not for binary data...

-Sterling



 

Naif Al-Otaibi wrote:

   

How can I insert a file into a binary field in sql server 2000. Do I 
need some function in the query like upload or just read the file and 
insert it.

Thanks,



 

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

   


 



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




Re: [PHP] Creating mySql search feature.....

2002-11-24 Thread Marek Kilimajer
You first need to separate the words and then build your query:

$words = explode(' ',$S_For);
$cond='';
foreach($word as $str) {
   $cond .=  $S_From LIKE '%$str%' AND ;  // replace AND with OR if 
you want ANY word
}
// remove trailing AND(last 4 chars) or OR(last 3 chars)
$cond = substr($cond, 0, strlen($cond) - 4); //  this is for AND

And I hope you check the value of $S_From if it is valid


Cookra wrote:

Hi all,
   Need a little help here been at this for a while now...

I have a database holding a table which in turn holds a collection of fields
I need to search.

Ive set up search form that sends the variable $S_For and $S_From, these
variables represent the following:

$S_For = the search keyword itself
$S_From = the column which I need to search

Ive created this and it works fine for single words, the problem as you may
of guessed is when I enter a string of words ie:

apple - works fine

orange - works fine

apple orange - doesnt

Any help would be ideal

-

Databse = clientacc
Table = hospitality

-

Everything else works on my site apart from this search
feature.. please help!


Regards

R



 



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




Re: [PHP] php and caching

2002-11-24 Thread Marek Kilimajer
Provide a back_to_the_form link and pass all values, then on the form 
assign them to the fields.

Alex wrote:

Hi,

I have a few pages on my site that contains dynamical content that must be
processed each time the page is loaded. But I'd also want to allow the
users to be able to use the back button of their browser to go back to forms
and that these forms still contain the information they entered (instead of
being cleared).

Can someone give me a hint on how to accomplish this if there's a way to do
it?

Thanks,

Alexandre Soares



 



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




[PHP] Cookies

2002-11-24 Thread Omid
Hello,

I have PHP v4.2.3 on Windows 2000 Advanced Server with Microsoft SQL Server
v7.0, and a script for domain registration via OnlineNIC.  That script uses
cookies to maintain session information, but it seems it can't store those
cookies on the hard disk so it always asks me to login in every page. I
changed any related options and settings in php.ini (according to my
knowledge of course) but the problem persists. Would someone please help me?

Thanks in advance.
Omid



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




Re: [PHP] Re: security of stand alone script

2002-11-24 Thread Ernest E Vogelsinger
At 19:10 24.11.2002, gamin said:
[snip]
i guess i can use $remote_addr to see if the user has an IP.

But still out of curosity - any way of knowing the user that called the
script ?
[snip] 

If the script is called via command line, at least these fields in the
$_SERVER array are empty/unset:
SERVER_NAME
REMOTE_IP
I don't even know if the $_SERVER array is set at all.

You can disable any PHP script to be run from the command line by setting
the appropriate file permissions (e.g. chown root:apache, chmod 640 *).


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




[PHP] getting mysql dump using php

2002-11-24 Thread See Kok Boon
thanks Edwin!!

oki... now that i can create the dump, i'll just use lynx from crontab to
send the dump as attachment to my email. thanks!

-Original Message-
From: @ Edwin [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 24, 2002 9:24 PM
To: See Kok Boon
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] getting mysql dump using php


Hello,

...seems like Rich is not available yet so let me try :)

See Kok Boon [EMAIL PROTECTED] wrote:

 hi Rich,

 yes think i need more info to the mysqldump utility. i suppose you mean
 there is in fact this utility?

Well, most probably you'll be able to find it inside your mysql/bin
directory.

Check the manual for more info:

  http://www.mysql.com/doc/en/mysqldump.html

And of course you can google for some related info ;)

  http://www.google.com/search?hl=enie=UTF-8oe=UTF-8q=mysqldump

HTH,

- E



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




Re: [PHP] Insert file into sql server binary field.

2002-11-24 Thread Chris Shiflett
--- Marek Kilimajer [EMAIL PROTECTED] wrote:

 BLOB is like TEXT

In what way? BLOB is binary large object. Text is ... text. One is
binary, and the other is ASCII. The only similarity I can think of is
that they both represent data. However, the format is completely
different.

Open up a binary file in a text editor, and then do the same with a
regular text file. I think you will notice a significant difference.
Or, consider the representation of 16 in binary versus ASCII:

binary - 1
ascii - 0011000100110110

As Sterling mentioned, using addslashes() on binary data is a bad
idea. The same can be said for any string operations intended for
ASCII data.

Chris

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




Re: [PHP] php and caching

2002-11-24 Thread Marco Tabini
Caching is usually managed through a set of headers--for example:

?php
header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);// Date in the past
header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT); 
 // always modified
header(Cache-Control: no-store, no-cache, must-revalidate);  //
HTTP/1.1
header(Cache-Control: post-check=0, pre-check=0, false);
header(Pragma: no-cache);  // HTTP/1.0
?

You can use these in the pages that are dynamic and omit them in those
pages where you want to keep the information.

Cheers,


Marco

php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com

On Sun, 2002-11-24 at 12:47, Alex wrote:
 Hi,
 
 I have a few pages on my site that contains dynamical content that must be
 processed each time the page is loaded. But I'd also want to allow the
 users to be able to use the back button of their browser to go back to forms
 and that these forms still contain the information they entered (instead of
 being cleared).
 
 Can someone give me a hint on how to accomplish this if there's a way to do
 it?
 
 Thanks,
 
 Alexandre Soares
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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




Re: [PHP] php and caching

2002-11-24 Thread Ernest E Vogelsinger
At 20:34 24.11.2002, Marco Tabini said:
[snip]
header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);// Date in the past
[snip] 

You should avoid this since most modern search engines would throw the site
away because it is expired...


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




[PHP] Another cookie question

2002-11-24 Thread Øystein Håland
In the purpose of getting access to mydomain.se/ha/ I will set a cookie:
setcookie (login, OK, time()+3600, /ha/);
It looks like the cookie is set since I get the confirmation text (of course
placed inside the codeblock where the cookie is 'set' (?). Probably it just
confirm that it has found ONE hit in the db on the username/password pair).
But, when I try to access any file in mydomain.se/ha/ it fails and the login
script is loaded again (and a look in 'Temporary Internet Files' tells the
cookie doesn't exist). On the local machine (w2k, apache 2) the same script
works ok



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




[PHP] Re: Another cookie question

2002-11-24 Thread Kyle Gibson
In the purpose of getting access to mydomain.se/ha/ I will set a cookie:
setcookie (login, OK, time()+3600, /ha/);


Not sure if this is the case, but try this instead:

setcookie (login, OK, time()+3600, /ha/,mydomain.se);

--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/


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




php-general Digest 24 Nov 2002 21:40:01 -0000 Issue 1724

2002-11-24 Thread php-general-digest-help

php-general Digest 24 Nov 2002 21:40:01 - Issue 1724

Topics (messages 125773 through 125836):

Re: Newbie: element index array
125773 by: Chase Urich
125774 by: Kyle Gibson

Re: does //commenting reduce performance?
125775 by: Kyle Gibson
125781 by: DL Neil
125783 by: Ernest E Vogelsinger
125797 by: Ernest E Vogelsinger
125798 by: . Edwin
125804 by: DL Neil
125806 by: DL Neil
125808 by: Sterling Hughes
125811 by: Ernest E Vogelsinger
125817 by: Vincent Vandemeulebrouck

Creating mySql search feature.
125776 by: Cookra
125777 by: Jean-Christian Imbeault
125778 by: Hatem Ben
125827 by: Marek Kilimajer

Re: sessions and trans-sid problem/question
125779 by: Ernest E Vogelsinger
125780 by: Ernest E Vogelsinger
125785 by: Jean-Christian Imbeault
125790 by: Justin French
125793 by: Jean-Christian Imbeault
125800 by: Ernest E Vogelsinger
125801 by: Ernest E Vogelsinger
125814 by: Michael Sims
125819 by: Chris Shiflett

get info of sub-directories
125782 by: gamin

Re: [PHP-WIN] Unable to upload.. :(
125784 by: Boris Kolev

getting mysql dump using php
125786 by: See Kok Boon
125789 by: See Kok Boon
125792 by: . Edwin
125831 by: See Kok Boon

Stripslashes through an array.
125787 by: Cookra

backticks vs Safe Mode
125788 by: Vincent Starre

Huffman encoding
125791 by: Hatem Ben
125794 by: Jean-Christian Imbeault
125795 by: Jean-Christian Imbeault

Re: Secureing PHP.
125796 by: . Edwin

Re: Huffman encoding / almost done
125799 by: Hatem Ben

How do I Install PHP on Apache 2.0?
125802 by: Tweak2x
125803 by: Stephan Seidt
125809 by: Tweak2x
125810 by: Stephan Seidt
125812 by: Tweak2x

Frequent question..Which Mailing List Script
125805 by: Bret L Conard

rad tools, form paser/validator
125807 by: Robert Mena

security of stand alone script
125813 by: gamin
125822 by: gamin
125823 by: Stephen
125825 by: DL Neil
125830 by: Ernest E Vogelsinger

Re: Linux Question
125815 by: Marek Kilimajer

Re: Insert file into sql server binary field.
125816 by: Marek Kilimajer
125818 by: Sterling Hughes
125826 by: Marek Kilimajer
125832 by: Chris Shiflett

php and caching
125820 by: Alex
125824 by: Stephan Seidt
125828 by: Marek Kilimajer
125833 by: Marco Tabini
125834 by: Ernest E Vogelsinger

Parse URLs
125821 by: Stephen

Cookies
125829 by: Omid

Another cookie question
125835 by: Øystein Håland
125836 by: Kyle Gibson

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]


--

---BeginMessage---
unset($a['element2']);

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

 I would like to ask that how can I completely delete the $a['element2'] in
 the array? That's mean I will get 'false' in 'isset($a['element2']) after
 the delete process is taken place.
-- 
Linux: Because rebooting is for adding hardware.
Fingerprint = CE24 057D 1E88 A253 3196 89DB 9FF0 9EF0 2F70 8BE8 BE8



signature.asc
Description: This is a digitally signed message part
---End Message---
---BeginMessage---
If I declared an element indexed array and put some values into it:

$a['element1'] = array('btime' = '19D', 'etime' = '22D', 'dayname' = 4);
$a['element2'] = array('btime' = '12D', 'etime' = '20D', 'dayname' = 2);
$a['element3'] = array('btime' = '15D', 'etime' = '17D', 'dayname' = 3);

I would like to ask that how can I completely delete the $a['element2'] in
the array? That's mean I will get 'false' in 'isset($a['element2']) after
the delete process is taken place.

Thanks for your help.


Use unset()

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

--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/


---End Message---
---BeginMessage---
I have always had the opinion that the more comments you put into php
scripts, the slower they will run because there is more data to be read...
Can someone tell me if there is any truth in this or whether commenting has
absolutely 'no' impact on the performance of a script?


The comments are ignored, except the characters that initiate the actual 
comment.

//some comment
$somevar=va;

some comment wouldn't even be looked at. PHP sees the //, and goes to 
the next line.

I suppose on a large scale this could reduce performance, but the 
performance that is lost in standard applications is minuscule.

One thing you might want to avoid is using comments inside loops.


--

[PHP] Re: php and caching

2002-11-24 Thread Alex
But my  main page, for instance mail.php, includes top.php and bottom.php.
But top.php must be processed each time because it prints on every page on
my site if the user has new messages. But if all pages are cached, then it's
always the cached version that's printed to the user, so even if he has new
mail, it doesn't show (because the page is directly taken from the cache
instead of being re-requested).
So I don't want this situation to happen, but i'd want users to be able to
make use of their back button without clearing the forms. Is there a
solution around this problem?

Thanks alot!


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

 I have a few pages on my site that contains dynamical content that must be
 processed each time the page is loaded. But I'd also want to allow the
 users to be able to use the back button of their browser to go back to
forms
 and that these forms still contain the information they entered (instead
of
 being cleared).

 Can someone give me a hint on how to accomplish this if there's a way to
do
 it?

 Thanks,

 Alexandre Soares





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




Re: [PHP] Re: php and caching

2002-11-24 Thread Ernest E Vogelsinger
At 22:38 24.11.2002, Alex said:
[snip]
But my  main page, for instance mail.php, includes top.php and bottom.php.
But top.php must be processed each time because it prints on every page on
my site if the user has new messages. But if all pages are cached, then it's
always the cached version that's printed to the user, so even if he has new
mail, it doesn't show (because the page is directly taken from the cache
instead of being re-requested).
So I don't want this situation to happen, but i'd want users to be able to
make use of their back button without clearing the forms. Is there a
solution around this problem?
[snip] 

You can't have all of both worlds - either allow the browser to cache, then
the form content will be still available from the back button. Or you
disallow caching, then it won't.

Of course you can always control what is allowed to cache - e.g. you might
allow the page containing the form to be cached, but not the results page.

However if you're using sessions, and your form is already session based,
even an uncached form could still be populated by your script when using
session variables.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] Another cookie question

2002-11-24 Thread Ernest E Vogelsinger
At 22:14 24.11.2002, Øystein Håland said:
[snip]
In the purpose of getting access to mydomain.se/ha/ I will set a cookie:
setcookie (login, OK, time()+3600, /ha/);
It looks like the cookie is set since I get the confirmation text (of course
placed inside the codeblock where the cookie is 'set' (?). Probably it just
confirm that it has found ONE hit in the db on the username/password pair).
But, when I try to access any file in mydomain.se/ha/ it fails and the login
script is loaded again (and a look in 'Temporary Internet Files' tells the
cookie doesn't exist). On the local machine (w2k, apache 2) the same script
works ok
[snip] 

There seems to be an inconsistency between (again) MSIE and other
Mozilla's. I found this function on php.net that seems to handle these
differences:

// 
// sess_setcookie()
// CODE TAKEN DIRECTLY FROM http://www.php.net/manual/en/function.setcookie.php
// 
function sess_setcookie($name, $value, $expDays=0, $expHours=0, $expMins=0,
$expSecs=0) {
/***
Notes:
This is a really simple cookie function. Use expDays, expHours, expMins
and expSecs to set the expiration time. If it's too user-friendly, feel
free to remove that feature.
It should handle all browsers, although I've only tested it on MSIE 6
(Win 2k, sp3). I coded it with both Microsoft and Netscape's Specs in mind.
If you find any errors, let me know at: cookieHeader .AT. inxil .DOT. com
(formatted to avoid spam).
***/
$exp = ($expDays * 86400) + ($expHours * 3600) + ($expMins * 60) +
$expSecs;
if (ereg(MSIE, getenv(HTTP_USER_AGENT))) {
$time = mktime()+$exp;
$date = gmdate(D, d-M-Y H:i:s \G\M\T, ($time));
header(Set-Cookie: $name=$value; expires=$date; path=/;);
} else {
header(Set-Cookie: $name=$value; expires= . time()+$exp . ;
path=/;);
}
return true;
}



-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




[PHP] Re: Sorting parsed XML

2002-11-24 Thread Chris
I'm trying to write PHP code that will not only parse the XML but also
allow me to sort the parsed information by the values parsed.
 
Current code
==
class RSSParser {
 var $insideitem = false;
 var $tag = ;
 var $ServerName = ;
 var $ServerStatus = ;
 var $ServerType = ;
 var $ServerPopulation = ;
 
 function startElement($parser, $tagName, $attrs) {
  if ($this-insideitem) {
   $this-tag = $tagName;
  } elseif ($tagName == SERVER) {
   $this-insideitem = true;
   while (list ($key, $val) = each($attrs)) {
switch ($key) {
 case NAME:
  $this-ServerName .= $val;
  break;
 case TYPE:
  $this-ServerType .= $val;
  break;
}
   }
  }
 }
 
 function endElement($parser, $tagName) {
  if ($tagName == SERVER) {
   printf(tr\n);
   if ($this-ServerType) {
printf(td%s i(%s)/i/td\n, $this-ServerName,
$this-ServerType);
   } else {
printf(td%s/td\n, $this-ServerName);
   }
   
   if ($this-ServerPopulation  0) {
printf(td%s/td\n, $this-ServerPopulation);
   } else {
printf(td%s/td\n, $this-ServerStatus);
   }
   printf(/tr\n);
  
   $this-ServerName = ;
   $this-ServerType = ;
   $this-ServerPopulation = ;
   $this-ServerStatus = ;
   $this-insideitem = false;
  }
 }
 
 function serverData($parser, $data) {
  if ($this-insideitem) {
   switch ($this-tag) {
case POPULATION:
 $this-ServerPopulation .= $data;
 break;
case STATUS:
 $this-ServerStatus .= $data;
 break;
   }
  }
 }
}
 
$xml_parser = xml_parser_create();
$rss_parser = new RSSParser();
xml_set_object($xml_parser,$rss_parser);
xml_set_element_handler($xml_parser, startElement, endElement);
xml_set_character_data_handler($xml_parser, serverData);
$fp = fopen(http://www.camelotherald.com/xml/servers.xml,r
http://www.camelotherald.com/xml/servers.xml )
 or die(Error reading RSS data.);
while ($data = fread($fp, 4096))
 xml_parse($xml_parser, $data, feof($fp))
 or die(sprintf(XML error: %s at line %d,
 xml_error_string(xml_get_error_code($xml_parser)),
 xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);

 
I've reviewed many online and book references and none have been helpful
in helping me to determine the way(s) in which I could do such a sort
from the parse code I have found to work very well.  I have tried
looking for a way to also append multiple XML RSS files in one (all
sharing the same structure) into one and then sort according by a value
there.  I am new to PHP and XML.
 
Any help and references would be greatly appreciated.
 
~PHP learner



Re: [PHP] Parse URLs

2002-11-24 Thread Justin French
Before asking, you should have done a search at google.com... I searched for
'emoticons replace php', and it returned HEAPS of results, including this
one, which seems close to what you're asking...

http://www.devarticles.com/art/1/161/2

Search the archives and google before posting please!


Justin


on 25/11/02 5:00 AM, Stephen ([EMAIL PROTECTED]) wrote:

 Thanks! Just one more question. I also want to replace emoticons, such as
 :-), :), or ;-), that are stored in a table. The structure is this: id,
 emote, replace. How could I check to see if the text the user typed in
 contains any of the emotes in the table then replace them with the correct
 replacement? Also, how could I then limit how many are in the post?


Justin French

http://Indent.com.au
Web Development  
Graphic Design



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




Re: [PHP] Re: php and caching

2002-11-24 Thread Robert Cummings
Ernest E Vogelsinger wrote:
 
 At 22:38 24.11.2002, Alex said:
 [snip]
 But my  main page, for instance mail.php, includes top.php and bottom.php.
 But top.php must be processed each time because it prints on every page on
 my site if the user has new messages. But if all pages are cached, then it's
 always the cached version that's printed to the user, so even if he has new
 mail, it doesn't show (because the page is directly taken from the cache
 instead of being re-requested).
 So I don't want this situation to happen, but i'd want users to be able to
 make use of their back button without clearing the forms. Is there a
 solution around this problem?
 [snip]
 
 You can't have all of both worlds - either allow the browser to cache, then
 the form content will be still available from the back button. Or you
 disallow caching, then it won't.

Actually you can. Try using session variables.

Cheers,
Rob.
-- 
.-.
| Worlds of Carnage - telnet wocmud.org 4000  |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

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




Re: [PHP] Re: php and caching

2002-11-24 Thread Ernest E Vogelsinger
At 00:27 25.11.2002, Robert Cummings said:
[snip]
 You can't have all of both worlds - either allow the browser to cache, then
 the form content will be still available from the back button. Or you
 disallow caching, then it won't.

Actually you can. Try using session variables.
[snip] 

If you read my complete post you'll notice that I suggested using session
variables. The issue why I first answered the question _without_ talking
about session variables is the fact that Alex was talking about a search
form. Search forms are often used on normal static web pages _without_
the help of sessions... that's the reason.

Rest assured I know about sessions in PHP :)


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] Parse URLs

2002-11-24 Thread Stephen
Yes, I found that after posting my last message. Sorry and I'll use google
more...


- Original Message -
From: Justin French [EMAIL PROTECTED]
To: Stephen [EMAIL PROTECTED]; PHP List
[EMAIL PROTECTED]
Sent: Sunday, November 24, 2002 6:42 PM
Subject: Re: [PHP] Parse URLs


 Before asking, you should have done a search at google.com... I searched
for
 'emoticons replace php', and it returned HEAPS of results, including this
 one, which seems close to what you're asking...

 http://www.devarticles.com/art/1/161/2

 Search the archives and google before posting please!


 Justin


 on 25/11/02 5:00 AM, Stephen ([EMAIL PROTECTED]) wrote:

  Thanks! Just one more question. I also want to replace emoticons, such
as
  :-), :), or ;-), that are stored in a table. The structure is this: id,
  emote, replace. How could I check to see if the text the user typed in
  contains any of the emotes in the table then replace them with the
correct
  replacement? Also, how could I then limit how many are in the post?


 Justin French
 
 http://Indent.com.au
 Web Development 
 Graphic Design
 




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




Re: [PHP] Re: php and caching

2002-11-24 Thread Robert Cummings
Ernest E Vogelsinger wrote:
 
 If you read my complete post you'll notice that I suggested using session
 variables. The issue why I first answered the question _without_ talking
 about session variables is the fact that Alex was talking about a search
 form. Search forms are often used on normal static web pages _without_
 the help of sessions... that's the reason.
 
 Rest assured I know about sessions in PHP :)

That'll teach me to form an opinion and skim :) My apologies.

Cheers,
Rob.
-- 
.-.
| Worlds of Carnage - http://www.wocmud.org   |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

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




[PHP] Re: php and caching

2002-11-24 Thread Alex
If the page itself is never cached to force dynamic php pages to always be
fresh, is there a way to cache only images to reduce bandwidth usage?

Thanks, (and thanks for all your good advices!)

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

 I have a few pages on my site that contains dynamical content that must be
 processed each time the page is loaded. But I'd also want to allow the
 users to be able to use the back button of their browser to go back to
forms
 and that these forms still contain the information they entered (instead
of
 being cleared).

 Can someone give me a hint on how to accomplish this if there's a way to
do
 it?

 Thanks,

 Alexandre Soares





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




Re: [PHP] Re: php and caching

2002-11-24 Thread Ernest E Vogelsinger
At 01:04 25.11.2002, Alex said:
[snip]
If the page itself is never cached to force dynamic php pages to always be
fresh, is there a way to cache only images to reduce bandwidth usage?
[snip] 

Alex,

images are a separate page if you want; the browser issues a separate
request for the image which is only _referenced_ by the page, not
_contained_ within. As such the caching requirements for an image are
unique and absolutely not connected to the caching restrictions of the page
it is referenced from.

That said: if your page is non-cacheable, images it contains will still be
cached if the server allows this. 

If you're image tags look like this:
img src=../images/somepic.gif
it's most likely the image will be cached (like any other static file).

For a tag like
img src=../imgdb/getimg.php?id=4711
the script getimg.php would need to issue the appropriate cache
directives to allow caching.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




[PHP] perplexed as to why this is happening...

2002-11-24 Thread Peter Houchin
Howdy,

I'm doing a simple db check.. grabbing a db value, in this case $sec, based
on the user name registered in the session,
I've created a user called test with $sec  equal to 2 but when i get to
the second echo of $sec the value has changed to 1 and I can't understand
why... can some one please give me some idea as to why this is happening?

elseif ($_POST['cost'] =11){
//query db
$res = mysql_query(SELECT sec FROM users WHERE uname='$_SESSION[uname]');
$num = mysql_numrows($res) ;
if ($num == 1) {
//get results
$sec = mysql_result($res, 0, 'sec');
echo $sec; // pulls out sec as 2 ( as is sposed to )
}
if (!$sec = 1){
echo font class='content'please contact your nearest
representive/font;
}
else {
echo $sec; // on this echo $sec has changed value from 2 to 1

Cheers

Peter
the only dumb question is the one that wasn't asked



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




RE: [PHP] perplexed as to why this is happening...

2002-11-24 Thread Michael Hazelden
Ahem ...

$sec=1 means set $sec to 1

You want

$sec==1

:-)

M.

-Original Message-
From: Peter Houchin [mailto:[EMAIL PROTECTED]]
Sent: 25 November 2002 00:53
To: php_gen
Subject: [PHP] perplexed as to why this is happening...


Howdy,

I'm doing a simple db check.. grabbing a db value, in this case $sec, based
on the user name registered in the session,
I've created a user called test with $sec  equal to 2 but when i get to
the second echo of $sec the value has changed to 1 and I can't understand
why... can some one please give me some idea as to why this is happening?

elseif ($_POST['cost'] =11){
//query db
$res = mysql_query(SELECT sec FROM users WHERE uname='$_SESSION[uname]');
$num = mysql_numrows($res) ;
if ($num == 1) {
//get results
$sec = mysql_result($res, 0, 'sec');
echo $sec; // pulls out sec as 2 ( as is sposed to )
}
if (!$sec = 1){
echo font class='content'please contact your nearest
representive/font;
}
else {
echo $sec; // on this echo $sec has changed value from 2 to 1

Cheers

Peter
the only dumb question is the one that wasn't asked



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


_
This message has been checked for all known viruses by the 
MessageLabs Virus Control Centre.

This message has been checked for all known viruses by the MessageLabs Virus Control 
Centre.


*

Notice:  This email is confidential and may contain copyright material of Ocado 
Limited (the Company). Opinions and views expressed in this message may not 
necessarily reflect the opinions and views of the Company.
If you are not the intended recipient, please notify us immediately and delete all 
copies of this message. Please note that it is your responsibility to scan this 
message for viruses.

Company reg. no. 3875000.  Swallowdale Lane, Hemel Hempstead HP2 7PY

*

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




RE: [PHP] perplexed as to why this is happening...

2002-11-24 Thread Peter Houchin
thanks for that .. I must be going blind :)

 -Original Message-
 From: Michael Hazelden [mailto:[EMAIL PROTECTED]]
 Sent: Monday, 25 November 2002 11:44 AM
 To: 'Peter Houchin'; php_gen
 Subject: RE: [PHP] perplexed as to why this is happening...
 
 
 Ahem ...
 
 $sec=1 means set $sec to 1
 
 You want
 
 $sec==1
 
 :-)
 
 M.
 
 -Original Message-
 From: Peter Houchin [mailto:[EMAIL PROTECTED]]
 Sent: 25 November 2002 00:53
 To: php_gen
 Subject: [PHP] perplexed as to why this is happening...
 
 
 Howdy,
 
 I'm doing a simple db check.. grabbing a db value, in this case 
 $sec, based
 on the user name registered in the session,
 I've created a user called test with $sec  equal to 2 but when i get to
 the second echo of $sec the value has changed to 1 and I can't 
 understand
 why... can some one please give me some idea as to why this is happening?
 
 elseif ($_POST['cost'] =11){
 //query db
 $res = mysql_query(SELECT sec FROM users WHERE 
 uname='$_SESSION[uname]');
 $num = mysql_numrows($res) ;
 if ($num == 1) {
 //get results
 $sec = mysql_result($res, 0, 'sec');
 echo $sec; // pulls out sec as 2 ( as is sposed to )
 }
 if (!$sec = 1){
 echo font class='content'please contact your nearest
 representive/font;
 }
 else {
 echo $sec; // on this echo $sec has changed value from 2 to 1
 
 Cheers
 
 Peter
 the only dumb question is the one that wasn't asked
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 _
 This message has been checked for all known viruses by the 
 MessageLabs Virus Control Centre.
 
 This message has been checked for all known viruses by the 
 MessageLabs Virus Control Centre.
 
   
 *
 
 Notice:  This email is confidential and may contain copyright 
 material of Ocado Limited (the Company). Opinions and views 
 expressed in this message may not necessarily reflect the 
 opinions and views of the Company.
 If you are not the intended recipient, please notify us 
 immediately and delete all copies of this message. Please note 
 that it is your responsibility to scan this message for viruses.
 
 Company reg. no. 3875000.  Swallowdale Lane, Hemel Hempstead HP2 7PY
 
 *
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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




Re: [PHP] perplexed as to why this is happening...

2002-11-24 Thread Kyle Gibson
Howdy,

I'm doing a simple db check.. grabbing a db value, in this case $sec, based
on the user name registered in the session,
I've created a user called test with $sec  equal to 2 but when i get to
the second echo of $sec the value has changed to 1 and I can't understand
why... can some one please give me some idea as to why this is happening?

elseif ($_POST['cost'] =11){
//query db
$res = mysql_query(SELECT sec FROM users WHERE uname='$_SESSION[uname]');
$num = mysql_numrows($res) ;
if ($num == 1) {
//get results
$sec = mysql_result($res, 0, 'sec');
echo $sec; // pulls out sec as 2 ( as is sposed to )
}
if (!$sec = 1){



Right there. Should be...

if ($sec != 1){


--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/


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




[PHP] date queries

2002-11-24 Thread Michael P. Carel
Hi to all,

Sorry for this post I know this is a mysql related question, i just wanna
have other comments.suggestions from this list.
I have a problem regarding date queries in mysql. Im creating inventory
reports in PHP. I want to query from the date field a weekly report for a
specific month,  year, and week.

Any idea, thanks in advance


Regards,
mike


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




[PHP] What is wrong here?

2002-11-24 Thread Cesar Aracena
Hi all,

I'm making a site which will reside in a remote server and had several
problems... most of them where solved once I saw that register_globals
are OFF, but now I don’t know which other settings are affecting my
scripts. I have trouble with header(Location... because the browser is
NOT redirected. If I set an echo statement after I detected that the
username and password using $_POST[], the echo goes OK but if I
comment the echo and un-comment the 

header(Location: http://www.domainname.com;);
exit;

nothing happens... and no, there isn't anything before that... what can
be wrong? Thanks in advance,

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina




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




Re: [PHP] What is wrong here?

2002-11-24 Thread Leif K-Brooks
Are you using a relative url for the redirection?

Cesar Aracena wrote:


Hi all,

I'm making a site which will reside in a remote server and had several
problems... most of them where solved once I saw that register_globals
are OFF, but now I dont know which other settings are affecting my
scripts. I have trouble with header(Location... because the browser is
NOT redirected. If I set an echo statement after I detected that the
username and password using $_POST[], the echo goes OK but if I
comment the echo and un-comment the 

header(Location: http://www.domainname.com;);
exit;

nothing happens... and no, there isn't anything before that... what can
be wrong? Thanks in advance,

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina




 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




Re: [PHP] What is wrong here?

2002-11-24 Thread Ernest E Vogelsinger
At 03:05 25.11.2002, Cesar Aracena said:
[snip]
I'm making a site which will reside in a remote server and had several
problems... most of them where solved once I saw that register_globals
are OFF, but now I don't know which other settings are affecting my
scripts. I have trouble with header(Location... because the browser is
NOT redirected. If I set an echo statement after I detected that the
username and password using $_POST[], the echo goes OK but if I
comment the echo and un-comment the 

header(Location: http://www.domainname.com;);
exit;

nothing happens... and no, there isn't anything before that... what can
be wrong? Thanks in advance,
[snip] 

What server are you running on? I once noticed redirection problems on IIS
where I had to resort to
header('HTTP/1.0 302 Moved');
header)'Location: blah');

Don't know if this helps in your case.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] What is wrong here?

2002-11-24 Thread Kyle Gibson

I'm making a site which will reside in a remote server and had several
problems... most of them where solved once I saw that register_globals
are OFF, but now I don’t know which other settings are affecting my
scripts. I have trouble with header(Location... because the browser is
NOT redirected. If I set an echo statement after I detected that the
username and password using $_POST[], the echo goes OK but if I
comment the echo and un-comment the 

header(Location: http://www.domainname.com;);
exit;

nothing happens... and no, there isn't anything before that... what can
be wrong? Thanks in advance,

The headers for the page might have already been sent. If there is a 
space at the top of your PHP file like below, any type of header change 
wont work:

---top of file

?

header(Location: ...);
exit;

?

--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/


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



Re: [PHP] What is wrong here?

2002-11-24 Thread Chris Shiflett
--- Cesar Aracena [EMAIL PROTECTED] wrote:

 I have trouble with header(Location... because the
 browser is NOT redirected. If I set an echo statement
 after I detected that the username and password using
 $_POST[], the echo goes OK but if I comment the echo
 and un-comment the 
 
 header(Location: http://www.domainname.com;);
 exit;
 
 nothing happens...

It is a good idea to always use a proper URL in conjunction with the
Location header, because this is required by the HTTP specification.
So, change your code to this:

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

However, I doubt this will solve your problem.

When you exchange the header() with an echo for debugging, you get
the output you expect, right? Is it possible that the echo is not the
only output, meaning that it would work fine whereas the header()
call would fail due to their being previous output somewhere else?
Depending on your HTML, errors might be hidden from the browser, so
you might have to glance through the source.

The only way to make sure PHP is properly changing the response
status code to 302 is to snoop the HTTP traffic surrounding this
transaction. Can you do that and show us the results? It might reveal
something.

Chris

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




RE: [PHP] date queries

2002-11-24 Thread John W. Holmes
 Sorry for this post I know this is a mysql related question, i just
wanna
 have other comments.suggestions from this list.
 I have a problem regarding date queries in mysql. Im creating
inventory
 reports in PHP. I want to query from the date field a weekly report
for a
 specific month,  year, and week.

SELECT * FROM your_table WHERE YEARWEEK(your_date_column) = $x

Where $x is a YEARWEEK in the format WW. WW is 0 - 53. Read the
manual for more info...

http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html
#Date_and_time_functions

---John Holmes...



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




Re: [PHP] Creating mySql search feature.....

2002-11-24 Thread Cookra
Thank you Marek






Marek Kilimajer [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 You first need to separate the words and then build your query:

 $words = explode(' ',$S_For);
 $cond='';
 foreach($word as $str) {
 $cond .=  $S_From LIKE '%$str%' AND ;  // replace AND with OR if
 you want ANY word
 }
 // remove trailing AND(last 4 chars) or OR(last 3 chars)
 $cond = substr($cond, 0, strlen($cond) - 4); //  this is for AND

 And I hope you check the value of $S_From if it is valid


 Cookra wrote:

 Hi all,
 Need a little help here been at this for a while now...
 
 I have a database holding a table which in turn holds a collection of
fields
 I need to search.
 
 Ive set up search form that sends the variable $S_For and $S_From, these
 variables represent the following:
 
 $S_For = the search keyword itself
 $S_From = the column which I need to search
 
 Ive created this and it works fine for single words, the problem as you
may
 of guessed is when I enter a string of words ie:
 
 apple - works fine
 
 orange - works fine
 
 apple orange - doesnt
 
 Any help would be ideal
 
 -
 
 Databse = clientacc
 Table = hospitality
 
 -
 
 Everything else works on my site apart from this search
 feature.. please help!
 
 
 Regards
 
 R
 
 
 
 
 




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




RE: [PHP] What is wrong here?

2002-11-24 Thread Cesar Aracena
In response to all of you wonderful people:

Leif, yes and no... I've tried all kind of URLs

Ernest, I think you're on the right track here... I'll try that.

Kyle, no... I made those errors in the past, so now I make sure I don't
(again :)

Chris, I tend to forget to append the / after the URL so thanks 4 that.
In the other hand, yes... the echo works fine. Now, I don't really know
what you mean by snoop the HTTP traffic but if it has something to do
with the server, then no I can't...

Thanks all of you... I'll try these things...

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina


-Mensaje original-
De: Cesar Aracena [mailto:[EMAIL PROTECTED]] 
Enviado el: domingo, 24 de noviembre de 2002 23:06
Para: [EMAIL PROTECTED]
Asunto: [PHP] What is wrong here?

Hi all,

I'm making a site which will reside in a remote server and had several
problems... most of them where solved once I saw that register_globals
are OFF, but now I don’t know which other settings are affecting my
scripts. I have trouble with header(Location... because the browser is
NOT redirected. If I set an echo statement after I detected that the
username and password using $_POST[], the echo goes OK but if I
comment the echo and un-comment the 

header(Location: http://www.domainname.com;);
exit;

nothing happens... and no, there isn't anything before that... what can
be wrong? Thanks in advance,

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina




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


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




[PHP] quick sanity check on user management / sessions

2002-11-24 Thread Justin French
Hi all,

I just need a quick sanity check.  I was going through some old scripts,
cleaning them up, optimising them, etc etc... and then I opened my OLD
user/sessions management library...

For some reason (inexperience probably, or a bad article), it was set-up so
that both the uid and pwd were set as session variables, and EACH PAGE on
the site checked the uid  pwd against the database...  this seems like a
lot of overhead to me.

Here's what I'd like to do:

login page validates user, and registers $_SESSION['uid'] (and any others I
need, like admin = true)

then, all other pages on the site will just need
session_start();

rather than the current call to the database to validate the user on every
page.


I know the above should be fine, but I'm just checking if there's any reason
why I choose to call the DB on every page... it was about 2 years ago, so my
guess is inexperience :)

TIA

Justin French

http://Indent.com.au
Web Development  
Graphic Design



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




[PHP] FULLTEXT: It worked?? Why?

2002-11-24 Thread John Taylor-Johnston
MySQL4.0.1 Question. HTOK

FULLTEXT index confusion.

Why does my SQL work?

SELECT YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,AUS
FROM ccl_main
WHERE MATCH (AUS)
AGAINST ('+margaret +atwood' IN BOOLEAN MODE)
ORDER BY id desc


AUS is not part of my FULLTEXT Index. So why does it work? How does FULLTEXT work 
then???

CREATE TABLE ccl_main (
id int(10) unsigned NOT NULL auto_increment,
...
PRIMARY KEY  (id),
FULLTEXT KEY CCL2002 (YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC)
) TYPE=MyISAM COMMENT='CCL Bibliography - Bibliographie ECC';



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




Re: [PHP] quick sanity check on user management / sessions

2002-11-24 Thread Chris Shiflett
--- Justin French [EMAIL PROTECTED] wrote:

 I just need a quick sanity check.

I'm no doctor, but I think you're sane. :-)

 For some reason (inexperience probably, or a bad
 article), it was set-up so that both the uid and pwd
 were set as session variables, and EACH PAGE on the
 site checked the uid  pwd against the database...
 this seems like a lot of overhead to me.

This seems superfluous to me as well. So, you are saying that the
unique identifier and the password are stored on the server in the
session data store (/tmp/sess_$PHPSESSID by default) and validated
against the user data store (where the username and password are
typically stored) for each access?

This offers no benefit that I can think of, because you are
validating server data against server data. It does nothing to
validate the client data, namely to offer assurance of the client's
identity. It is the client that I generally mistrust, not the server.
:-)

 Here's what I'd like to do:
 
 login page validates user, and registers
 $_SESSION['uid'] (and any others I need, like admin =
 true)
 
 then, all other pages on the site will just need
 session_start();

This will work fine and at least seems like a better approach than
the old code you found.

One thing you might want to consider is what might have been the
intent of the old code, which is to add some extra authentication for
the client's identity. My reason for suggesting this approach is
based on the following:

1. PHP uses a cookie for client identification by default.
2. IE versions 4.0 - 6.0 allow any Web site to read any of the user's
cookies, regardless of the access restrictions placed on those
cookies.
3. A majority of Web browsers in use identify themselves as being a
version of IE between 4.0 and 6.0.

Thus, impersonation is quite easy if the cookie is trusted. There are
many creative things you can do to add a bit of strength to the
identification process. One example would be to store the user agent
string in a session variable after authentication and to check the
client's user agent for each access within that session thereafter.
This would at least force an imposter to replicate the user agent.
Yes, this may not be very reliable either, but perhaps it will give
you some ideas. Just try to make it hard on the bad guys and easy on
the good guys, and you'll probably be fine.

Chris

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




RE: [PHP] What is wrong here?

2002-11-24 Thread Ernest E Vogelsinger
At 03:27 25.11.2002, Cesar Aracena said:
[snip]
what you mean by snoop the HTTP traffic but if it has something to do
with the server, then no I can't...
[snip] 

Make a
telnet www.mydomain.com 80
and transmit something like this:
---
GET /myredirurl.php HTTP/1.0
Host: www.mydomain.url
Accept: */*

---

Note the double newline at the end of the request header. Capture the
output and check if it properly returns

HTTP/1.x 302 Moved
Location: blah


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] quick sanity check on user management / sessions

2002-11-24 Thread Ernest E Vogelsinger
At 03:33 25.11.2002, Justin French said:
[snip]
I know the above should be fine, but I'm just checking if there's any reason
why I choose to call the DB on every page... it was about 2 years ago, so my
guess is inexperience :)
[snip] 

That's what all my apps do - they just check if the user is already logged in.

When there's no user record in session space, the login box gets
displayed, and as a response of user login the script checks the database.
It then reads all necessary data, including last login, user rights, etc
etc, from the DB, sometimes updates a user cookie, depending on the app. DB
is checked only once.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




[PHP] Browser going to page twice?

2002-11-24 Thread Leif K-Brooks
I'm having a weird problem.  When I submit a form on my site, it often 
sends twice.  I'm not sure if this is a client-side or server-side 
problem, but it doesn't happen on other sites.  Is this a common 
problem, or am I making some dumb mistake?

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



Re: [PHP] quick sanity check on user management / sessions

2002-11-24 Thread Justin French
Thanks all :)

 That's what all my apps do - they just check if the user is already logged in.
 
 When there's no user record in session space, the login box gets
 displayed, and as a response of user login the script checks the database.
 It then reads all necessary data, including last login, user rights, etc
 etc, from the DB, sometimes updates a user cookie, depending on the app. DB
 is checked only once.
 

Justin French

http://Indent.com.au
Web Development  
Graphic Design



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




  1   2   >