[PHP] Sphinx Open Source Text Based Search

2008-10-14 Thread Hemant Patel
Hello Everyone, I want to configure my text based
search with sphinx Search in PHP.Can anybody give any link to explore it
other than its own site.(Other Than Documentation).I want to learn
thorough process followed by sphinx...How indexing and searching happen
in sphinx...?


With Regards,
Hemant Patel


Re: [PHP] Little regex help please...

2008-10-14 Thread Richard Heyes
> /http:\/\/www\.asdf\.com\/blah\/foobar\.php/i ... looks like a zig-zaggy 
> mess. :)

Perhaps it was meant to... :-)

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org

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



Re: [PHP] New to this group....a continuation

2008-10-14 Thread Jason Pruim


On Oct 14, 2008, at 8:23 AM, Jay Blanchard wrote:


[snip]
... oh and we're all a bunch of pirates, except for Tedd ... he's a
retired pirate.
[/snip]

I thought he was semi-retired, or was it re-tread? Meh.


re-tread? Someone pulled off his old skin, and put new, younger  
looking skin on? Might work on the outside but nothing can change the  
fact that the tire is still old :P



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



Re: [PHP] New to PHP

2008-10-14 Thread Ben Stones
There are many places to get help when you need it, but a good place is the
unofficial PHP IRC channel. Search on Google for XChat, download it, and
connect to ##PHP in irc.freenode.net. Great place and it seriously has
helped me once or twice. If you don't know about how to use IRC, search on
Google :).

The best bet to grasping PHP logic itself is finding small scripts to learn
and tamper with. Go to www.hotscripts.com and find some unhelpful scripts
from there that you can learn from and modify. Best way of learning PHP
really :). If you are only just starting, tizag.com is a good place to learn
the basics.

Good luck!

2008/10/13 Gary <[EMAIL PROTECTED]>

> I am just starting to learn php, and typically I use newsgroups to
> suppliment the learning process.
>
> Does anyone have any sources that you would reccommend to me and is this
> the
> best NG for me to monitor?...or is there another you might suggest?
>
> Thanks
>
> Gary
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Colin Guthrie

Jason Pruim wrote:

Or, seeing as I'm a stickler for compact code:

if(!empty($_SESSION['userInfo']['loggedin'])) {

empty() is like isset() but tests for all sorts of "empty" cases ('', 
false, null and 0 are all considered, "empty").


Hey Colin,

Does the ! reverse the empty in this case? such as !empty = not empty?


Yes. That's what the ! always does. It's the "not" operator in PHP (and 
most languages):


http://uk3.php.net/manual/en/language.operators.logical.php

Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] 1 last error to fix before the application is done!

2008-10-14 Thread Jochem Maas
Jason Pruim schreef:
> Good morning everyone!
> 
> I think I might be having a "to early in the morning/not enough
> caffeine" moment... But I am down to 1 error on my timecard application
> that I would like to clean up. It's a small undefined index error, and
> the program works jsut fine the way it is, but why leave an error if you
> don't need to? :)
> 
> Here is the error:
> 
> [Tue Oct 14 08:19:47 2008] [error] PHP Notice:  Undefined index: 
> userInfo in
> /Volumes/RAIDer/webserver/Documents/dev/stimecard/inc/function/authentication.func.php
> on line 22
> 
> and here is the relevant code:
> 
> ==> Line 22if($_SESSION['userInfo']['loggedin'] == TRUE) {
>

if(isset($_SESSION['userInfo']['loggedin']) && 
$_SESSION['userInfo']['loggedin'] == TRUE) {

...

now go and walk the plank.

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



[PHP] 1 last error to fix before the application is done!

2008-10-14 Thread Jason Pruim

Good morning everyone!

I think I might be having a "to early in the morning/not enough  
caffeine" moment... But I am down to 1 error on my timecard  
application that I would like to clean up. It's a small undefined  
index error, and the program works jsut fine the way it is, but why  
leave an error if you don't need to? :)


Here is the error:

[Tue Oct 14 08:19:47 2008] [error] PHP Notice:  Undefined index:   
userInfo in /Volumes/RAIDer/webserver/Documents/dev/stimecard/inc/ 
function/authentication.func.php on line 22


and here is the relevant code:

==> Line 22  if($_SESSION['userInfo']['loggedin'] == TRUE) {

return TRUE;
}else{

if(is_array($row1)){


$_SESSION['userInfo'] = array( "authname" => $row1['username'],  
"loggedin" => TRUE, "fullname" => $row1['Name'], "empID" =>  
$row1['empID'], "authLevel" => $row1['authLevel']);



}

else
{
//$_SESSION['userInfo'] =array("loggedin" => 
FALSE);
die('authentication failed');

}
}

What I'm trying to do, is if the person already has a valid session, I  
want to skip over resetting all the variables, and just log them in.  
BUT if they have no session, and the auth returned an array, then have  
it set the variables. Or if they type in the wrong password it just  
dies... I may change that if I decide to release the code to the  
public so that it is handled more gracefully, but it works fine for my  
purposes right now :)


So... With all that said, anyone have any idea how to get rid of my  
error other then setting error reporting to none?


Thanks for taking the time to read this!

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]






[PHP] Re: BarcodeDB.com - a Barcode Database

2008-10-14 Thread Colin Guthrie

Alex Chamberlain wrote:

I wish to set up a similar website. Indexed on the modern EAN-13 (used
across the world, and includes ISBNs), the database will store a barcode and
name for *every* product. Additionally, the description of the product can
be stored. In the future, I would like to implement a 'tag-type' system,
whereby a tag, consisting of name (eg Author) and value (eg JK Rowling), can
be assigned to one or more objects. These tags could include links to
publicly available images etc. The country of registration of each product
can be derived from the barcode itself.


While not directly relevant the best book-specific system in this area 
I've seen is:

http://www.librarything.com/

It allows you to hook up a barcode scanner and scan in your books pretty 
quickly. It's quite nice.




I know a very basic database is easy to setup - I did it in a day or two,
but I am struggling with the user management side, including the
authentication of API access, as well as how to implement a 'pending' list.
Has anybody got any ideas?? Is there any (free) software out there capable
of this?? If anybody else wishes to contribute to this very young project, I
am open to ideas ([EMAIL PROTECTED]). Hosting is sorted and I own
BarcodeDB.com and .co.uk


I personally perfer the "API Key" approach where a user will generate an 
API key that is linked to their user account and can be embedded into 
remote applications etc. A simple interface to generate and revoke API 
keys should be available somewhere within your application.


You can then use this API key in your requests as you see fit. An API 
key would typically take the form of a UUID (try SELECT UUID(); in mysql)


It's obviously open to snooping and other such nefarious acts and if you 
want to do a more stringent test you should use some form of digest 
authentication which will require two way communication.


If this is too complex, running your API over SSL should cut down on the 
snooping risk and grabbing the API keys.


The good thing about using API keys like this is you can setup various 
things in your app as you see fit, like a TTL (time to live) or specific 
(i.e. restricted) permissions assigned to different API keys generated 
by a user.


Col


--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Andrew Ballard
On Tue, Oct 14, 2008 at 8:52 AM, Colin Guthrie <[EMAIL PROTECTED]> wrote:
> Yeti wrote:
>>
>> You might also want to try array_key_exists
>>
>> if (array_key_exists('loggedin', $_SESSION['userInfo'])) {
>> // do something with $_SESSION['userInfo']['loggedin']
>> }
>
> You'd first need to check that the key 'userInfo' existed in the $_SESSION
> array too.
>
> Personally, I very rarely see the point in using array_key_exists... It's a
> function call and has overhead where as isset() and empty() are language
> constructs and (I would hope) are much more efficient (although I've not
> done any benchmarks).
>

I've heard that a lot, but I just don't see it. I'm sure some of you
can come up with better tests than this, but here is what I used:



Sample Results:
Completed 5 iterations using isset() in 1.6928939819336 seconds.
Average time per function call: 3.3857879638672E-005

Completed 5 iterations using empty() in 1.6825141906738 seconds.
Average time per function call: 3.3650283813477E-005

Completed 5 iterations using array_key_exists() in 1.7125430107117 seconds.
Average time per function call: 3.4250860214233E-005

Based on these results, I'd hardly use the "language construct versus
function call" optimization argument to make my decision. I'm not sure
if this is a testament to improvements in the PHP engine over the last
couple years, or if equipment has gotten fast enough that the
differences have become irrelevant. Quite possibly, it's both.

Andrew

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



[PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Colin Guthrie

Yeti wrote:

Personally, I very rarely see the point in using array_key_exists... It's a 
function call and has overhead where as isset() and empty() are language 
constructs and (I would hope) are much more efficient (although I've not done 
any benchmarks)


# i don't know what's wrong with this ..

$foo = array();
$foo['bar'] = null;
if (array_key_exists('bar', $foo)) {
 switch ($foo['bar']) {
  case true:
   //do something
   break 1;
  default:
   //do something else
}
}

# if that's causing more overhead then let me see your benchmark, then
i believe it


I don't really get what you're trying to say here.

All I'm saying is that empty(), as a language construct, should be more 
efficient than the resulting function call overhead when using 
array_key_exists().


As I highlighted in my previous example, the only way to test of an 
array has an index which is set to null is to use the array_key_exists() 
function as both isset() (also a language construct) and empty() will 
not be able to tell you this.


So your example above (which sets an array index to null) is the only 
way to do what you want to do (the switch() is overkill for an if/else 
scenario but that's beside the point).



All I was saying was that for an array index value that is set to a 
known true/false value, or not set at all, using !empty() to test for 
when the value is true is the most efficient way.


Consider the following two attached test cases to check for a true 
value, two indexes deep in the array. One uses two calls to 
array_key_exits and then a comparison, the other uses !empty(). They are 
functionally equivalent but the results speak for themselves:


[EMAIL PROTECTED] 0.11]$ time php test1.php
Done: 1000
13.76user 0.01system 0:14.08elapsed 97%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2805minor)pagefaults 0swaps
[EMAIL PROTECTED] 0.11]$ time php test2.php
Done: 1000
3.06user 0.03system 0:03.13elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2797minor)pagefaults 0swaps


And a repeat for random variations:

[EMAIL PROTECTED] 0.11]$ time php test1.php
Done: 1000
14.58user 0.05system 0:14.77elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2805minor)pagefaults 0swaps
[EMAIL PROTECTED] 0.11]$ time php test2.php
Done: 1000
3.01user 0.01system 0:03.06elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2797minor)pagefaults 0swaps


There's a benchmark for you (not sure if it's the one you wanted) which 
proves that the !empty() is ~4.5x faster.


 Use !empty() :p

Col


--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


test1.php
Description: application/php


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

RE: [PHP] Re: BarcodeDB.com - a Barcode Database

2008-10-14 Thread Alex Chamberlain
Thanks for your suggestion!! Sounds like a good route to go down with the API 
access. Really struggling with the pending 'list' at the moment. Suppose I have 
got 2 tables `product` and `description`. `product` contains `EAN`, `name`, 
`last_modified` and `description` contains `EAN` and `description`. The nearest 
thing to me right now is a tub of pencils.

EAN: 5011772007888
Name: 50 Staedtler HB Pencils
Description: A tub of 50 HB Pencils by Staedtler.

Suppose someone at BarcodeDB.com, having signed in, wanted to change the 
description to: A tub of 50 HB Pencils by Staedtler. With strong break 
resistant leads, they make an ideal pencil for kids or adults alike.

Rather than update this description straight into the database. It would be 
nice for it to wait to be approved, and once approved a 'history' is kept so it 
is known who submitted the data and who approved it. Any ideas on how to 
achieve this effectively??

Thanks,

Alex

No virus found in this outgoing message. Scanned by AVG Free 8.0
Checked by AVG - http://www.avg.com 
Version: 8.0.173 / Virus Database: 270.8.0/1722 - Release Date: 14/10/2008 02:02


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



RE: [PHP] Re: BarcodeDB.com - a Barcode Database

2008-10-14 Thread Per Jessen
Alex Chamberlain wrote:

> Thanks for your suggestion!! Sounds like a good route to go down with
> the API access. Really struggling with the pending 'list' at the
> moment. 

Seems to me that 'pending' is just a flag - your list is then all of the
codes with flag=pending.  

> Suppose someone at BarcodeDB.com, having signed in, wanted to change
> the description to: A tub of 50 HB Pencils by Staedtler. With strong
> break resistant leads, they make an ideal pencil for kids or adults
> alike.
> 
> Rather than update this description straight into the database. It
> would be nice for it to wait to be approved, and once approved a
> 'history' is kept so it is known who submitted the data and who
> approved it. Any ideas on how to achieve this effectively??

You keep logs of all changes.


/Per Jessen, Zürich


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



Re: [PHP] PHP to get File Type

2008-10-14 Thread uaca man
There is a more elegant way:

http://br2.php.net/manual/en/function.mime-content-type.php

and the preferred way:

http://br2.php.net/manual/en/function.finfo-file.php

Angelo



2008/10/14 Aschwin Wesselius <[EMAIL PROTECTED]>

> Manoj Singh wrote:
>
>> Hello All,
>> Is there any function in PHP to get the file/Mime type of any file?
>>
>> Any help will be appreciated.
>>
> Hi,
>
> There are better and more elegant ways to do this, but I'm not aware of
> them.
>
> Here is what I use most of the time. You only use the filename as $value
> for get_mimetype().
>
>   function get_file_extension($file) {
>
>   return array_pop(explode('.',$file));
>   }
>
>   function get_mimetype($value='') {
>
>   $ct['htm'] = 'text/html';
>   $ct['html'] = 'text/html';
>   $ct['txt'] = 'text/plain';
>   $ct['asc'] = 'text/plain';
>   $ct['bmp'] = 'image/bmp';
>   $ct['gif'] = 'image/gif';
>   $ct['jpeg'] = 'image/jpeg';
>   $ct['jpg'] = 'image/jpeg';
>   $ct['jpe'] = 'image/jpeg';
>   $ct['png'] = 'image/png';
>   $ct['ico'] = 'image/vnd.microsoft.icon';
>   $ct['mpeg'] = 'video/mpeg';
>   $ct['mpg'] = 'video/mpeg';
>   $ct['mpe'] = 'video/mpeg';
>   $ct['qt'] = 'video/quicktime';
>   $ct['mov'] = 'video/quicktime';
>   $ct['avi']  = 'video/x-msvideo';
>   $ct['wmv'] = 'video/x-ms-wmv';
>   $ct['mp2'] = 'audio/mpeg';
>   $ct['mp3'] = 'audio/mpeg';
>   $ct['rm'] = 'audio/x-pn-realaudio';
>   $ct['ram'] = 'audio/x-pn-realaudio';
>   $ct['rpm'] = 'audio/x-pn-realaudio-plugin';
>   $ct['ra'] = 'audio/x-realaudio';
>   $ct['wav'] = 'audio/x-wav';
>   $ct['css'] = 'text/css';
>   $ct['zip'] = 'application/zip';
>   $ct['pdf'] = 'application/pdf';
>   $ct['doc'] = 'application/msword';
>   $ct['bin'] = 'application/octet-stream';
>   $ct['exe'] = 'application/octet-stream';
>   $ct['class']= 'application/octet-stream';
>   $ct['dll'] = 'application/octet-stream';
>   $ct['xls'] = 'application/vnd.ms-excel';
>   $ct['ppt'] = 'application/vnd.ms-powerpoint';
>   $ct['wbxml']= 'application/vnd.wap.wbxml';
>   $ct['wmlc'] = 'application/vnd.wap.wmlc';
>   $ct['wmlsc']= 'application/vnd.wap.wmlscriptc';
>   $ct['dvi'] = 'application/x-dvi';
>   $ct['spl'] = 'application/x-futuresplash';
>   $ct['gtar'] = 'application/x-gtar';
>   $ct['gzip'] = 'application/x-gzip';
>   $ct['js'] = 'application/x-javascript';
>   $ct['swf'] = 'application/x-shockwave-flash';
>   $ct['tar'] = 'application/x-tar';
>   $ct['xhtml']= 'application/xhtml+xml';
>   $ct['au'] = 'audio/basic';
>   $ct['snd'] = 'audio/basic';
>   $ct['midi'] = 'audio/midi';
>   $ct['mid'] = 'audio/midi';
>   $ct['m3u'] = 'audio/x-mpegurl';
>   $ct['tiff'] = 'image/tiff';
>   $ct['tif'] = 'image/tiff';
>   $ct['rtf'] = 'text/rtf';
>   $ct['wml'] = 'text/vnd.wap.wml';
>   $ct['wmls'] = 'text/vnd.wap.wmlscript';
>   $ct['xsl'] = 'text/xml';
>   $ct['xml'] = 'text/xml';
>
>   $extension = get_file_extension($value);
>
>   if (!$type = $ct[strtolower($extension)]) {
>
>   $type = 'text/html';
>   }
>
>   return $type;
>
>   }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Re: BarcodeDB.com - a Barcode Database

2008-10-14 Thread Andrew Ballard
On Tue, Oct 14, 2008 at 9:56 AM, Alex Chamberlain
<[EMAIL PROTECTED]> wrote:
> Thanks for your suggestion!! Sounds like a good route to go down with the API 
> access. Really struggling with the pending 'list' at the moment. Suppose I 
> have got 2 tables `product` and `description`. `product` contains `EAN`, 
> `name`, `last_modified` and `description` contains `EAN` and `description`. 
> The nearest thing to me right now is a tub of pencils.
>
> EAN: 5011772007888
> Name: 50 Staedtler HB Pencils
> Description: A tub of 50 HB Pencils by Staedtler.
>
> Suppose someone at BarcodeDB.com, having signed in, wanted to change the 
> description to: A tub of 50 HB Pencils by Staedtler. With strong break 
> resistant leads, they make an ideal pencil for kids or adults alike.
>
> Rather than update this description straight into the database. It would be 
> nice for it to wait to be approved, and once approved a 'history' is kept so 
> it is known who submitted the data and who approved it. Any ideas on how to 
> achieve this effectively??
>
> Thanks,
>
> Alex

If you want to accept/reject an entire set of changes, you could have
a pending_updates table with the same columns as your main table (plus
a primary key to identify one update request from another for the same
product, and to track the date/time/status of the change, etc.) Then
when you approve the change, you can execute something like this
(MySQL):


UPDATE product, pending_updates
   SET product.name = pending_updates.name,
   product.description = pending_updates.description
WHERE  product.EAN = pending_updates.EAN
  AND  pending_updates.sequence_no = ?;

...and then either delete the rows from pending_updates or set a
processing date on them so you don't do the same update again.



Andrew

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



RE: [PHP] Re: BarcodeDB.com - a Barcode Database

2008-10-14 Thread Mayer, Jonathan
Thanks for your suggestion!! Sounds like a good route to go down with the API 
access. Really struggling with the pending 'list' at the moment. Suppose I have 
got 2 tables `product` and `description`. `product` contains `EAN`, `name`, 
`last_modified` and `description` contains `EAN` and `description`. The nearest 
thing to me right now is a tub of pencils.

EAN: 5011772007888
Name: 50 Staedtler HB Pencils
Description: A tub of 50 HB Pencils by Staedtler.

Suppose someone at BarcodeDB.com, having signed in, wanted to change the 
description to: A tub of 50 HB Pencils by Staedtler. With strong break 
resistant leads, they make an ideal pencil for kids or adults alike.

Rather than update this description straight into the database. It would be 
nice for it to wait to be approved, and once approved a 'history' is kept so it 
is known who submitted the data and who approved it. Any ideas on how to 
achieve this effectively??


-- How about you add two extra fields in your 'description' table - 'UniqueID' 
and 'Approved.' Each time a new description is added or updated, it creates a 
new field in the description table. UniqueID auto-increments. 'Approved' is set 
to 0 until it has been approved (set to 1) or rejected (-1). This will make it 
easy to list pending approvals, too. The code can default to show the most 
recent (based on 'UniqueID') approved description.

This has the advantage of having a full history of descriptions, and whether 
they were approved. You could expand it by having further fields (SubmittedID, 
ApproverID) to track that. And you could choose to have the 'Product' table 
hold the UniqueID of the currently chosen description, if you want the 
flexibility to choose a description that isn't the most recently submitted one.

Jon.


Re: [PHP] Re: BarcodeDB.com - a Barcode Database

2008-10-14 Thread Bastien Koert
On Tue, Oct 14, 2008 at 9:56 AM, Alex Chamberlain <[EMAIL PROTECTED]
> wrote:

> Thanks for your suggestion!! Sounds like a good route to go down with the
> API access. Really struggling with the pending 'list' at the moment. Suppose
> I have got 2 tables `product` and `description`. `product` contains `EAN`,
> `name`, `last_modified` and `description` contains `EAN` and `description`.
> The nearest thing to me right now is a tub of pencils.
>
> EAN: 5011772007888
> Name: 50 Staedtler HB Pencils
> Description: A tub of 50 HB Pencils by Staedtler.
>
> Suppose someone at BarcodeDB.com, having signed in, wanted to change the
> description to: A tub of 50 HB Pencils by Staedtler. With strong break
> resistant leads, they make an ideal pencil for kids or adults alike.
>
> Rather than update this description straight into the database. It would be
> nice for it to wait to be approved, and once approved a 'history' is kept so
> it is known who submitted the data and who approved it. Any ideas on how to
> achieve this effectively??
>
> Thanks,
>
> Alex
>
> No virus found in this outgoing message. Scanned by AVG Free 8.0
> Checked by AVG - http://www.avg.com
> Version: 8.0.173 / Virus Database: 270.8.0/1722 - Release Date: 14/10/2008
> 02:02
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> **I would cue it up in an XML file-based queue, storing all changes in
that queue and letting an admin go thru it as they have time. When the
review is committed, the xml can be processed and the database updated. If
the review is rejected, remove the xml from the queue.




-- 

Bastien

Cat, the other other white meat


Re: [PHP] New to this group....a continuation

2008-10-14 Thread Jochem Maas
Daniel Brown schreef:
> On Tue, Oct 14, 2008 at 8:29 AM, Jason Pruim <[EMAIL PROTECTED]> wrote:
>> re-tread? Someone pulled off his old skin, and put new, younger looking skin
>> on? Might work on the outside but nothing can change the fact that the tire
>> is still old :P
> 
> 
> With a little Googling, I was able to find Tedd's class picture
> from his senior year.
> 
> http://parasane.net/images/SperlingSeniorClassPhoto.jpg

so he really did program with rocks[tm]!

> 


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



Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Andrew Ballard
On Tue, Oct 14, 2008 at 10:29 AM, Colin Guthrie <[EMAIL PROTECTED]> wrote:
> Andrew Ballard wrote:
>>
>> I've heard that a lot, but I just don't see it. I'm sure some of you
>> can come up with better tests than this, but here is what I used:
>
> ...
>>
>> Based on these results, I'd hardly use the "language construct versus
>> function call" optimization argument to make my decision. I'm not sure
>> if this is a testament to improvements in the PHP engine over the last
>> couple years, or if equipment has gotten fast enough that the
>> differences have become irrelevant. Quite possibly, it's both.
>
> There are a couple of issues with those benchmarks...
> 1. It uses rand()... this is generally a bad thing in benchmarks

True. I'm not sure how to test it, but I'm curious if there is a bias
toward elements that do or do not exist, so I let it pick values both
in and out of range. I suppose I could have preselected values to be
consistent among all tests.

> 2. It uses internal (wall clock) timing and tests different things in the
> same application run.

I'm on a Windows development machine.

> 3. 50k iterations is easy! Give it something hard :)

I've done the same with 100k or more. The average is the same. If I'm
ever calling either of these functions 100k times in a production
script, I need to rethink the app anyway.

> You should really use an external timing function (like "time blah" on *nix)
> as it shows you real processor time used, as well as wall-clock time.

Again, I'm on Windows and my PHP environment is inside Zend Studio. Is
this something I can see with something like the profiler in Xdebug?
(I have run similar test scripts on the web servers, but they are also
running Windows and I don't have access other than file shares to
where we publish apps.)

> I've posted a simple benchmark else where on this thread that tests which
> prove that for a two index-depth test, !empty is approx 4.5x faster than the
> equiv array_key_exists tests.

I saw that, and for this case I'd agree with you. To be fair, I think
the savings is more due to the difference between calling empty() once
to get the desired result versus calling array_key_exists() twice and
then testing the actual array value (which I'm sure means scanning the
array to get the value and then doing a logical comparison). I will,
however, file this information for later use as it looks useful in
some situations like this one.

> Even for a single depth array test, I still get ~3x speed improvement using
> empty() vs. array_key_exists().


Andrew

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



Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Wolf

> Does the ! reverse the empty in this case? such as !empty = not empty?

You definitely have to go walk the plank now...  You have to go back and
re-write code and make it more compact now, right?  tsk, tsk.  I thought
we taught you better then that.

! is the NOT operator in many languages.

So instead of something like this:
if ($employee_login == "true" || $employee_loggin == "break")
You could do:
if ($employee_login != "off")

Don't worry, it should be quick, we've been chumming the water.  ;)

HTH,
Wolf


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



Re: [PHP] Output text status on a long class

2008-10-14 Thread Stut

On 14 Oct 2008, at 15:56, Chrome wrote:
I have a class that takes a while to run and am wanting to push some  
output

to the browser while it's doing its stuff.  Is that possible?

Here's what I'd like:

Connecting to server... Done!
Retrieving categories... Done!
...

All I can get it to do is output all of the text at the end of the  
script


A voice in my head says that outputting all of the text at the end  
of the
script is the only way to do it.  Then another voice says but there  
must be

a way! :)

I did try a quick test of buffering the text then explicitly  
flushing the

buffer but it didn't seem to work

I know this seems pointless but I'm anticipating that the users will  
be
confused (which would be a surprise ) and attempt to abort/ 
bugger

off somewhere else


Put this line at the top of your script...

while (@ob_end_clean());

That will remove any output buffers and your script should then output  
stuff as it happens.


-Stut

--
http://stut.net/

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



Re: [PHP] Output text status on a long class

2008-10-14 Thread uaca man
Dan,

Try
echo "some text";
ob_flush() ;
*flush()* ;

also take a look at the documentation at:
http://br2.php.net/manual/en/function.flush.php

Angelo

2008/10/14 Chrome <[EMAIL PROTECTED]>

> Hi all
>
> I have a class that takes a while to run and am wanting to push some output
> to the browser while it's doing its stuff.  Is that possible?
>
> Here's what I'd like:
>
> Connecting to server... Done!
> Retrieving categories... Done!
> ...
>
> All I can get it to do is output all of the text at the end of the script
>
> A voice in my head says that outputting all of the text at the end of the
> script is the only way to do it.  Then another voice says but there must be
> a way! :)
>
> I did try a quick test of buffering the text then explicitly flushing the
> buffer but it didn't seem to work
>
> I know this seems pointless but I'm anticipating that the users will be
> confused (which would be a surprise ) and attempt to abort/bugger
> off somewhere else
>
> Thanks in advance!
>
> Dan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Jason Pruim


On Oct 14, 2008, at 11:05 AM, Wolf wrote:



Does the ! reverse the empty in this case? such as !empty = not  
empty?


You definitely have to go walk the plank now...  You have to go back  
and
re-write code and make it more compact now, right?  tsk, tsk.  I  
thought

we taught you better then that.


I have used ! a fair amount just never looked into it outside of  
isset :P





! is the NOT operator in many languages.

So instead of something like this:
if ($employee_login == "true" || $employee_loggin == "break")
You could do:
if ($employee_login != "off")

Don't worry, it should be quick, we've been chumming the water.  ;)


Gee thanks :P At least I won't limp away from it :P

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



RE: [PHP] Output text status on a long class

2008-10-14 Thread Chrome


> -Original Message-
> From: uaca man [mailto:[EMAIL PROTECTED]
> Sent: 14 October 2008 16:10
> To: php-general@lists.php.net
> Subject: Re: [PHP] Output text status on a long class
> 
> Dan,
> 
> Try
> echo "some text";
> ob_flush() ;
> *flush()* ;
> 
> also take a look at the documentation at:
> http://br2.php.net/manual/en/function.flush.php
> 
> Angelo
> 

Hi Angelo and Stut

Strange happenings.  Tried a few combinations of your suggestions but the
output is still just dumped at the end

Odd

Thanks for the input (and this may be something to do with the server (which
I didn't set up))

Dan



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



RE: [PHP] Output text status on a long class

2008-10-14 Thread Chrome
> Stut wrote:
> > On 14 Oct 2008, at 15:56, Chrome wrote:
> >> I have a class that takes a while to run and am wanting to push some
> >> output
> >> to the browser while it's doing its stuff.  Is that possible?
> >>
> >> Here's what I'd like:
> >>
> >> Connecting to server... Done!
> >> Retrieving categories... Done!
> >> ...
> >>
> >> All I can get it to do is output all of the text at the end of the
> script
> >>
> >> A voice in my head says that outputting all of the text at the end
> of the
> >> script is the only way to do it.  Then another voice says but there
> >> must be
> >> a way! :)
> >>
> >> I did try a quick test of buffering the text then explicitly
> flushing the
> >> buffer but it didn't seem to work
> >>
> >> I know this seems pointless but I'm anticipating that the users will
> be
> >> confused (which would be a surprise ) and attempt to
> >> abort/bugger
> >> off somewhere else
> >
> > Put this line at the top of your script...
> >
> > while (@ob_end_clean());
> >
> > That will remove any output buffers and your script should then
> output
> > stuff as it happens.
> >
> > -Stut
> >
> 
> Or you could add
> 
> flush();
> 
> after your output, which will flush the output buffer and force it to
> display.

I did that as well as stut's suggestion.  And I tried ob_flush() (just in
case).  Tried a few combinations

Personally I think I sometimes have a negative effect on these things

Dan

> Jay
> 
> --
> 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] Output text status on a long class

2008-10-14 Thread Stut

On 14 Oct 2008, at 16:51, Chrome wrote:
For the record I have included a 256 char long whitespace string  
along with any prospective output but still no joy


Opera 9.60 reliably informs me it's received 258 bytes but displays  
nothing


I'll carry on with this for a little before blaming the browsers  
(testing also in FF3) and putting in a 'This is going to take bloody  
ages' note :)


My initial response was based on it being a CLI script in which case  
my advice would have been enough. However in your case there are other  
buffers in play which could affect the output.


How is your output formatted? Browsers won't necessarily display  
content until they get closing tags. This is probably the issue you're  
running into.


-Stut

--
http://stut.net/

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



RE: [PHP] Output text status on a long class

2008-10-14 Thread Chrome
> On 14 Oct 2008, at 16:51, Chrome wrote:
> > For the record I have included a 256 char long whitespace string
> > along with any prospective output but still no joy
> >
> > Opera 9.60 reliably informs me it's received 258 bytes but displays
> > nothing
> >
> > I'll carry on with this for a little before blaming the browsers
> > (testing also in FF3) and putting in a 'This is going to take bloody
> > ages' note :)
> 
> My initial response was based on it being a CLI script in which case
> my advice would have been enough. However in your case there are other
> buffers in play which could affect the output.
> 
> How is your output formatted? Browsers won't necessarily display
> content until they get closing tags. This is probably the issue you're
> running into.

The output is [currently] plain text only.  Maybe it would help if I added
the standard HTML stuff too I'll have more luck

I'll try that in a little bit but food first :)

Thanks for the input

Dan

> -Stut
> 
> --
> http://stut.net/


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



Re: [PHP] Output text status on a long class

2008-10-14 Thread Jim Lucas
Chrome wrote:
>> On 14 Oct 2008, at 16:51, Chrome wrote:
>>> For the record I have included a 256 char long whitespace string
>>> along with any prospective output but still no joy
>>>
>>> Opera 9.60 reliably informs me it's received 258 bytes but displays
>>> nothing
>>>
>>> I'll carry on with this for a little before blaming the browsers
>>> (testing also in FF3) and putting in a 'This is going to take bloody
>>> ages' note :)
>> My initial response was based on it being a CLI script in which case
>> my advice would have been enough. However in your case there are other
>> buffers in play which could affect the output.
>>
>> How is your output formatted? Browsers won't necessarily display
>> content until they get closing tags. This is probably the issue you're
>> running into.
> 
> The output is [currently] plain text only.  Maybe it would help if I added
> the standard HTML stuff too I'll have more luck
> 
> I'll try that in a little bit but food first :)
> 
> Thanks for the input
> 
> Dan
> 
>> -Stut
>>
>> --
>> http://stut.net/
> 
> 

Also, a setting to check it to make sure that output_buffering, in the
PHP.ini, is set to off.  I think the default is 4096bytes.  You'll not want it
to do that.  Once you change that, restart apache/iis/etc...


-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare


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



RE: [PHP] Output text status on a long class

2008-10-14 Thread Boyd, Todd M.
> -Original Message-
> From: Jim Lucas [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 14, 2008 11:56 AM
> To: Boyd, Todd M.
> Cc: php php
> Subject: Re: [PHP] Output text status on a long class
> 
> Boyd, Todd M. wrote:
> >>
> >> Also, a setting to check it to make sure that output_buffering, in
> the
> >> PHP.ini, is set to off.  I think the default is 4096bytes.  You'll
> not
> >> want it
> >> to do that.  Once you change that, restart apache/iis/etc...
> >
> > OP wrote: "Thanks for the input (and this may be something to do
with
> > the server (which I didn't set up))"
> >
> > I'm thinking maybe they have no control over any INI settings that
> > cannot be changed programmatically on a per-script basis.
> 
> This is a setting can be placed in a .htaccess file  :)

I was unaware. I know there are some that can and some that can't...
good to know that this one can. :)


Todd Boyd
Web Programmer

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



Re: [PHP] Output text status on a long class

2008-10-14 Thread Jim Lucas
Boyd, Todd M. wrote:
>> -Original Message-
>> From: Jim Lucas [mailto:[EMAIL PROTECTED]
>> Sent: Tuesday, October 14, 2008 11:56 AM
>> To: Boyd, Todd M.
>> Cc: php php
>> Subject: Re: [PHP] Output text status on a long class
>>
>> Boyd, Todd M. wrote:
 Also, a setting to check it to make sure that output_buffering, in
>> the
 PHP.ini, is set to off.  I think the default is 4096bytes.  You'll
>> not
 want it
 to do that.  Once you change that, restart apache/iis/etc...
>>> OP wrote: "Thanks for the input (and this may be something to do
> with
>>> the server (which I didn't set up))"
>>>
>>> I'm thinking maybe they have no control over any INI settings that
>>> cannot be changed programmatically on a per-script basis.
>> This is a setting can be placed in a .htaccess file  :)
> 
> I was unaware. I know there are some that can and some that can't...
> good to know that this one can. :)
> 
> 
> Todd Boyd
> Web Programmer
> 

http://us.php.net/manual/en/outcontrol.configuration.php#ini.output-buffering

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare


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



[PHP] Can't use copy() to copy files

2008-10-14 Thread Ben Stones
Ok, here is my code (mind it is a bit messy I was just testing to see if it
works first of without success):

if($_GET['act'] == "update") {
  $check_exists=file_exists($_GET['file']);
  if($check_exists==1) {
   if(copy($_GET['file'],$_GET['file'])) {
echo 5;
   }
   else {
echo $_GET['file'];
   }
  }
 }

Obviously it doesn't echo 5, it just echo's the file name which is a sign it
isn't copying. If I change it to: copy($_GET['file'],"Hello/".$_GET['file'])
it copies file, and sure enough I check the directory to find it has copied
too. This code is in a seperate directory and I have changed both that
directory, the Hello directory and the file being copied to 777 permissions
but no luck. I noticed the following in the error_log:

[14-Oct-2008 18:07:38] PHP Warning:  copy(/index.php) [function.copy]: failed to open stream: Permission
denied in /home/vinat/public_html/Files/test.php on line 31
Any help appreciated!


Re: [PHP] Can't use copy() to copy files

2008-10-14 Thread Jim Lucas
Ben Stones wrote:
> Ok, here is my code (mind it is a bit messy I was just testing to see if it
> works first of without success):
> 
> if($_GET['act'] == "update") {
>   $check_exists=file_exists($_GET['file']);
>   if($check_exists==1) {
>if(copy($_GET['file'],$_GET['file'])) {
> echo 5;
>}
>else {
> echo $_GET['file'];
>}
>   }
>  }
> 
> Obviously it doesn't echo 5, it just echo's the file name which is a sign it
> isn't copying. If I change it to: copy($_GET['file'],"Hello/".$_GET['file'])
> it copies file, and sure enough I check the directory to find it has copied
> too. This code is in a seperate directory and I have changed both that
> directory, the Hello directory and the file being copied to 777 permissions
> but no luck. I noticed the following in the error_log:
> 
> [14-Oct-2008 18:07:38] PHP Warning:  copy(/index.php) [ href='function.copy'>function.copy]: failed to open stream: Permission
> denied in /home/vinat/public_html/Files/test.php on line 31
> Any help appreciated!
> 

your source and destination are the same.  you can't do that.  Even windows
cries when you try that.. :)

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare


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



[PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Colin Guthrie

Andrew Ballard wrote:

I've heard that a lot, but I just don't see it. I'm sure some of you
can come up with better tests than this, but here is what I used:


...

Based on these results, I'd hardly use the "language construct versus
function call" optimization argument to make my decision. I'm not sure
if this is a testament to improvements in the PHP engine over the last
couple years, or if equipment has gotten fast enough that the
differences have become irrelevant. Quite possibly, it's both.


There are a couple of issues with those benchmarks...
1. It uses rand()... this is generally a bad thing in benchmarks
2. It uses internal (wall clock) timing and tests different things in 
the same application run.

3. 50k iterations is easy! Give it something hard :)

You should really use an external timing function (like "time blah" on 
*nix) as it shows you real processor time used, as well as wall-clock time.



I've posted a simple benchmark else where on this thread that tests 
which prove that for a two index-depth test, !empty is approx 4.5x 
faster than the equiv array_key_exists tests.


Even for a single depth array test, I still get ~3x speed improvement 
using empty() vs. array_key_exists().


Col


--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] Output text status on a long class

2008-10-14 Thread Jay Moore

Stut wrote:

On 14 Oct 2008, at 15:56, Chrome wrote:
I have a class that takes a while to run and am wanting to push some 
output

to the browser while it's doing its stuff.  Is that possible?

Here's what I'd like:

Connecting to server... Done!
Retrieving categories... Done!
...

All I can get it to do is output all of the text at the end of the script

A voice in my head says that outputting all of the text at the end of the
script is the only way to do it.  Then another voice says but there 
must be

a way! :)

I did try a quick test of buffering the text then explicitly flushing the
buffer but it didn't seem to work

I know this seems pointless but I'm anticipating that the users will be
confused (which would be a surprise ) and attempt to 
abort/bugger

off somewhere else


Put this line at the top of your script...

while (@ob_end_clean());

That will remove any output buffers and your script should then output 
stuff as it happens.


-Stut



Or you could add

flush();

after your output, which will flush the output buffer and force it to 
display.


Jay

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



[PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Colin Guthrie

Yeti wrote:

You might also want to try array_key_exists

if (array_key_exists('loggedin', $_SESSION['userInfo'])) {
// do something with $_SESSION['userInfo']['loggedin']
}


You'd first need to check that the key 'userInfo' existed in the 
$_SESSION array too.


Personally, I very rarely see the point in using array_key_exists... 
It's a function call and has overhead where as isset() and empty() are 
language constructs and (I would hope) are much more efficient (although 
I've not done any benchmarks).


There are cases where you may want to use array_key_exists where isset() 
and empty() would fail, e.g.


$arr['foo'] = null;

isset($arr['foo']) == false
!empty($arr['foo']) == false
array_key_exists('foo', $arr) == true

Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



[PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Colin Guthrie

Jochem Maas wrote:

Jason Pruim schreef:

Good morning everyone!

I think I might be having a "to early in the morning/not enough
caffeine" moment... But I am down to 1 error on my timecard application
that I would like to clean up. It's a small undefined index error, and
the program works jsut fine the way it is, but why leave an error if you
don't need to? :)

Here is the error:

[Tue Oct 14 08:19:47 2008] [error] PHP Notice:  Undefined index: 
userInfo in

/Volumes/RAIDer/webserver/Documents/dev/stimecard/inc/function/authentication.func.php
on line 22

and here is the relevant code:

==> Line 22if($_SESSION['userInfo']['loggedin'] == TRUE) {
   


if(isset($_SESSION['userInfo']['loggedin']) && 
$_SESSION['userInfo']['loggedin'] == TRUE) {


Or, seeing as I'm a stickler for compact code:

  if(!empty($_SESSION['userInfo']['loggedin'])) {

empty() is like isset() but tests for all sorts of "empty" cases ('', 
false, null and 0 are all considered, "empty").


Col


--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] PHP to get File Type

2008-10-14 Thread Ashley Sheridan
On Tue, 2008-10-14 at 08:29 -0700, Yeti wrote:
> >   function get_file_extension($file) {
> 
> http://us2.php.net/manual/en/function.pathinfo.php
> 
>  $path_parts = pathinfo('/www/htdocs/index.html');
> 
> echo $path_parts['dirname'], "\n";
> echo $path_parts['basename'], "\n";
> echo $path_parts['extension'], "\n";
> echo $path_parts['filename'], "\n"; // since PHP 5.2.0
> ?>
> 
> Secondly the MIME type can differ from the extension (file suffix)
> It's the same with uploaded files. Although the browser sends the MIME
> type it might not be the right one, since browsers obtain the MIME by
> checking the extension.
> 
> //A yeti
> 
Different browsers return different mime-types for the same file, so you
cannot rely on that. The extension basically means squat with regards to
the mime-type, as that can be changed, so don't rely on that.

Basically, depending on what you want to achieve, there are several
things you can do. Obviously
http://br2.php.net/manual/en/function.mime-content-type.php and
http://br2.php.net/manual/en/function.finfo-file.php have already been
mentioned, but unfortunately these are not always available for every
hosting package (I'm one of the unlucky ones!)

The accepted method of detecting an image mime-type if you don't have
access to the above functions is to use the GD library to perform a
width and height calculation on the image. For other types, you can
usually determine the type based on the first few bytes in the file.
This is is simple representation of how a good operating system detects
the mime-type (Windows relies on file extensions still.) For example, if
all the characters are ascii, you could then use a bit of logic to
determine if it's an XML-based file, Windows exe files begin with MZ and
the character code 90, images usually start with a 3-letter
representation of their type, etc. You might need to do a little digging
with a hex-editor to find the file types you want, but it's generally
useful to work on a whitelist basis, i.e. only accept file types you
recognise and reject everything else.

Hope this helps!



Ash
www.ashleysheridan.co.uk


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



[PHP] App Question.

2008-10-14 Thread bruce
Hi list!!

Got a question, and I can't find a good answer for, so I figured i'd post
here. I'm working on a project that involves a number of smaller apps to be
developed, and run. In order to build this overall application, I'm trying
to find a web based app that I can use to manage the entire process.

I need to be able to create the basic app, and then to test the app, and
then to run the app in a production environment. I need to be able to
schedule when the app is tested/run in the production system, as well as be
able to track the status of the test/production app. My overall system will
have 100's of these smaller child apps.

Has anyone heard of, or have any pointers to any kind of webbased app that I
can use (open source) to manage this entire kind of process. I would prefer
a web based app, that runs on a LAMP platform to manage this overall
process

Thanks



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



[PHP] PDO

2008-10-14 Thread Alain Roger
Hi,

i'm currently using PDO as it seems better than any other pg_connect and so
on...

however, i experience issue testing it.

for example the following code returns me the correct records (count and
records themselve)

> $sql ="SELECT * FROM sewe.languages;";
>
>   $result = DatabaseHandler::Prepare($sql);
>
>   //$res=DatabaseHandler::Execute($result);
>
>   $rec = DatabaseHandler::GetAll($result);
>
>   echo "Amount of records : ".count($rec)."";
>
>   for ($i = 0; $i < count($rec); $i++)
>   {
>   print "Record ID : ".$rec[$i]['id']." / Abbreviation :
> ".$rec[$i]['abbreviation']. " / Description
> :".$rec[$i]['description']."";
>   }
>
> however if i replace this simple SQL request by my function./stored
procedure like that :

> $sql = 'select * from get_languages_list("*");';

it does not work...in fact it returns me 0 as count of record, whereas under
postgreSQL pgAdmin interface the same syntax of SQL request returns me the
same result as the previous SQL " selct * from..."

so where could be the issue when PDO uses stored procedures/functions ?

thx.

-- 
Alain

Windows XP SP3
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008


Re: [PHP] 1 last error to fix before the application is done!

2008-10-14 Thread Alan Boudreault

You should have a test like this:

 if ( ($_SESSION['userInfo']) && ($_SESSION['userInfo']['loggedin'] == 
TRUE)) {


I'm not sure about your script, i just see a small part.

Alan

Jason Pruim wrote:

Good morning everyone!

I think I might be having a "to early in the morning/not enough 
caffeine" moment... But I am down to 1 error on my timecard 
application that I would like to clean up. It's a small undefined 
index error, and the program works jsut fine the way it is, but why 
leave an error if you don't need to? :)


Here is the error:

[Tue Oct 14 08:19:47 2008] [error] PHP Notice:  Undefined index:  
userInfo in 
/Volumes/RAIDer/webserver/Documents/dev/stimecard/inc/function/authentication.func.php 
on line 22


and here is the relevant code:

==> Line 22if($_SESSION['userInfo']['loggedin'] == TRUE) {
   
return TRUE;

}else{
   
if(is_array($row1)){
   
   
$_SESSION['userInfo'] = array( "authname" => 
$row1['username'], "loggedin" => TRUE, "fullname" => $row1['Name'], 
"empID" => $row1['empID'], "authLevel" => $row1['authLevel']);
   
   
}
   
else

{
//$_SESSION['userInfo'] =array("loggedin" => FALSE);
die('authentication failed');
   
}

}

What I'm trying to do, is if the person already has a valid session, I 
want to skip over resetting all the variables, and just log them in. 
BUT if they have no session, and the auth returned an array, then have 
it set the variables. Or if they type in the wrong password it just 
dies... I may change that if I decide to release the code to the 
public so that it is handled more gracefully, but it works fine for my 
purposes right now :)


So... With all that said, anyone have any idea how to get rid of my 
error other then setting error reporting to none?


Thanks for taking the time to read this!

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]








--
Alan Boudreault
Mapgears
http://www.mapgears.com


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



Re: [PHP] Output text status on a long class

2008-10-14 Thread Jim Lucas
Boyd, Todd M. wrote:
>> -Original Message-
>> From: Jim Lucas [mailto:[EMAIL PROTECTED]
>> Sent: Tuesday, October 14, 2008 11:43 AM
>> To: Chrome
>> Cc: 'Stut'; 'Andrew Ballard'; 'Jay Moore'; php-general@lists.php.net
>> Subject: Re: [PHP] Output text status on a long class
>>
>> Chrome wrote:
 On 14 Oct 2008, at 16:51, Chrome wrote:
> For the record I have included a 256 char long whitespace string
> along with any prospective output but still no joy
>
> Opera 9.60 reliably informs me it's received 258 bytes but
> displays
> nothing
>
> I'll carry on with this for a little before blaming the browsers
> (testing also in FF3) and putting in a 'This is going to take
>> bloody
> ages' note :)
 My initial response was based on it being a CLI script in which
> case
 my advice would have been enough. However in your case there are
>> other
 buffers in play which could affect the output.

 How is your output formatted? Browsers won't necessarily display
 content until they get closing tags. This is probably the issue
>> you're
 running into.
>>> The output is [currently] plain text only.  Maybe it would help if I
>> added
>>> the standard HTML stuff too I'll have more luck
>>>
>>> I'll try that in a little bit but food first :)
>>>
>>> Thanks for the input
>> Also, a setting to check it to make sure that output_buffering, in the
>> PHP.ini, is set to off.  I think the default is 4096bytes.  You'll not
>> want it
>> to do that.  Once you change that, restart apache/iis/etc...
> 
> OP wrote: "Thanks for the input (and this may be something to do with
> the server (which I didn't set up))"
> 
> I'm thinking maybe they have no control over any INI settings that
> cannot be changed programmatically on a per-script basis.
> 
> 
> Todd Boyd
> Web Programmer
> 

This is a setting can be placed in a .htaccess file  :)

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare


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



Re: [PHP] Output text status on a long class

2008-10-14 Thread Andrew Ballard
On Tue, Oct 14, 2008 at 11:30 AM, Chrome <[EMAIL PROTECTED]> wrote:
>> Stut wrote:
>> > On 14 Oct 2008, at 15:56, Chrome wrote:
>> >> I have a class that takes a while to run and am wanting to push some
>> >> output
>> >> to the browser while it's doing its stuff.  Is that possible?
>> >>
>> >> Here's what I'd like:
>> >>
>> >> Connecting to server... Done!
>> >> Retrieving categories... Done!
>> >> ...
>> >>
>> >> All I can get it to do is output all of the text at the end of the
>> script
>> >>
>> >> A voice in my head says that outputting all of the text at the end
>> of the
>> >> script is the only way to do it.  Then another voice says but there
>> >> must be
>> >> a way! :)
>> >>
>> >> I did try a quick test of buffering the text then explicitly
>> flushing the
>> >> buffer but it didn't seem to work
>> >>
>> >> I know this seems pointless but I'm anticipating that the users will
>> be
>> >> confused (which would be a surprise ) and attempt to
>> >> abort/bugger
>> >> off somewhere else
>> >
>> > Put this line at the top of your script...
>> >
>> > while (@ob_end_clean());
>> >
>> > That will remove any output buffers and your script should then
>> output
>> > stuff as it happens.
>> >
>> > -Stut
>> >
>>
>> Or you could add
>>
>> flush();
>>
>> after your output, which will flush the output buffer and force it to
>> display.
>
> I did that as well as stut's suggestion.  And I tried ob_flush() (just in
> case).  Tried a few combinations
>
> Personally I think I sometimes have a negative effect on these things
>
> Dan
>

Did you also read the notes in the description for flush()?

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


Andrew

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



RE: [PHP] Output text status on a long class

2008-10-14 Thread Chrome
> On Tue, Oct 14, 2008 at 11:30 AM, Chrome <[EMAIL PROTECTED]> wrote:
> >> Stut wrote:
> >> > On 14 Oct 2008, at 15:56, Chrome wrote:
> >> >> I have a class that takes a while to run and am wanting to push
> some
> >> >> output
> >> >> to the browser while it's doing its stuff.  Is that possible?
> >> >>
> >> >> Here's what I'd like:
> >> >>
> >> >> Connecting to server... Done!
> >> >> Retrieving categories... Done!
> >> >> ...
> >> >>
> >> >> All I can get it to do is output all of the text at the end of
> the
> >> script
> >> >>
> >> >> A voice in my head says that outputting all of the text at the
> end
> >> of the
> >> >> script is the only way to do it.  Then another voice says but
> there
> >> >> must be
> >> >> a way! :)
> >> >>
> >> >> I did try a quick test of buffering the text then explicitly
> >> flushing the
> >> >> buffer but it didn't seem to work
> >> >>
> >> >> I know this seems pointless but I'm anticipating that the users
> will
> >> be
> >> >> confused (which would be a surprise ) and attempt to
> >> >> abort/bugger
> >> >> off somewhere else
> >> >
> >> > Put this line at the top of your script...
> >> >
> >> > while (@ob_end_clean());
> >> >
> >> > That will remove any output buffers and your script should then
> >> output
> >> > stuff as it happens.
> >> >
> >> > -Stut
> >> >
> >>
> >> Or you could add
> >>
> >> flush();
> >>
> >> after your output, which will flush the output buffer and force it
> to
> >> display.
> >
> > I did that as well as stut's suggestion.  And I tried ob_flush()
> (just in
> > case).  Tried a few combinations
> >
> > Personally I think I sometimes have a negative effect on these things
> >
> > Dan
> >
> 
> Did you also read the notes in the description for flush()?
> 
> http://www.php.net/manual/en/function.flush.php

I'm reading through them now :)

For the record I have included a 256 char long whitespace string along with any 
prospective output but still no joy

Opera 9.60 reliably informs me it's received 258 bytes but displays nothing

I'll carry on with this for a little before blaming the browsers (testing also 
in FF3) and putting in a 'This is going to take bloody ages' note :)

Thanks for all the input

Dan

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


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



[PHP] utf8/quoted printable based mail renders raw html

2008-10-14 Thread Eric Butera
Has anyone ever had reports of problems with Outlook 2003 using utf-8
and quoted printable?  I've recently started getting complains from
our clients that some of their subscribers are having problems with
the message coming through as raw html.  The email client is always
Outlook 2003 on XP of various flavors.  I set up a copy of Outlook
2003 and 2007 to test and I see the messages just fine.  Unfortunately
this makes it quite hard to troubleshoot.

Should I just bite the bullet and iconv from utf8 to latin1?  Any
other thoughts?  What would really be great is if I could reproduce
the problem to try different approaches.

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



RE: [PHP] Output text status on a long class

2008-10-14 Thread Boyd, Todd M.
> -Original Message-
> From: Jim Lucas [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 14, 2008 11:43 AM
> To: Chrome
> Cc: 'Stut'; 'Andrew Ballard'; 'Jay Moore'; php-general@lists.php.net
> Subject: Re: [PHP] Output text status on a long class
> 
> Chrome wrote:
> >> On 14 Oct 2008, at 16:51, Chrome wrote:
> >>> For the record I have included a 256 char long whitespace string
> >>> along with any prospective output but still no joy
> >>>
> >>> Opera 9.60 reliably informs me it's received 258 bytes but
displays
> >>> nothing
> >>>
> >>> I'll carry on with this for a little before blaming the browsers
> >>> (testing also in FF3) and putting in a 'This is going to take
> bloody
> >>> ages' note :)
> >> My initial response was based on it being a CLI script in which
case
> >> my advice would have been enough. However in your case there are
> other
> >> buffers in play which could affect the output.
> >>
> >> How is your output formatted? Browsers won't necessarily display
> >> content until they get closing tags. This is probably the issue
> you're
> >> running into.
> >
> > The output is [currently] plain text only.  Maybe it would help if I
> added
> > the standard HTML stuff too I'll have more luck
> >
> > I'll try that in a little bit but food first :)
> >
> > Thanks for the input
> 
> Also, a setting to check it to make sure that output_buffering, in the
> PHP.ini, is set to off.  I think the default is 4096bytes.  You'll not
> want it
> to do that.  Once you change that, restart apache/iis/etc...

OP wrote: "Thanks for the input (and this may be something to do with
the server (which I didn't set up))"

I'm thinking maybe they have no control over any INI settings that
cannot be changed programmatically on a per-script basis.


Todd Boyd
Web Programmer

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



Re: [PHP] Output text status on a long class

2008-10-14 Thread Jim Lucas
Chrome wrote:
>> On 14 Oct 2008, at 16:51, Chrome wrote:
>>> For the record I have included a 256 char long whitespace string
>>> along with any prospective output but still no joy
>>>
>>> Opera 9.60 reliably informs me it's received 258 bytes but displays
>>> nothing
>>>
>>> I'll carry on with this for a little before blaming the browsers
>>> (testing also in FF3) and putting in a 'This is going to take bloody
>>> ages' note :)
>> My initial response was based on it being a CLI script in which case
>> my advice would have been enough. However in your case there are other
>> buffers in play which could affect the output.
>>
>> How is your output formatted? Browsers won't necessarily display
>> content until they get closing tags. This is probably the issue you're
>> running into.
> 
> The output is [currently] plain text only.  Maybe it would help if I added
> the standard HTML stuff too I'll have more luck
> 
> I'll try that in a little bit but food first :)
> 
> Thanks for the input
> 
> Dan
> 
>> -Stut
>>
>> --
>> http://stut.net/
> 
> 


Also, a setting to check it to make sure that output_buffering, in the
PHP.ini, is set to off.  I think the default is 4096bytes.  You'll not want it
to do that.  Once you change that, restart apache/iis/etc...

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare


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



Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Yeti
Ok, so empty is faster. I appreciate the time you guys took to bench the thing.
But I'm still gonna use array_key_exists.
If you like it or not.
Using it a couple of times in my scripts will slow them down a few nanoseconds.
That's plain evil mwhahaha.

//A yeti

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



Re: [PHP] Sphinx Open Source Text Based Search

2008-10-14 Thread Stut

On 14 Oct 2008, at 08:03, Hemant Patel wrote:
Hello Everyone, I want to configure my text  
based
search with sphinx Search in PHP.Can anybody give any link to  
explore it

other than its own site.(Other Than Documentation).I want to learn
thorough process followed by sphinx...How indexing and searching  
happen

in sphinx...?


Indexing happens in Sphinx, PHP does not get involved in that.

If you're having trouble following the official documentation I  
suggest you read the following article which introduces the core  
concepts in a tutorial format...


  http://www.ibm.com/developerworks/library/os-php-sphinxsearch/

-Stut

--
http://stut.net/

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



[PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-14 Thread Jay Moore

Eric Butera wrote:

Has anyone ever had reports of problems with Outlook 2003 using utf-8
and quoted printable?  I've recently started getting complains from
our clients that some of their subscribers are having problems with
the message coming through as raw html.  The email client is always
Outlook 2003 on XP of various flavors.  I set up a copy of Outlook
2003 and 2007 to test and I see the messages just fine.  Unfortunately
this makes it quite hard to troubleshoot.

Should I just bite the bullet and iconv from utf8 to latin1?  Any
other thoughts?  What would really be great is if I could reproduce
the problem to try different approaches.



Check php.ini


;)

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



Re: [PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-14 Thread Ashley Sheridan
On Tue, 2008-10-14 at 15:55 -0500, Jay Moore wrote:
> Eric Butera wrote:
> > Has anyone ever had reports of problems with Outlook 2003 using utf-8
> > and quoted printable?  I've recently started getting complains from
> > our clients that some of their subscribers are having problems with
> > the message coming through as raw html.  The email client is always
> > Outlook 2003 on XP of various flavors.  I set up a copy of Outlook
> > 2003 and 2007 to test and I see the messages just fine.  Unfortunately
> > this makes it quite hard to troubleshoot.
> > 
> > Should I just bite the bullet and iconv from utf8 to latin1?  Any
> > other thoughts?  What would really be great is if I could reproduce
> > the problem to try different approaches.
> 
> 
> Check php.ini
> 
> 
> ;)
> 
I had a similar problem at work, and I found that adding some extra
headers to the email sorted this. Apparently Outlook had a problem with
all of the headers if it didn't have a few main ones. Are the rest of
the headers (like reply-to, from, etc) that you are setting being
preserved?


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] PHP to get File Type

2008-10-14 Thread Yeti
>   function get_file_extension($file) {

http://us2.php.net/manual/en/function.pathinfo.php



Secondly the MIME type can differ from the extension (file suffix)
It's the same with uploaded files. Although the browser sends the MIME
type it might not be the right one, since browsers obtain the MIME by
checking the extension.

//A yeti

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



[PHP] Output text status on a long class

2008-10-14 Thread Chrome
Hi all

I have a class that takes a while to run and am wanting to push some output
to the browser while it's doing its stuff.  Is that possible?

Here's what I'd like:

Connecting to server... Done!
Retrieving categories... Done!
...

All I can get it to do is output all of the text at the end of the script

A voice in my head says that outputting all of the text at the end of the
script is the only way to do it.  Then another voice says but there must be
a way! :)

I did try a quick test of buffering the text then explicitly flushing the
buffer but it didn't seem to work

I know this seems pointless but I'm anticipating that the users will be
confused (which would be a surprise ) and attempt to abort/bugger
off somewhere else

Thanks in advance!

Dan


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



Re: [PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-14 Thread Eric Butera
On Tue, Oct 14, 2008 at 5:17 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
> On Tue, 2008-10-14 at 17:06 -0400, Eric Butera wrote:
>> On Tue, Oct 14, 2008 at 5:04 PM, Ashley Sheridan
>> <[EMAIL PROTECTED]> wrote:
>> > On Tue, 2008-10-14 at 15:55 -0500, Jay Moore wrote:
>> >> Eric Butera wrote:
>> >> > Has anyone ever had reports of problems with Outlook 2003 using utf-8
>> >> > and quoted printable?  I've recently started getting complains from
>> >> > our clients that some of their subscribers are having problems with
>> >> > the message coming through as raw html.  The email client is always
>> >> > Outlook 2003 on XP of various flavors.  I set up a copy of Outlook
>> >> > 2003 and 2007 to test and I see the messages just fine.  Unfortunately
>> >> > this makes it quite hard to troubleshoot.
>> >> >
>> >> > Should I just bite the bullet and iconv from utf8 to latin1?  Any
>> >> > other thoughts?  What would really be great is if I could reproduce
>> >> > the problem to try different approaches.
>> >>
>> >>
>> >> Check php.ini
>> >>
>> >>
>> >> ;)
>> >>
>> > I had a similar problem at work, and I found that adding some extra
>> > headers to the email sorted this. Apparently Outlook had a problem with
>> > all of the headers if it didn't have a few main ones. Are the rest of
>> > the headers (like reply-to, from, etc) that you are setting being
>> > preserved?
>> >
>> >
>> > Ash
>> > www.ashleysheridan.co.uk
>> >
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>>
>> I suppose I don't have a reply-to specifically.  I do have a from and
>> return-path.  I'll add that in there.
>>
>> As for the rest:
>> Return-Path: <[EMAIL PROTECTED]>
>> Subject: Traverse City News: Entrepreneurs, Eateries Invest
>> X-Unsubscribe: [EMAIL PROTECTED]
>> X-Newsletter: 3431b0e8-aa87-401f-8701-728c86d4e6b4
>> X-User: de962663-da70-42b7-9a8f-a9658032fda8
>> X-Company: Some Company
>> From: "Some Company" <[EMAIL PROTECTED]>
>> Date: Tue, 14 Oct 2008 13:01:18 -0400
>> Date: Tue, 14 Oct 2008 13:01:18 -0400
>> Content-Type: multipart/alternative; charset="utf-8";
>>  boundary="=_bc453a55a20a3363c997c148e36438c2"
>> MIME-Version: 1.0
>>
>>
>> --=_bc453a55a20a3363c997c148e36438c2
>> Content-Type: text/plain; charset="utf-8"
>> Content-Transfer-Encoding: quoted-printable
>>
>> ...snip...
>
> You have two Content-Type declarations, was that intentional, or was
> that which was being produced by Outlook?
>
>
> Ash
> www.ashleysheridan.co.uk
>
>

It's a multi-part mime message with a plain text version and an html
version following.  I copied up until the content of the plain text
part just to give more info on it.

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



Re: [PHP] returning array from commandline

2008-10-14 Thread Ian
This is resolved - I used serialize and unserialize which worked a treat.

Thanks for the suggestion :)

On Fri, Oct 10, 2008 at 8:17 PM, Richard Lynch <[EMAIL PROTECTED]> wrote:
> Convert it to XML or JSON.
>
> Those port quite nicely to anything.
>
> For all-PHP, you can use serialize to make it a string.
>
>> -Original Message-
>> From: Ian [mailto:[EMAIL PROTECTED]
>> Sent: Friday, October 10, 2008 8:38 AM
>> To: php-general@lists.php.net
>> Subject: [PHP] returning array from commandline
>>
>> Hi,
>>
>> I am busy developing a commandline tool that will, in certain
>> cirumstances, return an array of information when called and im having
>> a problem with this.
>>
>> The last part of my code looks like this:
>>
>> if(is_array($rslt)) return $rslt;
>> else echo $rslt;
>>
>> I.e. if its an array dont echo it, return it rather and im have huge
>> problems even using that $rslt variable. I have tried various exec
>> queries including exec() (with var before function call and as a
>> parameter), passthru, backtick operators and none of them allow me to
>> use the array after the commandline tool has been run.
>>
>> I also dont know how many levels the array may have as im referencing
>> other functions that change them based on the query given to the
>> commandline tool so I cant even put it into a string before returning
>> it as i dont know how many levels are involved and are returned from
>> the function call inside the commandline app. Does anyone have any
>> suggestions as to how I could achieve this or any better ways of doing
>> it?
>>
>> Quick summary: Im accessing a web interface that calls a php file to
>> parse some info. That php file may get an array back that I need to
>> use in the web interface - but I cant pass it back to the web
>> interface from the commandline tool.
>>
>> Thanks
>> Ian
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> ___
>
> The  information in this email or in any file attached
> hereto is intended only for the personal and confiden-
> tial  use  of  the individual or entity to which it is
> addressed and may contain information that is  propri-
> etary  and  confidential.  If you are not the intended
> recipient of this message you are hereby notified that
> any  review, dissemination, distribution or copying of
> this message is strictly prohibited.  This  communica-
> tion  is  for information purposes only and should not
> be regarded as an offer to sell or as  a  solicitation
> of an offer to buy any financial product. Email trans-
> mission cannot be guaranteed to be  secure  or  error-
> free. P6070214
>

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



[PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Peter Ford
Jason Pruim wrote:
> Good morning everyone!
> 
> I think I might be having a "to early in the morning/not enough
> caffeine" moment... But I am down to 1 error on my timecard application
> that I would like to clean up. It's a small undefined index error, and
> the program works jsut fine the way it is, but why leave an error if you
> don't need to? :)
> 
> Here is the error:
> 
> [Tue Oct 14 08:19:47 2008] [error] PHP Notice:  Undefined index: 
> userInfo in
> /Volumes/RAIDer/webserver/Documents/dev/stimecard/inc/function/authentication.func.php
> on line 22
> 
> and here is the relevant code:
> 
> ==> Line 22if($_SESSION['userInfo']['loggedin'] == TRUE) {
>

Surely all you need here is to test existence first:

if (isset($_SESSION['userInfo']) && isset($_SESSION['userInfo']['loggedIn'] &&
$_SESSION['userInfo']['loggedin'] == TRUE) {


You can probably short-circuit some of that - for example if
$_SESSION['userInfo']['loggedIn'] is only ever set to TRUE (and is not set
otherwise) then you might find that

if (isset($_SESSION['userInfo']['loggedin'])) {

will work for you ...



-- 
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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



Re: [PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-14 Thread Eric Butera
On Tue, Oct 14, 2008 at 5:04 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
> On Tue, 2008-10-14 at 15:55 -0500, Jay Moore wrote:
>> Eric Butera wrote:
>> > Has anyone ever had reports of problems with Outlook 2003 using utf-8
>> > and quoted printable?  I've recently started getting complains from
>> > our clients that some of their subscribers are having problems with
>> > the message coming through as raw html.  The email client is always
>> > Outlook 2003 on XP of various flavors.  I set up a copy of Outlook
>> > 2003 and 2007 to test and I see the messages just fine.  Unfortunately
>> > this makes it quite hard to troubleshoot.
>> >
>> > Should I just bite the bullet and iconv from utf8 to latin1?  Any
>> > other thoughts?  What would really be great is if I could reproduce
>> > the problem to try different approaches.
>>
>>
>> Check php.ini
>>
>>
>> ;)
>>
> I had a similar problem at work, and I found that adding some extra
> headers to the email sorted this. Apparently Outlook had a problem with
> all of the headers if it didn't have a few main ones. Are the rest of
> the headers (like reply-to, from, etc) that you are setting being
> preserved?
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I suppose I don't have a reply-to specifically.  I do have a from and
return-path.  I'll add that in there.

As for the rest:
Return-Path: <[EMAIL PROTECTED]>
Subject: Traverse City News: Entrepreneurs, Eateries Invest
X-Unsubscribe: [EMAIL PROTECTED]
X-Newsletter: 3431b0e8-aa87-401f-8701-728c86d4e6b4
X-User: de962663-da70-42b7-9a8f-a9658032fda8
X-Company: Some Company
From: "Some Company" <[EMAIL PROTECTED]>
Date: Tue, 14 Oct 2008 13:01:18 -0400
Date: Tue, 14 Oct 2008 13:01:18 -0400
Content-Type: multipart/alternative; charset="utf-8";
 boundary="=_bc453a55a20a3363c997c148e36438c2"
MIME-Version: 1.0


--=_bc453a55a20a3363c997c148e36438c2
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

...snip...

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



Re: [PHP] New to this group....a continuation

2008-10-14 Thread Daniel Brown
On Tue, Oct 14, 2008 at 8:29 AM, Jason Pruim <[EMAIL PROTECTED]> wrote:
>
> re-tread? Someone pulled off his old skin, and put new, younger looking skin
> on? Might work on the outside but nothing can change the fact that the tire
> is still old :P


With a little Googling, I was able to find Tedd's class picture
from his senior year.

http://parasane.net/images/SperlingSeniorClassPhoto.jpg

-- 

More full-root dedicated server packages:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-14 Thread Ashley Sheridan
On Tue, 2008-10-14 at 17:15 -0400, Eric Butera wrote:
> On Tue, Oct 14, 2008 at 5:17 PM, Ashley Sheridan
> <[EMAIL PROTECTED]> wrote:
> > On Tue, 2008-10-14 at 17:06 -0400, Eric Butera wrote:
> >> On Tue, Oct 14, 2008 at 5:04 PM, Ashley Sheridan
> >> <[EMAIL PROTECTED]> wrote:
> >> > On Tue, 2008-10-14 at 15:55 -0500, Jay Moore wrote:
> >> >> Eric Butera wrote:
> >> >> > Has anyone ever had reports of problems with Outlook 2003 using utf-8
> >> >> > and quoted printable?  I've recently started getting complains from
> >> >> > our clients that some of their subscribers are having problems with
> >> >> > the message coming through as raw html.  The email client is always
> >> >> > Outlook 2003 on XP of various flavors.  I set up a copy of Outlook
> >> >> > 2003 and 2007 to test and I see the messages just fine.  Unfortunately
> >> >> > this makes it quite hard to troubleshoot.
> >> >> >
> >> >> > Should I just bite the bullet and iconv from utf8 to latin1?  Any
> >> >> > other thoughts?  What would really be great is if I could reproduce
> >> >> > the problem to try different approaches.
> >> >>
> >> >>
> >> >> Check php.ini
> >> >>
> >> >>
> >> >> ;)
> >> >>
> >> > I had a similar problem at work, and I found that adding some extra
> >> > headers to the email sorted this. Apparently Outlook had a problem with
> >> > all of the headers if it didn't have a few main ones. Are the rest of
> >> > the headers (like reply-to, from, etc) that you are setting being
> >> > preserved?
> >> >
> >> >
> >> > Ash
> >> > www.ashleysheridan.co.uk
> >> >
> >> >
> >> > --
> >> > PHP General Mailing List (http://www.php.net/)
> >> > To unsubscribe, visit: http://www.php.net/unsub.php
> >> >
> >> >
> >>
> >> I suppose I don't have a reply-to specifically.  I do have a from and
> >> return-path.  I'll add that in there.
> >>
> >> As for the rest:
> >> Return-Path: <[EMAIL PROTECTED]>
> >> Subject: Traverse City News: Entrepreneurs, Eateries Invest
> >> X-Unsubscribe: [EMAIL PROTECTED]
> >> X-Newsletter: 3431b0e8-aa87-401f-8701-728c86d4e6b4
> >> X-User: de962663-da70-42b7-9a8f-a9658032fda8
> >> X-Company: Some Company
> >> From: "Some Company" <[EMAIL PROTECTED]>
> >> Date: Tue, 14 Oct 2008 13:01:18 -0400
> >> Date: Tue, 14 Oct 2008 13:01:18 -0400
> >> Content-Type: multipart/alternative; charset="utf-8";
> >>  boundary="=_bc453a55a20a3363c997c148e36438c2"
> >> MIME-Version: 1.0
> >>
> >>
> >> --=_bc453a55a20a3363c997c148e36438c2
> >> Content-Type: text/plain; charset="utf-8"
> >> Content-Transfer-Encoding: quoted-printable
> >>
> >> ...snip...
> >
> > You have two Content-Type declarations, was that intentional, or was
> > that which was being produced by Outlook?
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> 
> It's a multi-part mime message with a plain text version and an html
> version following.  I copied up until the content of the plain text
> part just to give more info on it.
> 
I thought you just had to specify the multipart/alternative and use the
boundary sequence to separate the two messages? I can't see more than
one content type on any emails in my inbox.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] 1 last error to fix before the application is done!

2008-10-14 Thread Yeti
You might also want to try array_key_exists

if (array_key_exists('loggedin', $_SESSION['userInfo'])) {
// do something with $_SESSION['userInfo']['loggedin']
}

//A yeti

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



[PHP] Output to matrix printer

2008-10-14 Thread Dušan Novaković
I have some request to sent text to matrix printer to print ticket for
theater. Is it possible to do that whit some php functions? Main point
is how to control length of paper that will be drawn inside and to
print text on a specific place. It would be nice if somebody can write
the code about this as example.

Thnx, Dusan

-- 
made by Dusan

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



Re: [PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-14 Thread Eric Butera
On Tue, Oct 14, 2008 at 5:24 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
> I thought you just had to specify the multipart/alternative and use the
> boundary sequence to separate the two messages? I can't see more than
> one content type on any emails in my inbox.
>
>

I just looked at my inbox.  I found 4 examples from pretty large
companies that have the content type & transfer encoding defined on
each mime part.  If you're right it appears nobody is listening to the
spec. ;)

I was thinking it is something along the lines of using some funny
markup inside of my html part that causes outlook to crap out.  I
tested my program in Mail.app, Thunderbird, Outlook Express, Gmail,
Hotmail, and a lot of others.  Outlook is the only one I've heard
problems from.

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



Re: [PHP] PHP to get File Type

2008-10-14 Thread Yeti
> Is there any function in PHP to get the file/Mime type of any file?
check this out:
http://us2.php.net/manual/en/function.finfo-open.php

//A yeti

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



Re: [PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-14 Thread Ashley Sheridan
On Tue, 2008-10-14 at 17:26 -0400, Eric Butera wrote:
> On Tue, Oct 14, 2008 at 5:24 PM, Ashley Sheridan
> <[EMAIL PROTECTED]> wrote:
> > I thought you just had to specify the multipart/alternative and use the
> > boundary sequence to separate the two messages? I can't see more than
> > one content type on any emails in my inbox.
> >
> >
> 
> I just looked at my inbox.  I found 4 examples from pretty large
> companies that have the content type & transfer encoding defined on
> each mime part.  If you're right it appears nobody is listening to the
> spec. ;)
> 
> I was thinking it is something along the lines of using some funny
> markup inside of my html part that causes outlook to crap out.  I
> tested my program in Mail.app, Thunderbird, Outlook Express, Gmail,
> Hotmail, and a lot of others.  Outlook is the only one I've heard
> problems from.

I don't know about the spec, it was a wild stab in the dark! Yeah, I had
no problems sending emails to anything except Outlook. Have you tried
looking at Pear Mail. That might make things easier?


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Yeti
> Personally, I very rarely see the point in using array_key_exists... It's a 
> function call and has overhead where as isset() and empty() are language 
> constructs and (I would hope) are much more efficient (although I've not done 
> any benchmarks)

# i don't know what's wrong with this ..

$foo = array();
$foo['bar'] = null;
if (array_key_exists('bar', $foo)) {
 switch ($foo['bar']) {
  case true:
   //do something
   break 1;
  default:
   //do something else
}
}

# if that's causing more overhead then let me see your benchmark, then
i believe it

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



Re: [PHP] Output text status on a long class

2008-10-14 Thread Andrew Ballard
On Tue, Oct 14, 2008 at 11:19 AM, Chrome <[EMAIL PROTECTED]> wrote:
>
>
>> -Original Message-
>> From: uaca man [mailto:[EMAIL PROTECTED]
>> Sent: 14 October 2008 16:10
>> To: php-general@lists.php.net
>> Subject: Re: [PHP] Output text status on a long class
>>
>> Dan,
>>
>> Try
>> echo "some text";
>> ob_flush() ;
>> *flush()* ;
>>
>> also take a look at the documentation at:
>> http://br2.php.net/manual/en/function.flush.php
>>
>> Angelo
>>
>
> Hi Angelo and Stut
>
> Strange happenings.  Tried a few combinations of your suggestions but the
> output is still just dumped at the end
>
> Odd
>
> Thanks for the input (and this may be something to do with the server (which
> I didn't set up))
>
> Dan

There could be other causes, including the browser. Read the author's
note on this page:

http://www.hudzilla.org/phpbook/read.php/13_9_0

I'm not sure what browsers might have similar limits. I suspect they
do it because they usually download full documents all at once rather
than in delayed increments and they want to eliminate a lot of
unnecessary page reflows as content is being delivered. I think I've
even seen a FF extension that waits to display anything until the full
page has been downloaded since it makes pages appear to download
faster.

Andrew

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



RE: [PHP] New to this group....a continuation

2008-10-14 Thread Jay Blanchard
[snip]
... oh and we're all a bunch of pirates, except for Tedd ... he's a
retired pirate.
[/snip]

I thought he was semi-retired, or was it re-tread? Meh.

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



Re: [PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-14 Thread Eric Butera
On Tue, Oct 14, 2008 at 5:36 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
> On Tue, 2008-10-14 at 17:26 -0400, Eric Butera wrote:
>> On Tue, Oct 14, 2008 at 5:24 PM, Ashley Sheridan
>> <[EMAIL PROTECTED]> wrote:
>> > I thought you just had to specify the multipart/alternative and use the
>> > boundary sequence to separate the two messages? I can't see more than
>> > one content type on any emails in my inbox.
>> >
>> >
>>
>> I just looked at my inbox.  I found 4 examples from pretty large
>> companies that have the content type & transfer encoding defined on
>> each mime part.  If you're right it appears nobody is listening to the
>> spec. ;)
>>
>> I was thinking it is something along the lines of using some funny
>> markup inside of my html part that causes outlook to crap out.  I
>> tested my program in Mail.app, Thunderbird, Outlook Express, Gmail,
>> Hotmail, and a lot of others.  Outlook is the only one I've heard
>> problems from.
>
> I don't know about the spec, it was a wild stab in the dark! Yeah, I had
> no problems sending emails to anything except Outlook. Have you tried
> looking at Pear Mail. That might make things easier?
>
>
> Ash
> www.ashleysheridan.co.uk
>
>

I'm using the Zend_Mail classes.  I've had a lot of success with it at
my work.  Usually I send ISO-8859-1/quoted-printable emails.  This
time around I built my app from the ground up utf8.  I thought I'd
give it a go using utf8 in the mail.  I know I could cheat and
iconv//TRANSLIT, but I was hoping to stay in the future.

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



Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Jason Pruim


On Oct 14, 2008, at 8:38 AM, Colin Guthrie wrote:


Jochem Maas wrote:

Jason Pruim schreef:

Good morning everyone!

I think I might be having a "to early in the morning/not enough
caffeine" moment... But I am down to 1 error on my timecard  
application
that I would like to clean up. It's a small undefined index error,  
and
the program works jsut fine the way it is, but why leave an error  
if you

don't need to? :)

Here is the error:

[Tue Oct 14 08:19:47 2008] [error] PHP Notice:  Undefined index:  
userInfo in
/Volumes/RAIDer/webserver/Documents/dev/stimecard/inc/function/ 
authentication.func.php

on line 22

and here is the relevant code:

==> Line 22if($_SESSION['userInfo']['loggedin'] ==  
TRUE) {


if(isset($_SESSION['userInfo']['loggedin']) && $_SESSION['userInfo'] 
['loggedin'] == TRUE) {


Or, seeing as I'm a stickler for compact code:

if(!empty($_SESSION['userInfo']['loggedin'])) {

empty() is like isset() but tests for all sorts of "empty" cases  
('', false, null and 0 are all considered, "empty").


Hey Colin,

Does the ! reverse the empty in this case? such as !empty = not empty?


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



Re: [PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-14 Thread Ashley Sheridan
On Tue, 2008-10-14 at 17:36 -0400, Eric Butera wrote:
> On Tue, Oct 14, 2008 at 5:36 PM, Ashley Sheridan
> <[EMAIL PROTECTED]> wrote:
> > On Tue, 2008-10-14 at 17:26 -0400, Eric Butera wrote:
> >> On Tue, Oct 14, 2008 at 5:24 PM, Ashley Sheridan
> >> <[EMAIL PROTECTED]> wrote:
> >> > I thought you just had to specify the multipart/alternative and use the
> >> > boundary sequence to separate the two messages? I can't see more than
> >> > one content type on any emails in my inbox.
> >> >
> >> >
> >>
> >> I just looked at my inbox.  I found 4 examples from pretty large
> >> companies that have the content type & transfer encoding defined on
> >> each mime part.  If you're right it appears nobody is listening to the
> >> spec. ;)
> >>
> >> I was thinking it is something along the lines of using some funny
> >> markup inside of my html part that causes outlook to crap out.  I
> >> tested my program in Mail.app, Thunderbird, Outlook Express, Gmail,
> >> Hotmail, and a lot of others.  Outlook is the only one I've heard
> >> problems from.
> >
> > I don't know about the spec, it was a wild stab in the dark! Yeah, I had
> > no problems sending emails to anything except Outlook. Have you tried
> > looking at Pear Mail. That might make things easier?
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> 
> I'm using the Zend_Mail classes.  I've had a lot of success with it at
> my work.  Usually I send ISO-8859-1/quoted-printable emails.  This
> time around I built my app from the ground up utf8.  I thought I'd
> give it a go using utf8 in the mail.  I know I could cheat and
> iconv//TRANSLIT, but I was hoping to stay in the future.

Yeah, utf8 support in Windows apps has always seemed a little bolted
on :p Maybe it is just a particular character or sequence that's in the
email that Outlook thinks is some sort of proprietary escape sequence?


Ash
www.ashleysheridan.co.uk


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



[PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Colin Guthrie

Peter Ford wrote:

You can probably short-circuit some of that - for example if
$_SESSION['userInfo']['loggedIn'] is only ever set to TRUE (and is not set
otherwise) then you might find that

if (isset($_SESSION['userInfo']['loggedin'])) {


As I mentioned elsewhere on this thread, !empty(..) is a better way of 
doing this as it works in the case when the value is set to FALSE too.


Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] PHP to get File Type

2008-10-14 Thread Aschwin Wesselius

Manoj Singh wrote:

Hello All,
Is there any function in PHP to get the file/Mime type of any file?

Any help will be appreciated.

Hi,

There are better and more elegant ways to do this, but I'm not aware of 
them.


Here is what I use most of the time. You only use the filename as $value 
for get_mimetype().


   function get_file_extension($file) {

   return array_pop(explode('.',$file));
   }

   function get_mimetype($value='') {

   $ct['htm'] = 'text/html';
   $ct['html'] = 'text/html';
   $ct['txt'] = 'text/plain';
   $ct['asc'] = 'text/plain';
   $ct['bmp'] = 'image/bmp';
   $ct['gif'] = 'image/gif';
   $ct['jpeg'] = 'image/jpeg';
   $ct['jpg'] = 'image/jpeg';
   $ct['jpe'] = 'image/jpeg';
   $ct['png'] = 'image/png';
   $ct['ico'] = 'image/vnd.microsoft.icon';
   $ct['mpeg'] = 'video/mpeg';
   $ct['mpg'] = 'video/mpeg';
   $ct['mpe'] = 'video/mpeg';
   $ct['qt'] = 'video/quicktime';
   $ct['mov'] = 'video/quicktime';
   $ct['avi']  = 'video/x-msvideo';
   $ct['wmv'] = 'video/x-ms-wmv';
   $ct['mp2'] = 'audio/mpeg';
   $ct['mp3'] = 'audio/mpeg';
   $ct['rm'] = 'audio/x-pn-realaudio';
   $ct['ram'] = 'audio/x-pn-realaudio';
   $ct['rpm'] = 'audio/x-pn-realaudio-plugin';
   $ct['ra'] = 'audio/x-realaudio';
   $ct['wav'] = 'audio/x-wav';
   $ct['css'] = 'text/css';
   $ct['zip'] = 'application/zip';
   $ct['pdf'] = 'application/pdf';
   $ct['doc'] = 'application/msword';
   $ct['bin'] = 'application/octet-stream';
   $ct['exe'] = 'application/octet-stream';
   $ct['class']= 'application/octet-stream';
   $ct['dll'] = 'application/octet-stream';
   $ct['xls'] = 'application/vnd.ms-excel';
   $ct['ppt'] = 'application/vnd.ms-powerpoint';
   $ct['wbxml']= 'application/vnd.wap.wbxml';
   $ct['wmlc'] = 'application/vnd.wap.wmlc';
   $ct['wmlsc']= 'application/vnd.wap.wmlscriptc';
   $ct['dvi'] = 'application/x-dvi';
   $ct['spl'] = 'application/x-futuresplash';
   $ct['gtar'] = 'application/x-gtar';
   $ct['gzip'] = 'application/x-gzip';
   $ct['js'] = 'application/x-javascript';
   $ct['swf'] = 'application/x-shockwave-flash';
   $ct['tar'] = 'application/x-tar';
   $ct['xhtml']= 'application/xhtml+xml';
   $ct['au'] = 'audio/basic';
   $ct['snd'] = 'audio/basic';
   $ct['midi'] = 'audio/midi';
   $ct['mid'] = 'audio/midi';
   $ct['m3u'] = 'audio/x-mpegurl';
   $ct['tiff'] = 'image/tiff';
   $ct['tif'] = 'image/tiff';
   $ct['rtf'] = 'text/rtf';
   $ct['wml'] = 'text/vnd.wap.wml';
   $ct['wmls'] = 'text/vnd.wap.wmlscript';
   $ct['xsl'] = 'text/xml';
   $ct['xml'] = 'text/xml';

   $extension = get_file_extension($value);

   if (!$type = $ct[strtolower($extension)]) {

   $type = 'text/html';
   }

   return $type;
   }

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



[PHP] searching by tags....

2008-10-14 Thread Ryan S
Hey,

this the first time I am actually working with "tags" but it seems quite 
popular and am adding it on a clients requests.

By tags I mean something like wordpress' implementation of it, for example when 
an author writes an article on babies the tags might be
baby,babies, new borns, cribs, nappies

or a picture of a baby can have the tags 

baby,babies, new born, cute kid, nappies

the tags are comma separated above of course.

The way i am doing it right now is i have sa an article or a pic saved in 
the db as 
article_or_pic_address text
the_tags varchar(240)

My question is, when someone clicks on any one of the tags, do i do a  LIKE 
%search_term% search or...???

quite a few sites seem to have a very neat way of implementing this with (url 
rewriting?) something like http://sitename/blog/tags/tag-comes-here/

Any help in the form of advise, code or links would be appreciated.

TIA.

Cheers!
Ryan
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



  

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



Re: [PHP] 1 last error to fix before the application is done!

2008-10-14 Thread Jason Pruim


On Oct 14, 2008, at 8:28 AM, Jochem Maas wrote:


Jason Pruim schreef:

Good morning everyone!

I think I might be having a "to early in the morning/not enough
caffeine" moment... But I am down to 1 error on my timecard  
application
that I would like to clean up. It's a small undefined index error,  
and
the program works jsut fine the way it is, but why leave an error  
if you

don't need to? :)

Here is the error:

[Tue Oct 14 08:19:47 2008] [error] PHP Notice:  Undefined index:
userInfo in
/Volumes/RAIDer/webserver/Documents/dev/stimecard/inc/function/ 
authentication.func.php

on line 22

and here is the relevant code:

==> Line 22if($_SESSION['userInfo']['loggedin'] ==  
TRUE) {




if(isset($_SESSION['userInfo']['loggedin']) && $_SESSION['userInfo'] 
['loggedin'] == TRUE) {


As usual Jochem... You hit the nail on the head... Cleaned up my error  
perfectly!



...

now go and walk the plank.


But... But... But... there's SHARKS down there :P

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



Re: [PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-14 Thread Nathan Rixham

Eric Butera wrote:

On Tue, Oct 14, 2008 at 5:04 PM, Ashley Sheridan



From: "Some Company" <[EMAIL PROTECTED]>
Date: Tue, 14 Oct 2008 13:01:18 -0400
Date: Tue, 14 Oct 2008 13:01:18 -0400


maybe because you have two dates in the headers?

whats the mime type of the html block? if it's set to text/plain then..

Content-Type: text/plain; charset="utf-8"
doesn't need quotes so..
Content-Type: text/plain; charset=utf-8

is it all valid utf-8? (and indeed valid quoted-printable utf-8)?

+ something rings in my mind about either wrong line terminations in the 
mime headers OR having 1 too many..


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



[PHP] Re: searching by tags....

2008-10-14 Thread Nathan Rixham

Ryan S wrote:

Hey,

this the first time I am actually working with "tags" but it seems quite 
popular and am adding it on a clients requests.

By tags I mean something like wordpress' implementation of it, for example when 
an author writes an article on babies the tags might be
baby,babies, new borns, cribs, nappies

or a picture of a baby can have the tags 


baby,babies, new born, cute kid, nappies

the tags are comma separated above of course.

The way i am doing it right now is i have sa an article or a pic saved in the db as 
article_or_pic_address text

the_tags varchar(240)

My question is, when someone clicks on any one of the tags, do i do a  LIKE 
%search_term% search or...???

quite a few sites seem to have a very neat way of implementing this with (url 
rewriting?) something like http://sitename/blog/tags/tag-comes-here/

Any help in the form of advise, code or links would be appreciated.

TIA.

Cheers!
Ryan
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



  


you need to normalise you're db mate

table: tags
tagId int autoinc
tagString varchar(200)

table tags_ref
tagId (from above)
objectId (id of what you want to link the tag too)

that way you can simply join up the 3 tables and select from tags_ref 
where tagId=XXX to get all the objects (post, link, image, video etc) 
that the tag is associated to. (and allow much more functionality)


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



Re: [PHP] searching by tags....

2008-10-14 Thread Ashley Sheridan
On Tue, 2008-10-14 at 14:54 -0700, Ryan S wrote:
> Hey,
> 
> this the first time I am actually working with "tags" but it seems quite 
> popular and am adding it on a clients requests.
> 
> By tags I mean something like wordpress' implementation of it, for example 
> when an author writes an article on babies the tags might be
> baby,babies, new borns, cribs, nappies
> 
> or a picture of a baby can have the tags 
> 
> baby,babies, new born, cute kid, nappies
> 
> the tags are comma separated above of course.
> 
> The way i am doing it right now is i have sa an article or a pic saved in 
> the db as 
> article_or_pic_address text
> the_tags varchar(240)
> 
> My question is, when someone clicks on any one of the tags, do i do a  LIKE 
> %search_term% search or...???
> 
> quite a few sites seem to have a very neat way of implementing this with (url 
> rewriting?) something like http://sitename/blog/tags/tag-comes-here/
> 
> Any help in the form of advise, code or links would be appreciated.
> 
> TIA.
> 
> Cheers!
> Ryan
> --
> - The faulty interface lies between the chair and the keyboard.
> - Creativity is great, but plagiarism is faster!
> - Smile, everyone loves a moron. :-)
> 
> 
> 
>   
> 
I think your question has two parts there.

With regards to searching in the database, I'd do a LIKE '%search_term
%'.

As for getting those search terms, well a link in a page can contain GET
values, such as http://www.somedomain.com/blog?tag=search_term .
Alternatively, you could use mod-rewrite to rewrite the URL and turn the
path into tag variables. This is the same as the above but with the
added benefit that users can type in tags directly more easily, and
there are apparently benefits for SEO with this method as well (but I'm
not sure how true that is)


Ash
www.ashleysheridan.co.uk


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



[PHP] PHP to get File Type

2008-10-14 Thread Manoj Singh
Hello All,
Is there any function in PHP to get the file/Mime type of any file?

Any help will be appreciated.

Regards,
Manoj Kumar Singh


[PHP] BarcodeDB.com - a Barcode Database

2008-10-14 Thread Alex Chamberlain
Hi,

I am looking to set up a new 'public' database for barcodes. There are a
couple of barcode databases out there, namely http://www.upcdatabase.com/
and http//en.barcodepedia.com/. UPC Database is old fashioned and over run
by Google ads, but does provide an (unsecure) XML-RPC interface.
Barcodepedia is more modern, but there is no XML-RPC. UPC Database has
~2 users and 977,498 barcode entries, but there is simply a barcode and
a name (sometimes a size/ weight) - no description. Both sites claim to use
the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported
License.

I wish to set up a similar website. Indexed on the modern EAN-13 (used
across the world, and includes ISBNs), the database will store a barcode and
name for *every* product. Additionally, the description of the product can
be stored. In the future, I would like to implement a 'tag-type' system,
whereby a tag, consisting of name (eg Author) and value (eg JK Rowling), can
be assigned to one or more objects. These tags could include links to
publicly available images etc. The country of registration of each product
can be derived from the barcode itself.

I want to set up XML-RPC access for both downloading and uploading products,
but I want them to be secure. When people upload or edit a product, I want
it to go onto a pending list for me (and others in the future with the
appropriate rights) to approve, unless it’s the manufacturer themselves.

I know a very basic database is easy to setup - I did it in a day or two,
but I am struggling with the user management side, including the
authentication of API access, as well as how to implement a 'pending' list.
Has anybody got any ideas?? Is there any (free) software out there capable
of this?? If anybody else wishes to contribute to this very young project, I
am open to ideas ([EMAIL PROTECTED]). Hosting is sorted and I own
BarcodeDB.com and .co.uk

Platform: PHP 5, ADOdb, Smarty - MySQL to start with, though I have thought
about an XML database as well.

As the platform develops, I want to let companies upload their products for
free, but charge others to download them - think how much time companies
spend on data entry for this kind of thing!! For the consumer, a money diary
etc will follow.

Thanks,

Alex

No virus found in this outgoing message. Scanned by AVG Free 8.0
Checked by AVG - http://www.avg.com 
Version: 8.0.173 / Virus Database: 270.8.0/1722 - Release Date: 14/10/2008
02:02


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



Re: [PHP] Output to matrix printer

2008-10-14 Thread Miles Thompson
On Tue, Oct 14, 2008 at 6:23 PM, Dušan Novaković <[EMAIL PROTECTED]> wrote:

> I have some request to sent text to matrix printer to print ticket for
> theater. Is it possible to do that whit some php functions? Main point
> is how to control length of paper that will be drawn inside and to
> print text on a specific place. It would be nice if somebody can write
> the code about this as example.
>
> Thnx, Dusan
>
> --
> made by Dusan
>

Decide on the font you will use - either 10 or 12 characters per inch.
A line is usually 1/8" high.

So you essentially have a matrix running at "n" characters per inch
horizontally, and "m" fractions of an inch vertically.

Fit your print into this matrix - some people do it with an array, others
just work the spaces.

Provide a "test" ticket so the operator can get the printer lined up. With
a  tractor feed, after that you are good for a whole box of tickets.

Oh - one more thing - you may have to advance a number of lines so the
ticket can be torn off after printing, then reverse feed the same number.

Another tip - set your page length just to the height of the ticket.

You really want to exploit the basic native font built into the printer.

Hope this helps - Miles


Re: [PHP] Re: Csv issue

2008-10-14 Thread Shawn McKenzie


[EMAIL PROTECTED] wrote:
> OKay now i am really stumped.
> Notice: Undefined index: filename
> When clearly I have it being set in the form with the file.
> Any suggestions?
>
>
>
> [EMAIL PROTECTED] wrote:
>   
>> I am using a form to select a csv file and then import it into mysql and 
>> 
> maybe im just drawling a blank here. But why is it blowing up.
>   
>> This thing loads like 14 million records into the database and I am clue 
>> less 
>> 
> how it can do that with a 2 record csv file.
>   
>> 
>> Upload:
>> 
>>
>>
>> $row = 1;
>> $filename = $_POST['filename'];
>> $handle = fopen("$filename", "r");
>> while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
>> {
>> $num = count($data);
>> echo " $num fields in line $row: \n";
>> $row++;
>> }
>> fclose($handle);
>> print "Import done";
>>
>> This will produce millions of lines until i go in and stop the process on 
>> the 
>> 
> server. I know its stupid but im drawling a blank as to why its doing this. 
> The 
> csv file has 2 lines in period. 
>   
>>  0 fields in line 1: 
>>  0 fields in line 2: 
>> ect for millions of records.
>> 
> Try:
>
> print_r(file($_POST['filename']));
>
> And see if you get what you expect.  You might also want to have
> error_reporting at its highest and display_errors also.
>
> -Shawn
>
>   

Please reply to the list.  I missed it the first time around, but you
need to use the $_FILES array: 
http://php.net/manual/features.file-upload.php

-Shawn

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



Re: [PHP] searching by tags....

2008-10-14 Thread Ashley Sheridan
On Tue, 2008-10-14 at 23:17 +0100, Nathan Rixham wrote:
> Ashley Sheridan wrote:
> > On Tue, 2008-10-14 at 14:54 -0700, Ryan S wrote:
> >> quite a few sites seem to have a very neat way of implementing this with 
> >> (url rewriting?) something like http://sitename/blog/tags/tag-comes-here/
> 
> > As for getting those search terms, well a link in a page can contain GET
> > values, such as http://www.somedomain.com/blog?tag=search_term .
> > Alternatively, you could use mod-rewrite to rewrite the URL and turn the
> > path into tag variables. This is the same as the above but with the
> > added benefit that users can type in tags directly more easily, and
> > there are apparently benefits for SEO with this method as well (but I'm
> > not sure how true that is)
> 
> it's very true; from the google webmaster guidelines:
> 
> If you decide to use dynamic pages (i.e., the URL contains a "?" 
> character), be aware that not every search engine spider crawls dynamic 
> pages as well as static pages. It helps to keep the parameters short and 
> the number of them few.
> 
> previously it was text along the lines of "google doesn't index all 
> pages with query parameters, so avoid them where possible"
> 
> additionally one of the weightier points in categorising pages within 
> the SERPS is the text in the url (especially if the page is actually 
> about /the_tag_in_the_url : see http://www.google.com/search?q=tags)
> 
What I meant was this definately used to be the case, but I've not found
it to be anymore. Try searching the various engines with a
strange/obscure question (a real one obviously!) and look at the
results. Often you'll find forums are the main results, which almost
exclusively use GET parameters rather than URL rewriting. Also, you
mention about keywords in the URL; GET parameters qualify for this, but
I agree, certain parts of the URL (i.e. domain, path, querystring,
anchor) could have different weightings.


Ash
www.ashleysheridan.co.uk


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



RE: [PHP] New to PHP

2008-10-14 Thread David Robley
Juan Jose Rosales Rodriguez wrote:

> He i not speak very good englis, pliss can you tel me abaout list in
> spanich?

News version at news://news.php.net/php.general.es or via http at
http://news.php.net/group.php?group=php.general.es



Cheers
-- 
David Robley

Useless Invention: Self stick frying pan.
Today is Boomtime, the 68th day of Bureaucracy in the YOLD 3174. 


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



Re: [PHP] searching by tags....

2008-10-14 Thread Nathan Rixham

Ashley Sheridan wrote:

On Tue, 2008-10-14 at 14:54 -0700, Ryan S wrote:

quite a few sites seem to have a very neat way of implementing this with (url 
rewriting?) something like http://sitename/blog/tags/tag-comes-here/



As for getting those search terms, well a link in a page can contain GET
values, such as http://www.somedomain.com/blog?tag=search_term .
Alternatively, you could use mod-rewrite to rewrite the URL and turn the
path into tag variables. This is the same as the above but with the
added benefit that users can type in tags directly more easily, and
there are apparently benefits for SEO with this method as well (but I'm
not sure how true that is)


it's very true; from the google webmaster guidelines:

If you decide to use dynamic pages (i.e., the URL contains a "?" 
character), be aware that not every search engine spider crawls dynamic 
pages as well as static pages. It helps to keep the parameters short and 
the number of them few.


previously it was text along the lines of "google doesn't index all 
pages with query parameters, so avoid them where possible"


additionally one of the weightier points in categorising pages within 
the SERPS is the text in the url (especially if the page is actually 
about /the_tag_in_the_url : see http://www.google.com/search?q=tags)


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



Re: [PHP] Output to matrix printer

2008-10-14 Thread Ashley Sheridan
On Tue, 2008-10-14 at 19:15 -0300, Miles Thompson wrote:
> On Tue, Oct 14, 2008 at 6:23 PM, Dušan Novaković <[EMAIL PROTECTED]> wrote:
> 
> > I have some request to sent text to matrix printer to print ticket for
> > theater. Is it possible to do that whit some php functions? Main point
> > is how to control length of paper that will be drawn inside and to
> > print text on a specific place. It would be nice if somebody can write
> > the code about this as example.
> >
> > Thnx, Dusan
> >
> > --
> > made by Dusan
> >
> 
> Decide on the font you will use - either 10 or 12 characters per inch.
> A line is usually 1/8" high.
> 
> So you essentially have a matrix running at "n" characters per inch
> horizontally, and "m" fractions of an inch vertically.
> 
> Fit your print into this matrix - some people do it with an array, others
> just work the spaces.
> 
> Provide a "test" ticket so the operator can get the printer lined up. With
> a  tractor feed, after that you are good for a whole box of tickets.
> 
> Oh - one more thing - you may have to advance a number of lines so the
> ticket can be torn off after printing, then reverse feed the same number.
> 
> Another tip - set your page length just to the height of the ticket.
> 
> You really want to exploit the basic native font built into the printer.
> 
> Hope this helps - Miles

I'm not sure I would have chosen PHP as the ideal language for this kind
of thing, as it's strengths are mainly in the web server field. I
suppose it could be done with the PHP CLI. Have you found a spec for the
printer, i.e. what inputs it accepts, or is there a driver API that you
know it uses?


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-14 Thread Ashley Sheridan
On Tue, 2008-10-14 at 17:06 -0400, Eric Butera wrote:
> On Tue, Oct 14, 2008 at 5:04 PM, Ashley Sheridan
> <[EMAIL PROTECTED]> wrote:
> > On Tue, 2008-10-14 at 15:55 -0500, Jay Moore wrote:
> >> Eric Butera wrote:
> >> > Has anyone ever had reports of problems with Outlook 2003 using utf-8
> >> > and quoted printable?  I've recently started getting complains from
> >> > our clients that some of their subscribers are having problems with
> >> > the message coming through as raw html.  The email client is always
> >> > Outlook 2003 on XP of various flavors.  I set up a copy of Outlook
> >> > 2003 and 2007 to test and I see the messages just fine.  Unfortunately
> >> > this makes it quite hard to troubleshoot.
> >> >
> >> > Should I just bite the bullet and iconv from utf8 to latin1?  Any
> >> > other thoughts?  What would really be great is if I could reproduce
> >> > the problem to try different approaches.
> >>
> >>
> >> Check php.ini
> >>
> >>
> >> ;)
> >>
> > I had a similar problem at work, and I found that adding some extra
> > headers to the email sorted this. Apparently Outlook had a problem with
> > all of the headers if it didn't have a few main ones. Are the rest of
> > the headers (like reply-to, from, etc) that you are setting being
> > preserved?
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> I suppose I don't have a reply-to specifically.  I do have a from and
> return-path.  I'll add that in there.
> 
> As for the rest:
> Return-Path: <[EMAIL PROTECTED]>
> Subject: Traverse City News: Entrepreneurs, Eateries Invest
> X-Unsubscribe: [EMAIL PROTECTED]
> X-Newsletter: 3431b0e8-aa87-401f-8701-728c86d4e6b4
> X-User: de962663-da70-42b7-9a8f-a9658032fda8
> X-Company: Some Company
> From: "Some Company" <[EMAIL PROTECTED]>
> Date: Tue, 14 Oct 2008 13:01:18 -0400
> Date: Tue, 14 Oct 2008 13:01:18 -0400
> Content-Type: multipart/alternative; charset="utf-8";
>  boundary="=_bc453a55a20a3363c997c148e36438c2"
> MIME-Version: 1.0
> 
> 
> --=_bc453a55a20a3363c997c148e36438c2
> Content-Type: text/plain; charset="utf-8"
> Content-Transfer-Encoding: quoted-printable
> 
> ...snip...

You have two Content-Type declarations, was that intentional, or was
that which was being produced by Outlook?


Ash
www.ashleysheridan.co.uk


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



[PHP] Re: Output to matrix printer

2008-10-14 Thread Shawn McKenzie
Dušan Novaković wrote:
> I have some request to sent text to matrix printer to print ticket for
> theater. Is it possible to do that whit some php functions? Main point
> is how to control length of paper that will be drawn inside and to
> print text on a specific place. It would be nice if somebody can write
> the code about this as example.
> 
> Thnx, Dusan
> 

Matrix printer?  Is this an awesomely powerful matrix of multiple
printers high output printers?

-Shawn


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



Re: [PHP] searching by tags....

2008-10-14 Thread Jochem Maas
Nathan Rixham schreef:
> Ashley Sheridan wrote:
>> On Tue, 2008-10-14 at 14:54 -0700, Ryan S wrote:
>>> quite a few sites seem to have a very neat way of implementing this
>>> with (url rewriting?) something like
>>> http://sitename/blog/tags/tag-comes-here/
> 
>> As for getting those search terms, well a link in a page can contain GET
>> values, such as http://www.somedomain.com/blog?tag=search_term .
>> Alternatively, you could use mod-rewrite to rewrite the URL and turn the
>> path into tag variables. This is the same as the above but with the
>> added benefit that users can type in tags directly more easily, and
>> there are apparently benefits for SEO with this method as well (but I'm
>> not sure how true that is)
> 
> it's very true; from the google webmaster guidelines:
> 
> If you decide to use dynamic pages (i.e., the URL contains a "?"
> character), be aware that not every search engine spider crawls dynamic
> pages as well as static pages. It helps to keep the parameters short and
> the number of them few.
> 
> previously it was text along the lines of "google doesn't index all
> pages with query parameters, so avoid them where possible"
> 
> additionally one of the weightier points in categorising pages within
> the SERPS is the text in the url (especially if the page is actually
> about /the_tag_in_the_url : see http://www.google.com/search?q=tags)

^-- some what 
ironic :-)
> 


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



Re: [PHP] Re: 1 last error to fix before the application is done!

2008-10-14 Thread Jochem Maas
Colin Guthrie schreef:
> Jochem Maas wrote:
>> Jason Pruim schreef:
>>> Good morning everyone!
>>>
>>> I think I might be having a "to early in the morning/not enough
>>> caffeine" moment... But I am down to 1 error on my timecard application
>>> that I would like to clean up. It's a small undefined index error, and
>>> the program works jsut fine the way it is, but why leave an error if you
>>> don't need to? :)
>>>
>>> Here is the error:
>>>
>>> [Tue Oct 14 08:19:47 2008] [error] PHP Notice:  Undefined index:
>>> userInfo in
>>> /Volumes/RAIDer/webserver/Documents/dev/stimecard/inc/function/authentication.func.php
>>>
>>> on line 22
>>>
>>> and here is the relevant code:
>>>
>>> ==> Line 22if($_SESSION['userInfo']['loggedin'] == TRUE) {
>>>
>>
>> if(isset($_SESSION['userInfo']['loggedin']) &&
>> $_SESSION['userInfo']['loggedin'] == TRUE) {
> 
> Or, seeing as I'm a stickler for compact code:

me too, I also like to be able to change stuff at a single point
in the code so I usually wrap this kind of thing inside a function/class
where I don't have to look at the length of the LOC that does the actual work 
:-)

...

>   if(!empty($_SESSION['userInfo']['loggedin'])) {

if (Sess::userLoggedIn()) { /* ... :-) */ }

> 
> empty() is like isset() but tests for all sorts of "empty" cases ('',
> false, null and 0 are all considered, "empty").

all true, but just as often you'd want to test for not only a non-empty value
but a very specific value. in which case you'd be back to using isset and a
comparison expression.

> 
> Col
> 
> 


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



Re: [PHP] searching by tags....

2008-10-14 Thread Ashley Sheridan
On Wed, 2008-10-15 at 01:17 +0200, Jochem Maas wrote:
> Nathan Rixham schreef:
> > Ashley Sheridan wrote:
> >> On Tue, 2008-10-14 at 14:54 -0700, Ryan S wrote:
> >>> quite a few sites seem to have a very neat way of implementing this
> >>> with (url rewriting?) something like
> >>> http://sitename/blog/tags/tag-comes-here/
> > 
> >> As for getting those search terms, well a link in a page can contain GET
> >> values, such as http://www.somedomain.com/blog?tag=search_term .
> >> Alternatively, you could use mod-rewrite to rewrite the URL and turn the
> >> path into tag variables. This is the same as the above but with the
> >> added benefit that users can type in tags directly more easily, and
> >> there are apparently benefits for SEO with this method as well (but I'm
> >> not sure how true that is)
> > 
> > it's very true; from the google webmaster guidelines:
> > 
> > If you decide to use dynamic pages (i.e., the URL contains a "?"
> > character), be aware that not every search engine spider crawls dynamic
> > pages as well as static pages. It helps to keep the parameters short and
> > the number of them few.
> > 
> > previously it was text along the lines of "google doesn't index all
> > pages with query parameters, so avoid them where possible"
> > 
> > additionally one of the weightier points in categorising pages within
> > the SERPS is the text in the url (especially if the page is actually
> > about /the_tag_in_the_url : see http://www.google.com/search?q=tags)
> 
>   ^-- some what 
> ironic :-)
> > 
> 
> 
Yeah I saw that too...

What always gets me is that forums always feature really high on search
results, and I've yet to see one of these forums use URL rewriting! I
really think this belief about query-less URLs being more search engine
friendly is outdated.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] searching by tags....

2008-10-14 Thread Nathan Rixham

Ashley Sheridan wrote:

On Wed, 2008-10-15 at 01:17 +0200, Jochem Maas wrote:

Nathan Rixham schreef:

Ashley Sheridan wrote:

On Tue, 2008-10-14 at 14:54 -0700, Ryan S wrote:

quite a few sites seem to have a very neat way of implementing this
with (url rewriting?) something like
http://sitename/blog/tags/tag-comes-here/

As for getting those search terms, well a link in a page can contain GET
values, such as http://www.somedomain.com/blog?tag=search_term .
Alternatively, you could use mod-rewrite to rewrite the URL and turn the
path into tag variables. This is the same as the above but with the
added benefit that users can type in tags directly more easily, and
there are apparently benefits for SEO with this method as well (but I'm
not sure how true that is)

it's very true; from the google webmaster guidelines:

If you decide to use dynamic pages (i.e., the URL contains a "?"
character), be aware that not every search engine spider crawls dynamic
pages as well as static pages. It helps to keep the parameters short and
the number of them few.

previously it was text along the lines of "google doesn't index all
pages with query parameters, so avoid them where possible"

additionally one of the weightier points in categorising pages within
the SERPS is the text in the url (especially if the page is actually
about /the_tag_in_the_url : see http://www.google.com/search?q=tags)

^-- some what 
ironic :-)


Yeah I saw that too...

What always gets me is that forums always feature really high on search
results, and I've yet to see one of these forums use URL rewriting! I
really think this belief about query-less URLs being more search engine
friendly is outdated.


Ash
www.ashleysheridan.co.uk



a search engines main job is to send people to what they are looking 
for, not what an seo has determined they should be seeing, as such 
"content is king".


Forums, lists and newsgroups tend to hold more specific content on 
exactly what the user is searching for, hence why google shows it high 
(as it's one of the few documents on the net which relate most directly 
to what was searched for [long tail search terms]); additionally all the 
aforementioned often have a trail of replies; sometimes this is a bonus 
as the replies repeat the keyword terms; however sometimes it's to the 
detriment, particularly when they wander off topic.


It's also worth noting that sites which update frequently, especially 
those who update sitemaps and send out pings get crawled more frequently 
and thus indexed faster. On hot-topics this has a knock on effect, the 
posts get crawled by scrapers and content harvesters and re-published 
(often with a link back) - and this helps as the vote count for the 
original forum post goes up due to the link backs + the original source 
is detected as such and given prominence over the copies (most of the time).


Further people take care to title their posts/messages correctly in 
order to attract answers quickly, this text is then repeated on the 
forum page in all the prominent places (title, permalink, heading 
tags..) and further still, the post/message is normally perfectly 
matched to the user specified title - so it's natural seo at it's best. 
(Worth having a read up on contextual and semantic analysis as well)


Next up, the sites weight, as forums often have thousands (or hundreds 
of thousands) of pages/posts, and high volume traffic, the site is 
deemed more important and thus higher ranking, which brings in more 
traffic and so it spirals. On this note it's also worth considering that 
google track what you click on so if searchers continually click item 3 
in the search results, over time they'll move it up as it's been classed 
as most accurate for that search (more.. obviously due to wide use of 
analytics and checking when a user comes back to the results to click 
another they can also harvest accuracy data by comparing bounce rates 
etc and adjust accordingly).


so much more on this subject but that's about the top and bottom of it 
in this scenario.


*yawn* getting late

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



Re: [PHP] Re: utf8/quoted printable based mail renders raw html

2008-10-14 Thread Eric Butera
On Tue, Oct 14, 2008 at 5:54 PM, Nathan Rixham <[EMAIL PROTECTED]> wrote:
> Eric Butera wrote:
>>
>> On Tue, Oct 14, 2008 at 5:04 PM, Ashley Sheridan
>
>> From: "Some Company" <[EMAIL PROTECTED]>
>> Date: Tue, 14 Oct 2008 13:01:18 -0400
>> Date: Tue, 14 Oct 2008 13:01:18 -0400
>
> maybe because you have two dates in the headers?
>
> whats the mime type of the html block? if it's set to text/plain then..
>
> Content-Type: text/plain; charset="utf-8"
> doesn't need quotes so..
> Content-Type: text/plain; charset=utf-8
>
> is it all valid utf-8? (and indeed valid quoted-printable utf-8)?
>
> + something rings in my mind about either wrong line terminations in the
> mime headers OR having 1 too many..

There are two dates in there because of my copy & paste error.  I only
pasted a little bit and later revised by pasting more of my headers to
be more clear.  Whoops.

As for it being all valid utf-8, I'm pretty sure it is.  I have a
header that sets the content type to text/html charset utf8 along with
a meta tag.  My database tables are all utf8 (along with the
collation) and so is that connection.  I suppose I haven't gone
through the extreme of actually validating each character, but that is
a bit much.

As for the headers & mime encoding, well I'd have to search the Zend
Framework docs/forums to figure that out since it isn't really a
php-general question.  There are a lot of eyes on this code and it has
really good unit tests.  I'm fairly confident in its abilities, but
nothing is perfect.

I'd err on the side of my content before anything else.  Maybe looking
into the headers/quoting issue might provide some light.

Thanks!

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



[PHP] pdo and dabase schema

2008-10-14 Thread Alain Roger
Hi,

is there a way with PDO class to not have:
- to execute a simple SET search_path TO myschema;
- and after to fletch another SQL request, like select to be sure that the
SQL statement will be perform on this schema ?
(basically i want to do it in 1 step)

because i tried to specify the schema into my sql statement but in this case
PDO returns me 0 record.
thanks a lot,

-- 
Alain

Windows XP SP3
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008


Re: [PHP] pdo and dabase schema

2008-10-14 Thread Chris

Alain Roger wrote:

Hi,

is there a way with PDO class to not have:
- to execute a simple SET search_path TO myschema;


can you alter the postgres users path?

alter user  set search_path to new_schema, current_schemas();

or some variation on that.


- and after to fletch another SQL request, like select to be sure that the
SQL statement will be perform on this schema ?
(basically i want to do it in 1 step)


You can't. After you connect you have to change the schema.

--
Postgresql & php tutorials
http://www.designmagick.com/


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



Re: [PHP] Re: Output to matrix printer

2008-10-14 Thread Per Jessen
Shawn McKenzie wrote:

> Matrix printer?  Is this an awesomely powerful matrix of multiple
> printers high output printers?
> 
> -Shawn

http://en.wikipedia.org/wiki/Matrix_printer


/Per Jessen, Zürich


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



Re: [PHP] searching by tags....

2008-10-14 Thread Ashley Sheridan
On Wed, 2008-10-15 at 00:58 +0100, Nathan Rixham wrote:
> Ashley Sheridan wrote:
> > On Wed, 2008-10-15 at 01:17 +0200, Jochem Maas wrote:
> >> Nathan Rixham schreef:
> >>> Ashley Sheridan wrote:
>  On Tue, 2008-10-14 at 14:54 -0700, Ryan S wrote:
> > quite a few sites seem to have a very neat way of implementing this
> > with (url rewriting?) something like
> > http://sitename/blog/tags/tag-comes-here/
>  As for getting those search terms, well a link in a page can contain GET
>  values, such as http://www.somedomain.com/blog?tag=search_term .
>  Alternatively, you could use mod-rewrite to rewrite the URL and turn the
>  path into tag variables. This is the same as the above but with the
>  added benefit that users can type in tags directly more easily, and
>  there are apparently benefits for SEO with this method as well (but I'm
>  not sure how true that is)
> >>> it's very true; from the google webmaster guidelines:
> >>>
> >>> If you decide to use dynamic pages (i.e., the URL contains a "?"
> >>> character), be aware that not every search engine spider crawls dynamic
> >>> pages as well as static pages. It helps to keep the parameters short and
> >>> the number of them few.
> >>>
> >>> previously it was text along the lines of "google doesn't index all
> >>> pages with query parameters, so avoid them where possible"
> >>>
> >>> additionally one of the weightier points in categorising pages within
> >>> the SERPS is the text in the url (especially if the page is actually
> >>> about /the_tag_in_the_url : see http://www.google.com/search?q=tags)
> >>^-- some what 
> >> ironic :-)
> >>
> > Yeah I saw that too...
> > 
> > What always gets me is that forums always feature really high on search
> > results, and I've yet to see one of these forums use URL rewriting! I
> > really think this belief about query-less URLs being more search engine
> > friendly is outdated.
> > 
> > 
> > Ash
> > www.ashleysheridan.co.uk
> > 
> 
> a search engines main job is to send people to what they are looking 
> for, not what an seo has determined they should be seeing, as such 
> "content is king".
> 
> Forums, lists and newsgroups tend to hold more specific content on 
> exactly what the user is searching for, hence why google shows it high 
> (as it's one of the few documents on the net which relate most directly 
> to what was searched for [long tail search terms]); additionally all the 
> aforementioned often have a trail of replies; sometimes this is a bonus 
> as the replies repeat the keyword terms; however sometimes it's to the 
> detriment, particularly when they wander off topic.
> 
> It's also worth noting that sites which update frequently, especially 
> those who update sitemaps and send out pings get crawled more frequently 
> and thus indexed faster. On hot-topics this has a knock on effect, the 
> posts get crawled by scrapers and content harvesters and re-published 
> (often with a link back) - and this helps as the vote count for the 
> original forum post goes up due to the link backs + the original source 
> is detected as such and given prominence over the copies (most of the time).
> 
> Further people take care to title their posts/messages correctly in 
> order to attract answers quickly, this text is then repeated on the 
> forum page in all the prominent places (title, permalink, heading 
> tags..) and further still, the post/message is normally perfectly 
> matched to the user specified title - so it's natural seo at it's best. 
> (Worth having a read up on contextual and semantic analysis as well)
> 
> Next up, the sites weight, as forums often have thousands (or hundreds 
> of thousands) of pages/posts, and high volume traffic, the site is 
> deemed more important and thus higher ranking, which brings in more 
> traffic and so it spirals. On this note it's also worth considering that 
> google track what you click on so if searchers continually click item 3 
> in the search results, over time they'll move it up as it's been classed 
> as most accurate for that search (more.. obviously due to wide use of 
> analytics and checking when a user comes back to the results to click 
> another they can also harvest accuracy data by comparing bounce rates 
> etc and adjust accordingly).
> 
> so much more on this subject but that's about the top and bottom of it 
> in this scenario.
> 
> *yawn* getting late
> 
You're preaching to the converted on this topic, I've already put
together a couple of articles on my site about it in the past. What I
was saying was that the sites that seem to feature so prominently on
listings were in fact using querystring URLs; the very thing that SEO
guides tell us not to use. I think it's just an outdated belief that URL
rewriting is better, as clearly it doesn't ever seem to be.



Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscr