Re: [PHP] Using dBase.

2004-04-21 Thread Jason Wong
On Wednesday 21 April 2004 13:51, Barry Stokes wrote:

 Yes, it's still undefined.

Apparently you configured php with --enable-dbase, did you restart your 
webserver? Does phpinfo() show anything about dbase?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Don't let your mind wander -- it's too little to be let out alone.
*/

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



Re: [PHP] Using dBase.

2004-04-21 Thread Barry Stokes
On Wednesday 21 Apr 2004 07:01, Jason Wong wrote:
 On Wednesday 21 April 2004 13:51, Barry Stokes wrote:
  Yes, it's still undefined.

 Apparently you configured php with --enable-dbase, did you restart your
 webserver? Does phpinfo() show anything about dbase?


I didn't restart the webserver as I have not changed the config. 
--enable-dbase was built in the first time around.

phpinfo shows --enable-dbase as a config option, and also in the section 
marked Additional Modules.

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



Re: [PHP] Using dBase.

2004-04-21 Thread Jason Wong
On Wednesday 21 April 2004 14:07, Barry Stokes wrote:

 I didn't restart the webserver as I have not changed the config.
 --enable-dbase was built in the first time around.

 phpinfo shows --enable-dbase as a config option, and also in the section
 marked Additional Modules.

Which version of PHP are you using? According to the manual 
dbase_get_header_info() may only be available in CVS.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Most people prefer certainty to truth.
*/

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



[PHP] Re: document

2004-04-21 Thread kris
Please read the document.


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

Re: [PHP] Making an app unviewable during system maintainance

2004-04-21 Thread Burhan Khalid
Travis Low wrote:

Michal Migurski wrote:

Don't take the database down for backups.

I can think of no logical reason why you'd want to kill the DB to back
it up, since it's just a big read operation.


Referential integrity might be a reason. 


Good point, though if this is a concern, the OP will probably use the
built-in enforcement of referential integrity and transaction support of
whatever database they are running.


I don't know what an OP is, though I'm not sure it's relevant to my 
point. What I'm saying is that I don't think it's a good idea to back up 
a live database, because at that point you can't enforce referential 
integrity any more.

If a single database is spread over files A, B, and C, then in the time 
it took for a naive backup to grab file A, files B and C may have 
changed such that the database cannot be restored to an 
internally-consistent state using files A, B, and C.  At this point, 
enforcement of referential integrity would actually work against you.
MySQL provides facilities for locking tables for this purpose.  Also, as 
others have suggested, replication is a better way to do backups than 
directly off of the live server.

Just my non-db-guru $0.02.

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


Re: [PHP] ADOdb SQL Updates

2004-04-21 Thread Lester Caine
Gabe wrote:

I double checked the names.  Everything looks okay.  Another ideas?
Did the ADOdb list answer not work?
http://phplens.com/lens/lensforum/msgs.php?id=9285
Single and double quotes can be a problem in SQL.

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Web Hosting

2004-04-21 Thread Lester Caine
-{ Rene Brehmer }- wrote:

Hmm ... why the heck 65 characters ??? ... Old EGA screens were 80x34
characters, VGA is 80x43 characters ... The reason Usenet standard is 76
chars wide messages (today anyways) is that text-mode readers need the last
4 characters to display window borders and control chars along the message
lines ...
You never had a teletype then :)
I seem to recall they packed up about 65 characters across the line 
until punched cards came in.
5 bit baudot code was also a little restricting ;)

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Forking external binaries

2004-04-21 Thread Aidan Lister
There's a nu-fork library or something around.

There's a pear package which provides an API to this. Have a look around.

Michal Migurski [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
  We have a web application that forks off an external program to inject
  an email in the outgoing queue. At busy periods this external program
  (qmail-inject) can take a little while to return. I'm currently using
  popen() to spawn the qmail-inject binary.
 
  Is there a way to spawn the external binary but not wait for it to
  return. I'd be happy to ignore any return value if the tradeoff was a
  fast return.

 If you call it via exec(), you can append an ampersan to detach the
 controlling terminal:

 exec(/path/to/qmail-inject -args );

 Wish php had fork() in a non-experimental context. :\

 -
 michal migurski- contact info and pgp key:
 sf/cahttp://mike.teczno.com/contact.html

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



[PHP] Re: Extension : compiling several .C files ?

2004-04-21 Thread user
Any help will be greatly appreciated. Perheaps someone has a link to a 
newsgroup or a forum where I can find an answer

thx

[EMAIL PROTECTED]

[EMAIL PROTECTED] wrote:
Hi,

I've learn how to compile a simple (with only one .C file) extension 
under Windows and Linux. And multi .C file compilation with Windows.

But how can I compile a PHP extension composed by several .C files ? I'm 
not an expert in GCC compilation. So perheaps I've missed something.

For linux, I use the information give by the php documentation

http://www.php.net/manual/fr/zend.creating.php

The example give in the doc is fine for one .c file, but does not works 
for several .C files.

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


[PHP] Trouble with thumbnail generation using GD

2004-04-21 Thread Haddad Said
Hi, i was trying to create thumbnail using a tutorial on image galleries,
I am having problems creating thumbnail images using GD. The thumbnail is
created with the sizes prorerly, however the image is black.

I have posted a temporary php file i created to investigate the problem
below.

I suspect the problem is with the imagecopyresampled function.

I am using php version 4.3.4 with GD ver 2.0.x in windows XP for the test
machine

I appreciate any help


Thanks
PHP:


?php
$submit = $_POST['submit'];
if(isset($submit))
{
$file = $_FILES['file'];
$filename = any.jpg;
move_uploaded_file($file['tmp_name'], $filename);

$height = get_size($filename, height);
$width = get_size($filename, width);

$source_handle = ImageCreateFromJPEG($filename);
$destination_handle = ImageCreateTrueColor($width, $height);

ImageCopyResampled($destination_handle, $source_handle, 0, 0, 0, 0,
$width, $height, $size[0], $size[1]);
ImageJPEG($source_handle, './tb_' . $filename);

echo Success!!?brbrbrimg src=./tb_any.jpg /?
exit();
}
function get_size($filename, $dimension)
{
global $images_dir;
$size = GetImageSize($filename);
// Wide Image
if($size[0]  $size[1])
{
  $thumbnail_width = 100;
  $thumbnail_height = (int)(100 * $size[1] / $size[0]);
}
// Tall Image
else
{
   $thumbnail_width = (int)(100 * $size[0] / $size[1]);
   $thumbnail_height = 100;
}
if($dimension == width)
{
  return $thumbnail_width;
}
else
{
  return $thumbnail_height;
}
}
?

form action=?=$PHP_SELF? name=frmAdd method=post
enctype=multipart/form-data 
pTitle:brinput type=text size=54 name=article_title //p

pDescription:brtextarea name=article_text rows=10
cols=40/textarea/p
pFile:brinput name=file type=file size=54 //p
pinput type=submit name=submit value=Submit //p/form

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



[PHP] A good search tutorial

2004-04-21 Thread Phpu
Hi there
I have a site driven by a database and I need a search engine...when someone enter a 
word the script to search the entire database for that word and return the results.
Could someone give me the link to that kind of tutorial?
Please email me asap 


[PHP] Text Box question

2004-04-21 Thread Brent Clark
Hi all
I have a problem where, when I click on a link and when the page is finish
loading
I would like for the cursor to ready in the correct html text box.
I cant seem to find a solution

If anyone could help, that would be most appreciated
Kind Regards
Brent Clark

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



Re: [PHP] A good search tutorial

2004-04-21 Thread Brent Clark
Hi there
I have a site driven by a database and I need a search engine...when
someone enter a word the script to search the entire database for that word
and return the results.
Could someone give me the link to that kind of tutorial?
Please email me asap

Not that my database (mysql) is big or anything, and I only work with a very
selected columns
I just normally use LIKE in my query.
E.g.

SELECT abc FROM def WHERE LIKE '%string%';
Depending on what you what. I place the % before, after and in this example
before and after.

Kind Regards
Brent Clark

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



Re: [PHP] Text Box question

2004-04-21 Thread Miguel J. Jiménez
You can use javascript to perform this... Do the following:

   script type=text/javascript
  document.formName.boxName.focus(); // set the focus to the box
   /script
Brent Clark escribió:

Hi all
I have a problem where, when I click on a link and when the page is finish
loading
I would like for the cursor to ready in the correct html text box.
I cant seem to find a solution
If anyone could help, that would be most appreciated
Kind Regards
Brent Clark
 

--
Miguel J. Jiménez
ISOTROL, S.A. (Área de Internet)
Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA)
[EMAIL PROTECTED]   ---   http://www.isotrol.com
TLFNO. 955036800 ext. 111
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Text Box question

2004-04-21 Thread Brent Clark
You can use javascript to perform this... Do the following:

script type=text/javascript
   document.formName.boxName.focus(); // set the focus to the box
/script

Thank you
Worked like charm

Much appreciated

Kind Regards
Brent Clark

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



[PHP] Error using sockets in PHP 5

2004-04-21 Thread Sergio Cinos
Hi,

I have a problem using sockets in PHP 5. I create a socket in non-blocking
mode, and when I read in that socket, socket_read() function waits for
incoming data (as in a blocking socket). 

However, if I use system 'ltrace' in my script, I can see that: 
  recv(3, 0x4078f1c4, 1, 0) = -1 EAGAIN (Resource temporarily unavailable)

Why a socket_last_error() does not return nothing? Why socket_read() keeps
waiting for data?

Thanks for your help.

-- 
Sergio Cinos
http://www.alsernet.es - [EMAIL PROTECTED]
Tlf: 902 187 187 - Fax: 902 187 188

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



[PHP] Re: Text Box question

2004-04-21 Thread Saulius
put a JS code in yor body tag:

body onLoad=this.document.form_name.textbox_name.focus=true

Brent Clark [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi all
 I have a problem where, when I click on a link and when the page is finish
 loading
 I would like for the cursor to ready in the correct html text box.
 I cant seem to find a solution

 If anyone could help, that would be most appreciated
 Kind Regards
 Brent Clark

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



[PHP] Problem installing CURL for phpMySearch

2004-04-21 Thread KidLat Ngayon
Greetings!!!

I hope that there would be someone could help me in
installing CURL Version 7.11.0 for PHP Version 4.3.2.

I've already configure the CURL in PHP using on this
way:

./configure --with-mysql=/usr/local/mysql \
--with-nsapi=/usr/iplanet/iWS \
--with-curl=/usr/local \
--with-curlwrappers \
--enable-libgcc

After I have configured , make, and make install the
php, I dont get any error from them, instead a
complete configuration or build on it.

But whenever I checked my phpinfo (using phpMyAdmin),
I only got this configuration:

 './configure' '--with-mysql=/usr/local/mysql'
'--with-nsapi=/usr/iplanet/iWS' '--enable-libgcc'

And, when I checked the installation of phpMySearch,
it always have error on CURL saying that I need to
compile it.

Any suggestions is highly appreciated.
Thank you in advance.

Regards,
Erwin




__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash

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



[PHP] Problem installing CURL for phpMySearch

2004-04-21 Thread KidLat Ngayon
Subject:  Problem installing CURL for phpMySearch
To: [EMAIL PROTECTED]

Greetings!!!

I hope that there would be someone could help me in
installing CURL Version 7.11.0 for PHP Version 4.3.2.

I've already configure the CURL in PHP using on this
way:

./configure --with-mysql=/usr/local/mysql \
--with-nsapi=/usr/iplanet/iWS \
--with-curl=/usr/local \
--with-curlwrappers \
--enable-libgcc

After I have configured , make, and make install the
php, I dont get any error from them, instead a
complete configuration or build on it.

But whenever I checked my phpinfo (using phpMyAdmin),
I only got this configuration:

 './configure' '--with-mysql=/usr/local/mysql'
'--with-nsapi=/usr/iplanet/iWS' '--enable-libgcc'

And, when I checked the installation of phpMySearch,
it always have error on CURL saying that I need to
compile it.

Any suggestions is highly appreciated.
Thank you in advance.

Regards,
Erwin






__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash

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



[PHP] strange urlencode/decode problem

2004-04-21 Thread Victor Spång Arthursson
Perhaps I'm tired, perhaps I've missed something obvious, but I can't 
get this simple thing which I practically does every week to work

Ok, here is what I do:

?php

$foo = urlencode(Delete from whatever where ditten = 'datten');
echo 'a href=foo.php?strSQL=' . $foo . 'Click here to test/a';
?

I sidan foo.php skriver jag:

?php

echo urldecode($_GET[strSQL]);

?

and gets the result:

Delete from whatever where ditten = \'datten\'

The question is why PHP escapes the single qoutes? This has never 
happened to me before, except if I have been using addslashes() or 
similiar functions

And they occur even if I don't urlencode at all

Why!?!?!?!?

Sincerely

Victor Spng Arthursson - Copenhagen

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


[PHP] Re: strange urlencode/decode problem

2004-04-21 Thread Craig
http://ie.php.net/manual/en/function.get-magic-quotes-gpc.php

use stripslashes() :

?php
echo stripslashes(urldecode($_GET[strSQL]));
?

Cheers



Victor spång arthursson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Perhaps I'm tired, perhaps I've missed something obvious, but I can't
get this simple thing which I practically does every week to work…

Ok, here is what I do:

?php

$foo = urlencode(Delete from whatever where ditten = 'datten');
echo 'a href=foo.php?strSQL=' . $foo . 'Click here to test/a';

?

I sidan foo.php skriver jag:

?php

echo urldecode($_GET[strSQL]);

?

and gets the result:

Delete from whatever where ditten = \'datten\'

The question is why PHP escapes the single qoutes? This has never
happened to me before, except if I have been using addslashes() or
similiar functions…

And they occur even if I don't urlencode at all…

Why!?!?!?!?

Sincerely

Victor Spång Arthursson - Copenhagen

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



[PHP] Re: Text Box question

2004-04-21 Thread pete M
Brent Clark wrote:
Hi all
I have a problem where, when I click on a link and when the page is finish
loading
I would like for the cursor to ready in the correct html text box.
I cant seem to find a solution
If anyone could help, that would be most appreciated
Kind Regards
Brent Clark


Stick this in the body tag

body onload=document.form1.textboxname.focus();

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


Re: [PHP] PHP Web Hosting

2004-04-21 Thread -{ Rene Brehmer }-
According to historical records, on Wed, 21 Apr 2004 13:16:35 +0800 Jason
Wong [EMAIL PROTECTED] wrote about Re: [PHP] PHP Web Hosting:

On Tuesday 20 April 2004 23:38, -{ Rene Brehmer }- wrote:

 I've got mine registered at enom through Westhost, and westhost gives me a
 registrar interface so I can do whatever I want with my domain ... make new
 TLDs, 

Make new TLDs!?! Is ICANN aware of this ;)

Sorry ... meant SLDs ... obviously ... :-/


Rene

-- 
Rene Brehmer
aka Metalbunny

~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums @ http://forums.metalbunny.net/

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



[PHP] objects in a session

2004-04-21 Thread electroteque
Hi there going back to the discussions of objects in a session. I would like
to know what are the benifits of this, and in what scenarios would it be
used. I have an application I am trying to make scalable if possible, it
uses a sub class to a phplayers menu class which parses an xml file and
generates the menu depending on certain attributes like access for instance.
It will check if the user is an admin or normal user and not show it. Would
this one be useful for adding into a session across pages ? Also i have a
date/calender class which is used across pages, it dynamically generates
list menus of day/month/year , somehow it slows down the page when loading,
would it be useful to go into a session aswell ? I dont want to overdo the
session vars aswell.

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



Re: [PHP] redirection with PHP and closing windows?

2004-04-21 Thread -{ Rene Brehmer }-
According to historical records, on Tue, 20 Apr 2004 23:02:50 -0500 Andre
wrote about [PHP] redirection with PHP and closing windows?:

I want to be able to process a PHP script and then if successful redirect to
another page. Is there a good way to do this with PHP or do I need to stick
to Javascript?

I always use META redirects for this (trying to avoid anything but PHP
whatever it takes) ... but I believe there are other ways ...

Also, is it possible to close a window that is running a .PHP page via a
link or again, just stuck with Javascript?

I don't think it gets any simpler than the JavaScript:

// method 1
a href=javascript:window.close()Close window/a

// method 2
a href=# onClick=window.close()Close window/a

Not entirely sure how cross-browser compatible this is. May have to use
this.window.close() or windows.close(this) ... I can't remember the exact
syntax, sorry, haven't worked much with JavaScript except for mouseovers in
several years


Rene

-- 
Rene Brehmer
aka Metalbunny

~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums @ http://forums.metalbunny.net/

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



Re: [PHP] A good search tutorial

2004-04-21 Thread raditha dissanayake
Phpu wrote:

Hi there
I have a site driven by a database and I need a search engine...when someone enter a word the script to search the entire database for that word and return the results.
Could someone give me the link to that kind of tutorial?
Please email me asap 
 

IT may be that full text indexing (ref Mysql Manual) is all you need.



--
Raditha Dissanayake.
-
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions 

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


Re: [PHP] A good search tutorial

2004-04-21 Thread -{ Rene Brehmer }-
According to historical records, on Wed, 21 Apr 2004 12:28:27 +0300 Phpu
wrote about [PHP] A good search tutorial :

Hi there
I have a site driven by a database and I need a search engine...when someone enter a 
word the script to search the entire database for that word and return the results.
Could someone give me the link to that kind of tutorial?
Please email me asap 

I'd say it largely depends on what kinda data you're searching in, and how
you want it displayed ... 

The search engine I wrote for the CPU database on my site
(http://metalbunny.net/computers/cpudb.php) does wildcard/free searching in
3 fields in the one table in the database simultaneously, and allows for
selective reduction of the result set and custom sorting of all the 12
columns it displays. (thanks alot btw to everyone on this list and PHP DB
that helped me make this!). It's a few hundred lines long because of the
many options...

My point with mentioning this is merely that depending on how complex data
you want to search in, and how flexible you want to make the search option
... and how you want to display the results of the search, the method of and
approach to  building the search engine differs ...

The code Brent posted is the basic start for the SQL string for the search
engine ... you need to find out what you want it to be able to do and build
it from there ... 

I don't know if my code would help you any bit ... but I'd gladly post it
upon request  it's just that it's made when I was still a rookie at SQL,
so it's not very elegant, and not very well commented ... and looking at it
now I can find several ways to improve it ...just don't have the time for
it...

FWIW

Rene
-- 
Rene Brehmer
aka Metalbunny

~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums @ http://forums.metalbunny.net/

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



[PHP] eval() question

2004-04-21 Thread OrangeHairedBoy
I would like to use eval() to evaluate another PHP file and store the output
of that file in a string.

So, let's say, for example, that I have a file called colors.php which
contains this:

pColors: ? echo Red, Yellow, Green, Blue; ?/p

Then, in another file, I have this:

$file = file_get_contents( colors.php );
$colors = eval( $file );

I'm having problems getting $file into $colors. How can I do this?

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



RE: [PHP] eval() question

2004-04-21 Thread Michael Sims
OrangeHairedBoy wrote:
 I would like to use eval() to evaluate another PHP file and store the
 output of that file in a string.

You could use output buffering to do this a bit more easily, I think:

ob_start();
include('colors.php');
$colors = ob_get_contents();
ob_end_clean();

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



Re: [PHP] eval() question

2004-04-21 Thread OrangeHairedBoy
While that is an awesome idea, I don't think it will work for me.

There's two reasons why. First, colors.php is actually stored in a MySQL
server.

Second, before the PHP code inside colors.php I want to be able to replace
data inside that file. For example:

$file = str_replace( Green , Orange , $file );

Lewis


Michael Sims [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 OrangeHairedBoy wrote:
  I would like to use eval() to evaluate another PHP file and store the
  output of that file in a string.

 You could use output buffering to do this a bit more easily, I think:

 ob_start();
 include('colors.php');
 $colors = ob_get_contents();
 ob_end_clean();

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



RE: [PHP] A good search tutorial

2004-04-21 Thread Brian Paulson
There is a good search engine tutorial at devshed  -
http://www.devshed.com/c/a/PHP/Quick-and-Dirty-Search-Engine-with-PHP-and-My
SQL/

I use it for a few searches on our site and it works well.

Thank You
Brian Paulson
Sr. Web Developer
[EMAIL PROTECTED]
www.chieftain.com
1-800-279-6397 x 207
 

-Original Message-
From: Phpu [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 21, 2004 3:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP] A good search tutorial 

Hi there
I have a site driven by a database and I need a search engine...when someone
enter a word the script to search the entire database for that word and
return the results.
Could someone give me the link to that kind of tutorial?
Please email me asap 

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



Re: [PHP] eval() question

2004-04-21 Thread Marek Kilimajer
OrangeHairedBoy wrote:
I would like to use eval() to evaluate another PHP file and store the output
of that file in a string.
So, let's say, for example, that I have a file called colors.php which
contains this:
pColors: ? echo Red, Yellow, Green, Blue; ?/p

Then, in another file, I have this:

$file = file_get_contents( colors.php );
$colors = eval( $file );
I'm having problems getting $file into $colors. How can I do this?

eval starts in php mode by default, change the file content to

?pColors: ? echo Red, Yellow, Green, Blue; ?/p?

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


Re: [PHP] eval() question

2004-04-21 Thread OrangeHairedBoy
Marek,

OK...that worked...kinda, but it doesn't pass the output to $colors. It
echos it. I need the output to be passed to $colors.

Lewis

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 OrangeHairedBoy wrote:
  I would like to use eval() to evaluate another PHP file and store the
output
  of that file in a string.
 
  So, let's say, for example, that I have a file called colors.php which
  contains this:
 
  pColors: ? echo Red, Yellow, Green, Blue; ?/p
 
  Then, in another file, I have this:
 
  $file = file_get_contents( colors.php );
  $colors = eval( $file );
 
  I'm having problems getting $file into $colors. How can I do this?
 

 eval starts in php mode by default, change the file content to

 ?pColors: ? echo Red, Yellow, Green, Blue; ?/p?

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



Re: [PHP] ADOdb SQL Updates

2004-04-21 Thread Gabe
It sort of did.  It may have corrected that error, but now I get a new 
error:

Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access 
Driver] Operation must use an updateable query., SQL state S1000 in 
SQLExecDirect in d:\adodb\drivers\adodb-odbc.inc.php on line 504
S1000: [Microsoft][ODBC Microsoft Access Driver] Operation must use an 
updateable query.

What do you think?

Lester Caine wrote:
Gabe wrote:

I double checked the names.  Everything looks okay.  Another ideas?


Did the ADOdb list answer not work?
http://phplens.com/lens/lensforum/msgs.php?id=9285
Single and double quotes can be a problem in SQL.

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


RE: [PHP] eval() question

2004-04-21 Thread Michael Sims
 OrangeHairedBoy wrote:
 I would like to use eval() to evaluate another PHP file and store
 the output of that file in a string.

 You could use output buffering to do this a bit more easily, I think:

 ob_start();
 include('colors.php');
 $colors = ob_get_contents();
 ob_end_clean();

 While that is an awesome idea, I don't think it will work for me.

 There's two reasons why. First, colors.php is actually stored in a
 MySQL server.

 Second, before the PHP code inside colors.php I want to be able to
 replace data inside that file. For example:

 $file = str_replace( Green , Orange , $file );

Ok, then a slight adjustment should work:

$file = file_get_contents( colors.php );
$file = str_replace( Green , Orange , $file );
ob_start();
eval( $file );
$colors = ob_get_contents();
ob_end_clean();

I've never done that personally, but the documentation for eval() states:

In PHP 4, eval() returns NULL unless return is called in the evaluated code,
in which case the value passed to return is returned.

And then:

Tip: As with anything that outputs its result directly to the browser, you
can use the output-control functions to capture the output of this function,
and save it in a string (for example).

HTH...

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



Re: [PHP] eval() question

2004-04-21 Thread OrangeHairedBoy
Thanks Michael  Marek! It worked! :)


Michael Sims [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
  OrangeHairedBoy wrote:
  I would like to use eval() to evaluate another PHP file and store
  the output of that file in a string.
 
  You could use output buffering to do this a bit more easily, I think:
 
  ob_start();
  include('colors.php');
  $colors = ob_get_contents();
  ob_end_clean();
 
  While that is an awesome idea, I don't think it will work for me.
 
  There's two reasons why. First, colors.php is actually stored in a
  MySQL server.
 
  Second, before the PHP code inside colors.php I want to be able to
  replace data inside that file. For example:
 
  $file = str_replace( Green , Orange , $file );

 Ok, then a slight adjustment should work:

 $file = file_get_contents( colors.php );
 $file = str_replace( Green , Orange , $file );
 ob_start();
 eval( $file );
 $colors = ob_get_contents();
 ob_end_clean();

 I've never done that personally, but the documentation for eval() states:

 In PHP 4, eval() returns NULL unless return is called in the evaluated
code,
 in which case the value passed to return is returned.

 And then:

 Tip: As with anything that outputs its result directly to the browser, you
 can use the output-control functions to capture the output of this
function,
 and save it in a string (for example).

 HTH...

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



[PHP] SQL like processing on array of keyed arrays ?

2004-04-21 Thread Richard A. DeVenezia
Suppose I don't have access to a database server.

I have any indexed array of like keyed arrays, essentially mimicing a
database table.
Are there any libraries or functions that I can use to 'query' the array in
a SQL like manner ?

e.g.
$data = array
(array(a=1,b=2,c=3)
,array(a=2,b=3,c=4)
,array(a=3,b=4,c=5)
);

I would like to be able to do

$subset = arraysql_query ($data, where a=3);

instead of

$subset = array();
foreach ($data as $dat) {
  if ($dat['a'] = 3) $subset[]=$dat;
}
-- 
Richard

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



Re: [PHP] ADOdb SQL Updates

2004-04-21 Thread Gabe
Here's another version of the SQL statement and I get  a different
error now.  When I copy and paste this exact same SQL statement into an
update query in Access it works fine.  When I try to use it in my PHP
code, I get the following error:
SQL Statement:
UPDATE tblFAQ_Book SET fldTitle = 'one more test' WHERE (autoBookID= 1);
Error Message:
Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access
Driver] Operation must use an updateable query., SQL state S1000 in
SQLExecDirect in d:\adodb\drivers\adodb-odbc.inc.php on line 504
S1000: [Microsoft][ODBC Microsoft Access Driver] Operation must use an
updateable query.
Thanks

Curt Zirzow wrote:

* Thus wrote Gabe ([EMAIL PROTECTED]):

...
(access): UPDATE tblFAQ_Book SET tblFAQ_Book.fldTitle = one more test 
WHERE (tblFAQ_Book.autoBookID = 1)

Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access 
Driver] Too few parameters. Expected 1., SQL state 07001 in 
SQLExecDirect in \adodb\drivers\adodb-odbc.inc.php on line 504
07001: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. 
Expected 1.


Recheck the spelling of column names and table names.

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


Re: [PHP] Using dBase.

2004-04-21 Thread Curt Zirzow
* Thus wrote Jason Wong ([EMAIL PROTECTED]):
 On Wednesday 21 April 2004 14:07, Barry Stokes wrote:
 
  I didn't restart the webserver as I have not changed the config.
  --enable-dbase was built in the first time around.
 
  phpinfo shows --enable-dbase as a config option, and also in the section
  marked Additional Modules.
 
 Which version of PHP are you using? According to the manual 
 dbase_get_header_info() may only be available in CVS.

I looked this up, and the most recent documentation lists this
function as PHP5 only.

Apparently it didn't make it into the php4.x version.

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] ADOdb SQL Updates

2004-04-21 Thread David O'Brien
At 11:01 AM 4/21/2004, you wrote:
Here's another version of the SQL statement and I get  a different
error now.  When I copy and paste this exact same SQL statement into an
update query in Access it works fine.  When I try to use it in my PHP
code, I get the following error:
SQL Statement:
UPDATE tblFAQ_Book SET fldTitle = 'one more test' WHERE (autoBookID= 1);
Error Message:
Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access
Driver] Operation must use an updateable query., SQL state S1000 in
SQLExecDirect in d:\adodb\drivers\adodb-odbc.inc.php on line 504
S1000: [Microsoft][ODBC Microsoft Access Driver] Operation must use an
updateable query.
this sounds like your are updating the table with exactly the same values 
that are already present?

Have you tried it on different values to see if it works or just the ones 
you paste into access?

-Dave


Thanks

Curt Zirzow wrote:

* Thus wrote Gabe ([EMAIL PROTECTED]):

...
(access): UPDATE tblFAQ_Book SET tblFAQ_Book.fldTitle = one more test 
WHERE (tblFAQ_Book.autoBookID = 1)

Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access 
Driver] Too few parameters. Expected 1., SQL state 07001 in 
SQLExecDirect in \adodb\drivers\adodb-odbc.inc.php on line 504
07001: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. 
Expected 1.
Recheck the spelling of column names and table names.
Curt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


David G. O'Brien
Web Services Coordinator / Systems Administrator
NACCRRA
The Nation's Network of Child Care Resource  Referral
1319 F Street NW, Suite 500
Washington, DC 20004
(202) 393-5501 ext. 113
(202) 393-1109 fax
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ADOdb SQL Updates

2004-04-21 Thread David O'Brien
After googling the error message for you, I found about a zillion pages
which all basically say the same thing.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q175168

-Dave

At 11:01 AM 4/21/2004, Gabe wrote:
Here's another version of the SQL statement and I get  a different
error now.  When I copy and paste this exact same SQL statement into an
update query in Access it works fine.  When I try to use it in my PHP
code, I get the following error:
SQL Statement:
UPDATE tblFAQ_Book SET fldTitle = 'one more test' WHERE (autoBookID= 1);
Error Message:
Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access
Driver] Operation must use an updateable query., SQL state S1000 in
SQLExecDirect in d:\adodb\drivers\adodb-odbc.inc.php on line 504
S1000: [Microsoft][ODBC Microsoft Access Driver] Operation must use an
updateable query.
Thanks

Curt Zirzow wrote:

* Thus wrote Gabe ([EMAIL PROTECTED]):

...
(access): UPDATE tblFAQ_Book SET tblFAQ_Book.fldTitle = one more test 
WHERE (tblFAQ_Book.autoBookID = 1)

Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access 
Driver] Too few parameters. Expected 1., SQL state 07001 in 
SQLExecDirect in \adodb\drivers\adodb-odbc.inc.php on line 504
07001: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. 
Expected 1.
Recheck the spelling of column names and table names.
Curt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


David G. O'Brien
Web Services Coordinator / Systems Administrator
NACCRRA
The Nation's Network of Child Care Resource  Referral
1319 F Street NW, Suite 500
Washington, DC 20004
(202) 393-5501 ext. 113
(202) 393-1109 fax


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


[PHP] adding -'s to a numeric string

2004-04-21 Thread Adam Williams
Hi, I have a form where I have a user entering in the date in a numeric 
string.  For today they would enter 04212004 and so on...I'm working on 
this date within mysql server, and mssql server handles dates as 
04-21-2004 when you use convert(varchar,field,110).  So how in PHP can I 
change a variable's value which is 04122004 into 04-21-2204 

thanks!

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



Re: [PHP] slow upload with http post

2004-04-21 Thread William Lovaton
Mmmm... do you have another test box?

How much time does it take using, let's say, ftp or samba??


-William


El mi? 21-04-2004 a las 00:57, Yavuz Malak escribi:
 full duplex
 - Original Message - 
 From: William Lovaton [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, April 20, 2004 6:40 PM
 Subject: Re: [PHP] slow upload with http post
 
 
  full duplex or half duplex?
 
 
  El mar, 20-04-2004 a las 02:00, Yavuz Malak escribi:
   Hello
   I have a webserver that  running php4.3.x,mysql3.5x,apache1.3.x  on
 Mandrake9.
   I intended to transfer this server to another server.
   I installed Freebsd4.9 on newserver. and certainly apache1.3x,php4,mysql
 and concerning components.
   it works well. and I have a problem.
   We have 100Mbit/s Lan media. no problem
   Folders that (some has  size of 1Mbyte or more )  are uploaded with
 http_post to the server.
   in old server
   the folder that size of 1mbyte was uploaded with in 2 second. but on
 Freebsd the same folder uploading with in 7,8 second. That is, Upload is
 slow
   What shall i do ?
  
  
  
 
  -- 
  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] Form Data Transfer b/w Pages

2004-04-21 Thread Sobajo
Two forms (form1 and form2 submit to the same controller.php file. The 
controller redirects the page depending on the value of hidden value 
'page'. I want form data 'username' and 'password' to be available on 
both redirected pages (staff.php and customer.php). How do I accomplish 
this?

!--form1.php--
form action=controller.php method=post
  input type=hidden name=page value=staff.php
  input name=password type=password
  input name=username type=text
  input type=submit value=Submit
/form
!--form2.php--
form action=controller.php method=post
  input type=hidden name=page value=customer.php
  input name=password type=password
  input name=username type=text
  input type=submit value=Submit
/form
?php
 //controller.php
 header(Location: http://; . $_SERVER['HTTP_HOST']
. dirname($_SERVER['PHP_SELF'])
. /
. $_POST[page]);
?
?php
 //user.php
 echo Staff Name =  . $_POST[username];
 echo Staff Password =  . $_POST[password];
?
?php
 //customer.php
 echo Customer Name =  . $_POST[username];
 echo Customer Password =  . $_POST[password];
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Whats faster? text files or mysql?

2004-04-21 Thread William Lovaton
Hi Jay,

El mar, 20-04-2004 a las 07:52, Jay Blanchard escribió:
 [snip]
 I have two text files with two rows of data on each line sperated by a
 tab for about 20 lines in each file. Would it be faster accessing this
 data by putting it in a mysql table?
 [/snip]
 
 Sounds like the perfect opportunity to set up a test! File I/O is always
 slower.

I/O is always slow, but it is even slower when it is done through a
network.  It is always faster accessing a file on the hard disk than
accessing it through the network.

If you don't need to index the information and make complex queries, a
text file on the web server hard disk is just fine.


-William

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



[PHP] Re: Form Data Transfer b/w Pages

2004-04-21 Thread Craig
For ease of use, i would create a session and handle it that way or you
could pass it through $_GET[]
Query string.
Would recommend $_SESSION though.
Cheers

Sobajo [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Two forms (form1 and form2 submit to the same controller.php file. The
 controller redirects the page depending on the value of hidden value
 'page'. I want form data 'username' and 'password' to be available on
 both redirected pages (staff.php and customer.php). How do I accomplish
 this?

 !--form1.php--
 form action=controller.php method=post
input type=hidden name=page value=staff.php
input name=password type=password
input name=username type=text
input type=submit value=Submit
 /form

 !--form2.php--
 form action=controller.php method=post
input type=hidden name=page value=customer.php
input name=password type=password
input name=username type=text
input type=submit value=Submit
 /form

 ?php
   //controller.php
   header(Location: http://; . $_SERVER['HTTP_HOST']
  . dirname($_SERVER['PHP_SELF'])
  . /
  . $_POST[page]);
 ?

 ?php
   //user.php
   echo Staff Name =  . $_POST[username];
   echo Staff Password =  . $_POST[password];
 ?


 ?php
   //customer.php
   echo Customer Name =  . $_POST[username];
   echo Customer Password =  . $_POST[password];
 ?

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



[PHP] Re: adding -'s to a numeric string

2004-04-21 Thread Craig
Something like this would work:
=

?php

 function dateConvert($date)
 {
  $newdate = ;

  $newdate .= substr($date,0,2);
  $newdate .= -;
  $newdate .= substr($date,2,2);
  $newdate .= -;
  $newdate .= substr($date,4,4);

  return $newdate;
 }

 echo dateConvert(04212004);
?

Adam Williams [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi, I have a form where I have a user entering in the date in a numeric
 string.  For today they would enter 04212004 and so on...I'm working on
 this date within mysql server, and mssql server handles dates as
 04-21-2004 when you use convert(varchar,field,110).  So how in PHP can I
 change a variable's value which is 04122004 into 04-21-2204

 thanks!

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



Re: [PHP] ADOdb SQL Updates

2004-04-21 Thread Gabe
Thanks Dave.  It's working now.  I searched many different places for an 
answer and yet for whatever reason, I just didn't check Google.  We're 
all allowed a few brain mishaps, right?   :-)

Thanks again.

David O'Brien wrote:

After googling the error message for you, I found about a zillion pages
which all basically say the same thing.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q175168

-Dave

At 11:01 AM 4/21/2004, Gabe wrote:

Here's another version of the SQL statement and I get  a different
error now.  When I copy and paste this exact same SQL statement into an
update query in Access it works fine.  When I try to use it in my PHP
code, I get the following error:
SQL Statement:
UPDATE tblFAQ_Book SET fldTitle = 'one more test' WHERE (autoBookID= 1);
Error Message:
Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access
Driver] Operation must use an updateable query., SQL state S1000 in
SQLExecDirect in d:\adodb\drivers\adodb-odbc.inc.php on line 504
S1000: [Microsoft][ODBC Microsoft Access Driver] Operation must use an
updateable query.
Thanks

Curt Zirzow wrote:

* Thus wrote Gabe ([EMAIL PROTECTED]):

...
(access): UPDATE tblFAQ_Book SET tblFAQ_Book.fldTitle = one more 
test WHERE (tblFAQ_Book.autoBookID = 1)

Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access 
Driver] Too few parameters. Expected 1., SQL state 07001 in 
SQLExecDirect in \adodb\drivers\adodb-odbc.inc.php on line 504
07001: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. 
Expected 1.


Recheck the spelling of column names and table names.
Curt


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


David G. O'Brien
Web Services Coordinator / Systems Administrator
NACCRRA
The Nation's Network of Child Care Resource  Referral
1319 F Street NW, Suite 500
Washington, DC 20004
(202) 393-5501 ext. 113
(202) 393-1109 fax

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


Re: [PHP] Whats faster? text files or mysql?

2004-04-21 Thread William Lovaton
El mar, 20-04-2004 a las 08:24, John Nichel escribió:
 Jay Blanchard wrote:
  
  There is always awk! 
  
 
 Aw, no votes for cat | grep? ;)

No, that would be worse since the system needs to spawn a new process
and this is slow too.  Specially on a high loaded system.

If you are concerned about speed always use native functions.


-William

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



Re: [PHP] Re: Form Data Transfer b/w Pages

2004-04-21 Thread Daniel Clark
I agree.   $_GET[] would expose the username and password on the URL.

 For ease of use, i would create a session and handle it that way or you
 could pass it through $_GET[]
 Query string.
 Would recommend $_SESSION though.
 Cheers

 Sobajo [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Two forms (form1 and form2 submit to the same controller.php file. The
 controller redirects the page depending on the value of hidden value
 'page'. I want form data 'username' and 'password' to be available on
 both redirected pages (staff.php and customer.php). How do I accomplish
 this?

 !--form1.php--
 form action=controller.php method=post
input type=hidden name=page value=staff.php
input name=password type=password
input name=username type=text
input type=submit value=Submit
 /form

 !--form2.php--
 form action=controller.php method=post
input type=hidden name=page value=customer.php
input name=password type=password
input name=username type=text
input type=submit value=Submit
 /form

 ?php
   //controller.php
   header(Location: http://; . $_SERVER['HTTP_HOST']
  . dirname($_SERVER['PHP_SELF'])
  . /
  . $_POST[page]);
 ?

 ?php
   //user.php
   echo Staff Name =  . $_POST[username];
   echo Staff Password =  . $_POST[password];
 ?


 ?php
   //customer.php
   echo Customer Name =  . $_POST[username];
   echo Customer Password =  . $_POST[password];
 ?


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



RE: [PHP] Making an app unviewable during system maintainance

2004-04-21 Thread Chris W. Parker
Travis Low mailto:[EMAIL PROTECTED]
on Tuesday, April 20, 2004 10:02 PM said:

 Michal Migurski wrote:

[snip]

 Good point, though if this is a concern, the OP will probably use the
 built-in enforcement of referential integrity and transaction
 support of whatever database they are running.
 
 I don't know what an OP is, though I'm not sure it's relevant to my
 point.

it means Original Poster as in the person that started the thread.


sort of like OG, original gangster! cha cha cha.



hth,
chris.

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



Re: [PHP] Whats faster? text files or mysql?

2004-04-21 Thread John Nichel
William Lovaton wrote:
El mar, 20-04-2004 a las 08:24, John Nichel escribió:

Jay Blanchard wrote:

There is always awk! 

Aw, no votes for cat | grep? ;)


No, that would be worse since the system needs to spawn a new process
and this is slow too.  Specially on a high loaded system.
If you are concerned about speed always use native functions.

-William

It was a joke. :)

--
***
*  _  __   __  __   _  * John  Nichel *
* | |/ /___ __ \ \/ /__ _ _| |__ ___  __ ___ _ __  * 716.856.9675 *
* | ' / -_) _` \ \/\/ / _ \ '_| / /(_-_/ _/ _ \ '  \ * 737 Main St. *
* |_|\_\___\__, |\_/\_/\___/_| |_\_\/__(_)__\___/_|_|_|* Suite #150   *
*  |___/   * Buffalo, NY  *
* http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 *
***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] File upload problem

2004-04-21 Thread William Merrick
Hi, I have two php pages that upload files to a mysql db. I do not know how
to change this code to accept more than plain text files. Specifically, I
would like to accept .doc and .xls files. Can anyone help? Thanks...Will



This is my upload form

body
h3 Upload a New File/h3
form enctype=multipart/form-data action=item_upload.php method=post
input type=hidden name=MAX_FILE_SIZE value=10
Upload this file: input name=userfile type=file
input type=submit value=Send File
/form
/body
/html


This, I use to handle the uploaded file...

?
if ($userfile==none)
{
echo Problem: no file uploaded;
exit;
}

if ($userfile_size==0)
{
echo Problem: uploaded file is zero length;
exit;
}

if (!is_uploaded_file($userfile))
{
echo Problem: possibles file upload attack;
exit;
}

$upfile = ../uploads/.$userfile_name;

if ( !copy($userfile, $upfile))
{
echo Problem: Could not move file into directory;
exit;
}

echo File uploaded successfullybrbr;
$fp = fopen($upfile, r);
$contents = fread ($fp, filesize ($upfile));
fclose ($fp);

$contents = strip_tags($contents);
$fp = fopen($upfile, w);
fwrite($fp, $contents);
fclose($fp);

echo preview of uploaded file contents:brhr;
echo $contents;
echo brhr;

?

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



Re: [PHP] Making an app unviewable during system maintainance

2004-04-21 Thread Michal Migurski
  Good point, though if this is a concern, the OP will probably use the
  built-in enforcement of referential integrity and transaction support
  of whatever database they are running.

 If a single database is spread over files A, B, and C, then in the time
 it took for a naive backup to grab file A, files B and C may have
 changed such that the database cannot be restored to an
 internally-consistent state using files A, B, and C.  At this point,
 enforcement of referential integrity would actually work against you.

Right, but if the database's built-in backup tool is used rather than the
filesystem, it ought to respect the read/write locks that are a natural
by-product of using begin/commit to wrap your transactions. E.g., a call
to pg_dump should be guaranteed to pull the database in an
internally-consistent state, if the application logic uses transactions
correctly. I guess that's probably what you meant by Use the DB to make
the snapshot, then back up the snapshot. :)

(I say ought and should because I'm no DB guru, myself)

This popped up on /. yesterday, and it seems relevant:
http://www.oreillynet.com/pub/wlg/4715

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



Re: [PHP] slow upload with http post

2004-04-21 Thread Don Read

On 21-Apr-2004 Yavuz Maºlak wrote:
 full duplex

What's the output of:

mount and sysctl -a | grep '^hw' ?


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

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



[PHP] Re: Trouble with thumbnail generation using GD

2004-04-21 Thread Justin Patrin
Haddad Said wrote:

Hi, i was trying to create thumbnail using a tutorial on image galleries,
I am having problems creating thumbnail images using GD. The thumbnail is
created with the sizes prorerly, however the image is black.
I have posted a temporary php file i created to investigate the problem
below.
I suspect the problem is with the imagecopyresampled function.

I am using php version 4.3.4 with GD ver 2.0.x in windows XP for the test
machine
I appreciate any help

Thanks
PHP:
?php
$submit = $_POST['submit'];
if(isset($submit))
{
$file = $_FILES['file'];
$filename = any.jpg;
move_uploaded_file($file['tmp_name'], $filename);
$height = get_size($filename, height);
$width = get_size($filename, width);
$source_handle = ImageCreateFromJPEG($filename);
$destination_handle = ImageCreateTrueColor($width, $height);
ImageCopyResampled($destination_handle, $source_handle, 0, 0, 0, 0,
$width, $height, $size[0], $size[1]);
ImageJPEG($source_handle, './tb_' . $filename);
echo Success!!?brbrbrimg src=./tb_any.jpg /?
exit();
}
function get_size($filename, $dimension)
{
global $images_dir;
$size = GetImageSize($filename);
// Wide Image
if($size[0]  $size[1])
{
  $thumbnail_width = 100;
  $thumbnail_height = (int)(100 * $size[1] / $size[0]);
}
// Tall Image
else
{
   $thumbnail_width = (int)(100 * $size[0] / $size[1]);
   $thumbnail_height = 100;
}
if($dimension == width)
{
  return $thumbnail_width;
}
else
{
  return $thumbnail_height;
}
}
?
form action=?=$PHP_SELF? name=frmAdd method=post
enctype=multipart/form-data 
pTitle:brinput type=text size=54 name=article_title //p
pDescription:brtextarea name=article_text rows=10
cols=40/textarea/p
pFile:brinput name=file type=file size=54 //p
pinput type=submit name=submit value=Submit //p/form
Check the color format of your image. If it's in CMYK (I think) then GD 
will choke on it. Make sure it's in RGB color mode.

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


[PHP] Re: objects in a session

2004-04-21 Thread Justin Patrin
Electroteque wrote:

Hi there going back to the discussions of objects in a session. I would like
to know what are the benifits of this, and in what scenarios would it be
used. I have an application I am trying to make scalable if possible, it
uses a sub class to a phplayers menu class which parses an xml file and
generates the menu depending on certain attributes like access for instance.
It will check if the user is an admin or normal user and not show it. Would
this one be useful for adding into a session across pages ? Also i have a
date/calender class which is used across pages, it dynamically generates
list menus of day/month/year , somehow it slows down the page when loading,
would it be useful to go into a session aswell ? I dont want to overdo the
session vars aswell.
Sounds like you should put those in a session, yes. If you put the vars 
in your session, you'll be storing them in the filesystem as serialized 
variables, but it's better than doing lots of querying / XML processing 
/ etc. If you're worries about the filesystem, you could also use a 
RAMDrive for your session storage.

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


[PHP] Memory-Size of Objects

2004-04-21 Thread Thomas Weber
Hi,

does anybody know a way to get the memory-size of an object?

I'm triing to seek some memory-leaks in a php-daemon-program wich cannot be
reproduced easily to track them down, so i thought to monitor the size of
the objects while running in a production-enviroment.

Thanks!
Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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



[PHP] Need help with loading and displaying PDF files

2004-04-21 Thread Gord Busse
Greetings,
 
I have an archive of PDF documents that are stored in a non web accessible
directory. I wrote a small script that will load a PDF document from this
directory, dump it to the browser and display it in the Acrobat Plug-in.
This works ok. Where the problem lies is in the naming of the PDF file. When
viewing the PDF file in the Acrobat Plug-in if I click the plug-in's save to
disk icon the filename the PDF file wants to be saved as it test.pdf. The
name of my PHP script is test.php. How if at all, can I get the PDF filename
to be the actual PDF filename and not test.pdf. If I try manually opening a
PDF document directly into the browser it works fine, but doing it via PHP
and my script doesn't. Below is what I have written so far after searching
the web:
 
?php
 
$document_directory = d:/documents;
$document_filename = the_document.pdf;
$document = $document_directory./.$document_filename;
 
header(Content-Type: application/pdf);
header(Content-Length:  .filesize($document));
header(Content-Disposition: inline; filename=.$document_filename);
readfile($document);
 
?
 
I am running Windows XP Pro and using IE6 as my browser. Although I have
also tried this without success using Mozilla 1.6 on Windows and Safari and
IE5 on OSX. Sorry if a solution to this problem has already been posted
elsewhere. If it has please point me in the right direction.
 
Thanx in advance,
Gord
 

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



Re: [PHP] ADOdb SQL Updates

2004-04-21 Thread Lester Caine
Gabe wrote:

It sort of did.  It may have corrected that error, but now I get a new 
error:

Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access 
Driver] Operation must use an updateable query., SQL state S1000 in 
SQLExecDirect in d:\adodb\drivers\adodb-odbc.inc.php on line 504
S1000: [Microsoft][ODBC Microsoft Access Driver] Operation must use an 
updateable query.

What do you think?
I see you have solved this - I only use Access when I'm moving customers 
problems away from it :)

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] php t1lib windows

2004-04-21 Thread Nikola Novakovic
Hi everybody,
 
I run Appache/PHP (latest or near the latest versions) on Windows 2000.

This was installed by pre-configured package WAMP5 (I'm the beginner), and it works 
fine, except I don't know how to obtain support for T1LIB library that is required for 
some graphics functions.

I read all references I could find, but no one says exactly how to enable this support.

Does anybody have any advice?

Thanks,
Nikola


Re: [PHP] php t1lib windows

2004-04-21 Thread Ray Hunter
On Wed, 2004-04-21 at 14:50, Nikola Novakovic wrote:
 Hi everybody,
  
 I run Appache/PHP (latest or near the latest versions) on Windows 2000.
 
 This was installed by pre-configured package WAMP5 (I'm the beginner), and it works 
 fine, except I don't know how to obtain support for T1LIB library that is required 
 for some graphics functions.
 
 I read all references I could find, but no one says exactly how to enable this 
 support.
 
 Does anybody have any advice?

Download the zip file of php-version and check to see if there are dlls
for that library...if yes...then copy those to your dll folder where
your other php dlls are. Uncomment that dll name in your php.ini file,
restart server and verify that the library is getting loaded.

--
Ray

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



[PHP] WAP Push

2004-04-21 Thread Catalin Trifu
Hi,

Has anyone worked with Simplewire SMS SDK ?
If yes, is it possible to send WAP push messages with it and
if yes how.
If anyone has any info about some PHP + WAP push combination
i would be very grateful.


Thank you,
Catalin

P.S.
I've googled for it

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



[PHP] SOAP function call

2004-04-21 Thread Craig Gardner
I'm trying to create a simple (I think) SOAP function that checks 
whether or not a file was uploaded to a server.  I have everything set 
up, but when I try to use the function I get an array disguised as an 
object.  The function I've created should return either TRUE or FALSE 
and I can't find either result in the array.  What am I doing wrong?

Thanks,

Craig.

Server:

?php
require_once('SOAP/Server.php');
class validate
{
   var $method_namespace = 'urn:validate';
   function check($filename)
   {
   if(file_exists($filename))
   {
   $return = TRUE;
   }
   else
   {
   $fp = fopen($filename, a);
   $contents = fread($filename, filesize($filename));
   if(!strstr($contents, $filename))
   fwrite($fp, $filename./r/n);
   fclose($fp);

   $return = FALSE;
   }
   return $return;
   }
}
$check = new validate;

$server = new SOAP_Server;
$server-addObjectMap($check);
$server-service($HTTP_RAW_POST_DATA);
?

Client:

require_once(SOAP/Client.php);
$soap = new SOAP_Client('http://10.0.1.100/scanned_docs/index.php');
$params = array(filename = $tmpname);
$urn = urn:validate;
$obj = $soap-call('verify', $params, $urn)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: eval() question

2004-04-21 Thread Jason Barnett
Orangehairedboy wrote:

I would like to use eval() to evaluate another PHP file and store the output
of that file in a string.
Personally, I try to avoid using eval().  It can be very useful, but 
there are also potential security issues depending on your setup.  Based 
on what you said in another post, suppose someone can execute an INSERT 
command for your database and replaces the code for colors.php?

So, let's say, for example, that I have a file called colors.php which
contains this:
pColors: ? echo Red, Yellow, Green, Blue; ?/p
You might use return instead.  Something like:
/** colors.php */
?php
$colors = array('Red', 'Yellow', 'Green', 'Blue');
return $colors;
?
/** another file */
?php
$colors = include_once 'colors.php';

?

This works because included files can use return to return values.
http://www.php.net/return
Then, in another file, I have this:

$file = file_get_contents( colors.php );
$colors = eval( $file );
I'm having problems getting $file into $colors. How can I do this?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: SQL like processing on array of keyed arrays ?

2004-04-21 Thread Jason Barnett
Richard A. Devenezia wrote:

Suppose I don't have access to a database server.

I have any indexed array of like keyed arrays, essentially mimicing a
database table.
Are there any libraries or functions that I can use to 'query' the array in
a SQL like manner ?
e.g.
$data = array
(array(a=1,b=2,c=3)
,array(a=2,b=3,c=4)
,array(a=3,b=4,c=5)
);
I think foreach is about the only thing you can do here.  If your issue 
is memory storage then you might consider using SQLite, never used it 
myself but I hear it's quite small and pretty fast.

Well I did think of one other possibility... if you really don't have a 
database option then you might structure your data into an xml file and 
then use XPath (I think PHP 5 only) to do queries like that.  But a 
database would be better suited for this task.

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


Re: [PHP] Problem installing CURL for phpMySearch

2004-04-21 Thread Curt Zirzow
* Thus wrote KidLat Ngayon ([EMAIL PROTECTED]):
 Subject:  Problem installing CURL for phpMySearch
 To: [EMAIL PROTECTED]
 
 Greetings!!!
 
 I hope that there would be someone could help me in
 installing CURL Version 7.11.0 for PHP Version 4.3.2.
 
 I've already configure the CURL in PHP using on this
 way:
 
 ./configure --with-mysql=/usr/local/mysql \
 --with-nsapi=/usr/iplanet/iWS \
 --with-curl=/usr/local \
 --with-curlwrappers \
 --enable-libgcc
 
 After I have configured , make, and make install the
 php, I dont get any error from them, instead a
 complete configuration or build on it.

It appears that make install isn't putting the libphp4.so in the
proper place (where ever naspi loads modules from). Or you you
didn't restart the webserver.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] Problems with patters

2004-04-21 Thread Phpu
Hi,

i have a script that searches a database after a specific word.

this function check the entered word
 
function valid_word($word) {

  if(ereg(^[a-zA-Z0-9_]{3,15}$, $word)) {

   return true;

  } else {

   return false;

  }

 }

If i search for a word is ok but when i searches for a phrase it returns no result.

What do i have to modify the function?

Thank you for your reply


[PHP] Problems with patterns

2004-04-21 Thread Phpu
Hi,

i have a script that searches a database after a specific word.

this function check the entered word
 
function valid_word($word) {

  if(ereg(^[a-zA-Z0-9_]{3,15}$, $word)) {

   return true;

  } else {

   return false;

  }

 }

If i search for a word is ok but when i searches for a phrase it returns no result.

What do i have to modify the function?

Thank you for your reply



Re: [PHP] Problems with patterns

2004-04-21 Thread Matt Matijevich
you need to account fir white space if you want phrases

\s+


I would switch to preg_match() instead of ereg()

http://www.php.net/manual/en/function.preg-match.php

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



[PHP] Re: Problems with patterns

2004-04-21 Thread Jason Barnett
What kinds of phrases are you looking for?  If you want to know whether 
an *exact* phrase is going to appear in a block of text, just use 
strstr() or strpos(), they tend to be faster than regexes anyway.

http://www.php.net/strpos

function valid_phrase ($phrase, $search = 'text to search for') {
return strpos($phrase, $search);
}
If you really want to use ereg though, you'll need to search for 
whitespace characters (or maybe just spaces, depending on your need). 
But I think strpos() will be fine for what you want to do.

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


[PHP] objects in sessions again

2004-04-21 Thread daniel
Hi there, needing some more advise, is this function correct ?

function create_object($class_name,$dir = null, $serialize = null)
{
$dir ? $dir = $dir./ : $dir = ;
require_once(.CLASS_PATH.$dir.$class_name..php);
if ($serialize) {
if (!isset($_SESSION[''.$class_name.''])) {
$class = new $class_name;
$_SESSION[''.$class_name.''] = serialize
($class);
}
return unserialize($_SESSION
[''.$class_name.'']);
} else {
return new $class_name;
}
}

i needed to serialize and unserialize or else all hell broke loose.

Let me know Thanks.

Dan

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



[PHP] includes and classes

2004-04-21 Thread dubreuilmedia
Hi

I was wondering about includes and classes. I have a class in which
depending on a member variable, i should load
the proper include, which is really the proper config file for that moment.
Now if i do this in the constructor
i can't seem to be able to use the variables found in my config in the other
member functions.

Any way to set a include 'congig.php' as global for the whole class once
instead of calling include 'congig.php' it in every function?

Thanks for the help,

Olivier Dubreuil
Président
dubreuilmedia
www.dubreuilmedia.com
514 457 6211

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



[PHP] Re: objects in sessions again

2004-04-21 Thread Jason Barnett
[EMAIL PROTECTED] wrote:
Hi there, needing some more advise, is this function correct ?

function create_object($class_name,$dir = null, $serialize = null)
{
$dir ? $dir = $dir./ : $dir = ;
require_once(.CLASS_PATH.$dir.$class_name..php);
if ($serialize) {
if (!isset($_SESSION[''.$class_name.''])) {
$class = new $class_name;
$_SESSION[''.$class_name.''] = serialize
($class);
}
return unserialize($_SESSION
[''.$class_name.'']);
} else {
return new $class_name;
}
}
i needed to serialize and unserialize or else all hell broke loose.

Let me know Thanks.

Dan
If your goal is to store certain objects in sessions and some not, then 
this should be fine.  Just be sure that you intend to have only one 
instance of the objects you want to serialize, or hell can still break 
loose :)

Jason

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


Re: [PHP] Re: objects in sessions again

2004-04-21 Thread daniel


 If your goal is to store certain objects in sessions and some not, then
  this should be fine.  Just be sure that you intend to have only one
 instance of the objects you want to serialize, or hell can still break
 loose :)


Yes thats fine, there is a DB and auth and template class i instance
globally, these are across pages aswell should i do the same ?? I dont wont
to go overboard and slow the system down, I'd really want to make it
scalable. These dont store any data as such though like the rest. The
others i instance when i need them.

Thanks !

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



[PHP] Re: includes and classes

2004-04-21 Thread Jason Barnett
Dubreuilmedia wrote:

Hi

I was wondering about includes and classes. I have a class in which
depending on a member variable, i should load
the proper include, which is really the proper config file for that moment.
How does a member variable control this?  E.g. you set the member 
variable in the constructor and then include some config file?

Now if i do this in the constructor
i can't seem to be able to use the variables found in my config in the other
member functions.
Yeah, this can be a little confusing.  When you include a file in a 
function, it only gains the scope of that function.  I.e. variables in 
the included file are only available to that function.  What you can do, 
however, is to assign the config variables to an array in the object.

?php

class someClass
{
function someClass($param) {
// Include the config file
if (21 == $param) {
include_once 'config21.php';
}
// Bring the config variables into this object
foreach ($config as $varname = $value) {
$this-config['varname'] = $value;
}
}
}
?

Obviously the above method is a little messy.  A better way to handle 
this would be object overloading with __set() and __get(), which is 
available in PHP4 with a few commands and PHP5 uses it by default.

http://www.php.net/overload

(I wouldn't be too afraid of the experimental warning, overloading in 
PHP5 is pretty much the same as in PHP4, and looks like it's here to stay).

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


Re: [PHP] Re: objects in sessions again

2004-04-21 Thread Jason Barnett
Yes thats fine, there is a DB and auth and template class i instance
globally, these are across pages aswell should i do the same ?? I dont wont
to go overboard and slow the system down, I'd really want to make it
scalable. These dont store any data as such though like the rest. The
others i instance when i need them.
Thanks !
If you don't store data in a class, then there is absolutely no reason 
to serialize it in a session.  Serialization will *only* store property 
values, not methods (objects become glorified arrays).  But maybe in the 
future this will change?  A boy can dream :)

Come to think of it, in PHP5 you probably *could* serialize methods in 
the object.  But to do it you'd need to store Reflection_Method objects 
as properties, which just introduces a lot of other messy problems.

So, um, long answer to your question: don't bother serializing those 
other global objects, since they don't store data.

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


Re: [PHP] Problems with patterns

2004-04-21 Thread Phpu
where in the ereg(^[a-zA-Z0-9_]{3,15}$, $cuvant) i should place \s+ ?

- Original Message - 
From: Matt Matijevich [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, April 22, 2004 3:34 AM
Subject: Re: [PHP] Problems with patterns


 you need to account fir white space if you want phrases
 
 \s+
 
 
 I would switch to preg_match() instead of ereg()
 
 http://www.php.net/manual/en/function.preg-match.php
 

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



[PHP] umask wierdness

2004-04-21 Thread Bret Hughes
I have found a funky situation that I am trying to figure out if it is 
bug or not:

I see this behavior on both redhat 9 and fedora running 

php 4.3.4
httpd(apache) 2.0.48

calling umask(0002) in a script leaves the httpd process with a umask of
2 after exit so that the next process to hit that process gets the new
umask. in other words the environment does not revert to default as the
umask() docs say it should.  This does not happen on my 7.3 box running 
apache-1.3.27-2
php-4.1.2-7.3.6

I found this chasing a rabbit trail of a bug.  This is kind of sneaky
since it only changes the umask for the single httpd process it hits. 
multiple calls to umask(0002) will change every process it hits.

I distilled this down to this test:
BTW this is also file at buzilla.redhat.com as bug number 121454:

http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=121454

1.install umask.php in a directory accessible by the web server 

### umask.php

?php
if ( isset( $_GET['newmask']) ) {
print newmask is set to $_GET[newmask] calling umask()br\n;
print umask($_GET['newmask']) .br\n;
}
else {
print umask is . umask() . br\n;
}
?
# end of umask.php

2. copy chkmask.sh somwhere on the server


## chkumask.sh  

#!/bin/sh

if [ -n $1 ] ; then
echo setting hostname to input host $1
myhost=$1
else
myhost=$HOSTNAME
fi
echo using $myhost as wget host

while [ 1 ]; do

echo -n `date +'%D'`  host: $myhost  

wget -q -O - http://$myhost/umask.php;
sleep 1
done

 end of of chkumask.sh   

3. run chkumask.sh [hostnameofserver]
this will start looping and making calls to the umask.php script on
the server  defaults to value of $HOSTNAME

4. with a broser or whatever go to
http://servername/locationofumask.php?newmask=0002

5 observe output of chkumask.sh depending on the number of threads
started by httpd the umask changes from 18(octal 22, the default) to 2
for that thread.

refresh the browser several times to have more threads get changed.

Actual Results:  output of chkumask.sh:

using 10.23.0.137 as wget host
04/21/04  host: 10.23.0.137  umask is 2br
04/21/04  host: 10.23.0.137  umask is 18br
04/21/04  host: 10.23.0.137  umask is 2br
04/21/04  host: 10.23.0.137  umask is 2br
04/21/04  host: 10.23.0.137  umask is 18br
04/21/04  host: 10.23.0.137  umask is 18br
04/21/04  host: 10.23.0.137  umask is 18br
04/21/04  host: 10.23.0.137  umask is 2br
04/21/04  host: 10.23.0.137  umask is 2br
04/21/04  host: 10.23.0.137  umask is 18br
04/21/04  host: 10.23.0.137  umask is 2br

any tips appreciated as well as report wither the behavior is seen or
not on various versions.  I am trying to isolate when this behavior
started or what I have done wrong.


Bret



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



[PHP] SQL Hell

2004-04-21 Thread Marc Greenstock
Hi all,

Wondering if someone could help me with an sql statement

MySQL version 4.0.18

I have three tables:
1. visitor_data (Visitor_ID, IP Address)
2. visit_data (Visit_ID, Visitor_ID)
3. page_data (Page_ID, Visit_ID, Visitor_ID, URI)

If you look closely you can see the relationship in these tables and you
might guess I'm tracking what a user is doing on this site.

visitor_data obviously records only unique visitors, I'm collecting a few
other things as well as what I've written, such as employing a cookie,
tracking their current local time, etc to build an effective method of
knowing who is coming back.

visit_data records each visit to the site and references from the
visitor_data.Visitor_ID. This is only done once a session.

page_data records every move the user makes.

I need to pull data out of these tables to make a graphical table
displaying: Visitor ID, Entry Page, Exit Page and Session Duration. There
will be one row per visit.

So far I've made multiple statements pulling out all the data and using PHP
to formulate the information. But I know there is a better way using mysql.
Only thing is I haven't got the faintest idea how to do it in one query and
keep overheads low. I start to get lost when I'm doing select statements
within select statements.

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



[PHP] Re: SQL Hell

2004-04-21 Thread Jason Barnett
So far I've made multiple statements pulling out all the data and using PHP
to formulate the information. But I know there is a better way using mysql.
Only thing is I haven't got the faintest idea how to do it in one query and
keep overheads low. I start to get lost when I'm doing select statements
within select statements.
I'm no DB guru, but as I understand it what you want to do requires the 
use of foreign keys.  InnoDB tables implement them, but I don't think 
they currently grab the related information when you do SELECT 
statements.  It sounds like you are emulating that right now with your 
SQL statements, and I don't think that any of the 4.x versions of MySQL 
will fully support foreign keys.  I did find something interesting, 
though: apparently MySQL is going to support *stored_procedures* and 
*foreign_keys* in the 5.0-5.1 branch.  I may have to go play with some 
of the 5.0 alpha stuff soon...

http://dev.mysql.com/doc/mysql/en/TODO.html

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


Re: [PHP] umask wierdness

2004-04-21 Thread Curt Zirzow
* Thus wrote Bret Hughes ([EMAIL PROTECTED]):
 I have found a funky situation that I am trying to figure out if it is 
 bug or not:
 
 I see this behavior on both redhat 9 and fedora running 
 
 php 4.3.4
 httpd(apache) 2.0.48
 
 calling umask(0002) in a script leaves the httpd process with a umask of
 2 after exit so that the next process to hit that process gets the new
 umask. in other words the environment does not revert to default as the
 umask() docs say it should.  This does not happen on my 7.3 box running 
 apache-1.3.27-2
 php-4.1.2-7.3.6
 
 I found this chasing a rabbit trail of a bug.  This is kind of sneaky
 since it only changes the umask for the single httpd process it hits. 
 multiple calls to umask(0002) will change every process it hits.

This set up works perfectly fine for me, umask is reset to original
value after php dies so all my checkumask.sh output results with
18.

System: FreeBSD, apache 1.3.29, php5.

Looking at the php source code, it looks like all its doing is
calling the system's umask(), which leads me to belive its an issue
with either the OS or apache.

You might want to ask [EMAIL PROTECTED] about this they might be
able to help you a little more about this.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] SQL Hell

2004-04-21 Thread Curt Zirzow
* Thus wrote Marc Greenstock ([EMAIL PROTECTED]):
 Hi all,
 
 Wondering if someone could help me with an sql statement
 
 MySQL version 4.0.18
 
 I have three tables:
 1. visitor_data (Visitor_ID, IP Address)
 2. visit_data (Visit_ID, Visitor_ID)
 3. page_data (Page_ID, Visit_ID, Visitor_ID, URI)
 
 If you look closely you can see the relationship in these tables and you
 might guess I'm tracking what a user is doing on this site.

This really should be asked on a mysql list.

select pg.Page_ID, pg.Visit_ID, pg.Vistor_ID, pg.URI
  from vistor_data vrd, visit_data vd, page_data pg
where vrd.Visitor_ID = vd.Visitor_ID
  and vd.Visit_ID = pg.Visit_ID

As loong as 
  vrd.Vistor_ID, vd.Visit_ID are unique
and
  pg.Visit_ID is indexed

You'll performance wont be an issue.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] Re: SQL Hell

2004-04-21 Thread Lester Caine
Jason Barnett wrote:

So far I've made multiple statements pulling out all the data and 
using PHP
to formulate the information. But I know there is a better way using 
mysql.
Only thing is I haven't got the faintest idea how to do it in one 
query and
keep overheads low. I start to get lost when I'm doing select statements
within select statements.
I'm no DB guru, but as I understand it what you want to do requires the 
use of foreign keys.  InnoDB tables implement them, but I don't think 
they currently grab the related information when you do SELECT 
statements.  It sounds like you are emulating that right now with your 
SQL statements, and I don't think that any of the 4.x versions of MySQL 
will fully support foreign keys.  I did find something interesting, 
though: apparently MySQL is going to support *stored_procedures* and 
*foreign_keys* in the 5.0-5.1 branch.  I may have to go play with some 
of the 5.0 alpha stuff soon...
Alternatively, use a better database :)
Firebird has had Triggers and Stored Procedures from the start. Using 
these with PHP gives the power needed to update cross references without 
having to build complex PHP code.
http://www.firebirdsql.org/

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] phpedit

2004-04-21 Thread Andy B
i know this isnt quite php exactly but anybody thats ever installed phpedit
before remember how long it took to install on windows?? seems like mine is
taking about 6 hours to install for some strange reason...

its either massive huge or my computer is super slow for some reason...

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