Re: [PHP] Posting Summary for Week Ending 25 January, 2008: php-general@lists.php.net

2008-01-24 Thread Wolf

Jochem Maas wrote:


Posting Summary for PHP-General List
Week Ending: Friday, 25 January, 2008

Messages| Bytes   | Sender
+-+--
697  (100%) 975244  (100%)  EVERYONE
690 (98.9%) 974000 (99.8%)  Richard Lynch [EMAIL PROTECTED]
  7  (1.1%)   1244  (0.2%)  everyone else



Now That's Funny!!!  True, but funny...

I swear, I do work for a minute and Richard posts 12 times...  He must 
be on vacation on a beach somewhere... ;)


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



Re: [PHP] Posting Summary for Week Ending 25 January, 2008: php-general@lists.php.net

2008-01-24 Thread Zoltán Németh
2008. 01. 24, csütörtök keltezéssel 02.45-kor Wolf ezt írta:
 Jochem Maas wrote:
  
  Posting Summary for PHP-General List
  Week Ending: Friday, 25 January, 2008
  
  Messages| Bytes   | Sender
  +-+--
  697  (100%) 975244  (100%)  EVERYONE
  690 (98.9%) 974000 (99.8%)  Richard Lynch [EMAIL PROTECTED]
7  (1.1%)   1244  (0.2%)  everyone else
  
 
 Now That's Funny!!!  True, but funny...
 
 I swear, I do work for a minute and Richard posts 12 times...  He must 
 be on vacation on a beach somewhere... ;)
 

or he has set up some AI systems to answer to the mailing list while he
does his job. or he has set up the AI systems to do his job while he is
answering to the list. :)

greets
Zoltán Németh

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



[PHP] forms and php

2008-01-24 Thread Mark Pashia
I am fairly new to the php/mySQL combo and just noticed an unusual behavior
and don't know where to find the answer to fix this. It is probably common
knowledge, but not to a newbie.

 

If I fill in the fields of a form and hit the enter key to submit the
form, no variables seem to be passed along. If I use the submit button,
everything works perfectly. It seems that other forms on the web work with
the enter key just fine, so I am probably doing something to cause this yet
I don't know what.

 

I am hosted at hostgator.com and it has php version 4.4.4 and mySQL version
4.1.22-standard.

 

Thanks, Mark Pashia



Re: [PHP] DOM API Namespaces - help?

2008-01-24 Thread Per Jessen
Nathan Rixham wrote:

 but assuming the above file is:
 ?xml version=1.0 ?
 chapter xmlns:xi=http://www.w3.org/2001/XInclude;
 a /
 /chapter
 
 how would one retrieve xmlns:xi=http://www.w3.org/2001/XInclude;

When you say 'retrieve', what do you really mean?  You need to get the
namespace value into a PHP variable? 

I would probably look at the namespace-uri() function in XSLT, but I
don't know if you're using XSLT?


/Per Jessen, Zürich

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



[PHP] are email address could be spammed

2008-01-24 Thread clive
http://www.mail4liste.de/viewtopic.php?p=259845sid=4b4f436983abded92e9a090cdea0c688 


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



Re: [PHP] are email address could be spammed

2008-01-24 Thread Zoltán Németh


2008. 01. 24, csütörtök keltezéssel 11.40-kor clive ezt írta:
 http://www.mail4liste.de/viewtopic.php?p=259845sid=4b4f436983abded92e9a090cdea0c688
  
 

read back the archives, this has been discussed already. our addresses
are already public, as we use them to answer mails on this list. so it
does not matter at all. but if you ask Dan, he will remove your address
from the report surely.

greets
Zoltán Németh

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



Re: [PHP] Posting Summary for Week Ending 25 January, 2008: php-general@lists.php.net

2008-01-24 Thread Jochem Maas

Paul Scott schreef:

On Thu, 2008-01-24 at 01:13 +0100, Jochem Maas wrote:

stats while I'm at it ... I've been busy wracking my brain trying to
figure out
the setup for a load-balanced configuration for one of my major
clients ... at least
a system capable of migrating to loadbalancing ... global file system,
virtual machines,
all that jazz. I'm in over my head as usual.


Have you taken a look at LVS yet? I presume  that you are not attempting
this on a Windows cluster - right?


no windows here :-)
I hadn't checked out LVS - I'll do some reading, although currently we're
working on a Xen based system. actually the virtualisation aspect is purely
to avoid having to purchase a stack of machines at the current time.

the aim of the game is to allow redundancy and scalability - building
the serverfarm as VMs now and then migrating them to seperate hardware
as the need/money arises.

actually the biggest stumbling block is getting GFS running - something
which is way over my head :-) (oh look it's a plane ;-)



http://www.linuxvirtualserver.org/

I just had to do the same thing for my University systems - come up with
an architecture at least. If you would like the dox, let me know - they
are all CC licensed.

--Paul





All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 





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



Re: [PHP] are email address could be spammed

2008-01-24 Thread Jochem Maas

hi clive,

it's 'our email' not 'are email' ;-) and yes we know about this problem.
nothing much we can do about it

clive schreef:
http://www.mail4liste.de/viewtopic.php?p=259845sid=4b4f436983abded92e9a090cdea0c688 



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



[PHP] Verification number

2008-01-24 Thread Emil Edeholt

Hi

Sorry if this is considered off topic. Please ignore the post in that case.

My site uses ten digit numbers as ID:s for our products. I would like 
the last digit to be a verification/check digit. I was just about to 
just make some simple function that would add the other values together 
into a one digit verification digit. But I thought maybe there are 
better or worse ways of doing this, since some algorithms probably 
produce a more even distribution of verification digits than others do. 
I.e. it would be a shame if I later on notice that half of my ID:s get  
9 as verification.


Any ideas?

Regards Emil

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



Re: [PHP] DOM API Namespaces - help?

2008-01-24 Thread Nathan Rixham
Thanks Jessen, I'm using the DOM API (domdocument) in PHP 5 - and yes 
pull xmlns:xi=http://www.w3.org/2001/XInclude; from the chapter or 
indeed any namespaces defined in the root node and store them in a variable.


If anybody could shed any light it'd be greatly appreciated.

Nathan

Per Jessen wrote:

Nathan Rixham wrote:


but assuming the above file is:
?xml version=1.0 ?
chapter xmlns:xi=http://www.w3.org/2001/XInclude;
a /
/chapter

how would one retrieve xmlns:xi=http://www.w3.org/2001/XInclude;


When you say 'retrieve', what do you really mean?  You need to get the
namespace value into a PHP variable? 


I would probably look at the namespace-uri() function in XSLT, but I
don't know if you're using XSLT?


/Per Jessen, Zürich


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



Re: [PHP] Using mysql_real_escape_string without connecting to mysql

2008-01-24 Thread Jochem Maas

Dotan Cohen schreef:

On 24/01/2008, Richard Lynch [EMAIL PROTECTED] wrote:

On Wed, January 23, 2008 4:04 pm, Dotan Cohen wrote:

Is the -- here not treated as the beginning of an SQL comment?

No, because it is inside the apostrophes.

The purpose of mysql_real_escape_string (or using prepared statements)
is to mark up (or separate) the DATA from the QUERY.

The data about to be put into the database being escaped by
mysql_real_escape_string is sufficient to be sure nobody is playing
games with apostrophe followed by -- which could, in theory, insert an
SQL comment or allow them to execute arbitrary SQL code.


In that case, the function:

function clean_mysql ($dirty) {
  $dirty=str_replace (--, , $dirty);
  $dirty=str_replace (;, , $dirty);
  $clean=mysql_real_escape_string($dirty);
  return $clean;
}

Can be reduced to:

function clean_mysql ($dirty) {
  $clean=mysql_real_escape_string($dirty);
  return $clean;
}


or even:

function clean_mysql ($dirty)
{
return mysql_real_escape_string($dirty);
}

although I would make it part of a DB connection object so that
you can explicitly and transparently pass in the link id.

class myDBC
{
private $link;

function __construct($u, $p, $db, $cs)
{
// connect to given $db or throw exception
}

function cleanStr($s)
{
return mysql_real_escape_string($s, $this-link);
}
}

just a thought.



Which basically is the same as a simple mysql_real_escape_string? In
other words, mysql_real_escape_string itself is safe from SQL
injection?


not exactly - it assumes you will use the value as a quoted string in a query.

$s = clean_mysql(foo -- bar ; ' qux)
$q = INSERT INTO foo (bar) VALUES ('$s');



Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


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



Re: [PHP] Verification number

2008-01-24 Thread Jochem Maas

Emil Edeholt schreef:

Hi

Sorry if this is considered off topic. Please ignore the post in that case.

My site uses ten digit numbers as ID:s for our products. I would like 
the last digit to be a verification/check digit. I was just about to 
just make some simple function that would add the other values together 
into a one digit verification digit. But I thought maybe there are 
better or worse ways of doing this, since some algorithms probably 
produce a more even distribution of verification digits than others do. 
I.e. it would be a shame if I later on notice that half of my ID:s get  
9 as verification.


if the checksum is merely 1 byte there will only be 256 variations - and
they are liable to be concentrated in a certain range of values.

I'm not sure if the code below is anything like along the right lines,
I used your post as an excuse to play wih pack/unpack - which I
don't fully grok - but I'm guessing you want to create a checksum from the
id and binary encode the value (then add it to the id to create the final
public id) so that you can later perform the check sum check

$a = 123456789;
$r = crc32($a);
$u = sprintf(%u, $r);
$l = pack(H*, $u);
$k = unpack(H*, $l);

var_dump($u, $l, $k[1]);

$i = $a.$l;
$b = substr($i, 0, 9);
$c = substr($i, 9);

var_dump( $i, $b, $c, ($c == pack(H*, sprintf(%u, crc32($b );

I may be on the completely wrong track, I'm sure I'm missing something and at
the very least there is probably an endianess issue I'm not taking into account.

maybe someone smart can offer a correction :-)



Any ideas?

Regards Emil



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



Re: [PHP] DOM API Namespaces - help?

2008-01-24 Thread Rob

Hi Nathan,

You need to retrieve the attribute based on the xmlns namespace.

Nathan Rixham wrote:
Thanks Jessen, I'm using the DOM API (domdocument) in PHP 5 - and yes 
pull xmlns:xi=http://www.w3.org/2001/XInclude; from the chapter or 
indeed any namespaces defined in the root node and store them in a 
variable.


If anybody could shed any light it'd be greatly appreciated.


$xml = '?xml version=1.0 ?
chapter xmlns:xi=http://www.w3.org/2001/XInclude;
a /
/chapter';

$dom = new DOMDocument();
$dom-loadXML($xml);
$root = $dom-documentElement;
$attr = $root-getAttributeNS('http://www.w3.org/2000/xmlns/', 'xi');
var_dump($attr);

Rob



Nathan

Per Jessen wrote:

Nathan Rixham wrote:


but assuming the above file is:
?xml version=1.0 ?
chapter xmlns:xi=http://www.w3.org/2001/XInclude;
a /
/chapter

how would one retrieve xmlns:xi=http://www.w3.org/2001/XInclude;


When you say 'retrieve', what do you really mean?  You need to get the
namespace value into a PHP variable?
I would probably look at the namespace-uri() function in XSLT, but I
don't know if you're using XSLT?


/Per Jessen, Zürich


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



Re: [PHP] Verification number

2008-01-24 Thread Emil Edeholt

Hi,

Thanks for your sugestions. I ended up using the Luhn algorithm. Simple 
but I think it will work for me.


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

Emil

George Pitcher wrote:

Emil,

have you looked at the 10-digit ISBN verification, which has just been
replaced by the 13-digit EAN system?

It may be of use, but it needs the field to be varchar as the checkdigit may
be a 'X'.

Hope this helps.

George
  


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



RE: [PHP] Posting Summary for Week Ending 25 January, 2008: php-general@lists.php.net

2008-01-24 Thread Jay Blanchard
[snip]
 Dude, I laughed so loud that it echoed in the halls of the
 Engineering Wing over here.  What makes it so funny?  That it's not
 much of an exaggeration!  ;-D
 

very glad to raise a laugh :-) those without a sense of humour should
leave the php highway at the next exit. ;-)

oh and I'm gonna hold you to that beer one day :-)
[/snip]

The first time we ever see all of us face to face there will have to be
a lot of beer bought. The conversation will be interesting though.
Several folks will ask and answer questions. I will say RTFM so many
times that folks will quit listening to me. Then Richard will answer all
of the questions in one long monologue. Daniel will then recap. Some
fool will ask a MySQL question at which point we will all point to
another room and advise them to get their answer there, either that or
they will have to buy the next round. A fist fight will occur when
someone provides an answer to a question that hasn't been asked. The
phrase curly braces, schmurley braces will be heard. And someone will
no doubt ask everyone else to speak up so that we can all hear the
question or answer.

Maybe this is the premise for the next great novel

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



RE: [PHP] Posting Summary for Week Ending 25 January, 2008: php-general@lists.php.net

2008-01-24 Thread Zoltán Németh
2008. 01. 24, csütörtök keltezéssel 07.13-kor Jay Blanchard ezt írta:
 [snip]
  Dude, I laughed so loud that it echoed in the halls of the
  Engineering Wing over here.  What makes it so funny?  That it's not
  much of an exaggeration!  ;-D
  
 
 very glad to raise a laugh :-) those without a sense of humour should
 leave the php highway at the next exit. ;-)
 
 oh and I'm gonna hold you to that beer one day :-)
 [/snip]
 
 The first time we ever see all of us face to face there will have to be
 a lot of beer bought. The conversation will be interesting though.
 Several folks will ask and answer questions. I will say RTFM so many
 times that folks will quit listening to me. Then Richard will answer all
 of the questions in one long monologue. Daniel will then recap. Some
 fool will ask a MySQL question at which point we will all point to
 another room and advise them to get their answer there, either that or
 they will have to buy the next round. A fist fight will occur when
 someone provides an answer to a question that hasn't been asked. The
 phrase curly braces, schmurley braces will be heard. And someone will
 no doubt ask everyone else to speak up so that we can all hear the
 question or answer.

yeah, and every once in a while we form two or more groups quarreling
about some indecisible questions (remember the threads about storing
images in databases for example ;) ) - maybe we play football matches or
whatever games or end up in a giant fight to achieve a decision then,
losing side buys the next round, then everything goes on as before :D

greets
Zoltán Németh

 
 Maybe this is the premise for the next great novel
 

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



Re: [PHP] Verification number

2008-01-24 Thread Per Jessen
Emil Edeholt wrote:

 George Pitcher wrote:
 Emil,

 have you looked at the 10-digit ISBN verification, which has just
 been replaced by the 13-digit EAN system?

 It may be of use, but it needs the field to be varchar as the
 checkdigit may be a 'X'.

AFAIK, the 10-digit ISBN numbers use the modulus 11 algorithm, which
is also used in several other places (Danish social security numbers
for instance), and I'm sure you can adjust the weighting such that the
checkdigit is always numeric. 


/Per Jessen, Zürich

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



Re: [PHP] DOM API Namespaces - help?

2008-01-24 Thread Nathan Rixham

Cheers Rob,

But this is the problem, I don't know what the namespace/prefix is! ie 
xi and the following doesn't work:


$root-getAttributeNS('http://www.w3.org/2000/xmlns/', '*');

further xmlns is ?not? a prefix so this won't work either..
$root-lookupPrefix('http://www.w3.org/2000/xmlns/');

we need to assume that we don't know the document we're working on, thus 
we don't know:

a] if it has any namespaces defined
b] if any, what the namespaces are
c] if any, what the prefixes are.

And I still can't find any way of finding this out, it should be simple 
enough surely?


still help!?

Nathan

Rob wrote:

Hi Nathan,

You need to retrieve the attribute based on the xmlns namespace.

Nathan Rixham wrote:
Thanks Jessen, I'm using the DOM API (domdocument) in PHP 5 - and yes 
pull xmlns:xi=http://www.w3.org/2001/XInclude; from the chapter or 
indeed any namespaces defined in the root node and store them in a 
variable.


If anybody could shed any light it'd be greatly appreciated.


$xml = '?xml version=1.0 ?
chapter xmlns:xi=http://www.w3.org/2001/XInclude;
a /
/chapter';

$dom = new DOMDocument();
$dom-loadXML($xml);
$root = $dom-documentElement;
$attr = $root-getAttributeNS('http://www.w3.org/2000/xmlns/', 'xi');
var_dump($attr);

Rob



Nathan

Per Jessen wrote:

Nathan Rixham wrote:


but assuming the above file is:
?xml version=1.0 ?
chapter xmlns:xi=http://www.w3.org/2001/XInclude;
a /
/chapter

how would one retrieve xmlns:xi=http://www.w3.org/2001/XInclude;


When you say 'retrieve', what do you really mean?  You need to get the
namespace value into a PHP variable?
I would probably look at the namespace-uri() function in XSLT, but I
don't know if you're using XSLT?


/Per Jessen, Zürich


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



Re: [PHP] forms and php

2008-01-24 Thread Jochem Maas

Mark Pashia schreef:

I am fairly new to the php/mySQL combo and just noticed an unusual behavior
and don't know where to find the answer to fix this. It is probably common
knowledge, but not to a newbie.

 


If I fill in the fields of a form and hit the enter key to submit the
form, no variables seem to be passed along. If I use the submit button,
everything works perfectly. It seems that other forms on the web work with
the enter key just fine, so I am probably doing something to cause this yet
I don't know what.


seem?

try the following line at the top of your submit script to see what is posted:

var_dump($_GET, $_POST);



 


I am hosted at hostgator.com and it has php version 4.4.4 and mySQL version
4.1.22-standard.

 


Thanks, Mark Pashia




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



Re: [PHP] DOM API Namespaces - help?

2008-01-24 Thread Rob

Hi Nathan,

Nathan Rixham wrote:

Cheers Rob,

But this is the problem, I don't know what the namespace/prefix is! ie 
xi and the following doesn't work:


$root-getAttributeNS('http://www.w3.org/2000/xmlns/', '*');

further xmlns is ?not? a prefix so this won't work either..
$root-lookupPrefix('http://www.w3.org/2000/xmlns/');

we need to assume that we don't know the document we're working on, thus 
we don't know:

a] if it has any namespaces defined
b] if any, what the namespaces are
c] if any, what the prefixes are.

And I still can't find any way of finding this out, it should be simple 
enough surely?


still help!?



There are a couple of ways to do this.
Using only DOM, you can grab the namespaces via XPath:

$root = $dom-documentElement;
$xpath = new DOMXPath($dom);
$nodes = $xpath-query('namespace::*');
foreach ($nodes AS $node) {
print x: .$node-localName.\n;
}


A simpler solution is to use simplexml:
$sxe = simplexml_import_dom($root);
var_dump($sxe-getDocNamespaces(true));

Rob




Nathan

Rob wrote:

Hi Nathan,

You need to retrieve the attribute based on the xmlns namespace.

Nathan Rixham wrote:
Thanks Jessen, I'm using the DOM API (domdocument) in PHP 5 - and yes 
pull xmlns:xi=http://www.w3.org/2001/XInclude; from the chapter or 
indeed any namespaces defined in the root node and store them in a 
variable.


If anybody could shed any light it'd be greatly appreciated.


$xml = '?xml version=1.0 ?
chapter xmlns:xi=http://www.w3.org/2001/XInclude;
a /
/chapter';

$dom = new DOMDocument();
$dom-loadXML($xml);
$root = $dom-documentElement;
$attr = $root-getAttributeNS('http://www.w3.org/2000/xmlns/', 'xi');
var_dump($attr);

Rob



Nathan

Per Jessen wrote:

Nathan Rixham wrote:


but assuming the above file is:
?xml version=1.0 ?
chapter xmlns:xi=http://www.w3.org/2001/XInclude;
a /
/chapter

how would one retrieve xmlns:xi=http://www.w3.org/2001/XInclude;


When you say 'retrieve', what do you really mean?  You need to get the
namespace value into a PHP variable?
I would probably look at the namespace-uri() function in XSLT, but I
don't know if you're using XSLT?


/Per Jessen, Zürich


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



Re: [PHP] are email address could be spammed

2008-01-24 Thread Nathan Nobbe
On Jan 24, 2008 4:57 AM, Jochem Maas [EMAIL PROTECTED] wrote:

 it's 'our email' not 'are email' ;-) and yes we know about this problem.
 nothing much we can do about it


get gmail; it works like a charm :)

-nathan


Re: [PHP] are email address could be spammed

2008-01-24 Thread Jochem Maas

Nathan Nobbe schreef:

On Jan 24, 2008 4:57 AM, Jochem Maas [EMAIL PROTECTED] wrote:


it's 'our email' not 'are email' ;-) and yes we know about this problem.
nothing much we can do about it



get gmail; it works like a charm :)


like a charm for the marketing, ad-shovelling sales whores at google you.
my mail server is fine thanks, plaster my email address all over the web for
all I care.



-nathan



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



Re: [PHP] are email address could be spammed

2008-01-24 Thread Nathan Nobbe
On Jan 24, 2008 10:26 AM, Jochem Maas [EMAIL PROTECTED] wrote:

 like a charm for the marketing, ad-shovelling sales whores at google you.


i dont know man; its a pretty nice user interface.  i might try to setup an
open
source web interface for my server when i get the time, but for now i can
use
gmail to interface w/ my personal mail server as well; thats pretty
convenient.
check this one out; from the same guys that make trac (edgewall)
http://posterity.edgewall.org/

my mail server is fine thanks, plaster my email address all over the web for
 all I care.


thats cool, what i was really getting at is that gmail handles the spam
issues w/
next to no hassle.  im sure there are plenty of solutions to protect
personal mail
servers as well, such as spam assassin.  the whole spam thing really isnt a
big
issue for me, and sounds like it isnt for you either :)

-nathan


[PHP] if

2008-01-24 Thread Pastor Steve
Greetings,

Can anyone point me in the right direction on this?

I want a link to an image that appears below the link after it is clicked. I
think it would be an ³if² statement, but I am not sure where to start.

Thanks,

--
Steve M.



[PHP] 128M need in PHP5.2.5 instead of 8M in PHP5.1.4!

2008-01-24 Thread Luc Maltier
Hello!
 
My first message:
 
I've just updated PHP from 5.1.4 to 5.2.5 (to solve an Apache problem when
double-clicking on links). This was successful, as the problem is now
solved, but I now, sometimes, get a message stating that the memory is
exhausted. I modififed php.ini and set memory_limit to 16M (instead of 8M
with PHP5.1.4), then 32M, then 64M, with the same message. With 128M, it
works. Can this change in memory required be considered as normal? I don't
think so... Is there any explanation?
 
Details:
- Platform: Windows.
- I used Windows binaries (no C compiler available). The part causing the
error uses jpgraph (for generating .png files) and the png files are used
when generating a PDF file (by the tcpdf library) (the gd extension is
used).
 
A second issue with this release: When I made the tests decribed above, I
used 'restart' to restart the Apache server, with no error message. When I
tried to stop Apache and start it again, I got an error message stating that
the zend_unmangle_property_name_ex entry  cannot be found in php5ts.dll, and
I now get this message each time I restart Apache (Apache2.2),. But it seems
that Apache works normally nonetheless. I made sure that the php5ts.dll used
is the right version for 5.2.5. Any idea?
 
Thanks for any suggestion!


Re: [PHP] are email address could be spammed

2008-01-24 Thread Eric Butera
On Jan 24, 2008 10:36 AM, Nathan Nobbe [EMAIL PROTECTED] wrote:
 On Jan 24, 2008 10:26 AM, Jochem Maas [EMAIL PROTECTED] wrote:

  like a charm for the marketing, ad-shovelling sales whores at google you.


 i dont know man; its a pretty nice user interface.  i might try to setup an
 open
 source web interface for my server when i get the time, but for now i can
 use
 gmail to interface w/ my personal mail server as well; thats pretty
 convenient.
 check this one out; from the same guys that make trac (edgewall)
 http://posterity.edgewall.org/

 my mail server is fine thanks, plaster my email address all over the web for
  all I care.


 thats cool, what i was really getting at is that gmail handles the spam
 issues w/
 next to no hassle.  im sure there are plenty of solutions to protect
 personal mail
 servers as well, such as spam assassin.  the whole spam thing really isnt a
 big
 issue for me, and sounds like it isnt for you either :)

 -nathan


I used to be hardcore pop only but now that I use gmail I don't care
about any other mail client.  It beats Thunderbird and Mail.app hands
down.  If you don't look at the right hand side you won't see the ads.
:)  I even have it set up now to pull my pop mail account and slap it
in a filter.  Plus I enjoy all the people complaining about how users
shouldn't change the subject.  The gmail thread grouping takes care of
all that for me. :D  The only real downside is you can't view the raw
source of messages or get the headers.

As Nathan said, the spam filter is really good too.

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



Re: [PHP] DOM API Namespaces - help?

2008-01-24 Thread Nathan Rixham

Cheers indeed Rob!

That DOMXPath solution is exactly what I was looking for; Many, Many Thanks,

Nathan

Rob wrote:

Hi Nathan,

Nathan Rixham wrote:

Cheers Rob,

But this is the problem, I don't know what the namespace/prefix is! ie 
xi and the following doesn't work:


$root-getAttributeNS('http://www.w3.org/2000/xmlns/', '*');

further xmlns is ?not? a prefix so this won't work either..
$root-lookupPrefix('http://www.w3.org/2000/xmlns/');

we need to assume that we don't know the document we're working on, 
thus we don't know:

a] if it has any namespaces defined
b] if any, what the namespaces are
c] if any, what the prefixes are.

And I still can't find any way of finding this out, it should be 
simple enough surely?


still help!?



There are a couple of ways to do this.
Using only DOM, you can grab the namespaces via XPath:

$root = $dom-documentElement;
$xpath = new DOMXPath($dom);
$nodes = $xpath-query('namespace::*');
foreach ($nodes AS $node) {
print x: .$node-localName.\n;
}


A simpler solution is to use simplexml:
$sxe = simplexml_import_dom($root);
var_dump($sxe-getDocNamespaces(true));

Rob




Nathan

Rob wrote:

Hi Nathan,

You need to retrieve the attribute based on the xmlns namespace.

Nathan Rixham wrote:
Thanks Jessen, I'm using the DOM API (domdocument) in PHP 5 - and 
yes pull xmlns:xi=http://www.w3.org/2001/XInclude; from the chapter 
or indeed any namespaces defined in the root node and store them in 
a variable.


If anybody could shed any light it'd be greatly appreciated.


$xml = '?xml version=1.0 ?
chapter xmlns:xi=http://www.w3.org/2001/XInclude;
a /
/chapter';

$dom = new DOMDocument();
$dom-loadXML($xml);
$root = $dom-documentElement;
$attr = $root-getAttributeNS('http://www.w3.org/2000/xmlns/', 'xi');
var_dump($attr);

Rob



Nathan

Per Jessen wrote:

Nathan Rixham wrote:


but assuming the above file is:
?xml version=1.0 ?
chapter xmlns:xi=http://www.w3.org/2001/XInclude;
a /
/chapter

how would one retrieve xmlns:xi=http://www.w3.org/2001/XInclude;


When you say 'retrieve', what do you really mean?  You need to get the
namespace value into a PHP variable?
I would probably look at the namespace-uri() function in XSLT, but I
don't know if you're using XSLT?


/Per Jessen, Zürich


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



Re: [PHP] Posting Summary for Week Ending 25 January, 2008: php-general@lists.php.net

2008-01-24 Thread Robert Cummings

On Thu, 2008-01-24 at 09:10 +0100, Zoltán Németh wrote:
 2008. 01. 24, csütörtök keltezéssel 02.45-kor Wolf ezt írta:
  Jochem Maas wrote:
   
   Posting Summary for PHP-General List
   Week Ending: Friday, 25 January, 2008
   
   Messages| Bytes   | Sender
   +-+--
   697  (100%) 975244  (100%)  EVERYONE
   690 (98.9%) 974000 (99.8%)  Richard Lynch [EMAIL 
   PROTECTED]
 7  (1.1%)   1244  (0.2%)  everyone else
   
  
  Now That's Funny!!!  True, but funny...
  
  I swear, I do work for a minute and Richard posts 12 times...  He must 
  be on vacation on a beach somewhere... ;)
  
 
 or he has set up some AI systems to answer to the mailing list while he
 does his job. or he has set up the AI systems to do his job while he is
 answering to the list. :)

The singularity is upon... it's name is Richard .01 alpha. Please report
bugs to the singularity himself.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] if

2008-01-24 Thread Nathan Nobbe
On Jan 24, 2008 10:39 AM, Pastor Steve [EMAIL PROTECTED] wrote:

 Greetings,

 Can anyone point me in the right direction on this?

 I want a link to an image that appears below the link after it is clicked.
 I
 think it would be an ³if² statement, but I am not sure where to start.


there are many ways to do this; but mostly they will involve javascript
unless
you want the browser to navigate to another page (which is the standard
behavior
of an anchor tag).
you can check out chunkystudio.com if you want; once you get into the
drawings
or paintings section there is a preview something like what youre after (im
guessing).
the javascript code is freely available (obviously) but it uses the
prototype framework
to do most of the heavy lifting.

for something generic, with instructions, check this out (found it in a
quick google for
javascript image preview)
http://www.huddletogether.com/projects/lightbox/

-nathan


Re: [PHP] 128M need in PHP5.2.5 instead of 8M in PHP5.1.4!

2008-01-24 Thread Eric Butera
On Jan 24, 2008 10:44 AM, Luc Maltier [EMAIL PROTECTED] wrote:
 Hello!

 My first message:

 I've just updated PHP from 5.1.4 to 5.2.5 (to solve an Apache problem when
 double-clicking on links). This was successful, as the problem is now
 solved, but I now, sometimes, get a message stating that the memory is
 exhausted. I modififed php.ini and set memory_limit to 16M (instead of 8M
 with PHP5.1.4), then 32M, then 64M, with the same message. With 128M, it
 works. Can this change in memory required be considered as normal? I don't
 think so... Is there any explanation?

 Details:
 - Platform: Windows.
 - I used Windows binaries (no C compiler available). The part causing the
 error uses jpgraph (for generating .png files) and the png files are used
 when generating a PDF file (by the tcpdf library) (the gd extension is
 used).

 A second issue with this release: When I made the tests decribed above, I
 used 'restart' to restart the Apache server, with no error message. When I
 tried to stop Apache and start it again, I got an error message stating that
 the zend_unmangle_property_name_ex entry  cannot be found in php5ts.dll, and
 I now get this message each time I restart Apache (Apache2.2),. But it seems
 that Apache works normally nonetheless. I made sure that the php5ts.dll used
 is the right version for 5.2.5. Any idea?

 Thanks for any suggestion!


On sites I work on we keep the memory limit quite low.  Then on pages
that require more memory for image manipulation or what have you I
just ini_set the memory limit up to something I need.  This isn't a
practical solution for all people but it works well for me as it is a
dedicated server under my control.

As for your second part I have no idea.  Try the Windows PHP users list.

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



Re: [PHP] are email address could be spammed

2008-01-24 Thread Robert Cummings

On Thu, 2008-01-24 at 10:42 -0500, Eric Butera wrote:
 On Jan 24, 2008 10:36 AM, Nathan Nobbe [EMAIL PROTECTED] wrote:
  On Jan 24, 2008 10:26 AM, Jochem Maas [EMAIL PROTECTED] wrote:
 
   like a charm for the marketing, ad-shovelling sales whores at google you.
 
 
  i dont know man; its a pretty nice user interface.  i might try to setup an
  open
  source web interface for my server when i get the time, but for now i can
  use
  gmail to interface w/ my personal mail server as well; thats pretty
  convenient.
  check this one out; from the same guys that make trac (edgewall)
  http://posterity.edgewall.org/
 
  my mail server is fine thanks, plaster my email address all over the web for
   all I care.
 
 
  thats cool, what i was really getting at is that gmail handles the spam
  issues w/
  next to no hassle.  im sure there are plenty of solutions to protect
  personal mail
  servers as well, such as spam assassin.  the whole spam thing really isnt a
  big
  issue for me, and sounds like it isnt for you either :)
 
  -nathan
 
 
 I used to be hardcore pop only but now that I use gmail I don't care
 about any other mail client.  It beats Thunderbird and Mail.app hands
 down.  If you don't look at the right hand side you won't see the ads.
 :)

You should look into user mode JavScript. I use Opera and I can have my
own brewed JS run when I load a page. This allows me to do special
filtering/post markup/event handling for common sites I visit. I know
Firefox has something similar but I don't use Firefox except to check
for correctness so can't speak more on it.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] are email address could be spammed

2008-01-24 Thread Stut


On 24 Jan 2008, at 15:42, Eric Butera wrote:

I used to be hardcore pop only but now that I use gmail I don't care
about any other mail client.  It beats Thunderbird and Mail.app hands
down.  If you don't look at the right hand side you won't see the ads.
:)  I even have it set up now to pull my pop mail account and slap it
in a filter.  Plus I enjoy all the people complaining about how users
shouldn't change the subject.  The gmail thread grouping takes care of
all that for me. :D  The only real downside is you can't view the raw
source of messages or get the headers.


Top-right of any message, the down arrow next to the Reply link,  
select Show Original... voila, the raw message complete with all  
headers.


I'm almost exclusively using Google Apps for all my mail (just a  
couple of accounts left to move), and nothing much has changed about  
what I do. I still have the choice between Thunderbird (IMAP) or  
Webmail (Gmail), and I still have a complete archive of all my mail  
since 1996. I have no complaints at all.


-Stut

--
http://stut.net/

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



Re: [PHP] Using mysql_real_escape_string without connecting to mysql

2008-01-24 Thread Dotan Cohen
On 24/01/2008, Jochem Maas [EMAIL PROTECTED] wrote:
  Which basically is the same as a simple mysql_real_escape_string? In
  other words, mysql_real_escape_string itself is safe from SQL
  injection?

 not exactly - it assumes you will use the value as a quoted string in a query.

 $s = clean_mysql(foo -- bar ; ' qux)
 $q = INSERT INTO foo (bar) VALUES ('$s');

Ah, we've gotten to the meat. So long as there as single quotes around
the data that has gone through mysql_real_escape_string there is no
danger of SQL injection? So this is safe:
mysql_query(
INSERT INTO
foo (bar)
VALUES (
'.mysql_real_escape_string($evilString).'
));

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


Re: [PHP] forms and php

2008-01-24 Thread Nathan Nobbe
On Jan 24, 2008 3:34 AM, Mark Pashia [EMAIL PROTECTED] wrote:

 If I fill in the fields of a form and hit the enter key to submit the
 form, no variables seem to be passed along. If I use the submit button,
 everything works perfectly. It seems that other forms on the web work with
 the enter key just fine, so I am probably doing something to cause this
 yet
 I don't know what.


what does the html look like?
i did a quick little experiment
http://nathan.moxune.com/exampleForm.php
and found if the type attribute of the input tag,
used for the submission button, was 'submit',
the enter key would not submit the form.  however,
if the value of the type attribute was 'button', pressing
the enter button would submit the form.

-nathan


[PHP] RE : [PHP] 128M need in PHP5.2.5 instead of 8M in PHP5.1.4!

2008-01-24 Thread Luc Maltier

Thanks for this clue (ini_set). But I normally don't need this amount of
memory anywhere, as 8M were OK in PHP5.1.4... I just want to understand what
happens.

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



Re: [PHP] are email address could be spammed

2008-01-24 Thread Eric Butera
On Jan 24, 2008 10:56 AM, Stut [EMAIL PROTECTED] wrote:

 On 24 Jan 2008, at 15:42, Eric Butera wrote:
  I used to be hardcore pop only but now that I use gmail I don't care
  about any other mail client.  It beats Thunderbird and Mail.app hands
  down.  If you don't look at the right hand side you won't see the ads.
  :)  I even have it set up now to pull my pop mail account and slap it
  in a filter.  Plus I enjoy all the people complaining about how users
  shouldn't change the subject.  The gmail thread grouping takes care of
  all that for me. :D  The only real downside is you can't view the raw
  source of messages or get the headers.

 Top-right of any message, the down arrow next to the Reply link,
 select Show Original... voila, the raw message complete with all
 headers.

 I'm almost exclusively using Google Apps for all my mail (just a
 couple of accounts left to move), and nothing much has changed about
 what I do. I still have the choice between Thunderbird (IMAP) or
 Webmail (Gmail), and I still have a complete archive of all my mail
 since 1996. I have no complaints at all.

 -Stut

 --
 http://stut.net/


Stut you made my day!  Thanks! :D

I tried the IMAP stuff with Mail.app and Thunderbird, but I didn't
really like it.  It always seemed to hiccup and act slow randomly
which just got on my nerves.  I still keep it around for when I need
to use GPG though.

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



[PHP] Re: RE : [PHP] 128M need in PHP5.2.5 instead of 8M in PHP5.1.4!

2008-01-24 Thread Eric Butera
On Jan 24, 2008 11:14 AM, Luc Maltier [EMAIL PROTECTED] wrote:

 Thanks for this clue (ini_set). But I normally don't need this amount of
 memory anywhere, as 8M were OK in PHP5.1.4... I just want to understand what
 happens.



Memory limit wasn't force enabled before 5.2.1.  Maybe that was it?

http://www.php.net/ChangeLog-5.php#5.2.1

Version 5.2.1

08-Feb-2007
Added CURLOPT_TCP_NODELAY constant to Curl extension. (Sara)
Added support for hex numbers of any size. (Matt)
Added function stream_socket_shutdown(). It is a wrapper for system
shutdown() function, that shut downs part of a full-duplex connection.
(Dmitry)
Added internal heap protection (Dmitry)
memory-limit is always enabled (--enable-memory-limit removed)

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



Re: [PHP] 128M need in PHP5.2.5 instead of 8M in PHP5.1.4!

2008-01-24 Thread Sancar Saran
On Thursday 24 January 2008 17:44:03 Luc Maltier wrote:
 Hello!

 My first message:

 I've just updated PHP from 5.1.4 to 5.2.5 (to solve an Apache problem when
 double-clicking on links). This was successful, as the problem is now
 solved, but I now, sometimes, get a message stating that the memory is
 exhausted. I modififed php.ini and set memory_limit to 16M (instead of 8M
 with PHP5.1.4), then 32M, then 64M, with the same message. With 128M, it
 works. Can this change in memory required be considered as normal? I don't
 think so... Is there any explanation?

If you are used data which serialized by older versions this may lead memory 
leaks.

Remove all caches etc then try.

Sancar

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



Re: [PHP] RE : [PHP] 128M need in PHP5.2.5 instead of 8M in PHP5.1.4!

2008-01-24 Thread Richard Lynch
On Thu, January 24, 2008 10:14 am, Luc Maltier wrote:
 Thanks for this clue (ini_set). But I normally don't need this amount
 of
 memory anywhere, as 8M were OK in PHP5.1.4... I just want to
 understand what
 happens.

PHP RAM needs shouldn't jump from 8M to 128M in a minor version change...

Something is not adding up here...

8M to 16M, sure, but not to 128M...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] if

2008-01-24 Thread Richard Lynch
On Thu, January 24, 2008 9:39 am, Pastor Steve wrote:
 Greetings,

 Can anyone point me in the right direction on this?

 I want a link to an image that appears below the link after it is
 clicked. I
 think it would be an ³if² statement, but I am not sure where to start.


What you describe sounds to me like something happening in the
BROWSER, which would be Javascript/CSS and HTML, with no PHP
nvolved...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



[PHP] Assistance needed with mysql query to achieve this php5

2008-01-24 Thread Don Don
Hi all I have a table below

CREATE TABLE `friends` (
  `id` int(11) NOT NULL auto_increment,
  `member_id` int(11) NOT NULL,
  `member` varchar(32) NOT NULL,
  `friendwith` varchar(32) NOT NULL,
  `friendWithId` int(11) NOT NULL,
  `status` varchar(32) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=49 ;


I run the following query to get my friends

SELECT fc.friendWithId, fc.friendWith, uu.image_path, uu.first_name, 
uu.last_name, uu.city, uu.gender, uu.relationship_status, uu.last_login FROM 
friends fc JOIN users uu ON fc.friendWithId = uu.user_id WHERE member_id = '%s' 
AND member = '%s' and fc.status='active'

I need help on how to modify the sql query so that it not only displays people 
who am friends with but  should also display people who are friends with me

What i currently have is a one way relationship, I am trying to modify the 
query to create a two way relationship.

Cheers

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

Re: [PHP] Verification number

2008-01-24 Thread Richard Lynch
On Thu, January 24, 2008 5:37 am, Emil Edeholt wrote:
 Sorry if this is considered off topic. Please ignore the post in that
 case.

 My site uses ten digit numbers as ID:s for our products. I would like
 the last digit to be a verification/check digit. I was just about to
 just make some simple function that would add the other values
 together
 into a one digit verification digit. But I thought maybe there are
 better or worse ways of doing this, since some algorithms probably
 produce a more even distribution of verification digits than others
 do.
 I.e. it would be a shame if I later on notice that half of my ID:s get
 9 as verification.

 Any ideas?

If you are generating the other 9 digits with an even distribution,
the check-sum digit will also be even distribution.

There's no rocket science here; Just basic arithmetic. :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



[PHP] Re: 128M need in PHP5.2.5 instead of 8M in PHP5.1.4!

2008-01-24 Thread Nathan Rixham
RE: the second apache issue, you only did a restart; you need to do a 
force-reload to properly unload and reload apache2; as such you didn't 
actually restart until the stop/start.


On a side note, can I suggest you uninstall all versions of php5 then 
re-install again and see if the issues resolve themselves..


Many Regards

Nathan

Luc Maltier wrote:

Hello!
 
My first message:
 
I've just updated PHP from 5.1.4 to 5.2.5 (to solve an Apache problem when

double-clicking on links). This was successful, as the problem is now
solved, but I now, sometimes, get a message stating that the memory is
exhausted. I modififed php.ini and set memory_limit to 16M (instead of 8M
with PHP5.1.4), then 32M, then 64M, with the same message. With 128M, it
works. Can this change in memory required be considered as normal? I don't
think so... Is there any explanation?
 
Details:

- Platform: Windows.
- I used Windows binaries (no C compiler available). The part causing the
error uses jpgraph (for generating .png files) and the png files are used
when generating a PDF file (by the tcpdf library) (the gd extension is
used).
 
A second issue with this release: When I made the tests decribed above, I

used 'restart' to restart the Apache server, with no error message. When I
tried to stop Apache and start it again, I got an error message stating that
the zend_unmangle_property_name_ex entry  cannot be found in php5ts.dll, and
I now get this message each time I restart Apache (Apache2.2),. But it seems
that Apache works normally nonetheless. I made sure that the php5ts.dll used
is the right version for 5.2.5. Any idea?
 
Thanks for any suggestion!




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



Re: [PHP] (Slightly OT) are email address could be spammed

2008-01-24 Thread Tom Chubb
On 24/01/2008, Stut [EMAIL PROTECTED] wrote:


 On 24 Jan 2008, at 15:42, Eric Butera wrote:
  I used to be hardcore pop only but now that I use gmail I don't care
  about any other mail client.  It beats Thunderbird and Mail.app hands
  down.  If you don't look at the right hand side you won't see the ads.
  :)  I even have it set up now to pull my pop mail account and slap it
  in a filter.  Plus I enjoy all the people complaining about how users
  shouldn't change the subject.  The gmail thread grouping takes care of
  all that for me. :D  The only real downside is you can't view the raw
  source of messages or get the headers.

 Top-right of any message, the down arrow next to the Reply link,
 select Show Original... voila, the raw message complete with all
 headers.

 I'm almost exclusively using Google Apps for all my mail (just a
 couple of accounts left to move), and nothing much has changed about
 what I do. I still have the choice between Thunderbird (IMAP) or
 Webmail (Gmail), and I still have a complete archive of all my mail
 since 1996. I have no complaints at all.

 -Stut

 --
 http://stut.net/

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


Has anyone found a way of getting Gmail to download from your pop mailbox
every time you click refresh instead of going to accounts  check mail?
Sometimes it doesn't check it for up to an hour!


Re: [PHP] forms and php

2008-01-24 Thread Richard Lynch
Some older browsers didn't send along the button name/value when you
hit enter, for a one-button form...

But I've never heard of one that failed to send anything at all...

It's almost for sure a browser issue though -- PHP doesn't really *do*
anything with the data it gets.

It just stuffs it into $_POST / $_GET

Ah.

Did you remember to use method=post in your FORM tag?... :-)

On Thu, January 24, 2008 2:34 am, Mark Pashia wrote:
 I am fairly new to the php/mySQL combo and just noticed an unusual
 behavior
 and don't know where to find the answer to fix this. It is probably
 common
 knowledge, but not to a newbie.



 If I fill in the fields of a form and hit the enter key to submit
 the
 form, no variables seem to be passed along. If I use the submit
 button,
 everything works perfectly. It seems that other forms on the web work
 with
 the enter key just fine, so I am probably doing something to cause
 this yet
 I don't know what.



 I am hosted at hostgator.com and it has php version 4.4.4 and mySQL
 version
 4.1.22-standard.



 Thanks, Mark Pashia




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Using mysql_real_escape_string without connecting to mysql

2008-01-24 Thread Richard Lynch
On Wed, January 23, 2008 11:28 pm, Dotan Cohen wrote:
 In
 other words, mysql_real_escape_string itself is safe from SQL
 injection?

Yes.

That is the entire purpose of the existence of that function in the
first place.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] are email address could be spammed

2008-01-24 Thread Daniel Brown
On Jan 24, 2008 10:42 AM, Eric Butera [EMAIL PROTECTED] wrote:
 I used to be hardcore pop only but now that I use gmail I don't care
 about any other mail client.  It beats Thunderbird and Mail.app hands
 down.  If you don't look at the right hand side you won't see the ads.
 :)  I even have it set up now to pull my pop mail account and slap it
 in a filter.  Plus I enjoy all the people complaining about how users
 shouldn't change the subject.  The gmail thread grouping takes care of
 all that for me. :D  The only real downside is you can't view the raw
 source of messages or get the headers.

At the top-right of each message is a little downward-pointing
arrow (next to the Reply button).  Click that, and then you click
Show Original to view all of the headers.

I actually don't see the same threading in Gmail.  If a subject is
changed, for whatever reason, my Gmail sees it as a new thread - even
just with `Re:` appended to it.  No clue why.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since
Nineteen-Seventy-[mumble].

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



Re: [PHP] Using mysql_real_escape_string without connecting to mysql

2008-01-24 Thread Richard Lynch
On Thu, January 24, 2008 10:01 am, Dotan Cohen wrote:
 On 24/01/2008, Jochem Maas [EMAIL PROTECTED] wrote:
  Which basically is the same as a simple mysql_real_escape_string?
 In
  other words, mysql_real_escape_string itself is safe from SQL
  injection?

 not exactly - it assumes you will use the value as a quoted string
 in a query.

 $s = clean_mysql(foo -- bar ; ' qux)
 $q = INSERT INTO foo (bar) VALUES ('$s');

 Ah, we've gotten to the meat. So long as there as single quotes around
 the data that has gone through mysql_real_escape_string there is no
 danger of SQL injection? So this is safe:
 mysql_query(
 INSERT INTO
 foo (bar)
 VALUES (
 '.mysql_real_escape_string($evilString).'
 ));

It is safe from SQL injection.

It is NOT safe from, say, XSS attack if $evilString contains an XSS
snippet and you re-display it on your site.

In other words, you should still filter the INPUT somewhere; But you
are escaping the output to MySQL so that it is not going to execute
arbitrary SQL on your DB server.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] are email address could be spammed

2008-01-24 Thread bruce
also...

for gmail, as far as i can tell.. you can't do a resend on a sent email...
ie, get the email you sent, reedit it, and resend it..

peace..


-Original Message-
From: Daniel Brown [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 24, 2008 9:51 AM
To: Eric Butera
Cc: Nathan Nobbe; Jochem Maas; clive; PHP LIST
Subject: Re: [PHP] are email address could be spammed


On Jan 24, 2008 10:42 AM, Eric Butera [EMAIL PROTECTED] wrote:
 I used to be hardcore pop only but now that I use gmail I don't care
 about any other mail client.  It beats Thunderbird and Mail.app hands
 down.  If you don't look at the right hand side you won't see the ads.
 :)  I even have it set up now to pull my pop mail account and slap it
 in a filter.  Plus I enjoy all the people complaining about how users
 shouldn't change the subject.  The gmail thread grouping takes care of
 all that for me. :D  The only real downside is you can't view the raw
 source of messages or get the headers.

At the top-right of each message is a little downward-pointing
arrow (next to the Reply button).  Click that, and then you click
Show Original to view all of the headers.

I actually don't see the same threading in Gmail.  If a subject is
changed, for whatever reason, my Gmail sees it as a new thread - even
just with `Re:` appended to it.  No clue why.

--
/Dan

Daniel P. Brown
Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since
Nineteen-Seventy-[mumble].

--
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] Using mysql_real_escape_string without connecting to mysql

2008-01-24 Thread Dotan Cohen
On 24/01/2008, Richard Lynch [EMAIL PROTECTED] wrote:
 It is NOT safe from, say, XSS attack if $evilString contains an XSS
 snippet and you re-display it on your site.

 In other words, you should still filter the INPUT somewhere; But you
 are escaping the output to MySQL so that it is not going to execute
 arbitrary SQL on your DB server.

After I pull the info out of the database, before it goes to the
webbrowser, it goes through this:

function clean_html ($dirty) {
  $dirty=strip_tags($dirty);
  $clean=htmlentities($dirty);
  return $clean;
}

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


Re: [PHP] including files outside of document root

2008-01-24 Thread Jason Pruim


On Jan 23, 2008, at 4:43 PM, Daniel Brown wrote:


On Jan 23, 2008 4:19 PM, Jason Pruim [EMAIL PROTECTED] wrote:

Okay, so I have this mostly working now! if I put my
ini_set(include_path, blah/to/balh); on each and every page. I
know I could include a file that is in the document root which
specified that, but I was wondering if I was missing something?
Obviously other then changing the php.ini file?


   You do know you can set overrides for PHP in .htaccess, or even
have a whole php.ini file in the directory in which you're working,
right?


Holy frickin' crap I had never even thought about it, but it works  
great! it also helps to make the app more portable because I can set  
the include path in there so that they don't have to change it


You just made my life so much earlier! Thank you!





   You can either set `php_flag include_path path/to/blah` in
.htaccess (without the backticks, of course), or you can place a
php.ini file in the same directory as the files to override the values
(if they're INI_PERDIR or similar, anyway).

--
/Dan

Daniel P. Brown
Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since
Nineteen-Seventy-[mumble].



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
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] Posting Summary for Week Ending 25 January, 2008: php-general@lists.php.net

2008-01-24 Thread Daniel Brown
On Jan 24, 2008 8:13 AM, Jay Blanchard [EMAIL PROTECTED] wrote:
 The first time we ever see all of us face to face there will have to be
 a lot of beer bought. The conversation will be interesting though.
 Several folks will ask and answer questions. I will say RTFM so many
 times that folks will quit listening to me. Then Richard will answer all
 of the questions in one long monologue. Daniel will then recap. Some
 fool will ask a MySQL question at which point we will all point to
 another room and advise them to get their answer there, either that or
 they will have to buy the next round. A fist fight will occur when
 someone provides an answer to a question that hasn't been asked. The
 phrase curly braces, schmurley braces will be heard. And someone will
 no doubt ask everyone else to speak up so that we can all hear the
 question or answer.

People will then be scorned for speaking with someone one-on-one,
and the person to which they were speaking will have to repeat the
conversation to the group, verbatim.  And eventually someone will ask
a question of their own during someone else's conversation, and then
when they change the subject, no one will even know what conversation
they were originally referring to.  Crayon will show up for a few
minutes, use some very big words, and then mysteriously disappear
again.  Someone new to the party will come out of the bathroom,
immediately hit the hors d'oeuvre table, and several people will scold
said person for not sanitizing his input.  Every so often, the phone
will ring, and it will be someone asking a one-off question from one
of the neighborhood newsgroups.  Someone will be tinkering around in
the corner for a while, and then disappear to the second floor for a
short while to have a talk with the Internals department.  Then, the
worst sin of all occurs: someone top-posts in the middle of a
discussion.  That person is then brutally assaulted, argues back and
calls names, and is then never heard from again.

Then, out of nowhere, *some darn fool* will just keep saying the
same thing, over and over again, to the tune of about 93 times, once
every minute. :-\

 Maybe this is the premise for the next great novel

I'd buy it. :-D

-- 
/Dan

Daniel P. Brown
Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since
Nineteen-Seventy-[mumble].

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



Re: [PHP] Using mysql_real_escape_string without connecting to mysql

2008-01-24 Thread Eric Butera
On Jan 24, 2008 1:03 PM, Dotan Cohen [EMAIL PROTECTED] wrote:
 On 24/01/2008, Richard Lynch [EMAIL PROTECTED] wrote:
  It is NOT safe from, say, XSS attack if $evilString contains an XSS
  snippet and you re-display it on your site.
 
  In other words, you should still filter the INPUT somewhere; But you
  are escaping the output to MySQL so that it is not going to execute
  arbitrary SQL on your DB server.

 After I pull the info out of the database, before it goes to the
 webbrowser, it goes through this:

 function clean_html ($dirty) {
   $dirty=strip_tags($dirty);
   $clean=htmlentities($dirty);
   return $clean;
 }


 Dotan Cohen

 http://what-is-what.com
 http://gibberish.co.il
 א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

 A: Because it messes up the order in which people normally read text.
 Q: Why is top-posting such a bad thing?


That won't save you if you're echoing into a single quote attribute.
(ie: src='')

Like htmlspecialchars(), the optional second quote_style parameter
lets you define what will be done with 'single' and double quotes.
It takes on one of three constants with the default being ENT_COMPAT:

ENT_COMPAT  Will convert double-quotes and leave single-quotes alone.


You might want to just use: htmlspecialchars($string, ENT_QUOTES);


Re: [PHP] including files outside of document root

2008-01-24 Thread Daniel Brown
On Jan 24, 2008 1:05 PM, Jason Pruim [EMAIL PROTECTED] wrote:

 You just made my life so much earlier! Thank you!

Yes, you guessed it.  I am your father.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since
Nineteen-Seventy-[mumble].

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



Re: [PHP] Posting Summary for Week Ending 25 January, 2008: php-general@lists.php.net

2008-01-24 Thread Andrew Ballard
On Jan 24, 2008 1:11 PM, Daniel Brown [EMAIL PROTECTED] wrote:
 On Jan 24, 2008 8:13 AM, Jay Blanchard [EMAIL PROTECTED] wrote:
  The first time we ever see all of us face to face there will have to be
  a lot of beer bought. The conversation will be interesting though.
  Several folks will ask and answer questions. I will say RTFM so many
  times that folks will quit listening to me. Then Richard will answer all
  of the questions in one long monologue. Daniel will then recap. Some
  fool will ask a MySQL question at which point we will all point to
  another room and advise them to get their answer there, either that or
  they will have to buy the next round. A fist fight will occur when
  someone provides an answer to a question that hasn't been asked. The
  phrase curly braces, schmurley braces will be heard. And someone will
  no doubt ask everyone else to speak up so that we can all hear the
  question or answer.

 People will then be scorned for speaking with someone one-on-one,
 and the person to which they were speaking will have to repeat the
 conversation to the group, verbatim.  And eventually someone will ask
 a question of their own during someone else's conversation, and then
 when they change the subject, no one will even know what conversation
 they were originally referring to.  Crayon will show up for a few
 minutes, use some very big words, and then mysteriously disappear
 again.  Someone new to the party will come out of the bathroom,
 immediately hit the hors d'oeuvre table, and several people will scold
 said person for not sanitizing his input.  Every so often, the phone
 will ring, and it will be someone asking a one-off question from one
 of the neighborhood newsgroups.  Someone will be tinkering around in
 the corner for a while, and then disappear to the second floor for a
 short while to have a talk with the Internals department.  Then, the
 worst sin of all occurs: someone top-posts in the middle of a
 discussion.  That person is then brutally assaulted, argues back and
 calls names, and is then never heard from again.

 Then, out of nowhere, *some darn fool* will just keep saying the
 same thing, over and over again, to the tune of about 93 times, once
 every minute. :-\

  Maybe this is the premise for the next great novel

 I'd buy it. :-D

 --
 /Dan

 Daniel P. Brown
 Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since
 Nineteen-Seventy-[mumble].


And then periodically Dan will stand up in the middle of the room and
tell everyone how many times each person has spoken since his last
count. This will, of course, prompt someone in the back of the room to
complain because he didn't want anyone to know he was even in the room
in the first place. :-D

Andrew

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



RE: [PHP] Verification number

2008-01-24 Thread Bastien Koert

google mod10 checksum
 
bastien
 Date: Thu, 24 Jan 2008 12:37:20 +0100 From: [EMAIL PROTECTED] To: 
 php-general@lists.php.net Subject: [PHP] Verification number  Hi  Sorry 
 if this is considered off topic. Please ignore the post in that case.  My 
 site uses ten digit numbers as ID:s for our products. I would like  the last 
 digit to be a verification/check digit. I was just about to  just make some 
 simple function that would add the other values together  into a one digit 
 verification digit. But I thought maybe there are  better or worse ways of 
 doing this, since some algorithms probably  produce a more even distribution 
 of verification digits than others do.  I.e. it would be a shame if I later 
 on notice that half of my ID:s get  9 as verification.  Any ideas?  
 Regards Emil  --  PHP General Mailing List (http://www.php.net/) To 
 unsubscribe, visit: http://www.php.net/unsub.php 
_



[PHP] Question about functions

2008-01-24 Thread Jason Pruim

Hi everyone!

So, I'm trying to learn about functions, and I think I understand what  
to use them for... And one of the ideas I had was to write a function  
to logout of an application. The question I have though, is how do I  
call it?


Right now I just have a link like this: A href=logout.phpClick  
here to logout/A  Can I do the same thing with a function? And if  
so, then maybe I don't really understand functions like I thought I  
did... Because to me, that would look like it would be just the same  
as calling a single script to logout vs. a function?

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
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] Question about functions

2008-01-24 Thread Stut

On 24 Jan 2008, at 20:00, Jason Pruim wrote:
So, I'm trying to learn about functions, and I think I understand  
what to use them for... And one of the ideas I had was to write a  
function to logout of an application. The question I have though, is  
how do I call it?


Right now I just have a link like this: A href=logout.phpClick  
here to logout/A  Can I do the same thing with a function? And if  
so, then maybe I don't really understand functions like I thought I  
did... Because to me, that would look like it would be just the same  
as calling a single script to logout vs. a function?


Functions are internal to PHP, there is no way to address them from a  
web page.


-Stut

--
http://stut.net/

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



Re: [PHP] Question about functions

2008-01-24 Thread Dave Goodchild
Methink you're a little confused. A function is a piece of code that
performs a specific job that can be called. You may send it
data, you may not. It may return data, it may not. If your link goes to
logout.php, that script may use functions to do it's job.
You can't call a function in a link as php is server-side. What you are
thinking of is an event handler, ie client side (javascript).

Example of how you could achieve what you want:

logout.php


include 'logfunctions.php'

logout($_GET['id']);

header(Location: index.php);
exit();

logfunctions.php


function logout($id) {
 unset($id);
}

etc etc etc - crude example but pushed for time and you get the idea!


On Jan 24, 2008 8:00 PM, Jason Pruim [EMAIL PROTECTED] wrote:

 Hi everyone!

 So, I'm trying to learn about functions, and I think I understand what
 to use them for... And one of the ideas I had was to write a function
 to logout of an application. The question I have though, is how do I
 call it?

 Right now I just have a link like this: A href=logout.phpClick
 here to logout/A  Can I do the same thing with a function? And if
 so, then maybe I don't really understand functions like I thought I
 did... Because to me, that would look like it would be just the same
 as calling a single script to logout vs. a function?
 --

 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 3251 132nd ave
 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] Question about functions

2008-01-24 Thread Eric Butera
On Jan 24, 2008 3:00 PM, Jason Pruim [EMAIL PROTECTED] wrote:
 Hi everyone!

 So, I'm trying to learn about functions, and I think I understand what
 to use them for... And one of the ideas I had was to write a function
 to logout of an application. The question I have though, is how do I
 call it?

 Right now I just have a link like this: A href=logout.phpClick
 here to logout/A  Can I do the same thing with a function? And if
 so, then maybe I don't really understand functions like I thought I
 did... Because to me, that would look like it would be just the same
 as calling a single script to logout vs. a function?
 --

 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 3251 132nd ave
 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



Keep your link as is.  Create a page called logout.php.

Make it look like something like this:

?php
require_once 'functions.php';
logout();
require_once 'index.php';
?

Then functions.php:
?php
function logout() {
session_destroy(); or whatever
}
?

See the function is an idea of code to be run.  You still have to
access a function at some point and run it.  The point though is that
you call the function instead of having tons of code just littering up
your page.  It makes the logic flow of your scripts easier to
understand.

Another example would be a form processing page.  You could do something like

if (my_uber_form_processor() !== true) {
require_once 'form.php';
exit();
}

require_once 'success.php';

This way you keep the logic of how your pages work separate from the
gritty details of what form processing is or how you log out.  This is
a oversimplification, but hopefully it might make something in your
head click.

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



Re: [PHP] Question about functions

2008-01-24 Thread Eric Butera
On Jan 24, 2008 3:08 PM, Dave Goodchild [EMAIL PROTECTED] wrote:
 header(Location: index.php);

Redirect uri's should be absolute.

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



Re: [PHP] Question about functions

2008-01-24 Thread Dave Goodchild
Said it was a crude example and I was pushed for time

On Jan 24, 2008 8:13 PM, Eric Butera [EMAIL PROTECTED] wrote:

 On Jan 24, 2008 3:08 PM, Dave Goodchild [EMAIL PROTECTED] wrote:
  header(Location: index.php);

 Redirect uri's should be absolute.



[PHP] Re: Question about functions

2008-01-24 Thread Nathan Rixham

Jason Pruim wrote:

Hi everyone!

So, I'm trying to learn about functions, and I think I understand what 
to use them for... And one of the ideas I had was to write a function to 
logout of an application. The question I have though, is how do I call it?


Right now I just have a link like this: A href=logout.phpClick here 
to logout/A  Can I do the same thing with a function? And if so, then 
maybe I don't really understand functions like I thought I did... 
Because to me, that would look like it would be just the same as calling 
a single script to logout vs. a function?

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]


Functions basically save you repeating code; for example, let's say we 
have these lines of code in 10 scripts on our website:


if(isset($_GET['pageid'])  trim($_GET['pageid'])) {
 $pageid = trim($_GET['pageid']);
} else {
 $pageid = '1';
}

you could wrap this code up in a function as such:

function get_pageid() {
 if(isset($_GET['pageid'])  trim($_GET['pageid'])) {
  $pageid = trim($_GET['pageid']);
 } else {
  $pageid = '1';
 }
 return $pageid;
}

save that function (along with other functions you've made) in an php 
file (example: myfunctions.php)


then in every script we simply include our functions file and call our 
function(s) as and when we need them:


scripta.php:
?php
include 'myfunctions.php';
$pageid = get_pageid();
//more code
?

I'm no technical writer but I think that about sums it up.

Nathan

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



[PHP] Rename

2008-01-24 Thread Pastor Steve
Does anyone know if there is a way to move all the files in one directory
into another?

Thanks,

--
Steve M.


Re: [PHP] Rename

2008-01-24 Thread Pastor Steve
I have been looking, but the problem is that I don¹t know what questions to
ask or what to look for. I think it is a rename function. That works, but it
only does one file at a time. I was looking for something that will do all
the files in the directory without needing to know the name of each file.

I couldn¹t find anything like that there.

Thanks,

--
Steve M.

on 1/24/08 2:46 PM [EMAIL PROTECTED]
([EMAIL PROTECTED]) wrote:

 i believe you will find what you're looking for by searching or
 browsing the documentation found at:
 
   http://www.php.net/manual/en/
 
 
- Rick
 
 
  Original Message 
  Date: Thursday, January 24, 2008 02:36:55 PM -0600
  From: Pastor Steve [EMAIL PROTECTED]
  To: PHP eMail List php-general@lists.php.net
  Subject: [PHP] Rename
  
  Does anyone know if there is a way to move all the files in one
  directory into another?
  
  Thanks,
  
  --
  Steve M.
 
 -- End Original Message --
 




Re: [PHP] Rename

2008-01-24 Thread Nathan Nobbe
On Jan 24, 2008 3:51 PM, Pastor Steve [EMAIL PROTECTED] wrote:

 I have been looking, but the problem is that I don¹t know what questions
 to
 ask or what to look for. I think it is a rename function. That works, but
 it
 only does one file at a time. I was looking for something that will do all
 the files in the directory without needing to know the name of each file.

 I couldn¹t find anything like that there.


use opendir() to get a list of files in the source directory.
use  readdir() to iterate over the list of files in that directory.
then within that loop you can call the rename() function on
each value.

-nathan


Re: [PHP] Rename

2008-01-24 Thread Nathan Nobbe
here a simple little cli script that has the guts of what youre
trying to accomplish.
NOTE: this is not a comprehensive solution :)

?php
$srcDir = $argv[1];
$destDir = $argv[2];

if(is_dir($srcDir)  is_dir($destDir)) {
$dirHandle = opendir($srcDir);
while($curFile = readdir($dirHandle)) {
if(empty($curFile) || $curFile == '.' || $curFile == '..') {
continue;
}
rename($srcDir/$curFile, $destDir/$curFile);
}
}
?

-nathan


Re: [PHP] Rename

2008-01-24 Thread Al

First get an array of all the files, e.g.,

$fpDir is the full path to yiour dir.

foreach(glob($fpDir*.*) as $file)
{

$filesArray[] = $file;
}

print_r($filesArray); //so you can see what's happening

Then do a:

foreach($filesArray as $file){

rename($sourceDir.$file, $destDir. $file);
}

This is just an outline.  All the paths should be full.

Once you get this working, you can put the rename() in the first foreach() loop. 
  Don't forget to take care of exceptions.


Pastor Steve wrote:

I have been looking, but the problem is that I don¹t know what questions to
ask or what to look for. I think it is a rename function. That works, but it
only does one file at a time. I was looking for something that will do all
the files in the directory without needing to know the name of each file.

I couldn¹t find anything like that there.

Thanks,

--
Steve M.

on 1/24/08 2:46 PM [EMAIL PROTECTED]
([EMAIL PROTECTED]) wrote:


i believe you will find what you're looking for by searching or
browsing the documentation found at:

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


   - Rick


 Original Message 

Date: Thursday, January 24, 2008 02:36:55 PM -0600
From: Pastor Steve [EMAIL PROTECTED]
To: PHP eMail List php-general@lists.php.net
Subject: [PHP] Rename

Does anyone know if there is a way to move all the files in one
directory into another?

Thanks,

--
Steve M.

-- End Original Message --







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



Re: [PHP] Rename

2008-01-24 Thread Robert Cummings

On Thu, 2008-01-24 at 16:18 -0500, Al wrote:
 First get an array of all the files, e.g.,

That's useful for debugging, but once you know what you're doing, it's a
waste of resources to accumulate the array unless you have a good reason
for doing so :)

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



[PHP] PHP and LDAP Authentication

2008-01-24 Thread Sutton, John
Hello,

I have encountered a situation where a user password
Contains a space in it (in the middle). I am looking for
A way to send that password through ldap_bind()
Correctly. So far no luck.

Can you give me any suggestions?

John J. Sutton
Sr. Programmer/Analyst
371-4872 (office)
773-4550 (cell)



RE: [PHP] Rename

2008-01-24 Thread Bastien Koert

http://ca3.php.net/manual/en/function.copy.php
 
make the manual your friend
 
bastien Date: Thu, 24 Jan 2008 14:36:55 -0600 From: [EMAIL PROTECTED] To: 
php-general@lists.php.net Subject: [PHP] Rename  Does anyone know if there 
is a way to move all the files in one directory into another?  Thanks,  
-- Steve M.
_



Re: [PHP] Using mysql_real_escape_string without connecting to mysql

2008-01-24 Thread Dotan Cohen
On 24/01/2008, Eric Butera [EMAIL PROTECTED] wrote:
 That won't save you if you're echoing into a single quote attribute.
 (ie: src='')

Even after I've stripped away the tags with strip_tags()?

 Like htmlspecialchars(), the optional second quote_style parameter
 lets you define what will be done with 'single' and double quotes.
 It takes on one of three constants with the default being ENT_COMPAT:

 ENT_COMPAT  Will convert double-quotes and leave single-quotes alone.


 You might want to just use: htmlspecialchars($string, ENT_QUOTES);

I'm heading over to the manpage to look at that now, thanks.

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


RE: [PHP] PHP and LDAP Authentication

2008-01-24 Thread Bastien Koert

htmlentities?
 
urlencode?
 
 
bastien Date: Thu, 24 Jan 2008 15:20:44 -0600 From: [EMAIL PROTECTED] To: 
php-general@lists.php.net Subject: [PHP] PHP and LDAP Authentication  
Hello,  I have encountered a situation where a user password Contains a 
space in it (in the middle). I am looking for A way to send that password 
through ldap_bind() Correctly. So far no luck.  Can you give me any 
suggestions?  John J. Sutton Sr. Programmer/Analyst 371-4872 (office) 
773-4550 (cell) 
_



Re: [PHP] Rename

2008-01-24 Thread Nathan Nobbe
On Jan 24, 2008 4:42 PM, Bastien Koert [EMAIL PROTECTED] wrote:

 http://ca3.php.net/manual/en/function.copy.php

 make the manual your friend


rename() is much more efficient; since the original files will
have to be deleted as well, with a copy approach.
and i suspect rename() atomic as well.

-nathan


[PHP] Sql support

2008-01-24 Thread mattias
I try to add php-support to my php installation on windows 2000 server
Can someone check my phpinfo.php?
http://mjw.se/phpinfo.php

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



Re: [PHP] Using mysql_real_escape_string without connecting to mysql

2008-01-24 Thread Richard Lynch
On Thu, January 24, 2008 12:03 pm, Dotan Cohen wrote:
 On 24/01/2008, Richard Lynch [EMAIL PROTECTED] wrote:
 It is NOT safe from, say, XSS attack if $evilString contains an XSS
 snippet and you re-display it on your site.

 In other words, you should still filter the INPUT somewhere; But you
 are escaping the output to MySQL so that it is not going to execute
 arbitrary SQL on your DB server.

 After I pull the info out of the database, before it goes to the
 webbrowser, it goes through this:

 function clean_html ($dirty) {
   $dirty=strip_tags($dirty);

The strip_tags should probably have been done before it ever went into
the database, as part of INPUT FILTERING rather than escaping
output...

   $clean=htmlentities($dirty);
   return $clean;
 }

 Dotan Cohen

 http://what-is-what.com
 http://gibberish.co.il
 א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-×
-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

 A: Because it messes up the order in which people normally read text.
 Q: Why is top-posting such a bad thing?



-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Assistance needed with mysql query to achieve this php5

2008-01-24 Thread Richard Lynch
Just take out member_id = '%s' and use friendWIthId = '%s' instead.

Actually, I think you may need to swap member/friendwith as well...

But why you are storing everybody's NAME twice is beyond me...

Or maybe I'm guessing wrongly what the fields are...

On Thu, January 24, 2008 10:49 am, Don Don wrote:
 Hi all I have a table below

 CREATE TABLE `friends` (
   `id` int(11) NOT NULL auto_increment,
   `member_id` int(11) NOT NULL,
   `member` varchar(32) NOT NULL,
   `friendwith` varchar(32) NOT NULL,
   `friendWithId` int(11) NOT NULL,
   `status` varchar(32) NOT NULL,
   PRIMARY KEY  (`id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=49 ;


 I run the following query to get my friends

 SELECT fc.friendWithId, fc.friendWith, uu.image_path, uu.first_name,
 uu.last_name, uu.city, uu.gender, uu.relationship_status,
 uu.last_login FROM friends fc JOIN users uu ON fc.friendWithId =
 uu.user_id WHERE member_id = '%s' AND member = '%s' and
 fc.status='active'

 I need help on how to modify the sql query so that it not only
 displays people who am friends with but  should also display people
 who are friends with me

 What i currently have is a one way relationship, I am trying to modify
 the query to create a two way relationship.

 Cheers


 -
 Be a better friend, newshound, and know-it-all with Yahoo! Mobile.
 Try it now.


-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Rename

2008-01-24 Thread Al
You obviously missed my last sentence. Once you get this working, you can put 
the rename() in the first foreach() loop.   Don't forget to take care of 
exceptions. 


Robert Cummings wrote:

On Thu, 2008-01-24 at 16:18 -0500, Al wrote:

First get an array of all the files, e.g.,


That's useful for debugging, but once you know what you're doing, it's a
waste of resources to accumulate the array unless you have a good reason
for doing so :)

Cheers,
Rob.


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



Re: [PHP] Sql support

2008-01-24 Thread Chris

mattias wrote:

I try to add php-support to my php installation on windows 2000 server


Eh?

What sort of support are you trying to add?

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

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



Re: [PHP] Using mysql_real_escape_string without connecting to mysql

2008-01-24 Thread Jim Lucas

Richard Lynch wrote:

On Thu, January 24, 2008 12:03 pm, Dotan Cohen wrote:

On 24/01/2008, Richard Lynch [EMAIL PROTECTED] wrote:

It is NOT safe from, say, XSS attack if $evilString contains an XSS
snippet and you re-display it on your site.

In other words, you should still filter the INPUT somewhere; But you
are escaping the output to MySQL so that it is not going to execute
arbitrary SQL on your DB server.

After I pull the info out of the database, before it goes to the
webbrowser, it goes through this:

function clean_html ($dirty) {
  $dirty=strip_tags($dirty);


The strip_tags should probably have been done before it ever went into
the database, as part of INPUT FILTERING rather than escaping
output...



That should be considered part of the DRY method.  But spanning page 
requests.


I cannot see any reason why you shouldn't be doing this before you 
insert this information into your DB.  Doing it once on your insert, 
instead of every single page request would seen to me a much better use 
of resources.


If you are needing to have the tags in the DB, what I would do is have 
add second column in your DB.  One that contains the clean version and 
one that contains the marked up version.  Then you are not doing so much 
work on each page load, and you are able to retain the marked up version 
for editing ( i assume )



  $clean=htmlentities($dirty);
  return $clean;
}

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-×’-ד-×”-ו-×–-×—-ט-×™-ך-×›-ל-ם-מ-ן-×

-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?







--
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] Using mysql_real_escape_string without connecting to mysql

2008-01-24 Thread Dotan Cohen
On 25/01/2008, Jim Lucas [EMAIL PROTECTED] wrote:
 That should be considered part of the DRY method.  But spanning page
 requests.

 I cannot see any reason why you shouldn't be doing this before you
 insert this information into your DB.  Doing it once on your insert,
 instead of every single page request would seen to me a much better use
 of resources.

 If you are needing to have the tags in the DB, what I would do is have
 add second column in your DB.  One that contains the clean version and
 one that contains the marked up version.  Then you are not doing so much
 work on each page load, and you are able to retain the marked up version
 for editing ( i assume )

I will do as you suggest here, as disk space is cheaper than processor
time. Thanks.

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


SV: [PHP] Sql support

2008-01-24 Thread mattias
oops sorry
i meen sql

-Ursprungligt meddelande-
Från: Chris [mailto:[EMAIL PROTECTED]
Skickat: den 25 januari 2008 00:06
Till: mattias
Kopia: php-general@lists.php.net
Ämne: Re: [PHP] Sql support


mattias wrote:
 I try to add php-support to my php installation on windows 2000 server

Eh?

What sort of support are you trying to add?

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

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



[PHP] pack it in

2008-01-24 Thread Jochem Maas

someone asked about checksum values in another thread, I believe
he got his answer no thanks to me. but whilst I was trying to help
I got stuck playing with pack/unpack.

so now I have the broadbrush question of what would one use
pack/unpack for? can anyone point at some realworld examples/code that
might help me broaden my horizons?

rds,
jochem

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



Re: [PHP] pack it in

2008-01-24 Thread Nathan Nobbe
On Jan 24, 2008 6:20 PM, Jochem Maas [EMAIL PROTECTED] wrote:

 someone asked about checksum values in another thread, I believe
 he got his answer no thanks to me. but whilst I was trying to help
 I got stuck playing with pack/unpack.

 so now I have the broadbrush question of what would one use
 pack/unpack for? can anyone point at some realworld examples/code that
 might help me broaden my horizons?


here is an awesome one.
so for ldap, you have to ensure data meets a specific 'format' for
all the different 'syntax'es it supports.  these are each represented
by a particular syntax oid, and the syntax is written in backus noir form.
i wish i could say its reasonable to cipher out the syntax of those things,
but then id be lying; at least for me, i struggle .. =/
anyways; for the password field, you have to supply ldap an appropriate
syntax.
the field has this syntax oid
1.3.6.1.4.1.1466.115.121.1.40
which is described as an Octet String.
in order to get a password into ldap, i had to use the following
$attrs['userPassword'] = '{MD5}' . base64_encode(pack('H*', $userPassword));

per this article:
http://logout.sh/computers/ldap/

-nathan


[PHP] Looking for easier way to build email message

2008-01-24 Thread Rene Brehmer
Drew a blank off the archive, so here goes...

I'm working on some forms for our company website, all of which simply have
to be mailed to us by email.

After verifying that the content of all the fields is valid and the proper
type, it builds the email message as following. This all works great, but I
want a simpler/easier way to reuse the code (we have 3 forms, with
distinctively different content, but the mail process remains the same), so
something that will do the below, but can be reduced to something like
grabbing a text file and fill in the blanks would be nice, instead of this:

  // prepare message
  if(! $error) {
$message = Information submitted with Tee Time booking form:\r\n;
$message .= Name and address:\r\n\r\n;
$message .= $name\r\n;
$message .= $address\r\n;
$message .= $city\r\n;
$message .= $state $postcode\r\n\r\n;
$message .= Email: $email\r\n;
$message .= Phone: $phone\r\n;
$message .= \r\n\r\nBooking info:\r\n\r\n;
$message .= Arrival: $a_month $a_day\r\n;
$message .= Departure: $d_month $d_day\r\n;
$message .= Persons: $persons\r\n;
$message .= Rooms: $rooms\r\n;
$message .= \r\nGolf Courses\r\n\r\n;
for($i = 1; $i  8; $i++) {
  if($_POST['course_'.$i] != 0) {
$message .= 'Course: '.$_POST['course_'.$i].\r\n;
$message .= 'Date: '.$_POST['month_'.$i].'
'.$_POST['day_'.$i].\r\n;
$message .= 'Time: '.$_POST['teetime_'.$i].\r\n;
$message .= '# of golfers: '.$_POST['golfers_'.$i].\r\n;
  }
}
if(! empty($comments)) {
  $message .= \r\nComments:\r\n$comments\r\n;
}
$message .= \r\nUser Client Info:\r\n;
$message .= 'User IP: '.$_SERVER['REMOTE_ADDR'].\r\nUser agent:
.$_SERVER['HTTP_USER_AGENT'].\r\n\r\n;


// NOTE: This code only builds the actual message, the headers are built
elsewhere in the code.
// This is our golf-package quote request (I work for a hotel) form, where
you can book up to 7 tee times. Thus the iteration in the middle, to run
through the 7 tee time fields.

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



Re: [PHP] Looking for easier way to build email message

2008-01-24 Thread Nathan Nobbe
On Jan 24, 2008 6:20 PM, Rene Brehmer [EMAIL PROTECTED] wrote:

 Drew a blank off the archive, so here goes...

 I'm working on some forms for our company website, all of which simply
 have
 to be mailed to us by email.

 After verifying that the content of all the fields is valid and the proper
 type, it builds the email message as following. This all works great, but
 I
 want a simpler/easier way to reuse the code (we have 3 forms, with
 distinctively different content, but the mail process remains the same),
 so
 something that will do the below, but can be reduced to something like
 grabbing a text file and fill in the blanks would be nice, instead of
 this:

  // prepare message
  if(! $error) {
$message = Information submitted with Tee Time booking form:\r\n;
$message .= Name and address:\r\n\r\n;
$message .= $name\r\n;
$message .= $address\r\n;
$message .= $city\r\n;
$message .= $state $postcode\r\n\r\n;
$message .= Email: $email\r\n;
$message .= Phone: $phone\r\n;
$message .= \r\n\r\nBooking info:\r\n\r\n;
$message .= Arrival: $a_month $a_day\r\n;
$message .= Departure: $d_month $d_day\r\n;
$message .= Persons: $persons\r\n;
$message .= Rooms: $rooms\r\n;
$message .= \r\nGolf Courses\r\n\r\n;
for($i = 1; $i  8; $i++) {
  if($_POST['course_'.$i] != 0) {
$message .= 'Course: '.$_POST['course_'.$i].\r\n;
$message .= 'Date: '.$_POST['month_'.$i].'
 '.$_POST['day_'.$i].\r\n;
$message .= 'Time: '.$_POST['teetime_'.$i].\r\n;
$message .= '# of golfers: '.$_POST['golfers_'.$i].\r\n;
  }
}
if(! empty($comments)) {
  $message .= \r\nComments:\r\n$comments\r\n;
}
$message .= \r\nUser Client Info:\r\n;
$message .= 'User IP: '.$_SERVER['REMOTE_ADDR'].\r\nUser agent:
 .$_SERVER['HTTP_USER_AGENT'].\r\n\r\n;


 // NOTE: This code only builds the actual message, the headers are built
 elsewhere in the code.
 // This is our golf-package quote request (I work for a hotel) form, where
 you can book up to 7 tee times. Thus the iteration in the middle, to run
 through the 7 tee time fields.


check the  archives for smtp vs. mail(); somebody mentioned a number of
classes available at this site:
http://www.phpclasses.org

some of them looked quite useful.

-nathan


Re: [PHP] pack it in

2008-01-24 Thread Richard Lynch
On Thu, January 24, 2008 5:20 pm, Jochem Maas wrote:
 someone asked about checksum values in another thread, I believe
 he got his answer no thanks to me. but whilst I was trying to help
 I got stuck playing with pack/unpack.

 so now I have the broadbrush question of what would one use
 pack/unpack for? can anyone point at some realworld examples/code that
 might help me broaden my horizons?

Reading a binary file with various bytes/bits that need to get
converted to integers for you to do something useful with them.

Ditty for writing said file.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: SV: [PHP] Sql support

2008-01-24 Thread Chris

mattias wrote:

oops sorry
i meen sql


You could probably access it through odbc but I can't see any other 
method available.


If you want to use the mssql_* functions the php site has info about how 
to get it going:


http://php.net/mssql

Read the comments too - it looks like there are a few hints there.

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

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



Re: [PHP] Sql support

2008-01-24 Thread Richard Lynch


On Thu, January 24, 2008 5:05 pm, Chris wrote:
 mattias wrote:
 I try to add php-support to my php installation on windows 2000
 server

 Eh?

 What sort of support are you trying to add?


The subject said Sql support so I'd guess MS SQL.

The answer being:

#1
Look at a page like this on your server: ?php phpinfo();?

#2
Find (or put) a php.ini file in the directory where PHP is looking for
it.

#3
Edit that php.ini file and un-comment the mssql.dll bit in the
extensions list.

#4
Restart the computer.
[It's Windows.  He's used to re-booting.]

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Looking for easier way to build email message

2008-01-24 Thread Richard Lynch
On Thu, January 24, 2008 5:20 pm, Rene Brehmer wrote:
 Drew a blank off the archive, so here goes...

 I'm working on some forms for our company website, all of which simply
 have
 to be mailed to us by email.

 After verifying that the content of all the fields is valid and the
 proper
 type, it builds the email message as following. This all works great,
 but I
 want a simpler/easier way to reuse the code (we have 3 forms, with
 distinctively different content, but the mail process remains the
 same), so
 something that will do the below, but can be reduced to something like
 grabbing a text file and fill in the blanks would be nice, instead of
 this:

http://php.net/faq.php

foreach($_POST as $field = $value){
  $message .= $field: ;
  if (is_array($value)){
$message .= \r\n;
foreach ($value as $f = $v){
  $message .= strrepeat( , strlen($field) + 2) . $f: $v\r\n;
}
  }
  else $message .= $value\r\n;
}

And get rid of your course_1, course_2, course_3... names and use:
name=course[1], name=course[2], name=course[3]
instead.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] pack it in

2008-01-24 Thread Jochem Maas

Richard Lynch schreef:

On Thu, January 24, 2008 5:20 pm, Jochem Maas wrote:

someone asked about checksum values in another thread, I believe
he got his answer no thanks to me. but whilst I was trying to help
I got stuck playing with pack/unpack.

so now I have the broadbrush question of what would one use
pack/unpack for? can anyone point at some realworld examples/code that
might help me broaden my horizons?


Reading a binary file with various bytes/bits that need to get
converted to integers for you to do something useful with them.


ok. that's where my brain goes to mush - all strings in php (for now)
are binary ... what's the difference between the binary strings
in php and such found in these 'binary files' that they need to be
packed/unpacked?

sorry if I'm sounding retarded ... I probably am :-/



Ditty for writing said file.



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



Re: [PHP] Looking for easier way to build email message

2008-01-24 Thread Jochem Maas

a well known easy to use wrapper is phpmailer (STW), alternatively
check out Manuel Lemos' mail related offerings at phpclasses.org (his code
is, afaict, better but also a little more involved.

Rene Brehmer schreef:

Drew a blank off the archive, so here goes...

I'm working on some forms for our company website, all of which simply have
to be mailed to us by email.

After verifying that the content of all the fields is valid and the proper
type, it builds the email message as following. This all works great, but I
want a simpler/easier way to reuse the code (we have 3 forms, with
distinctively different content, but the mail process remains the same), so
something that will do the below, but can be reduced to something like
grabbing a text file and fill in the blanks would be nice, instead of this:

  // prepare message
  if(! $error) {
$message = Information submitted with Tee Time booking form:\r\n;
$message .= Name and address:\r\n\r\n;
$message .= $name\r\n;
$message .= $address\r\n;
$message .= $city\r\n;
$message .= $state $postcode\r\n\r\n;
$message .= Email: $email\r\n;
$message .= Phone: $phone\r\n;
$message .= \r\n\r\nBooking info:\r\n\r\n;
$message .= Arrival: $a_month $a_day\r\n;
$message .= Departure: $d_month $d_day\r\n;
$message .= Persons: $persons\r\n;
$message .= Rooms: $rooms\r\n;
$message .= \r\nGolf Courses\r\n\r\n;
for($i = 1; $i  8; $i++) {
  if($_POST['course_'.$i] != 0) {
$message .= 'Course: '.$_POST['course_'.$i].\r\n;
$message .= 'Date: '.$_POST['month_'.$i].'
'.$_POST['day_'.$i].\r\n;
$message .= 'Time: '.$_POST['teetime_'.$i].\r\n;
$message .= '# of golfers: '.$_POST['golfers_'.$i].\r\n;
  }
}
if(! empty($comments)) {
  $message .= \r\nComments:\r\n$comments\r\n;
}
$message .= \r\nUser Client Info:\r\n;
$message .= 'User IP: '.$_SERVER['REMOTE_ADDR'].\r\nUser agent:
.$_SERVER['HTTP_USER_AGENT'].\r\n\r\n;


// NOTE: This code only builds the actual message, the headers are built
elsewhere in the code.
// This is our golf-package quote request (I work for a hotel) form, where
you can book up to 7 tee times. Thus the iteration in the middle, to run
through the 7 tee time fields.



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



Re: SV: SV: [PHP] Sql support

2008-01-24 Thread Chris

mattias wrote:

yes but if you check my phpinfo.php
http://mjw.se/phpinfo.php
i can't reed out if sql support are enabled


If it was there would be a big section called 'mssql' - like there is 
for odbc.


If that's not there, then no you don't have mssql support enabled.

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

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



[PHP] Re: Looking for easier way to build email message

2008-01-24 Thread Manuel Lemos
Hello,

on 01/24/2008 09:20 PM Rene Brehmer said the following:
 Drew a blank off the archive, so here goes...
 
 I'm working on some forms for our company website, all of which simply have
 to be mailed to us by email.
 
 After verifying that the content of all the fields is valid and the proper
 type, it builds the email message as following. This all works great, but I
 want a simpler/easier way to reuse the code (we have 3 forms, with
 distinctively different content, but the mail process remains the same), so
 something that will do the below, but can be reduced to something like
 grabbing a text file and fill in the blanks would be nice, instead of this:

As already been suggested by others, you may want to try the MIME
message class.

http://www.phpclasses.org/mimemessage

It seems that you want to send personalized messages to multiple
recipients. Usually you use a template and have it processed for each
recipient. The class above comes with two alternative examples for doing
that:

Using simple template string concatenation:
test_personalized_bulk_mail.php

or using Smarty templates:
test_smarty_personalized_mailing.php

-- 

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



SV: SV: [PHP] Sql support

2008-01-24 Thread mattias
yes but if you check my phpinfo.php
http://mjw.se/phpinfo.php
i can't reed out if sql support are enabled

-Ursprungligt meddelande-
Från: Chris [mailto:[EMAIL PROTECTED]
Skickat: den 25 januari 2008 01:18
Till: mattias
Kopia: php-general@lists.php.net
Ämne: Re: SV: [PHP] Sql support


mattias wrote:
 oops sorry
 i meen sql

You could probably access it through odbc but I can't see any other
method available.

If you want to use the mssql_* functions the php site has info about how
to get it going:

http://php.net/mssql

Read the comments too - it looks like there are a few hints there.

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

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



Re: [PHP] Looking for easier way to build email message

2008-01-24 Thread Eric Butera
On Jan 24, 2008 6:20 PM, Rene Brehmer [EMAIL PROTECTED] wrote:
 Drew a blank off the archive, so here goes...

 I'm working on some forms for our company website, all of which simply have
 to be mailed to us by email.

 After verifying that the content of all the fields is valid and the proper
 type, it builds the email message as following. This all works great, but I
 want a simpler/easier way to reuse the code (we have 3 forms, with
 distinctively different content, but the mail process remains the same), so
 something that will do the below, but can be reduced to something like
 grabbing a text file and fill in the blanks would be nice, instead of this:

   // prepare message
   if(! $error) {
 $message = Information submitted with Tee Time booking form:\r\n;
 $message .= Name and address:\r\n\r\n;
 $message .= $name\r\n;
 $message .= $address\r\n;
 $message .= $city\r\n;
 $message .= $state $postcode\r\n\r\n;
 $message .= Email: $email\r\n;
 $message .= Phone: $phone\r\n;
 $message .= \r\n\r\nBooking info:\r\n\r\n;
 $message .= Arrival: $a_month $a_day\r\n;
 $message .= Departure: $d_month $d_day\r\n;
 $message .= Persons: $persons\r\n;
 $message .= Rooms: $rooms\r\n;
 $message .= \r\nGolf Courses\r\n\r\n;
 for($i = 1; $i  8; $i++) {
   if($_POST['course_'.$i] != 0) {
 $message .= 'Course: '.$_POST['course_'.$i].\r\n;
 $message .= 'Date: '.$_POST['month_'.$i].'
 '.$_POST['day_'.$i].\r\n;
 $message .= 'Time: '.$_POST['teetime_'.$i].\r\n;
 $message .= '# of golfers: '.$_POST['golfers_'.$i].\r\n;
   }
 }
 if(! empty($comments)) {
   $message .= \r\nComments:\r\n$comments\r\n;
 }
 $message .= \r\nUser Client Info:\r\n;
 $message .= 'User IP: '.$_SERVER['REMOTE_ADDR'].\r\nUser agent:
 .$_SERVER['HTTP_USER_AGENT'].\r\n\r\n;


 // NOTE: This code only builds the actual message, the headers are built
 elsewhere in the code.
 // This is our golf-package quote request (I work for a hotel) form, where
 you can book up to 7 tee times. Thus the iteration in the middle, to run
 through the 7 tee time fields.

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



Check out Zend_Mail.  It changed my life. :)

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



[PHP] [EMAIL PROTECTED]

2008-01-24 Thread Marek Zdybel

-- 
Fotograf Ślubny
http://mzdybel.pl
tel. 607 825 735
gg:4203195
skype: marek.zdybel

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



Re: [PHP] Posting Summary for Week Ending 25 January, 2008: php-general@lists.php.net

2008-01-24 Thread Wolf

Jay Blanchard wrote:

[snip]

Dude, I laughed so loud that it echoed in the halls of the
Engineering Wing over here.  What makes it so funny?  That it's not
much of an exaggeration!  ;-D



very glad to raise a laugh :-) those without a sense of humour should
leave the php highway at the next exit. ;-)

oh and I'm gonna hold you to that beer one day :-)
[/snip]

The first time we ever see all of us face to face there will have to be
a lot of beer bought. The conversation will be interesting though.
Several folks will ask and answer questions. I will say RTFM so many
times that folks will quit listening to me. Then Richard will answer all
of the questions in one long monologue. Daniel will then recap. Some
fool will ask a MySQL question at which point we will all point to
another room and advise them to get their answer there, either that or
they will have to buy the next round. A fist fight will occur when
someone provides an answer to a question that hasn't been asked. The
phrase curly braces, schmurley braces will be heard. And someone will
no doubt ask everyone else to speak up so that we can all hear the
question or answer.

Maybe this is the premise for the next great novel

Until that time, how many of you are on XBOX live and playing Call Of 
Duty 4?  Or playing Eve-Online?  :)


We could make a PHP clan and when the sides get to quarreling, have a 
war amongst ourselves to settle it.


Wolf

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



Re: [PHP] pack it in

2008-01-24 Thread Nathan Nobbe
On Jan 24, 2008 7:13 PM, Jochem Maas [EMAIL PROTECTED] wrote:

 ok. that's where my brain goes to mush - all strings in php (for now)
 are binary ... what's the difference between the binary strings
 in php and such found in these 'binary files' that they need to be
 packed/unpacked?

 sorry if I'm sounding retarded ... I probably am :-/


pack() allows you to format binary data.  it can be formatted for specific
architectures as well.  formating of php stings does not take place on a
binary level, rather it occurs on a byte level, or multibyte using the
multibyte string functions
http://www.php.net/manual/en/ref.mbstring.php
here is a nice example i found from phpdig.net, that is designed to
determine whether a system is little, big, or middle endian.  (there is a
small error on the script at the actual website; ive modified it for the
post
here and sent a notice to the site regarding it).
id like to see how this could be done w/ regular php strings :)

?php
# A hex number that may represent 'abyz'
$abyz = 0x6162797A;

# Convert $abyz to a binary string containing 32 bits
# Do the conversion the way that the system architecture wants to
switch (pack ('L', $abyz)) {

# Compare the value to the same value converted in a Little-Endian
fashion
case pack ('V', $abyz):
echo 'Your system is Little-Endian.';
break;

# Compare the value to the same value converted in a Big-Endian fashion
case pack ('N', $abyz):
echo 'Your system is Big-Endian.';
break;

default:
$endian = Your system 'endian' is unknown.
. It may be some perverse Middle-Endian architecture.;
}
?

-nathan


Re: [PHP] Rename

2008-01-24 Thread Robert Cummings

On Thu, 2008-01-24 at 18:05 -0500, Al wrote:
 You obviously missed my last sentence. Once you get this working, you can 
 put 
 the rename() in the first foreach() loop.   Don't forget to take care of 
 exceptions. 

Yep, sorry :)

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



  1   2   >