Re: [PHP] PHP code will not work

2008-07-10 Thread Sanjay Mantoor
Hi,

I found
$_SERVER['HTTP_USER_AGENT'] works when you are using with browser by
server like Apache.

If you are executing your code like script in command prompt it may not work.
I got below :-
PHP Notice:  Undefined index: HTTP_USER_AGENT

If you use print_r($_SERVER) , you can see all the listing of indexes.



On Wed, Jul 9, 2008 at 7:15 PM, Mike V [EMAIL PROTECTED] wrote:

 I had this problem and just figured it out.  I was copying and pasting the
 code snippet from the tutorials page to my test editor and in the process
 picked up an invisible ctrl char.  Doh!!


 Joseph Subida wrote:


 The error I get when I try

 ?php
 echo $_SERVER['HTTP_USER_AGENT'];
 ?

 is

 Parse error: syntax error, unexpected T_VARIABLE in
 /Library/WebServer/Documents/test.php on line 106

 I tried Googling T_VARIABLE and haven't found any useful solutions.
 Any ideas? Thanks!

 -J.C.

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




 --
 View this message in context: 
 http://www.nabble.com/PHP-code-will-not-work-tp17811807p18362005.html
 Sent from the PHP - General mailing list archive at Nabble.com.


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





-- 
Thanks,
Sanjay Mantoor

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



Re: [PHP] PHP code will not work

2008-07-10 Thread Ted Wood


PHP at the command line doesn't run within a web server environment.

~Ted


On 9-Jul-08, at 11:07 PM, Sanjay Mantoor wrote:


Hi,

I found
$_SERVER['HTTP_USER_AGENT'] works when you are using with browser by
server like Apache.

If you are executing your code like script in command prompt it may  
not work.

I got below :-
PHP Notice:  Undefined index: HTTP_USER_AGENT

If you use print_r($_SERVER) , you can see all the listing of indexes.



On Wed, Jul 9, 2008 at 7:15 PM, Mike V [EMAIL PROTECTED] wrote:


I had this problem and just figured it out.  I was copying and  
pasting the
code snippet from the tutorials page to my test editor and in the  
process

picked up an invisible ctrl char.  Doh!!


Joseph Subida wrote:



The error I get when I try

?php
echo $_SERVER['HTTP_USER_AGENT'];
?

is

Parse error: syntax error, unexpected T_VARIABLE in
/Library/WebServer/Documents/test.php on line 106

I tried Googling T_VARIABLE and haven't found any useful  
solutions.

Any ideas? Thanks!

-J.C.

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





--
View this message in context: 
http://www.nabble.com/PHP-code-will-not-work-tp17811807p18362005.html
Sent from the PHP - General mailing list archive at Nabble.com.


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






--
Thanks,
Sanjay Mantoor

--
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] Logic sought

2008-07-10 Thread Per Jessen
tedd wrote:

 If two, or more, users hit the site at the same time then a RACE
 condition may have one user getting something they didn't ask for or
 not getting anything at all.
 
 The complicated way I figure I could solve this would be to:
 
 1. Generate a random string name for the file -- instead of test.zip,
 it could be ax12nhg34.zip.

Either a random name or one based on the session_id(). 

 I know this will work, but if the user never downloads the file, then
 the files accumulate on the server.

Use cron to run a daily job of 

'find /yourtempdir -type f -ctime +1 | xargs rm'

Run more often and/or with less ctime if you need the space or the site
is very busy.


/Per Jessen, Zürich


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



[PHP] Pear DB

2008-07-10 Thread John Comerford

Hi Folks,

I have just successfully lobbied for the company I work for to use 
PHP/MySQL for our next website.  My Question is regarding DB abstraction 
.  I know there is a Pear DB module, is this the best to use ?  I have a 
vague memory of reading somewhere that there is a newer lib or something 
which is considered better ?


TIA,
 JC

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



Re: [PHP] Pear DB

2008-07-10 Thread Jason Norwood-Young

On Thu, 2008-07-10 at 16:47 +1000, John Comerford wrote:
 Hi Folks,
 
 I have just successfully lobbied for the company I work for to use 
 PHP/MySQL for our next website.  My Question is regarding DB abstraction 
 .  I know there is a Pear DB module, is this the best to use ?  I have a 
 vague memory of reading somewhere that there is a newer lib or something 
 which is considered better ?
 

Hi John

You might consider CodeIgniter - it's a very nice, simple to use
framework with a pretty good DB abstraction layer built in.
http://codeigniter.com/

J



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



Re: [PHP] Pear DB

2008-07-10 Thread Larry Garfield
PEAR::DB was deprecated years ago.  Do not use it.  

PEAR::MDB2 is the preferred PEAR wrapper these days.  

Personally, I skip them both and prefer to go straight to PDO, available in 
PHP 5.  

http://www.php.net/pdo

On Thursday 10 July 2008 1:47:34 am John Comerford wrote:
 Hi Folks,

 I have just successfully lobbied for the company I work for to use
 PHP/MySQL for our next website.  My Question is regarding DB abstraction
 .  I know there is a Pear DB module, is this the best to use ?  I have a
 vague memory of reading somewhere that there is a newer lib or something
 which is considered better ?

 TIA,
   JC

-- 
Larry Garfield
[EMAIL PROTECTED]

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



RE: [PHP] Pear DB

2008-07-10 Thread Alex Chamberlain
 Hi Folks,

 I have just successfully lobbied for the company I work for to use 
 PHP/MySQL for our next website.  My Question is regarding DB abstraction 
 .  I know there is a Pear DB module, is this the best to use ?  I have a 
 vague memory of reading somewhere that there is a newer lib or something 
 which is considered better ?

 TIA,
   JC

The newest version of Pear DB is Pear MDB2. I have to say I'm not a great
fan of the pear system, but MDB2 is probably one of the best.

Alex

No virus found in this outgoing message. Scanned by AVG Free 8.0
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.4.7/1542 - Release Date: 09/07/2008
06:50


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



[PHP] scalable web gallery

2008-07-10 Thread paragasu
i am planning to create a web photo gallery. i know there is a lot
available out there,
but i really want to create my own. the problem is not about creating
the photo gallery.
i want it to be scalable.

the plan is saving the image metadata in the database and keep the
original files
in a folder. while it work perfectly, i afraid how many files 1
directory can keep.
in 1 year, there going to be more than 1000 photo uploaded or more.
sure it bring problem
to maintain thus files.

when i see big2 website out there like friendster, photobucket. the
url for the image change
like
pic-1.domain.com/images/filename.jpg
pic-2.domain.com/images/filename.jpg
etc. they seems to put the image in different subdomain. Just wan't to
ask anyone who
did create a big-big web gallery like this. How did you do it?

thanks

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



Re: [PHP] Pear DB

2008-07-10 Thread Lester Caine

John Comerford wrote:

Hi Folks,

I have just successfully lobbied for the company I work for to use 
PHP/MySQL for our next website.  My Question is regarding DB abstraction 
.  I know there is a Pear DB module, is this the best to use ?  I have a 
vague memory of reading somewhere that there is a newer lib or something 
which is considered better ?


As others have said - MDB2 or PDO are the Pear:DB replacements, but if you 
would like a proper abstraction of SQL then ADOdb is still the best choice and 
it can handle PDO or raw mysql drivers internally. But more important it gives 
you the safety net to be able to switch to an alternative to MySQL ;)


http://adodb.sourceforge.net/

You will also find a lot of useful projects that are built on it which may 
provide the bulk of your site code. No need to build a site from scratch - 
just select a suitable framework :)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



AW: [PHP] scalable web gallery

2008-07-10 Thread Andreas J.
 in 1 year, there going to be more than 1000 photo uploaded or more.
That isn’t really much.

A directory can held much more than a few thousand files.

They use more than one Server because 1 Server can't handle the load. The
don’t do that because of limited File system.

But the file system may get slower if you have thousands of files in one
dir. So maybe make dirs like c/a/cartoon.jpg to get not too much files in
one dir.

If you need several Servers for this depends on how many visitors you have.

-Ursprüngliche Nachricht-
Von: paragasu [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 10. Juli 2008 09:47
An: php-general@lists.php.net
Betreff: [PHP] scalable web gallery

i am planning to create a web photo gallery. i know there is a lot
available out there,
but i really want to create my own. the problem is not about creating
the photo gallery.
i want it to be scalable.

the plan is saving the image metadata in the database and keep the
original files
in a folder. while it work perfectly, i afraid how many files 1
directory can keep.
in 1 year, there going to be more than 1000 photo uploaded or more.
sure it bring problem
to maintain thus files.

when i see big2 website out there like friendster, photobucket. the
url for the image change
like
pic-1.domain.com/images/filename.jpg
pic-2.domain.com/images/filename.jpg
etc. they seems to put the image in different subdomain. Just wan't to
ask anyone who
did create a big-big web gallery like this. How did you do it?

thanks

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


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



Re: [PHP] scalable web gallery

2008-07-10 Thread mike
On 7/10/08, paragasu [EMAIL PROTECTED] wrote:
 i am planning to create a web photo gallery. i know there is a lot
 available out there,
 but i really want to create my own. the problem is not about creating
 the photo gallery.
 i want it to be scalable.

 the plan is saving the image metadata in the database and keep the
 original files
 in a folder. while it work perfectly, i afraid how many files 1
 directory can keep.
 in 1 year, there going to be more than 1000 photo uploaded or more.
 sure it bring problem
 to maintain thus files.

if this becomes a huge project i'd recommend looking into using mogilefs.

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



Re: [PHP] scalable web gallery

2008-07-10 Thread Thodoris


O/H paragasu ??:

i am planning to create a web photo gallery. i know there is a lot
available out there,
but i really want to create my own. the problem is not about creating
the photo gallery.
i want it to be scalable.

the plan is saving the image metadata in the database and keep the
original files
in a folder. while it work perfectly, i afraid how many files 1
directory can keep.
in 1 year, there going to be more than 1000 photo uploaded or more.
sure it bring problem
to maintain thus files.

when i see big2 website out there like friendster, photobucket. the
url for the image change
like
pic-1.domain.com/images/filename.jpg
pic-2.domain.com/images/filename.jpg
etc. they seems to put the image in different subdomain. Just wan't to
ask anyone who
did create a big-big web gallery like this. How did you do it?

thanks

  
I never did create a big image gallery but I have worked with uploaded 
files quite many times. There are many solutions to this so it depends 
on what you have and what you are willing to do.


A first solution that I can think of is to separate your images in 
categories. Add a field in the database table that describes the image 
category and make a directory with the same name. When you query the 
database you will get the filename of the image (or something like that) 
and you will get the image from this specific directory. If you so many 
images that this does not solve this you may add an extra field in the 
database and add subcategories and move the files into a subdir 
(subcategory) inside the previously mentioned dir (category).


Another solution that is better if you are not willing to categorize the 
images is to divide them by date. You may include a date or date-time 
field in the database that describes the creation date of the image (or 
the upload date if you like) and divide the images into directories per 
month or per year or even both. Like making a directory 2008 and add 
inside sub-directories like 01,02,03... or Jan,Feb,Mar etc. Now when you 
query the database you may find from the creation date the directory 
that sores the image and everything is in order. For e.g.


If the date you got from the database is 2008-01-23 and the image name 
is image01.jpg then the path would be:


?php

$date = '2008-01-23';
$fname = 'image01.jpg';
list($year,$month,$day) = split('-',$date);
$file_dir = '/data/images';
$path = $file_dir./.$year./.$month./.$fname;

print $path;
?

--
Thodoris


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



[PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Peter Ford

tedd wrote:

Hi gang:

I'm running a Mac (so I know mine is a bit different size wise) but I'm 
currently using Veranda at 14 point for coding.


Just out of curiosity, what font and size do you ppls use for your 
programming?


Cheers,

tedd



I'd love to be coding on the Veranda, but it's raining horizontally at the 
moment and my keyboard hates being wet.


I'm using Lucida Sans for code these days - I finally figured that it didn't 
really have to be a fixed-width font, since I couldn't find one that wasn't ugly.


--
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



[PHP] Re: Logic sought

2008-07-10 Thread Peter Ford

tedd wrote:

Hi gang:

Here's the logic problem.

First the site:

http://php1.net/b/zip-files/

Now, the site works well enough. The user selects what they want, clicks 
Submit, the order is assembled in zip file and presented to the user for 
downloading.


However, as it stands now, before the script assembles the test.zip, it 
deletes (unlinks) the previous test.zip and therein lies the problem.


If two, or more, users hit the site at the same time then a RACE 
condition may have one user getting something they didn't ask for or not 
getting anything at all.


The complicated way I figure I could solve this would be to:

1. Generate a random string name for the file -- instead of test.zip, it 
could be ax12nhg34.zip.


2. Then when the user selects the download that would trigger a 
javascript routine that would send the name of the file to be deleted to 
a slave php script that would unlinks the file.


I know this will work, but if the user never downloads the file, then 
the files accumulate on the server.


Does anyone have a better idea?

Thanks,

tedd



For bespoke downloads I create a directory somewhere named with the session ID, 
then build the download file there and only allow access throw a PHP script 
which knows the session ID. I guess it depends how commercial or sensitive the 
data is.

Then I have a cron or something clean up the old directories.

It would be nice to have some sort of trigger to indicate that the session has 
expired - anyone know if Apache can do such a thing?
In a Java environment, I used a session object which cleaned up such folders 
when it was garbage-collected...


--
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] Need help with regular expression

2008-07-10 Thread Maxim Antonov

Hello.

But I need no td and tr inside regular expression
It is a part of my templater.


In real code it looks like:
  if(strlen($item[$key])1){
return 
preg_replace('#\{%%%.*?\{%'.$key.'%\}.*?%%%\}#is','',$tpl);

}

if one of $key inside  {%%%  %%%} points to empty array item - all 
section between {%%% %%%} must be deleted.




Daniel Brown :

On Wed, Jul 9, 2008 at 5:21 AM, Maxim Antonov [EMAIL PROTECTED] wrote:

Hi, all!

I try to use folowing regular expression:
$out =
preg_replace('#\{%%%.*?\{%bigfoto%\}.*?%%%\}#is','==REPLACEMENT==',$str);


[snip!]

I need result as:

trtdNAME:/tdtdinput type=text name=name value=
size=80//td/tr
 trtdFoto:/tdtdinput type=file name=foto value={%foto%} /
 {%%%br/img alt={%name%} src={%foto%}/%%%}
 /td/tr
==REPLACEMENT==

[snip!]

To get it *exactly* as you've mentioned here, use this instead:

?php
$out = 
preg_replace('/trtdBig.*\{%%%.*\{%bigfoto%\}.*%%%\}.*\/tr/Uis','==REPLACEMENT==',$str);
?



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



Re: [PHP] scalable web gallery

2008-07-10 Thread Per Jessen
paragasu wrote:

 i am planning to create a web photo gallery. i know there is a lot
 available out there, but i really want to create my own. the problem
 is not about creating  the photo gallery.
 i want it to be scalable.

The first question is - how scalable?  How many photos and how many
users?

 the plan is saving the image metadata in the database and keep the
 original files in a folder. while it work perfectly, i afraid how many
 files 1 directory can keep.

Easily more than 100K.  Depending on your filesystem, directory access
might slow down the bigger it gets.  

 in 1 year, there going to be more than 1000 photo uploaded or more.
 sure it bring problem to maintain thus files.

No, 1000 photos in a single directory will not be a problem at all.


/Per Jessen, Zürich


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



[PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Colin Guthrie

tedd wrote:
Just out of curiosity, what font and size do you ppls use for your 
programming?


I've got a lot of projects so I always use a really small font to save 
on disk space



Col


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



[PHP] Error handling, apache and ErrorDocument

2008-07-10 Thread Daniele Grillenzoni
Hi, I'm having trouble with a framework I'm developing, apparently when a 
non-catchable error occurs (E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, 
E_COMPILE_ERROR, E_COMPILE_WARNING types) not only I can't fire up my error 
handling function, I can't even display the static html page I set with the 
ErrorDocument apache directive. What's weird is that it doesn't look like an 
apache problem, with perl it works perfectly.


This guy had the same problem as me, check his post (point 3 mostly): 
http://www.entropy.ch/blog/Developer/2007/05/10/Apache-ErrorDocument-PHP-header-interaction.html


Thanks in advance

Daniele Grillenzoni 



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



Re: [PHP] scalable web gallery

2008-07-10 Thread paragasu
snip
Another solution that is better if you are not willing to categorize
the images is to divide them by date. You may include a date or
date-time field in the database that describes the creation date of
the image (or the upload date if you like) and divide the images into
directories per month or per year or even both. Like making a
directory 2008 and add inside sub-directories like 01,02,03... or
Jan,Feb,Mar etc. Now when you query the database you may find from the
creation date the directory that sores the image and everything is in
order. For e.g.

If the date you got from the database is 2008-01-23 and the image name
is image01.jpg then the path would be:

?php

$date = '2008-01-23';
$fname = 'image01.jpg';
list($year,$month,$day) = split('-',$date);
$file_dir = '/data/images';
$path = $file_dir./.$year./.$month./.$fname;

print $path;
?
/snip
wow!.. this is a good idea. i really never think of this idea. i think
i want to divide the image
in a folder separated by year. thanks...

i am also wondering if there is another approach on organizing the photos.
what i heard from friends, image gallery like flickr using tag to
organize the photos.
anyone have comment on tag vs album?

On 7/10/08, Per Jessen [EMAIL PROTECTED] wrote:
 paragasu wrote:

 i am planning to create a web photo gallery. i know there is a lot
 available out there, but i really want to create my own. the problem
 is not about creating  the photo gallery.
 i want it to be scalable.

 The first question is - how scalable?  How many photos and how many
 users?

 the plan is saving the image metadata in the database and keep the
 original files in a folder. while it work perfectly, i afraid how many
 files 1 directory can keep.

 Easily more than 100K.  Depending on your filesystem, directory access
 might slow down the bigger it gets.

 in 1 year, there going to be more than 1000 photo uploaded or more.
 sure it bring problem to maintain thus files.

 No, 1000 photos in a single directory will not be a problem at all.


 /Per Jessen, Zürich


 --
 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] Need help with regular expression

2008-07-10 Thread Boyd, Todd M.
 -Original Message-
 From: Maxim Antonov [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 10, 2008 4:24 AM
 To: php-general@lists.php.net; Daniel Brown
 Subject: Re: [PHP] Need help with regular expression
 
 Hello.
 
 But I need no td and tr inside regular expression
 It is a part of my templater.
 
 
 In real code it looks like:
if(strlen($item[$key])1){
  return
 preg_replace('#\{%%%.*?\{%'.$key.'%\}.*?%%%\}#is','',$tpl);
  }
 
 if one of $key inside  {%%%  %%%} points to empty array item - all
 section between {%%% %%%} must be deleted.

---8--- snip

Maxim,

You could try using a capture group, and re-assemble the match with
the match group inbetween your {%%% %%%} omitted. Just an idea.


Todd Boyd
Web Programmer




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



[PHP] PHP and Modbus

2008-07-10 Thread Tom Chubb
Hi List,
Has anyone on this list had any application experience of polling Modbus
devices with PHP?
Thanks


Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Eric Butera
Here's how I roll. :)  Consolas is the font.

http://refraxion.com/pdt-eclipse.png

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



Re: [PHP] Need help with regular expression

2008-07-10 Thread Al

Your description of the problem is confusing.

Do you simply want to delete a table row if it contains a variable, e.g., $var='bigfoto' and append 
==REPLACEMENT== ? Where $var can be anything you assign.



Maxim Antonov wrote:

Hello.

But I need no td and tr inside regular expression
It is a part of my templater.


In real code it looks like:
  if(strlen($item[$key])1){
return 
preg_replace('#\{%%%.*?\{%'.$key.'%\}.*?%%%\}#is','',$tpl);

}

if one of $key inside  {%%%  %%%} points to empty array item - all 
section between {%%% %%%} must be deleted.




Daniel Brown :
On Wed, Jul 9, 2008 at 5:21 AM, Maxim Antonov [EMAIL PROTECTED] 
wrote:

Hi, all!

I try to use folowing regular expression:
$out =
preg_replace('#\{%%%.*?\{%bigfoto%\}.*?%%%\}#is','==REPLACEMENT==',$str); 




[snip!]

I need result as:

trtdNAME:/tdtdinput type=text name=name value=
size=80//td/tr
 trtdFoto:/tdtdinput type=file name=foto 
value={%foto%} /

 {%%%br/img alt={%name%} src={%foto%}/%%%}
 /td/tr
==REPLACEMENT==

[snip!]

To get it *exactly* as you've mentioned here, use this instead:

?php
$out = 
preg_replace('/trtdBig.*\{%%%.*\{%bigfoto%\}.*%%%\}.*\/tr/Uis','==REPLACEMENT==',$str); 


?



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



Re: [PHP] Need help with regular expression

2008-07-10 Thread Eric Butera
On Wed, Jul 9, 2008 at 5:21 AM, Maxim Antonov [EMAIL PROTECTED] wrote:
 Hi, all!

 I try to use folowing regular expression:
 $out =
 preg_replace('#\{%%%.*?\{%bigfoto%\}.*?%%%\}#is','==REPLACEMENT==',$str);

 It not work as I need. Please tell me - what I do wrong?

 I have string:


   trtdNAME:/tdtdinput type=text name=name value=
 size=80//td/tr
  trtdFoto:/tdtdinput type=file name=foto value={%foto%} /
  {%%%br/img alt={%name%} src={%foto%}/%%%}
  /td/tr
  trtdBig foto:/tdtdinput type=file name=bigfoto value= /
  {%%%br/img alt={%name%} src={%bigfoto%}/%%%}
  /td/tr



 I need result as:


 trtdNAME:/tdtdinput type=text name=name value=
 size=80//td/tr
  trtdFoto:/tdtdinput type=file name=foto value={%foto%} /
  {%%%br/img alt={%name%} src={%foto%}/%%%}
  /td/tr
 ==REPLACEMENT==


 And I have this result:

   trtdNAME:/tdtdinput type=text name=name value=
 size=80//td/tr
  trtdFoto:/tdtdinput type=file name=foto value={%foto%} /
 ==REPLACEMENT==
  /td/tr


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



I'm sure it won't be this easy because of who knows what (like
inheriting code, etc), but why not just use something easier like:


$replace = array(
'{%key1%}' = 'value1',
'{%key2%}' = 'value2'
);

$html = str_replace(
array_keys($replace),
array_values($replace),
file_get_contents('tpl.html')
);


Or the easiest is to just use raw php code seeing as php is a
templating language. :)

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



[PHP] phpmyadmin

2008-07-10 Thread Ronald Wiplinger
I would like to use this time phpmyadmin (2.11.3) to setup for a new
user a database, which he can use to setup his own tables for his web site.

User abc should get his own database xyz.

I am not sure if I did it correct, and if it is safe to do so:

A
==
1. I created an empty database xyz (main page of phpmyadmin)
2. I added a new user on the Privileges page with:
User: abc
Host: Any (%)
Password: (yes)
Global privileges: 
(Data:) SELECT, INSERT, UPDATE, DELETE, FILE
(Structure:) CREATE, ALTER, INDEX, DROP, CREATE TEMPORARY TABLES
(Administration:)(nothing ticked)
(Resource limits:)   (nothing ticked)

What does it mean so far? Can the user abc already access data of any
database?

B
==
I found Database-specific privileges for the user abc, where I added
the database xyz and ticked:
(Data:) SELECT, INSERT, UPDATE, DELETE
(Structure:) CREATE, ALTER, INDEX, DROP, CREATE TEMPORARY TABLES
(Administration:)(nothing ticked)

What confuses me is that I have already some databases setup for my own
web, but none of the users has B attached.
Currently I am going away from a single person using the database to
allow others also to use the database.

Thanks for enlightening me.

bye

Ronald







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



Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Daniel Brown
On Thu, Jul 10, 2008 at 9:46 AM, Eric Butera [EMAIL PROTECTED] wrote:
 Here's how I roll. :)  Consolas is the font.

 http://refraxion.com/pdt-eclipse.png

Reminds me of Comic Sans Bold.  ;-P

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
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: What font/size do you use for programming?

2008-07-10 Thread Daniel Brown
On Thu, Jul 10, 2008 at 5:07 AM, Peter Ford [EMAIL PROTECTED] wrote:

 I'm running a Mac (so I know mine is a bit different size wise) but I'm
 currently using Veranda at 14 point for coding.

 I'd love to be coding on the Veranda, but it's raining horizontally at the
 moment and my keyboard hates being wet.

Ha!  Nice catch with the spelling, Pete.  That actually almost
made me spit coffee on my many thousands of monitors (they're
multiplying like rabbits now).

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
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: What font/size do you use for programming?

2008-07-10 Thread Daniel Brown
On Thu, Jul 10, 2008 at 6:12 AM, Colin Guthrie [EMAIL PROTECTED] wrote:
 tedd wrote:

 Just out of curiosity, what font and size do you ppls use for your
 programming?

 I've got a lot of projects so I always use a really small font to save on
 disk space

That doesn't work, dummy!  You still have to save only half of
your files.  ;-P

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
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] PHP code will not work

2008-07-10 Thread Daniel Brown
On Thu, Jul 10, 2008 at 2:15 AM, Ted Wood [EMAIL PROTECTED] wrote:

 PHP at the command line doesn't run within a web server environment.

Correct.  EGPCS is inaccessible via the CLI (unless you
force-populate the variables and arrays).  Only via a web server will
you have access to:

$_ENV
$_GET
$_POST
$_COOKIE
$_SERVER
- and -
$_SESSION

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
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] phpmyadmin

2008-07-10 Thread Wolf

 Ronald Wiplinger [EMAIL PROTECTED] wrote: 
 I would like to use this time phpmyadmin (2.11.3) to setup for a new
 user a database, which he can use to setup his own tables for his web site.
 
 User abc should get his own database xyz.

Yup, you can do this.  Depending on how you are setting this up, you could 
theoretically put a separate phpmyadmin folder in each of the web folders of 
the users who use your services.

Have you RTFM and set it up as the documentation stated and then tested it by 
logging in as the new user?

http://www.phpmyadmin.net/home_page/docs.php

Wolf

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



Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Philip Thompson

On Jul 10, 2008, at 4:07 AM, Peter Ford wrote:


tedd wrote:

Hi gang:
I'm running a Mac (so I know mine is a bit different size wise) but  
I'm currently using Veranda at 14 point for coding.
Just out of curiosity, what font and size do you ppls use for your  
programming?

Cheers,
tedd


I'd love to be coding on the Veranda, but it's raining horizontally  
at the moment and my keyboard hates being wet.


I'm using Lucida Sans for code these days - I finally figured that  
it didn't really have to be a fixed-width font, since I couldn't  
find one that wasn't ugly.


Are you sure you're a *coder*? =D I've looked at some code in a non  
fixed-width font before and it hurt my eyes! I bet you use tabs  
instead of spaces too. ;)


~Phil


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



Re: [PHP] scalable web gallery

2008-07-10 Thread Daniel Brown
On Thu, Jul 10, 2008 at 3:46 AM, paragasu [EMAIL PROTECTED] wrote:

 the plan is saving the image metadata in the database and keep the
 original files
 in a folder. while it work perfectly, i afraid how many files 1
 directory can keep.
 in 1 year, there going to be more than 1000 photo uploaded or more.
 sure it bring problem
 to maintain thus files.

I wrote a gallery script in about two hours last year, and in the
first week alone, over 7,000 images were uploaded by fans of the band
for whom I wrote it.  It had full administrative control, voting, and
user authentication requirements, in addition to some other stuff, all
written from scratch in that time.

So an existing system that's been around for a while would
*certainly* be able to handle a mere 1,000 in a year.  No worries
about that.

And for the record, in the olden days, there was a limit of
about 2048 files per directory, back when no one thought there would
ever be a need for nearly that many files.  Then, with improved
filesystems, the limit was rumored to be another magic number: 65535.
That depended on the operating system, filesystem, and the kernel.  I
think (but don't quote me on this) that BeOS had the 65535 limit.

Now, on an ext3 filesystem (we're not counting ReiserFS because
(1) I was never a fan, and (2) he might kill me if I say something
bad!  8^O) you're okay with hundreds of thousands of files per
directory.  ls'ing will be a bit of a pain in the ass, and if you're
in Bash, you probably don't want to double-TAB the directory, but all
in all, you'll be okay.

Still, I'd create 16 subdirectories under the images directory:
0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f.  Then name the file as an MD5 hash of
the image uploaded, and place it in the directory matching the first
character of the new file name.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
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



[PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Colin Guthrie

Daniel Brown wrote:

On Thu, Jul 10, 2008 at 6:12 AM, Colin Guthrie [EMAIL PROTECTED] wrote:

tedd wrote:

Just out of curiosity, what font and size do you ppls use for your
programming?

I've got a lot of projects so I always use a really small font to save on
disk space


That doesn't work, dummy!  You still have to save only half of
your files.  ;-P


Yeah you're right... well most of my lines are short so I'll try only 
saving the left hand side of each file and see if that helps save space :p


Col


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



RE: [PHP] phpmyadmin

2008-07-10 Thread Will Fitch
This is more of a SQL question that PHP.  If you want to grant all
privileges to abc to database xyz (minus GRANT), you should run these
queries:

CREATE DATABASE xyz;
GRANT ALL PRIVILEGES ON xyz.* TO 'abc'@'somehost' IDENTIFIED BY
'somepassword';



-Original Message-
From: Ronald Wiplinger [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 10, 2008 9:22 AM
To: php-general@lists.php.net
Subject: [PHP] phpmyadmin

I would like to use this time phpmyadmin (2.11.3) to setup for a new
user a database, which he can use to setup his own tables for his web site.

User abc should get his own database xyz.

I am not sure if I did it correct, and if it is safe to do so:

A
==
1. I created an empty database xyz (main page of phpmyadmin)
2. I added a new user on the Privileges page with:
User: abc
Host: Any (%)
Password: (yes)
Global privileges: 
(Data:) SELECT, INSERT, UPDATE, DELETE, FILE
(Structure:) CREATE, ALTER, INDEX, DROP, CREATE TEMPORARY TABLES
(Administration:)(nothing ticked)
(Resource limits:)   (nothing ticked)

What does it mean so far? Can the user abc already access data of any
database?

B
==
I found Database-specific privileges for the user abc, where I added
the database xyz and ticked:
(Data:) SELECT, INSERT, UPDATE, DELETE
(Structure:) CREATE, ALTER, INDEX, DROP, CREATE TEMPORARY TABLES
(Administration:)(nothing ticked)

What confuses me is that I have already some databases setup for my own
web, but none of the users has B attached.
Currently I am going away from a single person using the database to
allow others also to use the database.

Thanks for enlightening me.

bye

Ronald







-- 
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] Re: What font/size do you use for programming?

2008-07-10 Thread Jason Pruim


On Jul 10, 2008, at 10:44 AM, Colin Guthrie wrote:


Daniel Brown wrote:
On Thu, Jul 10, 2008 at 6:12 AM, Colin Guthrie  
[EMAIL PROTECTED] wrote:

tedd wrote:

Just out of curiosity, what font and size do you ppls use for your
programming?
I've got a lot of projects so I always use a really small font to  
save on

disk space

   That doesn't work, dummy!  You still have to save only half of
your files.  ;-P


Yeah you're right... well most of my lines are short so I'll try  
only saving the left hand side of each file and see if that helps  
save space :p



No wonder my files are so large... I have been saving them at 20 point  
type... Easier to read from aways away :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] PHP code will not work

2008-07-10 Thread Richard Heyes

$_ENV

$_SERVER

$_ENV and $_SERVER are. Though their contents are doubtless different.

--
Richard Heyes

Employ me:
http://www.phpguru.org/cv

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



[PHP] OT - RE: [PHP] scalable web gallery

2008-07-10 Thread Boyd, Todd M.
 -Original Message-
 From: Daniel Brown [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 10, 2008 9:42 AM
 To: paragasu
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] scalable web gallery

---8--- snip

 And for the record, in the olden days, there was a limit of
 about 2048 files per directory, back when no one thought there would
 ever be a need for nearly that many files.  Then, with improved
 filesystems, the limit was rumored to be another magic number: 65535.
 That depended on the operating system, filesystem, and the kernel.  I
 think (but don't quote me on this) that BeOS had the 65535 limit.
 
 Now, on an ext3 filesystem (we're not counting ReiserFS because
 (1) I was never a fan, and (2) he might kill me if I say something
 bad!  8^O) you're okay with hundreds of thousands of files per
 directory.  ls'ing will be a bit of a pain in the ass, and if you're
 in Bash, you probably don't want to double-TAB the directory, but all
 in all, you'll be okay.
 
 Still, I'd create 16 subdirectories under the images directory:
 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f.  Then name the file as an MD5 hash of
 the image uploaded, and place it in the directory matching the first
 character of the new file name.

Aren't directory structures in Windows (2.x) and even DOS (4.x) built
with B-Trees? I wouldn't figure there would be any kind of
limit--excepting memory, of course--to how many files or subdirectories
can be linked to a single node.

Been a while since I've played with those underlying data structures we
all take for granted, though, so maybe I'm way off base.


Todd Boyd
Web Programmer




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



Re: [PHP] PHP code will not work

2008-07-10 Thread Daniel Brown
On Thu, Jul 10, 2008 at 11:07 AM, Richard Heyes [EMAIL PROTECTED] wrote:
$_ENV

$_SERVER

 $_ENV and $_SERVER are. Though their contents are doubtless different.

Proof that old dogs can learn new tricks.  As n00b and fundamental
as it may be, I took for granted that they weren't going to be
available.  They are different, but they certainly are available.

I'll be honest --- I just found out this minute, too, that I was
wrong about $HTTP_SERVER_VARS as well.  I ignorantly based my
assumptions (back in '97 or '98) that they'd only be available via the
web on the *name* of the array alone.  HTTP is a protocol you get
the point.

Neat-o.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
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: What font/size do you use for programming?

2008-07-10 Thread Daniel Brown
On Thu, Jul 10, 2008 at 10:53 AM, Jason Pruim [EMAIL PROTECTED] wrote:

 No wonder my files are so large... I have been saving them at 20 point
 type... Easier to read from aways away :P

aways = 37.126 feet  ;-P

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
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: What font/size do you use for programming?

2008-07-10 Thread Dan Joseph
On Thu, Jul 10, 2008 at 10:53 AM, Jason Pruim [EMAIL PROTECTED] wrote:


 On Jul 10, 2008, at 10:44 AM, Colin Guthrie wrote:

  Daniel Brown wrote:

 On Thu, Jul 10, 2008 at 6:12 AM, Colin Guthrie [EMAIL PROTECTED]
 wrote:

 tedd wrote:

 Just out of curiosity, what font and size do you ppls use for your
 programming?

 I've got a lot of projects so I always use a really small font to save
 on
 disk space

   That doesn't work, dummy!  You still have to save only half of
 your files.  ;-P


 Yeah you're right... well most of my lines are short so I'll try only
 saving the left hand side of each file and see if that helps save space :p



 No wonder my files are so large... I have been saving them at 20 point
 type... Easier to read from aways away :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


All of this reminds me of a conversation I overheard at a previous job
between our deployment manager and his new worker.

We did credit card processing.  They deployed the terminals to customers.
They'd load the customer's data onto them, box, ship 'em.  Her job was to
ship them.  He had a chart of how much each type of terminal weighed.  She
said they were ripping off UPS because the data is never the same, and some
have more data, and will weigh more.  They went back and forth for 10
minutes.  She became hostile about it.  A couple of our other IT guys tried
to explain data had no weight.  She ended up getting fired over it.  Just
hilarious.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


[PHP] Re: What font/size do you use for programming?

2008-07-10 Thread tedd

At 11:12 AM +0100 7/10/08, Colin Guthrie wrote:

tedd wrote:
Just out of curiosity, what font and size do you ppls use for your 
programming?


I've got a lot of projects so I always use a really small font to 
save on disk space


Col


LOL

Why is it that I always have to read your post twice to get it?

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] cookie encoding/decoding

2008-07-10 Thread Jeff Demel
I have a situation where a cookie is being set elsewhere on a site by
ASP.NET, and I want to read it in my PHP.  However, when getting a cookie in
PHP, it does an automatic urldecode (or some kind of decoding).  Since the
cookie is entered in its pure form, with no encoding, on the ASP.NET side,
PHP is actually converting/decoding correct characters that don't need
decoding.  So, for example a plus sign would become a blank space.  This, of
course, means I'm getting incorrect info from the cookie.

Is there a way to turn off this PHP feature?  Perhaps a flag in the .ini
file?

-Jeff



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



[PHP] Re: What font/size do you use for programming?

2008-07-10 Thread tedd

At 10:07 AM +0100 7/10/08, Peter Ford wrote:

tedd wrote:

Hi gang:

I'm running a Mac (so I know mine is a bit different size wise) but 
I'm currently using Veranda at 14 point for coding.


Just out of curiosity, what font and size do you ppls use for your 
programming?


Cheers,

tedd



I'd love to be coding on the Veranda, but it's raining horizontally 
at the moment and my keyboard hates being wet.


I'm using Lucida Sans for code these days - I finally figured that 
it didn't really have to be a fixed-width font, since I couldn't 
find one that wasn't ugly.


--
Peter Ford



Peter:

Good catch -- sometimes I hate spelling checkers.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread tedd

At 12:24 PM -0400 7/10/08, Robert Cummings wrote:

On Thu, 2008-07-10 at 11:47 -0400, tedd wrote:

 At 11:12 AM +0100 7/10/08, Colin Guthrie wrote:
 tedd wrote:
 Just out of curiosity, what font and size do you ppls use for your
 programming?
 
 I've got a lot of projects so I always use a really small font to
 save on disk space
 
 Col

 LOL

 Why is it that I always have to read your post twice to get it?


Increase your font size Tedd, that way you have bigger understanding.

Cheers,
Rob.


Yeah, but I can't get the larger fonts into my head -- my eyes are too small.

Cheers,

tedd



--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] CURL de-bugging: So why am I not getting the results page on the target site?

2008-07-10 Thread ioannes
I would like someone to help me on this outside the group discussion.  
Is there anyone out there that would look at a curl problem with me?


Thanks,

John

ioannes wrote:
My current theory on this is that the initial input page creates a 
per-session cookie.  Is CURL able to send this when the page is 
submitted and if so how do I find out the name and value of the cookie 
as per my reading it is not stored on the computer, though I reckon it 
must be there somewhere.


The initial page is in this format:
https://www.targetsite.com/subdir/page.asp?serialno=GM201OtherCode=NextCode= 



So I have various GET parameters.

The initial input page also has POST parameters which I can see the in 
page source, and so send via CURL.


I cannot find any javascript doing a set_cookie, including in any 
included files of which there are none anyway.  But there is some 
session going on as the serialno parameter is not in a hidden field or 
explicitly set cookie, so it must be a per-session cookie maybe with a 
different name, I reason.  How do I find out about these?


John

ioannes wrote:
My code is as below.  It comes back with 'Bad session variable name - 
CompanySerialNo' from the site.but the COOKIEJAR does not show this 
variable name and it is not sent, it just shows:


www.targetsite.comFALSE/FALSE0
ASPSESSIONIDQCSQDTABLKAONANAFJPNMFFECLFNCLBP


There is a serialno but that is sent in the GET (URL below).  
Question is: What to test now?  I am trying to get a results page 
from an input page.


What code below is trying to do is access the page, get any cookies 
set then try the page again with the relevant inputs.


?
   
$url=https://www.targetsite.com/subdir/page.asp?serialno=GM201OtherCode=NextCode=;; 



   $ch = curl_init();
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

   curl_setopt ($ch, CURLOPT_COOKIEJAR, cookies.txt);
   curl_setopt ($ch, CURLOPT_COOKIEFILE, cookies.txt);

   curl_setopt($ch, CURLOPT_HEADER, 0);
 curl_setopt($ch, CURLOPT_AUTOREFERER, true);

   curl_setopt($ch, CURLOPT_URL, $url);
  /*
//GET list from submitting POST form as GET
https://www.shortstay-london.com/checkavail.asp?
1 - clock=+09%3A54
2 - StartDay=6
3 - StartMonth=September+%3A+2008
4 - EndDay=13
5 - EndMonth=September+%3A+2008
13 - CheckThis=Check+This

use this list to create POST data
*/

   curl_setopt($ch, CURLOPT_POST, 1);
 $curlPost=array();

   $curlPost[clock]= 09:54;
   $curlPost[StartDay]=6;
   $curlPost[StartMonth]=September : 2008;
   $curlPost[EndDay]=13;
   $curlPost[EndMonth]=September : 2008;
   //etc
   $curlPost[CheckThis]=Check This;

   curl_setopt($ch, CURLOPT_POSTFIELDS,$curlPost);
 
   curl_setopt($ch, CURLOPT_FOLLOWLOCATION  ,1);

   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

   $store = curl_exec ($ch);
 curl_close ($ch);
 print($store);
  ?





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



Re: [PHP] scalable web gallery

2008-07-10 Thread Robert Cummings
On Thu, 2008-07-10 at 15:46 +0800, paragasu wrote:
 i am planning to create a web photo gallery. i know there is a lot
 available out there,
 but i really want to create my own. the problem is not about creating
 the photo gallery.
 i want it to be scalable.
 
 the plan is saving the image metadata in the database and keep the
 original files
 in a folder. while it work perfectly, i afraid how many files 1
 directory can keep.
 in 1 year, there going to be more than 1000 photo uploaded or more.
 sure it bring problem
 to maintain thus files.
 
 when i see big2 website out there like friendster, photobucket. the
 url for the image change
 like
 pic-1.domain.com/images/filename.jpg
 pic-2.domain.com/images/filename.jpg
 etc. they seems to put the image in different subdomain. Just wan't to
 ask anyone who
 did create a big-big web gallery like this. How did you do it?

Those guys are probably having their images hit over a million times a
day. They also likely have millions of images. They are using multiple
servers to load balance the image serving. Whether this also is used to
distribute the images themselves is another question.

In Linux a single directory can easily handle hundreds of thousands of
files. If you expect there to be million in short time, you can always
bucket the images. Bucketing involves generating some kind of ID that
can be used to generate bucket directories. For instance if you decide
you want 1000 buckets, you can an unique integer ID for images in the
database and modulo the uid by 1000 to determine the bucket directory.
This means if you have 100,000 images then there would be 1000
directories and 100 images in each. As you grow to 1 million images you
would approach 1000 images in 1000 directories. Server offloading can
work similarly. And you can combine approaches. For instance if you have
10 servers to dedicate to images then you can do the following:

$serverId = $imageUid % 10;
$bucketId = $imageUid % 1000;

$url = http://image{$serverId}.myDomain.com;
  ./{$bucketId}/{$imageFile};

So for the first 20 images you would have:

   http://image1.myDomain.com/1/aa.jpg
   http://image2.myDomain.com/2/ab.jpg
   http://image3.myDomain.com/3/ac.jpg
   http://image4.myDomain.com/4/ad.jpg
   http://image5.myDomain.com/5/ae.jpg
   http://image6.myDomain.com/6/af.jpg
   http://image7.myDomain.com/7/ag.jpg
   http://image8.myDomain.com/8/ah.jpg
   http://image9.myDomain.com/9/ai.jpg
   http://image10.myDomain.com/10/aj.jpg
   http://image1.myDomain.com/11/ak.jpg
   http://image2.myDomain.com/12/al.jpg
   http://image3.myDomain.com/13/am.jpg
   http://image4.myDomain.com/14/an.jpg
   http://image5.myDomain.com/15/ao.jpg
   http://image6.myDomain.com/16/ap.jpg
   http://image7.myDomain.com/17/aq.jpg
   http://image8.myDomain.com/18/ar.jpg
   http://image9.myDomain.com/19/as.jpg
   http://image10.myDomain.com/20/at.jpg

Of course, if you have multiple servers, you need some mechanism on the
backend to migrate uploaded images to the appropriate server.

Hope that helps.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



[PHP] simplexml

2008-07-10 Thread Joakim Ling
Hi 

 

I'm using simplexml to create some xml files.

Here's a stripped example, how can I get this to work? Tried millions
different ways still no joy.

 

?php

header(Content-type: text/xml);

 

$xml = simplexml_load_string('root/root');

$root = $xml-addChild('tests');

$root-addChild('test', 'test  test');

 

echo $xml-asXML();

?

 

// cheers jo



Re: [PHP] OT - RE: [PHP] scalable web gallery

2008-07-10 Thread Robert Cummings
On Thu, 2008-07-10 at 10:18 -0500, Boyd, Todd M. wrote:
  -Original Message-
  From: Daniel Brown [mailto:[EMAIL PROTECTED]
  Sent: Thursday, July 10, 2008 9:42 AM
  To: paragasu
  Cc: php-general@lists.php.net
  Subject: Re: [PHP] scalable web gallery
 
 ---8--- snip
 
  And for the record, in the olden days, there was a limit of
  about 2048 files per directory, back when no one thought there would
  ever be a need for nearly that many files.  Then, with improved
  filesystems, the limit was rumored to be another magic number: 65535.
  That depended on the operating system, filesystem, and the kernel.  I
  think (but don't quote me on this) that BeOS had the 65535 limit.
  
  Now, on an ext3 filesystem (we're not counting ReiserFS because
  (1) I was never a fan, and (2) he might kill me if I say something
  bad!  8^O) you're okay with hundreds of thousands of files per
  directory.  ls'ing will be a bit of a pain in the ass, and if you're
  in Bash, you probably don't want to double-TAB the directory, but all
  in all, you'll be okay.
  
  Still, I'd create 16 subdirectories under the images directory:
  0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f.  Then name the file as an MD5 hash of
  the image uploaded, and place it in the directory matching the first
  character of the new file name.
 
 Aren't directory structures in Windows (2.x) and even DOS (4.x) built
 with B-Trees? I wouldn't figure there would be any kind of
 limit--excepting memory, of course--to how many files or subdirectories
 can be linked to a single node.
 
 Been a while since I've played with those underlying data structures we
 all take for granted, though, so maybe I'm way off base.

They may all be B-Trees but the storage mechanism often differs between
one filesystem and another. FAT16 and FAT32 both suffered from
limitations on the number of files that could exist in a directory.
Actually, I may be wrong about FAT32, but I do know for certain it had
massive slowdown if it hit some magic number.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Robert Cummings
On Thu, 2008-07-10 at 11:47 -0400, tedd wrote:
 At 11:12 AM +0100 7/10/08, Colin Guthrie wrote:
 tedd wrote:
 Just out of curiosity, what font and size do you ppls use for your 
 programming?
 
 I've got a lot of projects so I always use a really small font to 
 save on disk space
 
 Col
 
 LOL
 
 Why is it that I always have to read your post twice to get it?

Increase your font size Tedd, that way you have bigger understanding.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread tedd

At 9:40 AM -0500 7/10/08, Philip Thompson wrote:

On Jul 10, 2008, at 4:07 AM, Peter Ford wrote:
I'm using Lucida Sans for code these days - I finally figured that 
it didn't really have to be a fixed-width font, since I couldn't 
find one that wasn't ugly.


Are you sure you're a *coder*? =D I've looked at some code in a non 
fixed-width font before and it hurt my eyes! I bet you use tabs 
instead of spaces too. ;)


~Phil


~Phil:

As I wrote to Ted off-list.

A fixed width is not easier for me. After years of being forced to 
use a command, light on dark, and one font, it's a relief to pick 
what I want.


All my correspondence, email, notes, and coding is done in one font. 
The only time I change fonts is in final 
formal-presentations/publications and web sites.


For me, consistency between me and the computer screen is paramount 
in all my writing, including coding. I don't want to see the same 
word presented differently based upon what application I'm using.


As far as alignment of brackets and whatnot, I have absolutely no 
problem with the weird-ass style I use, which I use for ALL 
languages, namely:


php/javascript

whatever()
   {
   whatever;
   }

and html

whatever
   whatever
/whatever

and css

.whatever
   {
   whatever: whatever;
   }

and whatever else (i.e., actionscript, perl, c, c++, FB, and more 
than I want to remember).


A tab is consistent regardless of the type of font you use. I could 
not imagine putting spaces in my code when tabs work exceedingly well.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] simplexml

2008-07-10 Thread Nate Tallman
You have to handle the html special chars.

 == amp;



On Thu, Jul 10, 2008 at 10:59 AM, Joakim Ling [EMAIL PROTECTED] wrote:

 Hi



 I'm using simplexml to create some xml files.

 Here's a stripped example, how can I get this to work? Tried millions
 different ways still no joy.



 ?php

 header(Content-type: text/xml);



 $xml = simplexml_load_string('root/root');

 $root = $xml-addChild('tests');

 $root-addChild('test', 'test  test');



 echo $xml-asXML();

 ?



 // cheers jo




Re: [PHP] simplexml

2008-07-10 Thread Nate Tallman
You have to handle the html special chars.

 == amp;



On Thu, Jul 10, 2008 at 10:59 AM, Joakim Ling [EMAIL PROTECTED] wrote:

 Hi



 I'm using simplexml to create some xml files.

 Here's a stripped example, how can I get this to work? Tried millions
 different ways still no joy.



 ?php

 header(Content-type: text/xml);



 $xml = simplexml_load_string('root/root');

 $root = $xml-addChild('tests');

 $root-addChild('test', 'test  test');



 echo $xml-asXML();

 ?



 // cheers jo




Re: [PHP] What font/size do you use for programming?

2008-07-10 Thread T Lensselink
tedd wrote:
 Hi gang:

 I'm running a Mac (so I know mine is a bit different size wise) but
 I'm currently using Veranda at 14 point for coding.

 Just out of curiosity, what font and size do you ppls use for your
 programming?

 Cheers,

 tedd

Envy Code R (Still in beta i believe) 10pt

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



RE: [PHP] OT - RE: [PHP] scalable web gallery

2008-07-10 Thread Boyd, Todd M.
 -Original Message-
 From: Robert Cummings [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 10, 2008 11:24 AM
 To: Boyd, Todd M.
 Cc: Daniel Brown; php-general@lists.php.net
 Subject: Re: [PHP] OT - RE: [PHP] scalable web gallery
 
 On Thu, 2008-07-10 at 10:18 -0500, Boyd, Todd M. wrote:
   -Original Message-
   From: Daniel Brown [mailto:[EMAIL PROTECTED]
   Sent: Thursday, July 10, 2008 9:42 AM
   To: paragasu
   Cc: php-general@lists.php.net
   Subject: Re: [PHP] scalable web gallery
 
  ---8--- snip
 
   And for the record, in the olden days, there was a limit of
   about 2048 files per directory, back when no one thought there
 would
   ever be a need for nearly that many files.  Then, with improved
   filesystems, the limit was rumored to be another magic number:
 65535.
   That depended on the operating system, filesystem, and the kernel.
 I
   think (but don't quote me on this) that BeOS had the 65535 limit.
  
   Now, on an ext3 filesystem (we're not counting ReiserFS
because
   (1) I was never a fan, and (2) he might kill me if I say something
   bad!  8^O) you're okay with hundreds of thousands of files per
   directory.  ls'ing will be a bit of a pain in the ass, and if
 you're
   in Bash, you probably don't want to double-TAB the directory, but
 all
   in all, you'll be okay.
  
   Still, I'd create 16 subdirectories under the images
directory:
   0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f.  Then name the file as an MD5
hash
 of
   the image uploaded, and place it in the directory matching the
 first
   character of the new file name.
 
  Aren't directory structures in Windows (2.x) and even DOS (4.x)
 built
  with B-Trees? I wouldn't figure there would be any kind of
  limit--excepting memory, of course--to how many files or
 subdirectories
  can be linked to a single node.
 
  Been a while since I've played with those underlying data structures
 we
  all take for granted, though, so maybe I'm way off base.
 
 They may all be B-Trees but the storage mechanism often differs
between
 one filesystem and another. FAT16 and FAT32 both suffered from
 limitations on the number of files that could exist in a directory.
 Actually, I may be wrong about FAT32, but I do know for certain it had
 massive slowdown if it hit some magic number.

tedd also sent me an e-mail that sparked a memory of mine... the
b-trees, regardless of their efficiency, still assign each dir/file
INode an identifying number. This number, obviously, can only get so
large in the context of one b-tree object (i.e., a directory).

In spite of this mental exercise, I do *NOT* miss my Data Structures 
Algorithms class. :)


Todd Boyd
Web Programmer




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



[PHP] Relocating and POSTing

2008-07-10 Thread Alex Chamberlain
I need to send a header('Location:') and send some data along with it -
how would I do this??

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.138 / Virus Database: 270.4.7/1544 - Release Date: 10/07/2008
07:37


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



Re: [PHP] simplexml

2008-07-10 Thread Nathan Nobbe
On Thu, Jul 10, 2008 at 10:55 AM, Nate Tallman 
[EMAIL PROTECTED] wrote:

 You have to handle the html special chars.

  == amp;


and if you use the SimpleXMLElement constructor, it will throw an exception,
rather than just return false, which is useful, because it tells you what
went wrong.

-nathan


Re: [PHP] Relocating and POSTing

2008-07-10 Thread Richard Heyes

Alex Chamberlain wrote:

I need to send a header('Location:') and send some data along with it -
how would I do this??


Two methods:

1. Use the query string. Eg

header('Location: http://www.xxx.com?name=valuename2=value2');

2. Use sessions

--
Richard Heyes

Employ me:
http://www.phpguru.org/cv

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



Re: [PHP] Relocating and POSTing

2008-07-10 Thread Daniel Brown
On Thu, Jul 10, 2008 at 2:20 PM, Alex Chamberlain
[EMAIL PROTECTED] wrote:
 I need to send a header('Location:') and send some data along with it -
 how would I do this??

You probably want to use cURL:

http://php.net/curl

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
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: What font/size do you use for programming?

2008-07-10 Thread Philip Thompson

On Jul 10, 2008, at 9:53 AM, Jason Pruim wrote:


On Jul 10, 2008, at 10:44 AM, Colin Guthrie wrote:


Daniel Brown wrote:
On Thu, Jul 10, 2008 at 6:12 AM, Colin Guthrie  
[EMAIL PROTECTED] wrote:

tedd wrote:

Just out of curiosity, what font and size do you ppls use for your
programming?
I've got a lot of projects so I always use a really small font to  
save on

disk space

  That doesn't work, dummy!  You still have to save only half of
your files.  ;-P


Yeah you're right... well most of my lines are short so I'll try  
only saving the left hand side of each file and see if that helps  
save space :p



No wonder my files are so large... I have been saving them at 20  
point type... Easier to read from aways away :P


I think if you don't use indentation and unneeded spaces, you could  
save lots of space too...


?php
function aFunction($a,$b)
{
if($a-$b0){
while($a+$b0){
if($c){
$c++;
}else{
$c++;
}
}
return 'negative';
}else{
return 'possitive';
}
}
?

I can't tell you how much HDD space I've saved doing this!! ;P

~Phil

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



Re: [PHP] Relocating and POSTing

2008-07-10 Thread Daniel Brown
On Thu, Jul 10, 2008 at 2:32 PM, Richard Heyes [EMAIL PROTECTED] wrote:

 1. Use the query string. Eg

 header('Location: http://www.xxx.com?name=valuename2=value2');

That's GET, not POST, as the subject requests.  ;-P

 2. Use sessions

 if you're not trying to POST the data and are staying within
the same domain on the same server. ;-P

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
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: What font/size do you use for programming?

2008-07-10 Thread Dan Joseph
On Thu, Jul 10, 2008 at 2:43 PM, Philip Thompson [EMAIL PROTECTED]
wrote:

 On Jul 10, 2008, at 9:53 AM, Jason Pruim wrote:

  On Jul 10, 2008, at 10:44 AM, Colin Guthrie wrote:

  Daniel Brown wrote:

 On Thu, Jul 10, 2008 at 6:12 AM, Colin Guthrie [EMAIL PROTECTED]
 wrote:

 tedd wrote:

 Just out of curiosity, what font and size do you ppls use for your
 programming?

 I've got a lot of projects so I always use a really small font to save
 on
 disk space

  That doesn't work, dummy!  You still have to save only half of
 your files.  ;-P


 Yeah you're right... well most of my lines are short so I'll try only
 saving the left hand side of each file and see if that helps save space :p



 No wonder my files are so large... I have been saving them at 20 point
 type... Easier to read from aways away :P


 I think if you don't use indentation and unneeded spaces, you could save
 lots of space too...

 ?php
 function aFunction($a,$b)
 {
 if($a-$b0){
 while($a+$b0){
 if($c){
 $c++;
 }else{
 $c++;
 }
 }
 return 'negative';
 }else{
 return 'possitive';
 }
 }
 ?

 I can't tell you how much HDD space I've saved doing this!! ;P

 ~Phil


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


You could probably save even more if you didn't use those unneeded returns
also:

?php function
aFunction($a,$b){if($a-$b0){while($a+$b0){if($c){$c++;}else{$c++;}}return
'negative';}else{return 'possitive';}} ?

I think that's still perfectly legible.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Eric Butera
On Thu, Jul 10, 2008 at 2:43 PM, Philip Thompson [EMAIL PROTECTED] wrote:
 I think if you don't use indentation and unneeded spaces, you could save
 lots of space too...

 ?php
 function aFunction($a,$b)
 {
 if($a-$b0){
 while($a+$b0){
 if($c){
 $c++;
 }else{
 $c++;
 }
 }
 return 'negative';
 }else{
 return 'possitive';
 }
 }
 ?

 I can't tell you how much HDD space I've saved doing this!! ;P

 ~Phil

Don't forget line returns!

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



RE: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Jay Blanchard
[snip]
...
[/snip]

220, 221whatever it takes

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



Re: [PHP] Relocating and POSTing

2008-07-10 Thread Eric Butera
On Thu, Jul 10, 2008 at 2:58 PM, Daniel Brown [EMAIL PROTECTED] wrote:
 On Thu, Jul 10, 2008 at 2:32 PM, Richard Heyes [EMAIL PROTECTED] wrote:

 1. Use the query string. Eg

 header('Location: http://www.xxx.com?name=valuename2=value2');

That's GET, not POST, as the subject requests.  ;-P

 2. Use sessions

 if you're not trying to POST the data and are staying within
 the same domain on the same server. ;-P

I'm pretty sure he means persist POST data on the forwarded request.

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



FW: [PHP] Relocating and POSTing

2008-07-10 Thread Alex Chamberlain
I've solved the problem by using a query string - whilst it is the same domain 
now - it won't always be and I a silly moment trying to POST data with the 
redirect!

Thanks for the help,

Alex

 -Original Message-
 From: Eric Butera [mailto:[EMAIL PROTECTED]
 Sent: 10 July 2008 20:12
 To: Daniel Brown
 Cc: [EMAIL PROTECTED]; Alex Chamberlain; PHP General list
 Subject: Re: [PHP] Relocating and POSTing
 
 On Thu, Jul 10, 2008 at 2:58 PM, Daniel Brown [EMAIL PROTECTED]
 wrote:
  On Thu, Jul 10, 2008 at 2:32 PM, Richard Heyes [EMAIL PROTECTED]
 wrote:
 
  1. Use the query string. Eg
 
  header('Location: http://www.xxx.com?name=valuename2=value2');
 
 That's GET, not POST, as the subject requests.  ;-P
 
  2. Use sessions
 
  if you're not trying to POST the data and are staying within
  the same domain on the same server. ;-P
 
 I'm pretty sure he means persist POST data on the forwarded request.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 No virus found in this incoming message.
 Checked by AVG - http://www.avg.com
 Version: 8.0.138 / Virus Database: 270.4.7/1544 - Release Date:
 10/07/2008 07:37

No virus found in this outgoing message. Scanned by AVG Free 8.0
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.4.7/1544 - Release Date: 10/07/2008 07:37

No virus found in this outgoing message. Scanned by AVG Free 8.0
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.4.7/1544 - Release Date: 10/07/2008 07:37


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



Re: [PHP] Relocating and POSTing

2008-07-10 Thread Shawn McKenzie

Daniel Brown wrote:

On Thu, Jul 10, 2008 at 2:32 PM, Richard Heyes [EMAIL PROTECTED] wrote:

1. Use the query string. Eg

header('Location: http://www.xxx.com?name=valuename2=value2');


That's GET, not POST, as the subject requests.  ;-P


2. Use sessions


 if you're not trying to POST the data and are staying within
the same domain on the same server. ;-P



With all that in mind, if you must POST then you can do something like this:

$data = addslashes(yourvar=$yourdatasecondvar=$moredata); //just like get

header('POST /some/path/to/somefile.php HTTP/1.1');
header('Host: www.example.com');
header(Content-Type: application/x-www-form-urlencoded);
header(Content-Length:  . strlen($data));
header($data);

-Shawn

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



Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Omar Noppe
Is there any reason to pick a black background en white fonts in your  
editor (for example writability)?




--
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] Re: What font/size do you use for programming?

2008-07-10 Thread Philip Thompson

On Jul 10, 2008, at 3:35 PM, Omar Noppe wrote:

Is there any reason to pick a black background en white fonts in  
your editor (for example writability)?


I think a black background is much easier on the eyes

~Philip


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



Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Daniel Brown
On Thu, Jul 10, 2008 at 5:29 PM, Philip Thompson [EMAIL PROTECTED] wrote:
 On Jul 10, 2008, at 3:35 PM, Omar Noppe wrote:

 Is there any reason to pick a black background en white fonts in your
 editor (for example writability)?

 I think a black background is much easier on the eyes

Blkbkgrnd69:  You're not so bad yourself, hot stuff.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
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



[PHP] how to change session timeout output text

2008-07-10 Thread Luis Cordova
A message Session timeout! Please relogin again. appears after the
session expires.

I was looking in the php where can I:
1. modify the above text message
2. redirect after some seconds to another page.
But I could not find anything in my code to do that.

How can I do this? Any hints,

Encouragements,
-- 

 Luis Cordova

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



[PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Colin Guthrie

Dan Joseph wrote:

You could probably save even more if you didn't use those unneeded returns
also:

?php function
aFunction($a,$b){if($a-$b0){while($a+$b0){if($c){$c++;}else{$c++;}}return
'negative';}else{return 'possitive';}} ?

I think that's still perfectly legible.



And that looks like a suspiciously unnecessary  ? at the end 
there I wonder what I'll spend my 24 bits on that could be 
1/1000 of a nipple in a grainy jpeg ;)


Col


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



[PHP] include_path, permissions question

2008-07-10 Thread dg

Hello,

I'd greatly appreciate some help with some problems I'm hitting.

I have a site set up on a dev server and it works fine.

In transferring it to the clients server, it's getting all weird.

When I first transferred created files, the owner was joe.  And they  
worked fine.


When I republished those files using fwrite, the owner changed to  
httpd.


And includes and file_get_contents stopped working.

I tried changing the owner, but couldn't.
I changed include_path.


I turned on error reporting and got:

Warning: include(includes/common.php): failed to open stream:  
Inappropriate ioctl for device in /**/local/home/**/dev.**.net/ 
alb**acl.php on line 5


Warning: file_get_contents(): SAFE MODE Restriction in effect.  The  
script whose uid/gid is 398/398 is not allowed to access includes/ 
lyrics_box_scripts.txt owned by uid/gid 191739/191739 in /**/local/ 
home/**/dev.**.net/alb**acl.php on line 11



Thanks in advance for any assistance.

-dg



Re: [PHP] how to change session timeout output text

2008-07-10 Thread Jim Lucas

Luis Cordova wrote:

A message Session timeout! Please relogin again. appears after the
session expires.

I was looking in the php where can I:
1. modify the above text message
2. redirect after some seconds to another page.
But I could not find anything in my code to do that.

How can I do this? Any hints,

Encouragements,


#1 is in your PHP code and is unique to your php scripts.  It is not a generic 
message that PHP generates.


#2 is done client side with either Javascript or meta .../ tag redirects

--
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] include_path, permissions question

2008-07-10 Thread Jim Lucas

dg wrote:

Hello,

I'd greatly appreciate some help with some problems I'm hitting.

I have a site set up on a dev server and it works fine.

In transferring it to the clients server, it's getting all weird.

When I first transferred created files, the owner was joe.  And they 
worked fine.


When I republished those files using fwrite, the owner changed to httpd.


who publishes with fwrite?  Did you mean FTP?



And includes and file_get_contents stopped working.

I tried changing the owner, but couldn't.
I changed include_path.


I turned on error reporting and got:

Warning: include(includes/common.php): failed to open stream: 
Inappropriate ioctl for device in 
/**/local/home/**/dev.**.net/alb**acl.php on line 5


Warning: file_get_contents(): SAFE MODE Restriction in effect.  The 
script whose uid/gid is 398/398 is not allowed to access 
includes/lyrics_box_scripts.txt owned by uid/gid 191739/191739 in 
/**/local/home/**/dev.**.net/alb**acl.php on line 11



Thanks in advance for any assistance.

-dg




--
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] Relocating and POSTing

2008-07-10 Thread M. Sokolewicz

Shawn McKenzie wrote:

Daniel Brown wrote:
On Thu, Jul 10, 2008 at 2:32 PM, Richard Heyes [EMAIL PROTECTED] 
wrote:

1. Use the query string. Eg

header('Location: http://www.xxx.com?name=valuename2=value2');


That's GET, not POST, as the subject requests.  ;-P


2. Use sessions


 if you're not trying to POST the data and are staying within
the same domain on the same server. ;-P



With all that in mind, if you must POST then you can do something like 
this:


$data = addslashes(yourvar=$yourdatasecondvar=$moredata); //just like 
get


header('POST /some/path/to/somefile.php HTTP/1.1');
header('Host: www.example.com');
header(Content-Type: application/x-www-form-urlencoded);
header(Content-Length:  . strlen($data));
header($data);

-Shawn


Have you tried it? I very much doubt that would work, considering 
neither GET nor POST are valid in a RESPONSE (which is what you're 
sending), they're only valid in REQUEST headers (which you're not in 
right now, that's the browser's domain)


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



Re: [PHP] scalable web gallery

2008-07-10 Thread paragasu
what  Robert suggest, is something exactly what the big-big photos
gallery out there used
to store their image. Distributing the image into many servers. But i
am not very sure, how
they store the image location information inside the database.

But i like the idea of using imageUId to determine where to store the image.
I think, storing image in a bucket with 100 images each can make the image more
manageable..

thanks for that idea..

On 7/11/08, Robert Cummings [EMAIL PROTECTED] wrote:
 On Thu, 2008-07-10 at 15:46 +0800, paragasu wrote:
 i am planning to create a web photo gallery. i know there is a lot
 available out there,
 but i really want to create my own. the problem is not about creating
 the photo gallery.
 i want it to be scalable.

 the plan is saving the image metadata in the database and keep the
 original files
 in a folder. while it work perfectly, i afraid how many files 1
 directory can keep.
 in 1 year, there going to be more than 1000 photo uploaded or more.
 sure it bring problem
 to maintain thus files.

 when i see big2 website out there like friendster, photobucket. the
 url for the image change
 like
 pic-1.domain.com/images/filename.jpg
 pic-2.domain.com/images/filename.jpg
 etc. they seems to put the image in different subdomain. Just wan't to
 ask anyone who
 did create a big-big web gallery like this. How did you do it?

 Those guys are probably having their images hit over a million times a
 day. They also likely have millions of images. They are using multiple
 servers to load balance the image serving. Whether this also is used to
 distribute the images themselves is another question.

 In Linux a single directory can easily handle hundreds of thousands of
 files. If you expect there to be million in short time, you can always
 bucket the images. Bucketing involves generating some kind of ID that
 can be used to generate bucket directories. For instance if you decide
 you want 1000 buckets, you can an unique integer ID for images in the
 database and modulo the uid by 1000 to determine the bucket directory.
 This means if you have 100,000 images then there would be 1000
 directories and 100 images in each. As you grow to 1 million images you
 would approach 1000 images in 1000 directories. Server offloading can
 work similarly. And you can combine approaches. For instance if you have
 10 servers to dedicate to images then you can do the following:

 $serverId = $imageUid % 10;
 $bucketId = $imageUid % 1000;

 $url = http://image{$serverId}.myDomain.com;
   ./{$bucketId}/{$imageFile};

 So for the first 20 images you would have:

    http://image1.myDomain.com/1/aa.jpg
    http://image2.myDomain.com/2/ab.jpg
    http://image3.myDomain.com/3/ac.jpg
    http://image4.myDomain.com/4/ad.jpg
    http://image5.myDomain.com/5/ae.jpg
    http://image6.myDomain.com/6/af.jpg
    http://image7.myDomain.com/7/ag.jpg
    http://image8.myDomain.com/8/ah.jpg
    http://image9.myDomain.com/9/ai.jpg
    http://image10.myDomain.com/10/aj.jpg
    http://image1.myDomain.com/11/ak.jpg
    http://image2.myDomain.com/12/al.jpg
    http://image3.myDomain.com/13/am.jpg
    http://image4.myDomain.com/14/an.jpg
    http://image5.myDomain.com/15/ao.jpg
    http://image6.myDomain.com/16/ap.jpg
    http://image7.myDomain.com/17/aq.jpg
    http://image8.myDomain.com/18/ar.jpg
    http://image9.myDomain.com/19/as.jpg
    http://image10.myDomain.com/20/at.jpg

 Of course, if you have multiple servers, you need some mechanism on the
 backend to migrate uploaded images to the appropriate server.

 Hope that helps.

 Cheers,
 Rob.
 --
 http://www.interjinn.com
 Application and Templating Framework for PHP




Re: [PHP] how to change session timeout output text

2008-07-10 Thread Luis Cordova
I have been hunting for it for hours and seems like it is not there...
It should but do you know how can I trace to which file is it pointing
or what function? Is there anything close to debugging in php?

Encouragements,

On Thu, Jul 10, 2008 at 6:48 PM, Jim Lucas [EMAIL PROTECTED] wrote:
 Luis Cordova wrote:

 A message Session timeout! Please relogin again. appears after the
 session expires.

 I was looking in the php where can I:
1. modify the above text message
2. redirect after some seconds to another page.
 But I could not find anything in my code to do that.

 How can I do this? Any hints,

 Encouragements,

 #1 is in your PHP code and is unique to your php scripts.  It is not a
 generic message that PHP generates.

 #2 is done client side with either Javascript or meta .../ tag redirects

 --
 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





--

 Luis Cordova



-- 

 Luis Cordova

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



Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Robert Cummings
On Thu, 2008-07-10 at 12:33 -0400, tedd wrote:
 At 12:24 PM -0400 7/10/08, Robert Cummings wrote:
 On Thu, 2008-07-10 at 11:47 -0400, tedd wrote:
   At 11:12 AM +0100 7/10/08, Colin Guthrie wrote:
   tedd wrote:
   Just out of curiosity, what font and size do you ppls use for your
   programming?
   
   I've got a lot of projects so I always use a really small font to
   save on disk space
   
   Col
 
   LOL
 
   Why is it that I always have to read your post twice to get it?
 
 Increase your font size Tedd, that way you have bigger understanding.
 
 Cheers,
 Rob.
 
 Yeah, but I can't get the larger fonts into my head -- my eyes are too small.

Try an alternate route... bite on the monitor.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



RE: [PHP] OT - RE: [PHP] scalable web gallery

2008-07-10 Thread Robert Cummings
On Thu, 2008-07-10 at 12:06 -0500, Boyd, Todd M. wrote:
  -Original Message-
  From: Robert Cummings [mailto:[EMAIL PROTECTED]
  Sent: Thursday, July 10, 2008 11:24 AM
  To: Boyd, Todd M.
  Cc: Daniel Brown; php-general@lists.php.net
  Subject: Re: [PHP] OT - RE: [PHP] scalable web gallery
  
  On Thu, 2008-07-10 at 10:18 -0500, Boyd, Todd M. wrote:
-Original Message-
From: Daniel Brown [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 10, 2008 9:42 AM
To: paragasu
Cc: php-general@lists.php.net
Subject: Re: [PHP] scalable web gallery
  
   ---8--- snip
  
And for the record, in the olden days, there was a limit of
about 2048 files per directory, back when no one thought there
  would
ever be a need for nearly that many files.  Then, with improved
filesystems, the limit was rumored to be another magic number:
  65535.
That depended on the operating system, filesystem, and the kernel.
  I
think (but don't quote me on this) that BeOS had the 65535 limit.
   
Now, on an ext3 filesystem (we're not counting ReiserFS
 because
(1) I was never a fan, and (2) he might kill me if I say something
bad!  8^O) you're okay with hundreds of thousands of files per
directory.  ls'ing will be a bit of a pain in the ass, and if
  you're
in Bash, you probably don't want to double-TAB the directory, but
  all
in all, you'll be okay.
   
Still, I'd create 16 subdirectories under the images
 directory:
0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f.  Then name the file as an MD5
 hash
  of
the image uploaded, and place it in the directory matching the
  first
character of the new file name.
  
   Aren't directory structures in Windows (2.x) and even DOS (4.x)
  built
   with B-Trees? I wouldn't figure there would be any kind of
   limit--excepting memory, of course--to how many files or
  subdirectories
   can be linked to a single node.
  
   Been a while since I've played with those underlying data structures
  we
   all take for granted, though, so maybe I'm way off base.
  
  They may all be B-Trees but the storage mechanism often differs
 between
  one filesystem and another. FAT16 and FAT32 both suffered from
  limitations on the number of files that could exist in a directory.
  Actually, I may be wrong about FAT32, but I do know for certain it had
  massive slowdown if it hit some magic number.
 
 tedd also sent me an e-mail that sparked a memory of mine... the
 b-trees, regardless of their efficiency, still assign each dir/file
 INode an identifying number. This number, obviously, can only get so
 large in the context of one b-tree object (i.e., a directory).
 
 In spite of this mental exercise, I do *NOT* miss my Data Structures 
 Algorithms class. :)

Really? That along with distributed computing, and parallel computing
were my favourites... and here I am programming for the Web... I guess
it's distributed ;)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Robert Cummings
On Thu, 2008-07-10 at 16:29 -0500, Philip Thompson wrote:
 On Jul 10, 2008, at 3:35 PM, Omar Noppe wrote:
 
  Is there any reason to pick a black background en white fonts in  
  your editor (for example writability)?
 
 I think a black background is much easier on the eyes

And on the environment since the energy needed to sustain it is lower.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Robert Cummings
On Thu, 2008-07-10 at 23:47 +0100, Colin Guthrie wrote:
 Dan Joseph wrote:
  You could probably save even more if you didn't use those unneeded returns
  also:
  
  ?php function
  aFunction($a,$b){if($a-$b0){while($a+$b0){if($c){$c++;}else{$c++;}}return
  'negative';}else{return 'possitive';}} ?
  
  I think that's still perfectly legible.
 
 
 And that looks like a suspiciously unnecessary  ? at the end 
 there I wonder what I'll spend my 24 bits on that could be 
 1/1000 of a nipple in a grainy jpeg ;)

You only want to sharpen that image if the rest is easy on the eyes too.
Some things are better left grainy.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] scalable web gallery

2008-07-10 Thread Robert Cummings
On Fri, 2008-07-11 at 07:55 +0800, paragasu wrote:
 what  Robert suggest, is something exactly what the big-big photos
 gallery out there used
 to store their image. Distributing the image into many servers. But i
 am not very sure, how
 they store the image location information inside the database.
 
 But i like the idea of using imageUId to determine where to store the image.
 I think, storing image in a bucket with 100 images each can make the image 
 more
 manageable..
 
 thanks for that idea..

That physical location on the hard drive just needs to be a
configuration variable for the site. As long as all the servers use the
same physical path, then it's a no brainer.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] how to change session timeout output text

2008-07-10 Thread Robert Cummings
On Thu, 2008-07-10 at 20:08 -0500, Luis Cordova wrote:
 I have been hunting for it for hours and seems like it is not there...
 It should but do you know how can I trace to which file is it pointing
 or what function? Is there anything close to debugging in php?

I hope you're not using Winblows:

cd /path/to/web/tree
grep -rn 'Please relogin again'

Cheers,
Rob.



 Encouragements,
 
 On Thu, Jul 10, 2008 at 6:48 PM, Jim Lucas [EMAIL PROTECTED] wrote:
  Luis Cordova wrote:
 
  A message Session timeout! Please relogin again. appears after the
  session expires.
 
  I was looking in the php where can I:
 1. modify the above text message
 2. redirect after some seconds to another page.
  But I could not find anything in my code to do that.
 
  How can I do this? Any hints,
 
  Encouragements,
 
  #1 is in your PHP code and is unique to your php scripts.  It is not a
  generic message that PHP generates.
 
  #2 is done client side with either Javascript or meta .../ tag redirects
 
  --
  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
 
 
 
 
 
 --
 
  Luis Cordova
 
 
 
 -- 
 
  Luis Cordova
 
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread dg

On Jul 10, 2008, at 9:33 PM, Robert Cummings wrote:


On Thu, 2008-07-10 at 16:29 -0500, Philip Thompson wrote:

On Jul 10, 2008, at 3:35 PM, Omar Noppe wrote:


Is there any reason to pick a black background en white fonts in
your editor (for example writability)?


I think a black background is much easier on the eyes


And on the environment since the energy needed to sustain it is lower.

Cheers,
Rob.


I find if I read stuff on a black background, I start seeing fuzzy  
streaks.  I do use a light grey to edit in though.


Be cool to see screenshots of people's set-ups.  The light grey is the  
only alteration I've ever made from BBedit's default settings.


-dg



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



Re: [PHP] scalable web gallery

2008-07-10 Thread paragasu
 As long as all the servers use the
 same physical path, then it's a no brainer.

well, for now, it might look no brainer. but in the future, i can move
the images to another
servers with few changes on dns configurations (i think so)..

On 7/11/08, Robert Cummings [EMAIL PROTECTED] wrote:
 On Fri, 2008-07-11 at 07:55 +0800, paragasu wrote:
 what  Robert suggest, is something exactly what the big-big photos
 gallery out there used
 to store their image. Distributing the image into many servers. But i
 am not very sure, how
 they store the image location information inside the database.

 But i like the idea of using imageUId to determine where to store the
 image.
 I think, storing image in a bucket with 100 images each can make the image
 more
 manageable..

 thanks for that idea..

 That physical location on the hard drive just needs to be a
 configuration variable for the site. As long as all the servers use the
 same physical path, then it's a no brainer.

 Cheers,
 Rob.
 --
 http://www.interjinn.com
 Application and Templating Framework for PHP



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



Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Robert Cummings
On Thu, 2008-07-10 at 21:45 -0700, dg wrote:

 Be cool to see screenshots of people's set-ups.  The light grey is the  
 only alteration I've ever made from BBedit's default settings.

http://www.interjinn.com/bleh/snapshot.20080711.png

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread dg


On Jul 10, 2008, at 10:31 PM, Robert Cummings wrote:


http://www.interjinn.com/bleh/snapshot.20080711.png


very kewl. Maybe I'll ask Rich Siegel to pose shirtless for my BBedit  
background...


I'm used to line numbers along the side, especially given all my  
errors, how do you zoom in on them without seeing them there?


-dg


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



Re: [PHP] Re: What font/size do you use for programming?

2008-07-10 Thread Robert Cummings
On Thu, 2008-07-10 at 22:49 -0700, dg wrote:
 On Jul 10, 2008, at 10:31 PM, Robert Cummings wrote:
 
  http://www.interjinn.com/bleh/snapshot.20080711.png
 
 very kewl. Maybe I'll ask Rich Siegel to pose shirtless for my BBedit  
 background...
 
 I'm used to line numbers along the side, especially given all my  
 errors, how do you zoom in on them without seeing them there?

CTRL+K L, input line number

Also the line the cursor is currently on is displayed at the top right
corner.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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