php-general Digest 15 Apr 2005 05:53:48 -0000 Issue 3398

2005-04-14 Thread php-general-digest-help

php-general Digest 15 Apr 2005 05:53:48 - Issue 3398

Topics (messages 213099 through 213126):

Re: Directory perms
213099 by: Jason Wong

Getting a contract
213100 by: Ryan A
213102 by: chris
213108 by: Miles Thompson
213110 by: Brent Baisley

Reverse plural forms to singular for search
213101 by: Eugene Voznesensky

Re: header()
213103 by: chris

Insert Chars into a string
213104 by: PartyPosters
213106 by: Mike Johnson
213107 by: Mike Johnson

Re: RegEx help
213105 by: trlists.clayst.com

ini_set and upload_tmp_dir
213109 by: Reynier Perez Mira
213111 by: Marek Kilimajer
213112 by: Jason Wong

Streaming video BLOBs from MySQL
213113 by: J J

Re: imagecopyresample
213114 by: Marek Kilimajer
213123 by: gareth.zaphodmcmillan.com

Re: Storing password in cookie
213115 by: trlists.clayst.com
213116 by: trlists.clayst.com

pixels per character
213117 by: Christian Calloway
213119 by: Chris W. Parker
213120 by: Greg Donald
213126 by: Amir Mohammad Saied

Best practices for set/get methods
213118 by: Tim Boring
213121 by: Greg Donald
213122 by: Rasmus Lerdorf

Sessions and frames
213124 by: Gustav Wiberg
213125 by: Chris W. Parker

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
On Thursday 14 April 2005 22:25, Reynier Perez Mira wrote:
 How I can obtain directory perms and how I know if they are RW on Win32
 plattforms? I find into PHP Manual but I only obtain function fileperms
 wich have only for files and not for directories

fileperms() works on files AND directories (and in fact the examples shows 
that). is_readable() and is_writeable() also works on files/dirs.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts
---End Message---
---BeginMessage---
Hey,
There was some discussion before this on how much to charge to make a site /
set of scripts,
which also turned into advise  from the more experienced members of this
list...good advise I
might add.

Note:
This thread is not directly a php thread but related in a big way to what
most of us do, you might
not want to read it if you only read programming threads, this is intended
to be more of a discussion.

That saidI'll continue:
One of the parts that I noted (and that has come back to haunt me) is:
write the entire scope of the project and make them sign on the dotted line
even if they are family friends.
(more or less those words)
I'm working with a client who is really ticking me off with his constant
request for addition of
features/changes some of which i pointly decline unless i am paid
more...others I do...coz the project is
big and well payingand the changes are not too big.
The client I am working with gave me some rough drawings (pen (not pencil)
hand drawings on napkins
and A4 papers), some scribblings etc

My question is, how can we document the whole contract *properly* when the
client is asking you
to make something new (eg features not found anywhere else), code, layouts,
navigation, buttons,
sections, functionality  etc? Getting a lawyer is (for most of us...like me)
out of the question...

Is there any software out there that helps? or do you take the extra days
(or maybe weeks) to write
up everything for him to sign on the dotted line? Keep in mind while you are
taking the time to write
up the whole thing he can pick someone else...or he might be in a hurry.


Advise on what you think would help...and things that you _actually_ do
would help a lot of us I think
sidestep bad experiences in the future.

Thanks,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.9 - Release Date: 4/13/2005
---End Message---
---BeginMessage---
Ryan,

Write the contract to state the targets as they exist now, the estimated 
hours and how you will be paid(i.e. - by the hour, milestone, etc...)
then when a change is made to the design, simply make an addendum to the 
original contract and list the changes that are to be done, estimated time 
and again how you will be paid. Make sure the client is signing this stuff 
(even friends and family). Personally I like setting design targets (or 
goals if you prefer) and having the client sign off on each as they are 
completed and I am paid per 

Re: [PHP] Re: User Management

2005-04-14 Thread Dasmeet Singh
This seems to be something exactly as i was looking for.. Can you pls 
send me some tutorials/examples/links on how to implement it?

Regards,
Dasmeet
http://hostwindow.info
Eugene Voznesensky wrote:
Yoy can try this one:
http://pear.php.net/package/LiveUser

Hi!
I am developing an applicaton in PHP where
different users would have 

different permissions and access to different
functions/pages of website. 

Now whats the best way to do tht?
One way I can think of is keep all permissions in
a table and divide 

everyting on site into functions..and when every
function is called, check 

whether thecurrent user has permission to
particular function..
But this method looks quiet complicated..is ther
any other way to do this?
Also if you can give me some links to
articles/tutorials on user/levels 

management in PHP, it would be really helpful..
Thanks in advance 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


[PHP] Re: mod_rewrite from .htaccess

2005-04-14 Thread Dasmeet Singh
Matthew Weier O'Phinney wrote:
* Amir Mohammad Saied [EMAIL PROTECTED]:
I want to use mod_rewrite patterns, but i have not access to the 
httpd.conf so i think i should use .htaccess, but the patterns don't 
work properly there, have my admin should set any settings in the 
httpd.conf?

I use mod_rewrite from .htaccess all the time; just make sure that you
have the 'RewriteEngine on' directive in your .htaccess file before your
rewrite rules. 

It's entirely possible, however, that the server admin has denied
permission for that action in the global httpd.conf, though. If you
simply cannot get rules to work -- rules that you know work on another
machine, for instance, that would be the next step to try.
This should help you :)
http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html
http://www.webmasterworld.com/forum92/82.htm
Regards,
Dasmeet
http://hostwindow.info
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] PHP 4 to PHP 5 Migration shortcut

2005-04-14 Thread Rob Agar


 From: Rasmus Lerdorf 
 Chances are pretty good that you won't have to change 
 anything.  Step 1 
 would be to simply try running your existing code under PHP5 and see 
 what breaks.  Unless you have complicated OO code or you are 
 using the 
 domxml extension, you likely won't need to change anything.

FWIW, in my experience the thing most likely to trip you up is this: 

$a = new C();
$b = $a;

...in php4 $b is a copy of $a, but in php5 it's a reference to the same
object. You can use clone() to get the same result. 

hth
Rob

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



[PHP] Image and PHP

2005-04-14 Thread Mario de Frutos Dieguez
I have a page where i place an image but i want when i show the image 
delete it. How can i do this?

--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones  

CARTIF -Parque Tecnológico Boecillo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] PHP 4 to PHP 5 Migration shortcut

2005-04-14 Thread Rob Agar
 ...and trying to re-assign $this inside a class.

which is perverse and shouldn't have been allowed in the first place =)

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



Re: [PHP] Storing password in cookie

2005-04-14 Thread Chris Shiflett
Richard Lynch wrote:
There aren't a whole lot of shared servers that are running a different
pool of httpd for each user, nor using only CGI with different user ids,
nor...
I daresay that unless you are setting up a shared server yourself, rather
than renting space on one, you'll be hard-pressed to find that feature...
Perhaps phpsec.org would want to list hosts who go above and beyond the
current norm and actually provide that.
That's not a bad idea, but I'm not sure such endorsement would be 
beneficial, since it crosses into the territory of business interests. 
On the other hand, hosts might see huge value in being endorsed by the 
PHPSC and make a special effort to comply with recommendations and such.

I guess a good first step would be to generate a document that details 
some options for running a secure shared host, so that people can apply 
the practices that fit their needs.

If you're stuck on a shared host with poor security, your best hope is 
to keep all sensitive data (session data included) in the database, 
relying on its access control for some protection. This places all of 
the trust in your database access credentials, and there are some pretty 
effective ways to keep this information protected. You can at least keep 
people from browsing around with scripts like this:

http://shiflett.org/code/browse.phps
If you can think of a good business reason to store somebody's CC# in
$_SESSION, I guess it must exist.
I sure can't think of one...
When a user enters a credit card number, there may likely be a 
verification step before the actual purchase is made. It's better to 
keep this number on the server (in the session data store) than to 
unnecessarily expose it over the Internet again (SSL mitigates the risk, 
but an unnecessary risk is still worth avoiding).

Being mindful of this, it's also helpful to not even display it to the 
user, instead showing only the last four digits or something, because 
this display also counts as exposure (since it's in the response).

I'm certainly interested to know when/why Chris Shiflett would store a CC#
anywhere at all, unless he's actually working *FOR* the Credit Card guys,
cuz that's what they're there for. :-) That doesn't count.
Heh. :-)
You might need to store credit card numbers if you're someone like 
Amazon and you see a great deal of value in making future purchases as 
convenient as possible. Whether it's one-click ordering or not, 
statistics prove that customers are more likely to buy products when the 
purchase barrier is reduced. Sure, this is necessarily going to be less 
secure than destroying the credit card number after each use, but there 
are ways to mitigate the risk, and security can't always take precedence.

I'm doing some security consulting for an Amazon-like company right now 
that requires this. The credit card numbers are all encrypted and kept 
in a secure database (my opinion), and I've added specific safeguards to 
protect the symmetric key from theoretical risks (for example, Apache 
has insufficient privileges to access the key, so even command injection 
can't necessarily be used to obtain it).

Of course, this is all tangential to the whole password in a cookie 
discussion, in which case I'm not aware of any situation or business 
need that can possibly justify that. :-)

Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Dedicated server

2005-04-14 Thread Chris Shiflett
Ryan A wrote:
Can anyone recommend a host for dedicated hosting? Hopefully one that you
have used. Please reply offlist so as not to disturb anyone else.
This doesn't seem entirely off-topic to me.
I use and can happily recommend these guys:
http://aspextra.net/
This is for fully-managed hosting (I don't have the time nor expertise 
to properly administer a business-critical server).

If your needs are more modest, you might consider these guys:
http://johncompanies.com/
They are about as inexpensive as you can get without having to make too 
many sacrifices, and they offer both dedicated and virtual dedicated 
servers.

Hope that helps.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Image and PHP

2005-04-14 Thread Petar Nedyalkov
On Thursday 14 April 2005 10:06, Mario de Frutos Dieguez wrote:
 I have a page where i place an image but i want when i show the image
 delete it. How can i do this?

You want to delete it from the clients machine or what? 


 --
 Mario de Frutos Dieguez

 División de Ingeniería del Software
 y Comunicaciones

 CARTIF -Parque Tecnológico Boecillo

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpXvgvK7G0wH.pgp
Description: PGP signature


Re: [PHP] Image and PHP

2005-04-14 Thread Mario de Frutos Dieguez
Petar Nedyalkov escribió:
On Thursday 14 April 2005 10:06, Mario de Frutos Dieguez wrote:
 

I have a page where i place an image but i want when i show the image
delete it. How can i do this?
   

You want to delete it from the clients machine or what? 

 

--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones
CARTIF -Parque Tecnológico Boecillo
   

 

Sorry, i want delete it from the server side. I put the images in a 
directory in the server.

--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones  

CARTIF -Parque Tecnológico Boecillo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] a new it company

2005-04-14 Thread Rory Browne
Dan:

My apologies for any negitive psychological effects my reply to the
password sharing thread, may have had on you. It was not a case of
mistaken identity, but rather a case of replying to the last poster,
instead of to the list. gmail has this quick reply box on the bottom,
and I clicked on that, typed my reply and clicked 'send'. I simply
forgot to change it to 'Reply to all' instead of just 'reply'.

Maybe I was a bit quick on the gun, but I felt annoyed by someone
posting that they had 'found' a website, vouched for their staff(Great
People), and failed to address whether or not the site was their own.

I wouldn't have had so much of a problem, with a direct honest
announcement, that they had formed a new IT company, as opposed to
casting the impression that this was a site that they had no intrest
in, and had just hopped across it whilst searching
google/yahoo/whatever.

I can't believe this got 12 replies.

On 3/9/05, Dan Tappin [EMAIL PROTECTED] wrote:
 I think Rory has trouble jumping to conclusions.  I was attacked off
 list by Rory thinking I was another list member... another dant
 (remember the OT adult content rant / thread?).
 
 I would agree that this is not really spam... just bad judgment.  The
 flood of angry replies to this poster should teach them their lesson
 about mailing list etiquette.  If it continues they will simply be
 banned from the list.
 
 With free speech you have to live with the odd incident like this.
 
 Dan Tappin (Dan T)
 
 On Mar 9, 2005, at 11:29 AM, Jochem Maas wrote:
 
  Rory Browne wrote:
  SPAMMER
  From your email address I'm assuming that your name is Sharvan Saxena.
  It seems like too much of a coincidence that the contact person on
  that site(Tanuj Saxena), and your good self, have the same surname.
  Because it seems your are a spammer, and a liar(you concealed your
 
  I'd class him as stupid or ignorant maybe - but one hand sent email
  doesn't
  really class someone as a spammer does it, I thought the bar was a
  little
  higher than 1 email :-)
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



[PHP] unserialize problem

2005-04-14 Thread Dasmeet Singh
Hi!
I am trying to unserialize a serialized array stored in cookie...
I am using following code :
echo(Welcome to Members Areabr);
echo(br$loginbr);
$m_l_d=unserialize($login);
echo $m_l_d;
echo($m_l_d[0], $m_l_d[1], $m_l_d[2]);
However the output is:
Welcome to Members Area
a:4:{i:0;s:1:\h\;i:1;s:1:\2\;i:2;s:1:\1\;i:3;s:1:\g\;}
, ,
that means $login exists and it echos properly..
but why isnt it unserializing?


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


Re: [PHP] enterprise patterns headache

2005-04-14 Thread Robert Janeczek
On Wed, 13 Apr 2005, Richard Lynch wrote:
On Wed, April 13, 2005 2:01 pm, Robert Janeczek said:
I can't claim a detailed understanding of what you are doing, and,
frankly, it sounds like you are creating a BUNCH of over-engineered
headache-inducing code without a good, proven need for it.  YMVV.
The Upper Case Nice Names I used before are not really difficult to 
implement. Some of these patterns are even smaller than most 
implementations of GOF design patterns.

That said, one thing I *did* understand and can comment on:
Sample code:
$company = CompanyMapper::find(1); // we have ghost inside $company
//some other operations, but we don`t touch $company
$company2 = CompanyMapper::findByName('Big Ltd.');
Now let`s assume, that company with ID=1 has name Big Ltd. We have two
independent copies of the same object what kinda sucks :] The problem is
that both finding methods return ghosts and the second one doesn`t know
his ID yet. If there would be only ID-based searching than Identity Map
would detect it and caused returning the same instance, but it`s not...
So why not do this:
Make findByName look up the $ID with the query you already use, possibly
caching the other fields/data you use frequently in some kind of very temp
space: $row (array returned from query).
Then call CompanyMapper::find($ID, $row);
which uses the info it already has given for free in $row, but can also
check your cache of existing object, fill in any free data from $row, and
return the existing object if it's there.
The problem is that both finding methods don`t query the database when 
they are called. They just store information how can the database be 
queried to fetch the data which should be inside them. So - I don`t have 
ID inside $company2 unless I accessed it`s variables.

Perhaps a specialized object that manipulates/returns other objects based
on arguments is in order.  Instead of a zillion objects that all do that
same thing, only one for each real object, you have one that handles all
the other objects the same way, but trying to find the same object in your
cache first, then digging deeper into lazy load (or whatever) to build it.
That`s what Identity Map doing - it keeps track of all business objects 
inside application. Still - after doing find*() there is no way to tell 
that two variables are the same object inside until they are accessed. And 
after they are accessed it`s already to late, because we have two 
instances.

How certain are you that all this code is saving you *ANYTHING*?
Quite much :) Honestly - it`s a pleasure to write code for application 
using this architecture. Repetition of code is basicly non-existent, 
except for interfaces (which are generated automaticly anyway).

Is it worth the development/maintenance expense?
The expenses are not really high. The biggest problem is that if come to 
dead 
end somewhere than we have to look for solutions in java literature :] And 
of course it takes time for PHP developer to switch to using it, but 
that`s not different from any framework.

It`s worth the effort, trust me :)
rash
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Image and PHP

2005-04-14 Thread Erwin Kerk
Mario de Frutos Dieguez wrote:
Petar Nedyalkov escribió:
On Thursday 14 April 2005 10:06, Mario de Frutos Dieguez wrote:
 

I have a page where i place an image but i want when i show the image
delete it. How can i do this?
  

You want to delete it from the clients machine or what?
 

--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones
CARTIF -Parque Tecnológico Boecillo
  

 

Sorry, i want delete it from the server side. I put the images in a 
directory in the server.


Try a wrapper script, that first outputs the image data, and then 
removes the file.

somethinglike:
img src=script_that_show_image_and_deletes_it.php?image=ladieda.jpg /
Erwin Kerk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Tomcat and php in Suse 9.2

2005-04-14 Thread Andreas Persson
I have installed tomcat and added php-support with help of the php-servlet
but it seem like php cant find any of the extensions installed. Like
mysql. I have the php4-mysql package installed.

If i run php -i from the commandline its telling me that I have
mysql-support and a small php-script runned from the commandline verifies
this.

But if i run phpinfo() from a php-page under tomcat there is no support
for mysql (or anyother extension). It tells me that its using /etc/php.ini
and I have enabled the mysql extension in it.

Anyone who knows why tomcat failes to find the php-extensions?

/Andreas

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



[PHP] Re: unserialize problem

2005-04-14 Thread Dasmeet Singh
Dasmeet Singh wrote:
Hi!
I am trying to unserialize a serialized array stored in cookie...
I am using following code :
echo(Welcome to Members Areabr);
echo(br$loginbr);
$m_l_d=unserialize($login);
echo $m_l_d;
echo($m_l_d[0], $m_l_d[1], $m_l_d[2]);
However the output is:
Welcome to Members Area
a:4:{i:0;s:1:\h\;i:1;s:1:\2\;i:2;s:1:\1\;i:3;s:1:\g\;}
, ,
that means $login exists and it echos properly..
but why isnt it unserializing?


http://hostwindow.info
I have also tried stripslashes..still not working :(

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


Re: [PHP] unserialize problem

2005-04-14 Thread Marek Kilimajer
Dasmeet Singh wrote:
Hi!
I am trying to unserialize a serialized array stored in cookie...
I am using following code :
echo(Welcome to Members Areabr);
echo(br$loginbr);
$m_l_d=unserialize($login);
echo $m_l_d;
echo($m_l_d[0], $m_l_d[1], $m_l_d[2]);
However the output is:
Welcome to Members Area
a:4:{i:0;s:1:\h\;i:1;s:1:\2\;i:2;s:1:\1\;i:3;s:1:\g\;}
, ,
that means $login exists and it echos properly..
but why isnt it unserializing?
magic_quotes_gpc is on, so the cookie is quoted. Use first:
$login = (ini_get('magic_quotes_gpc') ? stripslashes($_COOKIE['login']) 
: $_COOKIE['login']);

then unserialize.
!!!WARNING!!!
array elements in $m_l_d are NOT quoted, don't use them directly in sql 
queries, validate them first

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


RE: [PHP] Image and PHP

2005-04-14 Thread YaronKh
Hi Mario
you can use something like

 img src=blabla.jpg ONLOAD=delete_pic.php?fn=blabla.jpg

And in delete_pic.php write something like:
  unlink ($_GET['fn']);

-Original Message-
From: Mario de Frutos Dieguez [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 14, 2005 10:53 AM
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: Re: [PHP] Image and PHP

Petar Nedyalkov escribi:

On Thursday 14 April 2005 10:06, Mario de Frutos Dieguez wrote:
  

I have a page where i place an image but i want when i show the image
delete it. How can i do this?



You want to delete it from the clients machine or what? 

  

--
Mario de Frutos Dieguez

Divisin de Ingeniera del Software
y Comunicaciones

CARTIF -Parque Tecnolgico Boecillo



  

Sorry, i want delete it from the server side. I put the images in a 
directory in the server.

-- 
Mario de Frutos Dieguez

Divisin de Ingeniera del Software
y Comunicaciones  

CARTIF -Parque Tecnolgico Boecillo

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



Re: [PHP] unserialize problem

2005-04-14 Thread Dasmeet Singh
Marek Kilimajer wrote:
Dasmeet Singh wrote:
Hi!
I am trying to unserialize a serialized array stored in cookie...
I am using following code :
echo(Welcome to Members Areabr);
echo(br$loginbr);
$m_l_d=unserialize($login);
echo $m_l_d;
echo($m_l_d[0], $m_l_d[1], $m_l_d[2]);
However the output is:
Welcome to Members Area
a:4:{i:0;s:1:\h\;i:1;s:1:\2\;i:2;s:1:\1\;i:3;s:1:\g\;}
, ,
that means $login exists and it echos properly..
but why isnt it unserializing?
magic_quotes_gpc is on, so the cookie is quoted. Use first:
$login = (ini_get('magic_quotes_gpc') ? stripslashes($_COOKIE['login']) 
: $_COOKIE['login']);

then unserialize.
!!!WARNING!!!
array elements in $m_l_d are NOT quoted, don't use them directly in sql 
queries, validate them first
Yep! That is working :) Thanks!

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


RE: [PHP] Image and PHP -Correction

2005-04-14 Thread YaronKh
Correction :
u need to use a hidden frame or iframe using style=display:none let call the 
hidden frame myhframe now in you code write
img src=blabla.jpg  onload = myhframe.location = 
'delete_pic.php?fn=blabla.jpg' 



-Original Message-
From:   
Sent: Thursday, April 14, 2005 1:20 PM
To: 'Mario de Frutos Dieguez'; [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: RE: [PHP] Image and PHP

Hi Mario
you can use something like

 img src=blabla.jpg ONLOAD=delete_pic.php?fn=blabla.jpg

And in delete_pic.php write something like:
  unlink ($_GET['fn']);

-Original Message-
From: Mario de Frutos Dieguez [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 14, 2005 10:53 AM
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: Re: [PHP] Image and PHP

Petar Nedyalkov escribi:

On Thursday 14 April 2005 10:06, Mario de Frutos Dieguez wrote:
  

I have a page where i place an image but i want when i show the image
delete it. How can i do this?



You want to delete it from the clients machine or what? 

  

--
Mario de Frutos Dieguez

Divisin de Ingeniera del Software
y Comunicaciones

CARTIF -Parque Tecnolgico Boecillo



  

Sorry, i want delete it from the server side. I put the images in a 
directory in the server.

-- 
Mario de Frutos Dieguez

Divisin de Ingeniera del Software
y Comunicaciones  

CARTIF -Parque Tecnolgico Boecillo

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



Re: [PHP] Creating intelligent forms

2005-04-14 Thread James Kaufman
On Wed, Apr 13, 2005 at 06:54:25PM -0700, dan wrote:
 Hello, all -
 
 I had some questions regarding the creation of intelligent forms - 
 forms that take data, and then parse it for errors, real data, etc etc.
 
 The first idea I had was to make a function to display the form.  When 
 the form is submitted, the page would be called again (i.e. the form's 
 ACTION=itself), and then the POST or GET or SESSION variables will be 
 the arguments to the form.  The idea is, when this happens, the form 
 will be able to check the data that was sent, verify it, etc etc.  If 
 there are no problems with the data, then the user is directed to step 2 
 of the form, or the second page, to enter in additional data.  But how 
 should the redirection happen?
 
...

What you are suggesting sounds a lot like what has been done with PEAR's
QuickForm and QuickForm_Controller. Look at pear.php.net and see what's already
been done.  Why re-invent the wheel?

-- 
Jim Kaufman
Linux Evangelist
public key 0x6D802619, CISSP# 65668

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



[PHP] regular expressions

2005-04-14 Thread pete M
I've been messing about with this for a while to no avail.. so help 
would be appreciates

I'm new to regular expressions and tried this with preg_replace, now I'm 
using eregi_replace !

here's the text
$txt = 'span style=font-size: 10pt; font-family: Times New 
Roman;Itbr /
blahh blahhh blahhh ofbr /
/span';

what I want to do it take the font-size and font-family attributes out so
style=font-size: 10pt; font-family: Times New Roman;
beomes
style=  
and the php
$pattern = 'font-size:*\;';
$txt = eregi_replace($replace,'',$txt);
$pattern = 'font-family:*\;';
$txt = eregi_replace($replace,'',$txt);
What I'm trying to do is match the font-size: and replace everything up 
to the ; with '' ie nothing

dont work
Feel I'm so close ;-(
tia
Pete
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] regular expressions

2005-04-14 Thread Erwin Kerk
pete M wrote:
I've been messing about with this for a while to no avail.. so help 
would be appreciates

I'm new to regular expressions and tried this with preg_replace, now I'm 
using eregi_replace !

here's the text
$txt = 'span style=font-size: 10pt; font-family: Times New 
Roman;Itbr /
blahh blahhh blahhh ofbr /
/span';

what I want to do it take the font-size and font-family attributes out so
style=font-size: 10pt; font-family: Times New Roman;
beomes
style=  
and the php
$pattern = 'font-size:*\;';
$txt = eregi_replace($replace,'',$txt);
$pattern = 'font-family:*\;';
$txt = eregi_replace($replace,'',$txt);
What I'm trying to do is match the font-size: and replace everything up 
to the ; with '' ie nothing

dont work
Feel I'm so close ;-(
tia
Pete

Try this:
$pattern = 'font\-size:.*?\;';

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


[PHP] imagecopyresample

2005-04-14 Thread gareth
I have created (adapted) the follow function:
function imageresize($new_width, $new_height, $filename) {
// Content type
header('Content-type: image/jpeg');
// Get new dimensions
list($width, $height) = getimagesize($filename);
// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width,  
$new_height, $width, $height);

// Output
imagejpeg($image_p, null, 100);
}
The idea is it takes a image and resizes it at server end so that you  
dont have to download a massive image. And it works.

That is as long as that function is the only think you doing.
For example if I have a page with the following in it:
?php
require_once('../includes/functions.php');
imageresize('100', '75', 'pages/1.jpg');
?
I get my image resized. (functions.php is where all my fuctions are  
stored) However if I place anything after the imageresize it doesnt  
show that. Eg echohello'; does nothing. If anything goes before it the  
whole page doesnt work.

Any ideas why this is happening and how I can work around it?
 
-

check out my blog to find out what im up to:
http://www.zaphodmcmillan.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] regular expressions

2005-04-14 Thread pete M
The pattern
$pattern = 'font\-size:.*?\;';
throwns the error
eregi_replace(): REG_BADRPT
Erwin Kerk wrote:
pete M wrote:
I've been messing about with this for a while to no avail.. so help 
would be appreciates

I'm new to regular expressions and tried this with preg_replace, now 
I'm using eregi_replace !

here's the text
$txt = 'span style=font-size: 10pt; font-family: Times New 
Roman;Itbr /
blahh blahhh blahhh ofbr /
/span';

what I want to do it take the font-size and font-family attributes 
out so
style=font-size: 10pt; font-family: Times New Roman;
beomes
style=  

and the php
$pattern = 'font-size:*\;';
$txt = eregi_replace($replace,'',$txt);
$pattern = 'font-family:*\;';
$txt = eregi_replace($replace,'',$txt);
What I'm trying to do is match the font-size: and replace everything 
up to the ; with '' ie nothing

dont work
Feel I'm so close ;-(
tia
Pete

Try this:
$pattern = 'font\-size:.*?\;';

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


Re: [PHP] regular expressions

2005-04-14 Thread Erwin Kerk
pete M wrote:
The pattern
$pattern = 'font\-size:.*?\;';
throwns the error
eregi_replace(): REG_BADRPT
Well, this should work (tested and all )
$pattern=|font\-size:.*?;|si;
$txt = preg_replace( $pattern, , $txt );
Erwin
--

  mail   : [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
  msn: [EMAIL PROTECTED]
  jabber : [EMAIL PROTECTED]
  skype  : erwinkerk
  hello  : vlits

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


Re: [PHP] regular expressions

2005-04-14 Thread pete M
Thankyou
Diolch
danka
There seems to be a big difference between eregi_replace() and preg_replace
Am reding teh Sams - Regular Expressions in 10 mins bu the syntax seems 
ot be different. !!

regards
pete
Erwin Kerk wrote:
pete M wrote:
The pattern
$pattern = 'font\-size:.*?\;';
throwns the error
eregi_replace(): REG_BADRPT
Well, this should work (tested and all )
$pattern=|font\-size:.*?;|si;
$txt = preg_replace( $pattern, , $txt );
Erwin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] snort database not appearing in phpmyadmin

2005-04-14 Thread Mark Sargent
Hi All,
I've installed phpmyadmin and have a snort database in mysql, but, it 
doesn't appear in phpmyadmin. I know it's there, because base is using 
it to display info from snort on the machine. Why wouldn't it appear in 
phpmyadmin. It appears with the same set up on my work test machine. 
What should I look for to fix this..? Cheers.

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


[PHP] RegEx help

2005-04-14 Thread Bosky, Dave
I wanted to create a regex that force a PHP form text field to meet the
following requirements:

a. Must contain an 1 uppercase letter. [A-Z]

b. Must contain 1 digit. [0-9]

c. Must be a minimum of 7 characters in length. {7}

 

I'm not sure of how to build the correct syntax for using all 3
requirements together.

Any help?

 

Thanks,

Dave

 

 



HTC Disclaimer:  The information contained in this message may be privileged 
and confidential and protected from disclosure. If the reader of this message 
is not the intended recipient, or an employee or agent responsible for 
delivering this message to the intended recipient, you are hereby notified that 
any dissemination, distribution or copying of this communication is strictly 
prohibited.  If you have received this communication in error, please notify us 
immediately by replying to the message and deleting it from your computer.  
Thank you.


RE: [PHP] imagecopyresample

2005-04-14 Thread Kim Madsen
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 14, 2005 3:04 PM

 I get my image resized. (functions.php is where all my fuctions are
 stored) However if I place anything after the imageresize it doesnt
 show that. Eg echohello'; does nothing. If anything goes before it the
 whole page doesnt work.
 
 Any ideas why this is happening and how I can work around it?

Because You set the header to be an image:

// Content type
header('Content-type: image/jpeg');

I´m on my way out, so I don´t have the time to test on this but start by 
outcomment the header, return the value instead:

// Output
Return imagejpeg($image_p, null, 100);

And call it like: 

$new_img = imageresize('100', '75', 'pages/1.jpg');

Print img src=\$new_img\ alt=\$new_img\;


--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/Systemdeveloper

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



[PHP] Any experience with multi-language PHP sites?

2005-04-14 Thread Richard Davey
Hi all,

   I was wondering if anyone has any experience with building large
   scale multi-language websites with PHP/MySQL? The plan is to have
   the core site created in English and then translators can login to
   create the various language versions (we'll have 6 languages to
   start with including Japanese). Content will be pure text (no
   HTML), stored in a MySQL 4.1 database with appropriate caching for
   display.

   I'm interested in knowing of any problems I should be looking out
   for while designing this - what happens to Japanese characters for
   example when stored in a MySQL text field? Any issues re:
   displaying them again once extracted? Or on validating foreign
   data input on web forms?

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

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



Re: [PHP] snort database not appearing in phpmyadmin

2005-04-14 Thread Mark Sargent
Mark Sargent wrote:
Hi All,
I've installed phpmyadmin and have a snort database in mysql, but, it 
doesn't appear in phpmyadmin. I know it's there, because base is using 
it to display info from snort on the machine. Why wouldn't it appear 
in phpmyadmin. It appears with the same set up on my work test 
machine. What should I look for to fix this..? Cheers.

Mark Sargent.
Hi All,
also, I have no priviliges for create database. Below is my connection 
info. Cheers.

 Welcome to phpMyAdmin 2.6.1-pl3
*MySQL 4.1.10a-standard running on localhost as [EMAIL PROTECTED]
Mark Sargent.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Any experience with multi-language PHP sites?

2005-04-14 Thread Kim Madsen
 -Original Message-
 From: Richard Davey [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 14, 2005 3:46 PM
 To: php-general@lists.php.net
 Subject: [PHP] Any experience with multi-language PHP sites?
 
 Hi all,
 
I was wondering if anyone has any experience with building large
scale multi-language websites with PHP/MySQL? 

Look in the archives, it´s less than 2 weeks since this was discussed (again :-)

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/Systemdeveloper


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



Re: [PHP] RegEx help

2005-04-14 Thread Philip Hallstrom
On Thu, 14 Apr 2005, Bosky, Dave wrote:
I wanted to create a regex that force a PHP form text field to meet the
following requirements:
a. Must contain an 1 uppercase letter. [A-Z]
b. Must contain 1 digit. [0-9]
c. Must be a minimum of 7 characters in length. {7}
if ( ereg([A-Z0-9], $field)  strlen($field) = 7 ) {
print(We have a winner!);
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Image and PHP

2005-04-14 Thread Mike
 
 I have a page where i place an image but i want when i show 
 the image delete it. How can i do this?
 
What I would probably do is create a cleanup function/class in the script
that gets a list of all the images in the directory in question and deletes
anything that more then, say, an hour old. I don't like situations that may
result the client not receiving data because the server was too fast or
the client was too slow. 

So all you'll have to do is make sure you have a folder that only contains
the images for this process and don't upload any other images to that
folder.

Simple enough.

-M

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



Re: [PHP] Image and PHP

2005-04-14 Thread -k.
 --- Mario de Frutos Dieguez [EMAIL PROTECTED] wrote:
 I have a page where i place an image but i want when
 i show the image delete it. How can i do this?

Some good suggestions so far but to be a little more
explicit this is how you would do it. Essentially you
want  to have your image tag point to a script, have
that script pass the image to the browser then delete
the image.

Please note, this example code, for simplicity sake,
leaves out any security precautions. 

On you main page you'll have an image tag like:
img src=show_image.php?image_name=some_image.jpg

Then show_image.php will look something like this:
?Php

$filepath  = $_GET['image_name'];

$fd = fopen($filepath,'r');
fpassthru($fd);
fclose($fd);
unlink($filepath);
 
?

Remember though, as written you need to do some
validation on $filepath, because as is, this script
will pass anything to the user that is contained in
$_GET['image_name'] then delete it, so be careful.





-k.



__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 

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



[PHP] Re: Dedicated server (0T)

2005-04-14 Thread Ryan A
Hi,
First of all, - Thank you!

Many of you have replied with links and hosts that you recommend and some
that you actually own or resell,
most valuable was your experience with them and advise you gave me.

I've narrowed it down to just 4 hosts, I have one additional question if you
dont mind;
Anybody have any idea about http://www.fastservers.net/ ?
Reason I am asking is they have no setup fee and have a public forum, and on
the forum there is a lot of praise
with very little flack, prices are not too bad either...which is kind of
strange for a dedicated hosting provider.

I know the above might seem like a bit of promotion, but I have absolutely
no connection with that site or
anybody running that site just covering my @ss :-)

blah blah,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.9 - Release Date: 4/13/2005

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



Re: [PHP] imagecopyresample

2005-04-14 Thread gareth
On Apr 14, 2005, at 14:46, Kim Madsen wrote:
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 14, 2005 3:04 PM

I get my image resized. (functions.php is where all my fuctions are
stored) However if I place anything after the imageresize it doesnt
show that. Eg echohello'; does nothing. If anything goes before it  
the
whole page doesnt work.

Any ideas why this is happening and how I can work around it?
Because You set the header to be an image:
// Content type
header('Content-type: image/jpeg');
I´m on my way out, so I don´t have the time to test on this but start  
by outcomment the header, return the value instead:

// Output
Return imagejpeg($image_p, null, 100);
And call it like:
$new_img = imageresize('100', '75', 'pages/1.jpg');
Print img src=\$new_img\ alt=\$new_img\;

Thanks for the help.  But outcomment the header do you mean remove it?
If so.  I removed the header.  And changed the output.  The problem now  
is that it displays it as code (becuase there is no header)  it also  
manages to display it without the print comment

Gareth
 
-

check out my blog to find out what im up to:
http://www.zaphodmcmillan.com/
 
-

check out my blog to find out what im up to:
http://www.zaphodmcmillan.com/
And my new email is [EMAIL PROTECTED]
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re[2]: [PHP] Any experience with multi-language PHP sites?

2005-04-14 Thread Richard Davey
Hello Kim,

Thursday, April 14, 2005, 2:59:05 PM, you wrote:

KM Look in the archives, it´s less than 2 weeks since this was
KM discussed (again :-)

If you're referring to the subject Multilingual Web application - how
to? (the only multi-language thread in this mailing list since the
start of April - I checked before posting) then I'm afraid it didn't
even come close to covering any of the issues raised, it was simply
one post with one specific reply.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

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



Re: [PHP] RegEx help

2005-04-14 Thread M. Sokolewicz
Philip Hallstrom wrote:
On Thu, 14 Apr 2005, Bosky, Dave wrote:
I wanted to create a regex that force a PHP form text field to meet the
following requirements:
a. Must contain an 1 uppercase letter. [A-Z]
b. Must contain 1 digit. [0-9]
c. Must be a minimum of 7 characters in length. {7}
if ( ereg([A-Z0-9], $field)  strlen($field) = 7 ) {
print(We have a winner!);
}
nope, a username like 1234567 would go trough ok. Which isn't what he 
wanted

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


Re[2]: [PHP] Any experience with multi-language PHP sites?

2005-04-14 Thread Richard Davey
Hello Jochem,

Thursday, April 14, 2005, 3:37:07 PM, you wrote:

JM step 1: get a thorough understanding of unicode  UTF(8)
JM step 2: get familiar with the mb_*() functions and the iconv extension
JM step 3: step up your scripts and DB to output/store UTF
JM step 4: rinse/repeat.

Thanks, I have been looking at the mb functions earlier on and the
string/regexp/mail functions they overload, will take this over to the
i18n list I guess, is more appropriate there even if it is massively
low-traffic in comparison.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

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



Re: [PHP] RegEx help

2005-04-14 Thread Tom Rogers
Hi,

Thursday, April 14, 2005, 11:47:13 PM, you wrote:
BD I wanted to create a regex that force a PHP form text field to meet the
BD following requirements:

BD a. Must contain an 1 uppercase letter. [A-Z]

BD b. Must contain 1 digit. [0-9]

BD c. Must be a minimum of 7 characters in length. {7}

 

BD I'm not sure of how to build the correct syntax for using all 3
BD requirements together.

BD Any help?

 

BD Thanks,

BD Dave

 

 



BD HTC Disclaimer:  The information contained in this message
BD may be privileged and confidential and protected from disclosure.
BD If the reader of this message is not the intended recipient, or an
BD employee or agent responsible for delivering this message to the
BD intended recipient, you are hereby notified that any
BD dissemination, distribution or copying of this communication is
BD strictly prohibited.  If you have received this communication in
BD error, please notify us immediately by replying to the message and
BD deleting it from your computer.  Thank you.

easier done seperately I think
if(
  strlen($text)  6 
  preg_match('/\d+/',$text) 
  preg_match('/[A-Z]+/',$text)
) { echo 'OK br';

-- 
regards,
Tom

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



Re: [PHP] Creating intelligent forms

2005-04-14 Thread Jochem Maas
James Kaufman wrote:
On Wed, Apr 13, 2005 at 06:54:25PM -0700, dan wrote:
Hello, all -
I had some questions regarding the creation of intelligent forms - 
forms that take data, and then parse it for errors, real data, etc etc.

The first idea I had was to make a function to display the form.  When 
the form is submitted, the page would be called again (i.e. the form's 
ACTION=itself), and then the POST or GET or SESSION variables will be 
the arguments to the form.  The idea is, when this happens, the form 
will be able to check the data that was sent, verify it, etc etc.  If 
there are no problems with the data, then the user is directed to step 2 
of the form, or the second page, to enter in additional data.  But how 
should the redirection happen?

...
What you are suggesting sounds a lot like what has been done with PEAR's
QuickForm and QuickForm_Controller. Look at pear.php.net and see what's already
been done.  Why re-invent the wheel?
3 reasons:
1. human nature... the 'not-written-here' factor
2. its good way to learn.
3. QuickForm is about as impenetrable as Fort Knox... JMHO. (also the 'Quick' 
part
is a bit off... all the times I have tried it, its taken 10 times longer to 
create a
form in QF than doing it by hand, and doing it by hand always ended up more 
flexible
and maintainable AJMHO)
4. maybe this guy will end up coding a masterpiece that makes QF totally 
redundant? (heh, I can hope :-)
having said that its always worth the time/effort to search and review (i.e. 
read the code!)
what other people have done, in that respect QF should give alot of inspiration 
as how/what/where/why
etc.
have fun!

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


[PHP] Directory perms

2005-04-14 Thread Reynier Perez Mira
How I can obtain directory perms and how I know if they are RW on Win32 
plattforms? I find into PHP Manual but I only obtain function fileperms wich 
have only for files and not for directories

Regards

 

Reynier Pérez Mira

3ero. Ing. Informática

Entre más inteligente me siento, más me doy cuenta de lo ignorante que soy. 

 



Re: [PHP] Any experience with multi-language PHP sites?

2005-04-14 Thread Jochem Maas
Richard Davey wrote:
Hello Kim,
Thursday, April 14, 2005, 2:59:05 PM, you wrote:
KM Look in the archives, it´s less than 2 weeks since this was
KM discussed (again :-)
If you're referring to the subject Multilingual Web application - how
to? (the only multi-language thread in this mailing list since the
start of April - I checked before posting) then I'm afraid it didn't
even come close to covering any of the issues raised, it was simply
one post with one specific reply.
step 1: get a thorough understanding of unicode  UTF(8)
step 2: get familiar with the mb_*() functions and the iconv extension
step 3: step up your scripts and DB to output/store UTF
step 4: rinse/repeat.
these are just hints, sorry I can't be of more help - (lack of time mostly!
I'm still 900 odd mails behind on php-generals ;-)
Best regards,
Richard Davey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] header()

2005-04-14 Thread Martín Marqués
I'm having a bit of a problem understanding how the header() sends the HTTP 
headers.

Here's what I want to do:

1) Send a PDF file which will be printed in the client (the client will read 
it and print it if he wants to.
2) Redirect to the main page of the aplication.

Now, what happens to me is that, if I do (1) without (2), the PDF file is 
sent, but after printing and closing the PDF viewer, the browser stays in the 
old page, something I don't want.
If I put (1) and (2) I don't get the PDF to print. I just redirects to the new 
page.

Here is ths code (sorry about the comments on spanish :-) ):

// Vamos a mandar el PDF
header('Content-type: application/pdf');
// El archivo se va a llamar libreDeuda.pdf
header('Content-Disposition: attachment; filename=libreDeuda' . 
   '.pdf');
// El PDF fuente va a ser $ftexName.
readfile($fpdfName);

// Redirijimos todo.
header(Location:  . $_SERVER[PHP_SELF] . ? . session_name() . 
   = . session_id());



-- 
 11:47:49 up 12 days, 20:16,  1 user,  load average: 0.33, 0.30, 0.65
-
Martín Marqués| select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica  |  DBA, Programador, Administrador
 Universidad Nacional
  del Litoral
-

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



[PHP] Re: header()

2005-04-14 Thread Matthew Weier O'Phinney
* Martín Marqués martin@bugs.unl.edu.ar:
 I'm having a bit of a problem understanding how the header() sends the HTTP 
 headers.

 Here's what I want to do:

 1) Send a PDF file which will be printed in the client (the client will read 
 it and print it if he wants to.
 2) Redirect to the main page of the aplication.

You can't do both; you can do one or the other. A Location header will
always redirect, even if a content-type has been sent.

-- 
Matthew Weier O'Phinney   | WEBSITES:
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org

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



Re: [PHP] RegEx help

2005-04-14 Thread Philip Hallstrom
I wanted to create a regex that force a PHP form text field to meet the
following requirements:
a. Must contain an 1 uppercase letter. [A-Z]
b. Must contain 1 digit. [0-9]
c. Must be a minimum of 7 characters in length. {7}
if ( ereg([A-Z0-9], $field)  strlen($field) = 7 ) {
print(We have a winner!);
}
nope, a username like 1234567 would go trough ok. Which isn't what he 
wanted
that's what I get for thinking too fast :)
Seems like you should be able to do then um... ([A-Z]|[0-9]) as your 
regexp (check on escaping the ()'s or not.  I can never remember)

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


Re: [PHP] Directory perms

2005-04-14 Thread Jason Wong
On Thursday 14 April 2005 22:25, Reynier Perez Mira wrote:
 How I can obtain directory perms and how I know if they are RW on Win32
 plattforms? I find into PHP Manual but I only obtain function fileperms
 wich have only for files and not for directories

fileperms() works on files AND directories (and in fact the examples shows 
that). is_readable() and is_writeable() also works on files/dirs.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

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



[PHP] Getting a contract

2005-04-14 Thread Ryan A
Hey,
There was some discussion before this on how much to charge to make a site /
set of scripts,
which also turned into advise  from the more experienced members of this
list...good advise I
might add.

Note:
This thread is not directly a php thread but related in a big way to what
most of us do, you might
not want to read it if you only read programming threads, this is intended
to be more of a discussion.

That saidI'll continue:
One of the parts that I noted (and that has come back to haunt me) is:
write the entire scope of the project and make them sign on the dotted line
even if they are family friends.
(more or less those words)
I'm working with a client who is really ticking me off with his constant
request for addition of
features/changes some of which i pointly decline unless i am paid
more...others I do...coz the project is
big and well payingand the changes are not too big.
The client I am working with gave me some rough drawings (pen (not pencil)
hand drawings on napkins
and A4 papers), some scribblings etc

My question is, how can we document the whole contract *properly* when the
client is asking you
to make something new (eg features not found anywhere else), code, layouts,
navigation, buttons,
sections, functionality  etc? Getting a lawyer is (for most of us...like me)
out of the question...

Is there any software out there that helps? or do you take the extra days
(or maybe weeks) to write
up everything for him to sign on the dotted line? Keep in mind while you are
taking the time to write
up the whole thing he can pick someone else...or he might be in a hurry.


Advise on what you think would help...and things that you _actually_ do
would help a lot of us I think
sidestep bad experiences in the future.

Thanks,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.9 - Release Date: 4/13/2005

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



[PHP] Reverse plural forms to singular for search

2005-04-14 Thread Eugene Voznesensky
I'm trying to reverse plural forms to singular ones
and use the result for search [in database].

Is there any third party product to integrate with
PHP, or some reliable algorithm?

Thank you,

Eu.

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



[PHP] Re: Getting a contract

2005-04-14 Thread chris
Ryan,

Write the contract to state the targets as they exist now, the estimated 
hours and how you will be paid(i.e. - by the hour, milestone, etc...)
then when a change is made to the design, simply make an addendum to the 
original contract and list the changes that are to be done, estimated time 
and again how you will be paid. Make sure the client is signing this stuff 
(even friends and family). Personally I like setting design targets (or 
goals if you prefer) and having the client sign off on each as they are 
completed and I am paid per target finished.

CJ

Ryan A [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hey,
 There was some discussion before this on how much to charge to make a site 
 /
 set of scripts,
 which also turned into advise  from the more experienced members of this
 list...good advise I
 might add.

 Note:
 This thread is not directly a php thread but related in a big way to what
 most of us do, you might
 not want to read it if you only read programming threads, this is intended
 to be more of a discussion.

 That saidI'll continue:
 One of the parts that I noted (and that has come back to haunt me) is:
 write the entire scope of the project and make them sign on the dotted 
 line
 even if they are family friends.
 (more or less those words)
 I'm working with a client who is really ticking me off with his constant
 request for addition of
 features/changes some of which i pointly decline unless i am paid
 more...others I do...coz the project is
 big and well payingand the changes are not too big.
 The client I am working with gave me some rough drawings (pen (not pencil)
 hand drawings on napkins
 and A4 papers), some scribblings etc

 My question is, how can we document the whole contract *properly* when the
 client is asking you
 to make something new (eg features not found anywhere else), code, 
 layouts,
 navigation, buttons,
 sections, functionality  etc? Getting a lawyer is (for most of us...like 
 me)
 out of the question...

 Is there any software out there that helps? or do you take the extra days
 (or maybe weeks) to write
 up everything for him to sign on the dotted line? Keep in mind while you 
 are
 taking the time to write
 up the whole thing he can pick someone else...or he might be in a hurry.


 Advise on what you think would help...and things that you _actually_ do
 would help a lot of us I think
 sidestep bad experiences in the future.

 Thanks,
 Ryan



 -- 
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.9.9 - Release Date: 4/13/2005 

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



[PHP] Re: header()

2005-04-14 Thread chris
But you can design the script to redirect to a page with a JavaScript to 
open a file(PDF) by using the target=_new and then it redirects to the 
home page.

CJ

Matthew Weier O'Phinney [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
* Martín Marqués martin@bugs.unl.edu.ar:
 I'm having a bit of a problem understanding how the header() sends the 
 HTTP
 headers.

 Here's what I want to do:

 1) Send a PDF file which will be printed in the client (the client will 
 read
 it and print it if he wants to.
 2) Redirect to the main page of the aplication.

 You can't do both; you can do one or the other. A Location header will
 always redirect, even if a content-type has been sent.

 -- 
 Matthew Weier O'Phinney   | WEBSITES:
 Webmaster and IT Specialist   | http://www.garden.org
 National Gardening Association| http://www.kidsgardening.com
 802-863-5251 x156 | http://nationalgardenmonth.org
 mailto:[EMAIL PROTECTED] | http://vermontbotanical.org 

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



[PHP] Insert Chars into a string

2005-04-14 Thread PartyPosters
Hello,
I have a variable that contains a filename, I want to be able to insert the 
date and time just before for the .jpg
for example if my filename is 'pic.jpg' I want it to read 'pic_Monday 15th of 
January 2003 05:51:38 AM.jpg (or if anyone else knowshow to write the time and 
time all in numbers it would be appreciated as I'm using ate(l dS of F Y h:i:s 
A) which obviously is a bit long.

Many thanks.
Kaan


Re: [PHP] RegEx help

2005-04-14 Thread trlists
On 15 Apr 2005 Tom Rogers wrote:

 BD a. Must contain an 1 uppercase letter. [A-Z]
 BD b. Must contain 1 digit. [0-9]
 BD c. Must be a minimum of 7 characters in length. {7}
 
 BD I'm not sure of how to build the correct syntax for using all 3
 BD requirements together.

 easier done seperately I think
 if(
   strlen($text)  6 
   preg_match('/\d+/',$text) 
   preg_match('/[A-Z]+/',$text)
 ) { echo 'OK br';

To do it in one fell swoop you need to use lookahead assertions -- 
something like this:

if (preg_match('/(?=.*[A-Z])(?=.*[0-9]).{7,}/', $text))
echo 'Valid!';

I believe this matches for any string that has at least one uppercase 
letter and one digit and is at least 7 characters long.  However it 
allows other characters as well (not just A-Z and 0-9).  Lots of 
possible variations there.

--
Tom

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



RE: [PHP] Insert Chars into a string

2005-04-14 Thread Mike Johnson
From: PartyPosters [mailto:[EMAIL PROTECTED] 

 Hello,
 I have a variable that contains a filename, I want to be able 
 to insert the date and time just before for the .jpg
 for example if my filename is 'pic.jpg' I want it to read 
 'pic_Monday 15th of January 2003 05:51:38 AM.jpg (or if 
 anyone else knowshow to write the time and time all in 
 numbers it would be appreciated as I'm using ate(l dS of F Y 
 h:i:s A) which obviously is a bit long.

First off, I'd probably use preg_replace(). Maybe something like:

$pattern = '/^(.*?)(\.jpg)$/';
$replacement = '\1' . date('l dS of F Y h:i:s A') . '\2';
$filename = preg_replace($pattern, $replacement, $filename);

I haven't tested that, but I think it should work.

As for the date format, if it doesn't need to be human-readable, might I
suggest date('U')? It's the number of seconds since the epoch; it's
easily convertable to human-readable format. If that doesn't fly,
perhaps MySQL's datetime format, which is a 14-digit int, achievable
with date('YmdHis'). I may be a holdover from DOS, but I shudder at
spaces in filenames.   :)

HTH!

-- 
Mike Johnson Smarter Living, Inc.
Web Developerwww.smartertravel.com
[EMAIL PROTECTED]   (617) 886-5539

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



RE: [PHP] Insert Chars into a string

2005-04-14 Thread Mike Johnson
From: Mike Johnson [mailto:[EMAIL PROTECTED] 

 From: PartyPosters [mailto:[EMAIL PROTECTED] 
 
  Hello,
  I have a variable that contains a filename, I want to be able 
  to insert the date and time just before for the .jpg
  for example if my filename is 'pic.jpg' I want it to read 
  'pic_Monday 15th of January 2003 05:51:38 AM.jpg (or if 
  anyone else knowshow to write the time and time all in 
  numbers it would be appreciated as I'm using ate(l dS of F Y 
  h:i:s A) which obviously is a bit long.
 
 First off, I'd probably use preg_replace(). Maybe something like:
 
 $pattern = '/^(.*?)(\.jpg)$/';
 $replacement = '\1' . date('l dS of F Y h:i:s A') . '\2';
 $filename = preg_replace($pattern, $replacement, $filename);
 
 I haven't tested that, but I think it should work.

Actually, it occurs to me that strrpos() might be faster.

$filename = substr($filename, 0, strrpos('.jpg')) 
. date('YmdHis') 
. substr($filename, strrpos('.jpg'), strlen($filename));

Might need to tweak it, but that should work.

-- 
Mike Johnson Smarter Living, Inc.
Web Developerwww.smartertravel.com
[EMAIL PROTECTED]   (617) 886-5539

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



Re: [PHP] Getting a contract

2005-04-14 Thread Miles Thompson
Keep this in mind - I'll repeat it: WE ARE DOING INTELLECTUAL WORK, not 
painting walls. The simplest request can have unknown ramifications.

I was lucky  - in hindsight - got burned that way after I'd been in 
business about 6 weeks.

Wrote up one of those beautiful proposals which outline exactly what I was 
going to do, thereby demonstrating to my potential client that I KNEW what 
I was talking about.

Waited. And waited. And waited some more, then called client after a couple 
of weeks.

Thank you for your excellent document. It had a lot of very good ideas. We 
are having the IT instructor at xxx school implement the work.

WE ARE DOING INTELLECTUAL WORK
From then on - customer got one hour free; then the meter started. If they 
want details, they're buying my expertise, and it's been damned, 
hard-earned expertise too.

Feature creep seems to be the problem here. Money which should go to solid 
development gets frittered away checking this and that, adding a bit of 
fanciness here, etc. A friend of mine had a project shut down for three 
weeks, and his client looking for another developer,  because of that. The 
contact person could not resist adding new things, and willingly signed 
work orders for their addition, but lost sight that the overall goal was a 
functioning job-tracking / management system for a printing plant.

How did it work out? Well, he talked to all of his competition, and we 
indicated in our bids that he would be the person we'd engage to do the 
work. Hell, he was the most skilled FoxPro developer in town, and the only 
one who really knew the system.

Some helpful things:
1. Let's conform to original plan, what you are talking about can be added 
when the project is up and running.

WE ARE DOING INTELLECTUAL WORK
2. How much do you want to spend checking this out?  (It's really easy to 
Take 15 minutes, then you send an email which might take 30 min to get 
really clear and accurate, and the answer requires another 15~30 minutes 
and another email - hey, where'd the afternoon go?)

WE ARE DOING INTELLECTUAL WORK
3. Trust is important. An outline of the scope of the project, the 
available inputs, and what the desired outputs are, and an ESTIMATE of what 
it MIGHT cost. Remember - those napkins, notes and squiggles are contract 
documents.

WE ARE DOING INTELLECTUAL WORK
3. Bill bi-weekly, with bi-weekly terms.
Clients don't see us at work - and if they did they wouldn't understand. To 
close off, well-done scripting (or any type of programming) looks seamless 
and gives the user a good experience.

Don't know if this has been helpful. You might also see if Whil Hentzen is 
still publishing his Developers Guide at http://www.hentzenwerke.com. Or 
ask if he has an old copy, mine dates from 1997.

Cheers - Miles

At 01:39 PM 4/14/2005, Ryan A wrote:
Hey,
There was some discussion before this on how much to charge to make a site /
set of scripts,
which also turned into advise  from the more experienced members of this
list...good advise I
might add.
Note:
This thread is not directly a php thread but related in a big way to what
most of us do, you might
not want to read it if you only read programming threads, this is intended
to be more of a discussion.
That saidI'll continue:
One of the parts that I noted (and that has come back to haunt me) is:
write the entire scope of the project and make them sign on the dotted line
even if they are family friends.
(more or less those words)
I'm working with a client who is really ticking me off with his constant
request for addition of
features/changes some of which i pointly decline unless i am paid
more...others I do...coz the project is
big and well payingand the changes are not too big.
The client I am working with gave me some rough drawings (pen (not pencil)
hand drawings on napkins
and A4 papers), some scribblings etc
My question is, how can we document the whole contract *properly* when the
client is asking you
to make something new (eg features not found anywhere else), code, layouts,
navigation, buttons,
sections, functionality  etc? Getting a lawyer is (for most of us...like me)
out of the question...
Is there any software out there that helps? or do you take the extra days
(or maybe weeks) to write
up everything for him to sign on the dotted line? Keep in mind while you are
taking the time to write
up the whole thing he can pick someone else...or he might be in a hurry.
Advise on what you think would help...and things that you _actually_ do
would help a lot of us I think
sidestep bad experiences in the future.
Thanks,
Ryan

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


[PHP] ini_set and upload_tmp_dir

2005-04-14 Thread Reynier Perez Mira
Hi: 

I'm try to change de value for the PHP config var upload_tmp_dir  with objetive 
to make an file upload an access more easy to superglobal array 
$_FILES['fichero']['tmp_name']. Into my php file just in the start I have this:

ini_set(upload_tmp_dir,C:\\PHP5\\tmp\\);

The directory exists because I made it's after. What's wrong?

 

Reynier Pérez Mira

3ero. Ing. Informática

Entre más inteligente me siento, más me doy cuenta de lo ignorante que soy. 

 



Re: [PHP] Getting a contract

2005-04-14 Thread Brent Baisley
For larger projects, I always charged a contingency fee, maybe 
$100-$500, depending on the scope. This money basically pays you to 
write up a project document. After all, you are spending your valuable 
time on something for them. If they accept your proposal to write the 
application, the money goes towards your fee for the project. If decide 
not to use you, or pick someone else in the meantime, the money is 
yours. They get to keep the proposal, which they could give to someone 
else so that they could develop the application, but you at least got 
paid.

Whatever you do, document everything. Who asked for what change and 
when, even changes you reject.

On Apr 14, 2005, at 12:39 PM, Ryan A wrote:
Hey,
There was some discussion before this on how much to charge to make a 
site /
set of scripts,
which also turned into advise  from the more experienced members of 
this
list...good advise I
might add.

Note:
This thread is not directly a php thread but related in a big way to 
what
most of us do, you might
not want to read it if you only read programming threads, this is 
intended
to be more of a discussion.

That saidI'll continue:
One of the parts that I noted (and that has come back to haunt me) is:
write the entire scope of the project and make them sign on the dotted 
line
even if they are family friends.
(more or less those words)
I'm working with a client who is really ticking me off with his 
constant
request for addition of
features/changes some of which i pointly decline unless i am paid
more...others I do...coz the project is
big and well payingand the changes are not too big.
The client I am working with gave me some rough drawings (pen (not 
pencil)
hand drawings on napkins
and A4 papers), some scribblings etc

My question is, how can we document the whole contract *properly* when 
the
client is asking you
to make something new (eg features not found anywhere else), code, 
layouts,
navigation, buttons,
sections, functionality  etc? Getting a lawyer is (for most of 
us...like me)
out of the question...

Is there any software out there that helps? or do you take the extra 
days
(or maybe weeks) to write
up everything for him to sign on the dotted line? Keep in mind while 
you are
taking the time to write
up the whole thing he can pick someone else...or he might be in a 
hurry.

Advise on what you think would help...and things that you _actually_ do
would help a lot of us I think
sidestep bad experiences in the future.
Thanks,
Ryan

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

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ini_set and upload_tmp_dir

2005-04-14 Thread Marek Kilimajer
Reynier Perez Mira wrote:
Hi: 

I'm try to change de value for the PHP config var upload_tmp_dir  with objetive 
to make an file upload an access more easy to superglobal array 
$_FILES['fichero']['tmp_name']. Into my php file just in the start I have this:
ini_set(upload_tmp_dir,C:\\PHP5\\tmp\\);
The directory exists because I made it's after. What's wrong?
http://docs.php.net/en/ini.html
upload_tmp_dir is PHP_INI_SYSTEM - Entry can be set in php.ini or httpd.conf
It's logical, by the time your script is executed the file is already 
uploaded.

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


Re: [PHP] ini_set and upload_tmp_dir

2005-04-14 Thread Jason Wong
On Friday 15 April 2005 02:11, Reynier Perez Mira wrote:

 I'm try to change de value for the PHP config var upload_tmp_dir  with
 objetive to make an file upload an access more easy to superglobal
 array $_FILES['fichero']['tmp_name']. Into my php file just in the
 start I have this:

 ini_set(upload_tmp_dir,C:\\PHP5\\tmp\\);

You can't do that. That has to be set in php.ini.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

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



[PHP] Streaming video BLOBs from MySQL

2005-04-14 Thread J J
I have a case where video files (mov, flv, etc) have
been stored in a MySQL database as blobs.

I'm loading them into a flash video player and
everything works fine except it takes longer it seems
and it doesn't allow streaming the actual video.

If I load the same videos with a direct link to the
http:// file system (/videos/file.flv) it loads in
super-fast and allows streaming. 

I'm guessing mysql and/or php doesn't actually release
the BLOB until it's loaded it completely.


So, is there a way to actually have PHP read the BLOB
and stream it as it's loading?  Is there an fstream()
option like the fread()?


Wishful thinking?





__ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

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



Re: [PHP] imagecopyresample

2005-04-14 Thread Marek Kilimajer
[EMAIL PROTECTED] wrote:
I have created (adapted) the follow function:
function imageresize($new_width, $new_height, $filename) {
// Content type
header('Content-type: image/jpeg');
// Get new dimensions
list($width, $height) = getimagesize($filename);
// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width,  
$new_height, $width, $height);

// Output
imagejpeg($image_p, null, 100);
}
The idea is it takes a image and resizes it at server end so that you  
dont have to download a massive image. And it works.

That is as long as that function is the only think you doing.
For example if I have a page with the following in it:
?php
require_once('../includes/functions.php');
imageresize('100', '75', 'pages/1.jpg');
?
I get my image resized. (functions.php is where all my fuctions are  
stored) However if I place anything after the imageresize it doesnt  
show that. Eg echohello'; does nothing. If anything goes before it the  
whole page doesnt work.

Any ideas why this is happening and how I can work around it?
You can display either image or html, not both. You must do:
img src=thumb.php
thumb.php contains the code to output the thumbnail
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Storing password in cookie

2005-04-14 Thread trlists
On 13 Apr 2005 Richard Lynch wrote:

 I have what I consider a MINIMUM standard level of security for any site
 that asks for a password.
 
 That would include:
 Not storing the password *ANYWHERE* in clear-text.
   Not in database.
   Not in $_SESSION
   Not in COOKIES

Agreed.  I see less risk for temporary storage in $_SESSION in the case 
where the server is well-protected logically and physically, but it's 
so easy to encrypt (if session storage is needed at all) that there's 
no reason not to.

 Not storing an encrypted username/password in $_SESSION/COOKIE if having
 those values provides access.  Because at that point, the encryption is
 rather meaningless, as it's really a clear-text 32-character code that
 happens to be the encrypted value of something secret, but the clear-text
 32-character code gives the Bad Guy access, whether they know the secret
 or not.
 
 If your content/application/data is important enough to warrant a
 username/password, then it should be important enough to secure with this
 minimal level of security, IN MY OPINION.

Here I think we disagree as by this logic no one should store anything 
in a cookie that provides access (beyond a short temporary timeframe).  
There are many kinds of sites where users want some privacy or control 
over their own account but also want the convenience of staying logged 
in, and where there is little or nothing any Bad Guy skilled enough to 
go steal the cookie would bother with.  For example, many discussion 
board logins fit this description.  I personally use a different 
password for each one I'm on (it's not very many), and far prefer the 
convenience of not having to go look it up every time over the 
security of having it expire, particularly since the very worst 
someone can do if they gain access is post as if they were me.

The analogy is that the Bad Guys who know how to break into bank vaults 
just don't care about my (hypothetical) shed full of garden tools, and 
if they do test their skills there, the garden tools aren't that 
valuable anyway.  And if in order to prevent this highly unlikely theft 
I have to remember my key every time I go out to do some work, that's a 
poor tradeoff to me.

What we're arguing about is whether the garden shed [web site] should 
be designed so that I *have* to use a key (i.e. require a specific 
level of security) or whether I as the user can choose.  For anything 
involving money or significant personal data, or other similar risks, 
yes, to me the login security should be forced.  But for less important 
assets there are real benefits to security practices that give the user 
more control.

Some of this is simply a question of whether there is a category of 
stuff that is important enough to protect with a password but that 
doesn't require more careful security, login expiration after a short 
time and other protection mechanisms.  I think that category exists, 
sounds like you are saying you think it does not.

 If users forget passwords, they should get new random passwords, with the
 application/email directing them to change those passwords to memorable
 (to them) but hopefully un-guessable (to Bad Guys) values.

Agreed.  My clients don't always agree but I think this is correct.

 I would contend that anything less is simply a false sense of security,
 provided to the un-informed, by using inherently insecure
 username/password methodolgy.
 
 The fact that 10 zillion sites are currently doing exactly that does not
 make it right.
 
 You obviously disagree, and think everything is just hunky-dory in the 10
 zillion sites that are leaking passwords to any Bad Guy with half a clue.

Well I hope that was a bit tongue in cheek.  I didn't say that nor do I 
think that.  There's a lot of bad security out there.  That doesn't 
make someone like me who disagrees with a particular set of security 
principles into someone who thinks all bad security is fine.

--
Tom

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



Re: [PHP] Storing password in cookie

2005-04-14 Thread trlists
On 14 Apr 2005 Chris Shiflett wrote:

 When a user enters a credit card number, there may likely be a 
 verification step before the actual purchase is made. It's better to 
 keep this number on the server (in the session data store) than to 
 unnecessarily expose it over the Internet again (SSL mitigates the risk, 
 but an unnecessary risk is still worth avoiding).
 
 Being mindful of this, it's also helpful to not even display it to the 
 user, instead showing only the last four digits or something, because 
 this display also counts as exposure (since it's in the response).

There is one case where redisplaying the number (via https) makes sense 
to me -- when it fails a verification check.  The obvious example is a 
simple check-digit error due to a typing error on the user's part.  In 
this case the option is either expecting the user to retype the entire 
number every time they make a mistake, or accepting the -- to me 
minimal -- risk in sending it back for editing when redisplaying the 
form and error message.  But doing that does require putting the CC # 
in some form into session storage (or some kind of storage) in the case 
where the processing / validation and display scripts are separate and 
the processing script needs to pass posted data back for redisplay.  

Re last four digits, I have notice that many sites seem to be going to 
showing the last five or six, first four plus last four, etc.  
Apparently people are finding that last four alone isn't sufficient for 
users to recognize the card.  


--
Tom

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



[PHP] pixels per character

2005-04-14 Thread Christian Calloway
Hey all,

trying to dynamically size cell widths; what I need is a formula to measure 
pixels per character for an arbitrary font (in this case 10pt verdana). A 
simple function f(x) = strlen(x) * SOMECONSTANT just doesn't seem to cut it, 
as returned widths are to small are long. Any ideas?

Christian 


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



[PHP] Best practices for set/get methods

2005-04-14 Thread Tim Boring
Does anyone have suggestions/ideas about best practices for writing
set/get methods in PHP5?  There are two basic ways I've seen this done,
which I've provided examples of below. Method #2 is obviously the easier
way, but that doesn't mean it may be the best way.

I'm curious to read people's responses. 

Thanks,
Tim 

#1:  set/get method for each member attribute
example:
private $foo;
private $bar;

public getFoo()
{
return $this-foo;
}
public setFoo($val)
{
$this-foo = $val;
}
public getBar()
{
return $this-bar;
}
public setBar($val)
{
$this-bar = $val;
}

#2: generalized set/get methods
example:
private $foo;
private $bar;

public getVar($var)
{
return $this-$var;
}
public setVar($var, $val)
{
set $this-$var = $val;
} 

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



RE: [PHP] pixels per character

2005-04-14 Thread Chris W. Parker
Christian Calloway mailto:[EMAIL PROTECTED]
on Thursday, April 14, 2005 1:59 PM said:

 trying to dynamically size cell widths; what I need is a formula to
 measure pixels per character for an arbitrary font (in this case 10pt
 verdana). A simple function f(x) = strlen(x) * SOMECONSTANT just
 doesn't seem to cut it, as returned widths are to small are long. Any
 ideas? 

That's like killing a mouse with an atomic bomb. Why not just do
white-space: nowrap; or td nowrap=nowrap or set a percentage based
width?

What are you doing that requires determining the column width based on
pixels?



Chris.

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



Re: [PHP] pixels per character

2005-04-14 Thread Greg Donald
On 4/14/05, Christian Calloway [EMAIL PROTECTED] wrote:
 trying to dynamically size cell widths; what I need is a formula to measure
 pixels per character for an arbitrary font (in this case 10pt verdana). A
 simple function f(x) = strlen(x) * SOMECONSTANT just doesn't seem to cut it,
 as returned widths are to small are long. Any ideas?

Google for 'font width calculator'.  I've seen a few of them over the
years, mostly Flash or Java based.


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

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



Re: [PHP] Best practices for set/get methods

2005-04-14 Thread Greg Donald
On 4/14/05, Tim Boring [EMAIL PROTECTED] wrote:
 Does anyone have suggestions/ideas about best practices for writing
 set/get methods in PHP5?  There are two basic ways I've seen this done,
 which I've provided examples of below. Method #2 is obviously the easier
 way, but that doesn't mean it may be the best way.
 
 I'm curious to read people's responses.


I would start off with a simple base class like this:

abstract class Base
{
public function __construct()
{

}

public function __destruct()
{

}

public function __toString()
{
return 'pre' . print_r( $this, TRUE ) . '/pre';
}

public function __get( $key )
{
return isset( $this-$key )
? $this-$key
: NULL;
}

public function __set( $key, $value )
{
$this-$key = $value;
}
}


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

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



Re: [PHP] Best practices for set/get methods

2005-04-14 Thread Rasmus Lerdorf
Tim Boring wrote:
Does anyone have suggestions/ideas about best practices for writing
set/get methods in PHP5?  There are two basic ways I've seen this done,
which I've provided examples of below. Method #2 is obviously the easier
way, but that doesn't mean it may be the best way.
I'm curious to read people's responses. 

Thanks,
Tim 

#1:  set/get method for each member attribute
example:
private $foo;
private $bar;
public getFoo()
{
return $this-foo;
}
public setFoo($val)
{
$this-foo = $val;
}
public getBar()
{
return $this-bar;
}
public setBar($val)
{
$this-bar = $val;
}
#2: generalized set/get methods
example:
private $foo;
private $bar;
public getVar($var)
{
return $this-$var;
}
public setVar($var, $val)
{
set $this-$var = $val;
} 
Why not use __set()?
http://www.php.net/manual/en/language.oop5.overloading.php
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] imagecopyresample

2005-04-14 Thread gareth
On Apr 14, 2005, at 21:37, Marek Kilimajer wrote:
[EMAIL PROTECTED] wrote:
I have created (adapted) the follow function:
function imageresize($new_width, $new_height, $filename) {
// Content type
header('Content-type: image/jpeg');
// Get new dimensions
list($width, $height) = getimagesize($filename);
// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width,   
$new_height, $width, $height);
// Output
imagejpeg($image_p, null, 100);
}
The idea is it takes a image and resizes it at server end so that you  
 dont have to download a massive image. And it works.
That is as long as that function is the only think you doing.
For example if I have a page with the following in it:
?php
require_once('../includes/functions.php');
imageresize('100', '75', 'pages/1.jpg');
?
I get my image resized. (functions.php is where all my fuctions are   
stored) However if I place anything after the imageresize it doesnt   
show that. Eg echohello'; does nothing. If anything goes before it  
the  whole page doesnt work.
Any ideas why this is happening and how I can work around it?
You can display either image or html, not both. You must do:
img src=thumb.php
thumb.php contains the code to output the thumbnail

Thanks a lot  That worked a treat

 
-

check out my blog to find out what im up to:
http://www.zaphodmcmillan.com/
And my new email is [EMAIL PROTECTED]

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

[PHP] Sessions and frames

2005-04-14 Thread Gustav Wiberg
Hi there!
I have built my site into frames.
I want to transfer a session-variable from my left frame to my right 
frame... How do I do this best? Thoughts?

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


RE: [PHP] Sessions and frames

2005-04-14 Thread Chris W. Parker
Gustav Wiberg mailto:[EMAIL PROTECTED]
on Thursday, April 14, 2005 4:00 PM said:

 I have built my site into frames.
 
 I want to transfer a session-variable from my left frame to my right
 frame... How do I do this best? Thoughts?

You do this best by setting some session data on one page (any page),
and then accessing that same data on another page (any page). If both
frame sources are within the same domain they both have access to the
same session data.



Chris.

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



[PHP] Re: pixels per character

2005-04-14 Thread Amir Mohammad Saied
We have to kinds of fonts,
One the fonts that size of all thier characters are equal such as 
Courier, but in the other fonts etc. (Verdana) all of characters haven't 
an equal width

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