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 15 Sep 2006 06:36:58 -0000 Issue 4348

php-general-digest-helplists.php.net
Date: Fri Sep 15 2006 - 01:36:58 CDT


php-general Digest 15 Sep 2006 06:36:58 -0000 Issue 4348

Topics (messages 241800 through 241806):

Re: R: [PHP] session_start() and fopen
        241800 by: Christopher Weldon

R: [PHP] R: [PHP] session_start() and fopen
        241801 by: Fabri

Re: Question on explode and join.
        241802 by: Beauford

Re: security include from remote server
        241803 by: Miguel Vaz
        241804 by: Jon Anderson

Months between two dates
        241805 by: Phillip Baker
        241806 by: Kyle

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:


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fabri wrote:
> Hi Christopher: this is just a simplified code, I use it to generate some
> xml file, no loop is present.
>
> Try it as it is: you will find that two files will be generated while it
> should be only one.
> If you remove 'session_start()' then only one file will be generated: that's
> correct!
>
> Fabri

Hey Fabri,

I cannot replicate this bug (PHP 4.2.3 on older server). I'm only
getting one file written. What version of PHP are you using?

- --
Christopher Weldon, ZCE
President & CEO
Cerberus Interactive, Inc.
cweldoncerberusonline.com
979.739.5874
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFCa33Zxvk7JEXkbERAkT6AJwODHyP1uvE7UjlAOsjSlTf83LS0ACgifny
XRbhB2bRYZsKCvCl09QLkS0=
=lSIJ
-----END PGP SIGNATURE-----

attached mail follows:


Hi Chris,
thanks for your feedback: at least now I know that the script is correct, I
am using version 4.3.10, I will investigate if some bug is present in this
version.

Fabri

-----Messaggio originale-----
Da: Christopher Weldon [mailto:cweldoncerberusonline.com]
Inviato: giovedě 14 settembre 2006 21.31
A: Fabri
Cc: php-generallists.php.net
Oggetto: Re: [PHP] R: [PHP] session_start() and fopen

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fabri wrote:
> Hi Christopher: this is just a simplified code, I use it to generate some
> xml file, no loop is present.
>
> Try it as it is: you will find that two files will be generated while it
> should be only one.
> If you remove 'session_start()' then only one file will be generated:
that's
> correct!
>
> Fabri

Hey Fabri,

I cannot replicate this bug (PHP 4.2.3 on older server). I'm only
getting one file written. What version of PHP are you using?

- --
Christopher Weldon, ZCE
President & CEO
Cerberus Interactive, Inc.
cweldoncerberusonline.com
979.739.5874
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFCa33Zxvk7JEXkbERAkT6AJwODHyP1uvE7UjlAOsjSlTf83LS0ACgifny
XRbhB2bRYZsKCvCl09QLkS0=
=lSIJ
-----END PGP SIGNATURE-----

Chiacchiera con i tuoi amici in tempo reale!
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com

attached mail follows:


I read your email, but I'm not using sessions and not really planning too.
But some of your code may be able to be modified to do what I need.

Thanks for the input.

B

  _____

From: Dave Goodchild [mailto:buddhamagnetgmail.com]
Sent: September 14, 2006 8:52 AM
To: Beauford
Subject: Re: [PHP] Question on explode and join.

Hi. If you re-read my reponse you will see that it uses preg_replace with
the i flag which ignores case and will match banned words within words. With
a little modification (I can help if you like) you can easily use it in your
case.

attached mail follows:


         Yes, right on the spot. Main reasons being code theft and
using it on other projects. This being done by our office (its
actually a college and i work in a multimedia department) system
administrators, which are nothing left than arrogant leaches.

         All i was missing from your suggestion was the fact that i
would need to have my files remotely hosted and not using the .php
extension. Great help, thanks.

         Pag

>I personally don't understand why you'd need to store code remotely
>but execute it locally, unless you're concerned about the office
>"stealing" your code, or using it without permission...If you aren't
>concerned about code theft, there are lots of ways you could store
>code remotely, e.g. a very raw/simple/uncomplicated/ugly:
>
>$src = file_get_contents('http://server/code.php.txt');
>file_put_contents('/tmp/code.php',$src);
>include('/tmp/code.php');
>unlink('/tmp/code.php');
>
>But there are at least a few reasons why I wouldn't recommend doing that...
>
>jon

attached mail follows:


Miguel Vaz wrote:
> Yes, right on the spot. Main reasons being code theft and
> using it on other projects. This being done by our office (its
> actually a college and i work in a multimedia department) system
> administrators, which are nothing left than arrogant leaches.
>
> All i was missing from your suggestion was the fact that i
> would need to have my files remotely hosted and not using the .php
> extension. Great help, thanks.
If your sysadmins are trying to steal the code, all they'd have to do is
download the same code your local scripts refer to
(http://server/code.php.txt)...Seems to me that you might be better off
using an encoder of some kind so they don't get their hands on the
source. Using what I suggested is in no way secure or fast.

jon

attached mail follows:


Greetings Gents,

I want to take two dates formatted as
11/1/1998
10/1/2008

And find out how many months have elapsed between them.
I was wondering if there was a quick and dirty way to do this without a for
loop.

--
Blessed Be

Phillip

The House has passed a law that would abandon the Internet's First Amendment
-- a principle called Network Neutrality that prevents companies like AT&T,
Verizon and Comcast from deciding which Web sites work best for you -- based
on what site pays them the most. If the public doesn't speak up now, our
elected officials will cave to a multi-million dollar lobbying campaign.
Please contaxct your Senators to defeat this bill in the Senate.
http://www.savetheinternet.com
http://www.coanews.org/tiki-read_article.php?articleId=995
http://www.coanews.org/internetfreedom.html?page=netfreedom
http://www.gnn.tv/headlines/9484/
http://www.dearaol.com/

attached mail follows:


I will assume that your dates are stored in two variables $date1 and $date2

<code>
$date1array = explode("/",$date1);
$date2array = explode("/",$date2);

// Assume Date 2 is later than Date 1

$months_apart = ($date2array[2] - $date1array[2])*12;

// Month is later in date 1 than in date 2
// Find the difference of months
if( $date1array[0] > $date2array[0] )
{
        $months_apart -= $date1array[0] - $date2array[0];
}
else
{
        $months_apart += $date2array[0] - $date1array[0];
}

// $months_apart should now contain months apart
</code>

And there is your quick and dirty method,
I haven't really debugged it, but I am pretty sure that should work.
Some (int) casting my be necessary, but I think PHP will automatically
do that for you.

Good luck,
Kyle

Phillip Baker wrote:
> Greetings Gents,
>
> I want to take two dates formatted as
> 11/1/1998
> 10/1/2008
>
> And find out how many months have elapsed between them.
> I was wondering if there was a quick and dirty way to do this without a for
> loop.
>