Re: [PHP] Search engine

2005-01-20 Thread Jordi Canals
On Thu, 20 Jan 2005 14:04:44 +0200, Rosen [EMAIL PROTECTED] wrote:
 
 Hi,
 Can someone recommend me a search engine script in PHP for inside one site?
 
http://www.phpdig.net/

Regards,
Jordi

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



[PHP] Re: Best way to encode?

2005-01-20 Thread Sephiroth
in HTML with HTTP_GET, you can use:
xxx.href = my.php?data=+encodeURI(escape(...foreign strings...));

my.php:

$data = uniDecode($_GET[data]);
echo $data;



function uniDecode($sText) {
  $sData = preg_replace_callback(/%u[0-9A-Za-z]{4}/,toUtf8, $sText);
  return unescape($sData);
}

function toUtf8($ar) {
  $c = ;
  foreach($ar as $val) {
$val = intval(substr($val,2),16);
if($val  0x7F){// -007F
  $c .= chr($val);
}
elseif ($val  0x800) { // 0080-0800
  $c .= chr(0xC0 | ($val / 64));
  $c .= chr(0x80 | ($val % 64));
}
else {  // 0800-
  $c .= chr(0xE0 | (($val / 64) / 64));
  $c .= chr(0x80 | (($val / 64) % 64));
  $c .= chr(0x80 | ($val % 64));
}
  }
  return $c;
}

function unescape($sText) {
  $sTranArray = array(%09 = \t,
  %0A = \n,
  %0B = \x0b,
  %0D = \r,
  %20 =  ,
  %21 = !,
  %22 = \,
  %23 = #,
  %24 = $,
  %25 = %,
  %26 = ,
  %27 = ',
  %28 = (,
  %29 = ),
  %2C = ,,
  %3A = :,
  %3B = ;,
  %3C = ,
  %3D = =,
  %3E = ,
  %3F = ?,
  %5C = \\,
  %5B = [,
  %5D = ],
  %5E = ^,
  %60 = `,
  %7C = |,
  %7B = {,
  %7D = },
  %7E = ~);
  return strtr($sText, $sTranArray);
}

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



Re: [PHP] For HomeSite users...

2005-01-20 Thread daniel

 .org don't work but www.phpeclipse.de does.


Sorry yeh , anyway it took me a while to change, but with all the added
plugins i now have a cooolIDE which does cvs, debugging, xml, html, xsl 
testing, db schema, db
modeller, uml, java, tomcat,team syncing, the list goes on. One thing i cant 
manage to do yet is
generate phpdocs aswell asimport project to cvs , still have to do that via 
command line :|

May get my hands dirty and build a phpdoc java plugin :)

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



[PHP] Extending a Class

2005-01-20 Thread Phillip S. Baker
Greetings all,

I have a class I use for MySQL connection and functions.

I also have a class that I use to create Paged Results.

The paged results class connects to a DB and uses allot of sql calls to make
this happen. I am noticing that it does allot that the MySQL class does.

What I would like to do is to Have the paged results extend the MySQL class
so it can use the functions within that class so I can keep them updated in
just one place. How would I go about doing that?? Is it as simple as
something like this (this is shortened for convience)??

class Mysql {
 var $results;
 var $dbcnx;

 function Mysql($query, $cnx) { // Constructor function
   $this-dbcnx = $cnx;
   if (!$this-results = @mysql_query($query))
$this-_error(There was an error with executing your query. Try again
later., $query);
 }
}

class PageResultSet extends MySQL {
 var $results;

 function PageResultSet ($query,$pageSize,$resultpage,$cnx) {

  $this-results = @mysql_query($query,$cnx) or $this-_error('Error Running
your search. Try back later.', $query);
  $this-pageSize = $pageSize;
  if ((int)$resultpage = 0) $resultpage = 1;
  if ($resultpage  $this-getNumPages())
  $resultpage = $this-getNumPages();
  $this-setPageNum($resultpage);
 }
}

I would like to be able to pass the results from the MySQL class to the
PageResultSet class without have to do the query over and such.
How would I go about coding that? I am not clear on that.

Also can I extend a function in PageResultSet that is started in MySQL??
In MySQL I have
 function fetchAssoc() {
  if (!$this-results) return FALSE;
  $this-row++;
  return mysql_fetch_assoc($this-results);
 }

In PageResultSet I have
 function fetchAssoc() {
  if (!$this-results) return FALSE;
  if ($this-row = $this-pageSize) return FALSE;
  $this-row++;
  return mysql_fetch_assoc($this-results);
 }

Can I just write something like within PageResultSet
function fetchAssocPRS extends fetchAssoc () {
  if ($this-row = $this-pageSize) return FALSE;
}

Thanks for the help.

--
Blessed Be

Phillip

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



[PHP] Allow users to upload images to directory

2005-01-20 Thread Tim Burgan
Hello,
How can I allow users of my website to upload JPEG's to a set directory, 
and then have the JPEG scaled-down if they upload some huge image (both 
in pixel size and resolution)?

Is there anything around that clearly (and simply) explains this?
Thanks
Tim
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Allow users to upload images to directory

2005-01-20 Thread Greg Donald
On Fri, 21 Jan 2005 13:12:54 +1030, Tim Burgan [EMAIL PROTECTED] wrote:
 Hello,
 
 How can I allow users of my website to upload JPEG's to a set directory,
 and then have the JPEG scaled-down if they upload some huge image (both
 in pixel size and resolution)?
 
 Is there anything around that clearly (and simply) explains this?

php.net/imagecopyresized

There's an example right there on the manual page.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] too slow to unset big array (after mem fragment)

2005-01-20 Thread Xuefer Tinys
On Wed, 19 Jan 2005 16:28:21 -0700, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 
 A question from another naive reader.
 
 Have you tried re-setting the array to an empty one, using array(),
 instead of using unset()?
indeed!, unset($arr); $arr = array();
or $arr = array(); directly
it's same :(
 
 Kirk
 




On Wed, 19 Jan 2005 14:44:10 -0800 (PST), Richard Lynch [EMAIL PROTECTED] 
wrote:
 
 Just some ideas from a naive reader:
 
 1. unset() more often
i'm tracking ip of visiters to avoid double trigger of the counter.
if i shorten time to 5mins, therere so many ppl revisit after 5mins,
which give counter more points
 2. unset() only a portion of the elements of the array
i guess so, but ..
 
 You may even want to store a TIME element, and only unset() the old
 items or something.
i did, but it double the size, and scan of expired elements is slower
 
 You may also want to, perhaps, put the unset() of older data inside your
 socket listening/reading loop, so that you are unset-ing the really old
 stuff as you read the new stuff, to always keep your array small in
 size.
 
 --
 Like Music?
 http://l-i-e.com/artists.htm
 
 
and i'm not unseting the new items
here's the logic After the slow TIME element scanning scheme:
data flow:
incomming-currentTracker-oldTracker
for  {
$key = ...
$track = $currentTracker[$countername][$key][$id];
if isset($currentTracker[$countername][$key][$id]):
 $tarck ++;
 continue; // skip trigger
elif isset($oldTracker[$countername][$key][$id]):
 $track = $oldTracker[$countername][$key][$id] + 1;
 continue; // skip trigger
$counts[$key] ++; // trigger, will save later
} // end for
unset($track);
expiring:
foreach 1hour:
1. unset($oldTracker); // slow
2. $oldTracker = $currentTracker; // fast, this is COW(no copy)
3. $currentTracker = array(); // fast (no efree)
if u think 2/3 is slow, i can do:
2. $oldTracker = $currentTracker; // fast, php-reference
3. unset($currentTracker); // php-unreference
3. $currentTracker = array(); // fast
if i have to unset portion of the $oldTracker. i have to scan? or any other way?

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



[PHP] Re: Search engine

2005-01-20 Thread Raj Shekhar
Rosen [EMAIL PROTECTED] writes:

 Hi,
 Can someone recommend me a search engine script in PHP for inside one site?

If you need to index through static pages phpdig can be useful for you
http://www.phpdig.net/

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



[PHP] Re: Hidden Images.

2005-01-20 Thread Paul Birnstihl
If you have a 2bit GIF with only white and transparent and you place it 
on a white page (background), you can hide it until it's highlit. Not 
very pretty but it works.

Rob Adams wrote:
I've been figuring out how to create hidden images.  The concept is: when 
you highlight an image in Internet Explorer (and Mozilla too, though the 
grid is reversed) it puts a grid over the image.  If you put another image 
in between what the grid covers, you can kind of hide the image that then is 
exposed when highlighted in Internet Explorer.  You can check out a kinda of 
crappy first experiment at:

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


[PHP] mkdir security concern

2005-01-20 Thread kids_pro
Hi there,

I want to create a script.
When user register I want to create a folder : 
users\new_user_folder\images
The purpose is that I want to allow them to upload image to this image 
folders.

What sort of permission should I give to each folder
Root: users, new_user_folders, and images folder.

Regards,
kids

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



[PHP] file upload

2005-01-20 Thread akshay
Hi all,
I hv problem while file upload.
I hv one server and multiple client.
I want to upload a file from Server to client.
how this is possible in PHP
with regds,
akshay
--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mkdir security concern

2005-01-20 Thread Marek Kilimajer
kids_pro wrote:
Hi there,
I want to create a script.
When user register I want to create a folder : 
users\new_user_folder\images
The purpose is that I want to allow them to upload image to this image 
folders.

What sort of permission should I give to each folder
Root: users, new_user_folders, and images folder.
The least necessary. That depends on your server setup, primarily the 
user id your scripts are run under (mod_php/cgi or suexec). You might 
want to use ftp functions to create the directories if they would be 
created with apache as the owner otherwise.

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


Re: [PHP] Problem with hidden form input values

2005-01-20 Thread Ben Edwards
On Wed, 19 Jan 2005 15:22:55 -0800 (PST), Richard Lynch [EMAIL PROTECTED] 
wrote:
 Ben Edwards (lists) wrote:
  I know this is not strictly speaking a PHP question but it is to do with
  a PHP app.
 
  I have a form with a number of hidden values in it.  After the post
  print_r( $_POST ) shows all the values except these (this is copied from
  'Show Source' in the browser.
 
  input type=hidden name=keyField[mb_memberships][0] value=mb_e_id
  input type=hidden name=keyValue[mb_memberships][0] value=10
  input type=hidden name=keyField[mb_memberships][1] value=mb_id
  input type=hidden name=keyValue[mb_memberships][1] value=1
 
  Any idea why they wont post?
 
 The *do* POST, but PHP only handles one level of array references in NAME=xxx
 
 You can do something like:
 ?php
  while (list($keys, $value) = each($_POST['keyField'])){
$keys = explode('][', $keys);
list($key1, $key2) = $keys;
$realKeyField[$key1][$key2] = $value;
  }
 ?

Almost follow this but not quite.  Is this the code used to create the
hidden HTML input tag or the one to unpack the variable after the
post.  What is really spooky is the keys are actually held in a
variable in an object called keys - your telepathic abilities are very
impressive;).  My first thought was when you said PHP only handles one
level in post was to serialize the array, put the serialized version
in as a single hidden HTML tag and unserialize at the other end.  do
you reckon this is a goer?

 --
 Like Music?
 http://l-i-e.com/artists.htm
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



Re: [PHP] Problem with hidden form input values

2005-01-20 Thread Ben Edwards
On Thu, 20 Jan 2005 07:33:01 +0800, Jason Wong [EMAIL PROTECTED] wrote:
 On Thursday 20 January 2005 07:07, Ben Edwards (lists) wrote:
  I know this is not strictly speaking a PHP question but it is to do with
  a PHP app.
 
  I have a form with a number of hidden values in it.  After the post
  print_r( $_POST ) shows all the values except these (this is copied from
  'Show Source' in the browser.
 
  input type=hidden name=keyField[mb_memberships][0] value=mb_e_id
  input type=hidden name=keyValue[mb_memberships][0] value=10
  input type=hidden name=keyField[mb_memberships][1] value=mb_id
  input type=hidden name=keyValue[mb_memberships][1] value=1
 
  Any idea why they wont post?
 
 It *should* work. Maybe you're using a crappy browser (or a strictly standards
 only browser) in which case you ought to (and you should do this anyway) be
 using proper HTML ie:
 
 input type=hidden name=keyField[mb_memberships][0] value=mb_e_id

Ime using Firefox (0.9 I think) but thanks for the tip.  Am I correct
in thinking quoting is needed to make the HTML  XHTML complient?

Ben 
 --
 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
 --
 New Year Resolution: Ignore top posted posts
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



Re: [PHP] file upload

2005-01-20 Thread Marek Kilimajer
akshay wrote:
Hi all,
I hv problem while file upload.
I hv one server and multiple client.
I want to upload a file from Server to client.
how this is possible in PHP
This is usualy called download. Is this what you want?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Search engine

2005-01-20 Thread Rosen

Hi,
Can someone recommend me a search engine script in PHP for inside one site?

Thanks in advance!
Rosen

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



Re: [PHP] Search engine

2005-01-20 Thread Ben Edwards
This kind of depends on what database you are using (I am asuming you
mean you have a data driven site you want to search so strictly
speaking it is the database that you want to search).

Mysl has free text search facilities (i.e. you can pass it a number of
words and it can search for them in a set of database fields and even
kreates a 'ranking').  however this only works if you have a few
hundread records - less than this and the results are unpredictable.

Have you tries googeling for php search scripts?

Ben

On Thu, 20 Jan 2005 14:04:44 +0200, Rosen [EMAIL PROTECTED] wrote:
 
 Hi,
 Can someone recommend me a search engine script in PHP for inside one site?
 
 Thanks in advance!
 Rosen
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



Re: [PHP] file upload

2005-01-20 Thread anirudh dutt
On Thu, 20 Jan 2005 12:26:07 +0100, Marek Kilimajer [EMAIL PROTECTED] wrote:
 akshay wrote:
  Hi all,
  I hv problem while file upload.
  I hv one server and multiple client.
  I want to upload a file from Server to client.
  how this is possible in PHP
 
 This is usualy called download. Is this what you want?

yeah. if that's what u're trying, check out the manual page on
fsockopen: http://php.net/function.fsockopen

the first example will give u an idea of what to do.

[code]
?php
$fp = fsockopen(www.example.com, 80, $errno, $errstr, 30);
if (!$fp) {
   echo $errstr ($errno)br /\n;
} else {
   $out = GET / HTTP/1.1\r\n;
   $out .= Host: www.example.com\r\n;
   $out .= Connection: Close\r\n\r\n;

   fwrite($fp, $out);
   while (!feof($fp)) {
   echo fgets($fp, 128);
   }
   fclose($fp);
}
? 
[/code]

the 02-Dec-2004 01:50 comment is also useful.

anirudh

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



Re: [PHP] Search engine

2005-01-20 Thread Rosen
I try many scripts for searching, but they don't work how I want.
The problem is, that part of site is static text ( not in database ) , other
part ( products ) are in MySQL database - this part is generating from PHP
scripts.



Ben Edwards [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 This kind of depends on what database you are using (I am asuming you
 mean you have a data driven site you want to search so strictly
 speaking it is the database that you want to search).

 Mysl has free text search facilities (i.e. you can pass it a number of
 words and it can search for them in a set of database fields and even
 kreates a 'ranking').  however this only works if you have a few
 hundread records - less than this and the results are unpredictable.

 Have you tries googeling for php search scripts?

 Ben

 On Thu, 20 Jan 2005 14:04:44 +0200, Rosen [EMAIL PROTECTED] wrote:
 
  Hi,
  Can someone recommend me a search engine script in PHP for inside one
site?
 
  Thanks in advance!
  Rosen
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 -- 
 Ben Edwards - Poole, UK, England
 WARNING:This email contained partisan views - dont ever accuse me of
 using the veneer of objectivity
 If you have a problem emailing me use
 http://www.gurtlush.org.uk/profiles.php?uid=4
 (email address this email is sent from may be defunct)

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



Re: [PHP] file upload

2005-01-20 Thread M. Sokolewicz
Anirudh Dutt wrote:
On Thu, 20 Jan 2005 12:26:07 +0100, Marek Kilimajer [EMAIL PROTECTED] wrote:
akshay wrote:
Hi all,
I hv problem while file upload.
I hv one server and multiple client.
I want to upload a file from Server to client.
how this is possible in PHP
This is usualy called download. Is this what you want?

yeah. if that's what u're trying, check out the manual page on
fsockopen: http://php.net/function.fsockopen
the first example will give u an idea of what to do.
[code]
?php
$fp = fsockopen(www.example.com, 80, $errno, $errstr, 30);
if (!$fp) {
   echo $errstr ($errno)br /\n;
} else {
   $out = GET / HTTP/1.1\r\n;
   $out .= Host: www.example.com\r\n;
   $out .= Connection: Close\r\n\r\n;
   fwrite($fp, $out);
   while (!feof($fp)) {
   echo fgets($fp, 128);
   }
   fclose($fp);
}
? 
[/code]

the 02-Dec-2004 01:50 comment is also useful.
anirudh
what you're doing is server = server
What the akshay wants is server = client
The only not yet posted other options are client = client (which is 
essentially impossible with PHP, unless you use the server=server 
setup) and client = server (which is called uploading)

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


Re: [PHP] Search engine

2005-01-20 Thread Ben Edwards
Looks like you will have to write your own.  Have a look at the
scripts you have and see how they do it.  One option is to write the
'static' pages into the database as well as the file system.  I
personaly put all content into a database and do not really have any
static pages atall.

Ben

On Thu, 20 Jan 2005 14:18:49 +0200, Rosen [EMAIL PROTECTED] wrote:
 I try many scripts for searching, but they don't work how I want.
 The problem is, that part of site is static text ( not in database ) , other
 part ( products ) are in MySQL database - this part is generating from PHP
 scripts.
 
 Ben Edwards [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  This kind of depends on what database you are using (I am asuming you
  mean you have a data driven site you want to search so strictly
  speaking it is the database that you want to search).
 
  Mysl has free text search facilities (i.e. you can pass it a number of
  words and it can search for them in a set of database fields and even
  kreates a 'ranking').  however this only works if you have a few
  hundread records - less than this and the results are unpredictable.
 
  Have you tries googeling for php search scripts?
 
  Ben
 
  On Thu, 20 Jan 2005 14:04:44 +0200, Rosen [EMAIL PROTECTED] wrote:
  
   Hi,
   Can someone recommend me a search engine script in PHP for inside one
 site?
  
   Thanks in advance!
   Rosen
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 
  --
  Ben Edwards - Poole, UK, England
  WARNING:This email contained partisan views - dont ever accuse me of
  using the veneer of objectivity
  If you have a problem emailing me use
  http://www.gurtlush.org.uk/profiles.php?uid=4
  (email address this email is sent from may be defunct)
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



[PHP] php 5 interfaces

2005-01-20 Thread Sergio Gorelyshev
Hi all.

Situation:

interface MyInterface {
 public static myMethod();
}

class MyClass implements MyInterface {
  public static myMethod() {}
}

This sample will crash with message 
Fatal error: Access type for interface method MyInterface::myMethod() must be 
omitted in somefile.php on line NN

Why I'm not able to clarify call's type (static) for methods in interface? I'm 
predict closely that method myMethod() in all classes which implements  
MyInterface must be called statically. A little trick allowed to me to resolve 
this problem, but my question  more ideological than practical.

Thanks
-- 
RE5PECT
Sergio Gorelyshev

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



Re: [PHP] Search engine

2005-01-20 Thread Rosen
But here the problem is, that the texts in database uses from different
scripts and on the search engine I should show and link to the sctipt, thath
shows searched data.
My idea was for search script, who explore the whole site (as generated from
PHP scripts - via links ).



Ben Edwards [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Looks like you will have to write your own.  Have a look at the
 scripts you have and see how they do it.  One option is to write the
 'static' pages into the database as well as the file system.  I
 personaly put all content into a database and do not really have any
 static pages atall.

 Ben

 On Thu, 20 Jan 2005 14:18:49 +0200, Rosen [EMAIL PROTECTED] wrote:
  I try many scripts for searching, but they don't work how I want.
  The problem is, that part of site is static text ( not in database ) ,
other
  part ( products ) are in MySQL database - this part is generating from
PHP
  scripts.
 
  Ben Edwards [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
   This kind of depends on what database you are using (I am asuming you
   mean you have a data driven site you want to search so strictly
   speaking it is the database that you want to search).
  
   Mysl has free text search facilities (i.e. you can pass it a number of
   words and it can search for them in a set of database fields and even
   kreates a 'ranking').  however this only works if you have a few
   hundread records - less than this and the results are unpredictable.
  
   Have you tries googeling for php search scripts?
  
   Ben
  
   On Thu, 20 Jan 2005 14:04:44 +0200, Rosen [EMAIL PROTECTED]
wrote:
   
Hi,
Can someone recommend me a search engine script in PHP for inside
one
  site?
   
Thanks in advance!
Rosen
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
   
  
  
   --
   Ben Edwards - Poole, UK, England
   WARNING:This email contained partisan views - dont ever accuse me of
   using the veneer of objectivity
   If you have a problem emailing me use
   http://www.gurtlush.org.uk/profiles.php?uid=4
   (email address this email is sent from may be defunct)
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 -- 
 Ben Edwards - Poole, UK, England
 WARNING:This email contained partisan views - dont ever accuse me of
 using the veneer of objectivity
 If you have a problem emailing me use
 http://www.gurtlush.org.uk/profiles.php?uid=4
 (email address this email is sent from may be defunct)

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



Re: [PHP] Search engine

2005-01-20 Thread Robert Sossomon
Why not use PHP to create static pages from your dynamic info (say 5 minutes 
after the data is update?) and allow for the system to search the site then?  I 
have noticed that I don't even have to do that for the search spiders from 
Google and yahoo to trawl my site and get everything, so maybe looking for code 
to curl through would be good?

Robert
Rosen is quoted as saying on 1/20/2005 7:48 AM:
But here the problem is, that the texts in database uses from different
scripts and on the search engine I should show and link to the sctipt, thath
shows searched data.
My idea was for search script, who explore the whole site (as generated from
PHP scripts - via links ).

Ben Edwards [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Looks like you will have to write your own.  Have a look at the
scripts you have and see how they do it.  One option is to write the
'static' pages into the database as well as the file system.  I
personaly put all content into a database and do not really have any
static pages atall.
Ben
On Thu, 20 Jan 2005 14:18:49 +0200, Rosen [EMAIL PROTECTED] wrote:
I try many scripts for searching, but they don't work how I want.
The problem is, that part of site is static text ( not in database ) ,
other
part ( products ) are in MySQL database - this part is generating from
PHP
scripts.
Ben Edwards [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
This kind of depends on what database you are using (I am asuming you
mean you have a data driven site you want to search so strictly
speaking it is the database that you want to search).
Mysl has free text search facilities (i.e. you can pass it a number of
words and it can search for them in a set of database fields and even
kreates a 'ranking').  however this only works if you have a few
hundread records - less than this and the results are unpredictable.
Have you tries googeling for php search scripts?
Ben
On Thu, 20 Jan 2005 14:04:44 +0200, Rosen [EMAIL PROTECTED]
wrote:
Hi,
Can someone recommend me a search engine script in PHP for inside
one
site?
Thanks in advance!
Rosen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

--
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
200 Ricks Hall, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax:   919/515-7812
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] file upload

2005-01-20 Thread anirudh dutt
On Thu, 20 Jan 2005 13:30:35 +0100, M. Sokolewicz [EMAIL PROTECTED] wrote:
 what you're doing is server = server
 What the akshay wants is server = client
 The only not yet posted other options are client = client (which is
 essentially impossible with PHP, unless you use the server=server
 setup) and client = server (which is called uploading)

right. i assumed he wanted to do something like get a file from
another server and then send/display it to the client (news picker for
a feed or comic strip ripper).

if the file is on the same server, then a simple download would do ;-)
or if the script's gonna generate data dynamically, then it would have
to send the Content-Disposition, Pragma, etc. headers.

@akshay: the headers to be sent differ for normal browsers and IE.

anirudh

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



[PHP] Use a query twice

2005-01-20 Thread Shaun
Hi,

I have the following query:

$result = mysql_query(SELECT * FROM Users);
while( $r = db_fetch_array( $result ) ){
 echo $r['Name'];
}

Is it possible to use the same result set to loop through the values form 
the begining or do I have to create the $result varible again?

Thanks for your help 

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



[PHP] Search indexing.. Re: [PHP] Search engine

2005-01-20 Thread tg-php
Just out of curiosity.. relating to this subject.. does anyone have any good 
documentation on creating your own site index so you can create your own search 
engine?

That is..  do search engines like Google take every word in a web page and if 
you search for that specific word it has a list of all URLs whose pages contain 
that word?   I mean, what is the general theory behind creating a searchable 
index as opposed to just storing all your web pages in a database and using SQL 
to find the pages?   If you indexed the pages you could then do a sort by 
relevance (which you really can't do with just doing a 'LIKE' SQL query on your 
raw content).

I know this isn't strictly PHP related, but if someone hasn't done a basic 
indexing search engine in PHP, then it's time someone did I think. :)

-TG

= = = Original message = = =

Why not use PHP to create static pages from your dynamic info (say 5 minutes 
after the data is update?) and allow for the system to search the site then?  I 
have noticed that I don't even have to do that for the search spiders from 
Google and yahoo to trawl my site and get everything, so maybe looking for code 
to curl through would be good?

Robert

Rosen is quoted as saying on 1/20/2005 7:48 AM:
 But here the problem is, that the texts in database uses from different
 scripts and on the search engine I should show and link to the sctipt, thath
 shows searched data.
 My idea was for search script, who explore the whole site (as generated from
 PHP scripts - via links ).
 
 
 
 Ben Edwards [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
Looks like you will have to write your own.  Have a look at the
scripts you have and see how they do it.  One option is to write the
'static' pages into the database as well as the file system.  I
personaly put all content into a database and do not really have any
static pages atall.

Ben

On Thu, 20 Jan 2005 14:18:49 +0200, Rosen [EMAIL PROTECTED] wrote:

I try many scripts for searching, but they don't work how I want.
The problem is, that part of site is static text ( not in database ) ,
 
 other
 
part ( products ) are in MySQL database - this part is generating from
 
 PHP
 
scripts.

Ben Edwards [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

This kind of depends on what database you are using (I am asuming you
mean you have a data driven site you want to search so strictly
speaking it is the database that you want to search).

Mysl has free text search facilities (i.e. you can pass it a number of
words and it can search for them in a set of database fields and even
kreates a 'ranking').  however this only works if you have a few
hundread records - less than this and the results are unpredictable.

Have you tries googeling for php search scripts?

Ben

On Thu, 20 Jan 2005 14:04:44 +0200, Rosen [EMAIL PROTECTED]
 
 wrote:
 
Hi,
Can someone recommend me a search engine script in PHP for inside
 
 one
 
site?

Thanks in advance!
Rosen

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




--
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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




-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)
 
 

-- 
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
200 Ricks Hall, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax:   919/515-7812
[EMAIL PROTECTED]

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


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] Use a query twice

2005-01-20 Thread Sergio Gorelyshev
On Thu, 20 Jan 2005 13:06:54 -
Shaun [EMAIL PROTECTED] wrote:

 Hi,
 
 I have the following query:
 
 $result = mysql_query(SELECT * FROM Users);
 while( $r = db_fetch_array( $result ) ){
  echo $r['Name'];
 }
 
 Is it possible to use the same result set to loop through the values form 
 the begining or do I have to create the $result varible again?

see mysql_data_seek()

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


-- 
RE5PECT
Sergio Gorelyshev

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



Re: [PHP] Re: multiple sessions on same server/domain

2005-01-20 Thread Marek Kilimajer
Richard Lynch wrote:
Marek Kilimajer wrote:
Jason Barnett wrote:
Valter Toffolo wrote:

ok i have one server with a single domain, each user have it's home
with a public_html so i get mydomain.com/~user1/ and
mydomain.com/~user2/ and so on. but each user might like to use
sessions so how can i make it work so that sessions would have each
one it's own variables and all...??
thanks, valter.

What is the problem?  If you have session support set in PHP then each
user should be able to session_start etc.  The default session handler
that comes with PHP will allow each user to have their own session
variables (technically they're indices in the $_SESSION superglobal
array).
Please check the PHP manual to see how to set up session support if
that's what you're confused about.
The problem is with cookies being common for all user directories.

You'll have to be more specific than this.
Are you worried about:
1) Cookie filename collision, so two users criss-cross cookies?
No
2) Cookie security, so user1 can read user2's cookie files
Something like above, but cookies are not files as I'm sure you know ;) 
(though they are stored somewhere, this is just implementation).

3) Malicous user2 filling up everybody's /tmp dir with zillion cookie files
#1 is a non-problem, almost for sure.  I don't think the OS+PHP will
*ever* let your cookie files share a common name
#2 separating them into different directories is not a whole lot of
help...  If I know his cookie files are in ~/user2 and follow the same
naming conventions as the ones in my ~/user1 directory, I can still read
them.
I'm talking about COOKIE PATH - Path parameter of Set-Cookie header. 
What should user1 do in order to separate his cookies and sessions from 
other users is to give them different cookie path:

session_set_cookie_params(0, '/~user1/');
session_start();
But malicious evil can do:
session_set_cookie_params(2147483647, '/~victim/');
session_start();
Then write a script that will periodicaly check 
http://server/~victim/?SESSIONID=' . $stored_session_id if it displays 
Hello Richard (or any other sign off being logged in, eg log off link) 
and the session is highjacked.

#3 also separting the cookies is no help -- A full drive is a full drive. 
Unless you are doing a low-level partition separate for each user.

No

Each user should use session_set_cookie_params() to set the cookie path
to its own directory. And use of session_regenerate_id() is a must, else
user1 can set the cookie path to /~user2/ with lifetime till 2038 and...

And what?
Until we know what it is you think you're trying to solve we can't
advise you.
unique session for each user directory (/~user) and SECURITY. I think 
this was the concern of the OP.

So far, all we've got is a stated desire to segregate cookie files for no
apparent reason.
I'm sure it's perfectly clear to you why you want this, but nobody else is
getting it.
I hope everyone gets me now.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: which is best php editor?

2005-01-20 Thread QT
hi,

I am using editplus 2 as well. But don't you want to see functions in the
another window or some quick coompletion, when you write codes
[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
  What's the purpose of your coding?
  Applications? Just some sort of dynamic code here n there? or Huge OOP
  application with a team of programmers?
 
  I started with PHPEdit, Moved to Magna and then tried Dreaweaver to
  communicate with designers. And then came Zend 2.5 n then Got shocked
  with Zend 3.5 and now i'm on the Zend 4.0 Beta.  In all the cases I'd
  recommand Zend if you wish to buy rather than using a free one.
 
  But it all depends on u  the amount of work you want to get done with
  ur editor or IDE.
 
  HTH
 
  M.Saleh.E.G
  97150-4779817
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 Coding since about 4 years, never got a better editor than EditPlus 2. And
 sometime ago I was decided to get a very good Dev Env, no one did it, i
 was back to EditPlus in a week.

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



[PHP] Re: class structure.

2005-01-20 Thread Jason Barnett
Dustin Krysak wrote:
Hi there, I am pretty new to writing classes (and pretty new to PHP 
itself), but I was wondering what was the best format for constructing 
There are a few general patterns that show up time after time.  They 
happen so often that there are formal names for them.  This isn't really 
a PHP question per se, but a good site for exploring object design in 
PHP is http://phppatterns.com/

classes. Now for example, i have written 2 versions of a class that 
accomplish the exact same thing. And I was just wondering if there are 
any advantages to either, or even if one was formatted more so to 
standards. Just wanting to learn it the proper way from the get go. My 
classes are formatted for use in flash remoting (hence the methodTable 
stuff - you can ignore it). I guess my question refers more towards the 
declaration of properties, etc.
Think of declaration of properties and methods as a contract.  When 
something is public it is available to all of PHP.  When it is private 
it is only usable by the class that you define it in.  When it is 
protected it is a hybrid; it is usable to the class that defined it and 
it can be inherited by classes that extend that class.

So, decide what level of access you really *need* for that property / 
method.  If a property is only supposed to be modified by class methods 
(for example, a password string) then make it private or possibly 
protected.  If everything is public access then there is temptation to 
do something like:

?php
class myObject {
  public $pubprop = 'I am the starting value.  Trust me, even though I 
am public access';
}

function all_hell_breaks_loose($obj) {
  $obj-pubprop = 'ANARCHY LIVES!  PHEAR DA WRAFF OF DA PUBIC PROPS!';
}
$obj = new myObject();
/** ... 1000's of lines of code ... */
all_hell_breaks_loose($obj);
print_r($obj);
?
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY | 
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins

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


[PHP] quoting values in HTML - is there a diference between ' and

2005-01-20 Thread Ben Edwards
I always thought quoting values in HTML had to be dome with double
quotes ().  however on reeding some stuff in the PHP manual the
examples use single quoted.  Single quotes are allot more convenient
as I use double quotes generally for quoting strings.  So are the two
totally synonymous in HTML?

Ben
-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



Re: [PHP] quoting values in HTML - is there a diference between ' and

2005-01-20 Thread tg-php
I believe HTML uses ' and  interchangeably.  No real difference.  Well, it 
also depends on the HTML rendering engine too I guess.  IE might do it ok but 
Firefox might not.. things like that.  But I think as far as the spec goes, you 
can use both.In a lot of cases, as long as there are no spaces involved, 
you can go without the quotes too but that's just really poor coding practice I 
think.

I believe they allow single and double quotes to help accomodate client side 
scripting languages like JavaScript where you might have to echo text but still 
be able to break out to perform a function or concatenate a variable or 
something.  If a scripting language only let you use double quotes, then you 
have the option of using single quotes in the HTML you're echoing.  Or vice 
versa.

Firefox's Web Developer extension (which I highly recommend for web developers) 
will tell you if it's using W3 standard (strict), loose or...umm.. something 
else..  for it's rendering of the web page.  That is, if the HTML it's 
interpreting meets strict specs, loose specs, or is just sloppy as crap but 
it's going to do what it can anyway...   basically which facet of it's 
rendering engine is being used to display the page.

-TG


= = = Original message = = =

I always thought quoting values in HTML had to be dome with double
quotes ().  however on reeding some stuff in the PHP manual the
examples use single quoted.  Single quotes are allot more convenient
as I use double quotes generally for quoting strings.  So are the two
totally synonymous in HTML?

Ben
-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



[PHP] How to load PDF file page by page

2005-01-20 Thread Deepak Dhake
Hello all,
Can anyone tell me how to read large PDF file and outputs it but the PDF 
file should load page by page before it completely downloads.

Thanks in advance!
Deepak
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Search engine

2005-01-20 Thread Greg Donald
On Thu, 20 Jan 2005 14:04:44 +0200, Rosen [EMAIL PROTECTED] wrote:
 Can someone recommend me a search engine script in PHP for inside one site?

Use HTDig.  Here's a tutorial on how to use it and how to write a PHP
wrapper around the result set for total customization of the display
results:

http://www.devshed.com/c/a/PHP/Search-This/


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] quoting values in HTML - is there a diference between ' and

2005-01-20 Thread Greg Donald
On Thu, 20 Jan 2005 14:47:21 +, Ben Edwards [EMAIL PROTECTED] wrote:
 I always thought quoting values in HTML had to be dome with double
 quotes ().  however on reeding some stuff in the PHP manual the
 examples use single quoted.  Single quotes are allot more convenient
 as I use double quotes generally for quoting strings.  So are the two
 totally synonymous in HTML?

Feed it to the validator and see for yourself:

http://validator.w3.org/


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] Search indexing.. Re: [PHP] Search engine

2005-01-20 Thread Greg Donald
On Thu, 20 Jan 2005 8:16:28 -0500, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Just out of curiosity.. relating to this subject.. does anyone have any good
 documentation on creating your own site index so you can create your own
 search engine?

http://www.devshed.com/c/a/PHP/Search-This/


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re[2]: [PHP] quoting values in HTML - is there a diference between ' and

2005-01-20 Thread Richard Davey
Hello,

Thursday, January 20, 2005, 2:55:09 PM, you wrote:

tpgc I believe HTML uses ' and  interchangeably. No real difference.
tpgc Well, it also depends on the HTML rendering engine too I guess.
tpgc IE might do it ok but Firefox might not.. things like that. But
tpgc I think as far as the spec goes, you can use both.

In HTML 4.1 at least the atrribute values can be delimited using
either single or double quotation marks. I doubt there are many
rendering engines that would be specific to one type, othewise
something like this wouldn't be possible:

img src=blah.gif alt=Look, it's an image /

You can use numeric character references instead of quotes if you
like.

tpgc In a lot of cases, as long as there are no spaces involved, you
tpgc can go without the quotes too but that's just really poor coding
tpgc practice I think.

From the spec:

In certain cases, authors may specify the value of an attribute
without any quotation marks. The attribute value may only contain
letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45),
periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons
(ASCII decimal 58). We recommend using quotation marks even when it is
possible to eliminate them.

Bear in mind this is the HTML 4.1 spec - the XHTML spec is vastly
different and non-quoted attributes will fail validation big time.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

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



[PHP] Firefox's Web Developer Extension.. Re: [PHP] quoting values in HTML - is there a diference between ' and

2005-01-20 Thread tg-php
Yeah, that looks like it.  Even one little feature like being able to show 
table cell borders and toggle that one and off can be invaluable to someone 
who habitually goes in and sets a border=1 for a table then has to go back 
and do border=0 after checking the table.   The web browser knows where all 
that stuff is, but no browser I've ever seen gives you such easy access to that 
info.

I've also used the various disable functions from time to time.. there's even 
a Change GET to POST and vice versa.   Also you can see a list of all form 
elements and their current value (including HIDDEN elements) without having to 
look at the source code.

Very good stuff.

-TG

 Firefox's Web Developer extension (which I highly recommend for web 
 developers) will tell you if it's using W3 standard (strict), loose 
 or...umm.. something else..  for it's rendering of the web page.  That is, if 
 the HTML it's interpreting meets strict specs, loose specs, or is just sloppy 
 as crap but it's going to do what it can anyway...   basically which facet of 
 it's rendering engine is being used to display the page.

Is this http://www.chrispederick.com/work/firefox/webdeveloper/ what
you are refering to?  Looks interesting.  will give it a go tonight.

Ben


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



[PHP] Re: php 5 interfaces

2005-01-20 Thread M. Sokolewicz
Sergio Gorelyshev wrote:
Hi all.
Situation:
interface MyInterface {
 public static myMethod();
}
class MyClass implements MyInterface {
  public static myMethod() {}
}
This sample will crash with message 
Fatal error: Access type for interface method MyInterface::myMethod() must be omitted in somefile.php on line NN

Why I'm not able to clarify call's type (static) for methods in interface? I'm 
predict closely that method myMethod() in all classes which implements  
MyInterface must be called statically. A little trick allowed to me to resolve 
this problem, but my question  more ideological than practical.
Thanks
it's not the static part, it's the public part. You can't make 
non-public static methods. It's simply impossible by the definition of 
protected and private (both allow only the object itself to access it, 
or (in case of protected) a descendent).

So, removing the public part should work out fine.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: SPL Exceptions

2005-01-20 Thread Gerard Samuel
M. Sokolewicz wrote:
Gerard Samuel wrote:
Does anyone know when the exception objects listed in
item #6 at http://www.php.net/~helly/php/ext/spl/ will be available
in base php5??
Thanks
when you install the SPL extension :) I don't think it's planned for 
php5-source though

[UPDATE 1-20-2005]
Im making a minor additional note, just in case it comes up again.
From the lack of responses I got on this, I thought I may have missed
the point from your responses.
But I've found some information that may or may not be correct.
Speculation -
The SPL exceptions that I originally was asking about, may be in php
5.1.0.  By chance I came across a phpinfo dump of 5.1.0-dev and it
reports to have the exception classes.
http://dev.e-taller.net/reflector/reflector.php?mod=inf
and according to CVS, http://cvs.php.net/php-src/ext/spl/spl_exceptions.h
it looks like they were recently added last November, so Im guessing its
still pretty new to be in php 5.0.x.
Thanks for listening
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: php 5 interfaces

2005-01-20 Thread Sergio Gorelyshev
On Thu, 20 Jan 2005 16:39:21 +0100
M. Sokolewicz [EMAIL PROTECTED] wrote:

 Sergio Gorelyshev wrote:
  Hi all.
  
  Situation:
  
  interface MyInterface {
   public static myMethod();
  }
  
  class MyClass implements MyInterface {
public static myMethod() {}
  }
  
  This sample will crash with message 
  Fatal error: Access type for interface method MyInterface::myMethod() must 
  be omitted in somefile.php on line NN
  
  Why I'm not able to clarify call's type (static) for methods in interface? 
  I'm predict closely that method myMethod() in all classes which implements  
  MyInterface must be called statically. A little trick allowed to me to 
  resolve this problem, but my question  more ideological than practical.
  
  Thanks
 it's not the static part, it's the public part. You can't make 
 non-public static methods. It's simply impossible by the definition of 
 protected and private (both allow only the object itself to access it, 
 or (in case of protected) a descendent).
 
 So, removing the public part should work out fine.
 
I'm confused. Construction like that:
?php
interface MyInterface {
  public static function myMethod();
}

class MyClass implements MyInterface {
   public static function myMethod() {}
}

MyClass::myMethod();
?
fork fine when i'm fetched it from my framework. But it's crashes inside 
framework with previous message.

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


-- 
RE5PECT
Sergio Gorelyshev

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



[PHP] phppatterns.com, Nice idea, shame about the site (was Re: [PHP] Re: class structure.)

2005-01-20 Thread Ben Edwards
On Thu, 20 Jan 2005 09:37:37 -0500, Jason Barnett
[EMAIL PROTECTED] wrote:
 Dustin Krysak wrote:
  Hi there, I am pretty new to writing classes (and pretty new to PHP
  itself), but I was wondering what was the best format for constructing
 
 There are a few general patterns that show up time after time.  They
 happen so often that there are formal names for them.  This isn't really
 a PHP question per se, but a good site for exploring object design in
 PHP is http://phppatterns.com/

Nice idea, shame about the site.  I would expect a patterns site to
have a place with a list of the standard patterns, what they are for
and implementation in the target language.  This site douse not (or it
douse I cant find it).  Anyone know of one that douse.

Ben
 
  classes. Now for example, i have written 2 versions of a class that
  accomplish the exact same thing. And I was just wondering if there are
  any advantages to either, or even if one was formatted more so to
  standards. Just wanting to learn it the proper way from the get go. My
  classes are formatted for use in flash remoting (hence the methodTable
  stuff - you can ignore it). I guess my question refers more towards the
  declaration of properties, etc.
 
 Think of declaration of properties and methods as a contract.  When
 something is public it is available to all of PHP.  When it is private
 it is only usable by the class that you define it in.  When it is
 protected it is a hybrid; it is usable to the class that defined it and
 it can be inherited by classes that extend that class.
 
 So, decide what level of access you really *need* for that property /
 method.  If a property is only supposed to be modified by class methods
 (for example, a password string) then make it private or possibly
 protected.  If everything is public access then there is temptation to
 do something like:
 
 ?php
 
 class myObject {
   public $pubprop = 'I am the starting value.  Trust me, even though I
 am public access';
 }
 
 function all_hell_breaks_loose($obj) {
   $obj-pubprop = 'ANARCHY LIVES!  PHEAR DA WRAFF OF DA PUBIC PROPS!';
 }
 
 $obj = new myObject();
 
 /** ... 1000's of lines of code ... */
 
 all_hell_breaks_loose($obj);
 print_r($obj);
 
 ?
 
 --
 Teach a man to fish...
 
 NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
 STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
 STFM | http://www.php.net/manual/en/index.php
 STFW | http://www.google.com/search?q=php
 LAZY |
 http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



[PHP] filling a pdf form.

2005-01-20 Thread marc serra
Hello,
I got a problem with PDF. I got a PDF form that i want to put on a 
server to allow users to fill it. After this, i want to collect 
information entered by users and recreate a PDF file with all of them. 
It's important that's the original PDF file and the filled one had the 
same shape.

Can someone explain me how to do this ? I think the better way is to 
convert the pdf form into HTML but i don't find a software that do that 
automaticaly. Another solution could be to create the same form in HTML 
but the PDF file is 10 pages long :(

I got another problem. When i will find a way to collect information of 
my form, will it be possible to fill the original PDF file with the 
collected information without created it again ?

I think it could be possible to do this using XML, XSL AND FDF in which 
order using them...

Thanks for your help,
Marc.

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 16/01/2005
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: phppatterns.com, Nice idea, shame about the site (was Re: [PHP] Re: class structure.)

2005-01-20 Thread Jason Barnett
Ben Edwards wrote:
On Thu, 20 Jan 2005 09:37:37 -0500, Jason Barnett
[EMAIL PROTECTED] wrote:
Dustin Krysak wrote:
Hi there, I am pretty new to writing classes (and pretty new to PHP
itself), but I was wondering what was the best format for constructing
There are a few general patterns that show up time after time.  They
happen so often that there are formal names for them.  This isn't really
a PHP question per se, but a good site for exploring object design in
PHP is http://phppatterns.com/

Nice idea, shame about the site.  I would expect a patterns site to
have a place with a list of the standard patterns, what they are for
and implementation in the target language.  This site douse not (or it
http://phppatterns.com/index.php/article/archive/1/
Maybe not organized the way you would do it, but there are a lot of 
patterns there (and the links will describe implementation in PHP).

douse I cant find it).  Anyone know of one that douse.
Ben

--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY | 
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins

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


Re: [PHP] Re: SPL Exceptions

2005-01-20 Thread Jason Barnett
[UPDATE 1-20-2005]
Im making a minor additional note, just in case it comes up again.
 From the lack of responses I got on this, I thought I may have missed
the point from your responses.
But I've found some information that may or may not be correct.
Speculation -
The SPL exceptions that I originally was asking about, may be in php
5.1.0.  By chance I came across a phpinfo dump of 5.1.0-dev and it
reports to have the exception classes.
http://dev.e-taller.net/reflector/reflector.php?mod=inf
and according to CVS, http://cvs.php.net/php-src/ext/spl/spl_exceptions.h
it looks like they were recently added last November, so Im guessing its
still pretty new to be in php 5.0.x.
Thanks for listening
Thanks for the update.  I wouldn't count on this feature making it in 
for 5.1.0 for 100% certain, but yeah if it's in the dev tree then it is 
likely on the way.

--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY | 
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins

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


[PHP] EREGI_REPLACE? HELP!!!

2005-01-20 Thread Kiason Turner
I'm trying to take a string and remove all invalid characters from it.

$string=Frid#ays are@ re$ally G{}[]RE~AT. F*riday at 5 is be^tter.;

The only characters that should be allowed are A-Z, a-z, 0-9,
.(period), -(dash), ;(semi-colon), and :(colon).
All other characters should be removed.
After cleaning the string, the output should be: Fridays are really
GREAT. Friday at 5 is better.

Any ideas? Your help is appreciated.

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



[PHP] Seemingly weird regex problem

2005-01-20 Thread Tim Boring
Hello!  I'm having an odd regex problem.  Here's a summary of what I'm
trying to accomplish:

I've got a report file generated from our business management system
(Progress 4GL), one fixed-width record per line.  I've got a php script
that reads in the raw file one line at a time, and strips out any
unwanted lines (repeated column headings, mostly).  

I'm stripping out unwanted lines by looking at the beginning of each
line and doing the following:
1. If the line begins with a non-word character (\W+), discard it;
2. If the line begins with the word Vendor, discard it;
3. If the line begins with Loc, discard it;
4. If the line begins with a dash, discard it;
5. Else keep the line and write it to an output file.

The way I've implemented this in code is via the code snippet below. 
The problem I'm encountering, however, is that any line that begins with
a word, such as AKRN, is matching rule #1, thus discarding the line. 
This is not what I want, but I'm having difficulty spotting my mistake. 

To try to help spot the issue, I put in the if(preg_match(/^\W+/,
$line)) logic, and the weird thing is that this logic isn't outputting
the line beginning with things like AKRN, yet the same line is getting
caught in the switch statement and being discarded.

Any suggestions?

 while (!feof($input_handle))
 {
$line = fgets($input_handle);
 
if (preg_match(/^\W+/, $line))
{
  echo $line\n;
}
 
switch ($line)
{
case ($total_counter = 5):
fwrite($output_handle, $line);
$counter++;
$total_counter++;
break;
   // Rule #1: non-word character
   case preg_match(/^\W+/, $line):
  array_push($tossed_lines, $line);
  echo Rule #1 violation\n;
  $tossed_counter++;
  $total_counter++;
  break;
// Rule #2: Vendor at beginning of line
case preg_match(/^Vendor/i, $line):
  array_push($tossed_lines, $line);
  echo Rule #2 violation\n;
  $tossed_counter++;
  $total_counter++;
  break;
   // Rule #3: Loc at beginning of line
case preg_match(/^Loc/i, $line):
  array_push($tossed_lines, $line);
  echo Rule #3 violation\n;
  $tossed_counter++;
  $total_counter++;
  break;
   // Rule #4: dash character at beginning of line
case preg_match(/^\-/, $line):
   array_push($tossed_lines, $line);
   echo Rule #4 violation\n;
   $tossed_counter++;
   $total_counter++;
   break;
default:
   fwrite($output_handle, $line);
   $counter++;
   $total_counter++;
   break;
   }
 }

-- 
Tim Boring
IT Department, Automotive Distributors
Toll Free: 800-421-5556 x3007
Direct: 614-532-4240
E-mail: [EMAIL PROTECTED]

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



Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Richard Lynch
Tim Boring wrote:
 Hello!  I'm having an odd regex problem.  Here's a summary of what I'm
 trying to accomplish:

 switch ($line)
 {
 case ($total_counter = 5):
 break;
case preg_match(/^\W+/, $line):

While it would be Really Nifty (tm) if PHP worked this way, as far as I
know, you can only have a CONSTANT in your case.

switch($char){
  case 'X': echo It was an X; break;
}

You can't just put arbitrary expressions there...

Feel free to correct me if the Manual sez different.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Re: phppatterns.com, Nice idea, shame about the site (was Re: [PHP] Re: class structure.)

2005-01-20 Thread Ben Edwards
On Thu, 20 Jan 2005 11:55:37 -0500, Jason Barnett
[EMAIL PROTECTED] wrote:
 Ben Edwards wrote:
  On Thu, 20 Jan 2005 09:37:37 -0500, Jason Barnett
  [EMAIL PROTECTED] wrote:
 
 Dustin Krysak wrote:
 
 Hi there, I am pretty new to writing classes (and pretty new to PHP
 itself), but I was wondering what was the best format for constructing
 
 There are a few general patterns that show up time after time.  They
 happen so often that there are formal names for them.  This isn't really
 a PHP question per se, but a good site for exploring object design in
 PHP is http://phppatterns.com/
 
 
  Nice idea, shame about the site.  I would expect a patterns site to
  have a place with a list of the standard patterns, what they are for
  and implementation in the target language.  This site douse not (or it
 
 http://phppatterns.com/index.php/article/archive/1/

Cool, thats the type of thing.  Why don't you have a link at the top
with something like 'patterns directory' or alternativly have a 'about
us' link with the stuff at phppatterns and use phppatterns for the
paterns directory.  I would have them listed simplest to more complex.
 i.e. put Singleton at top.

Regards,
Ben

 Maybe not organized the way you would do it, but there are a lot of
 patterns there (and the links will describe implementation in PHP).
 
  douse I cant find it).  Anyone know of one that douse.
 
  Ben
 
 
 --
 Teach a man to fish...
 
 NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
 STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
 STFM | http://www.php.net/manual/en/index.php
 STFW | http://www.google.com/search?q=php
 LAZY |
 http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



[PHP] debugging modules

2005-01-20 Thread Arshavir Grigorian
Hi,
I am having trouble debugging a PECL module (APC) because while I am 
able to --enable-debug when configuring the PHP course, I cannot do the 
same for APC (no such configure option). Does anyone know how to do that?

PHP Warning:  Unknown(): apc: Unable to initialize module\nModule 
compiled with module API=20020429, debug=0, thread-safety=0\nPHP
compiled with module API=20020429, debug=1, thread-safety=0\nThese 
options need to match\n in Unknown on line 0

Thanks in advance for any pointers.

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


[PHP] URGENT: Break-lines disappearing.

2005-01-20 Thread Bruno B B Magalhães
Hi you all,
I am having a very big problem... I have an article module in a system, 
when an user creates an article it's parsed (as everything else in the 
system) by an input class, after, it is checked for emptily and after 
is build an insert query... But the break-lines just disappear... I've 
tested right before parsing to the database build query function and 
the breaks are there! And the build query function is this:

	function insert_query($table='',$values='')
	{
		if($table != ''  $values != '')
		{
			foreach($values as $var=$val)
			{
$insert_vars[] = $var;
$insert_vals[] = $val;
			}
			return $this-query('INSERT INTO '.$table.' 
('.implode(',',$insert_vars).') VALUES 
(\''.implode('\',\'',$insert_vals).'\') ');
		}
		else
		{
			return false;
		}
	}

And the sanitize function is:
function sanitize($input_data, $sanitize = true)
{
if(is_array($input_data))
{
foreach($input_data as $input_key=$input_value)
{
$output_data[$input_key] = 
$this-sanitize($input_value,$sanitize);
}
return $output_data;
}
elseif($sanitize)
{
return addslashes($input_data);
}
else
{
return $input_data;
}
}
Where are the break-lines?!?!? I am really desperate! Please! I am 
using MySQL and PHP4.

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


Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Bret Hughes
On Thu, 2005-01-20 at 11:59, Richard Lynch wrote:
 Tim Boring wrote:
  Hello!  I'm having an odd regex problem.  Here's a summary of what I'm
  trying to accomplish:
 
  switch ($line)
  {
  case ($total_counter = 5):
  break;
 case preg_match(/^\W+/, $line):
 
 While it would be Really Nifty (tm) if PHP worked this way, as far as I
 know, you can only have a CONSTANT in your case.
 
 switch($char){
   case 'X': echo It was an X; break;
 }
 
 You can't just put arbitrary expressions there...
 
 Feel free to correct me if the Manual sez different.
 

yeah,  the discussion for switch illustrates the use of functions in
case statements.  I have never done it and I wonder if there is a
difference in what preg_replace returns vs what is true but if that
was an issue, why doesn't the if catch it.  wish I had time to play.

Bret

http://www/php.net/switch

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



RE: [PHP] EREGI_REPLACE? HELP!!!

2005-01-20 Thread Chris W. Parker
Kiason Turner mailto:[EMAIL PROTECTED]
on Thursday, January 20, 2005 9:19 AM said:

 I'm trying to take a string and remove all invalid characters from
 it. 
 
 $string=Frid#ays are@ re$ally G{}[]RE~AT. F*riday at 5 is
 be^tter.; 

 Any ideas? Your help is appreciated.

What have you tried so far?

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



Re: [PHP] filling a pdf form.

2005-01-20 Thread Richard Lynch
marc serra wrote:
 I got a problem with PDF. I got a PDF form that i want to put on a
 server to allow users to fill it. After this, i want to collect
 information entered by users and recreate a PDF file with all of them.
 It's important that's the original PDF file and the filled one had the
 same shape.

 Can someone explain me how to do this ? I think the better way is to
 convert the pdf form into HTML but i don't find a software that do that
 automaticaly. Another solution could be to create the same form in HTML
 but the PDF file is 10 pages long :(

 I got another problem. When i will find a way to collect information of
 my form, will it be possible to fill the original PDF file with the
 collected information without created it again ?

I wrote an article in the June issue of php | architect that pretty much
described exactly how to do all this using Adobe's FDF.

http://www.phparch.com/

This on-line draft version may have enough info to get you going:
http://phpbootcamp.com/articles/fdf.htm

 I think it could be possible to do this using XML, XSL AND FDF in which
 order using them...

I dunno where you'd want to shove in the XML and XSL parts, but since
everybody seems to use XML and XSL for everything these days, no matter
how unsuitable it might be, I suppose it shouldn't be too difficult to
find some way to do it. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Tim Boring
On Thu, 2005-01-20 at 12:59, Richard Lynch wrote:
 Tim Boring wrote:
  Hello!  I'm having an odd regex problem.  Here's a summary of what I'm
  trying to accomplish:
 
  switch ($line)
  {
  case ($total_counter = 5):
  break;
 case preg_match(/^\W+/, $line):
 
 While it would be Really Nifty (tm) if PHP worked this way, as far as I
 know, you can only have a CONSTANT in your case.
 
 switch($char){
   case 'X': echo It was an X; break;
 }
 
 You can't just put arbitrary expressions there...
 
 Feel free to correct me if the Manual sez different.

It's perfectly legit to use expressions.  Now perhaps there is something
wrong with the regex I'm trying to use, but using a regex in and of
itself is legal. 
http://www.php.net/manual/en/control-structures.switch.php

Tim

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



Re: [PHP] EREGI_REPLACE? HELP!!!

2005-01-20 Thread Greg Donald
On Thu, 20 Jan 2005 11:19:10 -0600, Kiason Turner [EMAIL PROTECTED] wrote:
 I'm trying to take a string and remove all invalid characters from it.
 
 $string=Frid#ays are@ re$ally G{}[]RE~AT. F*riday at 5 is be^tter.;
 
 The only characters that should be allowed are A-Z, a-z, 0-9,
 .(period), -(dash), ;(semi-colon), and :(colon).
 All other characters should be removed.
 After cleaning the string, the output should be: Fridays are really
 GREAT. Friday at 5 is better.
 
 Any ideas? Your help is appreciated.

Maybe something like:

$string = ereg_replace( [^-.:;[:alnum:][:space:]+], '', $string );

I'm no regex guru so there may be a better way.. but it seemed to work for me.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



[PHP] downloading file and displaying HTML

2005-01-20 Thread Michael Grunewalder
Hi,
I have a list of files that are outside the web root and can't be accessed with 
a
URL directly.
If a user clicks the link for a file on the download page, I would like to send
that file to the browser as a download *and* display HTML in the browser window.
How can I do that - if it is possible at all.

Thanks in advance for your help
Mike

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



Re: [PHP] How to load PDF file page by page

2005-01-20 Thread Richard Lynch
Deepak Dhake wrote:
 Can anyone tell me how to read large PDF file and outputs it but the PDF
 file should load page by page before it completely downloads.

I think that's more of an Adobe question than PHP, really...

I vaguely recall that you could make this happen (only?) if you were using
not just a plain PDF, but a PDF with PDI (FDI???) where, essentially, your
PDF file references *other* PDF files, and those get sucked down
separately.

Note that this is the big-time feature where you have to PAY MONEY for
libPDF and similar products, as I recall.  IE, without this feature, it
was free/cheap, but if you wanted this, you'd pay (more).

Since I never needed this feature, I only skimmed through it all, and
could be completely wrong.

Also note that, almost for sure, when you send out the main PDF, and
then that PDF sucks down all the other PDFs, you are really chewing up a
*LOT* of HTTP connections opening and closing.  Seems kind of expensive to
me for the sake of showing the user one page/part of a giant PDF in
advance...

At that point, it seems to me you'd better serve the end user by having
separate PDF files, if at all possible, and let them download the parts
they want, or just warn them it will be awhile to download... YMMV  NAIAA 
IANAL

It's REAL easy to bloat PDF files very fast, and having monster PDF files
seems like a Bad Idea (tm) to me, in general.  I'm sure there are specific
cases where it's the Right Answer and your needs may well be one of them
-- I just want to make sure you understand the ramifications before you go
down the garden path.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Jason Wong
On Friday 21 January 2005 01:52, Tim Boring wrote:

 To try to help spot the issue, I put in the if(preg_match(/^\W+/,
 $line)) logic, and the weird thing is that this logic isn't outputting
 the line beginning with things like AKRN, yet the same line is getting
 caught in the switch statement and being discarded.

Well the biggest problem in your code right now is your incomprehensible (to 
me anyway) use of the switch construct. For a start I've no idea why you're 
using ...

 switch ($line)

... when your tests do not involve $line

 case ($total_counter = 5):

I suspect what you want to be doing is something like this:

  switch (TRUE) {
case ANY_EXPRESSION_THAT_EVALUATES_TO_TRUE:
...
  }

-- 
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
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Jason Wong
On Friday 21 January 2005 02:16, Tim Boring wrote:

 It's perfectly legit to use expressions.  Now perhaps there is something
 wrong with the regex I'm trying to use, but using a regex in and of
 itself is legal.
 http://www.php.net/manual/en/control-structures.switch.php

Yes, but comparing those expressions to:

  switch ($line)

where $line is a string, doesn't make sense. See my other post.

-- 
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
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] Re: multiple sessions on same server/domain

2005-01-20 Thread Richard Lynch
 2) Cookie security, so user1 can read user2's cookie files

 Something like above, but cookies are not files as I'm sure you know ;)
 (though they are stored somewhere, this is just implementation).

They are stored in files, by default, though you can put them in a
database, or whatever you want.

 3) Malicous user2 filling up everybody's /tmp dir with zillion cookie
 files

 #1 is a non-problem, almost for sure.  I don't think the OS+PHP will
 *ever* let your cookie files share a common name

 #2 separating them into different directories is not a whole lot of
 help...  If I know his cookie files are in ~/user2 and follow the same
 naming conventions as the ones in my ~/user1 directory, I can still read
 them.

 I'm talking about COOKIE PATH - Path parameter of Set-Cookie header.
 What should user1 do in order to separate his cookies and sessions from
 other users is to give them different cookie path:

 session_set_cookie_params(0, '/~user1/');
 session_start();

 But malicious evil can do:

 session_set_cookie_params(2147483647, '/~victim/');
 session_start();

 Then write a script that will periodicaly check
 http://server/~victim/?SESSIONID=' . $stored_session_id if it displays
 Hello Richard (or any other sign off being logged in, eg log off link)
 and the session is highjacked.

They don't have to muck around with session_set_cookie_params() to do that.

They can just read the Cookie files, or database, or whatever.

You have a chicken and egg problem here:  Either PHP can read the cookies
from wherever, and so can the malicious scripter, or PHP can't read the
cookies, and, well, you don't have cookies.

Each user should use session_set_cookie_params() to set the cookie path
to its own directory. And use of session_regenerate_id() is a must, else
user1 can set the cookie path to /~user2/ with lifetime till 2038 and...


 And what?

 Until we know what it is you think you're trying to solve we can't
 advise you.

 unique session for each user directory (/~user) and SECURITY. I think
 this was the concern of the OP.

SECURITY is not an on/off switch.

There is no feasible way (in general) for script X from user X in PHP to
not be able to read anything script Y from user Y can do in PHP on a
shared server.

If you *NEED* that level of SECURITY, don't use a shared server.  Period.

If you want to make it slightly more difficult, or at least less obvious,
you could put user X cookies in their database, and user Y cookies in a
different database.

Of course, now you have the issue that if user Y *wants* to badly enough,
they can read use PHP to read the file that has the password that user X
uses to connect to their database, and then they can get to the data.

 So far, all we've got is a stated desire to segregate cookie files for
 no
 apparent reason.

 I'm sure it's perfectly clear to you why you want this, but nobody else
 is
 getting it.

 I hope everyone gets me now.

Somewhat.

The problem is that you've focused in on Cookies in a shared-server
environment, when, in fact, the security levels implied in that
shared-server environment have much more far-flung effects and
implications that render your Cookie fixation rather meaningless.

Basically, if you *NEED* that level of separation of Cookie files, then
they shouldn't be on a shared server, because of everything *else* they
are already sharing.

Hope that makes sense.

Some other options, however, do include:

Give EACH user their own HTTPD pool of servers, running as some user such
as 'victor-www' with a different user for each.

Then all their files can be 600 or 700 and their Cookies as well.

This doesn't scale up well for lots of users on a single server, which is
a business requirement for most shared servers.  But it may be the Right
Solution for what you need.

Hide their Cookie files in intermediate directories whose names are
difficult to guess and which are NOT eXecutable (list-able) by other
users.

The Malicious user could still, eventually, manage to find the file
somehow, perhaps by using PHP to read PHP source code and settings rather
than reading the file structure itself.

Synopsis:
You are, most likely, zooming in too focused on Cookie files, and either
have MUCH bigger issues of SECURITY, or are just wasting your energy on a
tiny portion of a problem you simply cannot solve in the manner you are
attacking it.

It's also possible, though extremely unlikely, that you have a very weird,
rare, specific problem to solve, but without telling us more, will only
get useless generic answers that won't help in the least.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] How to load PDF file page by page

2005-01-20 Thread Deepak Dhake
Hi Richard,
There is a concept called byte-serving with you can control the 
loading of PDF file using PHP. I am not very sure how to do it. If you 
get a chance to look into it then please let me know.

Thanks,
Deepak
Richard Lynch wrote:
Deepak Dhake wrote:
 

Can anyone tell me how to read large PDF file and outputs it but the PDF
file should load page by page before it completely downloads.
   

I think that's more of an Adobe question than PHP, really...
I vaguely recall that you could make this happen (only?) if you were using
not just a plain PDF, but a PDF with PDI (FDI???) where, essentially, your
PDF file references *other* PDF files, and those get sucked down
separately.
Note that this is the big-time feature where you have to PAY MONEY for
libPDF and similar products, as I recall.  IE, without this feature, it
was free/cheap, but if you wanted this, you'd pay (more).
Since I never needed this feature, I only skimmed through it all, and
could be completely wrong.
Also note that, almost for sure, when you send out the main PDF, and
then that PDF sucks down all the other PDFs, you are really chewing up a
*LOT* of HTTP connections opening and closing.  Seems kind of expensive to
me for the sake of showing the user one page/part of a giant PDF in
advance...
At that point, it seems to me you'd better serve the end user by having
separate PDF files, if at all possible, and let them download the parts
they want, or just warn them it will be awhile to download... YMMV  NAIAA 
IANAL

It's REAL easy to bloat PDF files very fast, and having monster PDF files
seems like a Bad Idea (tm) to me, in general.  I'm sure there are specific
cases where it's the Right Answer and your needs may well be one of them
-- I just want to make sure you understand the ramifications before you go
down the garden path.
 

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


Re: [PHP] php 5 interfaces

2005-01-20 Thread Richard Lynch
Sergio Gorelyshev wrote:
 Hi all.

 Situation:

 interface MyInterface {
  public static myMethod();
 }

 class MyClass implements MyInterface {
   public static myMethod() {}
 }

 This sample will crash with message
 Fatal error: Access type for interface method MyInterface::myMethod() must
 be omitted in somefile.php on line NN

 Why I'm not able to clarify call's type (static) for methods in interface?
 I'm predict closely that method myMethod() in all classes which implements
  MyInterface must be called statically. A little trick allowed to me to
 resolve this problem, but my question  more ideological than practical.

As I understand it, an 'interface' is, by definition, never gonna have an
actualy object instantiated.

Thus, there can never *BE* an object for which private/public/protected
have any meaning.

You can only use the private/public/protected on the 'class' definitions.

Even if you *KNOW* that all class definitions *should* for this to be
'public' it just doesn't make sense from the strictly technical
stand-point of what an 'interface' is to declare it there.

Maybe somewhere over on php-dev you could make the case for the PHP Dev
Team to implement something good/interesting when public/protected/private
is used there, but currently it's semanticly undefined to have it there,
so it can't be there.

Disclaimer: I could easily be 100% wrong in this entire post. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Problem with hidden form input values

2005-01-20 Thread Richard Lynch
Ben Edwards wrote:
 On Wed, 19 Jan 2005 15:22:55 -0800 (PST), Richard Lynch [EMAIL PROTECTED]
 wrote:
 Ben Edwards (lists) wrote:
  I know this is not strictly speaking a PHP question but it is to do
 with
  a PHP app.
 
  I have a form with a number of hidden values in it.  After the post
  print_r( $_POST ) shows all the values except these (this is copied
 from
  'Show Source' in the browser.
 
  input type=hidden name=keyField[mb_memberships][0] value=mb_e_id
  input type=hidden name=keyValue[mb_memberships][0] value=10
  input type=hidden name=keyField[mb_memberships][1] value=mb_id
  input type=hidden name=keyValue[mb_memberships][1] value=1
 
  Any idea why they wont post?

 The *do* POST, but PHP only handles one level of array references in
 NAME=xxx

 You can do something like:
 ?php
  while (list($keys, $value) = each($_POST['keyField'])){
$keys = explode('][', $keys);
list($key1, $key2) = $keys;
$realKeyField[$key1][$key2] = $value;
  }
 ?

 Almost follow this but not quite.  Is this the code used to create the
 hidden HTML input tag

No, you have that correct already (though the  marks would be Good to add)

 or the one to unpack the variable after the
 post.

Yes.

What you are receiving from HTTP/POST/PHP is the same as:

$keyField['mb_memberhips][0'] = 'mb_e_id';

Note the lack of intervening apostrophes you expected:
$keyField['mb_memberhips']['0'] = 'mb_e_id';

PHP only parses POST data to *ONE* dimension.

Same as GET data too.

  What is really spooky is the keys are actually held in a
 variable in an object called keys - your telepathic abilities are very
 impressive;).

Actually, I'd recommend using something more specific than 'keys' -- I
used keys cuz I have no idea what you're doing.

You should NOT use keys, because you DO know what the data is.

'keys' is too generic for Good Programming Style.

  My first thought was when you said PHP only handles one
 level in post was to serialize the array, put the serialized version
 in as a single hidden HTML tag and unserialize at the other end.  do
 you reckon this is a goer?

This is also an option if you prefer, though I find it difficult to debug
or follow code logic when I can't use a browser's View Source to see all
the variables, so generally just un-pack the 2-D arrays as above.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Tim Boring
On Thu, 2005-01-20 at 13:41, Jason Wong wrote:
 On Friday 21 January 2005 01:52, Tim Boring wrote:
 
 Well the biggest problem in your code right now is your incomprehensible (to 
 me anyway) use of the switch construct. For a start I've no idea why you're 
 using ...
 
  switch ($line)
 
 ... when your tests do not involve $line
 
  case ($total_counter = 5):

I see your point, but the other tests do involve $line. This one that
you reference I'm using for a special need--basically so I leave in
the initial column headings from the report, because they would match
several of the tests that would discard those lines.

 
 I suspect what you want to be doing is something like this:
 
   switch (TRUE) {
 case ANY_EXPRESSION_THAT_EVALUATES_TO_TRUE:
 ...
   }

Thanks for the suggestion, but I'm not sure that does what I'm looking
for.  I really think the problem is with my regex, not necessarily with
the way I've constructed my switch statement.

I say this because I have since changed the first word in each line from
something like AKRN to a numeric value, and everything works just as I
would expect it to.  So it seems as if the ^ might be negating the \W+
part of the regex.  Although that shouldn't be happening because ^
only acts as a negation when it's used inside brackets, at least
according the documentation.

Again, thanks for the suggestion!

Tim

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



Re: [PHP] Re: class structure.

2005-01-20 Thread Richard Lynch
Jason Barnett wrote:
 Think of declaration of properties and methods as a contract.  When
 something is public it is available to all of PHP.  When it is private
 it is only usable by the class that you define it in.  When it is
 protected it is a hybrid; it is usable to the class that defined it and
 it can be inherited by classes that extend that class.

 So, decide what level of access you really *need* for that property /
 method.  If a property is only supposed to be modified by class methods
 (for example, a password string) then make it private or possibly
 protected.  If everything is public access then there is temptation to
 do something like:

Back in the day, I used to code in C++

Nothing irked me more than some so-called programmer who would
over-zealously make every damned thing private.

I'd go and sub-class it, and want to make my extended class actually
USEFUL and be ham-strung by his short-sightedness.

So when you ask yourself Self, should this be public, protected, or
private? make sure you phrase it as:

Can I think of ANY way in the future that some other cool programmer
would want to do fun and interesting and useful things with this?

Let the flames begin :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] class structure.

2005-01-20 Thread Richard Lynch
Dustin Krysak wrote:
 var $local;
 var $query_rs_biz;
 var $rs_biz;

You never actually use these as properties on the object, only as
variables within a single function.

So don't put them here.

Only put stuff here that you pass between functions or which you want
other scripts to be able to access.

 var $hostname_local = localhost;
 var $database_local = Blisting;
 var $username_local = root;
 var $password_local = URAredneck;

I'm thinking you missed changing these like you did the ones above...

Go change your password NOW.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] downloading file and displaying HTML

2005-01-20 Thread Richard Lynch
Michael Grunewalder wrote:
 I have a list of files that are outside the web root and can't be accessed
 with a
 URL directly.
 If a user clicks the link for a file on the download page, I would like to
 send
 that file to the browser as a download *and* display HTML in the browser
 window.
 How can I do that - if it is possible at all.

There's nothing in the HTTP protocol to allow you to send two answers to
one request.

One hack that will work on MOST current browsers is to put a:
META HTTP-EQUIV=REFRESH CONTENT=0;URL=http://example.com/download.php;
in your HTML, so the browser will then redirect them to the download.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Bret Hughes
On Thu, 2005-01-20 at 12:43, Jason Wong wrote:
 On Friday 21 January 2005 02:16, Tim Boring wrote:
 
  It's perfectly legit to use expressions.  Now perhaps there is something
  wrong with the regex I'm trying to use, but using a regex in and of
  itself is legal.
  http://www.php.net/manual/en/control-structures.switch.php
 
 Yes, but comparing those expressions to:
 
   switch ($line)
 
 where $line is a string, doesn't make sense. See my other post.
 

Chaching ( sound of light bulb turning on)  I see that in the example in
the manual it needs to be compared to true ( a boolean value)


switch (true)

rather than switch ($line)

What is not apparent to me is why the first case matches if the preg
fails.  Wouldn't line evaluate to true in a boolean context?

Bret

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



Re: [PHP] quoting values in HTML - is there a diference between ' and

2005-01-20 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
I believe HTML uses ' and  interchangeably.  No real difference.  Well, it 
also depends on the HTML rendering engine too I guess.  IE might do it ok but 
Firefox might not.. things like that.  But I think as far as the spec goes, you can 
use both.In a lot of cases, as long as there are no spaces involved, you can go 
without the quotes too but that's just really poor coding practice I think.
AFAICR  must be used if you want to be compliant - its also obvious 
that you can get away with murder in an HTML page ;-)

I believe they allow single and double quotes to help accomodate client side 
scripting languages like JavaScript where you might have to echo text but still 
be able to break out to perform a function or concatenate a variable or 
something.  If a scripting language only let you use double quotes, then you 
have the option of using single quotes in the HTML you're echoing.  Or vice 
versa.
Firefox's Web Developer extension (which I highly recommend for web developers) 
will tell you if it's using W3 standard (strict), loose or...umm.. something 
else..  for it's rendering of the web page.  That is, if the HTML it's 
interpreting meets strict specs, loose specs, or is just sloppy as crap but 
it's going to do what it can anyway...   basically which facet of it's 
rendering engine is being used to display the page.
-TG
= = = Original message = = =
I always thought quoting values in HTML had to be dome with double
quotes ().  however on reeding some stuff in the PHP manual the
double quotes will cause the string to be interpolated, using single 
quotes will not - e.g.

?
$test = 'test';
echo 'this is a $test'; echo \n;
echo this is a $test; echo \n;
so its 'recommended' to use doubles only when needed, (convienience and 
readability can be requirements :-)
oh and ALWAYS use double quotes if your sending a bit of test code
because that makes it easy to cut'n'paste it into a php -r command on a 
*nix shell.

examples use single quoted.  Single quotes are allot more convenient
as I use double quotes generally for quoting strings.  So are the two
totally synonymous in HTML?
Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Richard Lynch
Tim Boring wrote:
 It's perfectly legit to use expressions.  Now perhaps there is something
 wrong with the regex I'm trying to use, but using a regex in and of
 itself is legal.
 http://www.php.net/manual/en/control-structures.switch.php

Ah...

Well, the User Contributed notes provide some examples, and the manual
says you can use expressions, but nothing clarifies, for me, the
interaction betwee n $x and [expression] in:

switch ($x){
  case [expression]: /* code */; break;
}

Is $x compared to the return value of [expression]?

I think what you need, then, is TRUE instead of $x.

...  I think I'll go out on a limb and say that in MOST CASES it would be
Bad Style to have both $x and [expression]...  I mean, it just gets too
confusing.

And if you expressions also have side-effects (incrementing, for example)
then it would be REALLY UGLY to do, like:

switch ($x){
  case ($x++): /* code */ break;
  case ($x): /* code */ break;
}

[shudder]

I pity the programmer that has to make sense of something as messy as that.

Maybe I'm just missing a really elegant example of how cool this would
be, but it seems rife for confusion to me.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] URGENT: Break-lines disappearing.

2005-01-20 Thread Richard Lynch
 Where are the break-lines?!?!? I am really desperate! Please! I am
 using MySQL and PHP4.

Did you use View Source in your browser, or are you just seeing the data
dumped out to a browser which *IGNORES* line-breaks?...

When you print debug output, use PRE and /PRE around it for
anything that's gonna have line breaks and whatnot in it.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Re: php 5 interfaces

2005-01-20 Thread Jochem Maas
M. Sokolewicz wrote:
Sergio Gorelyshev wrote:
Hi all.
Situation:
interface MyInterface {
 public static myMethod();
}
class MyClass implements MyInterface {
  public static myMethod() {}
}
This sample will crash with message Fatal error: Access type for 
interface method MyInterface::myMethod() must be omitted in 
somefile.php on line NN

Why I'm not able to clarify call's type (static) for methods in 
interface? I'm predict closely that method myMethod() in all classes 
which implements  MyInterface must be called statically. A little 
trick allowed to me to resolve this problem, but my question  more 
ideological than practical.

Thanks
it's not the static part, it's the public part. You can't make 
non-public static methods. It's simply impossible by the definition of 
protected and private (both allow only the object itself to access it, 
or (in case of protected) a descendent).

So, removing the public part should work out fine.
you are half right but for the wrong reason. think about the word 
'interface'  for a moment! its illogical for a interface to define a 
protected/private method (don't argue the gods have already decided :-) 
and its therefore been decided that interfaces are not allowed to have 
access types defined.

the bit where you are wrong is that its quite feasable to have private 
or protected methods - heres a quick grep ('static private function') of 
some of my code:

include\class\ExchRates.class.php(164): static private function 
getConstants()
include\class\Img.class.php(35): static private function checkGD()
include\class\ImgChanger.class.php(124): static private function 
changeGamma($imgFile, $gamma)
include\class\Lang.class.php(453): static private function 
_setLang($lang = null)
include\class\Lang.class.php(646): static private function 
callSmartyModifier($string = '', $modifier = '')
include\class\Msg.class.php(124): static private function 
translate($text = '', $formatMask = 0)
include\class\Msg.class.php(136): static private function stringify($value)
include\class\Upload.class.php(122): static private function 
buildFiles($force = false)
include\class\Zipper.class.php(124): static private function checkforZIP()
include\class\auth\Auth.class.php(117): static private function 
getSessionKey()
include\class\auth\Session.class.php(240): static private function 
loadRegisteredClasses()
include\class\auth\Session.class.php(291): static private function 
privatizeCaching()
include\class\auth\Session.class.php(318): static private function 
chkSessionVarName($varName)
include\class\dynabyte\Comparison.class.php(374): static private 
function array_unique($arr)
include\class\dynabyte\Form.class.php(138): static private function setup()
include\class\dynabyte\Form.class.php(400): static private function 
checkAuthSubmit( $type )
include\class\dynabyte\Form.class.php(438): static private function 
sendEmail( $type )
include\class\dynabyte\Form.class.php(477): static private function 
getSuspectedCustomer()
include\class\dynabyte\Form.class.php(569): static private function 
getEmailAddr( $type )
include\class\dynabyte\Form.class.php(592): static private function 
getCheckedValues( $type )
include\class\persistent\Persistent.class.php(510): static private 
function getSelectClause($className)
include\class\persistent\Persistent.class.php(564): static private 
function getSelectQuery($className,$first, $skip)
include\class\persistent\Persistent.class.php(576): static private 
function getSelectCountClause($className)
include\class\persistent\Persistent.class.php(614): static private 
function getSelectCountQuery($className)
include\class\persistent\Persistent.class.php(623): static private 
function getSQLFieldItem($class, $field, $dir = null)
include\class\persistent\Persistent.class.php(655): static private 
function getOrderBy($class, $order)
include\class\persistent\ResourceFormat.class.php(68): static private 
function getExtensions( $format )
include\class\persistent\ResourceFormat.class.php(95): static private 
function getConstants()
include\class\view\Editizer.class.php(37): static private function 
singleton()
include\class\view\RowHandlers.class.php(122): static private function 
getCustomHandlers($entityName, $interface)
include\class\view\RowHandlers.class.php(146): static private function 
checkHandlers($entityName, $handlers, $popUpURL = '')



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


Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Jason Wong
On Friday 21 January 2005 03:21, Tim Boring wrote:
 On Thu, 2005-01-20 at 13:41, Jason Wong wrote:
  On Friday 21 January 2005 01:52, Tim Boring wrote:
 
  Well the biggest problem in your code right now is your incomprehensible
  (to me anyway) use of the switch construct. For a start I've no idea why
  you're using ...
 
   switch ($line)
 
  ... when your tests do not involve $line
 
   case ($total_counter = 5):

 I see your point, but the other tests do involve $line. This one that
 you reference I'm using for a special need--basically so I leave in
 the initial column headings from the report, because they would match
 several of the tests that would discard those lines.

But as you're using switch ($line) then your tests would have to evaluate to 
$line for the case to be true. AFAICS your preg_match() expressions will not 
return $line. That's why if your test cases involve wildly different things 
you should use:

  I suspect what you want to be doing is something like this:
 
switch (TRUE) {
  case ANY_EXPRESSION_THAT_EVALUATES_TO_TRUE:
  ...
}

 Thanks for the suggestion, but I'm not sure that does what I'm looking
 for.  I really think the problem is with my regex, not necessarily with
 the way I've constructed my switch statement.

 I say this because I have since changed the first word in each line from
 something like AKRN to a numeric value, and everything works just as I
 would expect it to.  

That's probably because you're relying on PHP's auto type conversion when it 
is evaluating your case expressions.

 So it seems as if the ^ might be negating the \W+ 
 part of the regex.  Although that shouldn't be happening because ^
 only acts as a negation when it's used inside brackets, at least
 according the documentation.

In any case you're (apparently (according to the subject)) trying to solve a 
regex problem, but you're muddying the issue by using (IMO) an incorrect 
switch construct. Get each of your preg_match() working properly on their own 
*then* stick them into the switch.

-- 
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
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Richard Lynch
Tim Boring wrote:
 On Thu, 2005-01-20 at 13:41, Jason Wong wrote:
 On Friday 21 January 2005 01:52, Tim Boring wrote:

 Well the biggest problem in your code right now is your incomprehensible
 (to
 me anyway) use of the switch construct. For a start I've no idea why
 you're
 using ...

  switch ($line)

 ... when your tests do not involve $line

  case ($total_counter = 5):

 I see your point, but the other tests do involve $line. This one that
 you reference I'm using for a special need--basically so I leave in
 the initial column headings from the report, because they would match
 several of the tests that would discard those lines.

My current theory is this:

PHP takes $line and compares it as a scalar to the return value of your
expressions.

Thus, something like:

($total_count = 5) which returns a BOOLEAN is compared to $line, which,
with AKRN at the front, in boolean turns into 1.

However, when you get to ereg_match, which returns, err?, integer, PHP
type-casts to integer, at which point AKRN turns into 0.

This is what I meant when I said it was just too damn confusing to
mix-n-match a value in the switch ($x) with an expression in the case :

I'd say use expressions with switch (TRUE) or swith ($x) with constants
but don't mix-n-match unless you really want to confuse yourself.

I suppose if *ALL* the variables/expresions are of the same data-type, it
would be Not So Bad since there will be none of the PHP
auto-type-conversion to muddy the waters...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] php 5 interfaces

2005-01-20 Thread Jochem Maas
Richard Lynch wrote:
Sergio Gorelyshev wrote:
Hi all.
Situation:
interface MyInterface {
public static myMethod();
}
class MyClass implements MyInterface {
 public static myMethod() {}
}
This sample will crash with message
Fatal error: Access type for interface method MyInterface::myMethod() must
be omitted in somefile.php on line NN
Why I'm not able to clarify call's type (static) for methods in interface?
I'm predict closely that method myMethod() in all classes which implements
MyInterface must be called statically. A little trick allowed to me to
resolve this problem, but my question  more ideological than practical.

As I understand it, an 'interface' is, by definition, never gonna have an
actualy object instantiated.
true but thats not the reason - the reason is because an interface is a 
PUBLIC contract which a class adheres to.

Thus, there can never *BE* an object for which private/public/protected
have any meaning.
private/public/protected have meaning for static/abstract classes.
You can only use the private/public/protected on the 'class' definitions.
I think that should be 'in' iso 'on'
Even if you *KNOW* that all class definitions *should* for this to be
'public' it just doesn't make sense from the strictly technical
stand-point of what an 'interface' is to declare it there.
Maybe somewhere over on php-dev you could make the case for the PHP Dev
Team to implement something good/interesting when public/protected/private
is used there, but currently it's semanticly undefined to have it there,
so it can't be there.
Disclaimer: I could easily be 100% wrong in this entire post. :-)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: phppatterns.com, Nice idea, shame about the site (was Re: [PHP] Re: class structure.)

2005-01-20 Thread Jason Barnett
Ben Edwards wrote:
...
http://phppatterns.com/index.php/article/archive/1/

Cool, thats the type of thing.  Why don't you have a link at the top
with something like 'patterns directory' or alternativly have a 'about
us' link with the stuff at phppatterns and use phppatterns for the
paterns directory.  I would have them listed simplest to more complex.
 i.e. put Singleton at top.
Regards,
Ben
Because, quite honestly, it's not my site.  But you can feel free to 
pass the suggestion on to Harry.  ;)

--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY | 
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins

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


Re: [PHP] Firefox's Web Developer Extension.. Re: [PHP] quoting values in HTML - is there a diference between ' and

2005-01-20 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
Yeah, that looks like it.  Even one little feature like being able to show table cell borders and 
toggle that one and off can be invaluable to someone who habitually goes in and sets a border=1 
for a table then has to go back and do border=0 after checking the table.   The web browser knows 
where all that stuff is, but no browser I've ever seen gives you such easy access to that info.
just to hammer the point home - CSS - the table killer.
I've also used the various disable functions from time to time.. there's even a 
Change GET to POST and vice versa.   Also you can see a list of all form elements and 
their current value (including HIDDEN elements) without having to look at the source code.
Very good stuff.
-TG

Firefox's Web Developer extension (which I highly recommend for web developers) will tell you if it's using W3 standard (strict), loose or...umm.. something else..  for it's rendering of the web page.  That is, if the HTML it's interpreting meets strict specs, loose specs, or is just sloppy as crap but it's going to do what it can anyway...   basically which facet of it's rendering engine is being used to display the page.

Is this http://www.chrispederick.com/work/firefox/webdeveloper/ what
you are refering to?  Looks interesting.  will give it a go tonight.
Ben
___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Problem with hidden form input values

2005-01-20 Thread Jason Wong
On Friday 21 January 2005 03:20, Richard Lynch wrote:

  The *do* POST, but PHP only handles one level of array references in
  NAME=xxx

[snip]

 What you are receiving from HTTP/POST/PHP is the same as:

 $keyField['mb_memberhips][0'] = 'mb_e_id';

 Note the lack of intervening apostrophes you expected:
 $keyField['mb_memberhips']['0'] = 'mb_e_id';

 PHP only parses POST data to *ONE* dimension.

Richard, what ancient version of PHP are we talking about here? Something 
like:

input type=text name=doo[dah][dee][dib][dab] value=dub

and print_r($_POST)

Would result in:

Array
(
[doo] = Array
(
[dah] = Array
(
[dee] = Array
(
[dib] = Array
(
[dab] = dub
)
)
)
)
)

Has worked for ages for me.

-- 
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
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Bret Hughes
On Thu, 2005-01-20 at 13:21, Tim Boring wrote:
 On Thu, 2005-01-20 at 13:41, Jason Wong wrote:
  On Friday 21 January 2005 01:52, Tim Boring wrote:
  
  Well the biggest problem in your code right now is your incomprehensible 
  (to 
  me anyway) use of the switch construct. For a start I've no idea why you're 
  using ...
  
   switch ($line)
  
  ... when your tests do not involve $line
  
   case ($total_counter = 5):
 
 I see your point, but the other tests do involve $line. This one that
 you reference I'm using for a special need--basically so I leave in
 the initial column headings from the report, because they would match
 several of the tests that would discard those lines.
 
  
  I suspect what you want to be doing is something like this:
  
switch (TRUE) {
  case ANY_EXPRESSION_THAT_EVALUATES_TO_TRUE:
  ...
}
 
 Thanks for the suggestion, but I'm not sure that does what I'm looking
 for.  I really think the problem is with my regex, not necessarily with
 the way I've constructed my switch statement.
 
 I say this because I have since changed the first word in each line from
 something like AKRN to a numeric value, and everything works just as I
 would expect it to.  So it seems as if the ^ might be negating the \W+
 part of the regex.  Although that shouldn't be happening because ^
 only acts as a negation when it's used inside brackets, at least
 according the documentation.
 
 Again, thanks for the suggestion!
 

I think I see a possible explanation for the behavior.  preg_replace
does not return a true or false value it returns the string passed as
the subject with any matched replacements done.  Hmm the manual says it
better:

If matches are found, the new subject will be returned, otherwise
subject will be returned unchanged. 

What I think is happening is that the first match is not finding
anything to replace and returning $line unchanged.  the comparison is
true since you are comparing to $line in the switch statement.

I will p[lay with it a bit since it pisses me off when I can't figure
out what is happening.

Bret

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



Re: [PHP] Problem with hidden form input values

2005-01-20 Thread Jochem Maas
Richard Lynch wrote:
Ben Edwards wrote:
On Wed, 19 Jan 2005 15:22:55 -0800 (PST), Richard Lynch [EMAIL PROTECTED]
wrote:
...
PHP only parses POST data to *ONE* dimension.
for the second time now: BULLSHIT - this is not true and has not been 
for along as I have used PHP (and that I was aware of passing around 
funky array structures via POST and GET).

but seeing as Mr. Lynch still uses IE4 then maybe he still runs PHP3 - 
in which case he could be right about his setup.

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


RE: [PHP] Seemingly weird regex problem

2005-01-20 Thread Michael Sims
Tim Boring wrote:
 On Thu, 2005-01-20 at 13:41, Jason Wong wrote:
 I suspect what you want to be doing is something like this:

   switch (TRUE) {
 case ANY_EXPRESSION_THAT_EVALUATES_TO_TRUE:
 ...
   }

 Thanks for the suggestion, but I'm not sure that does what I'm looking
 for.  I really think the problem is with my regex, not necessarily
 with the way I've constructed my switch statement.

No, Jason is right.  Your problem IS in the switch statement.  You cannot use 
it the
way you are trying to and get the results you're expecting.  Each case 
expression is
evaluated with the switch expression just as if you compared them with the ==
operator.  In your case, you're comparing the return value of preg_match() 
against
the $line string.  This isn't what you want.

Here's what happens.  Say your $line contains the string AKRN.  Your regex 
pattern
matches only if the line begins with a non-word character.  A is definitely a 
word
character, so the pattern does not match.  preg_match returns an integer 
indicating
the number of matches, which in this case is 0.

To evaluate your case, PHP does the equivalent of:

if (AKRN... == 0)

which is actually TRUE.  From:

http://www.php.net/manual/en/language.types.string.php#language.types.string.convers
ion

If the string starts with valid numeric data, this will be the value used.
Otherwise, the value will be 0 (zero).

Since AKRN doesn't begin with valid numeric data, it is converted to 0 for the
purposes of the comparison.  Since 0 == 0 the case comparison evaluates to true.

When you switch it to begin with a number, PHP now uses that number.  Say you 
switch
it to 1AKRN.  PHP then will compare 1 == 0 which is false.

To accomplish what you want you'll have to change it to:

switch (true) {
  case ($total_counter = 5):
...
  case (preg_match(...):
...

etc. as Jason suggested.  Why don't you try it and see if it works?

HTH

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



Re: [PHP] Re: class structure.

2005-01-20 Thread Jason Barnett
Richard Lynch wrote:
Jason Barnett wrote:
Think of declaration of properties and methods as a contract.  When
something is public it is available to all of PHP.  When it is private
it is only usable by the class that you define it in.  When it is
protected it is a hybrid; it is usable to the class that defined it and
it can be inherited by classes that extend that class.
So, decide what level of access you really *need* for that property /
method.  If a property is only supposed to be modified by class methods
(for example, a password string) then make it private or possibly
protected.  If everything is public access then there is temptation to
do something like:

Back in the day, I used to code in C++
Nothing irked me more than some so-called programmer who would
over-zealously make every damned thing private.
I'd go and sub-class it, and want to make my extended class actually
USEFUL and be ham-strung by his short-sightedness.
Punk.  ;)
You know as well as I do that is the reason why we have protected 
members.  And it is also why we use PHP: because we can quickly change 
the source to fit whatever are our new requirements.  Actually I find 
myself using public / protected members about 90% of the time... 
reserving private members only for things that just don't make sense in 
a subclass.  Or, things that *should* be different in a subclass (for 
example, DSN information on a database class).

So when you ask yourself Self, should this be public, protected, or
private? make sure you phrase it as:
Can I think of ANY way in the future that some other cool programmer
would want to do fun and interesting and useful things with this?
Let the flames begin :-)
The roof.  The roof.  The roof is on fire.  ;)
Isn't everything in life a trade off?  As I see it using private vs. 
protected vs. public is a tradeoff between flexibility and 
maintainability.  If a member is private and its value is somehow messed 
up, well I know that it had to have been messed up somewhere in *that* 
class.  If it's protected then the possible error points include the 
subclasses.  If it's public, well then I could have goofed up anywhere 
(and believe me I DO!)

Call me crazy, but didn't someone just a few weeks ago suggest you try 
to LIMIT the number of places where a bug can be found?  ;)

But I digress.  I said it before and I'll say it again: it's a trade off.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY | 
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins

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


[PHP] Providing a means for the surfer to send a file

2005-01-20 Thread Todd Cary




I am looking for some sample code on setting up a page that provides a
means for the surfer to send a file to the server.

Todd
-- 



inline: NewLogo.gif

Re: [PHP] Firefox's Web Developer Extension.. Re: [PHP] quoting values in HTML - is there a diference between ' and

2005-01-20 Thread tg-php
 just to hammer the point home - CSS - the table killer.

I still like tables.  Absolute positioning be damned.  Most times I'm perfectly 
happy letting the browser figure out where to put things without being 
explicit.   Given, I need to do more work with CSS, but one thing I know that 
drives me absolutely crazy is when I hit a web page that uses too much CSS and 
it looks like total crap until it finishes loading everything (looks like a 
hard computer crash or something).  I know I know.. .. if it's done RIGHT that 
doesn't happen.

Anyway. Tables are still cool in my book.  Style and new standards be damned.

-TG

___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Tim Boring
On Thu, 2005-01-20 at 14:40, Bret Hughes wrote:
 On Thu, 2005-01-20 at 12:43, Jason Wong wrote:
  On Friday 21 January 2005 02:16, Tim Boring wrote:
  
   It's perfectly legit to use expressions.  Now perhaps there is something
   wrong with the regex I'm trying to use, but using a regex in and of
   itself is legal.
   http://www.php.net/manual/en/control-structures.switch.php
  
  Yes, but comparing those expressions to:
  
switch ($line)
  
  where $line is a string, doesn't make sense. See my other post.
  
 
 Chaching ( sound of light bulb turning on)  I see that in the example in
 the manual it needs to be compared to true ( a boolean value)
 
 
 switch (true)
 
 rather than switch ($line)
 
 What is not apparent to me is why the first case matches if the preg
 fails.  Wouldn't line evaluate to true in a boolean context?

Yeah, the light bulb just turned on for me, too.  I'll play around with
this and change it to boolean, but it still bothers me.  

My thinking was that $line was the expression that I wanted the switch
construct to evaluate based on each case statement.  Thus, if the regex
turned out to be true, then it matched that case and would perform
whatever code was in that branch.

Weirdest of all, however, is that I've gone into the source input file
and changed the first word in each line from text to a numeric value. 
And the switch statement works just fine.

Thanks for the help!

Tim
 
 
 Bret
-- 
Tim Boring
IT Department, Automotive Distributors
Toll Free: 800-421-5556 x3007
Direct: 614-532-4240
E-mail: [EMAIL PROTECTED]

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



Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Tim Boring
On Thu, 2005-01-20 at 13:43, Jason Wong wrote:
 On Friday 21 January 2005 02:16, Tim Boring wrote:
 
  It's perfectly legit to use expressions.  Now perhaps there is something
  wrong with the regex I'm trying to use, but using a regex in and of
  itself is legal.
  http://www.php.net/manual/en/control-structures.switch.php
 
 Yes, but comparing those expressions to:
 
   switch ($line)
 
 where $line is a string, doesn't make sense. See my other post.

Thanks, Jason!  I'll try this and see what I get.

Tim

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



Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Bret Hughes
On Thu, 2005-01-20 at 14:06, Bret Hughes wrote:

 
 I think I see a possible explanation for the behavior.  preg_replace
 does not return a true or false value it returns the string passed as
 the subject with any matched replacements done.  Hmm the manual says it
 better:
 
 If matches are found, the new subject will be returned, otherwise
 subject will be returned unchanged. 
 
 What I think is happening is that the first match is not finding
 anything to replace and returning $line unchanged.  the comparison is
 true since you are comparing to $line in the switch statement.
 
 I will p[lay with it a bit since it pisses me off when I can't figure
 out what is happening.


Well it sure is easier to debug when you are looking at the right
frigging function.  I think the logic error is still similar you are
comparing two values that are not meant to be compared.  

Since if an integer is involved in a comparison, and it is here since
preg_match returns an integer, the string will be converted to an
integer.  IIRC string to integer conversion results in 0 if the string
does not look like number.

Since the match is not found, preg_match returns 0 compared to the
string contained in $line will be converted to 0 ( if it begins with a
letter its integer represetation is 0) the case mathes and the block
executes.

That and the first case is totally misued.  you are trying to use the
switch as a series of ifs and the analogy only holds true if the
comparison is the same.

I would not hesitate to rewrite this and encourage you to do so because
even if you get it to work as intended it is not clear what you are
trying to do.

Bret

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



RE: [PHP] Seemingly weird regex problem

2005-01-20 Thread Tim Boring
On Thu, 2005-01-20 at 15:13, Michael Sims wrote:
 Tim Boring wrote:
  On Thu, 2005-01-20 at 13:41, Jason Wong wrote:
  I suspect what you want to be doing is something like this:
 
switch (TRUE) {
  case ANY_EXPRESSION_THAT_EVALUATES_TO_TRUE:
  ...
}
 
  Thanks for the suggestion, but I'm not sure that does what I'm looking
  for.  I really think the problem is with my regex, not necessarily
  with the way I've constructed my switch statement.
 
 No, Jason is right.  Your problem IS in the switch statement.  You cannot use 
 it the
 way you are trying to and get the results you're expecting.  Each case 
 expression is
 evaluated with the switch expression just as if you compared them with the 
 ==
 operator.  In your case, you're comparing the return value of preg_match() 
 against
 the $line string.  This isn't what you want.
 
 Here's what happens.  Say your $line contains the string AKRN.  Your regex 
 pattern
 matches only if the line begins with a non-word character.  A is definitely 
 a word
 character, so the pattern does not match.  preg_match returns an integer 
 indicating
 the number of matches, which in this case is 0.
 
 To evaluate your case, PHP does the equivalent of:
 
 if (AKRN... == 0)
 
 which is actually TRUE.  From:
 
 http://www.php.net/manual/en/language.types.string.php#language.types.string.convers
 ion
 
 If the string starts with valid numeric data, this will be the value used.
 Otherwise, the value will be 0 (zero).
 
 Since AKRN doesn't begin with valid numeric data, it is converted to 0 for 
 the
 purposes of the comparison.  Since 0 == 0 the case comparison evaluates to 
 true.
 
 When you switch it to begin with a number, PHP now uses that number.  Say you 
 switch
 it to 1AKRN.  PHP then will compare 1 == 0 which is false.
 
 To accomplish what you want you'll have to change it to:
 
 switch (true) {
   case ($total_counter = 5):
 ...
   case (preg_match(...):
 ...
 
 etc. as Jason suggested.  Why don't you try it and see if it works?
 
 HTH

I tried it and it worked as Jason explained.  Sorry, I'm a little 
slow at times.  Thanks for taking the time and effort to explain 
this in more detail!

Tim

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



Re: [PHP] Providing a means for the surfer to send a file

2005-01-20 Thread Bret Hughes
On Thu, 2005-01-20 at 14:03, Todd Cary wrote:
 I am looking for some sample code on setting up a page that provides a 
 means for the surfer to send a file to the server.

Hmm lets see:

http://www.google.com/search?hl=enlr=q=html+file+upload+phpbtnG=Search

First hit looks promising.

Bret

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



Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Jochem Maas
Tim Boring wrote:
Hello!  I'm having an odd regex problem.  Here's a summary of what I'm
trying to accomplish:
I've got a report file generated from our business management system
(Progress 4GL), one fixed-width record per line.  I've got a php script
that reads in the raw file one line at a time, and strips out any
unwanted lines (repeated column headings, mostly).  

I'm stripping out unwanted lines by looking at the beginning of each
line and doing the following:
1. If the line begins with a non-word character (\W+), discard it;
2. If the line begins with the word Vendor, discard it;
3. If the line begins with Loc, discard it;
4. If the line begins with a dash, discard it;
5. Else keep the line and write it to an output file.
The way I've implemented this in code is via the code snippet below. 
The problem I'm encountering, however, is that any line that begins with
a word, such as AKRN, is matching rule #1, thus discarding the line. 
This is not what I want, but I'm having difficulty spotting my mistake. 

To try to help spot the issue, I put in the if(preg_match(/^\W+/,
$line)) logic, and the weird thing is that this logic isn't outputting
the line beginning with things like AKRN, yet the same line is getting
caught in the switch statement and being discarded.
Any suggestions?
 while (!feof($input_handle))
 {
$line = fgets($input_handle);
 
\W is every NON-word character.
if (preg_match(/^\W+/, $line))
{
manual says: preg_match() returns the number of times pattern matches. 
That will be either 0 times (no match) or 1 time because preg_match() 
will stop searching after the first match.

so $line will be a string.
  echo $line\n;
}
 
if the string is 0 bytes long the switch will equate to
false and match the first false case expression.
switch ($line)
{
is $total_counter less than or equal to 5?
if yes then this case runs. else...
case ($total_counter = 5):
fwrite($output_handle, $line);
$counter++;
$total_counter++;
break;
   // Rule #1: non-word character
if $line is empty the it typecasts to boolean as false.
if the regexp does not find match (which it wouldn't in the case of an 
the empty string) then preg_match returns false. so this case always 
runs when line is empty.

probably every $line will fire this case.
   case preg_match(/^\W+/, $line):
  array_push($tossed_lines, $line);
  echo Rule #1 violation\n;
  $tossed_counter++;
  $total_counter++;
  break;
// Rule #2: Vendor at beginning of line
none of the rest will fire if $line is empty.
this case should fire if $line is not empty and starts with 'Vendor' 
(case insensitive). non empty string and numeric 1 (return val from 
preg_match()) both equate to true.

yadda yadda yadda... I just played a little test on PHP5 regarding this 
little problem. its all a misunderstanding regarding automatic 
typecasting of strings I think:

$ php -r '
switch () {
   case 0:echo hello\n;
}
switch (yes) {
   case 1:echo hello again\n;
}
switch () {
   case 1:echo huh?\n;
}
switch (yes) {
   case 0:echo huh again?\n;
}
assert( == 0);
assert(yes == 1);
assert( == 1);
assert(yes == 0);
switch (1yes) {
   case 1: echo oh?\n;
}
switch (0yes) {
   case 0: echo geddit?\n;
}
'
hello
huh again?
Warning: assert(): Assertion failed in Command line code on line 17
Warning: assert(): Assertion failed in Command line code on line 18
oh?
geddit?
PHP 5.0.2 (cli) (built: Oct 21 2004 13:52:27)


case preg_match(/^Vendor/i, $line):
  array_push($tossed_lines, $line);
  echo Rule #2 violation\n;
  $tossed_counter++;
  $total_counter++;
  break;
   // Rule #3: Loc at beginning of line
case preg_match(/^Loc/i, $line):
  array_push($tossed_lines, $line);
  echo Rule #3 violation\n;
  $tossed_counter++;
  $total_counter++;
  break;
   // Rule #4: dash character at beginning of line

I think the /^\W+/ above will always catch this case first..
change the order of the case statements?
case preg_match(/^\-/, $line):
   array_push($tossed_lines, $line);
   echo Rule #4 violation\n;
   $tossed_counter++;
   $total_counter++;
   break;
default:
   fwrite($output_handle, $line);
   $counter++;
   $total_counter++;
   break;
   }
 }
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Providing a means for the surfer to send a file

2005-01-20 Thread Jay Blanchard
[snip]
I am looking for some sample code on setting up a page that provides a
means for the surfer to send a file to the server.
[/snip]

? Do you mean a file upload?

http://us3.php.net/manual/en/features.file-upload.php

BTW, HTML e-mail to a list is just bad karma dude.

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



Re: [PHP] Problem with hidden form input values

2005-01-20 Thread Richard Lynch
Jochem Maas wrote:
 Richard Lynch wrote:
 Ben Edwards wrote:

On Wed, 19 Jan 2005 15:22:55 -0800 (PST), Richard Lynch [EMAIL PROTECTED]
wrote:


 ...


 PHP only parses POST data to *ONE* dimension.


 for the second time now: BULLSHIT - this is not true and has not been
 for along as I have used PHP (and that I was aware of passing around
 funky array structures via POST and GET).

 but seeing as Mr. Lynch still uses IE4 then maybe he still runs PHP3 -
 in which case he could be right about his setup.

This probably *IS* an artifact in my brain from PHP3 days.

Sorry.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Upgrading PHP 4.2.2 on Red Hat 9

2005-01-20 Thread James Butler
Greetings,

Has anyone successfully upgraded a PHP 4.2.2 installation on a
Red Hat 9 machine to a more secure version?

I just want any more-secure version of PHP than 4.2.2, but it's looking
like I'll have to use Fedora or Gentoo or Mandrake or something in order

to be successful. Of course, this means arranging for a different
host/dedicated server ...

My main issue is that libdb-4.0.so is needed by existing installations
of curl, python, pam, cyrus, webalizer, db4, perl, postfix, sendmail,
perl-DB_File and on and on. And that's not even close to the end of the
old program dependencies list.

Upgrading via rpm is going to be a humongous pain if I have to upgrade
every program listed in the dependencies (rpm -Uvh --test), even if I
can figure out which order they need to be done in.

Building from source kills my httpd process so that it cannot be
restarted. Last two times I tried that I had to restore from my Apache
backup files, clean out the more recent PHP install and reinstall
v.4.2.2 in order to get everything up and running again. And that was an

attempt to get up to 4.3.10! Forget about v.5.0.3!

PHP.net says to be sure to upgrade ... but there's no indication of
what that means, or how to do it, or in what order all of the dependent
programs should be upgraded (if neccessary). I can find no step-by-step
upgrading instructions in any PHP or Linux newsgroup, forum, or doc.
There's no 4.2.2 to 4.3.x patch. I understand that there are manymany
upgrade details that are machine-and-OS-dependent, but I could use ANY
kind of help with this at all besides be sure to upgrade.

So I come here. (php.install hasn't had an entry for a long time, and
php.migration ended in 2001)

I'll post data, config settings, whatever you think might be helpful.
I'm hoping for someone to say First, do this ...; then, do this ...,
if at all possible. I'll even take Here's how I did it ...

Thanks in advance for ANY help at all.

James

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



[PHP] Re: [PHP-DB] php5 busts php4 code

2005-01-20 Thread Jochem Maas
Hassan Ebrahimi-Nuyken wrote:
Thank you Martin  Richard,
First Richard's question:
I am using the preconfigured binary install package
for Mac OS X 10.3.7 from Marc Liyanage at:
http://www.entropy.ch/
It has support for mysql compiled into it with
the mysql client library ver. 4.1.3beta as

if he's using MySQL 4.1.x should he be using the mysqli_*() functions
instead of the mysql_*() functions?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] For HomeSite users...

2005-01-20 Thread Daevid Vincent
OMG!

This is quite possibly the coolest thing I've found in a while, and it
breathes new life into my aging HomeSite+ v5.2 (now that Macromedia isn't
really updating it and is focusing more on their DreamWeaver line).

http://www.wilk4.com/asp4hs/installation.htm#parser

http://www.wilk4.com/asp4hs/dnld/php5_parser_js.zip

http://www.wilk4.com/asp4hs/list2.htm

Just look around all those links and you will find an abundance of useful
toolbars, PHP5 color coders, snippets, context manuals, etc. I nearly
spooged on myself when I came across this today. (no pun intended)

Jeremy Swinborne [EMAIL PROTECTED] created a PHP5 color coding .scc
file that is just a life saver. It fixes many of the short comings of the
default PHP4 color coder. It handles stuff like:

echo \this is embeded $variable in my output\; and it knows about
classes!


daevid.com

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



Re: [PHP] For HomeSite users...

2005-01-20 Thread daniel
I havent used Homesite in years, I am now an Eclipse advocate :)

www.phpeclipse.org :)


 OMG!

 This is quite possibly the coolest thing I've found in a while, and it
 breathes new life into my aging HomeSite+ v5.2 (now that Macromedia
 isn't really updating it and is focusing more on their DreamWeaver
 line).

 http://www.wilk4.com/asp4hs/installation.htm#parser

 http://www.wilk4.com/asp4hs/dnld/php5_parser_js.zip

 http://www.wilk4.com/asp4hs/list2.htm

 Just look around all those links and you will find an abundance of
 useful toolbars, PHP5 color coders, snippets, context manuals, etc. I
 nearly spooged on myself when I came across this today. (no pun
 intended)

 Jeremy Swinborne [EMAIL PROTECTED] created a PHP5 color coding
 .scc file that is just a life saver. It fixes many of the short comings
 of the default PHP4 color coder. It handles stuff like:

 echo \this is embeded $variable in my output\; and it knows about
 classes!


 daevid.com

 --
 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] Upgrading PHP 4.2.2 on Red Hat 9

2005-01-20 Thread Bret Hughes
On Thu, 2005-01-20 at 18:12, James Butler wrote:
 Greetings,
 
 Has anyone successfully upgraded a PHP 4.2.2 installation on a
 Red Hat 9 machine to a more secure version?
 
 I just want any more-secure version of PHP than 4.2.2, but it's looking
 like I'll have to use Fedora or Gentoo or Mandrake or something in order

snip
 Thanks in advance for ANY help at all.
 

Redhat used to do a pretty good job of backporting security issues and I
am assuming that fedoralegacy.org is still doing it.  There are php rpms
out there dated October so I it looks like to me they are trying to keep
up.

http://download.fedoralegacy.org/redhat/9/updates/i386/

you might take a look at the changelog to see if the fix you are worried
about is there.

Bret

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



Re: [PHP] debugging modules

2005-01-20 Thread Rasmus Lerdorf
Arshavir Grigorian wrote:
Hi,
I am having trouble debugging a PECL module (APC) because while I am 
able to --enable-debug when configuring the PHP course, I cannot do the 
same for APC (no such configure option). Does anyone know how to do that?

PHP Warning:  Unknown(): apc: Unable to initialize module\nModule 
compiled with module API=20020429, debug=0, thread-safety=0\nPHP
compiled with module API=20020429, debug=1, thread-safety=0\nThese 
options need to match\n in Unknown on line 0
You need to make install after compiling PHP with --enable-debug to get 
phpize and php-config to inherit the debug flag which will cause apc to 
be built with debug mode when you run phpize in the apc directory.

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


  1   2   >