php-general Digest 14 Mar 2008 08:39:02 -0000 Issue 5347

Topics (messages 271541 through 271562):

Re: avoid calling php script
        271541 by: H u g o H i r a m

Re: What's wrong the __autoload()?
        271542 by: Roland Häder
        271543 by: Andrés Robinet
        271544 by: Aschwin Wesselius
        271545 by: Børge Holen
        271548 by: Gustavo Narea
        271552 by: Robert Cummings
        271560 by: Aschwin Wesselius

Web host with SOAP
        271546 by: Larry Garfield
        271554 by: Daniel Brown
        271555 by: Shawn McKenzie
        271556 by: Shawn McKenzie

Re: How to get error context
        271547 by: Jim Lucas

class for generating ics or vcs file
        271549 by: VamVan
        271557 by: TG

Re: mail function and headers
        271550 by: Chris

Last Friday of every month
        271551 by: VamVan
        271553 by: Andrés Robinet
        271561 by: Aschwin Wesselius

Re: Intercepting errors
        271558 by: Chris

Re: curl fails to connect when not port 80
        271559 by: Chris

Sending multiple values from a form having same field names.
        271562 by: Suamya Srivastava

Administrivia:

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

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

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
HTTP_REFERER will do the job, thanks!

Hugo.
---

Steve Edberg escribió:
At 3:55 AM +0100 3/13/08, H u g o H i r a m wrote:
Hello

I have a swf that runs a PHP script that generates a XML, on the PHP is there any way to detect if the file is being called from the swf or from the browser? because I want to avoid the file being run directly from the browser or from any other file than the swf.

regards,
Hugo.


You might want to check the HTTP_REFERER value; test the program from a browser and the swf, and see what happens. Alternatively you could use a GET parameter like

   http://example.com/yourscript.php?calledby=swf

Be aware that anything sent back from the client can be spoofed - and HTTP_REFERER can be altered or disabled - so it probably wouldn't be hard for someone to make it appear to your script that it is being called by your SWF.

If you're really concerned about restricting the communication between the Flash movie and your server, there might be some way to build a challenge-response mechanism into the flash; I don't know much about it.

If, on the other hand, you just don't want to confuse someone who might accidentally run the XML-generating script from the browser, checking a GET parameter as above is probably the safest. If it's not set properly, redirect the user, eg:

   if (!isset($_GET['calledby']) || $_GET['calledby'] != 'swf') {
      header('Location: http://example.com/thecorrectpage.html');
      exit();
   }
   ...

    - steve


--- End Message ---
--- Begin Message ---
Are you talking about Ruby-On-Rails, which is a framework, or about Ruby?

Well, to point out my view, I have to admit that PHP is not really good 
written. In some functions the needle is the first argument, second the 
haystack and vise-versa in other functions.

And talk about OOP with PHP, well, it is -working- but not as like as you know 
from Java. In Java I can create a type-hinted hash-map in one line, by the 
type-hint is an interface. Very nice and small code. :)

Ruby might also be able to do this. In PHP I have to write a class which does 
this for me.

Well, what I want to say is that you cannot compare PHP with wether RoR nor 
Java. RoR is a framework, PHP is not. Java is 99.99% pure OO, PHP is not.

Hope that gives you an idea. :)

And btw: Hello. I'm new to this list. ;-)

Roland

On Thursday, 13. March 2008, Greg Donald wrote:
> On 3/13/08, Robert Cummings <[EMAIL PROTECTED]> wrote:
> > Sooooo... there we have it everyone... Greg has admitted that Ruby is as
> > smart as a cat.
>
> Hahaha..  yeah, you really got me on that one.
>
> /me slaps his knee.
>
> >  I like something a little more edgy personally. Something closer to
> > human... something with personality, something that evolves, something
> > not afraid to be itself. PHP fits the bill.
>
> PHP is anything but itself.  Before it was actually written in C it
> was first written in Perl.  And although it may be written in C and
> may look like C and Perl right now, it's clearly evolving into
> something very similar to Java.  PHP has a long, long history with
> identity crisis, ongoing even today.
>
> Meanwhile Ruby was written as a full-on OO language from the start.
> The OO layer didn't get "strapped on" at version 3 like with PHP.  OO
> was the main idea from the very start with Ruby.  As a result Ruby's
> OO model makes PHP's OO model look like a steaming pile of shit out in
> the pasture.  Hell, Perl's OO even makes PHP's OO look bad
> syntax-wise.
>
>
> --
> Greg Donald
> http://destiney.com/



-- 
Weblog:
http://blog.mxchange.org

Attachment: signature.asc
Description: This is a digitally signed message part.


--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Greg Donald [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 13, 2008 4:17 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] What's wrong the __autoload()?
> 
> On 3/13/08, Robert Cummings <[EMAIL PROTECTED]> wrote:
> > Sooooo... there we have it everyone... Greg has admitted that Ruby is as
> smart as a cat.
> 
> Hahaha..  yeah, you really got me on that one.
> 
> /me slaps his knee.
> 
> >  I like something a little more edgy personally. Something closer to
> human... something
> > with personality, something that evolves, something not afraid to be
> itself. PHP fits
> > the bill.
> 
> PHP is anything but itself.  Before it was actually written in C it
> was first written in Perl.  And although it may be written in C and
> may look like C and Perl right now, it's clearly evolving into
> something very similar to Java.  PHP has a long, long history with
> identity crisis, ongoing even today.
> 
> Meanwhile Ruby was written as a full-on OO language from the start.
> The OO layer didn't get "strapped on" at version 3 like with PHP.  OO
> was the main idea from the very start with Ruby.  As a result Ruby's
> OO model makes PHP's OO model look like a steaming pile of shit out in
> the pasture.  Hell, Perl's OO even makes PHP's OO look bad
> syntax-wise.
> 
> 
> --
> Greg Donald
> http://destiney.com/

Sorry dude, RoR is still an academic toy. And not the most successful one, since
I've heard people talking like you back in 2005. Ruby on Rails is not new and
has not proved anything yet.

It's an arrogant language, so much arrogant that its community pretend it can
fix the world. Back in 2005 I was very enthusiastic and thought it could have a
future, but after confirming what other poster said "the RoR community is
insane", I didn't give a f... anymore. 

I believe it will become some piece of *enterprise-class* piece of dust in the
best of scenarios. In the meantime, the web moves towards PHP more and more. And
if they need a fat cat... they don't use RoR, just the "Tom Cat".

Look at it this way, in 2001 M$ released the .Net Framework. It's been 7 YEARS
since PHP is STILL the leader and will be so for many more years. And .Net has
the "glorious" Visual Studio IDE, compiled code, built-in caching, and
idiot-proof tools, and has the BIGGEST software company behind. Do you think
that the work of "a man" can do much more than that? Specially, a man that has
the arrogance of a big Co.?

"In March 2007 David Heinemeier Hansson filed three Rails related trademark
applications to the USPTO. These applications regard the phrase "RUBY ON RAILS",
the word "RAILS" and the official Rails logo. As a consequence, in the summer of
2007 Hansson denied to Apress the permission to use the Rails logo on the cover
of a new Rails book written by some authoritative community members. The episode
gave rise to a polite protest in the Rails community. In response to this
criticism, Hansson made the following claims:
<quote>
I only grant promotional use [of the Rails logo] for products I'm directly
involved with. Such as books that I've been part of the development process for
or conferences where I have a say in the execution. I would most definitely seek
to enforce all the trademarks of Rails
</quote>

Sorry, even if it was the ONE AND ONLY programming language... I will dismiss it
until it becomes a "business need", as I don't even trust its creator. PHP is
easy to deal with, it's free... and IT GETS THE JOB DONE. You mentioned
something about projects done on RoR you can share... why don't you show us your
PHP work instead? Maybe you like RoR more because you suck at PHP.

Regards,

Rob


--- End Message ---
--- Begin Message ---
Andrés Robinet wrote:
why don't you show us your
PHP work instead? Maybe you like RoR more because you suck at PHP.

Regards,

Rob

Hi, can somebody please point out something to me? Did I miss something? Is there some initiation needed on this list which I've missed?

How come it is acceptable for grown up (you DO have pubic hair don't you?), mature and decent people to call names and try to convince each other of having a bigger, better whatever than the other etc.?

Is that PHP-list culture? Is it something to get used to? Is it the core of senior PHP-developers or what?

So, explain it to me, what is it that I could have missed? Is it somewhere in the archives? Is it explained on some FAQ page? Does it take some potions by full moon on a 3rd friday in may to get into this state?

It is OK do discuss a subject, to get overheated by passion, ignorance, irritation, misunderstanding or a mix of all of them. But isn't calling names and comparing bodyparts (and what not) something for kinder garten?

I'm not here to preach, I'm here to learn. So initiate me, tell me what is so important that we keep putting energy into convincing somebody that he's an idiot, a dumbass, an elite RoR fetishist etc. Does it give you a good feeling? Can I try? Should I try? Is it worth it? Will I become as enlightened as some of you are?

I don't want to miss out on this great experience, if it is worth it. It must be something amazing, really. If that makes the PHP community as great as it has become, I want to join and put some effort in this marvelous activity.

Aschwin Wesselius


--- End Message ---
--- Begin Message ---
On Thursday 13 March 2008 22:39:51 Aschwin Wesselius wrote:
> Andrés Robinet wrote:
> > why don't you show us your
> > PHP work instead? Maybe you like RoR more because you suck at PHP.
> >
> > Regards,
> >
> > Rob
>
> Hi, can somebody please point out something to me? Did I miss something?
> Is there some initiation needed on this list which I've missed?

Definetly, you need to express your ego, and be thick skinnned.

>
> How come it is acceptable for grown up (you DO have pubic hair don't
> you?),
don't use obscenities, this just look stupid on your part when someone google 
the list. Maby for your name?

> mature and decent people to call names and try to convince each 
> other of having a bigger, better whatever than the other etc.?

It's called discussion, you both walk og talk your stuff, so do others and if 
smart enought, someone may learn something from it.

>
> Is that PHP-list culture? Is it something to get used to? Is it the core
> of senior PHP-developers or what?

It's people with opinions, strong ones to at times.

>
> So, explain it to me, what is it that I could have missed? Is it
> somewhere in the archives? Is it explained on some FAQ page? Does it
> take some potions by full moon on a 3rd friday in may to get into this
> state?

You got different kinds of people here, like me, just doing this for a hobby, 
I can take some new age weird nerdy talk of nonecense.
However, there are those who do this for a living (not just php, but web 
design or lamp og wamp (how is that for a acronyme =D?)), they don't take 
lightly on having a serious discussion with someone who just f* around 
telling halftruths.

>
> It is OK do discuss a subject, to get overheated by passion, ignorance,
> irritation, misunderstanding or a mix of all of them. But isn't calling
> names and comparing bodyparts (and what not) something for kinder garten?

Everybody has those, has to do with experience, and the respect for those who 
know what they talk about (that would be those who do this for a living)

>
> I'm not here to preach, I'm here to learn. So initiate me, tell me what
> is so important that we keep putting energy into convincing somebody
> that he's an idiot, a dumbass, an elite RoR fetishist etc. Does it give
> you a good feeling? Can I try? Should I try? Is it worth it? Will I
> become as enlightened as some of you are?

Discuss that on a civil dunno, some cafe bar hangaround chat page... If you on 
the other hand got some problem with your php code, some questions for what 
you are looking for (i.e. what set of commands is capable of doing...) you've 
come to the right page.

>
> I don't want to miss out on this great experience, if it is worth it. It
> must be something amazing, really. If that makes the PHP community as
> great as it has become, I want to join and put some effort in this
> marvelous activity.

noones hindering you, just keep in mind that much of these ppl do this for a 
living and time/money/effort/payoff vs the hobbyist thinkering and thoughts 
is often two completly different mindsets

at least, THAT is what I read from the list these last couple of years.



>
> Aschwin Wesselius


ps. stop whining. If offended, lay low till something new comes to mind or you 
find some more interesting topic to join in on.
-- 
---
Børge Holen
http://www.arivene.net

--- End Message ---
--- Begin Message ---
Oh, I get it.

Thank you!

On Wednesday 12 March 2008 15:26:01 Richard Heyes wrote:
> > I'm wondering what's wrong with the use of __autoload(), since I see that
> > projects like the Zend Framework don't use it and prefer to require_once
> > each required file.
>
> Things that happen without you explicitly causing them (ie require() et
> al) can lead to confusion.
>
> For example a junior developer who doesn't know of its existence  and is
> new to a job is less likely to admit ignorance and ask how a class is
> being defined when __autoload() is being used.


-- 
Gustavo Narea.
http://gustavonarea.net/

Get rid of unethical constraints!
 - Switch to Freedomware: http://softwareliberty.com/
 - Reclaim your culture: http://lifesnotreadonly.net/

--- End Message ---
--- Begin Message ---
On Thu, 2008-03-13 at 22:39 +0100, Aschwin Wesselius wrote:
> Andrés Robinet wrote:
> > why don't you show us your
> > PHP work instead? Maybe you like RoR more because you suck at PHP.
> >
> > Regards,
> >
> > Rob
> 
> Hi, can somebody please point out something to me? Did I miss something? 
> Is there some initiation needed on this list which I've missed?
> 
> How come it is acceptable for grown up (you DO have pubic hair don't 
> you?), mature and decent people to call names and try to convince each 
> other of having a bigger, better whatever than the other etc.?
> 
> Is that PHP-list culture? Is it something to get used to? Is it the core 
> of senior PHP-developers or what?
> 
> So, explain it to me...

It works like follows...

    - $z asserts $a or claims $b
    - $y disagrees with $a or $b or both and responds with rebuttal $h
      and makes claims $c, $d, sometimes $e
    - $z responds with rebuttal $i and often asserts a few other things
      that well call $f, $g
    - $x throws in $Q
    - $w throws in $wtf
    - $foo, $fee, and $fii join in
    - $someone mentions $TLC
    - $o calls us all immature
    - $SJHSKJ mentions Nazis
    - $x invokes Godwin's Law
    - $y asserts Quirk's Exception
    - $G_Zus resurrects point $d
    - $nobody wins
    - $r, $u, $stillWithMe

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


--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
It works like follows...

    - $z asserts $a or claims $b
    - $y disagrees with $a or $b or both and responds with rebuttal $h
      and makes claims $c, $d, sometimes $e
    - $z responds with rebuttal $i and often asserts a few other things
      that well call $f, $g
    - $x throws in $Q
    - $w throws in $wtf
    - $foo, $fee, and $fii join in
    - $someone mentions $TLC
    - $o calls us all immature
    - $SJHSKJ mentions Nazis
    - $x invokes Godwin's Law
    - $y asserts Quirk's Exception
    - $G_Zus resurrects point $d
    - $nobody wins
    - $r, $u, $stillWithMe

Aaah..... so we're just six points before the end of this thread? ;-)
--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other....'/

--- End Message ---
--- Begin Message ---
Hi all.  I am looking for a web host for a site.  The usual host I work with is 
missing some important functionality, so I need to look elsewhere for this 
project.  Specifically, I need web host that offers the following:

- PHP 5.2.x
- SOAP support
- MySQL 5.0.x
- Allows .htaccess configuration

My current host is fine aside from the SOAP support, which is missing.  

Does anyone have any good recommendations for such a host?  I'd prefer shared 
(it shouldn't be a super-high-traffic site), but if necessary I'm open to 
dedicated if it's not too pricey.  I am willing to pay for quality service (so 
I don't need a cheapo $5/month site).  

--Larry Garfield



--- End Message ---
--- Begin Message ---
On Thu, Mar 13, 2008 at 5:33 PM, Larry Garfield <[EMAIL PROTECTED]> wrote:
>
>  Hi all.  I am looking for a web host for a site.  The usual host I work with 
> is missing some important functionality, so I need to look elsewhere for this 
> project.  Specifically, I need web host that offers the following:
>
>  - PHP 5.2.x
>  - SOAP support
>  - MySQL 5.0.x
>  - Allows .htaccess configuration

    Larry,

    I'm on 5.2.4 on the primary server right now, and if you need
something installed at root level, it's usually no problem (especially
for things like SOAP).  Send me a message off-list if you haven't
already found what you're looking for, and if you want references,
there are some on the list here even who host some sites with me.  Let
me know and I'm sure it won't be a problem to have them give you an
*honest* opinion about things.

    Plus, for a few people here, I don't have much issue with granting
sudo.... but don't tell anyone else.  ;-P

-- 
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

--- End Message ---
--- Begin Message ---
Daniel Brown wrote:
> On Thu, Mar 13, 2008 at 5:33 PM, Larry Garfield <[EMAIL PROTECTED]> wrote:
>>  Hi all.  I am looking for a web host for a site.  The usual host I work 
>> with is missing some important functionality, so I need to look elsewhere 
>> for this project.  Specifically, I need web host that offers the following:
>>
>>  - PHP 5.2.x
>>  - SOAP support
>>  - MySQL 5.0.x
>>  - Allows .htaccess configuration
> 
>     Larry,
> 
>     I'm on 5.2.4 on the primary server right now, and if you need
> something installed at root level, it's usually no problem (especially
> for things like SOAP).  Send me a message off-list if you haven't
> already found what you're looking for, and if you want references,
> there are some on the list here even who host some sites with me.  Let
> me know and I'm sure it won't be a problem to have them give you an
> *honest* opinion about things.
> 
>     Plus, for a few people here, I don't have much issue with granting
> sudo.... but don't tell anyone else.  ;-P
> 
Ooooooooooo...  I want SUDO!

--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:
> Daniel Brown wrote:
>> On Thu, Mar 13, 2008 at 5:33 PM, Larry Garfield <[EMAIL PROTECTED]> wrote:
>>>  Hi all.  I am looking for a web host for a site.  The usual host I work 
>>> with is missing some important functionality, so I need to look elsewhere 
>>> for this project.  Specifically, I need web host that offers the following:
>>>
>>>  - PHP 5.2.x
>>>  - SOAP support
>>>  - MySQL 5.0.x
>>>  - Allows .htaccess configuration
>>     Larry,
>>
>>     I'm on 5.2.4 on the primary server right now, and if you need
>> something installed at root level, it's usually no problem (especially
>> for things like SOAP).  Send me a message off-list if you haven't
>> already found what you're looking for, and if you want references,
>> there are some on the list here even who host some sites with me.  Let
>> me know and I'm sure it won't be a problem to have them give you an
>> *honest* opinion about things.
>>
>>     Plus, for a few people here, I don't have much issue with granting
>> sudo.... but don't tell anyone else.  ;-P
>>
> Ooooooooooo...  I want SUDO!

ALL = NOPASSWD: ALL

please!

--- End Message ---
--- Begin Message ---
It Maq wrote:
Hi,

i need help because I'm unable to retrieve error's context. Below is the code 
that is working perfectly except the context that is not displayed:

<?php
    function error_handler($errno, $errstr, $filename, $lineno, $errcontext)
    {

try doing a print_r($errcontext) here and see what you get?

maybe the zero index does not exist.

$str = "";
        $str .= "<br><br>ERROR Number: ". $errno;
        $str .= "<br>ERROR MESSAGE: ". $errstr;
        $str.= "<br>File: ". $filename;
        $str.= "<br>Line number: ". $lineno;
        $str.= "<br>Context: ". $errcontext[0];
        echo $str;
    }

echo "<h1>Testing set_error_handler</h1>";


I have always used
error_reporting(E_ALL);
instead of this.
error_reporting(0); set_error_handler('error_handler'); ini_set('error_reporting', 0);

I have never seen the above line before. This and the error_reporting(0) would probably suppress all error messages generated by PHP. Double check these settings and make sure the you can still trigger an error with trigger_error() if you have error_reporting() turned off.


//trigger_error("The string for testing the error", E_USER_WARNING);
$ourFileName = "testFile.txt";
$fh = fopen($ourFileName, 'X');// or die("Can't open file");
fclose($fh);


?>




      
____________________________________________________________________________________
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ




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

--- End Message ---
--- Begin Message ---
Hello All,

Can anyone share with me a simple class or code that can generate vcs
or ics calendar file in php, that can be imported in to outlook.

Thanks

--- End Message ---
--- Begin Message ---


----- Original Message -----
From: VamVan <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Thu, 13 Mar 2008 16:21:37 -0700
Subject: [PHP] class for generating ics or vcs file

> Hello All,
> 
> Can anyone share with me a simple class or code that can generate vcs
> or ics calendar file in php, that can be imported in to outlook.


I started making my own a while ago and never totally finished it.  I think 
it does actually work, but is somewhat incomplete and unpolished.  You're 
welcome to what I started if it helps.  It's relatively simple stuff (at 
least for the basic events).   I left in the notes I was keeping in 
comments with reference links and sample ICS data:

-TG


<?
###########################################################
# Notes
###########################################################

### Two good links about iCal and PHP
##  http://www.phpbuilder.com/columns/chow20021007.php3?print_mode=1
##  http://en.wikipedia.org/wiki/ICalendar

### Simple iCal example
/*
    BEGIN:VCALENDAR
    VERSION:2.0
    PRODID:-//GSA Calendar//NONSGML v1.0//EN
    BEGIN:VEVENT
    DTSTART:20080131T035959Z
    DTEND:20080131T170000Z
    SUMMARY:Test ICS download and integrate
    END:VEVENT
    END:VCALENDAR
*/

### Sample Outlook 2003 iCal invite
/*
    BEGIN:VCALENDAR
    PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
    VERSION:2.0
    METHOD:REQUEST
    BEGIN:VEVENT
    ATTENDEE;CN="Anthony 
Rogers";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:[EMAIL PROTECTED]
    

ATTENDEE;[EMAIL PROTECTED];ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:[EMAIL 
PROTECTED]
    

ATTENDEE;[EMAIL PROTECTED];ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:[EMAIL 
PROTECTED]
    DTSTART:20080111T193000Z
    DTEND:20080111T210000Z
    TRANSP:OPAQUE
    SEQUENCE:0
    

UID:040000008200E00074C5B7101A82E008000000005035EA6DAB52C8010000000000000000100
    000007401AA7720FA544DB3F1ADFE59AB3172
    DTSTAMP:20080109T154318Z
    DESCRIPTION:\nSince Cathy and Jes are Pacific Time it will be 11:30 -
    1:00pm for them. \n\n
    SUMMARY:Updated: Web Redesign & HighWire Discussion
    PRIORITY:1
    X-MICROSOFT-CDO-IMPORTANCE:2
    CLASS:PUBLIC
    END:VEVENT
    END:VCALENDAR
*/

# Mandatory fields?
$appname = "App Name";
$dtstart = "20080131T153000Z";
$dtend   = "20080131T170000Z";
$summary = "This is a test summary";
$filename = "Cal_$dtstart.ics";

$summary = str_replace("\r", "=0D=0A=", $summary);

$vCalStart = date("Ymd\THi00", $row['EventStart']);
$vCalEnd = date("Ymd\THi00", $row['EventEnd']);

# Optional fields
$description = "This is a longer description of what the event is all about.  
This part is optional I believe";
$attendees[] = array("Name"=>"", "Role"=>"", "RSVP"=>"", "MailTo"=>"");
$transp = "OPAQUE";
$sequence = "0";
$uid = "";
$dtstamp = "";
$priority = "1";
$xmicrosoftcdoimportance = "2";
$class = "PUBLIC";


header("Content-type: text/calendar");
header("Content-Disposition: inline; filename=$filename");

echo "BEGIN:VCALENDAR\n";
// echo "VERSION:2.0\n";
echo "PRODID:-//$appname//NONSGML v1.0//EN\n";
echo "BEGIN:VEVENT\n";
echo "DTSTART:$dtstart\n";
echo "DTEND:$dtend\n";
echo "SUMMARY:$summary\n";
echo "DESCRIPTION:$description\n";
echo "END:VEVENT\n";
echo "END:VCALENDAR\n";



?>

--- End Message ---
--- Begin Message ---
Alain Roger wrote:
hiChris,

i've read several forums where this mail() function from PHP initial package is not so great.

mail() works fine.

phpmailer (and zendmailer, swiftmailer and other such packages) help you with things like:

- sending through an smtp server
- putting a multipart email together
- adding attachments
- embedding images in your email content

and a whole bunch of other stuff so you don't have to write the code to do all of that.

There's nothing fancy in any of them, and if you don't tell them to send through an smtp server, they use the normal mail() command (in most cases I think anyway).

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

--- End Message ---
--- Begin Message ---
Can you tell me how to do this ?

suppose I have a date variable = '02/23/2008'

i need to know if this is the last friday of february....

let me know.

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: VamVan [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 13, 2008 9:13 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Last Friday of every month
> 
> Can you tell me how to do this ?
> 
> suppose I have a date variable = '02/23/2008'
> 
> i need to know if this is the last friday of february....
> 
> let me know.

My view...

$strDate = '02/23/2008';
//
$intDate = strtotime($strDate);
$numDaysInMonth = date('t', $intDate);
$dayOfWeek = date('w', $intDate);
$dayOfMonth = date('j', $intDate);
If ($dayOfWeek == 5 && $numDaysInMonth - $dayOfMonth < 7) {
        echo "Friday Party!";
} else {
        echo "Sorry dude, you missed it";
}

Btw, read the manual (and don't think to be so lucky to not found any bugs in my
code).

Regards,

Rob(inet)


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4296 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com




--- End Message ---
--- Begin Message ---
VamVan wrote:
Can you tell me how to do this ?

suppose I have a date variable = '02/23/2008'

i need to know if this is the last friday of february....

let me know.

   $month = 3;
   $year = 2008;

for ($day = 31; $day >= 21; $day--) { // maximum of 7 days, but february starts at 28 $tmp_time = mktime(0, 0, 0, $month, $day, $year);

       if (date('w', $tmp_time) === '5') { // 5 = friday
return date('d-m-Y', $tmp_time); // return $day.'-'.$month.'-'.$year; // without the function it is faster off course
           // echo 'Yeah, friday!';
       }
   }

Something similar worked for me to find out when daylight saving time is.
--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other....'/

--- End Message ---
--- Begin Message ---
Stephane Ulysse wrote:
PLEASE STOP EMAILING ME

THEN CLICK THE UNSUBSCRIBE LINK AT THE BOTTOM OF THE EMAIL. IT'S VERY EASY TO DO.

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

--- End Message ---
--- Begin Message ---

When running this same script through apache however, it works fine without
the port directive.  However, I get no results when attempting to connect to
port 8080.  Command line curl works fine too.  It's only when connecting
through apache that my script fails.

Here are some specifics about my environment:

Apache/2.2.3 (Red Hat)

libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
PHP/5.1.6

Any help/suggestions will be *greatly* appreciated!!  This is driving me
nuts!

Your host could have it blocked in the firewall.
It could be SeLinux getting in the way.

Not sure about other suggestions :)

Add a verbose call:

curl_setopt($ch, CURLOPT_VERBOSE, true);

and maybe set the error log for it to use:

curl_setopt($ch, CURLOPT_STDERR, '/path/to/file.log');

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

--- End Message ---
--- Begin Message ---
Hi,

How can I send multiple values from a form to be stored in a database, as
name of the fields is the same?

For example:

<?php
foreach ($field_data as $field) {

         $field_name=$field["field_name"];
         $field_id=$field["field_id"];
         $datatype=$field["datatype_name"];

?>
<input type="hidden" name="field_id" value="<?php echo $field_id;?>" />
<tr>
<td><strong><?php echo $field_name;?><strong></td>
<?php
     if ($datatype=="text" || $datatype=="integer") {
            echo "<td><input type=\"text\" name=\"field_data\"></td>";
     }
     elseif ($datatype=="textarea") {
          echo "<td><textarea rows=\"10\" cols=\"100\"
name=\"field_data\"></textarea><br></td>";
      }
      echo "</tr>";
}
?>

This creates a form with field names and text box or textarea box next to
each field name depending on the datatype. After the user enters the
values in the text or textarea and clicks submit, the values should get
stored in a database. But what is happening is that only the value entered
in the last field of the form is getting entered into the database.
This code is embedded in an application which is having an inbuilt
structure of taking the values from a form in a hash. Since key is the
same (i.e. field_id) everytime, the value gets overwritten and only the
last value gets stored in db. But I am not able to work out a solution for
this.
I hope I am able to make my problem clear enough.

Thanks,
Suamya.



 
-----------------------------------------------------------------------------
DISCLAIMER:- 
          "The information in this e-mail is confidential, and is intended 
solely for the addressee or addressees. If you are not the intended recipient,
 please delete the mail and kindly notify the sender of misdelivery. Any 
unauthorised use or disclosure of the contents of the mail is not permitted 
and may be unlawful."
-----------------------------------------------------------------------------

                         "Scanned By MailScanner"


--- End Message ---

Reply via email to