OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 29 May 2008 19:09:19 -0000 Issue 5486

php-general-digest-helplists.php.net
Date: Thu May 29 2008 - 14:09:19 CDT


php-general Digest 29 May 2008 19:09:19 -0000 Issue 5486

Topics (messages 274799 through 274832):

Re: Reloading changes JS files?
        274799 by: Richard Heyes
        274801 by: Per Jessen
        274803 by: Richard Heyes
        274804 by: Per Jessen

Embed images in emails
        274800 by: Iñigo Medina García
        274816 by: Bastien Koert
        274817 by: Per Jessen
        274818 by: Shawn McKenzie
        274819 by: Richard Heyes

Escaping JavaScript strings
        274802 by: Edward Kay
        274805 by: Richard Heyes
        274807 by: Edward Kay

Re: SOLVED: Calendar Date Help
        274806 by: Mark Weaver
        274815 by: Robert Cummings
        274820 by: Mark Weaver

IMAP connection to specific directory
        274808 by: Niall Jackson

How to Using xsl with .odt files
        274809 by: Priyanka
        274811 by: Per Jessen
        274813 by: Wolf

Re: Help mms (Get audio Stream)
        274810 by: Gabriel Sosa

Re: A Little Something.
        274812 by: Michelle Konzack
        274814 by: Wolf

Problem with Object references in an array via for loop
        274821 by: David Moylan
        274822 by: Gabriel Sosa
        274823 by: David Moylan
        274824 by: Gabriel Sosa
        274825 by: David Moylan
        274826 by: Robert Cummings

preg_match_all
        274827 by: Chris W
        274828 by: Robert Cummings
        274830 by: Robert Cummings

Javascript control on Firefox 2/3 with flash 9
        274829 by: jencisson.unicoco.com
        274831 by: Wolf

form validation
        274832 by: Sudhakar

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


> <img src='/image/bulk.jpg?112344324' />
>
> anything after the question mark will get ignored by the browser. Except
> that the browser will think that it is a new URL that it has never seen
> before and it will call to the server for a fresh copy of the file.

Another options is instead of a question mark use a forward slash. This
may be Apache specific though. Eg.

<img src='/image/bulk.jpg/112344324' />

ISTR question marks are not search engine friendly, so for pages this
may be a preferred option.

--
               Richard Heyes

          In Cambridge? Employ me
         http://www.phpguru.org/cv

+----------------------------------------+
| Access SSH with a Windows mapped drive |
| http://www.phpguru.org/sftpdrive |
+----------------------------------------+

attached mail follows:


Skip Evans wrote:

> Hey all,
>
> I have an HTML template file I read into a PHP
> script and then after supplying dynamic data I
> send the template to the browser with
>
> echo $html;
>
> The HTML template contains many JS files in the
> <head>...</head> section referenced like this:
>
> <script src="ajax/players.js"
> type="text/javascript"></script>
>
> My question is this: how can I cause the JS files
> on the header.html file to be reloaded to the
> browser when ever they have been modified?

When you do an explicit "refresh" or "reload" in your browser, it should
ignore whatever it's got cached and refetch your javascript files
regardless.

/Per Jessen, Zürich

attached mail follows:


> When you do an explicit "refresh" or "reload" in your browser, it should
> ignore whatever it's got cached and refetch your javascript files
> regardless.

With Interweb Explorer you need to hold down CTRL and CLICK on refresh
(as opposed to pressing CTRL+R say) to get a fresh copy. I guess it
depends on the headers you send on the page. Doing this will send a:

Cache-Control: no-cache

request header.

--
               Richard Heyes

          In Cambridge? Employ me
         http://www.phpguru.org/cv

+----------------------------------------+
| Access SSH with a Windows mapped drive |
| http://www.phpguru.org/sftpdrive |
+----------------------------------------+

attached mail follows:


Richard Heyes wrote:

>> When you do an explicit "refresh" or "reload" in your browser, it
>> should ignore whatever it's got cached and refetch your javascript
>> files regardless.
>
> With Interweb Explorer you need to hold down CTRL and CLICK on refresh
> (as opposed to pressing CTRL+R say) to get a fresh copy. I guess it
> depends on the headers you send on the page. Doing this will send a:
>
> Cache-Control: no-cache
>
> request header.

Any cache-instructions on the request are really for intermediate caches
and proxies only. The webserver itself doesn't do anything with them.
If you send an unconditional fetch, you will get a document served. I
don't know if an explicit refresh will cause the browser to do
conditional gets or not, but it probably will.

/Per Jessen, Zürich

attached mail follows:


Hi,

I'm trying to send emails with embed and dynamic images: a normal tell a
friend feature which sends the email with item's data: author, title,
image-cover, etc.

Ideas PEAR and mime classes apart?

thanks

   iñigo

--
--------
Iñigo Medina García
Librería Díaz de Santos
Madrid (Spain)
Dpt.Desarrollo

attached mail follows:


On Thu, May 29, 2008 at 6:11 AM, Iñigo Medina García <
imedinadiazdesantos.es> wrote:

> Hi,
>
> I'm trying to send emails with embed and dynamic images: a normal tell a
> friend feature which sends the email with item's data: author, title,
> image-cover, etc.
>
> Ideas PEAR and mime classes apart?
>
> thanks
>
> iñigo
>
> --
> --------
> Iñigo Medina García
> Librería Díaz de Santos
> Madrid (Spain)
> Dpt.Desarrollo
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
You'll need to create a HTML email, and then embed the image with the <img>
tag, using the entire path to the image as the source attribute

<img src='http://www.mysite.com/images/thisimage.jpg'>

You may want to look at some email that you get that have images in them and
just view the source.

--

Bastien

Cat, the other other white meat

attached mail follows:


Bastien Koert wrote:

> You'll need to create a HTML email, and then embed the image with the
> <img> tag, using the entire path to the image as the source attribute

Not necessarily, images may simply be sent as an attachment with
type "image/jpeg" etc.

/Per Jessen, Zürich

attached mail follows:


Per Jessen wrote:
> Bastien Koert wrote:
>
>> You'll need to create a HTML email, and then embed the image with the
>> <img> tag, using the entire path to the image as the source attribute
>
> Not necessarily, images may simply be sent as an attachment with
> type "image/jpeg" etc.
>
>
> /Per Jessen, Zürich
>

I haven't done it in a while but I believe you need a multipart mime
email with:

Content-Type: image/jpeg
Content-Disposition: inline

unless you want it to be a separate attachment.

-Shawn

attached mail follows:


>>> You'll need to create a HTML email, and then embed the image with the
>>> <img> tag, using the entire path to the image as the source attribute
>>
>> Not necessarily, images may simply be sent as an attachment with
>> type "image/jpeg" etc.
>>
>> /Per Jessen, Zürich
>>
>
> I haven't done it in a while but I believe you need a multipart mime
> email with:
>
> Content-Type: image/jpeg
> Content-Disposition: inline
>
> unless you want it to be a separate attachment.

This may help:

http://www.phpguru.org/static/htmlMimeMail5.html

--
               Richard Heyes

          In Cambridge? Employ me
         http://www.phpguru.org/cv

+----------------------------------------+
| Access SSH with a Windows mapped drive |
| http://www.phpguru.org/sftpdrive |
+----------------------------------------+

attached mail follows:


Hello,

I'm adding functionality to allow a user to copy data on a page to the
clipboard using JS. This can be done simply with:

  window.clipboardData.setData('Text','String to copy to clipboard');

The string from PHP needs to contain line breaks when copied into the
clipboard. This works when I use \n, e.g. 'This string\nspans
multiple\nlines' but how do I escape this string when outputting it from
PHP?

addslashes() seems the obvious choice, but as it escapes backslashes, the \n
chars end up in the clipboard!

Using hard new lines in the argument passed to the JS function doesn't work
as this causes JS errors:

DOESN'T WORK:
<script type="text/javascript">

var sCopy = 'String to copy
to clipboard';

</script>

<input type="button" value="COPY"
onclick="window.clipboardData.setData('Text',sCopy);" />

Any ideas?

Thanks,
Edward

attached mail follows:


> ...

This is a PHP function that escapes strings so you can output them as a
JS string. IIRC it assumes you're using single quotes to enclose your
strings.

     /**
     * Function to appropriately escape a string so it can be output
     * into javascript code.
     *
     * param string $string Input string to escape
     * return string Escaped string
     */
     function escapeString($string)
     {
         $js_escape = array("\r" => '\r',
                            "\n" => '\n',
                            "\t" => '\t',
                            "'" => "\\'",
                            '\\' => '\\\\');

         return strtr($string, $js_escape);
     }

--
               Richard Heyes

          In Cambridge? Employ me
         http://www.phpguru.org/cv

+----------------------------------------+
| Access SSH with a Windows mapped drive |
| http://www.phpguru.org/sftpdrive |
+----------------------------------------+

attached mail follows:


>
> This is a PHP function that escapes strings so you can output them as a
> JS string. IIRC it assumes you're using single quotes to enclose your
> strings.
>
> /**
> * Function to appropriately escape a string so it can be output
> * into javascript code.
> *
> * param string $string Input string to escape
> * return string Escaped string
> */
> function escapeString($string)
> {
> $js_escape = array("\r" => '\r',
> "\n" => '\n',
> "\t" => '\t',
> "'" => "\\'",
> '\\' => '\\\\');
>
> return strtr($string, $js_escape);
> }

Just what was needed - thanks Richard.

Edward

attached mail follows:


Mark Weaver wrote:
> Hi all,
>
> I've put this off as long as possible, however I think I've reached an
> impasse.
>
> I've got an application that I've been writing. One of the modules for
> this app is an event calendar. I've got the calendar to the place where
> it displays the current month as well as previous and future months. The
> place I'm stuck is it will only show months in the past or the future
> that are months in the current year.
>
> Basically the method I'm using to move backward and forward is with Unix
> timestamps.
>
> 1. When the calendar first loads the "what" is checked for;
> // passed in via $_GET
> $what == current, prev, or next
> a. "current" is the default
> $now = time()
> $prev = date('n',$now)-1
> $next = date('n',$now)+1
> b. Timestamp values are then stored in an array and then
> sent to client in session cookie which is then accessed
> upon each subsequent request to display the event calendar.
>
> My question/boggle is why, when the calendar advances to
> December(current year) it will display January, but of the current year.
> The same happens in reverse.
>
> Once I reach the end of the year either in the past or future the month
> increases or decreases accordingly, but the year doesn't change. Since
> the year value isn't changing the month calendar days that are displayed
> simply repeat themselves.
>
> I know there's something I'm missing, but I am definitely not seeing
> what it is...
>
> /********************** code below ************************/
>
> $cal = new Calendar;
> $calpos = array();
>
> // check incoming values
> if ($what === "current"){
> $cal->setCal(0,0,0,date('n'),1);
> $now = time();
> $prev = $cal->getStamp(date('n',$now)-1,1);
> $next = $cal->getStamp(date('n',$now)+1,1);
> $calpos['curr'] = $now;
> $calpos['prev'] = $prev;
> $calpos['next'] = $next;
> $_SESSION['calendar'] = $calpos;
> }
> elseif($what === "prev"){
> $peek = $_SESSION['calendar'];
> $now = $peek['prev'];
> $cal->setCal(0,0,0,date('n',$now),1);
> $prev = $cal->getStamp(date('n',$now)-1,1);
> $next = $cal->getStamp(date('n',$now)+1,1);
> $calpos['curr'] = $now;
> $calpos['prev'] = $prev;
> $calpos['next'] = $next;
> $_SESSION['calendar'] = $calpos;
> }
> elseif($what === "next"){
> $peek = $_SESSION['calendar'];
> $now = $peek['next'];
> $cal->setCal(0,0,0,date('n',$now),1);
> $prev = $cal->getStamp(date('n',$now)-1,1);
> $next = $cal->getStamp(date('n',$now)+1,1);
> $calpos['curr'] = $now;
> $calpos['prev'] = $prev;
> $calpos['next'] = $next;
> $_SESSION['calendar'] = $calpos;
> }
>
> <================================================================>
> function setCal($h=0,$m=0,$s=0,$offset,$dayVal=1){
> $stamp = date('U',mktime($h,$m,$s, $offset,$dayVal,date('Y')));
> // Using the stamp the various necessary properties are set for the
> // object
>
> function getStamp($dateStr,$dayVal=1){
> return date('U',mktime(0,0,0, $dateStr,$dayVal,date('Y')));
> }
>

Just in case:
The solution was right in front of my all along. When setting the
calendar object I was giving the class everything it needed except the
{year} value. I _ass_-umed it was being set auto-magically; possibly by
fairies or tree elves. Turns out I needed to set that parameter. Imagine
that... :)
------
$cal->setCal(0,0,0,date('n',$now),1);
------
function setCal($h=0,$m=0,$s=0,$offset,$dayVal=1){
    $stamp = date('U',mktime($h,$m,$s, $offset,$dayVal,date('Y')));
                                                        ^^^^^^^^
------

Solution:
setCal function from Calendar Class:
function setCal($h=0,$m=0,$s=0,$offset,$dayVal=1,$yrVal)

current: $cal->setCal(0,0,0,date('n',time()),1,date('Y',time()));

$prev value coming from session cookie
$now = $session['prev'];
prev: $cal->setCal(0,0,0,date('n',$now),1,date('Y',$now));

$next value coming from session cookie
$now = $session['next'];
next: $cal->setCal(0,0,0,date('n',$now),1,date('Y',$now));

It all works very nicely now.

Thank you Robert for the push to seriously scrutinize my code.

--
Mark
-------------------------
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==============================================
Powered by CentOS5 (RHEL5)

attached mail follows:


On Thu, 2008-05-29 at 07:37 -0400, Mark Weaver wrote:
> Mark Weaver wrote:
> > Hi all,
> >
> > I've put this off as long as possible, however I think I've reached an
> > impasse.
> >
> > I've got an application that I've been writing. One of the modules for
> > this app is an event calendar. I've got the calendar to the place where
> > it displays the current month as well as previous and future months. The
> > place I'm stuck is it will only show months in the past or the future
> > that are months in the current year.
> >
> > Basically the method I'm using to move backward and forward is with Unix
> > timestamps.
> >
> > 1. When the calendar first loads the "what" is checked for;
> > // passed in via $_GET
> > $what == current, prev, or next
> > a. "current" is the default
> > $now = time()
> > $prev = date('n',$now)-1
> > $next = date('n',$now)+1
> > b. Timestamp values are then stored in an array and then
> > sent to client in session cookie which is then accessed
> > upon each subsequent request to display the event calendar.
> >
> > My question/boggle is why, when the calendar advances to
> > December(current year) it will display January, but of the current year.
> > The same happens in reverse.
> >
> > Once I reach the end of the year either in the past or future the month
> > increases or decreases accordingly, but the year doesn't change. Since
> > the year value isn't changing the month calendar days that are displayed
> > simply repeat themselves.
> >
> > I know there's something I'm missing, but I am definitely not seeing
> > what it is...
> >
> > /********************** code below ************************/
> >
> > $cal = new Calendar;
> > $calpos = array();
> >
> > // check incoming values
> > if ($what === "current"){
> > $cal->setCal(0,0,0,date('n'),1);
> > $now = time();
> > $prev = $cal->getStamp(date('n',$now)-1,1);
> > $next = $cal->getStamp(date('n',$now)+1,1);
> > $calpos['curr'] = $now;
> > $calpos['prev'] = $prev;
> > $calpos['next'] = $next;
> > $_SESSION['calendar'] = $calpos;
> > }
> > elseif($what === "prev"){
> > $peek = $_SESSION['calendar'];
> > $now = $peek['prev'];
> > $cal->setCal(0,0,0,date('n',$now),1);
> > $prev = $cal->getStamp(date('n',$now)-1,1);
> > $next = $cal->getStamp(date('n',$now)+1,1);
> > $calpos['curr'] = $now;
> > $calpos['prev'] = $prev;
> > $calpos['next'] = $next;
> > $_SESSION['calendar'] = $calpos;
> > }
> > elseif($what === "next"){
> > $peek = $_SESSION['calendar'];
> > $now = $peek['next'];
> > $cal->setCal(0,0,0,date('n',$now),1);
> > $prev = $cal->getStamp(date('n',$now)-1,1);
> > $next = $cal->getStamp(date('n',$now)+1,1);
> > $calpos['curr'] = $now;
> > $calpos['prev'] = $prev;
> > $calpos['next'] = $next;
> > $_SESSION['calendar'] = $calpos;
> > }
> >
> > <================================================================>
> > function setCal($h=0,$m=0,$s=0,$offset,$dayVal=1){
> > $stamp = date('U',mktime($h,$m,$s, $offset,$dayVal,date('Y')));
> > // Using the stamp the various necessary properties are set for the
> > // object
> >
> > function getStamp($dateStr,$dayVal=1){
> > return date('U',mktime(0,0,0, $dateStr,$dayVal,date('Y')));
> > }
> >
>
> Just in case:
> The solution was right in front of my all along. When setting the
> calendar object I was giving the class everything it needed except the
> {year} value. I _ass_-umed it was being set auto-magically; possibly by
> fairies or tree elves. Turns out I needed to set that parameter. Imagine
> that... :)
> ------
> $cal->setCal(0,0,0,date('n',$now),1);
> ------
> function setCal($h=0,$m=0,$s=0,$offset,$dayVal=1){
> $stamp = date('U',mktime($h,$m,$s, $offset,$dayVal,date('Y')));
> ^^^^^^^^

I don't really want to say "I told you so", but that's one of the two
lines I denoted as incorrect in my first response ;)

> Solution:
> setCal function from Calendar Class:
> function setCal($h=0,$m=0,$s=0,$offset,$dayVal=1,$yrVal)
>
> current: $cal->setCal(0,0,0,date('n',time()),1,date('Y',time()));
>
> $prev value coming from session cookie
> $now = $session['prev'];
> prev: $cal->setCal(0,0,0,date('n',$now),1,date('Y',$now));
>
> $next value coming from session cookie
> $now = $session['next'];
> next: $cal->setCal(0,0,0,date('n',$now),1,date('Y',$now));
>
> It all works very nicely now.
>
> Thank you Robert for the push to seriously scrutinize my code.

It's far more important to learn to build complex code from simple code,
than to try and understand complex code and then refactor it to simple
code. Just a thought for the future since as it stands you have a very
convoluted system of moving back and forth between months.

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

attached mail follows:


Robert Cummings wrote:
>> function setCal($h=0,$m=0,$s=0,$offset,$dayVal=1){
>> $stamp = date('U',mktime($h,$m,$s, $offset,$dayVal,date('Y')));
>> ^^^^^^^^
>
> I don't really want to say "I told you so", but that's one of the two
> lines I denoted as incorrect in my first response ;)

:P indeed you did... it just took me a while before it dawned on me. I
just wasn't seeing it until the "Mule" got tired of trying to climb a
vertical cliff!

>>
>> Thank you Robert for the push to seriously scrutinize my code.
>
> It's far more important to learn to build complex code from simple code,
> than to try and understand complex code and then refactor it to simple
> code. Just a thought for the future since as it stands you have a very
> convoluted system of moving back and forth between months.
>
> Cheers,
> Rob.

The particular block of code you're referring to definitely needs to be
"re factored", however at the moment I don't know enough about php to
accomplish that. I think one of the bad habits I got into early on was
coding verbosely so I wouldn't have to comment as much. That definitely
doesn't serve very well at times.

--
Mark
-------------------------
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==============================================
Powered by CentOS5 (RHEL5)

attached mail follows:


Hi,

I am attempting to set up a group webmail client wherein certain emails
can be stored separately from the normal mailbox system and retrieved
for viewing by any user via a separate mechanism to the normal client.

According to the documentation, I should be able to connect to this
store using something of the form:

imap_open("{localhost/imap}/path/to/maildir", "u", "p");

or perhaps:

imap_open("{localhost/imap}#driver.maildir/path/to/maildir", "u", "p");

Various combinations of path, permissions, and so on all, without fail,
yield the error "Mailbox does not exist, or must be subscribed to."
Attempting to subscribe to the mailbox does not fix this, and since one
of the paths tried was that of a mailbox accessible through the normal
route:

imap_open("{localhost/imap}INBOX", "u", "p");

....I can only assume that I'm doing something wrong.

Can anyone assist? Specifically, I need to know:

* Are there any pitfalls associated with setting the mailbox up? (eg.
path restrictions, permissions, ownership, format.) We're using maildir
format elsewhere, it seems to be the most suitable.

* How exactly should the imap_open command be written to access such a
mailbox? Are there other commands needed as well (eg. imap_subscribe)?

Thanks in advance,

        Niall

attached mail follows:


How to import the stylesheet from a .odt file and modify it and use it for creating a document.

Can we use xsl functions for this process. If yes, then what are the required xsl functions?

attached mail follows:


Priyanka wrote:

> How to import the stylesheet from a .odt file and modify it and use it
> for creating a document.
>
> Can we use xsl functions for this process. If yes, then what are the
> required xsl functions?

Doesn't really sound like a PHP-related question, but yes it is all
possible. The .odt file is plain XML, you can XSL to fiddle with it.

/Per Jessen, Zürich

attached mail follows:


---- Priyanka <prianca.guptagmail.com> wrote:
> How to import the stylesheet from a .odt file and modify it and use it for creating a document.
>
> Can we use xsl functions for this process. If yes, then what are the required xsl functions?

EASY!!! Just STFW for XSL and ODT

This might help: http://healthlinks.washington.edu/howto/beyondgoogle.html

Then, once you understand what you are trying to work with, you can plug PHP into the search and see what PHP functions work best for what you are trying to accomplish.

And when you get stuck, POST THE CODE and we'll be glad to help you iron out the issues you have.

Wolf

attached mail follows:


what do you wanna do ?? just a bridge? or try to play it?? in that
case you can't.
i think you should get the streamming and try to play it with flash

saludos

On Thu, May 29, 2008 at 4:05 AM, Shelley <myphplistgmail.com> wrote:
> 1. URL
> http://pub.qmoon.net/WMSStatus/WMS.asmx/IRadioGetCurrentPublishPoint
>
> 2. Call method
>
> HTTP GET£º
> GET / WMSStatus/WMS.asmx/IRadioGetCurrentPublishPoint HTTP/1.1
> Host: pub.qmoon.net
>
> 3. return (string)
>
> <?xml version="1.0" encoding="utf-8" ?>
> <string xmlns="http://www.qmoon.net/">mms://pub.qmoon.net/audio</string>
>
> How can I listen to the audio stream with PHP?
> Anybody some suggestions?
>
> Thank you in advance.
>
>
> --
> Regards,
> Shelley
>

--
Los sabios buscan la sabidur¨ªa; los necios creen haberla encontrado.
Gabriel Sosa

attached mail follows:


Am 2008-05-28 08:40:09, schrieb Philip Thompson:
> It's amazing how someone so involved in security would provide any of
> this information. Name, job, location, phone numbers, Internet
> contact. You might as well have given the name of your children as
> well. Nevermind, I'll go find that out on Google. =P
------------------------ END OF REPLIED MESSAGE ------------------------

This is NOT the problem...
I was talking about the tracking of my activities around the world since
I have customers in Iran, Turkey, Syria, Lebanon, Moroco, Germany and
Swiss.

Thanks, Greetings and nice Day
    Michelle Konzack
    Systemadministrator
    24V Electronic Engineer
    Tamay Dogan Network
    Debian GNU/Linux Consultant

--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
+49/177/9351947 50, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFIPaUBC0FPBMSS+BIRAlcLAJ9NTBqUwAphMYXHf0pdo55yIPjYAgCfQN9d
qyBYywlZULehVn0NaSQaMA8=
=oK1R
-----END PGP SIGNATURE-----

attached mail follows:


---- Michelle Konzack <linux4michelletamay-dogan.net> wrote:
> Am 2008-05-28 08:40:09, schrieb Philip Thompson:
> > It's amazing how someone so involved in security would provide any of
> > this information. Name, job, location, phone numbers, Internet
> > contact. You might as well have given the name of your children as
> > well. Nevermind, I'll go find that out on Google. =P
> ------------------------ END OF REPLIED MESSAGE ------------------------
>
> This is NOT the problem...
> I was talking about the tracking of my activities around the world since
> I have customers in Iran, Turkey, Syria, Lebanon, Moroco, Germany and
> Swiss.
>
> Thanks, Greetings and nice Day
> Michelle Konzack
> Systemadministrator

Then get SMART about your surfing.

Set up your browser to use a burn alias, a yahoo email account you never check (or hotmail or whatnot) set to an ex-lover's name and post under an anonymous account.

But don't B*tch about a website that doesn't look/work like *YOU* think it should look/work when you arbitrarily block things that either don't have an impact or that *YOU* are not willing to take responsibility for your own actions.

Oh, you must be part of that "ME" generation who's unable to take responsibility for things.

Wolf

attached mail follows:


I have a snippet of code like this which works fine in PHP4.

$secs = array();
foreach($_GET['sids'] as $sid){
   $secs[$sid] = new CustomSecurity();
   $secs[$sid]->set(array('customSecurityID' => $sid));
}

However, in PHP5 (5.2.4) the array has the proper keys in it but all of
the array values in $secs seem to point to the same instance.
Basically, the customSecurityID value inside each array value (object
instance) should match the array key, but all of the customSecurityID
values are set to the last $sid value during the final iteration which
tells me the array values are not 3 separate instances, but references
to the same instance.

I'm having a hard time seeing how this isn't a bug. On each iteration
of the loop I'm using a new variable $secs[$sid] which is previously
unassigned and assigning it via the new operator to a new instance.

Is this a bug or a strange reference behavior that I don't understand?

How can you fill arrays with multiple new instances?

Thanks.

Dave

attached mail follows:


try doing this

$secs = array();
foreach($_GET['sids'] as $sid){
 $obj = null;
 $obj = new CustomSecurity();
 $obj->set(array('customSecurityID' => $sid));
 $secs[] = $obj;
}

i just don't know if the operator -> it's working wll over object arrays

saludos

On Thu, May 29, 2008 at 1:31 PM, David Moylan <davewestphila.net> wrote:
> I have a snippet of code like this which works fine in PHP4.
>
>
> $secs = array();
> foreach($_GET['sids'] as $sid){
> $secs[$sid] = new CustomSecurity();
> $secs[$sid]->set(array('customSecurityID' => $sid));
> }
>
> However, in PHP5 (5.2.4) the array has the proper keys in it but all of the
> array values in $secs seem to point to the same instance. Basically, the
> customSecurityID value inside each array value (object instance) should
> match the array key, but all of the customSecurityID values are set to the
> last $sid value during the final iteration which tells me the array values
> are not 3 separate instances, but references to the same instance.
>
> I'm having a hard time seeing how this isn't a bug. On each iteration of
> the loop I'm using a new variable $secs[$sid] which is previously unassigned
> and assigning it via the new operator to a new instance.
>
> Is this a bug or a strange reference behavior that I don't understand?
>
> How can you fill arrays with multiple new instances?
>
> Thanks.
>
> Dave
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Los sabios buscan la sabiduría; los necios creen haberla encontrado.
Gabriel Sosa

attached mail follows:


Nope. Same performance. I originally had something like this (minus
the assigment to null) but I thought the confusion was in the variable
assignment so I went directly to the array. I've tried your code
exactly and get the same thing, assignment to null doesn't help.

Dave

Gabriel Sosa wrote:
> try doing this
>
> $secs = array();
> foreach($_GET['sids'] as $sid){
> $obj = null;
> $obj = new CustomSecurity();
> $obj->set(array('customSecurityID' => $sid));
> $secs[] = $obj;
> }
>
>
> i just don't know if the operator -> it's working wll over object arrays
>
>
> saludos
>
> On Thu, May 29, 2008 at 1:31 PM, David Moylan <davewestphila.net> wrote:
>> I have a snippet of code like this which works fine in PHP4.
>>
>>
>> $secs = array();
>> foreach($_GET['sids'] as $sid){
>> $secs[$sid] = new CustomSecurity();
>> $secs[$sid]->set(array('customSecurityID' => $sid));
>> }
>>
>> However, in PHP5 (5.2.4) the array has the proper keys in it but all of the
>> array values in $secs seem to point to the same instance. Basically, the
>> customSecurityID value inside each array value (object instance) should
>> match the array key, but all of the customSecurityID values are set to the
>> last $sid value during the final iteration which tells me the array values
>> are not 3 separate instances, but references to the same instance.
>>
>> I'm having a hard time seeing how this isn't a bug. On each iteration of
>> the loop I'm using a new variable $secs[$sid] which is previously unassigned
>> and assigning it via the new operator to a new instance.
>>
>> Is this a bug or a strange reference behavior that I don't understand?
>>
>> How can you fill arrays with multiple new instances?
>>
>> Thanks.
>>
>> Dave
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>

attached mail follows:


I thought this line it may help, not actually the null
$secs[] = $obj;

i will still researching about this

On Thu, May 29, 2008 at 2:08 PM, David Moylan <davewestphila.net> wrote:
> Nope. Same performance. I originally had something like this (minus the
> assigment to null) but I thought the confusion was in the variable
> assignment so I went directly to the array. I've tried your code exactly
> and get the same thing, assignment to null doesn't help.
>
> Dave
>
> Gabriel Sosa wrote:
>>
>> try doing this
>>
>> $secs = array();
>> foreach($_GET['sids'] as $sid){
>> $obj = null;
>> $obj = new CustomSecurity();
>> $obj->set(array('customSecurityID' => $sid));
>> $secs[] = $obj;
>> }
>>
>>
>> i just don't know if the operator -> it's working wll over object arrays
>>
>>
>> saludos
>>
>> On Thu, May 29, 2008 at 1:31 PM, David Moylan <davewestphila.net> wrote:
>>>
>>> I have a snippet of code like this which works fine in PHP4.
>>>
>>>
>>> $secs = array();
>>> foreach($_GET['sids'] as $sid){
>>> $secs[$sid] = new CustomSecurity();
>>> $secs[$sid]->set(array('customSecurityID' => $sid));
>>> }
>>>
>>> However, in PHP5 (5.2.4) the array has the proper keys in it but all of
>>> the
>>> array values in $secs seem to point to the same instance. Basically, the
>>> customSecurityID value inside each array value (object instance) should
>>> match the array key, but all of the customSecurityID values are set to
>>> the
>>> last $sid value during the final iteration which tells me the array
>>> values
>>> are not 3 separate instances, but references to the same instance.
>>>
>>> I'm having a hard time seeing how this isn't a bug. On each iteration of
>>> the loop I'm using a new variable $secs[$sid] which is previously
>>> unassigned
>>> and assigning it via the new operator to a new instance.
>>>
>>> Is this a bug or a strange reference behavior that I don't understand?
>>>
>>> How can you fill arrays with multiple new instances?
>>>
>>> Thanks.
>>>
>>> Dave
>>>
>>> --
>>> 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
>
>

--
Los sabios buscan la sabiduría; los necios creen haberla encontrado.
Gabriel Sosa

attached mail follows:


Well, I did that except I'm providing the key explicitly. However, I've
tried it now without the key and it's the same except for the key value.
  Very frustrating.

Dave

Gabriel Sosa wrote:
> I thought this line it may help, not actually the null
> $secs[] = $obj;
>
> i will still researching about this
>
> On Thu, May 29, 2008 at 2:08 PM, David Moylan <davewestphila.net> wrote:
>> Nope. Same performance. I originally had something like this (minus the
>> assigment to null) but I thought the confusion was in the variable
>> assignment so I went directly to the array. I've tried your code exactly
>> and get the same thing, assignment to null doesn't help.
>>
>> Dave
>>
>> Gabriel Sosa wrote:
>>> try doing this
>>>
>>> $secs = array();
>>> foreach($_GET['sids'] as $sid){
>>> $obj = null;
>>> $obj = new CustomSecurity();
>>> $obj->set(array('customSecurityID' => $sid));
>>> $secs[] = $obj;
>>> }
>>>
>>>
>>> i just don't know if the operator -> it's working wll over object arrays
>>>
>>>
>>> saludos
>>>
>>> On Thu, May 29, 2008 at 1:31 PM, David Moylan <davewestphila.net> wrote:
>>>> I have a snippet of code like this which works fine in PHP4.
>>>>
>>>>
>>>> $secs = array();
>>>> foreach($_GET['sids'] as $sid){
>>>> $secs[$sid] = new CustomSecurity();
>>>> $secs[$sid]->set(array('customSecurityID' => $sid));
>>>> }
>>>>
>>>> However, in PHP5 (5.2.4) the array has the proper keys in it but all of
>>>> the
>>>> array values in $secs seem to point to the same instance. Basically, the
>>>> customSecurityID value inside each array value (object instance) should
>>>> match the array key, but all of the customSecurityID values are set to
>>>> the
>>>> last $sid value during the final iteration which tells me the array
>>>> values
>>>> are not 3 separate instances, but references to the same instance.
>>>>
>>>> I'm having a hard time seeing how this isn't a bug. On each iteration of
>>>> the loop I'm using a new variable $secs[$sid] which is previously
>>>> unassigned
>>>> and assigning it via the new operator to a new instance.
>>>>
>>>> Is this a bug or a strange reference behavior that I don't understand?
>>>>
>>>> How can you fill arrays with multiple new instances?
>>>>
>>>> Thanks.
>>>>
>>>> Dave
>>>>
>>>> --
>>>> 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
>>
>>
>
>
>

attached mail follows:


On Thu, 2008-05-29 at 14:01 -0300, Gabriel Sosa wrote:
> try doing this
>
> $secs = array();
> foreach($_GET['sids'] as $sid){
> $obj = null;
> $obj = new CustomSecurity();
> $obj->set(array('customSecurityID' => $sid));
> $secs[] = $obj;
> }

No, no, no. If it's a reference issue you need to do the following:

<?php

$secs = array();
foreach($_GET['sids'] as $sid)
{
   unset( $obj );
 $obj = new CustomSecurity();
 $obj->set(array('customSecurityID' => $sid));
 $secs[] = $obj;
}

?>

Assignment of null won't break a reference, it'll just make the value
refer to null. You need unset to break the reference. Personally, I'd
like to see the class definition to see what happens inside the set()
method.

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

attached mail follows:


What I want to do is find all links in an html file. I have the pattern
below. It works as long as there is only one link on a line and as long
as the whole link is one line. It seems there should be a way to get
this to work with more than one link on a single line. The work around
I have done for now is to read the whole file into a buffer and remove
all new lines and then add a new line after every closing a tag. Then
process each line. There has to be a better way.

Any Ideas? Also note I don't want to find any a tags that don't have an
href.... there probably aren't any but just in case.

preg_match_all("/(< *a[^>]*href[^>]+>)(.*)<\/a>/", $Line, $matches,
PREG_PATTERN_ORDER);

--
Chris W
KE5GIX

"Protect your digital freedom and privacy, eliminate DRM,
learn more at http://www.defectivebydesign.org/what_is_drm"

Ham Radio Repeater Database.preg_match_all("/(< *a[^>]*href[^>]+>)(.*)<\/a>/", $Line, $matches, PREG_PATTERN_ORDER);
http://hrrdb.com

attached mail follows:


On Thu, 2008-05-29 at 13:07 -0500, Chris W wrote:
> What I want to do is find all links in an html file. I have the pattern
> below. It works as long as there is only one link on a line and as long
> as the whole link is one line. It seems there should be a way to get
> this to work with more than one link on a single line. The work around
> I have done for now is to read the whole file into a buffer and remove
> all new lines and then add a new line after every closing a tag. Then
> process each line. There has to be a better way.
>
> Any Ideas? Also note I don't want to find any a tags that don't have an
> href.... there probably aren't any but just in case.
>
>
> preg_match_all("/(< *a[^>]*href[^>]+>)(.*)<\/a>/", $Line, $matches,
> PREG_PATTERN_ORDER);

Your preg isn't going to return the URLs (even if it works), it's going
to return the labels of the links. But anyways...

<?php

$content = implode( '', file( 'http://www.php.net' ) );

if( preg_match_all(
        '#(<a[^>]+href[^>]+>)(.*)</a>#Umis', $content, $bits ) )
{
    print_r( $bits );
}

?>

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

attached mail follows:


On Thu, 2008-05-29 at 14:20 -0400, Robert Cummings wrote:
> On Thu, 2008-05-29 at 13:07 -0500, Chris W wrote:
> > What I want to do is find all links in an html file. I have the pattern
> > below. It works as long as there is only one link on a line and as long
> > as the whole link is one line. It seems there should be a way to get
> > this to work with more than one link on a single line. The work around
> > I have done for now is to read the whole file into a buffer and remove
> > all new lines and then add a new line after every closing a tag. Then
> > process each line. There has to be a better way.
> >
> > Any Ideas? Also note I don't want to find any a tags that don't have an
> > href.... there probably aren't any but just in case.
> >
> >
> > preg_match_all("/(< *a[^>]*href[^>]+>)(.*)<\/a>/", $Line, $matches,
> > PREG_PATTERN_ORDER);
>
> Your preg isn't going to return the URLs (even if it works), it's going
> to return the labels of the links. But anyways...

Actually it returned both, just not how I had thought first. I forgot to
delete the above after I realized. My solution below works
nonetheless :)

> <?php
>
> $content = implode( '', file( 'http://www.php.net' ) );
>
> if( preg_match_all(
> '#(<a[^>]+href[^>]+>)(.*)</a>#Umis', $content, $bits ) )
> {
> print_r( $bits );
> }
>
> ?>
>
> Cheers,
> Rob.

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

attached mail follows:


my page include some javascript to control the play,rewind..and other functions of the swffile showEdit.swf, it works in Safari/IE with flash-plugin 8/9 installed but not works in Firefox with flash plugin 9(would reports obj.play() is not a function, is any one point out what is the problem or there are techniques i can use?

>>>>>>>the source codes>>>>>>>>>>>>>>>>>>
<script>
function show(){
 var obj=document.getElements("showEdit");//it works in Firefox
 obj.play();//it works in IE,but not in Firefox.
}
</script>
>>>>>>>>>>>>>
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="202" height="498" id="showEdit">
    <param name="movie" value="flash/show_edit.swf" />
    <param name="quality" value="high" />
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="FlashVars" value="userid=rasy" />
    <param name="name" value="FlashVars" />
    <embed src="flash/show_edit.swf" width="202" height="498" quality="hight" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptAccess="sameDomain" FlashVars="userid=rasy" name="FlashVars" name="showEdit">
    </embed>
  </object>

_________________________________________________________________
¶à¸öÓÊÏäͬ²½¹ÜÀí£¬live mail¿Í»§¶ËÍòÈËÇÀÓÃÖÐ
http://get.live.cn/product/mail.html

attached mail follows:


---- jencissonunicoco.com wrote:
>
> my page include some javascript to control the play,rewind..and other functions of the swffile showEdit.swf, it works in Safari/IE with flash-plugin 8/9 installed but not works in Firefox with flash plugin 9(would reports obj.play() is not a function, is any one point out what is the problem or there are techniques i can use?
>
> >>>>>>>the source codes>>>>>>>>>>>>>>>>>>
> <script>
> function show(){
> var obj=document.getElements("showEdit");//it works in Firefox
> obj.play();//it works in IE,but not in Firefox.
> }
> </script>

Sure, GO CHECK WITH A JAVASCRIPT LIST!

There is no PHP code anywhere here.

HTH,
Wolf

attached mail follows:


i need to validate a field in a form where a user enters a reference number
this can be letters, numbers and special characters also so i have not
written any special preg match as the username is a combination. the only
check i am doing is if there are any white spaces and if a user simple
presses the space bar and does not enter value i display a message to enter
the reference number and even if there are white spaces followed by the
reference number i have used trim method. i have checked in the database
even if there are white spaces followed by reference number due to trim()
method the data in the table is being inserted whithout those white spaces.

following is the code i am presently using

$referencenumber = trim($_POST["referencenumber"]);

if(strlen($referencenumber) == 0)
{
$error.="<li>Reference number cannot be blank </li> <br />";
}

this code works perfectly fine and does what it is supposed to, however i am
using techniques to avoid sql injection. following is the technique i have
used

if(get_magic_quotes_gpc())
{
$username = stripslashes($_POST["username"]);
}

else
{
$username = $_POST["username"];
}

due to this even if i use

if(get_magic_quotes_gpc())
{
$lodgementnumber = stripslashes($_POST["lodgementnumber"]);
}

else
{
$lodgementnumber = trim($_POST["lodgementnumber"]);
}

if(strlen($lodgementnumber) == 0)
{
$error.="reference number cannot be blank;
}

the validation is not doing what it does in the code i mentioned at the
begining.

i need to use techniques to avoid sql injection and i also need the
validation to work.

how can i fix this.

please advice.

thanks.