php-general Digest 20 Feb 2009 10:55:08 -0000 Issue 5969

Topics (messages 288615 through 288629):

Execute flash files with PHP
        288615 by: R B
        288620 by: Chris
        288621 by: Chris
        288622 by: tedd

Re: Unique User Hashes
        288616 by: Martin Zvarík
        288617 by: Chris
        288618 by: Martin Zvarík
        288624 by: Ashley Sheridan
        288625 by: Martin Zvarík

Re: Two troublesome fields
        288619 by: Terion Miller

Re: php cli memory leak error
        288623 by: Jochem Maas

What good is SoapClient->__getTypes() ?
        288626 by: Shanon Swafford

Re: Accessors
        288627 by: Thodoris

Re: Secure File Paths, File System - (simplified question)
        288628 by: Daniel Kolbo

What a VICTORY!!! My bankruptcy is DELETED!
        288629 by: Anselm Cowper

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

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


----------------------------------------------------------------------
--- Begin Message ---
Hello.

I have two scripts in php that reads a .swf or .flv movie file, like this:

SCRIPT # 1

<?php

$movie = "movie.swf";

readfile($movie);
?>

SCRIPT # 2

<?php

$movie = "movie.flv";

readfile($movie);
?>

The script # 1 with the .swf file works fine: the video is executed with
streaming.
The script # 2 with the .flv file  is executed but without streaming.

If i execute the movie.flv directly (without the php script), then it´s
executed with streaming.

Do you know how can i do to execute the .flv file with php and with
straming?
I tried with fopen, readfile, but don´t works.

Thank you

--- End Message ---
--- Begin Message ---
R B wrote:
Hello.

I have two scripts in php that reads a .swf or .flv movie file, like this:

SCRIPT # 1

<?php

$movie = "movie.swf";

readfile($movie);
?>

SCRIPT # 2

<?php

$movie = "movie.flv";

readfile($movie);
?>

The script # 1 with the .swf file works fine: the video is executed with
streaming.
The script # 2 with the .flv file  is executed but without streaming.

If i execute the movie.flv directly (without the php script), then it´s
executed with streaming.

If you change the filetype (from swf to flv) you need to change the headers php sends before it spits out the file.

What headers are you sending?

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


--- End Message ---
--- Begin Message ---
R B wrote:
Hello.

I have two scripts in php that reads a .swf or .flv movie file, like this:

SCRIPT # 1

<?php

$movie = "movie.swf";

readfile($movie);
?>

SCRIPT # 2

<?php

$movie = "movie.flv";

readfile($movie);
?>

The script # 1 with the .swf file works fine: the video is executed with
streaming.
The script # 2 with the .flv file  is executed but without streaming.

There's a tutorial here:

http://www.flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two

(have not tested it myself). The php code is available for download from that page as well.

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


--- End Message ---
--- Begin Message ---
There's a tutorial here:

http://www.flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two

(have not tested it myself). The php code is available for download from that page as well.

And the video there is awesome!

The narrator sounds like the one in my video:

http://webbytedd.com/bb/ice/

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
Chris napsal(a):
Martin Zvarík wrote:
tedd napsal(a):
At 5:28 PM +0100 2/19/09, Martin Zvarík wrote:
tedd napsal(a):
At 5:10 PM +0100 2/19/09, Martin Zvarík wrote:
tedd napsal(a):
At 1:49 AM +0100 2/19/09, Martin Zvarík wrote:
Guys, I have not seen a poll where you need to input your email address - and if I would I would not vote - because it's a waste of my time... if you want me to vote you do everything you can to make it as pleasant as possible -- certainly that isn't requirement of an email validation.
Btw. google "free temporary email address" to see how unique email addresses really are - in case you meant it in reference to the poll voting - where you care about uniqueness of votes = people.

So instead of trolling, offer a better suggestion.
Chris, if you would read the whole thread (my first comment), I bet you would consider more wisely your patronizing comment.
--- End Message ---
--- Begin Message ---
Martin Zvarík wrote:
Chris napsal(a):
Martin Zvarík wrote:
tedd napsal(a):
At 5:28 PM +0100 2/19/09, Martin Zvarík wrote:
tedd napsal(a):
At 5:10 PM +0100 2/19/09, Martin Zvarík wrote:
tedd napsal(a):
At 1:49 AM +0100 2/19/09, Martin Zvarík wrote:
Guys, I have not seen a poll where you need to input your email address - and if I would I would not vote - because it's a waste of my time... if you want me to vote you do everything you can to make it as pleasant as possible -- certainly that isn't requirement of an email validation.
Btw. google "free temporary email address" to see how unique email addresses really are - in case you meant it in reference to the poll voting - where you care about uniqueness of votes = people.

So instead of trolling, offer a better suggestion.
Chris, if you would read the whole thread (my first comment), I bet you would consider more wisely your patronizing comment.

"Use the ip" - which we've all said is useless.
Where's the better suggestion?

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


--- End Message ---
--- Begin Message ---
Chris napsal(a):
Martin Zvarík wrote:
Chris napsal(a):
Martin Zvarík wrote:
tedd napsal(a):
At 5:28 PM +0100 2/19/09, Martin Zvarík wrote:
tedd napsal(a):
At 5:10 PM +0100 2/19/09, Martin Zvarík wrote:
tedd napsal(a):
At 1:49 AM +0100 2/19/09, Martin Zvarík wrote:
Guys, I have not seen a poll where you need to input your email address - and if I would I would not vote - because it's a waste of my time... if you want me to vote you do everything you can to make it as pleasant as possible -- certainly that isn't requirement of an email validation.
Btw. google "free temporary email address" to see how unique email addresses really are - in case you meant it in reference to the poll voting - where you care about uniqueness of votes = people.

So instead of trolling, offer a better suggestion.
Chris, if you would read the whole thread (my first comment), I bet you would consider more wisely your patronizing comment.

"Use the ip" - which we've all said is useless.
Where's the better suggestion?
Nevermind, I was wrong - thank you for making me realize I am wasting time here.

This useless IP solution is used by 80% of websites. I was trying to convice you that requirement of an email validation is just, let's say, unwise. So, don't bark if you don't agree.
--- End Message ---
--- Begin Message ---
On Thu, 2009-02-19 at 23:34 +0100, Martin Zvarík wrote:
> Chris napsal(a):
> > Martin Zvarík wrote:
> >> Chris napsal(a):
> >>> Martin Zvarík wrote:
> >>>> tedd napsal(a):
> >>>>> At 5:28 PM +0100 2/19/09, Martin Zvarík wrote:
> >>>>>> tedd napsal(a):
> >>>>>>> At 5:10 PM +0100 2/19/09, Martin Zvarík wrote:
> >>>>>>>> tedd napsal(a):
> >>>>>>>>> At 1:49 AM +0100 2/19/09, Martin Zvarík wrote:
> >>>>>>>>>> Guys, I have not seen a poll where you need to input your 
> >>>>>>>>>> email address - and if I would I would not vote - because 
> >>>>>>>>>> it's a waste of my time... if you want me to vote you do 
> >>>>>>>>>> everything you can to make it as pleasant as possible -- 
> >>>>>>>>>> certainly that isn't requirement of an email validation.
> >>>> Btw. google "free temporary email address" to see how unique email 
> >>>> addresses really are - in case you meant it in reference to the 
> >>>> poll voting - where you care about uniqueness of votes = people.
> >>>
> >>> So instead of trolling, offer a better suggestion.
> >> Chris, if you would read the whole thread (my first comment), I bet 
> >> you would consider more wisely your patronizing comment.
> >
> > "Use the ip" - which we've all said is useless.
> > Where's the better suggestion?
> Nevermind, I was wrong - thank you for making me realize I am wasting 
> time here.
> 
> This useless IP solution is used by 80% of websites. I was trying to 
> convice you that requirement of an email validation is just, let's say, 
> unwise. So, don't bark if you don't agree.
So you;'e saying that unless we agree with you, not to mention anything?


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
Ashley Sheridan napsal(a):
On Thu, 2009-02-19 at 23:34 +0100, Martin Zvarík wrote:
Chris napsal(a):
Martin Zvarík wrote:
Chris napsal(a):
Martin Zvarík wrote:
tedd napsal(a):
At 5:28 PM +0100 2/19/09, Martin Zvarík wrote:
tedd napsal(a):
At 5:10 PM +0100 2/19/09, Martin Zvarík wrote:
tedd napsal(a):
At 1:49 AM +0100 2/19/09, Martin Zvarík wrote:
Guys, I have not seen a poll where you need to input your email address - and if I would I would not vote - because it's a waste of my time... if you want me to vote you do everything you can to make it as pleasant as possible -- certainly that isn't requirement of an email validation.
Btw. google "free temporary email address" to see how unique email addresses really are - in case you meant it in reference to the poll voting - where you care about uniqueness of votes = people.
So instead of trolling, offer a better suggestion.
Chris, if you would read the whole thread (my first comment), I bet you would consider more wisely your patronizing comment.
"Use the ip" - which we've all said is useless.
Where's the better suggestion?
Nevermind, I was wrong - thank you for making me realize I am wasting time here.

This useless IP solution is used by 80% of websites. I was trying to convice you that requirement of an email validation is just, let's say, unwise. So, don't bark if you don't agree.
So you;'e saying that unless we agree with you, not to mention anything?


Ash
www.ashleysheridan.co.uk
I meant: You don't have to bark, if you don't agree. = We can discuss.

--- End Message ---
--- Begin Message ---
Thanks
Terion

Happy Freecycling
Free the List !!
www.freecycle.org
Over Moderation of Freecycle List Prevents Post Timeliness.
------------------------------------------------
Twitter?
http://twitter.com/terionmiller
------------------------------------------------
Facebook:
<a href="http://www.facebook.com/people/Terion-Miller/1542024891";
title="Terion Miller's Facebook profile" target=_TOP><img src="
http://badge.facebook.com/badge/1542024891.237.919247960.png"; border=0
alt="Terion Miller's Facebook profile"></a>
Emo Philips  - "I was the kid next door's imaginary friend."

On Thu, Feb 19, 2009 at 2:31 PM, Bastien Koert <phps...@gmail.com> wrote:

>
>
> On Thu, Feb 19, 2009 at 3:21 PM, Terion Miller <webdev.ter...@gmail.com>wrote:
>
>> Hi all, I seem to be having a problem with getting two fields to insert
>> into
>> a table, the other fields insert but not these two
>> its from a form that is a duplicate, basically I have a workorder that I
>> want to make a copy of, I call it from the db, populate a form in case
>> changes want to be made, and insert with a new unique ID as a new record,
>> it's working great except Two fields will NOT insert and I'm at a loss for
>> why ...
>> the code is big so I will post snippets that I think may be the trouble
>> spots
>>
>> Here is the insert:
>>    $sql = "INSERT INTO workorders (CreatedDate, Location, WorkOrderName,
>> AdminID, FormName, Status, Notes) VALUES (";
>>    $sql .= "Now(), '$Location', '$WorkOrderName', '$AdminID', 'WorkOrder',
>> 'New Order', '$Notes')";
>>    mysql_query($sql);
>>    $WorkOrderID = mysql_insert_id();
>>
>> Here is the part where it calls the old values:
>>
>>    $sql2 = "SELECT Location, WorkOrderName FROM workorders WHERE
>> WorkOrderID='$WorkOrderID'";
>>    $result2 = mysql_query ($sql2);
>>    $row2 = mysql_fetch_array($result2);
>>
>>
>> Here is the form part:
>>
>>    <tr>
>>                        <td align="left" nowrap><div
>> class="CaptionReq">Property:</div></td>
>>                        <td align="left"><div><input type="hidden"
>> name="Location" value="<?php echo $row2['Location']; ?>"><?php echo
>> $row2['Location']; ?> </div></td>
>>                    </tr>
>>                    <tr>
>>                        <td align="left" nowrap><div
>> class="CaptionReq">Work
>> Order Name: <?php echo $row2['WorkOrderName']; ?></div></td>
>>                        <td align="left"><div><br><input type="hidden"
>> name="WorkOrderName" size="35 " value="<?php echo $row2['WorkOrderName'];
>> ?>"/></div></td>
>>                    </tr>
>>
>> I need some clues, everything works except the two fields Location, and
>> WorkOrderName.....
>>
>> Thanks
>> Terion
>>
>> Happy Freecycling
>> Free the List !!
>> www.freecycle.org
>> Over Moderation of Freecycle List Prevents Post Timeliness.
>> ------------------------------------------------
>> Twitter?
>> http://twitter.com/terionmiller
>> ------------------------------------------------
>> Facebook:
>> <a href="http://www.facebook.com/people/Terion-Miller/1542024891";
>> title="Terion Miller's Facebook profile" target=_TOP><img src="
>> http://badge.facebook.com/badge/1542024891.237.919247960.png"; border=0
>> alt="Terion Miller's Facebook profile"></a>
>> Bill Watterson  - "There is not enough time to do all the nothing we want
>> to
>> do."
>>
>
> Why not try a
>
> insert into table select fields from table where id = $id
>
> --
>
> Bastien
>
> Cat, the other other white meat
>
I just tried this and now it's not inserting at all where before everything
EXCEPT two fields go in...

$sql = "INSERT INTO workorders ( CreatedDate, Location, WorkOrderName,
AdminID, FormName, Status, Notes) VALUES (";

    $sql .= "Now(), ";
    $sql .= "'". mysql_real_escape_string($Location) ."', ";
    $sql .= "'". mysql_real_escape_string($WorkOrderName) ."', ";
    $sql .= "'". mysql_real_escape_string($AdminID) ."', ";
    $sql .= "'". mysql_real_escape_string("WorkOrder") ."', ";
    $sql .= "'". mysql_real_escape_string("New Order") ."', ";
    $sql .= "'". mysql_real_escape_string($Notes) ."', ";

    $WorkOrderID = mysql_insert_id();
    mysql_query($sql);

--- End Message ---
--- Begin Message ---
Lewis Wright schreef:
> 2009/2/19 Jochem Maas <joc...@iamjochem.com>:
>> Thodoris schreef:
>>>>
>>>> seems to work fine here.
>>>>
>>>> What are your php.ini (memory related) settings?
>>>>
>>>> run:
>>>>
>>>> /usr/local/bin/php --ini
>>>>
>>>> and get the location of the php.ini file that is getting used.  Check
>>>> our the memory settings in that file.
>>>>
>>>>
>>>>
>>>>
>>> Some general options:
>>> max_input_time = 60
>>> max_execution_time = 120
>>> memory_limit = 128M
>>>
>>> and the last one I have just noticed (that is why it reports the leak):
>>>
>>> report_memleaks = On
>>>
>>> In case I set this to Off it just stops bugging me. But is there a
>>> memory leak?
>> yes.
>>
>>> And if yes should I report this as a bug ?
>> if (
>>
>>        1. report_memleaks is a core php.ini setting (not suhosin) (I don't 
>> recall)
>>        2. you still get the leak if you disable suhosin extension
>>        3. you can create a small reproduction script (seems you have one, 
>> but I'd
>>           check that it's the getopt() call that triggers the leak)
>>        4. you can show the mem leak in 5.2.9RC2 and/or php5.3dev
>> ) {
>>        report_a_bug();
>> }
>>
> 
> Syntax error, unexpected T_STRING :(
> 

sorry. try this instead:

<?php

if (!function_exists('readline')) {
    function readline( $prompt = '' )
    {
        echo $prompt;
        return rtrim( fgets( STDIN ), "\n" );
    }
}

function makeUserPerformSomeStuff($cmd)
{
    $answer = null;

    echo "compute this: $cmd\n\n";

    while (!in_array(strtolower($answer), array('n','y')))
        $answer = readline("did it compute? [y/n]: ");

    return ($answer == 'y');
}

function report_a_bug()
{
    return makeUserPerformSomeStuff("report a bug.");
}

if (makeUserPerformSomeStuff("
    1. report_memleaks is a core php.ini setting (not suhosin) (I don't recall)
    2. you still get the leak if you disable suhosin extension
    3. you can create a small reproduction script (seems you have one, but I'd
       check that it's the getopt() call that triggers the leak)
    4. you can show the mem leak in 5.2.9RC2 and/or php5.3dev
")) {
    report_a_bug();
}

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

I'm using PHP 5.1.6 and I'm calling a WSDL that has 4 functions.

This is a brand new service opened by one of our vendors so I'm sure it is
going to change.  So I'm thinking I would like to build a page that pulls
the data structures and builds html input forms automatically.

So when I send the following code:

$client = new SoapClient($wsdl, $options);
$available_types = $client->__getTypes();
var_dump($available_types[4]);

I get back:

string(467) "struct ProvisionNewTrunk {
 string DeviceID;
 string DeviceModel;
 string PublicIP;
 string LastName;
 string FirstName;
 string Address1;
 string Address2;
 string City;
 string State;
 string ZIP;
 string Country;
 string Phone;
 string Email;
 string Department;
 string Company;
 string PromotionCode;
 string CCName;
 string CCAddress1;
 string CCAddress2;
 string CCCity;
 string CCState;
 string CCZIP;
 string CCCountry;
 string CCNumber;
 string CCExpDate;
}"

Normally I would just hard-code an array but is there any "automatic" way to
iterate through this so I can build an input form?  Besides hacking up a
str_split or something?

All my googling just turns up mirrors of php.net man pages:(

Thanks a bunch,
Shanon



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

Also, i know php is an interpreted language. But wouldn't it be possible to
write a virtual machine for php and compile byte code... I know, php is not
Java or Actionscript :-P but it could be an add on feature. i guess the eval
wouldn't work then would it? Although eval could still be interpreted...

This would be nice in case you need to protect your intellectual property.

I haven't tried it, but I might soon for an appliance I'm building.

http://www.roadsend.com/


Actually might not have "virtual machine" as java does but it has an engine and it is possible to produce something similar to byte-code. You can some solutions to this and here is one of them (open source):

http://www.php.net/manual/en/ref.bcompiler.php
http://pecl.php.net/package/bcompiler

and there is a script to make "byte-code":

http://bencoder.urdada.net/

I have used and it works.

--
Thodoris


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

Shawn McKenzie wrote:
Daniel Kolbo wrote:
Shawn McKenzie wrote:
Daniel Kolbo wrote:
Hello PHPers,

I am quite ignorant about file system security.   I was hoping you all
could help me understand things.

How does one restrict php script from going (reading, writing) files in
the file system?
As I see it, a php programmer could change the include_path, with
ini_set(), use "../" etc..., and browse all the files on the server to
which the php engine has access.  This would clearly not be acceptable
to a web host company, so how do most hosts restrict this kind of
behaviour?

Now, suppose i only have php access to my 'files' as defined by my host
somehow.  (again, my first part of the question is how do they do
this?).  Is it possible for me to further restrict this file
accessibility for different sub-folders?  Let me provide an example
folder hierarchy and user scenario.
Suppose there are two php programmers (me and you).  I want full access,
but I want to restrict you to your subdomain (subdomain2).

+AllUsers (me and you)
+Domain1
++Subdomain1 (me only)
++Subdomain2 (me and you)
++SharedDomain (me and you)
+ServerFile1 (me only)
+ServerFile2 (me only)
+SecretFile (no user)

Thanks for helping understand how to restrict/limit different php
programmers from going into places I'd rather them not go.
dK

Two methods come to mind, chroot and just setting perms for specific
dirs.

Hello,
1) chroot
I don't understand how to specify to the php engine to chroot upon
different scripts being executed (scripts that i don't control).  Would
you please clarify?
2)perms
The php engine is what has access to specific dirs (not users,
scripts,).  That i know of, the php engine doesn't allow per user
permissions.  That is, it is one engine, one set of perms.  Are you
suggesting i have a separate php engine for each user?

3) Maybe i can simplify this question:  How does a hosting company, in a
shared virtual host server environment, prevent all their clients (php
programmers) from snooping into all the other clients' folders?  I am
assuming we are all using the same php engine, as it is a shared apache
host.


O.K.  I read and typed too fast.  In short, suexec with apache will run
a user's scripts as that user so long as php is run as cgi and not the
apache mod.  Also, virtual hosts in apache define the docroot for a
virtual host (user/domain/etc.), so other virtual hosts can't access
outside of that docroot into other virtual hosts.

So the perms part of my previous reply was related to suexec and chroot
was out of my ass because many times you would chroot apache for extra
security from the webserver in general.

thx for the reply shawn.

--- End Message ---
--- Begin Message ---
Hi!

Today, I have erased two, outstanding "bad debts" totalling almost 10 thousand 
dollars, from my report. They were not mine, but I did not know how to proceed. 
This, alone, will save me THOUSANDS in interest, and more importantly, will 
make me a "good person" again, in "their" eyes.

How I did it? The answer is: Very Easy! I just checked my credit score using 
the free credit report, which is now available for all US citizens, and it is 
offered for absolutely free. You don't have to pay for it, and also you have 
nothing to loose, if you try it - you can only take a benefit of that free 
trial. It is also teaching you how to manage bad debts, how to erase them, and 
even better - how to increase and improve your credit score, that you have had 
so far.

How I ordered this free credit report? I checked their website, and send them 
an email asking them for help, so they send me back the information, asking me 
to let more US people know about that great offer, that is still available, 
even with less supplies, so be quick if you want that too. These are good 
people, you can trust them as I did.

All you have to do is send an email to bostianqueen1...@gmail.com saying that 
you want to order the Free Credit Report too, and they will get back to you 
almost immediately.


I whish you all the best!
from: Free-Of-Debts person











------------------------------------------------------------------
This email has been written and proved to be in compliance with the recently 
established can-spam act law in US. We are not provoking or forcing any person 
in any way to participate in our programs. To participate is your own decision 
and you carry the responsibility of taking further part in this promotion. 
Anyway, if you don't want to receive more good offers from us, you can simply 
Unsubscribe by sending us a notification email to out_of_the_l...@yahoo.com 
with a mail-subject and text "Unsubscribe me", and we will get your email out 
of our list within 10 days.

This message is STRICTLY CONFIDENTIAL and is solely for the individual or 
organisation to whom it is addressed. It may contain PRIVILEGED and 
CONFIDENTIAL information. If you are not the intended recipient, you are hereby 
notified that any dissemination, distribution or copying of this communication 
and its contents is strictly prohibited. If you are not interested in the 
offered promotions, please just don't answer. If you think you have received 
this message and its contents in error, please delete it from your computer, or 
follow the unsubscribing procedure shown above.
------------------------------------------------------------------
                

--- End Message ---

Reply via email to