[PHP] phpMyAdmin

2002-08-21 Thread Steve Jackson

Is it possible to use phpMyAdmin to add new databases (not tables whole
databases) to my website? I ask because currently my host has provided
me with one database and I don't want to mix database tables when adding
new features (such as shopping carts and bulletin boards)? I am new to
MySQL and PHP so would like some advice, is the way I describe
(databases for each website function) a good way to design or should I
have all my functions in one large database?

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159




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




Re: [PHP] phpMyAdmin

2002-08-21 Thread @ Edwin
All depends on your host and how phpMyAdmin was configured. It's better to 
ask them directly...

- E


Is it possible to use phpMyAdmin to add new databases (not tables whole
databases) to my website? I ask because currently my host has provided
me with one database and I don't want to mix database tables when adding
new features (such as shopping carts and bulletin boards)? I am new to
MySQL and PHP so would like some advice, is the way I describe
(databases for each website function) a good way to design or should I
have all my functions in one large database?

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159




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




_
$B%-%c%j%"%"%C%W$rL\;X$9$"$J$?$N%J%S%2!<%?!<(B MSN $B="?&!>?&(B 
http://career.msn.co.jp/


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


[PHP] still problems with register globals set to on

2002-08-21 Thread Andy

Hello everybody,

I am still having problems to run php scripts inside a directory with
register globals on.

This is what I did put inside the httpd.conf file right after the Directory
/ close tag.

Directory /home/www/oasis
php_value register_globals on
/Directory

It does not change anything. I restarted apache of course.

Do u have an idea where the error could live?

Andy


Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Sure, turn register_globals on only for the oasis directory.  In your
 httpd.conf add:

 Directory /some/path/oasis
 php_value register_globals on
 /Directory

 -Rasmus

 On Mon, 19 Aug 2002, Andy wrote:

  Hi there,
 
  I am running php 4.2.2 with register globals set to off. Now I am
planing to
  install oasis (a add tracking sw). Their current version requires a php
  build with register globals set to on!?
 
  Is there a way out of this dilema running only one server?
 
  Thanx for any advice,
 
  Andy
 
 
 
 
 
  --
  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] phpMyAdmin

2002-08-21 Thread Michael Egan

Steve,

I think it's fairly standard that hosts provide you with a single database.

A suggestion made with earlier thread, which I follow, is simply to make sure you set 
up your tables with names that clearly identify their function to you.

Michael Egan

-Original Message-
From: Steve Jackson [mailto:[EMAIL PROTECTED]]
Sent: 20 August 2002 23:35
To: MySQL General Mailing list; PHP General
Subject: [PHP] phpMyAdmin


Is it possible to use phpMyAdmin to add new databases (not tables whole
databases) to my website? I ask because currently my host has provided
me with one database and I don't want to mix database tables when adding
new features (such as shopping carts and bulletin boards)? I am new to
MySQL and PHP so would like some advice, is the way I describe
(databases for each website function) a good way to design or should I
have all my functions in one large database?

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159




-- 
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] Sorting a multi-dimensional array

2002-08-21 Thread Michael Egan

Ben,

I don't know whether this is the most efficient way of doing things but when I've 
tried in the past to sort multidimensional arrays according to a number of values I've 
ended up giving up on the PHP functions and creating a temporary table in MySQL.  

You can then retrieve the information sorted by various fields defined in your query 
to the database.

Others may well advise that this is not the best way of doing this but it's worked for 
me and has saved me beating myself up over not being able to get to grips with some 
complex functions!

Michael Egan


-Original Message-
From: Ben [mailto:[EMAIL PROTECTED]]
Sent: 20 August 2002 18:25
To: [EMAIL PROTECTED]
Subject: [PHP] Sorting a multi-dimensional array


I have looked at array_multisort, asort, etc. NONE of them do what I need.

My array looks like this:

$array[0][0] = First Id;
$array[0][1] = First Name;
$array[0][2] = First Rating;

$array[1][0] = Second Id;
$array[1][1] = Second Name;
$array[1][2] = Second Rating;

$array[2][0] = Third Id;
$array[2][1] = Third Name;
$array[2][2] = Third Rating;


Now, I want to sort the array (very very fast if possible cuz the array is
huge...150 such values) based on the Rating for each candidate, which is
the third column inside this matrix array. How should I ask PHP to do this?
Also, when I do sort by the Rating I want the ID and the name to remain the
same for each candidate, i.e., I want the indexes to be maintained.

HELP!

Thanks in advance
Ben



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

2002-08-21 Thread Michael Egan

I know similar threads have come up on this in the past but I suspect it's a 
constantly changing picture.

I recently saw a favourable review of Zend Studio 2.5 but wondered, out of curiosity, 
what sort of tools people use to develop PHP scripts and MySQL databases, tables and 
queries.

Up until now, in an attempt to try and get to grips with these packages, I've been 
using a variety of text editors from VI to Kwrite.  But I'm wondering whether it might 
speed up development times if I start to use one of the tools out there for working 
with PHP and MySQL.

Any thoughts?

Michael Egan

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




Re: [PHP] still problems with register globals set to on

2002-08-21 Thread Tom Rogers

Hi,

Wednesday, August 21, 2002, 5:34:35 PM, you wrote:
A Hello everybody,

A I am still having problems to run php scripts inside a directory with
A register globals on.

A This is what I did put inside the httpd.conf file right after the Directory
/ close tag.

A Directory /home/www/oasis
A php_value register_globals on
A /Directory

A It does not change anything. I restarted apache of course.

A Do u have an idea where the error could live?

A Andy


A Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag
A [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Sure, turn register_globals on only for the oasis directory.  In your
 httpd.conf add:

 Directory /some/path/oasis
 php_value register_globals on
 /Directory

 -Rasmus

 On Mon, 19 Aug 2002, Andy wrote:


You may need to add in the directory section (never used it so it is a
guess)

AllowOverride Options

-- 
regards,
Tom


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




Re: [PHP] PHP IDEs

2002-08-21 Thread David T-G

Michael, et al --

...and then Michael Egan said...
% 
% I know similar threads have come up on this in the past but I suspect it's a 
constantly changing picture.
...
% 
% Any thoughts?

Yes.  vim forever!  It's all you need :-)

OK, I admit that I'm interested in seeing what comes out...  Please post
a summary to the list if you get off-list discussion, and particularly
let us (me) know if you find something that will work in a vt100 screen
with no mouse input.


% 
% Michael Egan


Best of luck  HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg76373/pgp0.pgp
Description: PGP signature


[PHP] array_splice()

2002-08-21 Thread Riccardo Sepe

Hi evey1,
sorry if I' ve already posted this :
in order to remove a whole array of values from a multidimensional array 
I tried the following:

foreach($bkmks as $val) { 
  
if($val[8]==$cod){
   array_splice($bkmks,$val,1);
   }
  }It works fine for all the 
arrays but the first ($bkmks[0])
 When I try to remove that array this is what I get :
Fatal error: Maximum execution time of 30 seconds exceeded in .
 after that if I read $bkmks all the arrays have been removed but 
$bkmks[0]
(the array I wanted to  remove)
Why ?
Is there a better way to do it ?

thanks again


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




[PHP] Re: cURL and POST

2002-08-21 Thread lallous

even more, if you want to use curl...
I remember that curl can take post data from an input file, so dump the
$strXML to a temp file then supply that file to curl.

good luck,

Samantha Savvakis [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 HI,

 I'm using the cURL binary to perform a HTTP POST to a web page. I am
sending
 XML data to this web page.

 The issue I've come up against if the size of the data that I'm trying to
 post and it looks like cURL is crapping out.

 This is the command line that I'm currently using:

 /usr/local/bin/curl -m 600 -d $strXML http://myurl.com/webpage.php -L -s

 $strXML - variable containing the XML data. I run this command using
exec.

 The return code I receive is: 127. This means a fatal error has occured
with
 cURL but that's all I know.

 I have read the detail about using the -F option. I do not want to POST
the
 file as such, but rather the DATA in the file is I create a file of
the
 XML. The manpage for cURL states:

 -F : To just get  the content part from a file, prefix the file name with
 the letter . The difference between @ and  is then that @ makes a file
get
 attached in the post as a file upload, while the  makes a text field and
 just  get  the contents for that text field from a file.

 So I've tried going:

 /usr/local/bin/curl -m 600 -F /tmp/tempfile.xml
 http://myurl.com/webpage.php -L -s

 /tmp/tempfile.xml - contains the XML data. This isn't working.I'm getting
a
 return code of 2 meaning: Failed to initialize.

 I'm at a loss. I need to post this large amount of XML data to a remote
site
 and don't know how to get it there.

 Any ideas?

 Thanks,
 Sam








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




[PHP] Apache 2 and PHP

2002-08-21 Thread Adrian Ciutureanu

At http://www.php.net/ChangeLog-4.php#4.2.0 there is a note (Note: Apache2
support is EXPERIMENTAL.)
Is this note still justified for PHP/4.2.2? Is it about security?



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




Re: [PHP] still problems with register globals set to on

2002-08-21 Thread Andy

thanx tom, but this doen not seem to have anything to do with it.

Regards,

Andy



Tom Rogers [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 Wednesday, August 21, 2002, 5:34:35 PM, you wrote:
 A Hello everybody,

 A I am still having problems to run php scripts inside a directory with
 A register globals on.

 A This is what I did put inside the httpd.conf file right after the
Directory
 / close tag.

 A Directory /home/www/oasis
 A php_value register_globals on
 A /Directory

 A It does not change anything. I restarted apache of course.

 A Do u have an idea where the error could live?

 A Andy


 A Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag
 A [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Sure, turn register_globals on only for the oasis directory.  In your
  httpd.conf add:
 
  Directory /some/path/oasis
  php_value register_globals on
  /Directory
 
  -Rasmus
 
  On Mon, 19 Aug 2002, Andy wrote:


 You may need to add in the directory section (never used it so it is a
 guess)

 AllowOverride Options

 --
 regards,
 Tom




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




[PHP] search in serialized string

2002-08-21 Thread Rodrigo Peres

Hi list, 

I have a form to post resumes. In one parte the user have a option to choose
up to 5 languages and his knowledge in it. example : english: basic advanced

My problem is that was stored serialized in the BD and now I need to do a
search by language and knowledge. How can I do this. I've tried everything
unsuccessfully. example: search english advanced. If the user have english
basic and another advanced he/her appear in the search.

Thank's in advance

Rodrigo


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




[PHP] Image library

2002-08-21 Thread Scott Houseman

Hi there.

Which way would be the most efficient/fastest to access images from an image
library.
A) Store image files in a hash directory structure AND storing each file's
information in a mysql table
OR
B) Storing image information in mysql table AND storing the image in a BLOB
field in that table.

The way I see it, considerations to be taken into acount:
- Is it quicker/better to retrieve image from table  then stream out to
browser OR simply direct the browser to the file?
  i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
SRC=/imagelib/5/f/10
- Will a database OR filesystem be more scalable i.e. which wil perform
better when there are 1 images in the libary?

Thanks in advance

Regards

-Scott

--
Scott Houseman
Jam Warehouse http://www.jamwarehouse.com/
Smart Business Innovation
+27 21 4477440 / +27 82 4918021


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




[PHP] Simple Security Clarification

2002-08-21 Thread Andre Dubuc

In another thread [How do you protect individual files], Justin French stated:

In real short, you want to store the files outside your htdocs root (so they
can't be served by http) . . . 

My PHP setup serves files from DOCUMENT_ROOT=/var/www/html. If I place files 
in '/var/www/html/secure' would this provide any isolation for file access? 
Am I correct in thinking that 'below' is not the same as 'outside' doc_root, 
and that i this case, no protection would be afforded?  

Tia,
Andre


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




[PHP] Code for off-site Maintenance?

2002-08-21 Thread Andre Dubuc

Soon, I will be transferring my site to go on-line with my IP. Since I've 
never managed anything off-site, I have a very fundamental question:

What are the usual procedures with respect to maintaining a site, that is, 
accessing the PostgreSQL database for corrections, deletions, etc?

One idea that occured to me:  mirror the site here, complete with database, 
and modify stuff at this end, then upload to the IP. Or should I create some 
form of management code that would allow me, using php, to access and modify 
the stuff on-line. I've looked at Zope, Midguard, and another one, but they 
seem like over-kill (and I would have to change a lot of my code to use them).

I would appreciate any input pointing how I should proceed -- I'm a total 
newbie in this area. Any pointers, or where to look, would be greatly 
appreciated.

Tia,
Andre

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




Re: [PHP] Re: halloween documents

2002-08-21 Thread David T-G

Steve --

...and then Steve Mallett said...
% 
% A plea for help
% 
% Would anyone be willing to code the Halloween Documents so we could 
% print them as PDF files
% 
% http://opensource.org/halloween/

While I don't particularly see what this has to do with php, I also
wonder what sort of coding you require.  What needs to be done?  I might
be just the guy to do it.


HTH  HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg76382/pgp0.pgp
Description: PGP signature


Re: [PHP] Simple Security Clarification

2002-08-21 Thread John Wards

Andre

Doc root = http://www.yoursite.com/
'/var/www/html/secure' = http://www.yoursite.com/secure/

So its not secure

You could use .htaccess files but I am not that clued up on them

John
- Original Message -
From: Andre Dubuc [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 21, 2002 1:11 PM
Subject: [PHP] Simple Security Clarification


 In another thread [How do you protect individual files], Justin French
stated:

 In real short, you want to store the files outside your htdocs root (so
they
 can't be served by http) . . .

 My PHP setup serves files from DOCUMENT_ROOT=/var/www/html. If I place
files
 in '/var/www/html/secure' would this provide any isolation for file
access?
 Am I correct in thinking that 'below' is not the same as 'outside'
doc_root,
 and that i this case, no protection would be afforded?

 Tia,
 Andre


 --
 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] Simple Security Clarification

2002-08-21 Thread Jay Blanchard

[snip]
In another thread [How do you protect individual files], Justin French
stated:

In real short, you want to store the files outside your htdocs root (so
they
can't be served by http) . . .

My PHP setup serves files from DOCUMENT_ROOT=/var/www/html. If I place files
in '/var/www/html/secure' would this provide any isolation for file access?
Am I correct in thinking that 'below' is not the same as 'outside' doc_root,
and that i this case, no protection would be afforded?
[/snip]

Yes, and no. 'Secure' is below the root and is therfore less protected.
However, you can still use .htaccess directives to control the 'secure'
directory much more closely. The path could be hacked, but if there is a
requirement to login to that folder (because of .htaccess directives) then
the hacker will still have to come up with appropriate authentication.

If the root is /var/www/html then outside of the root could be
/var/www/secure so that the path cannot be hacked from the browser, but you
should still apply appropriate restrictions.

HTH!

Jay

***
* Texas PHP Developers Conf  Spring 2003  *
* T Bar M Resort  Conference Center  *
* New Braunfels, Texas*
* San Antonio Area PHP Developers Group   *
* Interested? Contact [EMAIL PROTECTED] *
***



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




Re: [PHP] Simple Security Clarification

2002-08-21 Thread Stas Maximov

Outside would be in '/var/www/secure' in your case. Or any other place
your scripts have access to, save under '/var/www/html/'.

HTH, Stas

- Original Message -
From: Andre Dubuc [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 21, 2002 1:11 PM
Subject: [PHP] Simple Security Clarification


 In another thread [How do you protect individual files], Justin French
stated:

 In real short, you want to store the files outside your htdocs root (so
they
 can't be served by http) . . .

 My PHP setup serves files from DOCUMENT_ROOT=/var/www/html. If I place
files
 in '/var/www/html/secure' would this provide any isolation for file
access?
 Am I correct in thinking that 'below' is not the same as 'outside'
doc_root,
 and that i this case, no protection would be afforded?

 Tia,
 Andre


 --
 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] still problems with register globals set to on

2002-08-21 Thread Rasmus Lerdorf

Are you sure you are editing the right httpd.conf file first of all?  Put
an obvious syntax error in there, such as misspelling Directory in that
tag and see if you get an error.

If so, make sure that this Directory block is not inside some other tag,
or overridden by a second Directory block somewhere.

Third, are you sure you are using PHP as an Apache module?  If you are
using the CGI version, the this will obviously not work.

-Rasmus

On Wed, 21 Aug 2002, Andy wrote:

 thanx tom, but this doen not seem to have anything to do with it.

 Regards,

 Andy



 Tom Rogers [EMAIL PROTECTED] schrieb im Newsbeitrag
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi,
 
  Wednesday, August 21, 2002, 5:34:35 PM, you wrote:
  A Hello everybody,
 
  A I am still having problems to run php scripts inside a directory with
  A register globals on.
 
  A This is what I did put inside the httpd.conf file right after the
 Directory
  / close tag.
 
  A Directory /home/www/oasis
  A php_value register_globals on
  A /Directory
 
  A It does not change anything. I restarted apache of course.
 
  A Do u have an idea where the error could live?
 
  A Andy
 
 
  A Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag
  A [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Sure, turn register_globals on only for the oasis directory.  In your
   httpd.conf add:
  
   Directory /some/path/oasis
   php_value register_globals on
   /Directory
  
   -Rasmus
  
   On Mon, 19 Aug 2002, Andy wrote:
 
 
  You may need to add in the directory section (never used it so it is a
  guess)
 
  AllowOverride Options
 
  --
  regards,
  Tom
 



 --
 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] Garbage Collection?

2002-08-21 Thread Vehbi Sinan Tunalioglu

Hi everybody,

Is there any requirement to free variables in php, or is there any 
garbage collection or built-in module that terminates unused variables? 
(Especially for arrays and class instances)...

Have a nice day...
Vehbi Sinan Tunalioglu


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




Re: [PHP] Garbage Collection?

2002-08-21 Thread Rasmus Lerdorf

 Hi everybody,

 Is there any requirement to free variables in php, or is there any
 garbage collection or built-in module that terminates unused variables?
 (Especially for arrays and class instances)...

Garbage collection is automatic in PHP.  When you do:

$a = 123;
$a = 456;

Then the memory for 123 is returned to the system as soon as you re-assign
$a.  You can also return it by doing unset($a);

-Rasmus


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




[PHP] Re: Image library

2002-08-21 Thread Bogdan Stancescu

The answer I would give at this moment would be a variant of your A) 
version where the hash directories would further contain directories 
limited to, say 300 images. Found it out after a painfully slow 
experience with MySQL blobs. I did not however implement this solution 
yet (still using the blobs due to lack of time), so I can't give you an 
actual comparison (hence the format of my first sentence).

HTH

Bogdan

Scott Houseman wrote:
 Hi there.
 
 Which way would be the most efficient/fastest to access images from an image
 library.
 A) Store image files in a hash directory structure AND storing each file's
 information in a mysql table
 OR
 B) Storing image information in mysql table AND storing the image in a BLOB
 field in that table.
 
 The way I see it, considerations to be taken into acount:
 - Is it quicker/better to retrieve image from table  then stream out to
 browser OR simply direct the browser to the file?
   i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
 SRC=/imagelib/5/f/10
 - Will a database OR filesystem be more scalable i.e. which wil perform
 better when there are 1 images in the libary?
 
 Thanks in advance
 
 Regards
 
 -Scott
 
 --
 Scott Houseman
 Jam Warehouse http://www.jamwarehouse.com/
 Smart Business Innovation
 +27 21 4477440 / +27 82 4918021
 



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




Re: [PHP] array_splice()

2002-08-21 Thread Bas Jobsen




$test=array('a'=1,'b'=2,'c'=3);
foreach ($test as $key=$value)
{
 if ($value==2) unset($test[$key]);
}

or

$test=array('a'=1,'b'=2,'c'=3);
$i=0;
foreach ($test as $key=$value)
{
 if ($value==2) array_splice($test,$i,1);
$i++;
}


Op woensdag 21 augustus 2002 12:17, schreef u:
 Hi evey1,
 sorry if I' ve already posted this :
 in order to remove a whole array of values from a multidimensional array
 I tried the following:

 foreach($bkmks as $val) {

 if($val[8]==$cod){
array_splice($bkmks,$val,1);
}
   }It works fine for all the
 arrays but the first ($bkmks[0])
  When I try to remove that array this is what I get :
 Fatal error: Maximum execution time of 30 seconds exceeded in .
  after that if I read $bkmks all the arrays have been removed but
 $bkmks[0]
 (the array I wanted to  remove)
 Why ?
 Is there a better way to do it ?

 thanks again

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




RE: [PHP] Agh! trim (#$@#@^%!!!)

2002-08-21 Thread Mike At Spy


Get this - it didn't work!  :(

I tried decreasing the -1 to -2 and so on, but nothing on that either.  :(

-Mike



 -Original Message-
 From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 20, 2002 12:45 PM
 To: Mike At Spy
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Agh! trim (#$@#@^%!!!)
 
 
 Well, perhaps you have something after the . in that string?
 
 You can strip off the last char of a string very simply with:
 
substr($str,0,-1)
 
 -Rasmus
 
 On Tue, 20 Aug 2002, Mike At Spy wrote:
 
 
  Hey!
 
  :)
 
  I have an issue with trim / triml.  Whenever I put a string in 
 to trimmed,
  it refuses to take the period at the end of the string off.
 
  I did put more things to trim first, but this is basically what 
 I am doing:
 
 
  $single = The date is 20-Aug-2002. // This is an example - see below
  $trimmed = rtrim($date, .);
 
 
  Is there an issue with this?  I've tried using trim() too.
 
  The source of $single is a reponse from a server.  I should 
 note that when I
  put this in as an experiment, it works fine.  When I get the 
 line from the
  server, it doesn't work!
 
  The only thing I can think of is the possibility that the . I 
 am seeing at
  the end of the line isn't really one (it looks like a duck, 
 copies like a
  duck, but...isn't a duck??!!).
 
  Is there a way to just strip the last character off regardless 
 of what it
  is?
 
  Thanks,
 
  -Mike
 
 
 
  --
  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: Code for off-site Maintenance?

2002-08-21 Thread Kondwani Spike Mkandawire


Andre Dubuc [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Soon, I will be transferring my site to go on-line with my IP. Since I've
 never managed anything off-site, I have a very fundamental question:

 What are the usual procedures with respect to maintaining a site, that is,
 accessing the PostgreSQL database for corrections, deletions, etc?


I personally would create a user-friendly front end to enable changes
online...  In the long run this would save time...  (I'd obviously code in
php)...
I would not want to continuously be loading and uploading and remodifying
record changes as that would be time consuming in the long run...
As your DB grows, obviously time taken to keep transferring the
files via ftp (I am assuming as most hosts have this capability) would
keep increasing though by a small factor but eventually this all adds
up and becomes an inconvinnience...  Obviously another thing to keep
in mind is that most of the hosts I have seen in Canada are on a
UNIX platform so if you are to create a user -friendly front end for
yourself you will have to be familiar with the UNIX chmod settings
i.e keep in mind writable scripts will have to be set to 666
and this would usually require familiarity with SSH as that would be
how you would alter the settings (its all online)...  Anywayz as
you are using PHP you are probably already familiar with UNIX
tools and utilities...  (Which may not even be necessary as
some hosts run the insecure MS Web Server software hence run
on a MS platform risking defacement)...

Anywayz, those are just my views on the issue...

 One idea that occured to me:  mirror the site here, complete with
database,
 and modify stuff at this end, then upload to the IP. Or should I create
some
 form of management code that would allow me, using php, to access and
modify
 the stuff on-line. I've looked at Zope, Midguard, and another one, but
they
 seem like over-kill (and I would have to change a lot of my code to use
them).

 I would appreciate any input pointing how I should proceed -- I'm a total
 newbie in this area. Any pointers, or where to look, would be greatly
 appreciated.

 Tia,
 Andre



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




Re: [PHP] Code for off-site Maintenance?

2002-08-21 Thread David T-G

Andre, et al --

...and then Andre Dubuc said...
% 
% Soon, I will be transferring my site to go on-line with my IP. Since I've 
% never managed anything off-site, I have a very fundamental question:
% 
% What are the usual procedures with respect to maintaining a site, that is, 
% accessing the PostgreSQL database for corrections, deletions, etc?

While I'm the type who uses ssh to connect and does work on the server,
not everyone is.  I know how I'd take care of the problem, though :-)

Since you're not on the server, I'd either write some management code
as has been suggested (be sure to encrypt your connection, strongly
authenticate who is making the changes, and so on) or just let the
database handle it.  I haven't used PostgreSQL but I have to imagine
it will let you connect to a remote server (hey, MySQL will), so just
fire up your DB client on your local machine, connect to the remote DB,
and make your changes; the only security you need is an ssh [forwarding?]
port for the DB (or use a VPN tunnel).

You *definitely* shouldn't have to transfer entire copies of your DB via
ftp; that's just way too painful.


HTH  HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg76393/pgp0.pgp
Description: PGP signature


[PHP] fscanf - string format - clear discription

2002-08-21 Thread Harry.de

where can i find a discription of  the possible options for the sting
format in the fscanf command [  fscanf ( int handle, string format [,
string var1])  ]

For example, what means:

%s\t

or

%s\n

in the command fscanf ($fp, %s\t%s\t%s\n);






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




[PHP] Re: fscanf - string format - clear discription

2002-08-21 Thread l0t3k

here's some info. in reading, keep in mind that PHP's implementation is
mostly ANSI compatible.
http://www.neosoft.com/neosoft/man/scanf.3.html

Harry.De [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 where can i find a discription of  the possible options for the sting
 format in the fscanf command [  fscanf ( int handle, string format [,
 string var1])  ]

 For example, what means:

 %s\t

 or

 %s\n

 in the command fscanf ($fp, %s\t%s\t%s\n);








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




Re: [PHP] Agh! trim (#$@#@^%!!!)

2002-08-21 Thread Jason Wong

On Wednesday 21 August 2002 20:36, Mike At Spy wrote:
 Get this - it didn't work!  :(

 I tried decreasing the -1 to -2 and so on, but nothing on that either.  :(

Post your exact code which didn't work.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
You can't go home again, unless you set $HOME.
*/


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




Re[2]: [PHP] still problems with register globals set to on

2002-08-21 Thread Tom Rogers

Hi,

Wednesday, August 21, 2002, 9:32:43 PM, you wrote:
A thanx tom, but this doen not seem to have anything to do with it.

A Regards,

A Andy



A Tom Rogers [EMAIL PROTECTED] schrieb im Newsbeitrag
A [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 Wednesday, August 21, 2002, 5:34:35 PM, you wrote:
 A Hello everybody,

 A I am still having problems to run php scripts inside a directory with
 A register globals on.

 A This is what I did put inside the httpd.conf file right after the
A Directory
 / close tag.

 A Directory /home/www/oasis
 A php_value register_globals on
 A /Directory

 A It does not change anything. I restarted apache of course.

 A Do u have an idea where the error could live?

 A Andy


 A Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag
 A [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Sure, turn register_globals on only for the oasis directory.  In your
  httpd.conf add:
 
  Directory /some/path/oasis
  php_value register_globals on
  /Directory
 
  -Rasmus
 
  On Mon, 19 Aug 2002, Andy wrote:


 You may need to add in the directory section (never used it so it is a
 guess)

 AllowOverride Options

 --
 regards,
 Tom


I eventually got it to work with the following:

Directory /usr/local/apache/domains/whatever/www/admin
AllowOverride All
Order allow,deny
Allow from all
php_flag register_globals   on
/Directory




-- 
regards,
Tom


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




Re[3]: [PHP] still problems with register globals set to on

2002-08-21 Thread Tom Rogers

Hi,

Wednesday, August 21, 2002, 10:53:48 PM, you wrote:
TR Hi,

TR Wednesday, August 21, 2002, 9:32:43 PM, you wrote:
A thanx tom, but this doen not seem to have anything to do with it.

A Regards,

A Andy



A Tom Rogers [EMAIL PROTECTED] schrieb im Newsbeitrag
A [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 Wednesday, August 21, 2002, 5:34:35 PM, you wrote:
 A Hello everybody,

 A I am still having problems to run php scripts inside a directory with
 A register globals on.

 A This is what I did put inside the httpd.conf file right after the
A Directory
 / close tag.

 A Directory /home/www/oasis
 A php_value register_globals on
 A /Directory

 A It does not change anything. I restarted apache of course.

 A Do u have an idea where the error could live?

 A Andy


 A Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag
 A [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Sure, turn register_globals on only for the oasis directory.  In your
  httpd.conf add:
 
  Directory /some/path/oasis
  php_value register_globals on
  /Directory
 
  -Rasmus
 
  On Mon, 19 Aug 2002, Andy wrote:


 You may need to add in the directory section (never used it so it is a
 guess)

 AllowOverride Options

 --
 regards,
 Tom


TR I eventually got it to work with the following:

TR Directory /usr/local/apache/domains/whatever/www/admin
TR AllowOverride All
TR Order allow,deny
TR Allow from all
TR php_flag register_globals   on
TR /Directory
In the httpd.conf you can get away with just:


Directory /usr/local/apache/domains/whatever/www/admin
php_flag register_globals   on
/Directory

-- 
regards,
Tom


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




RE: [PHP] Agh! trim (#$@#@^%!!!)

2002-08-21 Thread Mike At Spy


Here is the complete code - I have a lot of prints to watch things as they
happen. $whois is the result of a WHOIS search.



// beginning of my stuff

function get_date ($whois){
trim ($whois);
$whoisarray = explode (\n, $whois);
print_r(array_values ($whoisarray));

$total_elements = count ($whoisarray);

print pb$total_elements/b elements in this array;

$ce = 0;

while ($ce  $total_elements){

$single_line = array_pop ($whoisarray);

$expiration = strstr ($single_line,xpires);

if ($expiration != '' || 0) {

print pbThis is the line you want!  Line $ce that sez:
$single_line/bp;

// $single_line = preg_replace (.,  , $single_line);

$single_line = substr($single_line, 0, -2);

//  $single_line = rtrim ($single_line, \t\s\n\r);

$getdatearray = explode ( , $single_line);
print_r(array_values ($getdatearray));

$total_expire_elements = count ($getdatearray);

print pbr.$total_expire_elements;

$dc = 0;

while ($dc  $total_expire_elements){

$element = array_pop($getdatearray);

$date_dash = strstr($element,-);

if ($date_dash != '' || 0){

print pbrFirst Detection .$element;

// $trimmed = rtrim ($element, \t.);

print pbrLast print before date function 
.$element;

month_replace ($element);

print pbrResult after function .$element.pbr;

$MySQLDate=date_validate($element);
if (substr($MySQLDate, 0, 5)==Error) {
// Insert Error Code if you want
} else {
// Insert Valid Date Code if you want
}

print pThe MySQL Formated date is $MySQLDate;

}
else {}

$dc++;

 }

}
else {}

$ce++;

}

}
// end of my stuff


Thanks,

-Mike






 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 21, 2002 8:53 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Agh! trim (#$@#@^%!!!)


 On Wednesday 21 August 2002 20:36, Mike At Spy wrote:
  Get this - it didn't work!  :(
 
  I tried decreasing the -1 to -2 and so on, but nothing on that
 either.  :(

 Post your exact code which didn't work.

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 You can't go home again, unless you set $HOME.
 */


 --
 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] Code for off-site Maintenance?

2002-08-21 Thread Justin French

I'm usually weeks, or month ahead of myself.  The code I have in my local
environment is looking forward towards knew features, new ideas, etc etc.
Every week or two I grab a mirror of the online database (or I could connect
straight to it of course), and WHEN new code is ready to upload, I do it via
FTP.

If I had a LOT of uploads, I'd write something that does it for me,
comparing dates or something.

I do have a web-based control panel  content management system for some
sections of some sites, allowing me (or the client) to add / edit / delete /
arrange some content...

End of the day, it's each to their own -- but I know that I wouldn't want to
be directly editing live code, data or modules on the fly.  I like to work
on a mirror, test, test, test, upload, test.


Justin French


on 21/08/02 10:11 PM, Andre Dubuc ([EMAIL PROTECTED]) wrote:

 Soon, I will be transferring my site to go on-line with my IP. Since I've
 never managed anything off-site, I have a very fundamental question:
 
 What are the usual procedures with respect to maintaining a site, that is,
 accessing the PostgreSQL database for corrections, deletions, etc?
 
 One idea that occured to me:  mirror the site here, complete with database,
 and modify stuff at this end, then upload to the IP. Or should I create some
 form of management code that would allow me, using php, to access and modify
 the stuff on-line. I've looked at Zope, Midguard, and another one, but they
 seem like over-kill (and I would have to change a lot of my code to use them).
 
 I would appreciate any input pointing how I should proceed -- I'm a total
 newbie in this area. Any pointers, or where to look, would be greatly
 appreciated.
 
 Tia,
 Andre


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




[PHP] Best way to check for some certain text in a string

2002-08-21 Thread José Jeria

I want to find a certain text in a string and i want it to return me a
boolean.
What is the best thing to do this?

a) ereg(search for this, $string);// returns
int(1) if true, bool(false) if not
b) strpos($nav-userAgent, search for this)  0// gives me a boolean
directly

Any tips of which one I should use?

/José Jeria



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




Re: [PHP] Image library

2002-08-21 Thread Justin French

on 21/08/02 9:45 PM, Scott Houseman ([EMAIL PROTECTED]) wrote:


 Which way would be the most efficient/fastest to access images from an image
 library.
 A) Store image files in a hash directory structure AND storing each file's
 information in a mysql table
 OR
 B) Storing image information in mysql table AND storing the image in a BLOB
 field in that table.

From all accounts I've read on this list, a database is not usually faster
than a filesystem.  And for large amounts of files, like 1000's, a hash will
speed it up more.


 The way I see it, considerations to be taken into acount:
 - Is it quicker/better to retrieve image from table  then stream out to
 browser OR simply direct the browser to the file?
 i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
 SRC=/imagelib/5/f/10
 - Will a database OR filesystem be more scalable i.e. which wil perform
 better when there are 1 images in the libary?

Filesystem should be quicker.  You need to think about how you hash the
files up for the most even spread of files in each directory I guess.


Justin


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




Re: [PHP] PHP IDEs

2002-08-21 Thread Jaski

Even I would be very interested to know what every one out there 
uses for these. I use PhpMyAdmin for creating tables. Textpad for 
coding.

Jaski

On Wed, 21 Aug 2002 Michael Egan wrote :
I know similar threads have come up on this in the past but I 
suspect it's a constantly changing picture.

I recently saw a favourable review of Zend Studio 2.5 but 
wondered, out of curiosity, what sort of tools people use to 
develop PHP scripts and MySQL databases, tables and queries.

Up until now, in an attempt to try and get to grips with these 
packages, I've been using a variety of text editors from VI to 
Kwrite.  But I'm wondering whether it might speed up development 
times if I start to use one of the tools out there for working 
with PHP and MySQL.

Any thoughts?

Michael Egan

--
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] Simple Security Clarification

2002-08-21 Thread Justin French

If you can't store stuff ABOVE your doc root, you can protect them with a
.htaccess file.

I use this to refuse all *.inc files from being served:

Files ~ \.inc$
Order Allow,Deny
Deny from all
/Files

With this in mind, a quick visit to the Apache site should get you started
in the right direction.


Justin French


on 21/08/02 10:11 PM, Andre Dubuc ([EMAIL PROTECTED]) wrote:

 In another thread [How do you protect individual files], Justin French stated:
 
 In real short, you want to store the files outside your htdocs root (so they
 can't be served by http) . . .
 
 My PHP setup serves files from DOCUMENT_ROOT=/var/www/html. If I place files
 in '/var/www/html/secure' would this provide any isolation for file access?
 Am I correct in thinking that 'below' is not the same as 'outside' doc_root,
 and that i this case, no protection would be afforded?
 
 Tia,
 Andre
 


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




Re: [PHP] Simple Security Clarification

2002-08-21 Thread Andre Dubuc

On Wednesday 21 August 2002 08:15 am, Jay Blanchard wrote:
 [snip]
 In another thread [How do you protect individual files], Justin French
 stated:

 In real short, you want to store the files outside your htdocs root (so
 they
 can't be served by http) . . .

 My PHP setup serves files from DOCUMENT_ROOT=/var/www/html. If I place
 files in '/var/www/html/secure' would this provide any isolation for file
 access? Am I correct in thinking that 'below' is not the same as 'outside'
 doc_root, and that i this case, no protection would be afforded?
 [/snip]

 Yes, and no. 'Secure' is below the root and is therfore less protected.
 However, you can still use .htaccess directives to control the 'secure'
 directory much more closely. The path could be hacked, but if there is a
 requirement to login to that folder (because of .htaccess directives) then
 the hacker will still have to come up with appropriate authentication.

 If the root is /var/www/html then outside of the root could be
 /var/www/secure so that the path cannot be hacked from the browser, but you
 should still apply appropriate restrictions.

 HTH!

 Jay

Thanks Jay,

It's becoming clearer. But one question concerning:

the path could be hacked, but if there is a requirement to login to that 
folder (because of .htaccess directives)  then the hacker will still have to 
come up with appropriate authentication.

Since all sensitive files on my site require login (username/password) and 
each (https) page requires the appropriate $_SESSION variables before it'll 
load, I wonder whether I can leave things as they are (everything in the 
/html folder)? You mentioned that the path could be hacked -- if that's the 
case (even using .htaccess) would setting these sensitive files below the 
root make much difference?

Tia,
Andre

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




Re: [PHP] PHP IDEs

2002-08-21 Thread John Wards

I use Zend Studio 2.5 it is very time saveing as it prompts me for variables
i have used before classws and function i have used before etc even if they
are in an include file. The projects feature is very usefull as I have two
major projects at the moment and I can easily switch between then and have
all my files at hand. If you can afford it get it!

For Mysql I use DBtools as I have many databases over many different servers
so it lets me have access to them all in one place and i can test out my
queries before i use them in a script which is very usefull.

I used to use PHPcoder but it is far too buggy to use on a day to day bases.

John
- Original Message -
From: Jaski [EMAIL PROTECTED]
To: PHP General(E-mail) [EMAIL PROTECTED]
Sent: Wednesday, August 21, 2002 2:27 PM
Subject: Re: [PHP] PHP IDEs


 Even I would be very interested to know what every one out there
 uses for these. I use PhpMyAdmin for creating tables. Textpad for
 coding.

 Jaski

 On Wed, 21 Aug 2002 Michael Egan wrote :
 I know similar threads have come up on this in the past but I
 suspect it's a constantly changing picture.
 
 I recently saw a favourable review of Zend Studio 2.5 but
 wondered, out of curiosity, what sort of tools people use to
 develop PHP scripts and MySQL databases, tables and queries.
 
 Up until now, in an attempt to try and get to grips with these
 packages, I've been using a variety of text editors from VI to
 Kwrite.  But I'm wondering whether it might speed up development
 times if I start to use one of the tools out there for working
 with PHP and MySQL.
 
 Any thoughts?
 
 Michael Egan
 
 --
 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




RE: [PHP] Image library

2002-08-21 Thread Scott Houseman

Hi all.

This confirms what I suspected.

The hash algrithm:

I have a directory structure: dirs 0 - f, and within each of these, the same
dir structure 0 - f.
When an image gets uploaded into the library, do an md5sum of the file, take
the first 2 chars of that hash
and there's your path. e.g
$PICDBPATH.'/a/7/a7b8be10b0e69fe3decaa538f1febe84'

I'm not sure what the mathematical randomness of this is, but I'm sure it's
pretty random, and the chances
of collision should be virtually null, the only time you should overwrite a
file is if you upload the exact same file(?)
Is there a better way of doing this?

Cheers

-Scott

 -Original Message-
 From: Justin French [mailto:[EMAIL PROTECTED]]
 Sent: 21 August 2002 03:25
 To: [EMAIL PROTECTED]; PHP General
 Subject: Re: [PHP] Image library


 on 21/08/02 9:45 PM, Scott Houseman ([EMAIL PROTECTED]) wrote:


  Which way would be the most efficient/fastest to access images
 from an image
  library.
  A) Store image files in a hash directory structure AND storing
 each file's
  information in a mysql table
  OR
  B) Storing image information in mysql table AND storing the
 image in a BLOB
  field in that table.

 From all accounts I've read on this list, a database is not
 usually faster
 than a filesystem.  And for large amounts of files, like 1000's,
 a hash will
 speed it up more.


  The way I see it, considerations to be taken into acount:
  - Is it quicker/better to retrieve image from table  then stream out to
  browser OR simply direct the browser to the file?
  i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
  SRC=/imagelib/5/f/10
  - Will a database OR filesystem be more scalable i.e. which wil perform
  better when there are 1 images in the libary?

 Filesystem should be quicker.  You need to think about how you hash the
 files up for the most even spread of files in each directory I guess.


 Justin




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




[PHP] PHP/SQL - inserting into database null results

2002-08-21 Thread news

I am a new person to PHP.  I have purchased and read PHP fast  easy by
Julie Meloni and have also read the 24 hours PHP book.  I am able to connect
to the SQL database and insert into the database via my html form.  However,
the values are null.  When I look at the data in my database, it reads  ,
 ,  , etc.

I have tried a couple different code:

$query = INSERT INTO MemberReviews
 VALUES (' ','$memb_name', '$bookname','$author', '$grade', '$review') ;
mysql_query($query);

mysql_close();

or in the form itself, I have tried:

?
# this is processed when the form is submitted
# back on to this page (POST METHOD)
if ($REQUEST_METHOD==POST) {

# double-up apostrophes
$review = str_replace(','',$review);
$author = str_replace(','',$author);

# setup SQL statement
$SQL =  INSERT INTO MemberReviews ;
$SQL = $SQL .  (memb_name, bookname, author, grade, review) VALUES
;
$SQL = $SQL .  ('$memb_name', '$bookname','$author', '$grade',
'$review') ;

#execute SQL statement
$result = mysql_db_query($db,$SQL,$cid);

# check for error
if (!$result) { echo(ERROR:  . mysql_error() . \n$SQL\n);}

echo (PBNew Record Added/B/P\n);

}

?

Thanks in advance for your help

Jennifer




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




RE: [PHP] Simple Security Clarification

2002-08-21 Thread Jay Blanchard

[snip]
It's becoming clearer. But one question concerning:

the path could be hacked, but if there is a requirement to login to that
folder (because of .htaccess directives)  then the hacker will still have to
come up with appropriate authentication.

Since all sensitive files on my site require login (username/password) and
each (https) page requires the appropriate $_SESSION variables before it'll
load, I wonder whether I can leave things as they are (everything in the
/html folder)? You mentioned that the path could be hacked -- if that's
the
case (even using .htaccess) would setting these sensitive files below the
root make much difference?
[/snip]

I think that it is better to situate these sensitive files outside of the
web root accessible with appropriate authentication and session ID. You can
leave everything as is, and be reasonably assured of security. Me
personally? I would take the extra step. That way you know that you have
done all that you could possibly do.

As I have said (and many others have said), If you don't want anyone to get
a hold of the file, do not make it available from your web root.

HTH!

Jay

***
* Texas PHP Developers Conf  Spring 2003  *
* T Bar M Resort  Conference Center  *
* New Braunfels, Texas*
* San Antonio Area PHP Developers Group   *
* Interested? Contact [EMAIL PROTECTED] *
***



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




Re: [PHP] Code for off-site Maintenance?

2002-08-21 Thread Andre Dubuc

Thanks Justin,

A web-based control panel  content management system seems like a nice 
invitation to enter 'Hackers' Paradise'. I like the idea of doing it at home 
and testing, as you do. Something inside of me squirms at the idea of the 
whole shebang being tatooed by a hacker.

Regards,
Andre

On Wednesday 21 August 2002 09:21 am, Justin French wrote:
 I'm usually weeks, or month ahead of myself.  The code I have in my local
 environment is looking forward towards knew features, new ideas, etc etc.
 Every week or two I grab a mirror of the online database (or I could
 connect straight to it of course), and WHEN new code is ready to upload, I
 do it via FTP.

 If I had a LOT of uploads, I'd write something that does it for me,
 comparing dates or something.

 I do have a web-based control panel  content management system for some
 sections of some sites, allowing me (or the client) to add / edit / delete
 / arrange some content...

 End of the day, it's each to their own -- but I know that I wouldn't want
 to be directly editing live code, data or modules on the fly.  I like to
 work on a mirror, test, test, test, upload, test.


 Justin French

 on 21/08/02 10:11 PM, Andre Dubuc ([EMAIL PROTECTED]) wrote:
  Soon, I will be transferring my site to go on-line with my IP. Since I've
  never managed anything off-site, I have a very fundamental question:
 
  What are the usual procedures with respect to maintaining a site, that
  is, accessing the PostgreSQL database for corrections, deletions, etc?
 
  One idea that occured to me:  mirror the site here, complete with
  database, and modify stuff at this end, then upload to the IP. Or should
  I create some form of management code that would allow me, using php, to
  access and modify the stuff on-line. I've looked at Zope, Midguard, and
  another one, but they seem like over-kill (and I would have to change a
  lot of my code to use them).
 
  I would appreciate any input pointing how I should proceed -- I'm a total
  newbie in this area. Any pointers, or where to look, would be greatly
  appreciated.
 
  Tia,
  Andre

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




RE: [PHP] Image library

2002-08-21 Thread Michael Hazelden

I did something like this a while ago ... and while it might not be the best
solution - here's my situation and my solution:

I had a number of photos (just shy of 1000) ...

all were from various theatre shows ... taken at a different time of the
process (rehearsal ... performance etc).

So - I set up the following table in MySQL:

Photo ID - an auto increment integer
Show ID - an integer
Time ID - an integer
Imagetype - a string (JPG or Gif etc)

When the file was then uploaded - the user selects a show and time to store
it under. The file is then transferred to a directory numbered thus :

/photos/showid/timeid/photoid.jpg

When I then want to find a photo - it does a query over the database,
retrieves the information and can access the photo appropriately.

The downside of this - is that in order to know which photo is which - you
have to access the database first.

Dunno if that helps - but I thought I'd share my experience.

Michael.

-Original Message-
From: Scott Houseman [mailto:[EMAIL PROTECTED]]
Sent: 21 August 2002 14:39
To: Justin French; PHP General
Subject: RE: [PHP] Image library


Hi all.

This confirms what I suspected.

The hash algrithm:

I have a directory structure: dirs 0 - f, and within each of these, the same
dir structure 0 - f.
When an image gets uploaded into the library, do an md5sum of the file, take
the first 2 chars of that hash
and there's your path. e.g
$PICDBPATH.'/a/7/a7b8be10b0e69fe3decaa538f1febe84'

I'm not sure what the mathematical randomness of this is, but I'm sure it's
pretty random, and the chances
of collision should be virtually null, the only time you should overwrite a
file is if you upload the exact same file(?)
Is there a better way of doing this?

Cheers

-Scott

 -Original Message-
 From: Justin French [mailto:[EMAIL PROTECTED]]
 Sent: 21 August 2002 03:25
 To: [EMAIL PROTECTED]; PHP General
 Subject: Re: [PHP] Image library


 on 21/08/02 9:45 PM, Scott Houseman ([EMAIL PROTECTED]) wrote:


  Which way would be the most efficient/fastest to access images
 from an image
  library.
  A) Store image files in a hash directory structure AND storing
 each file's
  information in a mysql table
  OR
  B) Storing image information in mysql table AND storing the
 image in a BLOB
  field in that table.

 From all accounts I've read on this list, a database is not
 usually faster
 than a filesystem.  And for large amounts of files, like 1000's,
 a hash will
 speed it up more.


  The way I see it, considerations to be taken into acount:
  - Is it quicker/better to retrieve image from table  then stream out to
  browser OR simply direct the browser to the file?
  i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
  SRC=/imagelib/5/f/10
  - Will a database OR filesystem be more scalable i.e. which wil perform
  better when there are 1 images in the libary?

 Filesystem should be quicker.  You need to think about how you hash the
 files up for the most even spread of files in each directory I guess.


 Justin




-- 
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] PHP Site Mirror

2002-08-21 Thread Jay Blanchard

Can someone give me a URL for a php.net mirror? I am having trouble with
access...

Thanks!

Jay

***
* Texas PHP Developers Conf  Spring 2003  *
* T Bar M Resort  Conference Center  *
* New Braunfels, Texas*
* San Antonio Area PHP Developers Group   *
* Interested? Contact [EMAIL PROTECTED] *
***



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




Re: [PHP] Image library

2002-08-21 Thread Bogdan Stancescu

I've seen this kind of random approach several times and I keep 
wondering why not counting the files instead. Yes, it may take a little 
longer when uploading but I personally think the safety of the approach 
is worth the insignificant speed sacrifice.

Bogdan

Scott Houseman wrote:
 Hi all.
 
 This confirms what I suspected.
 
 The hash algrithm:
 
 I have a directory structure: dirs 0 - f, and within each of these, the same
 dir structure 0 - f.
 When an image gets uploaded into the library, do an md5sum of the file, take
 the first 2 chars of that hash
 and there's your path. e.g
 $PICDBPATH.'/a/7/a7b8be10b0e69fe3decaa538f1febe84'
 
 I'm not sure what the mathematical randomness of this is, but I'm sure it's
 pretty random, and the chances
 of collision should be virtually null, the only time you should overwrite a
 file is if you upload the exact same file(?)
 Is there a better way of doing this?
 
 Cheers
 
 -Scott
 
 
-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: 21 August 2002 03:25
To: [EMAIL PROTECTED]; PHP General
Subject: Re: [PHP] Image library


on 21/08/02 9:45 PM, Scott Houseman ([EMAIL PROTECTED]) wrote:



Which way would be the most efficient/fastest to access images

from an image

library.
A) Store image files in a hash directory structure AND storing

each file's

information in a mysql table
OR
B) Storing image information in mysql table AND storing the

image in a BLOB

field in that table.

From all accounts I've read on this list, a database is not
usually faster
than a filesystem.  And for large amounts of files, like 1000's,
a hash will
speed it up more.



The way I see it, considerations to be taken into acount:
- Is it quicker/better to retrieve image from table  then stream out to
browser OR simply direct the browser to the file?
i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
SRC=/imagelib/5/f/10
- Will a database OR filesystem be more scalable i.e. which wil perform
better when there are 1 images in the libary?

Filesystem should be quicker.  You need to think about how you hash the
files up for the most even spread of files in each directory I guess.


Justin


 
 



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




[PHP] Re: PHP Site Mirror

2002-08-21 Thread Bogdan Stancescu

Seems to be down - I can't reach it either.

Bogdan

Jay Blanchard wrote:
 Can someone give me a URL for a php.net mirror? I am having trouble with
 access...
 
 Thanks!
 
 Jay
 
 ***
 * Texas PHP Developers Conf  Spring 2003  *
 * T Bar M Resort  Conference Center  *
 * New Braunfels, Texas*
 * San Antonio Area PHP Developers Group   *
 * Interested? Contact [EMAIL PROTECTED] *
 ***
 
 



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




[PHP] mysql_query() ERROR

2002-08-21 Thread Fifield, Mike

This is a query that I am sending to mysql. The problem is that sometimes in
the variable $message characters like ) will get posted and when they do
it makes mysql die. I can only assume that mysql thinks that the ) in the
$message variable is meant to close the sql query, but I am having trouble
figuring out how to avoid this. I suppose I could use a regex to replace all
special characters with something more sql friendly but I am hoping there is
a better way to do this. Thanks for any help.  

 

mysql_query(insert into guestbook
(gb_entry_id,date,name,email,website_name,website_url,message) values
('',CURDATE(),'$name','$email','$website_name','$website_url','$message'))
or die (mysql_error());






[PHP] Re: Best way to check for some certain text in a string

2002-08-21 Thread Bogdan Stancescu

If you don't need regexps, use strpos. Make sure you read the 
documentation though - if $nav-userAgent starts with search for this, 
your code will return false.

Bogdan

José Jeria wrote:
 I want to find a certain text in a string and i want it to return me a
 boolean.
 What is the best thing to do this?
 
 a) ereg(search for this, $string);// returns
 int(1) if true, bool(false) if not
 b) strpos($nav-userAgent, search for this)  0// gives me a boolean
 directly
 
 Any tips of which one I should use?
 
 /José Jeria
 
 



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




[PHP] Re: PHP Site Mirror

2002-08-21 Thread Peter Bottenberg

http://uk.php.net
http://nl.php.net

Just checked them, and they are online


Bogdan Stancescu [EMAIL PROTECTED] schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Seems to be down - I can't reach it either.

 Bogdan

 Jay Blanchard wrote:
  Can someone give me a URL for a php.net mirror? I am having trouble with
  access...
 
  Thanks!
 
  Jay
 
  ***
  * Texas PHP Developers Conf  Spring 2003  *
  * T Bar M Resort  Conference Center  *
  * New Braunfels, Texas*
  * San Antonio Area PHP Developers Group   *
  * Interested? Contact [EMAIL PROTECTED] *
  ***
 
 





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




Re: [PHP] PHP Site Mirror

2002-08-21 Thread @ Edwin
Try this Jay,

  http://us.php.net/mirrors.php

(A mirror PLUS a list of mirrors...)

- E


Can someone give me a URL for a php.net mirror? I am having trouble with
access...

Thanks!

Jay

***
* Texas PHP Developers Conf  Spring 2003  *
* T Bar M Resort  Conference Center  *
* New Braunfels, Texas*
* San Antonio Area PHP Developers Group   *
* Interested? Contact [EMAIL PROTECTED] *
***



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




_
$B:G?7$N%U%!%$%J%s%9>pJs$H%i%$%U%W%i%s$N%"%I%P%$%9(B MSN $B%^%M!<(B 
http://money.msn.co.jp/


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


[PHP] Re: mysql_query() ERROR

2002-08-21 Thread Bogdan Stancescu

It's not the ) characters, it's the quotes - make sure you 
addslashes() to all the variables. Also make sure you don't double-slash 
- depending on your php.ini settings, PHP may automatically slash 
incoming variables.

Bogdan

Mike Fifield wrote:
 This is a query that I am sending to mysql. The problem is that sometimes in
 the variable $message characters like ) will get posted and when they do
 it makes mysql die. I can only assume that mysql thinks that the ) in the
 $message variable is meant to close the sql query, but I am having trouble
 figuring out how to avoid this. I suppose I could use a regex to replace all
 special characters with something more sql friendly but I am hoping there is
 a better way to do this. Thanks for any help.  
 
  
 
 mysql_query(insert into guestbook
 (gb_entry_id,date,name,email,website_name,website_url,message) values
 ('',CURDATE(),'$name','$email','$website_name','$website_url','$message'))
 or die (mysql_error());
 
 
 
 



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




RE: [PHP] mysql_query() ERROR

2002-08-21 Thread Jay Blanchard

[snip]
This is a query that I am sending to mysql. The problem is that sometimes in
the variable $message characters like ) will get posted and when they do
it makes mysql die. I can only assume that mysql thinks that the ) in the
$message variable is meant to close the sql query, but I am having trouble
figuring out how to avoid this. I suppose I could use a regex to replace all
special characters with something more sql friendly but I am hoping there is
a better way to do this. Thanks for any help.

mysql_query(insert into guestbook
(gb_entry_id,date,name,email,website_name,website_url,message) values
('',CURDATE(),'$name','$email','$website_name','$website_url','$message'))
or die (mysql_error());
[/snip]

You need to addslashes($message). Why, you ask curiously? It is because a
person posting to the guestbook has either single or double quotes (or both)
within the message which aren't escaped properly. addslashes() does this.
Use stripslashes() when retrieving the message for display to remove the
slashes so that the message looks normal.

HTH!

Jay

***
* Texas PHP Developers Conf  Spring 2003  *
* T Bar M Resort  Conference Center  *
* New Braunfels, Texas*
* San Antonio Area PHP Developers Group   *
* Interested? Contact [EMAIL PROTECTED] *
***




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




[PHP] Re: Best way to check for some certain text in a string

2002-08-21 Thread José Jeria

Bogdan Stancescu [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 If you don't need regexps, use strpos. Make sure you read the

Can you give me any particular reason why strpos is better?

 documentation though - if $nav-userAgent starts with search for this,
 your code will return false.

Yeah, that was a typo when i copy and pasted.


 Bogdan

 José Jeria wrote:
  I want to find a certain text in a string and i want it to return me a
  boolean.
  What is the best thing to do this?
 
  a) ereg(search for this, $string);//
returns
  int(1) if true, bool(false) if not
  b) strpos($nav-userAgent, search for this)  0// gives me a
boolean
  directly
 
  Any tips of which one I should use?
 
  /José Jeria
 
 





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




RE: [PHP] Agh! trim (#$@#@^%!!!)

2002-08-21 Thread Rasmus Lerdorf

Well, do a strlen() on it to see how long it actually is.  I bet you have
all sorts of stuff trailing that thing.  Or you are just making some other
really silly mistake.

-Rasmus

On Wed, 21 Aug 2002, Mike At Spy wrote:


 Get this - it didn't work!  :(

 I tried decreasing the -1 to -2 and so on, but nothing on that either.  :(

 -Mike



  -Original Message-
  From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, August 20, 2002 12:45 PM
  To: Mike At Spy
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP] Agh! trim (#$@#@^%!!!)
 
 
  Well, perhaps you have something after the . in that string?
 
  You can strip off the last char of a string very simply with:
 
 substr($str,0,-1)
 
  -Rasmus
 
  On Tue, 20 Aug 2002, Mike At Spy wrote:
 
  
   Hey!
  
   :)
  
   I have an issue with trim / triml.  Whenever I put a string in
  to trimmed,
   it refuses to take the period at the end of the string off.
  
   I did put more things to trim first, but this is basically what
  I am doing:
  
  
   $single = The date is 20-Aug-2002. // This is an example - see below
   $trimmed = rtrim($date, .);
  
  
   Is there an issue with this?  I've tried using trim() too.
  
   The source of $single is a reponse from a server.  I should
  note that when I
   put this in as an experiment, it works fine.  When I get the
  line from the
   server, it doesn't work!
  
   The only thing I can think of is the possibility that the . I
  am seeing at
   the end of the line isn't really one (it looks like a duck,
  copies like a
   duck, but...isn't a duck??!!).
  
   Is there a way to just strip the last character off regardless
  of what it
   is?
  
   Thanks,
  
   -Mike
  
  
  
   --
   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] Agh! trim (#$@#@^%!!!)

2002-08-21 Thread DL Neil

Mike,
What are the character codes of the last few bytes in the string?
Please advise,
=dn

- Original Message -
From: Mike At Spy [EMAIL PROTECTED]
To: Rasmus Lerdorf [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, August 21, 2002 1:36 PM
Subject: RE: [PHP] Agh! trim (#$@#@^%!!!)



 Get this - it didn't work!  :(

 I tried decreasing the -1 to -2 and so on, but nothing on that either.  :(

 -Mike



  -Original Message-
  From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, August 20, 2002 12:45 PM
  To: Mike At Spy
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP] Agh! trim (#$@#@^%!!!)
 
 
  Well, perhaps you have something after the . in that string?
 
  You can strip off the last char of a string very simply with:
 
 substr($str,0,-1)
 
  -Rasmus
 
  On Tue, 20 Aug 2002, Mike At Spy wrote:
 
  
   Hey!
  
   :)
  
   I have an issue with trim / triml.  Whenever I put a string in
  to trimmed,
   it refuses to take the period at the end of the string off.
  
   I did put more things to trim first, but this is basically what
  I am doing:
  
  
   $single = The date is 20-Aug-2002. // This is an example - see below
   $trimmed = rtrim($date, .);
  
  
   Is there an issue with this?  I've tried using trim() too.
  
   The source of $single is a reponse from a server.  I should
  note that when I
   put this in as an experiment, it works fine.  When I get the
  line from the
   server, it doesn't work!
  
   The only thing I can think of is the possibility that the . I
  am seeing at
   the end of the line isn't really one (it looks like a duck,
  copies like a
   duck, but...isn't a duck??!!).
  
   Is there a way to just strip the last character off regardless
  of what it
   is?
  
   Thanks,
  
   -Mike
  
  
  
   --
   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




RE: [PHP] Agh! trim (#$@#@^%!!!)

2002-08-21 Thread Darren Gamble

Good day,

Well, for one, you are discarding the results of trim().

Check out the online manual page for trim().  The trim'ed string is
returned.  It does not say it modifies the string it is passed.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


 -Original Message-
 From: Mike At Spy [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 21, 2002 7:12 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Agh! trim (#$@#@^%!!!)
 
 
 
 Here is the complete code - I have a lot of prints to watch 
 things as they
 happen. $whois is the result of a WHOIS search.
 
 
 
 // beginning of my stuff
 
 function get_date ($whois){
 trim ($whois);
 $whoisarray = explode (\n, $whois);
 print_r(array_values ($whoisarray));
 
 $total_elements = count ($whoisarray);
 
 print pb$total_elements/b elements in this array;
 
 $ce = 0;
 
 while ($ce  $total_elements){
 
   $single_line = array_pop ($whoisarray);
 
   $expiration = strstr ($single_line,xpires);
 
   if ($expiration != '' || 0) {
 
   print pbThis is the line you want!  Line $ce that sez:
 $single_line/bp;
 
   // $single_line = preg_replace (.,  , $single_line);
 
   $single_line = substr($single_line, 0, -2);
 
   //  $single_line = rtrim ($single_line, \t\s\n\r);
 
   $getdatearray = explode ( , $single_line);
   print_r(array_values ($getdatearray));
 
   $total_expire_elements = count ($getdatearray);
 
   print pbr.$total_expire_elements;
 
   $dc = 0;
 
   while ($dc  $total_expire_elements){
 
   $element = array_pop($getdatearray);
 
   $date_dash = strstr($element,-);
 
   if ($date_dash != '' || 0){
 
   print pbrFirst Detection 
 .$element;
 
   // $trimmed = rtrim ($element, \t.);
 
   print pbrLast print before 
 date function .$element;
 
   month_replace ($element);
 
   print pbrResult after function 
 .$element.pbr;
 
   $MySQLDate=date_validate($element);
   if (substr($MySQLDate, 0, 5)==Error) {
   // Insert Error Code if you want
   } else {
   // Insert Valid Date Code if you want
   }
 
   print pThe MySQL Formated date is 
 $MySQLDate;
 
   
   }
   else {}
 
   $dc++;
 
}
 
   
   }
   else {}
 
   $ce++;
 
   }
 
 }
   // end of my stuff
 
 
 Thanks,
 
 -Mike
 
 
 
 
 
 
  -Original Message-
  From: Jason Wong [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, August 21, 2002 8:53 AM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] Agh! trim (#$@#@^%!!!)
 
 
  On Wednesday 21 August 2002 20:36, Mike At Spy wrote:
   Get this - it didn't work!  :(
  
   I tried decreasing the -1 to -2 and so on, but nothing on that
  either.  :(
 
  Post your exact code which didn't work.
 
  --
  Jason Wong - Gremlins Associates - www.gremlins.com.hk
  Open Source Software Systems Integrators
  * Web Design  Hosting * Internet  Intranet Applications 
 Development *
 
  /*
  You can't go home again, unless you set $HOME.
  */
 
 
  --
  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




Re: [PHP] Image library

2002-08-21 Thread DL Neil

Scott (confirming Bogdan),

Libraries of all types have had this concern for years - even though books
are uniquely identified by ISBN, that is still not good enough for library
purposes (eg multiple copies of a single title). So they, exactly as Bogdan
suggests, use an Accession number sequence - which can be implemented very
neatly in MySQL (from PHP) as an AUTO_INCREMENT field.

Regards,
=dn

 I've seen this kind of random approach several times and I keep
 wondering why not counting the files instead. Yes, it may take a little
 longer when uploading but I personally think the safety of the approach
 is worth the insignificant speed sacrifice.

 Bogdan

 Scott Houseman wrote:
  Hi all.
 
  This confirms what I suspected.
 
  The hash algrithm:
 
  I have a directory structure: dirs 0 - f, and within each of these, the
same
  dir structure 0 - f.
  When an image gets uploaded into the library, do an md5sum of the file,
take
  the first 2 chars of that hash
  and there's your path. e.g
  $PICDBPATH.'/a/7/a7b8be10b0e69fe3decaa538f1febe84'
 
  I'm not sure what the mathematical randomness of this is, but I'm sure
it's
  pretty random, and the chances
  of collision should be virtually null, the only time you should
overwrite a
  file is if you upload the exact same file(?)
  Is there a better way of doing this?
 
  Cheers
 
  -Scott
 
 
 -Original Message-
 From: Justin French [mailto:[EMAIL PROTECTED]]
 Sent: 21 August 2002 03:25
 To: [EMAIL PROTECTED]; PHP General
 Subject: Re: [PHP] Image library
 
 
 on 21/08/02 9:45 PM, Scott Houseman ([EMAIL PROTECTED]) wrote:
 
 
 
 Which way would be the most efficient/fastest to access images
 
 from an image
 
 library.
 A) Store image files in a hash directory structure AND storing
 
 each file's
 
 information in a mysql table
 OR
 B) Storing image information in mysql table AND storing the
 
 image in a BLOB
 
 field in that table.
 
 From all accounts I've read on this list, a database is not
 usually faster
 than a filesystem.  And for large amounts of files, like 1000's,
 a hash will
 speed it up more.
 
 
 
 The way I see it, considerations to be taken into acount:
 - Is it quicker/better to retrieve image from table  then stream out
to
 browser OR simply direct the browser to the file?
 i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
 SRC=/imagelib/5/f/10
 - Will a database OR filesystem be more scalable i.e. which wil perform
 better when there are 1 images in the libary?
 
 Filesystem should be quicker.  You need to think about how you hash the
 files up for the most even spread of files in each directory I guess.
 
 
 Justin
 
 
 
 



 --
 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: Best way to check for some certain text in a string

2002-08-21 Thread Bogdan Stancescu

José Jeria wrote:
 Bogdan Stancescu [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
If you don't need regexps, use strpos. Make sure you read the
 
 
 Can you give me any particular reason why strpos is better?
http://php.weblogs.com/discuss/msgReader$1838

 
 
documentation though - if $nav-userAgent starts with search for this,
your code will return false.
 
 
 Yeah, that was a typo when i copy and pasted.
 
 
Bogdan

José Jeria wrote:

I want to find a certain text in a string and i want it to return me a
boolean.
What is the best thing to do this?

a) ereg(search for this, $string);//

 returns
 
int(1) if true, bool(false) if not
b) strpos($nav-userAgent, search for this)  0// gives me a

 boolean
 
directly

Any tips of which one I should use?

/José Jeria




 
 



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




[PHP] Exiting from an include or required file

2002-08-21 Thread Henry

Hi All,

I would like to exit from an include file and continue in the calling
script!

As an example

FILE A:

?php
if (empty($_POST['search_criteria'))
{
  echo You must provide search criteria;

  // exit the include file here But how?
 }

echo You have provided serach criteria;
?


FILE B

#include A;

form method=post
input name=search_criteria type=text
/form

TIA

Henry



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




Re: [PHP] patch for sablotron

2002-08-21 Thread Geoff

I finally was able to compile/install php with xslt extensions.

You have to apply the patch for Sablotron first then configure, make, su
make install then apply the php patch, configure, make, su make install

I applied the patches as follows:
patch original file patch file

for more options do man patch


 
On Tue, 2002-08-20 at 21:47, Tom Rogers wrote:
 Hi,
 
 Wednesday, August 21, 2002, 6:21:30 AM, you wrote:
 G I have been struggling to compile php(4.2.2, mandrake 8.2, apache
 G 1.3.26) with xslt support for over 3 days now. I can configure with
 G trouble like this: 
 G ./configure \ 
 G --with-apxs=/usr/lib/apache/bin/apxs \ 
 G --with-sybase=/usr/local/freetds \ 
 G --with-mysql \ 
 G --enable-xslt \ 
 G --with-xslt-sablot 
 
 G then make 
 G I get loads of errors in sablot.c including line 154 multiple definition
 G of 'SXPF_SUPPORTS_UNPARSED_ENTITIES'
 
 G so I noticed the sablotron site has 2 php patches here that appear to
 G fix this:
 G http://www.gingerall.com/charlie/ga/xml/d_sab.xml
 
 G HOW do I apply the patches??
 
 From the same site :)
 
 To apply a patch, copy it to the Sablotron root directory (Sablot-x.xx)
 and type: patch -p1  patch_filename
 
 
 -- 
 regards,
 Tom
 
 



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




RE: [PHP] Image library

2002-08-21 Thread Scott Houseman

Hi there.

So what you are suggesting is using an AUTO_INCREMENT field, possibly the
image's Primary Key as an identifier
for that image file., which is fine by me, but surely one should store files
across directories, as 1 images
in a single directory might slow down access to those images in the
filesystem, or not so?

Thanks for your input.

Regards

-Scott

 -Original Message-
 From: DL Neil [mailto:[EMAIL PROTECTED]]
 Sent: 21 August 2002 04:31
 To: [EMAIL PROTECTED]; Bogdan Stancescu
 Subject: Re: [PHP] Image library


 Scott (confirming Bogdan),

 Libraries of all types have had this concern for years - even though books
 are uniquely identified by ISBN, that is still not good enough for library
 purposes (eg multiple copies of a single title). So they, exactly
 as Bogdan
 suggests, use an Accession number sequence - which can be
 implemented very
 neatly in MySQL (from PHP) as an AUTO_INCREMENT field.

 Regards,
 =dn

  I've seen this kind of random approach several times and I keep
  wondering why not counting the files instead. Yes, it may take a little
  longer when uploading but I personally think the safety of the approach
  is worth the insignificant speed sacrifice.
 
  Bogdan
 
  Scott Houseman wrote:
   Hi all.
  
   This confirms what I suspected.
  
   The hash algrithm:
  
   I have a directory structure: dirs 0 - f, and within each of
 these, the
 same
   dir structure 0 - f.
   When an image gets uploaded into the library, do an md5sum of
 the file,
 take
   the first 2 chars of that hash
   and there's your path. e.g
   $PICDBPATH.'/a/7/a7b8be10b0e69fe3decaa538f1febe84'
  
   I'm not sure what the mathematical randomness of this is, but I'm sure
 it's
   pretty random, and the chances
   of collision should be virtually null, the only time you should
 overwrite a
   file is if you upload the exact same file(?)
   Is there a better way of doing this?
  
   Cheers
  
   -Scott
  
  
  -Original Message-
  From: Justin French [mailto:[EMAIL PROTECTED]]
  Sent: 21 August 2002 03:25
  To: [EMAIL PROTECTED]; PHP General
  Subject: Re: [PHP] Image library
  
  
  on 21/08/02 9:45 PM, Scott Houseman ([EMAIL PROTECTED]) wrote:
  
  
  
  Which way would be the most efficient/fastest to access images
  
  from an image
  
  library.
  A) Store image files in a hash directory structure AND storing
  
  each file's
  
  information in a mysql table
  OR
  B) Storing image information in mysql table AND storing the
  
  image in a BLOB
  
  field in that table.
  
  From all accounts I've read on this list, a database is not
  usually faster
  than a filesystem.  And for large amounts of files, like 1000's,
  a hash will
  speed it up more.
  
  
  
  The way I see it, considerations to be taken into acount:
  - Is it quicker/better to retrieve image from table  then stream out
 to
  browser OR simply direct the browser to the file?
  i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
  SRC=/imagelib/5/f/10
  - Will a database OR filesystem be more scalable i.e. which
 wil perform
  better when there are 1 images in the libary?
  
  Filesystem should be quicker.  You need to think about how
 you hash the
  files up for the most even spread of files in each directory I guess.
  
  
  Justin
  
  
  
  
 
 
 
  --
  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




Re: [PHP] Exiting from an include or required file

2002-08-21 Thread Bas Jobsen

Do:
 FILE A:

 ?php
 if (empty($_POST['search_criteria'))
 {
   echo You must provide search criteria;

   // exit the include file here But how?
  }
 else
{
 echo You have provided serach criteria;
}
 ?


Op woensdag 21 augustus 2002 16:39, schreef Henry:
 Hi All,

 I would like to exit from an include file and continue in the calling
 script!

 As an example

 FILE A:

 ?php
 if (empty($_POST['search_criteria'))
 {
   echo You must provide search criteria;

   // exit the include file here But how?
  }

 echo You have provided serach criteria;
 ?


 FILE B

 #include A;

 form method=post
 input name=search_criteria type=text
 /form

 TIA

 Henry

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




RE: [PHP] Agh! trim (#$@#@^%!!!)

2002-08-21 Thread Mike At Spy


But isn't taking off characters or spaces considered modifying a string?

I'll take another look at the manual, thanks.

-Mike


 -Original Message-
 From: Darren Gamble [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 21, 2002 10:32 AM
 To: 'Mike At Spy'; [EMAIL PROTECTED]
 Subject: RE: [PHP] Agh! trim (#$@#@^%!!!)
 
 
 Good day,
 
 Well, for one, you are discarding the results of trim().
 
 Check out the online manual page for trim().  The trim'ed string is
 returned.  It does not say it modifies the string it is passed.
 
 
 Darren Gamble
 Planner, Regional Services
 Shaw Cablesystems GP
 630 - 3rd Avenue SW
 Calgary, Alberta, Canada
 T2P 4L4
 (403) 781-4948
 
 
  -Original Message-
  From: Mike At Spy [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, August 21, 2002 7:12 AM
  To: [EMAIL PROTECTED]
  Subject: RE: [PHP] Agh! trim (#$@#@^%!!!)
  
  
  
  Here is the complete code - I have a lot of prints to watch 
  things as they
  happen. $whois is the result of a WHOIS search.
  
  
  
  // beginning of my stuff
  
  function get_date ($whois){
  trim ($whois);
  $whoisarray = explode (\n, $whois);
  print_r(array_values ($whoisarray));
  
  $total_elements = count ($whoisarray);
  
  print pb$total_elements/b elements in this array;
  
  $ce = 0;
  
  while ($ce  $total_elements){
  
  $single_line = array_pop ($whoisarray);
  
  $expiration = strstr ($single_line,xpires);
  
  if ($expiration != '' || 0) {
  
  print pbThis is the line you want!  Line $ce that sez:
  $single_line/bp;
  
  // $single_line = preg_replace (.,  , $single_line);
  
  $single_line = substr($single_line, 0, -2);
  
  //  $single_line = rtrim ($single_line, \t\s\n\r);
  
  $getdatearray = explode ( , $single_line);
  print_r(array_values ($getdatearray));
  
  $total_expire_elements = count ($getdatearray);
  
  print pbr.$total_expire_elements;
  
  $dc = 0;
  
  while ($dc  $total_expire_elements){
  
  $element = array_pop($getdatearray);
  
  $date_dash = strstr($element,-);
  
  if ($date_dash != '' || 0){
  
  print pbrFirst Detection 
  .$element;
  
  // $trimmed = rtrim ($element, \t.);
  
  print pbrLast print before 
  date function .$element;
  
  month_replace ($element);
  
  print pbrResult after function 
  .$element.pbr;
  
  $MySQLDate=date_validate($element);
  if (substr($MySQLDate, 0, 5)==Error) {
  // Insert Error Code if you want
  } else {
  // Insert Valid Date Code if you want
  }
  
  print pThe MySQL Formated date is 
  $MySQLDate;
  
  
  }
  else {}
  
  $dc++;
  
   }
  
  
  }
  else {}
  
  $ce++;
  
  }
  
  }
  // end of my stuff
  
  
  Thanks,
  
  -Mike
  
  
  
  
  
  
   -Original Message-
   From: Jason Wong [mailto:[EMAIL PROTECTED]]
   Sent: Wednesday, August 21, 2002 8:53 AM
   To: [EMAIL PROTECTED]
   Subject: Re: [PHP] Agh! trim (#$@#@^%!!!)
  
  
   On Wednesday 21 August 2002 20:36, Mike At Spy wrote:
Get this - it didn't work!  :(
   
I tried decreasing the -1 to -2 and so on, but nothing on that
   either.  :(
  
   Post your exact code which didn't work.
  
   --
   Jason Wong - Gremlins Associates - www.gremlins.com.hk
   Open Source Software Systems Integrators
   * Web Design  Hosting * Internet  Intranet Applications 
  Development *
  
   /*
   You can't go home again, unless you set $HOME.
   */
  
  
   --
   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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Exiting from an include or required file

2002-08-21 Thread Roedel, Mark


Seems like the easy way, at least in this case, would be to make the
second part of your File A an else to your if.

?php
if (empty($_POST['search_criteria'])) {
echo You must provide search criteria;
} else {
echo You provided search criteria;
}


---
Mark Roedel   | Blessed is he who has learned to laugh
Systems Programmer|  at himself, for he shall never cease
LeTourneau University |  to be entertained.
Longview, Texas, USA  |  -- John Powell


 -Original Message-
 From: Henry [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, August 21, 2002 9:40 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Exiting from an include or required file
 
 
 Hi All,
 
 I would like to exit from an include file and continue in the calling
 script!
 
 As an example
 
 FILE A:
 
 ?php
 if (empty($_POST['search_criteria'))
 {
   echo You must provide search criteria;
 
   // exit the include file here But how?
  }
 
 echo You have provided serach criteria;
 ?
 
 
 FILE B
 
 #include A;
 
 form method=post
 input name=search_criteria type=text
 /form
 
 TIA
 
 Henry
 
 
 
 -- 
 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] Code for off-site Maintenance?

2002-08-21 Thread Martin Clifford

Good comments made by all, no doubts.  Something said by Justin though, sticks out 
above the rest.

I strongly recommend to everyone to never, EVER edit or manipulate LIVE code!  I know 
we're all good at what we do, but accidents happen (perhaps you didn't specify a WHERE 
clause in your delete statement for your database?  Whoops!).  Like Justin, my process 
is to test, test, test, upload, and test some more.  Extra time spent now could 
possibly mean less time spent correcting stupid mistakes.

Martin

The more I see of this world, the more I am convinced of the inability of brute force 
to create anything durable.  - Napoleon

 Andre Dubuc [EMAIL PROTECTED] 08/21/02 09:49AM 
Thanks Justin,

A web-based control panel  content management system seems like a nice 
invitation to enter 'Hackers' Paradise'. I like the idea of doing it at home 
and testing, as you do. Something inside of me squirms at the idea of the 
whole shebang being tatooed by a hacker.

Regards,
Andre

On Wednesday 21 August 2002 09:21 am, Justin French wrote:
 I'm usually weeks, or month ahead of myself.  The code I have in my local
 environment is looking forward towards knew features, new ideas, etc etc.
 Every week or two I grab a mirror of the online database (or I could
 connect straight to it of course), and WHEN new code is ready to upload, I
 do it via FTP.

 If I had a LOT of uploads, I'd write something that does it for me,
 comparing dates or something.

 I do have a web-based control panel  content management system for some
 sections of some sites, allowing me (or the client) to add / edit / delete
 / arrange some content...

 End of the day, it's each to their own -- but I know that I wouldn't want
 to be directly editing live code, data or modules on the fly.  I like to
 work on a mirror, test, test, test, upload, test.


 Justin French

 on 21/08/02 10:11 PM, Andre Dubuc ([EMAIL PROTECTED]) wrote:
  Soon, I will be transferring my site to go on-line with my IP. Since I've
  never managed anything off-site, I have a very fundamental question:
 
  What are the usual procedures with respect to maintaining a site, that
  is, accessing the PostgreSQL database for corrections, deletions, etc?
 
  One idea that occured to me:  mirror the site here, complete with
  database, and modify stuff at this end, then upload to the IP. Or should
  I create some form of management code that would allow me, using php, to
  access and modify the stuff on-line. I've looked at Zope, Midguard, and
  another one, but they seem like over-kill (and I would have to change a
  lot of my code to use them).
 
  I would appreciate any input pointing how I should proceed -- I'm a total
  newbie in this area. Any pointers, or where to look, would be greatly
  appreciated.
 
  Tia,
  Andre


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




RE: [PHP] Exiting from an include or required file

2002-08-21 Thread M . A . Bond

Or just do a return();

?php
if (empty($_POST['search_criteria'])) 
{
echo You must provide search criteria;
  return;
}



-Original Message-
From: Roedel, Mark [mailto:[EMAIL PROTECTED]] 
Sent: 21 August 2002 15:48
To: Henry; php-general
Subject: RE: [PHP] Exiting from an include or required file



Seems like the easy way, at least in this case, would be to make the second
part of your File A an else to your if.

?php
if (empty($_POST['search_criteria'])) {
echo You must provide search criteria;
} else {
echo You provided search criteria;
}


---
Mark Roedel   | Blessed is he who has learned to laugh
Systems Programmer|  at himself, for he shall never cease
LeTourneau University |  to be entertained.
Longview, Texas, USA  |  -- John Powell


 -Original Message-
 From: Henry [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 21, 2002 9:40 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Exiting from an include or required file
 
 
 Hi All,
 
 I would like to exit from an include file and continue in the calling 
 script!
 
 As an example
 
 FILE A:
 
 ?php
 if (empty($_POST['search_criteria'))
 {
   echo You must provide search criteria;
 
   // exit the include file here But how?
  }
 
 echo You have provided serach criteria;
 ?
 
 
 FILE B
 
 #include A;
 
 form method=post
 input name=search_criteria type=text
 /form
 
 TIA
 
 Henry
 
 
 
 --
 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




Re: [PHP] Exiting from an include or required file

2002-08-21 Thread Henry

Thanks, but my situation is slight more convoluted than I describe.

I want to cascade down through a include chain and want to just stop
processing the current include and return to the one which called it.
Similar to exit() but only for the local scope.

TIA

Henry

Mark Roedel [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

Seems like the easy way, at least in this case, would be to make the
second part of your File A an else to your if.

?php
if (empty($_POST['search_criteria'])) {
echo You must provide search criteria;
} else {
echo You provided search criteria;
}


---
Mark Roedel   | Blessed is he who has learned to laugh
Systems Programmer|  at himself, for he shall never cease
LeTourneau University |  to be entertained.
Longview, Texas, USA  |  -- John Powell


 -Original Message-
 From: Henry [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 21, 2002 9:40 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Exiting from an include or required file


 Hi All,

 I would like to exit from an include file and continue in the calling
 script!

 As an example

 FILE A:

 ?php
 if (empty($_POST['search_criteria'))
 {
   echo You must provide search criteria;

   // exit the include file here But how?
  }

 echo You have provided serach criteria;
 ?


 FILE B

 #include A;

 form method=post
 input name=search_criteria type=text
 /form

 TIA

 Henry



 --
 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] Exiting from an include or required file

2002-08-21 Thread Henry

Thanks return thats it!

I hadn't appreciated that include was a function! I keep thinking like a
C/C++ programmer, must stop. Punishment is 8 lines of include is not a
pre-processor directive.

include is not a pre-processor directive
include is not a pre-processor directive
include is not a pre-processor directive
include is not a pre-processor directive
include is not a pre-processor directive
include is not a pre-processor directive
include is not a pre-processor directive
include is not a pre-processor directive



Thankyou once again

Henry



M A Bond [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Or just do a return();

 ?php
 if (empty($_POST['search_criteria']))
 {
 echo You must provide search criteria;
   return;
 }



 -Original Message-
 From: Roedel, Mark [mailto:[EMAIL PROTECTED]]
 Sent: 21 August 2002 15:48
 To: Henry; php-general
 Subject: RE: [PHP] Exiting from an include or required file



 Seems like the easy way, at least in this case, would be to make the
second
 part of your File A an else to your if.

 ?php
 if (empty($_POST['search_criteria'])) {
 echo You must provide search criteria;
 } else {
 echo You provided search criteria;
 }


 ---
 Mark Roedel   | Blessed is he who has learned to laugh
 Systems Programmer|  at himself, for he shall never cease
 LeTourneau University |  to be entertained.
 Longview, Texas, USA  |  -- John Powell


  -Original Message-
  From: Henry [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, August 21, 2002 9:40 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Exiting from an include or required file
 
 
  Hi All,
 
  I would like to exit from an include file and continue in the calling
  script!
 
  As an example
 
  FILE A:
 
  ?php
  if (empty($_POST['search_criteria'))
  {
echo You must provide search criteria;
 
// exit the include file here But how?
   }
 
  echo You have provided serach criteria;
  ?
 
 
  FILE B
 
  #include A;
 
  form method=post
  input name=search_criteria type=text
  /form
 
  TIA
 
  Henry
 
 
 
  --
  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




Re: [PHP] Exiting from an include or required file

2002-08-21 Thread Joseph W. Goff

You will have to enclose the code is some form of a container.
i.e. a function, while loop...
I would probably use the function, then you could exit with return
The other types of container would use break.
- Original Message - 
From: Henry [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 21, 2002 9:59 AM
Subject: Re: [PHP] Exiting from an include or required file


 Thanks, but my situation is slight more convoluted than I describe.
 
 I want to cascade down through a include chain and want to just stop
 processing the current include and return to the one which called it.
 Similar to exit() but only for the local scope.
 
 TIA
 
 Henry
 
 Mark Roedel [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
 Seems like the easy way, at least in this case, would be to make the
 second part of your File A an else to your if.
 
 ?php
 if (empty($_POST['search_criteria'])) {
 echo You must provide search criteria;
 } else {
 echo You provided search criteria;
 }
 
 
 ---
 Mark Roedel   | Blessed is he who has learned to laugh
 Systems Programmer|  at himself, for he shall never cease
 LeTourneau University |  to be entertained.
 Longview, Texas, USA  |  -- John Powell
 
 
  -Original Message-
  From: Henry [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, August 21, 2002 9:40 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Exiting from an include or required file
 
 
  Hi All,
 
  I would like to exit from an include file and continue in the calling
  script!
 
  As an example
 
  FILE A:
 
  ?php
  if (empty($_POST['search_criteria'))
  {
echo You must provide search criteria;
 
// exit the include file here But how?
   }
 
  echo You have provided serach criteria;
  ?
 
 
  FILE B
 
  #include A;
 
  form method=post
  input name=search_criteria type=text
  /form
 
  TIA
 
  Henry
 
 
 
  --
  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] unable to lookup host [1001] error

2002-08-21 Thread David Buerer

Anyone ever seen this error before?  What causes it?  It happens on a call
to socket_bind after a successful call to socket_listen.

Any ideas would be appreciated.

Warning: socket_bind() unable to lookup host [1001]: Recursion too deep,
stack overflowed. in
f:\public\www\josiah\josiah2\consultation\chat\test_server.php on line 31
AIEE -- Couldn't bind! 



Re: [PHP] Exiting from an include or required file

2002-08-21 Thread Joseph W. Goff

Actually, M.A.Bond is right, you don't even have to enclose it, just use the
return construct.
- Original Message -
From: Joseph W. Goff [EMAIL PROTECTED]
To: php-general [EMAIL PROTECTED]; Henry
[EMAIL PROTECTED]
Sent: Wednesday, August 21, 2002 10:03 AM
Subject: Re: [PHP] Exiting from an include or required file


 You will have to enclose the code is some form of a container.
 i.e. a function, while loop...
 I would probably use the function, then you could exit with return
 The other types of container would use break.
 - Original Message -
 From: Henry [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, August 21, 2002 9:59 AM
 Subject: Re: [PHP] Exiting from an include or required file


  Thanks, but my situation is slight more convoluted than I describe.
 
  I want to cascade down through a include chain and want to just stop
  processing the current include and return to the one which called it.
  Similar to exit() but only for the local scope.
 
  TIA
 
  Henry
 
  Mark Roedel [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
  Seems like the easy way, at least in this case, would be to make the
  second part of your File A an else to your if.
 
  ?php
  if (empty($_POST['search_criteria'])) {
  echo You must provide search criteria;
  } else {
  echo You provided search criteria;
  }
 
 
  ---
  Mark Roedel   | Blessed is he who has learned to laugh
  Systems Programmer|  at himself, for he shall never cease
  LeTourneau University |  to be entertained.
  Longview, Texas, USA  |  -- John Powell
 
 
   -Original Message-
   From: Henry [mailto:[EMAIL PROTECTED]]
   Sent: Wednesday, August 21, 2002 9:40 AM
   To: [EMAIL PROTECTED]
   Subject: [PHP] Exiting from an include or required file
  
  
   Hi All,
  
   I would like to exit from an include file and continue in the calling
   script!
  
   As an example
  
   FILE A:
  
   ?php
   if (empty($_POST['search_criteria'))
   {
 echo You must provide search criteria;
  
 // exit the include file here But how?
}
  
   echo You have provided serach criteria;
   ?
  
  
   FILE B
  
   #include A;
  
   form method=post
   input name=search_criteria type=text
   /form
  
   TIA
  
   Henry
  
  
  
   --
   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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] How Do You Protect Individual Files

2002-08-21 Thread Roger Lewis


On Wednesday 21 August 2002 10:54, Roger Lewis wrote:

 I did, but like I said, I couldn't find much.  Maybe I wasn't using the
 correct key words.  There is a lot about protecting php and html files but
 not much on other, non-php files in external directories.  There is some
 discussion about .htaccess, but I know nothing about this.  Is that the
way
 to do it, or can it be done with php.


Justin French, Tuesday, August 20, 2002 10:40 PM

 In real short, you want to store the files outside your htdocs root (so
they
 can't be served by http), OR restrict them from being served by using a
 htaccess file (try an apache list, the apache site, or your ISP sys
admin).

 Then, you want to serve those files THROUGH a PHP script.  Usually these
 scripts will:

 - authenticate a user
 - set the right mime-type header for the file type using header()
 - parse the requested file though the PHP script to the browser

 There were a few recent threads on this... search for the following
subject
 lines in the archives:

 - Authenticate files downloads
 - secure files acess

 Finally, there is a decent script/article/tutorial on the Zend site
(another
 place you should have looked), which is the basis for my code at the
moment.

 http://www.zend.com/zend/trick/tricks-august-2001.php

Well, I originally searched for protect file downloads.  I also searched
protect individual files, protect files, authenticate files, and on
and on.  There are thousands of messages, but very few with relevant titles
or content.  One point to consider: I have no control over the files
themselves.  They are being uploaded to the document directories by end
users, so I do not know the file names.  What I am trying to do is prevent
someone who knows the path to the file from being able to gain access to it
without authorization.
One of the best ideas I saw was to put the files outside the web root
directory.  That sounded pretty good until I discovered that then I couldn't
access the files.  Now you've again pointed out that solution, so I'm sure
it will work.  I've just got to study up on the subject.
I ran across the Zend article a couple of weeks ago, but it's going to take
me awhile to understand it.  I'm pretty new at this game, and my programming
skills are very limited.

I'm going to research .htaccess also.
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] PHP IDEs

2002-08-21 Thread Peter J. Schoenster

On 21 Aug 2002 at 8:55, Michael Egan wrote:

 I know similar threads have come up on this in the past but I suspect
 it's a constantly changing picture.
 
 I recently saw a favourable review of Zend Studio 2.5 but wondered, out
 of curiosity, what sort of tools people use to develop PHP scripts and
 MySQL databases, tables and queries.
 
 Up until now, in an attempt to try and get to grips with these packages,
 I've been using a variety of text editors from VI to Kwrite.  But I'm
 wondering whether it might speed up development times if I start to use
 one of the tools out there for working with PHP and MySQL.

This should really go in a FAQ. I don't know if there is a live FAQ for PHP based on 
this list. ?

Anyhow, this is one of my pet peeves.  Nothing gives me the shudders more when I 
encounter a *developer* who ONLY knows a GUI. 

Any conscientious person should always seek better ways to do what they do. So I 
always go out and try these IDEs and so far I've always returned 
to Textpad and the really good developers I know who use unix/linux for a workstation 
use emacs and vi.  A naïve user might find this odd. But you 
must understand that we also have scripting tools (usually Perl) coupled with an 
ability to type (above 60wpm) and at hand knowledge of the 
language. I and others also extensively use code libraries so we don't re-invent the 
wheel and consequently overbill. 

The only IDE that has impressed me, up until now, was the M$ stuff but I don't do VB, 
Visual C++ etc. 

But now I just downloaded this one:

http://www.phpedit.com/

 PHPEdit is a full featured PHP IDE for Windows. It has code insight,
 code completion, syntax-highlighting, integrated debugger, code browser,
 keyboard templates, and even more. 

Most IDEs make the simple simple or worse, difficult and nearly always difficult to 
later edit by hand. 

PHPEdit RECOGNIZES the the *classes* that you use in your scripts. It loads them. You 
can acccess them via the code browser. 

It recognizes all the methods in your file (according to class) and lists them for 
easy movement.

This IDE has great potential imho. It's just the sort of thing that I have been 
looking for. It doesn't not try to help me do the simple things. It helps me 
organize and access my code. I don't think this would help the developer who doesn't 
know anything.

It doesn't seem 100%. It has a nice feature where I can plug in documentation which 
gets loaded in the HELP browser window. This isn't working for 
me. It could be my fault. I have not investigated that much, but such a thing is 
quite, quite good, I still don't know PHP well enough to just write from 
brain to keyboard.

BTW, other tools I use in development:

Treepad (organize all sorts of data easily, http://www.treepad.com/ I use the free 
version)

Of course I have my own Perl scripts for s/r but I also use this a lot (primarily just 
for the search):

http://www.funduc.com/search_replace.htm

CuteFTP (I really hate this program for the stupid things it does but it's still the 
best I've found, I detest using my mouse and I can do a lot with cuteftp 
from the keyboard, but it's braindead and the developers don't respond to my 
suggestions for improvement, it might be I need to rethink my 
development model).

WinTelnet, I don't use the ftp app it comes with. I only use this because it SAVES all 
the servers I login to. At one time I had over 50 and I wasn't 
going to remember all the usernames/passwords and type the login all the time. This 
app logs me in and gets me to the command line. Oddly, it's not 
rated high here:

http://cws.internet.com/telnet.html

SSH Secure Shell 2.3, when I gotta use SSH. This could be a lot better. but it's okay.

TextPad (for those of us who have not learned emacs or vi well enough :)

http://www.textpad.com/

cygwin (get all those great linux tools on your windows box. I've got KDE running in 
another window :)

Perl (knowledge of a scripting language is a great tool, I've never used PHP from a 
cli as I started as a Perl programmer)  

Opera, IE, Mozilla (mozilla and Opera make it easier to turn cookies on/off and view 
them and lots of other things)



http://validator.w3.org/ (make sure the code adheres to a standard, I use the referrer 
as my html is never whole until you request a page)


Peter


















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




[PHP] PHP Web site down?

2002-08-21 Thread Adam Williams

Is it just me having network connectivity problems, or is the PHP website,
http://www.php.net down?  I tried connecting to it from a couple of
difference computers and I can't access it on any of them.  Just wondering
if anyone else is having problems getting to their website too.

Adam


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




[PHP] PHP and Windows Active Directory...

2002-08-21 Thread Glenn Sieb

I know that *ahem* theoretically Active Directory uses LDAP... has anyone 
had any luck getting PHP to talk to Active Directory?

Basically I'd like to fool around with a webpage for a corporate directory 
based on AD entries... if anyone has had any luck with this, I'd appreciate 
it :)))

As always,
Thanks!
Glenn

---
Glenn E. Sieb
System Administrator
Lumeta Corporation
+1 732 357-3514 (V)
+1 732 564-0731 (Fax)


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




Re: [PHP] Image library

2002-08-21 Thread DL Neil

Hi Scott,

Yes I am suggesting the naming of the image file by ascending number (at
least in part - our Sony digicam produces files named DSCn.JPG). The
danger of generating a filename by hash is that collisions are always
possible. Moving to an 'accession number' removes that threat.

The choice of locating the file in one or more sub-directories is a separate
issue. After all, you could have one field in the db to keep track of the
image's filename and another to keep track of its location - the two may or
may not be related.

Related: you can number/name the file and then use the last digit to
determine which directory to locate it within (10 directories) - or the last
two digits (100 directories). This has the advantage of spreading the
directory/index load evenly as new images are 'accessioned'/arrive into the
system.

Non-related: you can use whatever algorithm you like, eg hashing or
randomising, to decide where to place the image file. A low level of
'collisions' is immaterial in this application (whereas it would be
catastrophic for image filenames)!

Regards,
=dn


 So what you are suggesting is using an AUTO_INCREMENT field, possibly the
 image's Primary Key as an identifier
 for that image file., which is fine by me, but surely one should store
files
 across directories, as 1 images
 in a single directory might slow down access to those images in the
 filesystem, or not so?

 Thanks for your input.

 Regards

 -Scott

  -Original Message-
  From: DL Neil [mailto:[EMAIL PROTECTED]]
  Sent: 21 August 2002 04:31
  To: [EMAIL PROTECTED]; Bogdan Stancescu
  Subject: Re: [PHP] Image library
 
 
  Scott (confirming Bogdan),
 
  Libraries of all types have had this concern for years - even though
books
  are uniquely identified by ISBN, that is still not good enough for
library
  purposes (eg multiple copies of a single title). So they, exactly
  as Bogdan
  suggests, use an Accession number sequence - which can be
  implemented very
  neatly in MySQL (from PHP) as an AUTO_INCREMENT field.
 
  Regards,
  =dn
 
   I've seen this kind of random approach several times and I keep
   wondering why not counting the files instead. Yes, it may take a
little
   longer when uploading but I personally think the safety of the
approach
   is worth the insignificant speed sacrifice.
  
   Bogdan
  
   Scott Houseman wrote:
Hi all.
   
This confirms what I suspected.
   
The hash algrithm:
   
I have a directory structure: dirs 0 - f, and within each of
  these, the
  same
dir structure 0 - f.
When an image gets uploaded into the library, do an md5sum of
  the file,
  take
the first 2 chars of that hash
and there's your path. e.g
$PICDBPATH.'/a/7/a7b8be10b0e69fe3decaa538f1febe84'
   
I'm not sure what the mathematical randomness of this is, but I'm
sure
  it's
pretty random, and the chances
of collision should be virtually null, the only time you should
  overwrite a
file is if you upload the exact same file(?)
Is there a better way of doing this?
   
Cheers
   
-Scott
   
   
   -Original Message-
   From: Justin French [mailto:[EMAIL PROTECTED]]
   Sent: 21 August 2002 03:25
   To: [EMAIL PROTECTED]; PHP General
   Subject: Re: [PHP] Image library
   
   
   on 21/08/02 9:45 PM, Scott Houseman ([EMAIL PROTECTED]) wrote:
   
   
   
   Which way would be the most efficient/fastest to access images
   
   from an image
   
   library.
   A) Store image files in a hash directory structure AND storing
   
   each file's
   
   information in a mysql table
   OR
   B) Storing image information in mysql table AND storing the
   
   image in a BLOB
   
   field in that table.
   
   From all accounts I've read on this list, a database is not
   usually faster
   than a filesystem.  And for large amounts of files, like 1000's,
   a hash will
   speed it up more.
   
   
   
   The way I see it, considerations to be taken into acount:
   - Is it quicker/better to retrieve image from table  then stream
out
  to
   browser OR simply direct the browser to the file?
   i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
   SRC=/imagelib/5/f/10
   - Will a database OR filesystem be more scalable i.e. which
  wil perform
   better when there are 1 images in the libary?
   
   Filesystem should be quicker.  You need to think about how
  you hash the
   files up for the most even spread of files in each directory I
guess.
   
   
   Justin



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




Re: [PHP] PHP Web site down?

2002-08-21 Thread DL Neil

 Is it just me having network connectivity problems, or is the PHP website,
 http://www.php.net down?  I tried connecting to it from a couple of
 difference computers and I can't access it on any of them.  Just wondering
 if anyone else is having problems getting to their website too.


Adam,

It is not just your paranoia.
Be brave, step outside the contiguous 50 and try
http://uk2.php.net/manual/en/ (it's working!)

Regards,
=dn



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




RE: [PHP] Image library

2002-08-21 Thread Jay Blanchard

[snip]
... but surely one should store files across directories, as 1 images in
a single directory might slow down access to those images in the filesystem,
or not so?
[/snip]

Not really. The server really does not care where the files are and no
performance would be lost.

Jay

***
* Texas PHP Developers Conf  Spring 2003  *
* T Bar M Resort  Conference Center  *
* New Braunfels, Texas*
* San Antonio Area PHP Developers Group   *
* Interested? Contact [EMAIL PROTECTED] *
***



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




Re: [PHP] PHP Web site down?

2002-08-21 Thread Adam Williams

Thanks!  Silly me, I'm always forgetting about the mirror sites ;)

Adam

On Wed, 21 Aug 2002, DL Neil wrote:

  Is it just me having network connectivity problems, or is the PHP website,
  http://www.php.net down?  I tried connecting to it from a couple of
  difference computers and I can't access it on any of them.  Just wondering
  if anyone else is having problems getting to their website too.


 Adam,

 It is not just your paranoia.
 Be brave, step outside the contiguous 50 and try
 http://uk2.php.net/manual/en/ (it's working!)

 Regards,
 =dn




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




Re: [PHP] PHP/SQL - inserting into database null results

2002-08-21 Thread Tom Rogers

Hi,

Wednesday, August 21, 2002, 11:25:30 PM, you wrote:
n I am a new person to PHP.  I have purchased and read PHP fast  easy by
n Julie Meloni and have also read the 24 hours PHP book.  I am able to connect
n to the SQL database and insert into the database via my html form.  However,
n the values are null.  When I look at the data in my database, it reads  ,
n  ,  , etc.

n I have tried a couple different code:

n $query = INSERT INTO MemberReviews
n  VALUES (' ','$memb_name', '$bookname','$author', '$grade', '$review') ;
n mysql_query($query);

n mysql_close();

n or in the form itself, I have tried:

n ?
n # this is processed when the form is submitted
n # back on to this page (POST METHOD)
n if ($REQUEST_METHOD==POST) {

n # double-up apostrophes
n $review = str_replace(','',$review);
n $author = str_replace(','',$author);

n # setup SQL statement
n $SQL =  INSERT INTO MemberReviews ;
n $SQL = $SQL .  (memb_name, bookname, author, grade, review) VALUES
n ;
n $SQL = $SQL .  ('$memb_name', '$bookname','$author', '$grade',
n '$review') ;

n #execute SQL statement
n $result = mysql_db_query($db,$SQL,$cid);

n # check for error
n if (!$result) { echo(ERROR:  . mysql_error() . \n$SQL\n);}

n echo (PBNew Record Added/B/P\n);

n }

?

n Thanks in advance for your help

n Jennifer

If you have the latest version of php (4.2.2 or 4.2.1) try

if(!empty($_POST['memb_name']))$memb_name = add_slashes($_POST['memb_name']);
if(!empty($_POST['bookname']))$bookname = add_slashes($_POST['bookname']);

and so on, then add them to your query string.
(add_slashes() will take care of any pesky quotes)

-- 
regards,
Tom


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




Re: [PHP] Best way to check for some certain text in a string

2002-08-21 Thread Tom Rogers

Hi,

Wednesday, August 21, 2002, 11:22:36 PM, you wrote:
JJ I want to find a certain text in a string and i want it to return me a
JJ boolean.
JJ What is the best thing to do this?

JJ a) ereg(search for this, $string);// returns
JJ int(1) if true, bool(false) if not
b) strpos($nav-userAgent, search for this)  0// gives me a boolean
JJ directly

JJ Any tips of which one I should use?

JJ /José Jeria

you can do

if(eregi(search for this, $string)) echo 'found';




-- 
regards,
Tom


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




Re: [PHP] PHP Web site down?

2002-08-21 Thread Kondwani Spike Mkandawire

It seemed to be down...  Earlier in the morning I
had trouble getting onto it...  Its alright now though,
it may have been traffic or some minor stuff...

Spike...
Adam Williams [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Thanks!  Silly me, I'm always forgetting about the mirror sites ;)

 Adam

 On Wed, 21 Aug 2002, DL Neil wrote:

   Is it just me having network connectivity problems, or is the PHP
website,
   http://www.php.net down?  I tried connecting to it from a couple of
   difference computers and I can't access it on any of them.  Just
wondering
   if anyone else is having problems getting to their website too.
 
 
  Adam,
 
  It is not just your paranoia.
  Be brave, step outside the contiguous 50 and try
  http://uk2.php.net/manual/en/ (it's working!)
 
  Regards,
  =dn
 
 




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




Re: [PHP] PHP Web site down?

2002-08-21 Thread DL Neil

General advice:
take a look in the bottom right corner of any manual page and call for the
mirrors list - it's worth bookmarking/favoriting a couple, just in case one
goes down.

Also FYI, mirror sites are often faster (depending upon relative locations)
and their use certainly frees bandwidth at the central site.
=dn


 Thanks!  Silly me, I'm always forgetting about the mirror sites ;)

  It is not just your paranoia.
  Be brave, step outside the contiguous 50 and try
  http://uk2.php.net/manual/en/ (it's working!)



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




Re: [PHP] Image library

2002-08-21 Thread Jason Wong

On Thursday 22 August 2002 00:35, Jay Blanchard wrote:
 [snip]
 ... but surely one should store files across directories, as 1 images
 in a single directory might slow down access to those images in the
 filesystem, or not so?
 [/snip]

 Not really. The server really does not care where the files are and no
 performance would be lost.

Having a large number of files in a single directory does affect performance, 
the degree of which depends on the filesystem.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
QOTD:
I never met a man I couldn't drink handsome.
*/


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




Re: [PHP] Image library

2002-08-21 Thread DL Neil

 Having a large number of files in a single directory does affect
performance,
 the degree of which depends on the filesystem.


This is generally accepted wisdom for dealing with large numbers of files -
but what number is considered large?
Any rules of thumb, for different OpSys/file systems?
=dn



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




RE: [PHP] PHP and Windows Active Directory...

2002-08-21 Thread Roedel, Mark

 -Original Message-
 From: Glenn Sieb [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, August 21, 2002 11:30 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP and Windows Active Directory...
 
 
 I know that *ahem* theoretically Active Directory uses 
 LDAP... has anyone had any luck getting PHP to talk to Active
 Directory?

Working like a champ here.

I did have to make sure that I was connecting as a user who had
permission to browser the appropriate portions of the AD tree.  (Our
network admins were pretty helpful in that regard...if you've got
specific questions about that side of things, I'll be happy to pass them
along.)


---
Mark Roedel   | Blessed is he who has learned to laugh
Systems Programmer|  at himself, for he shall never cease
LeTourneau University |  to be entertained.
Longview, Texas, USA  |  -- John Powell


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




[PHP] Re: Image library

2002-08-21 Thread Philip Hallstrom

Lots of good ideas.

One other thing to consider when designing this is the possibility of
multiple web server accessing a single database server.

If you use the file system method which assumes that the web/db are on the
same server as soon as you want to have multiple web servers you'll run
into problems.

Of course you also probably don't want to have multiple web servers ask a
single db server over and over for the same image.  Especially if mysql's
blobs are inefficient (I don't know if they are or not).

You might consider storing the images in the database, and then setting it
up so that it first checks the filesystem and if it isn't there, gets it
from the database and caches it to the filesystem so the next access it
fast.

This would allow you to run multiple web servers since they could both
cache them locally.


For what it's worth, for our application we use a two level directory
heirarchy of [0-9]/[0-9]/primary_id.jpg.  Works well for us.

-philip

On Wed, 21 Aug 2002, Scott Houseman wrote:

 Hi there.

 Which way would be the most efficient/fastest to access images from an image
 library.
 A) Store image files in a hash directory structure AND storing each file's
 information in a mysql table
 OR
 B) Storing image information in mysql table AND storing the image in a BLOB
 field in that table.

 The way I see it, considerations to be taken into acount:
 - Is it quicker/better to retrieve image from table  then stream out to
 browser OR simply direct the browser to the file?
   i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
 SRC=/imagelib/5/f/10
 - Will a database OR filesystem be more scalable i.e. which wil perform
 better when there are 1 images in the libary?

 Thanks in advance

 Regards

 -Scott

 --
 Scott Houseman
 Jam Warehouse http://www.jamwarehouse.com/
 Smart Business Innovation
 +27 21 4477440 / +27 82 4918021


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

2002-08-21 Thread Jay Blanchard

[snip]
 Having a large number of files in a single directory does affect
performance,
 the degree of which depends on the filesystem.

This is generally accepted wisdom for dealing with large numbers of files -
but what number is considered large?
Any rules of thumb, for different OpSys/file systems?
[/snip]

I guess the situation I have had (various OS's) and numbers of items in the
file(s) (upwards of 40k items) I have never encountered a degredation in
performance that could be deemed noticeable. I could perform some file
retrieval analysis to see time lags, and I am sure that there would be some
dependent upon the file system (and OS), not to mention hardware factors,
the most significant which comes to mind is hard-drive seek times. But as
yet, none noticed...

Jay

***
* Texas PHP Developers Conf  Spring 2003  *
* T Bar M Resort  Conference Center  *
* New Braunfels, Texas*
* San Antonio Area PHP Developers Group   *
* Interested? Contact [EMAIL PROTECTED] *
***



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




RE: [PHP] unable to lookup host [1001] error

2002-08-21 Thread David Buerer

Here is the code per your request

?php

//includes
include('common.phpi');
include('constants.phpi');

// defaults...
define('MAXLINE', 1024);// how much to read from a socket at a time
define('LISTENQ', 10);  // listening queue
$PORT = 1482;  // the default port to run on
$FD_SETSIZE = 5;   // file descriptor set size (max number of
concurrent clients)...

set_time_limit(240);

$db_master=dbconnect($database_consultation);
mysql_query(DELETE FROM livechat);  //delete all old records left over
from a possible server crash or other anomoly

// set up the file descriptors and sockets...

// $listenfd only listens for a connection, it doesn't handle anything
// but initial connections, after which the $client array takes over...

$allset = socket_fd_alloc();
$listenfd = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($listenfd)
{ print Listening on port $PORT\n; }
else
{ die(AIEE -- socket died!\n); }

socket_setopt($listenfd, SOL_SOCKET, SO_REUSEADDR, 1);
if (!socket_bind($listenfd, '172.25.190.4', $PORT))
{
socket_close($listenfd);
die(AIEE -- Couldn't bind!\n);
}
socket_listen($listenfd, LISTENQ);
.
.
.
.
.

// set up our clients. After listenfd receives a connection,
// the connection is handed off to a $client[].

-Original Message-
From: Andrew Brampton [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 9:42 AM
To: David Buerer
Subject: Re: [PHP] unable to lookup host [1001] error


Show the code and we might be able to help better...
maybe line 20-35 ish, or anything you feel useful

thx
Andrew
- Original Message -
From: David Buerer [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 21, 2002 3:39 PM
Subject: [PHP] unable to lookup host [1001] error


 Anyone ever seen this error before?  What causes it?  It happens on a call
 to socket_bind after a successful call to socket_listen.

 Any ideas would be appreciated.

 Warning: socket_bind() unable to lookup host [1001]: Recursion too deep,
 stack overflowed. in
 f:\public\www\josiah\josiah2\consultation\chat\test_server.php on line 31
 AIEE -- Couldn't bind!





[PHP] Passing variables between servers

2002-08-21 Thread Mark McCulligh

I have two server.  One running PHP/Linux the other running ASP/2000.
The user logins into the PHP server and session variables are made to hold
their username, password, department, etc..  The site from time to time
redirect the user to the ASP server.  I want to pass the session variable
across to the other server.  I can't use the GET method.
(www.domain.com/form.asp?username=Mark.) because putting the password on
the address bar is not an option.  The ASP server will redirect them back
when they are done on it. It will pass back the variables just in case the
session on the PHP server has expired for the PHP server can create a new
session if needed.

I don't want to use a cookie.

I was thinking of using cURL but I can't fine any information about using it
in ASP.  I know how to use cURL in PHP to redirect the user to the ASP
server and pass the variables in the POST method, but not the other way.

Any ideas would be a GREAT help.
Mark.

_
Mark McCulligh, Application Developer / Analyst
Sykes Canada Corporation www.SykesCanada.com
[EMAIL PROTECTED]



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




Re: [PHP] Passing variables between servers

2002-08-21 Thread Adam Williams

Just suggestion but why not use md5($password) and then send the result of
that in your GET?

Adam

On Wed, 21 Aug 2002, Mark McCulligh wrote:

 I have two server.  One running PHP/Linux the other running ASP/2000.
 The user logins into the PHP server and session variables are made to hold
 their username, password, department, etc..  The site from time to time
 redirect the user to the ASP server.  I want to pass the session variable
 across to the other server.  I can't use the GET method.
 (www.domain.com/form.asp?username=Mark.) because putting the password on
 the address bar is not an option.  The ASP server will redirect them back
 when they are done on it. It will pass back the variables just in case the
 session on the PHP server has expired for the PHP server can create a new
 session if needed.

 I don't want to use a cookie.

 I was thinking of using cURL but I can't fine any information about using it
 in ASP.  I know how to use cURL in PHP to redirect the user to the ASP
 server and pass the variables in the POST method, but not the other way.

 Any ideas would be a GREAT help.
 Mark.

 _
 Mark McCulligh, Application Developer / Analyst
 Sykes Canada Corporation www.SykesCanada.com
 [EMAIL PROTECTED]






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




Re: [PHP] Passing variables between servers

2002-08-21 Thread Mark McCulligh

I thought about encrypting the whole querystring then decrypting it on the
other server, but I wanted to keep the address bar clean.  I wanted the user
not to know they just got passed.  If all a sudden there was a lot of data
in the address bar they will wonder what it is for.

Mark.
_
Mark McCulligh, Application Developer / Analyst
Sykes Canada Corporation www.SykesCanada.com
(888)225-6824 ex. 3262
[EMAIL PROTECTED]
- Original Message -
From: Adam Williams [EMAIL PROTECTED]
To: Mark McCulligh [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, August 21, 2002 1:30 PM
Subject: Re: [PHP] Passing variables between servers


 Just suggestion but why not use md5($password) and then send the result of
 that in your GET?

 Adam

 On Wed, 21 Aug 2002, Mark McCulligh wrote:

  I have two server.  One running PHP/Linux the other running ASP/2000.
  The user logins into the PHP server and session variables are made to
hold
  their username, password, department, etc..  The site from time to time
  redirect the user to the ASP server.  I want to pass the session
variable
  across to the other server.  I can't use the GET method.
  (www.domain.com/form.asp?username=Mark.) because putting the
password on
  the address bar is not an option.  The ASP server will redirect them
back
  when they are done on it. It will pass back the variables just in case
the
  session on the PHP server has expired for the PHP server can create a
new
  session if needed.
 
  I don't want to use a cookie.
 
  I was thinking of using cURL but I can't fine any information about
using it
  in ASP.  I know how to use cURL in PHP to redirect the user to the ASP
  server and pass the variables in the POST method, but not the other way.
 
  Any ideas would be a GREAT help.
  Mark.
 
  _
  Mark McCulligh, Application Developer / Analyst
  Sykes Canada Corporation www.SykesCanada.com
  [EMAIL PROTECTED]
 
 
 
 



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




RE: [PHP] Passing variables between servers

2002-08-21 Thread Daniel Masson


Hi !!

I know you said you cont want to use cookies ... I suggest that place
encrypted data in a cookie and in the win2000 machine place a php script
that read the data in the cookie, uncryptit and some how set the info
for the asp script, a plain text file or something ...

I hope this is useful.



-Mensaje original-
De: Mark McCulligh [mailto:[EMAIL PROTECTED]] 
Enviado el: miércoles, 21 de agosto de 2002 12:23
Para: [EMAIL PROTECTED]
Asunto: [PHP] Passing variables between servers


I have two server.  One running PHP/Linux the other running ASP/2000.
The user logins into the PHP server and session variables are made to
hold their username, password, department, etc..  The site from time to
time redirect the user to the ASP server.  I want to pass the session
variable across to the other server.  I can't use the GET method.
(www.domain.com/form.asp?username=Mark.) because putting the
password on the address bar is not an option.  The ASP server will
redirect them back when they are done on it. It will pass back the
variables just in case the session on the PHP server has expired for the
PHP server can create a new session if needed.

I don't want to use a cookie.

I was thinking of using cURL but I can't fine any information about
using it in ASP.  I know how to use cURL in PHP to redirect the user to
the ASP server and pass the variables in the POST method, but not the
other way.

Any ideas would be a GREAT help.
Mark.

_
Mark McCulligh, Application Developer / Analyst
Sykes Canada Corporation www.SykesCanada.com [EMAIL PROTECTED]



-- 
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] Passing variables between servers

2002-08-21 Thread Jay Blanchard

[snip]
I thought about encrypting the whole querystring then decrypting it on the
other server, but I wanted to keep the address bar clean.  I wanted the user
not to know they just got passed.  If all a sudden there was a lot of data
in the address bar they will wonder what it is for.
[/snip]

How about POSTING the whole querystring...

http://www.faqts.com/knowledge_base/view.phtml/aid/12039/fid/51

posting without using a form, can probably be re-engineered to for ASP to
send information back

HTH!

Jay

***
* Texas PHP Developers Conf  Spring 2003  *
* T Bar M Resort  Conference Center  *
* New Braunfels, Texas*
* San Antonio Area PHP Developers Group   *
* Interested? Contact [EMAIL PROTECTED] *
***



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




[PHP] Calendar logic question

2002-08-21 Thread Matt Schroebel

I have a calendar application that shows events in a month.  I want to add the ability 
to have re-occuring events.  I've been thinking about how to do that, but it's not 
seeming to be too easy.  

Say, I have a table of re-occuring events:
eventId int
eventName varchar
eventStartDate date
eventEndDate date
eventOccuranceType enum(weekly, monthly, daily)
eventInterval int
eventDOW int

Should I populate the actual events table with re-occuring events at 
insert/update/delete times, or should I code the event listing page to determine if 
there are events that would occur in the month shown? The first way would be costly at 
insert time, and may add lots of events that will never occur -- plus one can't go on 
forever, so at some point, it seems, it would have to do the second way anyway.   The 
second way, is costly at page view time.  With a small number of re-occurring events, 
that probably wouldn't be an issue, but as the calendar usage grows, I can see that 
becoming resource costly.  

Is there a better way?

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




Re: [PHP] Passing variables between servers

2002-08-21 Thread Seairth Jacobs

MD5 is a one-way hash.  There is no way to get information back out of it.
If he keeps a copy of the hash locally to comare instead of the original
password, this is still as vulnerable as using the original password in this
case.  The only thing it would protect from is making available the original
password (which may be used by the user for other sites, applications, etc).

---
Seairth Jacobs
[EMAIL PROTECTED]


Adam Williams [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Just suggestion but why not use md5($password) and then send the result of
 that in your GET?

 Adam

 On Wed, 21 Aug 2002, Mark McCulligh wrote:

  I have two server.  One running PHP/Linux the other running ASP/2000.
  The user logins into the PHP server and session variables are made to
hold
  their username, password, department, etc..  The site from time to time
  redirect the user to the ASP server.  I want to pass the session
variable
  across to the other server.  I can't use the GET method.
  (www.domain.com/form.asp?username=Mark.) because putting the
password on
  the address bar is not an option.  The ASP server will redirect them
back
  when they are done on it. It will pass back the variables just in case
the
  session on the PHP server has expired for the PHP server can create a
new
  session if needed.
 
  I don't want to use a cookie.
 
  I was thinking of using cURL but I can't fine any information about
using it
  in ASP.  I know how to use cURL in PHP to redirect the user to the ASP
  server and pass the variables in the POST method, but not the other way.
 
  Any ideas would be a GREAT help.
  Mark.
 
  _
  Mark McCulligh, Application Developer / Analyst
  Sykes Canada Corporation www.SykesCanada.com
  [EMAIL PROTECTED]
 
 
 
 




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




[PHP] Re: Passing variables between servers

2002-08-21 Thread Seairth Jacobs

Is there any reason to pass the data to the ASP server other than the need
for the ASP server to pass it back in case the PHP server session has
expired?  If not, why not just store the login information in a local table
referencable by a primary key that you pass around instead?  You could even
do this with GET.

---
Seairth Jacobs
[EMAIL PROTECTED]


Mark McCulligh [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have two server.  One running PHP/Linux the other running ASP/2000.
 The user logins into the PHP server and session variables are made to hold
 their username, password, department, etc..  The site from time to time
 redirect the user to the ASP server.  I want to pass the session variable
 across to the other server.  I can't use the GET method.
 (www.domain.com/form.asp?username=Mark.) because putting the password
on
 the address bar is not an option.  The ASP server will redirect them back
 when they are done on it. It will pass back the variables just in case the
 session on the PHP server has expired for the PHP server can create a new
 session if needed.

 I don't want to use a cookie.

 I was thinking of using cURL but I can't fine any information about using
it
 in ASP.  I know how to use cURL in PHP to redirect the user to the ASP
 server and pass the variables in the POST method, but not the other way.

 Any ideas would be a GREAT help.
 Mark.

 _
 Mark McCulligh, Application Developer / Analyst
 Sykes Canada Corporation www.SykesCanada.com
 [EMAIL PROTECTED]





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




  1   2   >